diff --git a/DEPS b/DEPS index 46c00ed..90b4787 100644 --- a/DEPS +++ b/DEPS
@@ -79,11 +79,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': 'cad0acf4db5b03f9b9bf6afedde162fd1c8c4c92', + 'skia_revision': 'cefc1b97405d7bad2c621987394fc2d0c6300887', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '1880a2eb3a934d7be057cf68e975ce663075f335', + 'v8_revision': '056e82837a1694a21f915498f7c757008de60771', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -103,7 +103,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': 'c8785f736df57d7d20649d803818a30eb55b2ee8', + 'pdfium_revision': 'e53460ff2697299d42518f587c42409b0bd673df', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling openmax_dl # and whatever else without interference from each other. @@ -135,7 +135,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '8273e472c81133bc18ce96b7f3cc16824d937f08', + 'catapult_revision': '7ae2122b3b38635538ce96564b18736a5f5799e8', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -856,7 +856,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + 'a182a9ad3078aca566d8355eabf2d9f56f70ee82', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '2b6f13508ec1b518c9b171f89699ce5c7e19765c', # commit position 21742 + Var('webrtc_git') + '/src.git' + '@' + '52e58524b67a27c8bd6cdf6e66954dab996364f7', # commit position 21742 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d',
diff --git a/android_webview/browser/aw_autofill_client.cc b/android_webview/browser/aw_autofill_client.cc index 8ddee2d4..7ee02cd5 100644 --- a/android_webview/browser/aw_autofill_client.cc +++ b/android_webview/browser/aw_autofill_client.cc
@@ -74,6 +74,10 @@ return nullptr; } +identity::IdentityManager* AwAutofillClient::GetIdentityManager() { + return nullptr; +} + IdentityProvider* AwAutofillClient::GetIdentityProvider() { return nullptr; }
diff --git a/android_webview/browser/aw_autofill_client.h b/android_webview/browser/aw_autofill_client.h index 2173308..e45c015 100644 --- a/android_webview/browser/aw_autofill_client.h +++ b/android_webview/browser/aw_autofill_client.h
@@ -64,6 +64,7 @@ scoped_refptr<autofill::AutofillWebDataService> GetDatabase() override; PrefService* GetPrefs() override; syncer::SyncService* GetSyncService() override; + identity::IdentityManager* GetIdentityManager() override; IdentityProvider* GetIdentityProvider() override; ukm::UkmRecorder* GetUkmRecorder() override; autofill::AddressNormalizer* GetAddressNormalizer() override;
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index dc262d0..35722e09 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc
@@ -387,7 +387,7 @@ Shell::Get()->display_manager()->GetDisplayInfo(display.id()); Shell::Get()->display_configuration_controller()->SetDisplayRotation( display.id(), GetNextRotation(display_info.GetActiveRotation()), - display::Display::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); } void HandleRestoreTab() {
diff --git a/ash/components/ink/OWNERS b/ash/components/ink/OWNERS new file mode 100644 index 0000000..4420a9f --- /dev/null +++ b/ash/components/ink/OWNERS
@@ -0,0 +1,3 @@ +# TODO(dvallet): Add owners once an initial skeleton has landed. + +# COMPONENT: Platform>Apps>Draw \ No newline at end of file
diff --git a/ash/content/display/screen_orientation_controller_chromeos_unittest.cc b/ash/content/display/screen_orientation_controller_chromeos_unittest.cc index e60e636..dc5a6660 100644 --- a/ash/content/display/screen_orientation_controller_chromeos_unittest.cc +++ b/ash/content/display/screen_orientation_controller_chromeos_unittest.cc
@@ -70,7 +70,7 @@ void SetDisplayRotationById(int64_t display_id, display::Display::Rotation rotation) { Shell::Get()->display_manager()->SetDisplayRotation( - display_id, rotation, display::Display::ROTATION_SOURCE_USER); + display_id, rotation, display::Display::RotationSource::USER); } void SetInternalDisplayRotation(display::Display::Rotation rotation) { @@ -643,7 +643,7 @@ ScreenOrientationControllerTestApi( Shell::Get()->screen_orientation_controller()) .SetDisplayRotation(kNewRotation, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(kNewRotation, display_manager() ->GetDisplayInfo(kInternalDisplayId)
diff --git a/ash/display/display_configuration_controller_unittest.cc b/ash/display/display_configuration_controller_unittest.cc index bd2c5a09..4de0111 100644 --- a/ash/display/display_configuration_controller_unittest.cc +++ b/ash/display/display_configuration_controller_unittest.cc
@@ -51,15 +51,15 @@ Shell::Get()->display_manager()->SetDisplayRotation( display.id(), display::Display::ROTATE_0, - display::Display::RotationSource::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); old_screen_rotation_animator->Rotate( - display::Display::ROTATE_90, display::Display::ROTATION_SOURCE_USER, + display::Display::ROTATE_90, display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_SYNC); ScreenRotationAnimator* new_screen_rotation_animator = testapi.GetScreenRotationAnimatorForDisplay(display.id()); new_screen_rotation_animator->Rotate( - display::Display::ROTATE_180, display::Display::ROTATION_SOURCE_USER, + display::Display::ROTATE_180, display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_SYNC); EXPECT_EQ(old_screen_rotation_animator, new_screen_rotation_animator); } @@ -71,7 +71,7 @@ DisplayConfigurationControllerTestApi testapi(controller); controller->SetDisplayRotation( display.id(), display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_ASYNC); EXPECT_EQ(display::Display::ROTATE_180, controller->GetTargetRotation(display.id())); @@ -86,7 +86,7 @@ DisplayConfigurationControllerTestApi testapi(controller); controller->SetDisplayRotation( display.id(), display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_ASYNC); EXPECT_EQ(display::Display::ROTATE_180, controller->GetTargetRotation(display.id()));
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc index 1441ce6..24660a37 100644 --- a/ash/display/display_manager_unittest.cc +++ b/ash/display/display_manager_unittest.cc
@@ -1820,10 +1820,10 @@ display_manager()->SetDisplayRotation(internal_display_id, display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); display_manager()->SetDisplayRotation( internal_display_id, display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); const display::ManagedDisplayInfo info = GetDisplayInfoForId(internal_display_id); @@ -1842,7 +1842,7 @@ display_manager()->SetDisplayRotation( internal_display_id, display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); const display::ManagedDisplayInfo& post_rotation_info = display::test::DisplayManagerTestApi(display_manager()) .GetInternalManagedDisplayInfo(internal_display_id); @@ -2396,7 +2396,7 @@ int64_t primary_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); display_manager()->SetDisplayRotation( primary_id, display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); SetSoftwareMirrorMode(false); } @@ -2807,11 +2807,11 @@ EXPECT_EQ("1150x500", display.size().ToString()); display_manager()->SetDisplayRotation( display.id(), display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ("1150x500", screen->GetPrimaryDisplay().size().ToString()); display_manager()->SetDisplayRotation( display.id(), display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ("1150x500", screen->GetPrimaryDisplay().size().ToString()); UpdateDisplay("400x500"); @@ -3355,9 +3355,9 @@ display_manager()->GetDisplayInfo(id); EXPECT_EQ(display::Display::ROTATE_90, - info.GetRotation(display::Display::ROTATION_SOURCE_USER)); + info.GetRotation(display::Display::RotationSource::USER)); EXPECT_EQ(display::Display::ROTATE_90, - info.GetRotation(display::Display::ROTATION_SOURCE_ACTIVE)); + info.GetRotation(display::Display::RotationSource::ACTIVE)); } TEST_F(DisplayManagerTest, RejectInvalidLayoutData) { @@ -3408,18 +3408,18 @@ display::test::DisplayManagerTestApi(display_manager()) .SetFirstDisplayAsInternalDisplay(); display::Screen* screen = display::Screen::GetScreen(); - EXPECT_EQ(display::Display::ACCELEROMETER_SUPPORT_UNAVAILABLE, + EXPECT_EQ(display::Display::AccelerometerSupport::UNAVAILABLE, screen->GetPrimaryDisplay().accelerometer_support()); display_manager()->set_internal_display_has_accelerometer(true); display_manager()->UpdateDisplays(); - EXPECT_EQ(display::Display::ACCELEROMETER_SUPPORT_AVAILABLE, + EXPECT_EQ(display::Display::AccelerometerSupport::AVAILABLE, screen->GetPrimaryDisplay().accelerometer_support()); UpdateDisplay("1000x1000,800x800"); - EXPECT_EQ(display::Display::ACCELEROMETER_SUPPORT_AVAILABLE, + EXPECT_EQ(display::Display::AccelerometerSupport::AVAILABLE, screen->GetPrimaryDisplay().accelerometer_support()); - EXPECT_EQ(display::Display::ACCELEROMETER_SUPPORT_UNAVAILABLE, + EXPECT_EQ(display::Display::AccelerometerSupport::UNAVAILABLE, display_manager()->GetSecondaryDisplay().accelerometer_support()); // Secondary is now primary and should not have accelerometer support. @@ -3428,7 +3428,7 @@ display::CreateDisplayInfo(display_manager()->GetSecondaryDisplay().id(), gfx::Rect(1, 1, 100, 100))); display_manager()->OnNativeDisplaysChanged(display_info_list); - EXPECT_EQ(display::Display::ACCELEROMETER_SUPPORT_UNAVAILABLE, + EXPECT_EQ(display::Display::AccelerometerSupport::UNAVAILABLE, screen->GetPrimaryDisplay().accelerometer_support()); // Re-enable internal display. @@ -3436,7 +3436,7 @@ display_info_list.push_back(display::CreateDisplayInfo( display::Display::InternalDisplayId(), gfx::Rect(1, 1, 100, 100))); display_manager()->OnNativeDisplaysChanged(display_info_list); - EXPECT_EQ(display::Display::ACCELEROMETER_SUPPORT_AVAILABLE, + EXPECT_EQ(display::Display::AccelerometerSupport::AVAILABLE, screen->GetPrimaryDisplay().accelerometer_support()); } @@ -3693,7 +3693,7 @@ // Rotate to portrait in clamshell. configuration_controller->SetDisplayRotation( screen->GetPrimaryDisplay().id(), display::Display::ROTATE_270, - display::Display::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); EXPECT_EQ(display::Display::ROTATE_270, screen->GetPrimaryDisplay().rotation()); EXPECT_FALSE(display_manager->registered_internal_display_rotation_lock()); @@ -3893,7 +3893,7 @@ // Emulate that Animator is calling this async when animation is completed. display_manager->SetDisplayRotation( screen->GetPrimaryDisplay().id(), display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACCELEROMETER); + display::Display::RotationSource::ACCELEROMETER); EXPECT_EQ(display::Display::ROTATE_90, screen->GetPrimaryDisplay().rotation());
diff --git a/ash/display/root_window_transformers_unittest.cc b/ash/display/root_window_transformers_unittest.cc index edbd8157..6de0fd37 100644 --- a/ash/display/root_window_transformers_unittest.cc +++ b/ash/display/root_window_transformers_unittest.cc
@@ -172,7 +172,7 @@ display_manager()->SetDisplayRotation( display1.id(), display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); // Move the cursor to the center of the first root window. generator1.MoveMouseToInHost(59, 100); @@ -199,7 +199,7 @@ display_manager()->SetDisplayRotation( display2_id, display::Display::ROTATE_270, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); // Move the cursor to the center of the second root window. generator2.MoveMouseToInHost(151, 199); @@ -220,7 +220,7 @@ display_manager()->SetDisplayRotation( display1.id(), display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); // Move the cursor to the center of the first root window. generator1.MoveMouseToInHost(59, 99);
diff --git a/ash/display/screen_orientation_controller_chromeos.cc b/ash/display/screen_orientation_controller_chromeos.cc index 9dd8e6c..d5792ed 100644 --- a/ash/display/screen_orientation_controller_chromeos.cc +++ b/ash/display/screen_orientation_controller_chromeos.cc
@@ -204,7 +204,7 @@ SetRotationLockedInternal(false); if (user_rotation_ != current_rotation_) { SetDisplayRotation(user_rotation_, - display::Display::ROTATION_SOURCE_ACCELEROMETER, + display::Display::RotationSource::ACCELEROMETER, DisplayConfigurationController::ANIMATION_SYNC); } } @@ -341,7 +341,7 @@ // TODO(oshima): Remove if when current_rotation_ is removed. if (current_rotation_ != user_rotation_) { SetDisplayRotation(user_rotation_, - display::Display::ROTATION_SOURCE_ACCELEROMETER, + display::Display::RotationSource::ACCELEROMETER, DisplayConfigurationController::ANIMATION_SYNC); } for (auto& observer : observers_) @@ -413,12 +413,12 @@ case blink::kWebScreenOrientationLockPortraitSecondary: LockRotation( OrientationToRotation(natural_orientation_, lock_orientation), - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); break; case blink::kWebScreenOrientationLockNatural: LockRotation(display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); break; default: NOTREACHED(); @@ -442,7 +442,7 @@ SetRotationLockedInternal(true); } else { LockRotation(display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); } } else { if (rotation == display::Display::ROTATE_90 || @@ -454,7 +454,7 @@ natural_orientation_ == blink::kWebScreenOrientationLockLandscape ? display::Display::ROTATE_270 // portrait in landscape device. : display::Display::ROTATE_90; // landscape in portrait device. - LockRotation(default_rotation, display::Display::ROTATION_SOURCE_ACTIVE); + LockRotation(default_rotation, display::Display::RotationSource::ACTIVE); } } } @@ -507,7 +507,7 @@ if (new_rotation != current_rotation_ && IsRotationAllowedInLockedState(new_rotation)) { SetDisplayRotation(new_rotation, - display::Display::ROTATION_SOURCE_ACCELEROMETER); + display::Display::RotationSource::ACCELEROMETER); } }
diff --git a/ash/display/window_tree_host_manager_unittest.cc b/ash/display/window_tree_host_manager_unittest.cc index fea5218..063fb2e4 100644 --- a/ash/display/window_tree_host_manager_unittest.cc +++ b/ash/display/window_tree_host_manager_unittest.cc
@@ -543,7 +543,7 @@ CreateDisplayInfo(int64_t id, int y, display::Display::Rotation rotation) { display::ManagedDisplayInfo info(id, "", false); info.SetBounds(gfx::Rect(0, y, 500, 500)); - info.SetRotation(rotation, display::Display::ROTATION_SOURCE_ACTIVE); + info.SetRotation(rotation, display::Display::RotationSource::ACTIVE); return info; } @@ -668,14 +668,14 @@ int64_t primary_id = GetPrimaryDisplay().id(); display_manager()->SetDisplayRotation( primary_id, display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(1, observer.GetRotationChangedCountAndReset()); EXPECT_EQ(1, observer.CountAndReset()); EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); display_manager()->SetDisplayRotation( primary_id, display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(0, observer.GetRotationChangedCountAndReset()); EXPECT_EQ(0, observer.CountAndReset()); EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); @@ -1223,7 +1223,7 @@ display_manager()->SetDisplayRotation( display1.id(), display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ("200x120", root_windows[0]->bounds().size().ToString()); EXPECT_EQ("150x200", root_windows[1]->bounds().size().ToString()); EXPECT_EQ("200,0 150x200", @@ -1243,7 +1243,7 @@ display_manager()->SetDisplayRotation( display2_id, display::Display::ROTATE_270, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ("200x120", root_windows[0]->bounds().size().ToString()); EXPECT_EQ("200x150", root_windows[1]->bounds().size().ToString()); EXPECT_EQ("50,120 200x150", @@ -1259,7 +1259,7 @@ EXPECT_EQ("180,25", event_handler.GetLocationAndReset()); display_manager()->SetDisplayRotation( display1.id(), display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ("120x200", root_windows[0]->bounds().size().ToString()); EXPECT_EQ("200x150", root_windows[1]->bounds().size().ToString());
diff --git a/ash/login/ui/lock_contents_view_unittest.cc b/ash/login/ui/lock_contents_view_unittest.cc index 953755a..a01c086 100644 --- a/ash/login/ui/lock_contents_view_unittest.cc +++ b/ash/login/ui/lock_contents_view_unittest.cc
@@ -146,21 +146,21 @@ // Start at 0 degrees (landscape). display_manager()->SetDisplayRotation( display.id(), display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); int distance_0deg = calculate_distance(); EXPECT_NE(distance_0deg, 0); // Rotate the display to 90 degrees (portrait). display_manager()->SetDisplayRotation( display.id(), display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); int distance_90deg = calculate_distance(); EXPECT_GT(distance_0deg, distance_90deg); // Rotate the display back to 0 degrees (landscape). display_manager()->SetDisplayRotation( display.id(), display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); int distance_180deg = calculate_distance(); EXPECT_EQ(distance_0deg, distance_180deg); EXPECT_NE(distance_0deg, distance_90deg); @@ -186,19 +186,19 @@ // Start at 0 degrees (landscape). display_manager()->SetDisplayRotation( display.id(), display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(contents->height(), users_list->height()); // Rotate the display to 90 degrees (portrait). display_manager()->SetDisplayRotation( display.id(), display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(contents->height(), users_list->height()); // Rotate the display back to 0 degrees (landscape). display_manager()->SetDisplayRotation( display.id(), display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(contents->height(), users_list->height()); } @@ -235,21 +235,21 @@ // Start at 0 degrees (landscape). display_manager()->SetDisplayRotation( display.id(), display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(top_margin(), bottom_margin()); EXPECT_EQ(users_list->height(), users_list->contents()->height()); // Rotate the display to 90 degrees (portrait). display_manager()->SetDisplayRotation( display.id(), display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(top_margin(), bottom_margin()); EXPECT_EQ(users_list->height(), users_list->contents()->height()); // Rotate the display back to 0 degrees (landscape). display_manager()->SetDisplayRotation( display.id(), display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(top_margin(), bottom_margin()); EXPECT_EQ(users_list->height(), users_list->contents()->height()); }
diff --git a/ash/metrics/pointer_metrics_recorder_unittest.cc b/ash/metrics/pointer_metrics_recorder_unittest.cc index 71157fb..dc06560 100644 --- a/ash/metrics/pointer_metrics_recorder_unittest.cc +++ b/ash/metrics/pointer_metrics_recorder_unittest.cc
@@ -97,7 +97,7 @@ Shell::Get()->screen_orientation_controller()); // Set the screen orientation. test_api.SetDisplayRotation(rotation, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); } pointer_metrics_recorder_->OnPointerEventObserved(pointer_event, gfx::Point(), window);
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc index 92c80a7..f7e5f1b 100644 --- a/ash/root_window_controller_unittest.cc +++ b/ash/root_window_controller_unittest.cc
@@ -725,14 +725,14 @@ Shell::Get()->display_manager()->GetSecondaryDisplay(); display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .SetTouchSupport(secondary_display.id(), - display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE); + display::Display::TouchSupport::AVAILABLE); // The primary display doesn't have touch capability and the secondary display // does. - ASSERT_NE(display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE, + ASSERT_NE(display::Display::TouchSupport::AVAILABLE, display::Screen::GetScreen()->GetPrimaryDisplay().touch_support()); ASSERT_EQ( - display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE, + display::Display::TouchSupport::AVAILABLE, Shell::Get()->display_manager()->GetSecondaryDisplay().touch_support()); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); @@ -777,18 +777,18 @@ display::Screen::GetScreen()->GetPrimaryDisplay().id(); display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .SetTouchSupport(primary_display_id, - display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE); + display::Display::TouchSupport::AVAILABLE); const int64_t secondary_display_id = Shell::Get()->display_manager()->GetSecondaryDisplay().id(); display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .SetTouchSupport(secondary_display_id, - display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE); + display::Display::TouchSupport::AVAILABLE); // Both of displays have touch capability. - ASSERT_EQ(display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE, + ASSERT_EQ(display::Display::TouchSupport::AVAILABLE, display::Screen::GetScreen()->GetPrimaryDisplay().touch_support()); ASSERT_EQ( - display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE, + display::Display::TouchSupport::AVAILABLE, Shell::Get()->display_manager()->GetSecondaryDisplay().touch_support()); aura::Window::Windows root_windows = Shell::GetAllRootWindows();
diff --git a/ash/rotator/screen_rotation_animator_unittest.cc b/ash/rotator/screen_rotation_animator_unittest.cc index d1a2e5a..a454d66 100644 --- a/ash/rotator/screen_rotation_animator_unittest.cc +++ b/ash/rotator/screen_rotation_animator_unittest.cc
@@ -46,8 +46,7 @@ void SetDisplayRotation(int64_t display_id, display::Display::Rotation rotation) { Shell::Get()->display_manager()->SetDisplayRotation( - display_id, rotation, - display::Display::RotationSource::ROTATION_SOURCE_USER); + display_id, rotation, display::Display::RotationSource::USER); } OverviewButtonTray* GetTray() { @@ -268,7 +267,7 @@ EXPECT_FALSE(observer.notified()); animator()->Rotate(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_SYNC); EXPECT_FALSE(observer.notified()); @@ -285,12 +284,12 @@ EXPECT_FALSE(observer.notified()); animator()->Rotate(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_SYNC); EXPECT_FALSE(observer.notified()); animator()->Rotate(display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_SYNC); EXPECT_FALSE(observer.notified()); @@ -303,7 +302,7 @@ TEST_F(ScreenRotationAnimatorSlowAnimationTest, RotatesToDifferentRotation) { SetDisplayRotation(display_id(), display::Display::ROTATE_0); animator()->Rotate(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_SYNC); EXPECT_TRUE(test_api()->HasActiveAnimations()); @@ -315,7 +314,7 @@ ShouldNotRotateTheSameRotation) { SetDisplayRotation(display_id(), display::Display::ROTATE_0); animator()->Rotate(display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_SYNC); EXPECT_FALSE(test_api()->HasActiveAnimations()); } @@ -326,13 +325,13 @@ TEST_F(ScreenRotationAnimatorSlowAnimationTest, RotatesDuringRotation) { SetDisplayRotation(display_id(), display::Display::ROTATE_0); animator()->Rotate(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_SYNC); EXPECT_TRUE(animator()->IsRotating()); EXPECT_EQ(display::Display::ROTATE_90, animator()->GetTargetRotation()); animator()->Rotate(display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_SYNC); EXPECT_TRUE(test_api()->HasActiveAnimations()); EXPECT_TRUE(animator()->IsRotating()); @@ -350,17 +349,17 @@ TEST_F(ScreenRotationAnimatorSlowAnimationTest, ShouldCompleteAnimations) { SetDisplayRotation(display_id(), display::Display::ROTATE_0); animator()->Rotate(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_SYNC); EXPECT_TRUE(test_api()->HasActiveAnimations()); animator()->Rotate(display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_SYNC); EXPECT_TRUE(test_api()->HasActiveAnimations()); animator()->Rotate(display::Display::ROTATE_270, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_SYNC); EXPECT_TRUE(test_api()->HasActiveAnimations()); @@ -386,7 +385,7 @@ ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); SetDisplayRotation(display_id(), display::Display::ROTATE_0); animator()->Rotate(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_SYNC); EXPECT_FALSE(GetTray()->visible()); @@ -404,7 +403,7 @@ base::Unretained(this))); SetDisplayRotation(display_id, display::Display::ROTATE_0); animator()->Rotate(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_ASYNC); EXPECT_TRUE(animator()->IsRotating()); @@ -441,7 +440,7 @@ run_loop_->QuitWhenIdleClosure()); SetDisplayRotation(secondary_display_id, display::Display::ROTATE_0); animator()->Rotate(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_ASYNC); WaitForCopyCallback(); EXPECT_EQ(1U, display_manager()->GetNumDisplays()); @@ -467,7 +466,7 @@ run_loop_->QuitWhenIdleClosure()); SetDisplayRotation(primary_display_id, display::Display::ROTATE_0); animator()->Rotate(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_ASYNC); WaitForCopyCallback(); EXPECT_EQ(1U, display_manager()->GetNumDisplays()); @@ -491,7 +490,7 @@ base::Unretained(this), "640x480")); SetDisplayRotation(secondary_display_id, display::Display::ROTATE_0); animator()->Rotate(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_ASYNC); WaitForCopyCallback(); EXPECT_EQ(1U, display_manager()->GetNumDisplays()); @@ -517,7 +516,7 @@ base::Unretained(this), "640x480")); SetDisplayRotation(primary_display_id, display::Display::ROTATE_0); animator()->Rotate(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_ASYNC); WaitForCopyCallback(); EXPECT_EQ(1U, display_manager()->GetNumDisplays()); @@ -543,7 +542,7 @@ run_loop_->QuitWhenIdleClosure()); SetDisplayRotation(secondary_display_id, display::Display::ROTATE_0); animator()->Rotate(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_ASYNC); WaitForCopyCallback(); EXPECT_EQ(1U, display_manager()->GetNumDisplays()); @@ -575,7 +574,7 @@ base::Unretained(this))); SetDisplayRotation(display_id, display::Display::ROTATE_0); animator()->Rotate(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_ASYNC); WaitForCopyCallback(); @@ -596,7 +595,7 @@ base::Unretained(this))); SetDisplayRotation(display_id, display::Display::ROTATE_0); animator()->Rotate(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_ASYNC); WaitForCopyCallback(); EXPECT_TRUE(test_api()->HasActiveAnimations()); @@ -612,7 +611,7 @@ // Should work for another rotation. animator()->Rotate(display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_USER, + display::Display::RotationSource::USER, DisplayConfigurationController::ANIMATION_ASYNC); WaitForCopyCallback(); EXPECT_TRUE(test_api()->HasActiveAnimations()); @@ -644,7 +643,7 @@ ScreenOrientationControllerTestApi( Shell::Get()->screen_orientation_controller()) .SetDisplayRotation(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACCELEROMETER); + display::Display::RotationSource::ACCELEROMETER); EXPECT_TRUE(animator->IsRotating()); display_manager()->UpdateDisplays();
diff --git a/ash/shelf/shelf_controller_unittest.cc b/ash/shelf/shelf_controller_unittest.cc index 5e8f450..bb96149e 100644 --- a/ash/shelf/shelf_controller_unittest.cc +++ b/ash/shelf/shelf_controller_unittest.cc
@@ -471,7 +471,7 @@ // Verify that screen rotation does not change alignment or auto-hide. display_manager()->SetDisplayRotation( display::Screen::GetScreen()->GetPrimaryDisplay().id(), - display::Display::ROTATE_90, display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::ROTATE_90, display::Display::RotationSource::ACTIVE); EXPECT_EQ(SHELF_ALIGNMENT_BOTTOM, shelf->alignment()); EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
diff --git a/ash/system/screen_layout_observer.cc b/ash/system/screen_layout_observer.cc index 4d8bd4a4..f6a10ab0 100644 --- a/ash/system/screen_layout_observer.cc +++ b/ash/system/screen_layout_observer.cc
@@ -305,7 +305,7 @@ continue; // b) the source is accelerometer. if (iter.second.active_rotation_source() == - display::Display::ROTATION_SOURCE_ACCELEROMETER) { + display::Display::RotationSource::ACCELEROMETER) { continue; } // c) if the device is in tablet mode, and source is not user. @@ -313,7 +313,7 @@ ->tablet_mode_controller() ->IsTabletModeWindowManagerEnabled() && iter.second.active_rotation_source() != - display::Display::ROTATION_SOURCE_USER) { + display::Display::RotationSource::USER) { continue; }
diff --git a/ash/system/screen_layout_observer_unittest.cc b/ash/system/screen_layout_observer_unittest.cc index 54e028c..7c8e846 100644 --- a/ash/system/screen_layout_observer_unittest.cc +++ b/ash/system/screen_layout_observer_unittest.cc
@@ -587,14 +587,14 @@ // The accelerometer source. display_manager()->SetDisplayRotation( primary_id, display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACCELEROMETER); + display::Display::RotationSource::ACCELEROMETER); EXPECT_TRUE(GetDisplayNotificationText().empty()); EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); // The user source. display_manager()->SetDisplayRotation(primary_id, display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); EXPECT_EQ(l10n_util::GetStringFUTF16( IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetFirstDisplayName(), l10n_util::GetStringUTF16( @@ -604,7 +604,7 @@ // The active source. display_manager()->SetDisplayRotation( primary_id, display::Display::ROTATE_270, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(l10n_util::GetStringFUTF16( IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetFirstDisplayName(), l10n_util::GetStringUTF16( @@ -617,13 +617,13 @@ // The accelerometer source. display_manager()->SetDisplayRotation( primary_id, display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACCELEROMETER); + display::Display::RotationSource::ACCELEROMETER); EXPECT_TRUE(GetDisplayNotificationText().empty()); // The user source. display_manager()->SetDisplayRotation(primary_id, display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); EXPECT_EQ(l10n_util::GetStringFUTF16( IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetFirstDisplayName(), l10n_util::GetStringUTF16( @@ -633,7 +633,7 @@ // The active source. display_manager()->SetDisplayRotation( primary_id, display::Display::ROTATE_270, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_TRUE(GetDisplayNotificationText().empty()); }
diff --git a/ash/virtual_keyboard_controller.cc b/ash/virtual_keyboard_controller.cc index 5f48c39..c950995 100644 --- a/ash/virtual_keyboard_controller.cc +++ b/ash/virtual_keyboard_controller.cc
@@ -54,8 +54,7 @@ void MoveKeyboardToFirstTouchableDisplay() { // Move the keyboard to the first display with touch capability. for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) { - if (display.touch_support() == - display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE) { + if (display.touch_support() == display::Display::TouchSupport::AVAILABLE) { MoveKeyboardToDisplayInternal(display.id()); return; } @@ -148,14 +147,14 @@ if (current_display.id() != focused_display.id() && focused_display.id() != display::kInvalidDisplayId && focused_display.touch_support() == - display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE) { + display::Display::TouchSupport::AVAILABLE) { MoveKeyboardToDisplayInternal(focused_display.id()); return; } } if (current_display.touch_support() != - display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE) { + display::Display::TouchSupport::AVAILABLE) { // The keyboard is currently on the display without touch capability. MoveKeyboardToFirstTouchableDisplay(); }
diff --git a/ash/wm/lock_layout_manager_unittest.cc b/ash/wm/lock_layout_manager_unittest.cc index 12ed4e28..d59c559 100644 --- a/ash/wm/lock_layout_manager_unittest.cc +++ b/ash/wm/lock_layout_manager_unittest.cc
@@ -251,13 +251,13 @@ ShowKeyboard(false); display_manager()->SetDisplayRotation( primary_display.id(), display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); primary_display = display::Screen::GetScreen()->GetPrimaryDisplay(); screen_bounds = primary_display.bounds(); EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); display_manager()->SetDisplayRotation( primary_display.id(), display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); // When virtual keyboard overscroll is disabled keyboard bounds do // affect window bounds.
diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc index 441c4a3..72ff4e6c 100644 --- a/ash/wm/overview/window_selector_unittest.cc +++ b/ash/wm/overview/window_selector_unittest.cc
@@ -2128,7 +2128,7 @@ const display::Display& display = screen->GetPrimaryDisplay(); display_manager()->SetDisplayRotation( display.id(), display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); // Verify that |wide| has its window dimension type updated after the display // change. EXPECT_EQ(ScopedTransformOverviewWindow::GridWindowFillMode::kNormal, @@ -3077,7 +3077,7 @@ // Set the screen orientation to LANDSCAPE_PRIMARY. test_api.SetDisplayRotation(display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(test_api.GetCurrentOrientation(), blink::kWebScreenOrientationLockLandscapePrimary); @@ -3109,7 +3109,7 @@ // Rotate the screen by 270 degree. test_api.SetDisplayRotation(display::Display::ROTATE_270, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(test_api.GetCurrentOrientation(), blink::kWebScreenOrientationLockPortraitPrimary); ToggleOverview(); @@ -3134,7 +3134,7 @@ // Rotate the screen by 180 degree. test_api.SetDisplayRotation(display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(test_api.GetCurrentOrientation(), blink::kWebScreenOrientationLockLandscapeSecondary); ToggleOverview(); @@ -3159,7 +3159,7 @@ // Rotate the screen by 90 degree. test_api.SetDisplayRotation(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(test_api.GetCurrentOrientation(), blink::kWebScreenOrientationLockPortraitSecondary); ToggleOverview();
diff --git a/ash/wm/splitview/split_view_controller_unittest.cc b/ash/wm/splitview/split_view_controller_unittest.cc index fdc51b1f..6ad04f0 100644 --- a/ash/wm/splitview/split_view_controller_unittest.cc +++ b/ash/wm/splitview/split_view_controller_unittest.cc
@@ -784,7 +784,7 @@ // Set the screen orientation to LANDSCAPE_PRIMARY. test_api.SetDisplayRotation(display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(test_api.GetCurrentOrientation(), blink::kWebScreenOrientationLockLandscapePrimary); @@ -809,7 +809,7 @@ // Rotate the screen by 270 degree. test_api.SetDisplayRotation(display::Display::ROTATE_270, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(test_api.GetCurrentOrientation(), blink::kWebScreenOrientationLockPortraitPrimary); @@ -827,7 +827,7 @@ // Rotate the screen by 180 degree. test_api.SetDisplayRotation(display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(test_api.GetCurrentOrientation(), blink::kWebScreenOrientationLockLandscapeSecondary); @@ -845,7 +845,7 @@ // Rotate the screen by 90 degree. test_api.SetDisplayRotation(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(test_api.GetCurrentOrientation(), blink::kWebScreenOrientationLockPortraitSecondary); bounds_window1 = window1->GetBoundsInScreen(); @@ -862,7 +862,7 @@ // Rotate the screen back to 0 degree. test_api.SetDisplayRotation(display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(test_api.GetCurrentOrientation(), blink::kWebScreenOrientationLockLandscapePrimary); bounds_window1 = window1->GetBoundsInScreen(); @@ -928,7 +928,7 @@ // Set the screen orientation to LANDSCAPE_PRIMARY test_api.SetDisplayRotation(display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(test_api.GetCurrentOrientation(), blink::kWebScreenOrientationLockLandscapePrimary); @@ -955,7 +955,7 @@ // Rotate the screen by 270 degree. test_api.SetDisplayRotation(display::Display::ROTATE_270, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(test_api.GetCurrentOrientation(), blink::kWebScreenOrientationLockPortraitPrimary); @@ -981,7 +981,7 @@ // Rotate the screen by 180 degree. test_api.SetDisplayRotation(display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(test_api.GetCurrentOrientation(), blink::kWebScreenOrientationLockLandscapeSecondary); @@ -1008,7 +1008,7 @@ // Rotate the screen by 90 degree. test_api.SetDisplayRotation(display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(test_api.GetCurrentOrientation(), blink::kWebScreenOrientationLockPortraitSecondary);
diff --git a/base/bind.h b/base/bind.h index b57a969c..aab682896 100644 --- a/base/bind.h +++ b/base/bind.h
@@ -13,8 +13,32 @@ // Usage documentation // ----------------------------------------------------------------------------- // -// See //docs/callback.md for documentation. +// Overview: +// base::BindOnce() and base::BindRepeating() are helpers for creating +// base::OnceCallback and base::RepeatingCallback objects respectively. // +// For a runnable object of n-arity, the base::Bind*() family allows partial +// application of the first m arguments. The remaining n - m arguments must be +// passed when invoking the callback with Run(). +// +// // The first argument is bound at callback creation; the remaining +// // two must be passed when calling Run() on the callback object. +// base::OnceCallback<void(int, long)> cb = base::BindOnce( +// [](short x, int y, long z) { return x * y * z; }, 42); +// +// When binding to a method, the receiver object must also be specified at +// callback creation time. When Run() is invoked, the method will be invoked on +// the specified receiver object. +// +// class C : public base::RefCounted<C> { void F(); }; +// auto instance = base::MakeRefCounted<C>(); +// auto cb = base::BindOnce(&C::F, instance); +// cb.Run(); // Identical to instance->F() +// +// base::Bind is currently a type alias for base::BindRepeating(). In the +// future, we expect to flip this to default to base::BindOnce(). +// +// See //docs/callback.md for the full documentation. // // ----------------------------------------------------------------------------- // Implementation notes
diff --git a/base/callback.h b/base/callback.h index c5b2e60f9..e9c5a0b 100644 --- a/base/callback.h +++ b/base/callback.h
@@ -1,6 +1,9 @@ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// +// NOTE: Header files that do not require the full definition of Callback or +// Closure should #include "base/callback_forward.h" instead of this file. #ifndef BASE_CALLBACK_H_ #define BASE_CALLBACK_H_ @@ -8,14 +11,41 @@ #include "base/callback_forward.h" #include "base/callback_internal.h" -// NOTE: Header files that do not require the full definition of Callback or -// Closure should #include "base/callback_forward.h" instead of this file. - // ----------------------------------------------------------------------------- // Usage documentation // ----------------------------------------------------------------------------- // -// See //docs/callback.md for documentation. +// Overview: +// A callback is similar in concept to a function pointer: it wraps a runnable +// object such as a function, method, lambda, or even another callback, allowing +// the runnable object to be invoked later via the callback object. +// +// Unlike function pointers, callbacks are created with base::BindOnce() or +// base::BindRepeating() and support partial function application. +// +// A base::OnceCallback may be Run() at most once; a base::RepeatingCallback may +// be Run() any number of times. |is_null()| is guaranteed to return true for a +// moved-from callback. +// +// // The lambda takes two arguments, but the first argument |x| is bound at +// // callback creation. +// base::OnceCallback<int(int)> cb = base::BindOnce([] (int x, int y) { +// return x + y; +// }, 1); +// // Run() only needs the remaining unbound argument |y|. +// printf("1 + 2 = %d\n", std::move(cb).Run(2)); // Prints 3 +// printf("cb is null? %s\n", cb ? "true" : "false"); // Prints true +// std::move(cb).Run(2); // Crashes since |cb| has already run. +// +// Callbacks also support cancellation. A common use is binding the receiver +// object as a WeakPtr<T>. If that weak pointer is invalidated, calling Run() +// will be a no-op. Note that |is_cancelled()| and |is_null()| are distinct: +// simply cancelling a callback will not also make it null. +// +// base::Callback is currently a type alias for base::RepeatingCallback. In the +// future, we expect to flip this to default to base::OnceCallback. +// +// See //docs/callback.md for the full documentation. namespace base {
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni index 61a4dfb2..54b2b2d 100644 --- a/build/config/android/internal_rules.gni +++ b/build/config/android/internal_rules.gni
@@ -1289,6 +1289,8 @@ } inputs += [ _android_sdk_ijar ] args = [ + "--depfile", + rebase_path(depfile, root_build_dir), "--input-jar", rebase_path(_desugar_input_jar, root_build_dir), "--output-jar",
diff --git a/cc/OWNERS b/cc/OWNERS index 42a4666..169e4a1 100644 --- a/cc/OWNERS +++ b/cc/OWNERS
@@ -46,9 +46,9 @@ weiliangc@chromium.org # animation -vollick@chromium.org ajuma@chromium.org flackr@chromium.org +smcgruer@chromium.org # images ericrk@chromium.org
diff --git a/cc/animation/OWNERS b/cc/animation/OWNERS deleted file mode 100644 index d84ea709..0000000 --- a/cc/animation/OWNERS +++ /dev/null
@@ -1,4 +0,0 @@ -loyso@chromium.org - -# TEAM: threaded-rendering-dev@chromium.org -# COMPONENT: Internals>Compositing>Animation
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc index ec7bc773c..bc1573be 100644 --- a/cc/layers/picture_layer_impl.cc +++ b/cc/layers/picture_layer_impl.cc
@@ -278,13 +278,14 @@ gfx::Rect scaled_visible_layer_rect = shared_quad_state->visible_quad_layer_rect; - Occlusion scaled_occlusion = - draw_properties() - .occlusion_in_content_space.GetOcclusionWithGivenDrawTransform( - shared_quad_state->quad_to_target_transform); + Occlusion occlusion; + // TODO(sunxd): Compute the correct occlusion for mask layers. + if (mask_type_ == Layer::LayerMaskType::NOT_MASK) { + occlusion = draw_properties().occlusion_in_content_space; + } SolidColorLayerImpl::AppendSolidQuads( - render_pass, scaled_occlusion, shared_quad_state, - scaled_visible_layer_rect, raster_source_->GetSolidColor(), + render_pass, occlusion, shared_quad_state, scaled_visible_layer_rect, + raster_source_->GetSolidColor(), !layer_tree_impl()->settings().enable_edge_anti_aliasing, append_quads_data); return;
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc index 34e4f19..327e479 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -3366,6 +3366,39 @@ scoped_refptr<FakeRasterSource> pending_raster_source = FakeRasterSource::CreateFilledSolidColor(layer_bounds); SetupPendingTree(std::move(pending_raster_source), gfx::Size(), Region(), + Layer::LayerMaskType::NOT_MASK); + // Device scale factor should not affect a non-mask solid color layer. + host_impl()->pending_tree()->SetDeviceScaleFactor(2.f); + ActivateTree(); + + { + SCOPED_TRACE("Scaled occlusion"); + gfx::Rect occluded(300, 0, 400, 2000); + impl.AppendQuadsWithOcclusion(active_layer(), occluded); + + size_t partial_occluded_count = 0; + LayerTestCommon::VerifyQuadsAreOccluded(impl.quad_list(), occluded, + &partial_occluded_count); + // Because of the implementation of test helper AppendQuadsWithOcclusion, + // the occlusion will have a scale transform resulted from the device scale + // factor. However, the AppendQuads function will try to tile a solid color + // layer ignoring the scale factor, and its visible layer bounds is 500x500. + // So we end up having 4 partially occluded quads. + EXPECT_EQ(4u, impl.quad_list().size()); + EXPECT_EQ(4u, partial_occluded_count); + } +} + +TEST_F(PictureLayerImplTest, IgnoreOcclusionOnSolidColorMask) { + gfx::Size layer_bounds(1000, 1000); + gfx::Size viewport_size(1000, 1000); + + LayerTestCommon::LayerImplTest impl; + host_impl()->SetViewportSize(viewport_size); + + scoped_refptr<FakeRasterSource> pending_raster_source = + FakeRasterSource::CreateFilledSolidColor(layer_bounds); + SetupPendingTree(std::move(pending_raster_source), gfx::Size(), Region(), Layer::LayerMaskType::MULTI_TEXTURE_MASK); host_impl()->pending_tree()->SetDeviceScaleFactor(2.f); ActivateTree(); @@ -3376,12 +3409,12 @@ impl.AppendQuadsWithOcclusion(active_layer(), occluded); size_t partial_occluded_count = 0; - LayerTestCommon::VerifyQuadsAreOccluded(impl.quad_list(), occluded, + LayerTestCommon::VerifyQuadsAreOccluded(impl.quad_list(), gfx::Rect(), &partial_occluded_count); - // None of the quads shall be occluded and half of them are partially - // occluded. + // None of the quads shall be occluded because mask layers ignores + // occlusion. EXPECT_EQ(16u, impl.quad_list().size()); - EXPECT_EQ(8u, partial_occluded_count); + EXPECT_EQ(0u, partial_occluded_count); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java index 98a3f11..92ee8710 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
@@ -221,6 +221,7 @@ public static final String SEARCH_ENGINE_PROMO_NEW_DEVICE = "SearchEnginePromo.NewDevice"; public static final String MATERIAL_DESIGN_INCOGNITO_NTP = "MaterialDesignIncognitoNTP"; public static final String MODAL_PERMISSION_PROMPTS = "ModalPermissionPrompts"; + public static final String MODAL_PERMISSION_DIALOG_VIEW = "ModalPermissionDialogView"; public static final String NEW_PHOTO_PICKER = "NewPhotoPicker"; public static final String NO_CREDIT_CARD_ABORT = "NoCreditCardAbort"; public static final String NTP_ARTICLE_SUGGESTIONS_EXPANDABLE_HEADER =
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadLocationDialogBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadLocationDialogBridge.java index 54879b11..c65b347 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadLocationDialogBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadLocationDialogBridge.java
@@ -101,6 +101,9 @@ mLocationDialog = null; } + @Override + public void onDismiss() {} + /** * Pass along information from location dialog to native. *
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/jsdialog/JavascriptTabModalDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/jsdialog/JavascriptTabModalDialog.java index fb999040..dc52ee4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/jsdialog/JavascriptTabModalDialog.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/jsdialog/JavascriptTabModalDialog.java
@@ -115,6 +115,9 @@ cancel(); } + @Override + public void onDismiss() {} + /** * Sends notification to native that the user accepts the dialog. * @param promptResult The text edited by user.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/modaldialog/ModalDialogManager.java b/chrome/android/java/src/org/chromium/chrome/browser/modaldialog/ModalDialogManager.java index da571eb..d5079b7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/modaldialog/ModalDialogManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/modaldialog/ModalDialogManager.java
@@ -184,7 +184,7 @@ if (!isShowing()) return; assert dialog == mCurrentPresenter.getModalDialog(); - + dialog.getController().onDismiss(); mCurrentPresenter.setModalDialog(null, null); mCurrentPresenter = null; showNextDialog();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/modaldialog/ModalDialogView.java b/chrome/android/java/src/org/chromium/chrome/browser/modaldialog/ModalDialogView.java index 53d9a5d0..9cafa86 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/modaldialog/ModalDialogView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/modaldialog/ModalDialogView.java
@@ -37,10 +37,15 @@ void onClick(@ButtonType int buttonType); /** - * Handle dismiss event when the dialog is not dismissed by actions on the dialog such as + * Handle cancel event when the dialog is not dismissed by actions on the dialog such as * back press, and on tab modal dialog, tab switcher button click. */ void onCancel(); + + /** + * Handle dismiss event when the dialog is dismissed by actions on the dialog. + */ + void onDismiss(); } /** Parameters that can be used to create a new ModalDialogView. */ @@ -62,6 +67,18 @@ /** Optional: Resource ID of the String to show on the negative button. */ public @StringRes int negativeButtonTextId; + + /** + * Optional: The String to show on the positive button. Note that String + * must be null if positiveButtonTextId is not zero. + */ + public String positiveButtonText; + + /** + * Optional: The String to show on the negative button. Note that String + * must be null if negativeButtonTextId is not zero + */ + public String negativeButtonText; } @IntDef({BUTTON_POSITIVE, BUTTON_NEGATIVE}) @@ -134,18 +151,26 @@ mCustomView.setVisibility(View.GONE); } - if (mParams.positiveButtonTextId == 0) { - mPositiveButton.setVisibility(View.GONE); - } else { + assert(mParams.positiveButtonTextId == 0 || mParams.positiveButtonText == null); + if (mParams.positiveButtonTextId != 0) { mPositiveButton.setText(mParams.positiveButtonTextId); mPositiveButton.setOnClickListener(this); + } else if (mParams.positiveButtonText != null) { + mPositiveButton.setText(mParams.positiveButtonText); + mPositiveButton.setOnClickListener(this); + } else { + mPositiveButton.setVisibility(View.GONE); } - if (mParams.negativeButtonTextId == 0) { - mNegativeButton.setVisibility(View.GONE); - } else { + assert(mParams.negativeButtonTextId == 0 || mParams.negativeButtonText == null); + if (mParams.negativeButtonTextId != 0) { mNegativeButton.setText(mParams.negativeButtonTextId); mNegativeButton.setOnClickListener(this); + } else if (mParams.negativeButtonText != null) { + mNegativeButton.setText(mParams.negativeButtonText); + mNegativeButton.setOnClickListener(this); + } else { + mNegativeButton.setVisibility(View.GONE); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/permissions/PermissionAppModalDialogView.java b/chrome/android/java/src/org/chromium/chrome/browser/permissions/PermissionAppModalDialogView.java new file mode 100644 index 0000000..53f8873 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/permissions/PermissionAppModalDialogView.java
@@ -0,0 +1,74 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.permissions; + +import android.support.v4.widget.TextViewCompat; +import android.text.TextUtils; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.TextView; + +import org.chromium.chrome.R; +import org.chromium.chrome.browser.modaldialog.ModalDialogView; + +/** + * The Permission dialog that is app modal. + */ +public class PermissionAppModalDialogView extends ModalDialogView { + private PermissionDialogDelegate mDialogDelegate; + private View mView; + + /** + * Constructor for the Dialog View. Creates the AlertDialog. + */ + public static PermissionAppModalDialogView create( + Controller controller, PermissionDialogDelegate delegate) { + Params params = new Params(); + params.positiveButtonText = delegate.getPrimaryButtonText(); + params.negativeButtonText = delegate.getSecondaryButtonText(); + return new PermissionAppModalDialogView(controller, params, delegate); + } + + private PermissionAppModalDialogView( + Controller controller, Params params, PermissionDialogDelegate delegate) { + super(controller, params); + mDialogDelegate = delegate; + params.customView = createView(); + } + + @Override + protected void prepareBeforeShow() { + super.prepareBeforeShow(); + TextView messageTextView = (TextView) mView.findViewById(R.id.text); + messageTextView.setText(prepareMainMessageString(mDialogDelegate)); + messageTextView.setVisibility(View.VISIBLE); + messageTextView.announceForAccessibility(mDialogDelegate.getMessageText()); + TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds( + messageTextView, mDialogDelegate.getDrawableId(), 0, 0, 0); + } + + /** + * Prepares the dialog before show. Creates the View inside of the dialog. + */ + private View createView() { + LayoutInflater inflater = LayoutInflater.from(getContext()); + mView = inflater.inflate(R.layout.permission_dialog, null); + return mView; + } + + private CharSequence prepareMainMessageString(final PermissionDialogDelegate delegate) { + String messageText = delegate.getMessageText(); + assert !TextUtils.isEmpty(messageText); + + // TODO(timloh): Currently the strings are shared with infobars, so we for now manually + // remove the full stop (this code catches most but not all languages). Update the strings + // after removing the infobar path. + if (messageText.endsWith(".") || messageText.endsWith("。")) { + messageText = messageText.substring(0, messageText.length() - 1); + } + + return messageText; + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/permissions/PermissionDialogController.java b/chrome/android/java/src/org/chromium/chrome/browser/permissions/PermissionDialogController.java index 4c2f879..d2c68d6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/permissions/PermissionDialogController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/permissions/PermissionDialogController.java
@@ -11,6 +11,9 @@ import org.chromium.base.VisibleForTesting; import org.chromium.base.annotations.CalledByNative; import org.chromium.chrome.browser.ChromeActivity; +import org.chromium.chrome.browser.ChromeFeatureList; +import org.chromium.chrome.browser.modaldialog.ModalDialogManager; +import org.chromium.chrome.browser.modaldialog.ModalDialogView; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet; import org.chromium.chrome.browser.widget.bottomsheet.EmptyBottomSheetObserver; @@ -27,7 +30,8 @@ * visible on the screen at once. Any additional request for a modal permissions dialog is queued, * and will be displayed once the user responds to the current dialog. */ -public class PermissionDialogController implements AndroidPermissionRequester.RequestDelegate { +public class PermissionDialogController + implements AndroidPermissionRequester.RequestDelegate, ModalDialogView.Controller { private static final int NOT_SHOWING = 0; // We don't show prompts while Chrome Home is showing. private static final int PROMPT_PENDING = 1; @@ -42,7 +46,12 @@ private @interface State {} private PermissionDialogView mDialogView; + private PermissionAppModalDialogView mAppModalDialogView; private PermissionDialogDelegate mDialogDelegate; + private ModalDialogManager mModalDialogManager; + private DialogInterface.OnClickListener mPositiveClickListener; + private DialogInterface.OnClickListener mNegativeClickListener; + private DialogInterface.OnDismissListener mDismissListener; // As the PermissionRequestManager handles queueing for a tab and only shows prompts for active // tabs, we typically only have one request. This class only handles multiple requests at once @@ -189,12 +198,10 @@ return; } - mDialogView = new PermissionDialogView(mDialogDelegate); - // Set the buttons to call the appropriate delegate methods. When the dialog is dismissed, // the delegate's native pointers are freed, and the next queued dialog (if any) is // displayed. - DialogInterface.OnClickListener positiveClickListener = + mPositiveClickListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { @@ -202,7 +209,7 @@ mState = PROMPT_ACCEPTED; } }; - DialogInterface.OnClickListener negativeClickListener = + mNegativeClickListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { @@ -213,19 +220,17 @@ // Called when the dialog is dismissed. Interacting with either button in the dialog will // call this handler after the primary/secondary handler. - DialogInterface.OnDismissListener dismissListener = + mDismissListener = new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { mDialogView = null; - if (mDialogDelegate == null) { // We get into here if a tab navigates or is closed underneath the // prompt. mState = NOT_SHOWING; return; } - if (mState == PROMPT_ACCEPTED) { // Request Android permissions if necessary. This will call back into // either onAndroidPermissionAccepted or onAndroidPermissionCanceled, @@ -253,13 +258,20 @@ } } }; - mDialogView.createView(positiveClickListener, negativeClickListener, dismissListener); - mDialogView.show(); + + if (useAppModalDialogView()) { + mModalDialogManager = mDialogDelegate.getTab().getActivity().getModalDialogManager(); + mAppModalDialogView = PermissionAppModalDialogView.create(this, mDialogDelegate); + mModalDialogManager.showDialog(mAppModalDialogView, ModalDialogManager.APP_MODAL); + } else { + mDialogView = new PermissionDialogView(mDialogDelegate); + mDialogView.createView( + mPositiveClickListener, mNegativeClickListener, mDismissListener); + mDialogView.show(); + } mState = PROMPT_OPEN; } - - public void dismissFromNative(PermissionDialogDelegate delegate) { if (mDialogDelegate == delegate) { // Some caution is required here to handle cases where the user actions or dismisses @@ -267,7 +279,11 @@ // may be called after onClick and before onDismiss, or before both of those listeners. mDialogDelegate = null; if (mState == PROMPT_OPEN) { - mDialogView.dismiss(); + if (useAppModalDialogView()) { + mModalDialogManager.dismissDialog(mAppModalDialogView); + } else { + mDialogView.dismiss(); + } } else { assert mState == PROMPT_PENDING || mState == REQUEST_ANDROID_PERMISSIONS || mState == PROMPT_DENIED || mState == PROMPT_ACCEPTED; @@ -279,9 +295,37 @@ delegate.destroy(); } + @Override + public void onCancel() {} + + @Override + public void onDismiss() { + mDismissListener.onDismiss(null); + mAppModalDialogView = null; + } + + @Override + public void onClick(@ModalDialogView.ButtonType int buttonType) { + switch (buttonType) { + case ModalDialogView.BUTTON_POSITIVE: + mPositiveClickListener.onClick(null, 0); + break; + case ModalDialogView.BUTTON_NEGATIVE: + mNegativeClickListener.onClick(null, 0); + break; + default: + assert false : "Unexpected button pressed in dialog: " + buttonType; + } + mModalDialogManager.dismissDialog(mAppModalDialogView); + } + private void destroyDelegate() { mDialogDelegate.destroy(); mDialogDelegate = null; mState = NOT_SHOWING; } + + private static boolean useAppModalDialogView() { + return ChromeFeatureList.isEnabled(ChromeFeatureList.MODAL_PERMISSION_DIALOG_VIEW); + } }
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni index b908521..5e4062e9 100644 --- a/chrome/android/java_sources.gni +++ b/chrome/android/java_sources.gni
@@ -880,6 +880,7 @@ "java/src/org/chromium/chrome/browser/payments/ui/SectionUiUtils.java", "java/src/org/chromium/chrome/browser/payments/ui/ShoppingCart.java", "java/src/org/chromium/chrome/browser/permissions/AndroidPermissionRequester.java", + "java/src/org/chromium/chrome/browser/permissions/PermissionAppModalDialogView.java", "java/src/org/chromium/chrome/browser/permissions/PermissionDialogController.java", "java/src/org/chromium/chrome/browser/permissions/PermissionDialogDelegate.java", "java/src/org/chromium/chrome/browser/permissions/PermissionDialogView.java",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/modaldialog/ModalDialogManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/modaldialog/ModalDialogManagerTest.java index a5071988..726cbe3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/modaldialog/ModalDialogManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/modaldialog/ModalDialogManagerTest.java
@@ -532,6 +532,9 @@ public void onCancel() {} @Override + public void onDismiss() {} + + @Override public void onClick(int buttonType) { switch (buttonType) { case ModalDialogView.BUTTON_POSITIVE:
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index c43d038..4400b39 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -535,8 +535,6 @@ {flags_ui::kGenericExperimentChoiceDefault, "", ""}, {flags_ui::kGenericExperimentChoiceDisabled, switches::kV8CacheOptions, "none"}, - {flag_descriptions::kV8CacheOptionsParse, switches::kV8CacheOptions, - "parse"}, {flag_descriptions::kV8CacheOptionsCode, switches::kV8CacheOptions, "code"}, }; @@ -1904,6 +1902,10 @@ flag_descriptions::kTabModalJsDialogName, flag_descriptions::kTabModalJsDialogDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kTabModalJsDialog)}, + {"enable-modal-permission-dialog-view", + flag_descriptions::kModalPermissionDialogViewName, + flag_descriptions::kModalPermissionDialogViewDescription, kOsAndroid, + FEATURE_VALUE_TYPE(chrome::android::kModalPermissionDialogView)}, {"vr-browsing-native-android-ui", flag_descriptions::kVrBrowsingNativeAndroidUiName, flag_descriptions::kVrBrowsingNativeAndroidUiDescription, kOsAndroid,
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc index 1eceeb3..54aa093 100644 --- a/chrome/browser/android/chrome_feature_list.cc +++ b/chrome/browser/android/chrome_feature_list.cc
@@ -94,6 +94,7 @@ &kFullscreenActivity, &kImprovedA2HS, &kLanguagesPreference, + &kModalPermissionDialogView, &kNewPhotoPicker, &kNoCreditCardAbort, &kNTPCondensedLayoutFeature, @@ -287,6 +288,9 @@ const base::Feature kLanguagesPreference{"LanguagesPreference", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kModalPermissionDialogView{ + "ModalPermissionDialogView", base::FEATURE_DISABLED_BY_DEFAULT}; + const base::Feature kSearchEnginePromoExistingDevice{ "SearchEnginePromo.ExistingDevice", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/chrome/browser/android/chrome_feature_list.h b/chrome/browser/android/chrome_feature_list.h index b91bcbc..310a9b3e 100644 --- a/chrome/browser/android/chrome_feature_list.h +++ b/chrome/browser/android/chrome_feature_list.h
@@ -54,6 +54,7 @@ extern const base::Feature kFullscreenActivity; extern const base::Feature kImprovedA2HS; extern const base::Feature kLanguagesPreference; +extern const base::Feature kModalPermissionDialogView; extern const base::Feature kSearchEnginePromoExistingDevice; extern const base::Feature kSearchEnginePromoNewDevice; extern const base::Feature kNewPhotoPicker;
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index b09303d9..7fb3d42 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -881,6 +881,11 @@ registry->RegisterBooleanPref(prefs::kDisable3DAPIs, false); registry->RegisterBooleanPref(prefs::kEnableHyperlinkAuditing, true); registry->RegisterListPref(prefs::kEnableDeprecatedWebPlatformFeatures); + // Register user prefs for mapping SitePerProcess and IsolateOrigins in + // user policy in addition to the same named ones in Local State (which are + // used for mapping the command-line flags). + registry->RegisterStringPref(prefs::kIsolateOrigins, std::string()); + registry->RegisterBooleanPref(prefs::kSitePerProcess, false); } // static
diff --git a/chrome/browser/chrome_service_worker_browsertest.cc b/chrome/browser/chrome_service_worker_browsertest.cc index e1b6827..10fca397 100644 --- a/chrome/browser/chrome_service_worker_browsertest.cc +++ b/chrome/browser/chrome_service_worker_browsertest.cc
@@ -395,6 +395,13 @@ } #if BUILDFLAG(ENABLE_NACL) +// This test registers a service worker and then loads a controlled iframe that +// creates a PNaCl plugin in an <embed> element. Once loaded, the PNaCl plugin +// is ordered to do a resource request for "/echo". The service worker records +// all the fetch events it sees. Since requests for plug-ins and requests +// initiated by plug-ins should not be interecepted by service workers, we +// expect that the the service worker only see the navigation request for the +// iframe. class ChromeServiceWorkerFetchPPAPITest : public ChromeServiceWorkerFetchTest { protected: ChromeServiceWorkerFetchPPAPITest() {} @@ -410,12 +417,8 @@ test_page_url_ = GetURL("/pnacl_url_loader.html"); } - std::string GetRequestStringForPNACL(const std::string& fragment) const { - return RequestString(test_page_url_ + fragment, "navigate", "include") + - RequestString(GetURL("/pnacl_url_loader.nmf"), "same-origin", - "same-origin") + - RequestString(GetURL("/pnacl_url_loader_newlib_pnacl.pexe"), - "same-origin", "same-origin"); + std::string GetNavigationRequestString(const std::string& fragment) const { + return RequestString(test_page_url_ + fragment, "navigate", "include"); } std::string ExecutePNACLUrlLoaderTest(const std::string& mode) { @@ -435,153 +438,17 @@ DISALLOW_COPY_AND_ASSIGN(ChromeServiceWorkerFetchPPAPITest); }; -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPITest, SameOrigin) { - // In pnacl_url_loader.cc: - // request.SetMethod("GET"); - // request.SetURL("/echo"); - EXPECT_EQ(GetRequestStringForPNACL("#Same") + - RequestString(GetURL("/echo"), "same-origin", "include"), - ExecutePNACLUrlLoaderTest("Same")); -} - -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPITest, SameOriginCORS) { - // In pnacl_url_loader.cc: - // request.SetMethod("GET"); - // request.SetURL("/echo"); - // request.SetAllowCrossOriginRequests(true); - EXPECT_EQ(GetRequestStringForPNACL("#SameCORS") + - RequestString(GetURL("/echo"), "cors", "omit"), - ExecutePNACLUrlLoaderTest("SameCORS")); -} - IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPITest, - SameOriginCredentials) { - // In pnacl_url_loader.cc: - // request.SetMethod("GET"); - // request.SetURL("/echo"); - // request.SetAllowCredentials(true); - EXPECT_EQ(GetRequestStringForPNACL("#SameCredentials") + - RequestString(GetURL("/echo"), "same-origin", "include"), - ExecutePNACLUrlLoaderTest("SameCredentials")); -} - -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPITest, - SameOriginCORSCredentials) { - // In pnacl_url_loader.cc: - // request.SetMethod("GET"); - // request.SetURL("/echo"); - // request.SetAllowCrossOriginRequests(true); - // request.SetAllowCredentials(true); - EXPECT_EQ(GetRequestStringForPNACL("#SameCORSCredentials") + - RequestString(GetURL("/echo"), "cors", "include"), - ExecutePNACLUrlLoaderTest("SameCORSCredentials")); -} - -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPITest, OtherOrigin) { - // In pnacl_url_loader.cc: - // request.SetMethod("GET"); - // request.SetURL("https://www.example.com/echo"); - // This request fails because AllowCrossOriginRequests is not set. - EXPECT_EQ(GetRequestStringForPNACL("#Other"), - ExecutePNACLUrlLoaderTest("Other")); -} - -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPITest, OtherOriginCORS) { - // In pnacl_url_loader.cc: - // request.SetMethod("GET"); - // request.SetURL("https://www.example.com/echo"); - // request.SetAllowCrossOriginRequests(true); - EXPECT_EQ(GetRequestStringForPNACL("#OtherCORS") + - RequestString("https://www.example.com/echo", "cors", "omit"), - ExecutePNACLUrlLoaderTest("OtherCORS")); -} - -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPITest, - OtherOriginCredentials) { - // In pnacl_url_loader.cc: - // request.SetMethod("GET"); - // request.SetURL("https://www.example.com/echo"); - // request.SetAllowCredentials(true); - // This request fails because AllowCrossOriginRequests is not set. - EXPECT_EQ(GetRequestStringForPNACL("#OtherCredentials"), - ExecutePNACLUrlLoaderTest("OtherCredentials")); -} - -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPITest, - OtherOriginCORSCredentials) { - // In pnacl_url_loader.cc: - // request.SetMethod("GET"); - // request.SetURL("https://www.example.com/echo"); - // request.SetAllowCrossOriginRequests(true); - // request.SetAllowCredentials(true); - EXPECT_EQ( - GetRequestStringForPNACL("#OtherCORSCredentials") + - RequestString("https://www.example.com/echo", "cors", "include"), - ExecutePNACLUrlLoaderTest("OtherCORSCredentials")); -} - -class ChromeServiceWorkerFetchPPAPIPrivateTest - : public ChromeServiceWorkerFetchPPAPITest { - protected: - ChromeServiceWorkerFetchPPAPIPrivateTest() {} - ~ChromeServiceWorkerFetchPPAPIPrivateTest() override {} - - void SetUpCommandLine(base::CommandLine* command_line) override { - ChromeServiceWorkerFetchPPAPITest::SetUpCommandLine(command_line); - // Sets this flag to test that the fetch request from the plugins with - // private permission (PERMISSION_PRIVATE) should not go to the service - // worker. - command_line->AppendSwitch(switches::kEnablePepperTesting); - } - - private: - DISALLOW_COPY_AND_ASSIGN(ChromeServiceWorkerFetchPPAPIPrivateTest); -}; - -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPIPrivateTest, SameOrigin) { - EXPECT_EQ(GetRequestStringForPNACL("#Same"), - ExecutePNACLUrlLoaderTest("Same")); -} - -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPIPrivateTest, - SameOriginCORS) { - EXPECT_EQ(GetRequestStringForPNACL("#SameCORS"), - ExecutePNACLUrlLoaderTest("SameCORS")); -} - -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPIPrivateTest, - SameOriginCredentials) { - EXPECT_EQ(GetRequestStringForPNACL("#SameCredentials"), - ExecutePNACLUrlLoaderTest("SameCredentials")); -} - -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPIPrivateTest, - SameOriginCORSCredentials) { - EXPECT_EQ(GetRequestStringForPNACL("#SameCORSCredentials"), - ExecutePNACLUrlLoaderTest("SameCORSCredentials")); -} - -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPIPrivateTest, OtherOrigin) { - EXPECT_EQ(GetRequestStringForPNACL("#Other"), - ExecutePNACLUrlLoaderTest("Other")); -} - -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPIPrivateTest, - OtherOriginCORS) { - EXPECT_EQ(GetRequestStringForPNACL("#OtherCORS"), - ExecutePNACLUrlLoaderTest("OtherCORS")); -} - -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPIPrivateTest, - OtherOriginCredentials) { - EXPECT_EQ(GetRequestStringForPNACL("#OtherCredentials"), - ExecutePNACLUrlLoaderTest("OtherCredentials")); -} - -IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPIPrivateTest, - OtherOriginCORSCredentials) { - EXPECT_EQ(GetRequestStringForPNACL("#OtherCORSCredentials"), - ExecutePNACLUrlLoaderTest("OtherCORSCredentials")); + NotInterceptedByServiceWorker) { + // Only the navigation to the iframe should be intercepted by the service + // worker. The request for the PNaCl manifest ("/pnacl_url_loader.nmf"), + // the request for the compiled code ("/pnacl_url_loader_newlib_pnacl.pexe"), + // and any other requests initiated by the plug-in ("/echo") should not be + // seen by the service worker. + const std::string fragment = + "NotIntercepted"; // this string is not important. + EXPECT_EQ(GetNavigationRequestString("#" + fragment), + ExecutePNACLUrlLoaderTest(fragment)); } #endif // BUILDFLAG(ENABLE_NACL)
diff --git a/chrome/browser/chromeos/arc/print/OWNERS b/chrome/browser/chromeos/arc/print/OWNERS new file mode 100644 index 0000000..bb65116 --- /dev/null +++ b/chrome/browser/chromeos/arc/print/OWNERS
@@ -0,0 +1,2 @@ +per-file *_struct_traits*.*=set noparent +per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS
diff --git a/chrome/browser/chromeos/arc/print/arc_print_service.cc b/chrome/browser/chromeos/arc/print/arc_print_service.cc index 1d763ef..c9619f99 100644 --- a/chrome/browser/chromeos/arc/print/arc_print_service.cc +++ b/chrome/browser/chromeos/arc/print/arc_print_service.cc
@@ -4,55 +4,94 @@ #include "chrome/browser/chromeos/arc/print/arc_print_service.h" +#include <limits> +#include <memory> +#include <string> #include <utility> +#include <vector> -#include "ash/shell.h" -#include "ash/shell_delegate.h" -#include "base/bind.h" -#include "base/files/file_util.h" -#include "base/logging.h" +#include "base/bind_helpers.h" #include "base/memory/singleton.h" +#include "base/strings/utf_string_conversions.h" #include "base/task_scheduler/post_task.h" -#include "base/task_scheduler/task_traits.h" -#include "base/threading/thread_restrictions.h" +#include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/chromeos/printing/cups_print_job.h" +#include "chrome/browser/chromeos/printing/cups_print_job_manager.h" +#include "chrome/browser/chromeos/printing/cups_print_job_manager_factory.h" +#include "chrome/browser/chromeos/printing/cups_printers_manager.h" +#include "chrome/browser/chromeos/printing/printer_configurer.h" +#include "chrome/browser/printing/print_job.h" +#include "chrome/browser/printing/print_job_worker.h" +#include "chrome/browser/profiles/profile.h" #include "components/arc/arc_bridge_service.h" #include "components/arc/arc_browser_context_keyed_service_factory_base.h" +#include "components/keyed_service/core/keyed_service.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_source.h" +#include "content/public/common/child_process_host.h" #include "mojo/edk/embedder/embedder.h" -#include "net/base/filename_util.h" -#include "url/gurl.h" - -namespace { - -base::Optional<base::FilePath> SavePdf(base::File file) { - base::AssertBlockingAllowed(); - - base::FilePath file_path; - base::CreateTemporaryFile(&file_path); - base::File out(file_path, - base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); - - char buf[8192]; - ssize_t bytes; - while ((bytes = file.ReadAtCurrentPos(buf, sizeof(buf))) > 0) { - int written = out.WriteAtCurrentPos(buf, bytes); - if (written < 0) { - LOG(ERROR) << "Error while saving PDF to a disk"; - return base::nullopt; - } - } - - return file_path; -} - -} // namespace +#include "mojo/public/cpp/bindings/strong_binding.h" +#include "printing/backend/print_backend.h" +#include "printing/backend/print_backend_consts.h" +#include "printing/pdf_metafile_skia.h" +#include "printing/print_job_constants.h" +#include "printing/printed_document.h" +#include "printing/units.h" namespace arc { namespace { +class PrintJobHostImpl; +class PrinterDiscoverySessionHostImpl; + +class ArcPrintServiceImpl : public ArcPrintService, + public chromeos::CupsPrintJobManager::Observer, + public KeyedService { + public: + ArcPrintServiceImpl(content::BrowserContext* context, + ArcBridgeService* bridge_service); + ~ArcPrintServiceImpl() override; + + // KeyedService: + void Shutdown() override; + + // mojom::PrintHost: + void PrintDeprecated(mojo::ScopedHandle pdf_data) override; + void Print(mojom::PrintJobInstancePtr instance, + mojom::PrintJobRequestPtr print_job, + PrintCallback callback) override; + void CreateDiscoverySession( + mojom::PrinterDiscoverySessionInstancePtr instance, + CreateDiscoverySessionCallback callback) override; + + void DeleteJob(PrintJobHostImpl* job); + void DeleteSession(PrinterDiscoverySessionHostImpl* session); + void JobIdGenerated(PrintJobHostImpl* job, const std::string& job_id); + + protected: + // chromeos::CupsPrintJobManager::Observer: + void OnPrintJobCreated(chromeos::CupsPrintJob* job) override; + void OnPrintJobCancelled(chromeos::CupsPrintJob* job) override; + void OnPrintJobError(chromeos::CupsPrintJob* job) override; + void OnPrintJobDone(chromeos::CupsPrintJob* job) override; + + private: + Profile* const profile_; // Owned by ProfileManager. + ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager. + + std::map<PrintJobHostImpl*, std::unique_ptr<PrintJobHostImpl>> jobs_; + std::map<PrinterDiscoverySessionHostImpl*, + std::unique_ptr<PrinterDiscoverySessionHostImpl>> + sessions_; + + // Managed by PrintJobHostImpl instances. + std::map<std::string, PrintJobHostImpl*> jobs_by_id_; +}; + // Singleton factory for ArcPrintService. class ArcPrintServiceFactory : public internal::ArcBrowserContextKeyedServiceFactoryBase< - ArcPrintService, + ArcPrintServiceImpl, ArcPrintServiceFactory> { public: // Factory name used by ArcBrowserContextKeyedServiceFactoryBase. @@ -68,6 +107,523 @@ ~ArcPrintServiceFactory() override = default; }; +// This creates a Metafile instance which is a wrapper around a byte buffer at +// this point. +std::unique_ptr<printing::PdfMetafileSkia> ReadFileOnBlockingTaskRunner( + base::File file, + size_t data_size) { + // TODO(vkuzkokov) Can we make give pipe to CUPS directly? + std::vector<char> buf(data_size); + int bytes = file.ReadAtCurrentPos(buf.data(), data_size); + if (bytes < 0) { + PLOG(ERROR) << "Error reading PDF"; + return nullptr; + } + if (static_cast<size_t>(bytes) != data_size) + return nullptr; + + file.Close(); + + auto metafile = std::make_unique<printing::PdfMetafileSkia>(); + if (!metafile->InitFromData(buf.data(), buf.size())) { + LOG(ERROR) << "Failed to initialize PDF metafile"; + return nullptr; + } + return metafile; +} + +using PrinterQueryCallback = + base::OnceCallback<void(scoped_refptr<printing::PrinterQuery>)>; + +void OnSetSettingsDoneOnIOThread(scoped_refptr<printing::PrinterQuery> query, + PrinterQueryCallback callback); + +void CreateQueryOnIOThread(std::unique_ptr<printing::PrintSettings> settings, + PrinterQueryCallback callback) { + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + auto query = base::MakeRefCounted<printing::PrinterQuery>( + content::ChildProcessHost::kInvalidUniqueID, + content::ChildProcessHost::kInvalidUniqueID); + query->SetSettingsFromPOD( + std::move(settings), + base::BindOnce(&OnSetSettingsDoneOnIOThread, query, std::move(callback))); +} + +// Send initialized PrinterQuery to UI thread. +void OnSetSettingsDoneOnIOThread(scoped_refptr<printing::PrinterQuery> query, + PrinterQueryCallback callback) { + content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, + base::BindOnce(std::move(callback), query)); +} + +std::unique_ptr<printing::PrinterSemanticCapsAndDefaults> +FetchCapabilitiesOnBlockingTaskRunner(const std::string& printer_id) { + scoped_refptr<printing::PrintBackend> backend( + printing::PrintBackend::CreateInstance(nullptr)); + auto caps = std::make_unique<printing::PrinterSemanticCapsAndDefaults>(); + if (!backend->GetPrinterSemanticCapsAndDefaults(printer_id, caps.get())) { + LOG(ERROR) << "Failed to get caps for " << printer_id; + return nullptr; + } + return caps; +} + +// Transform printer info to Mojo type and add capabilities, if present. +mojom::PrinterInfoPtr ToArcPrinter( + const chromeos::Printer& printer, + std::unique_ptr<printing::PrinterSemanticCapsAndDefaults> caps) { + return mojom::PrinterInfo::New( + printer.id(), printer.display_name(), mojom::PrinterStatus::IDLE, + printer.description(), base::nullopt, + caps ? base::make_optional<printing::PrinterSemanticCapsAndDefaults>( + std::move(*caps)) + : base::nullopt); +} + +// PrinterDiscoverySessionHost implementation. +class PrinterDiscoverySessionHostImpl + : public mojom::PrinterDiscoverySessionHost, + public chromeos::CupsPrintersManager::Observer { + public: + PrinterDiscoverySessionHostImpl( + mojo::InterfaceRequest<mojom::PrinterDiscoverySessionHost> request, + mojom::PrinterDiscoverySessionInstancePtr instance, + ArcPrintServiceImpl* service, + Profile* profile) + : binding_(this, std::move(request)), + instance_(std::move(instance)), + service_(service), + printers_manager_(chromeos::CupsPrintersManager::Create(profile)), + configurer_(chromeos::PrinterConfigurer::Create(profile)), + weak_ptr_factory_(this) { + printers_manager_->AddObserver(this); + binding_.set_connection_error_handler(MakeErrorHandler()); + instance_.set_connection_error_handler(MakeErrorHandler()); + } + + ~PrinterDiscoverySessionHostImpl() override { + printers_manager_->RemoveObserver(this); + } + + // mojom::PrinterDiscoverySessionHost: + void StartPrinterDiscovery( + const std::vector<std::string>& printer_ids) override { + std::vector<mojom::PrinterInfoPtr> arc_printers; + for (size_t i = 0; i < chromeos::CupsPrintersManager::kNumPrinterClasses; + i++) { + std::vector<chromeos::Printer> printers = printers_manager_->GetPrinters( + static_cast<chromeos::CupsPrintersManager::PrinterClass>(i)); + for (const auto& printer : printers) + arc_printers.emplace_back(ToArcPrinter(printer, nullptr)); + } + if (!arc_printers.empty()) + instance_->AddPrinters(std::move(arc_printers)); + } + + void StopPrinterDiscovery() override { + // Do nothing + } + + void ValidatePrinters(const std::vector<std::string>& printer_ids) override { + // TODO(vkuzkokov) implement or determine that we don't need to. + } + + void StartPrinterStateTracking(const std::string& printer_id) override { + std::unique_ptr<chromeos::Printer> printer = + printers_manager_->GetPrinter(printer_id); + if (!printer) { + RemovePrinter(printer_id); + return; + } + if (printers_manager_->IsPrinterInstalled(*printer)) { + PrinterInstalled(std::move(printer), chromeos::kSuccess); + return; + } + const chromeos::Printer& printer_ref = *printer; + configurer_->SetUpPrinter( + printer_ref, + base::BindOnce(&PrinterDiscoverySessionHostImpl::PrinterInstalled, + weak_ptr_factory_.GetWeakPtr(), std::move(printer))); + } + + void StopPrinterStateTracking(const std::string& printer_id) override { + // Do nothing + } + + void DestroyDiscoverySession() override { service_->DeleteSession(this); } + + // chromeos::CupsPrintersManager::Observer: + void OnPrintersChanged( + chromeos::CupsPrintersManager::PrinterClass printer_class, + const std::vector<chromeos::Printer>& printers) override { + // TODO(vkuzkokov) remove missing printers and only add new ones. + std::vector<mojom::PrinterInfoPtr> arc_printers; + for (const auto& printer : printers) + arc_printers.emplace_back(ToArcPrinter(printer, nullptr)); + + instance_->AddPrinters(std::move(arc_printers)); + } + + private: + base::OnceClosure MakeErrorHandler() { + return base::BindOnce( + &PrinterDiscoverySessionHostImpl::DestroyDiscoverySession, + weak_ptr_factory_.GetWeakPtr()); + } + + // Fetch capabilities for newly installed printer. + void PrinterInstalled(std::unique_ptr<chromeos::Printer> printer, + chromeos::PrinterSetupResult result) { + if (result != chromeos::kSuccess) { + RemovePrinter(printer->id()); + return; + } + printers_manager_->PrinterInstalled(*printer); + const std::string& printer_id = printer->id(); + base::PostTaskWithTraitsAndReplyWithResult( + FROM_HERE, {base::MayBlock()}, + base::BindOnce(&FetchCapabilitiesOnBlockingTaskRunner, printer_id), + base::BindOnce(&PrinterDiscoverySessionHostImpl::CapabilitiesReceived, + weak_ptr_factory_.GetWeakPtr(), std::move(printer))); + } + + // Remove from the list of available printers. + void RemovePrinter(const std::string& printer_id) { + instance_->RemovePrinters(std::vector<std::string>{printer_id}); + } + + // Transform printer capabilities to mojo type and send to container. + void CapabilitiesReceived( + std::unique_ptr<chromeos::Printer> printer, + std::unique_ptr<printing::PrinterSemanticCapsAndDefaults> caps) { + if (!caps) { + RemovePrinter(printer->id()); + return; + } + std::vector<mojom::PrinterInfoPtr> arc_printers; + arc_printers.emplace_back(ToArcPrinter(*printer, std::move(caps))); + instance_->AddPrinters(std::move(arc_printers)); + } + + // Binds |this|. + mojo::Binding<mojom::PrinterDiscoverySessionHost> binding_; + + mojom::PrinterDiscoverySessionInstancePtr instance_; + ArcPrintServiceImpl* const service_; + std::unique_ptr<chromeos::CupsPrintersManager> printers_manager_; + std::unique_ptr<chromeos::PrinterConfigurer> configurer_; + base::WeakPtrFactory<PrinterDiscoverySessionHostImpl> weak_ptr_factory_; + + DISALLOW_COPY_AND_ASSIGN(PrinterDiscoverySessionHostImpl); +}; + +// Get requested color mode from Mojo type. +// |mode| is a bitfield but must have exactly one mode set here. +printing::ColorModel FromArcColorMode(mojom::PrintColorMode mode) { + switch (mode) { + case mojom::PrintColorMode::MONOCHROME: + return printing::GRAY; + case mojom::PrintColorMode::COLOR: + return printing::COLOR; + } + NOTREACHED(); +} + +// Get requested duplex mode from Mojo type. +// |mode| is a bitfield but must have exactly one mode set here. +printing::DuplexMode FromArcDuplexMode(mojom::PrintDuplexMode mode) { + switch (mode) { + case mojom::PrintDuplexMode::NONE: + return printing::SIMPLEX; + case mojom::PrintDuplexMode::LONG_EDGE: + return printing::LONG_EDGE; + case mojom::PrintDuplexMode::SHORT_EDGE: + return printing::SHORT_EDGE; + } + NOTREACHED(); +} + +// This represents a single request from container. Object of this class +// self-destructs when the request is completed, successfully or otherwise. +class PrintJobHostImpl : public mojom::PrintJobHost, + public content::NotificationObserver { + public: + PrintJobHostImpl(mojo::InterfaceRequest<mojom::PrintJobHost> request, + mojom::PrintJobInstancePtr instance, + ArcPrintServiceImpl* service, + chromeos::CupsPrintJobManager* job_manager, + std::unique_ptr<printing::PrintSettings> settings, + base::File file, + size_t data_size) + : binding_(this, std::move(request)), + instance_(std::move(instance)), + service_(service), + job_manager_(job_manager), + weak_ptr_factory_(this) { + // We read printing data from pipe on working thread in parallel with + // initializing PrinterQuery on IO thread. When both tasks are complete we + // start printing. + base::PostTaskWithTraitsAndReplyWithResult( + FROM_HERE, {base::MayBlock()}, + base::BindOnce(&ReadFileOnBlockingTaskRunner, std::move(file), + data_size), + base::BindOnce(&PrintJobHostImpl::OnFileRead, + weak_ptr_factory_.GetWeakPtr())); + content::BrowserThread::PostTask( + content::BrowserThread::IO, FROM_HERE, + base::BindOnce(&CreateQueryOnIOThread, std::move(settings), + base::BindOnce(&PrintJobHostImpl::OnSetSettingsDone, + weak_ptr_factory_.GetWeakPtr()))); + binding_.set_connection_error_handler(MakeErrorHandler()); + instance_.set_connection_error_handler(MakeErrorHandler()); + } + + void CupsJobCreated(chromeos::CupsPrintJob* cups_job) { + cups_job_ = cups_job; + } + + void JobCanceled() { + instance_->Cancel(); + service_->DeleteJob(this); + } + + void JobError() { + // TODO(vkuzkokov) transform cups_job_->error_code() into localized string. + instance_->Fail({}); + service_->DeleteJob(this); + } + + void JobDone() { + instance_->Complete(); + service_->DeleteJob(this); + } + + // mojom::PrintJobHost: + void Cancel() override { + if (cups_job_) { + // Job already spooled. + job_manager_->CancelPrintJob(cups_job_); + } else { + JobCanceled(); + } + } + + // content::NotificationObserver: + void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) override { + DCHECK_EQ(chrome::NOTIFICATION_PRINT_JOB_EVENT, type); + const printing::JobEventDetails& event_details = + *content::Details<printing::JobEventDetails>(details).ptr(); + switch (event_details.type()) { + case printing::JobEventDetails::DOC_DONE: + DCHECK(event_details.document()); + service_->JobIdGenerated( + this, chromeos::CupsPrintJob::GetUniqueId( + base::UTF16ToUTF8( + event_details.document()->settings().device_name()), + event_details.job_id())); + break; + case printing::JobEventDetails::FAILED: + // TODO(vkuzkokov) see if we can extract an error message. + JobError(); + break; + default: + // TODO(vkuzkokov) consider updating container on other events. + break; + } + } + + private: + void Destroy() { service_->DeleteJob(this); } + + base::OnceClosure MakeErrorHandler() { + return base::BindOnce(&PrintJobHostImpl::Destroy, + weak_ptr_factory_.GetWeakPtr()); + } + + // Store Metafile and start printing if PrintJob is created as well. + void OnFileRead(std::unique_ptr<printing::PdfMetafileSkia> metafile) { + metafile_ = std::move(metafile); + StartPrintingIfReady(); + } + + // Create PrintJob and start printing if Metafile is created as well. + void OnSetSettingsDone(scoped_refptr<printing::PrinterQuery> query) { + job_ = base::MakeRefCounted<printing::PrintJob>(); + job_->Initialize(query.get(), base::string16() /* name */, + 1 /* page_count */); + registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, + content::Source<printing::PrintJob>(job_.get())); + StartPrintingIfReady(); + } + + // If both PrintJob and Metafile are available start printing. + void StartPrintingIfReady() { + if (!job_ || !metafile_) + return; + + printing::PrintedDocument* document = job_->document(); + document->SetDocument(std::move(metafile_) /* metafile */, + gfx::Size() /* paper_size */, + gfx::Rect() /* page_rect */); + job_->StartPrinting(); + } + + // Binds the lifetime of |this| to the Mojo connection. + mojo::Binding<mojom::PrintJobHost> binding_; + + mojom::PrintJobInstancePtr instance_; + ArcPrintServiceImpl* const service_; + chromeos::CupsPrintJobManager* const job_manager_; + std::unique_ptr<printing::PdfMetafileSkia> metafile_; + scoped_refptr<printing::PrintJob> job_; + chromeos::CupsPrintJob* cups_job_; + content::NotificationRegistrar registrar_; + base::WeakPtrFactory<PrintJobHostImpl> weak_ptr_factory_; + + DISALLOW_COPY_AND_ASSIGN(PrintJobHostImpl); +}; + +ArcPrintServiceImpl::ArcPrintServiceImpl(content::BrowserContext* context, + ArcBridgeService* bridge_service) + : profile_(Profile::FromBrowserContext(context)), + arc_bridge_service_(bridge_service) { + arc_bridge_service_->print()->SetHost(this); + chromeos::CupsPrintJobManagerFactory::GetForBrowserContext(profile_) + ->AddObserver(this); +} + +ArcPrintServiceImpl::~ArcPrintServiceImpl() { + arc_bridge_service_->print()->SetHost(nullptr); +} + +void ArcPrintServiceImpl::Shutdown() { + chromeos::CupsPrintJobManagerFactory::GetForBrowserContext(profile_) + ->RemoveObserver(this); +} + +void ArcPrintServiceImpl::OnPrintJobCreated(chromeos::CupsPrintJob* job) { + auto it = jobs_by_id_.find(job->GetUniqueId()); + if (it != jobs_by_id_.end()) + it->second->CupsJobCreated(job); +} + +void ArcPrintServiceImpl::OnPrintJobCancelled(chromeos::CupsPrintJob* job) { + auto it = jobs_by_id_.find(job->GetUniqueId()); + if (it != jobs_by_id_.end()) + it->second->JobCanceled(); +} + +void ArcPrintServiceImpl::OnPrintJobError(chromeos::CupsPrintJob* job) { + auto it = jobs_by_id_.find(job->GetUniqueId()); + if (it != jobs_by_id_.end()) + it->second->JobError(); +} + +void ArcPrintServiceImpl::OnPrintJobDone(chromeos::CupsPrintJob* job) { + auto it = jobs_by_id_.find(job->GetUniqueId()); + if (it != jobs_by_id_.end()) + it->second->JobDone(); +} + +void ArcPrintServiceImpl::PrintDeprecated(mojo::ScopedHandle pdf_data) { + LOG(ERROR) << "ArcPrintService::Print(ScopedHandle) is deprecated."; +} + +void ArcPrintServiceImpl::Print(mojom::PrintJobInstancePtr instance, + mojom::PrintJobRequestPtr print_job, + PrintCallback callback) { + instance->Start(); + + const mojom::PrintAttributesPtr& attr = print_job->attributes; + const mojom::PrintMediaSizePtr& arc_media = attr->media_size; + const base::Optional<gfx::Size> resolution = attr->resolution; + if (!arc_media || !resolution) { + // TODO(vkuzkokov): localize + instance->Fail(base::Optional<std::string>( + base::in_place, + "Print request must contain media size and resolution")); + return; + } + + const mojom::PrintMarginsPtr& margins = attr->min_margins; + auto settings = std::make_unique<printing::PrintSettings>(); + + gfx::Size size_mils(arc_media->width_mils, arc_media->height_mils); + printing::PrintSettings::RequestedMedia media; + media.size_microns = + gfx::ScaleToRoundedSize(size_mils, printing::kMicronsPerMil); + settings->set_requested_media(media); + + // TODO(vkuzkokov) Is it just max(dpm_hor, dpm_ver) as per + // print_settings_conversion? + float x_scale = + static_cast<float>(resolution->width()) / printing::kMilsPerInch; + float y_scale = + static_cast<float>(resolution->height()) / printing::kMilsPerInch; + settings->set_dpi_xy(resolution->width(), resolution->height()); + + gfx::Rect area_mils(size_mils); + if (margins) { + area_mils.Inset(margins->left_mils, margins->top_mils, margins->right_mils, + margins->bottom_mils); + } + settings->SetPrinterPrintableArea( + gfx::ScaleToRoundedSize(size_mils, x_scale, y_scale), + gfx::ScaleToRoundedRect(area_mils, x_scale, y_scale), false); + if (print_job->printer_id) + settings->set_device_name(base::UTF8ToUTF16(print_job->printer_id.value())); + + // Chrome expects empty set of pages to mean "all". + // Android uses a single range from 0 to 2^31-1 for that purpose. + const printing::PageRanges& pages = print_job->pages; + if (!pages.empty() && pages.back().to != std::numeric_limits<int>::max()) + settings->set_ranges(pages); + + settings->set_title(base::UTF8ToUTF16(print_job->document_name)); + settings->set_color(FromArcColorMode(attr->color_mode)); + settings->set_copies(print_job->copies); + settings->set_duplex_mode(FromArcDuplexMode(attr->duplex_mode)); + mojo::edk::ScopedPlatformHandle scoped_handle; + PassWrappedPlatformHandle(print_job->data.release().value(), &scoped_handle); + + mojom::PrintJobHostPtr host_proxy; + auto job = std::make_unique<PrintJobHostImpl>( + mojo::MakeRequest(&host_proxy), std::move(instance), this, + chromeos::CupsPrintJobManagerFactory::GetForBrowserContext(profile_), + std::move(settings), base::File(scoped_handle.release().handle), + print_job->data_size); + PrintJobHostImpl* job_raw = job.get(); + jobs_.emplace(job_raw, std::move(job)); + std::move(callback).Run(std::move(host_proxy)); +} + +void ArcPrintServiceImpl::CreateDiscoverySession( + mojom::PrinterDiscoverySessionInstancePtr instance, + CreateDiscoverySessionCallback callback) { + mojom::PrinterDiscoverySessionHostPtr host_proxy; + auto session = std::make_unique<PrinterDiscoverySessionHostImpl>( + mojo::MakeRequest(&host_proxy), std::move(instance), this, profile_); + PrinterDiscoverySessionHostImpl* session_raw = session.get(); + sessions_.emplace(session_raw, std::move(session)); + std::move(callback).Run(std::move(host_proxy)); +} + +void ArcPrintServiceImpl::DeleteJob(PrintJobHostImpl* job) { + jobs_.erase(job); +} + +void ArcPrintServiceImpl::DeleteSession( + PrinterDiscoverySessionHostImpl* session) { + sessions_.erase(session); +} + +void ArcPrintServiceImpl::JobIdGenerated(PrintJobHostImpl* job, + const std::string& job_id) { + jobs_by_id_.emplace(job_id, job); +} + } // namespace // static @@ -76,48 +632,6 @@ return ArcPrintServiceFactory::GetForBrowserContext(context); } -ArcPrintService::ArcPrintService(content::BrowserContext* context, - ArcBridgeService* bridge_service) - : arc_bridge_service_(bridge_service), - weak_ptr_factory_(this) { - arc_bridge_service_->print()->SetHost(this); -} - -ArcPrintService::~ArcPrintService() { - arc_bridge_service_->print()->SetHost(nullptr); -} - -void ArcPrintService::Print(mojo::ScopedHandle pdf_data) { - if (!pdf_data.is_valid()) { - LOG(ERROR) << "handle is invalid"; - return; - } - - mojo::edk::ScopedPlatformHandle scoped_platform_handle; - MojoResult mojo_result = mojo::edk::PassWrappedPlatformHandle( - pdf_data.release().value(), &scoped_platform_handle); - if (mojo_result != MOJO_RESULT_OK) { - LOG(ERROR) << "PassWrappedPlatformHandle failed: " << mojo_result; - return; - } - - base::File file(scoped_platform_handle.release().handle); - - base::PostTaskWithTraitsAndReplyWithResult( - FROM_HERE, {base::MayBlock()}, - base::BindOnce(&SavePdf, base::Passed(&file)), - base::BindOnce(&ArcPrintService::OpenPdf, - weak_ptr_factory_.GetWeakPtr())); -} - -void ArcPrintService::OpenPdf(base::Optional<base::FilePath> file_path) const { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (!file_path) - return; - - GURL gurl = net::FilePathToFileURL(file_path.value()); - ash::Shell::Get()->shell_delegate()->OpenUrlFromArc(gurl); - // TODO(poromov) Delete file after printing. (http://crbug.com/629843) -} +ArcPrintService::ArcPrintService() {} } // namespace arc
diff --git a/chrome/browser/chromeos/arc/print/arc_print_service.h b/chrome/browser/chromeos/arc/print/arc_print_service.h index 829e883f..9aacfacb 100644 --- a/chrome/browser/chromeos/arc/print/arc_print_service.h +++ b/chrome/browser/chromeos/arc/print/arc_print_service.h
@@ -5,13 +5,7 @@ #ifndef CHROME_BROWSER_CHROMEOS_ARC_PRINT_ARC_PRINT_SERVICE_H_ #define CHROME_BROWSER_CHROMEOS_ARC_PRINT_ARC_PRINT_SERVICE_H_ -#include "base/files/file.h" -#include "base/macros.h" -#include "base/memory/weak_ptr.h" -#include "base/optional.h" -#include "base/threading/thread_checker.h" #include "components/arc/common/print.mojom.h" -#include "components/keyed_service/core/keyed_service.h" namespace content { class BrowserContext; @@ -19,33 +13,17 @@ namespace arc { -class ArcBridgeService; - -class ArcPrintService : public KeyedService, - public mojom::PrintHost { +class ArcPrintService : public mojom::PrintHost { public: // Returns singleton instance for the given BrowserContext, // or nullptr if the browser |context| is not allowed to use ARC. static ArcPrintService* GetForBrowserContext( content::BrowserContext* context); - ArcPrintService(content::BrowserContext* context, - ArcBridgeService* bridge_service); - ~ArcPrintService() override; - - // mojom::PrintHost override: - void Print(mojo::ScopedHandle pdf_data) override; + protected: + ArcPrintService(); private: - // Opens the pdf file at |file_path|. - // If given |file_path| is nullopt, do nothing. - void OpenPdf(base::Optional<base::FilePath> file_path) const; - - THREAD_CHECKER(thread_checker_); - - ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager. - - base::WeakPtrFactory<ArcPrintService> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(ArcPrintService); };
diff --git a/chrome/browser/chromeos/arc/print/print_struct_traits.cc b/chrome/browser/chromeos/arc/print/print_struct_traits.cc new file mode 100644 index 0000000..627f0ca --- /dev/null +++ b/chrome/browser/chromeos/arc/print/print_struct_traits.cc
@@ -0,0 +1,104 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/arc/print/print_struct_traits.h" + +#include "base/strings/stringprintf.h" +#include "printing/units.h" + +namespace mojo { + +namespace { + +// Transform paper size to Mojo type. +arc::mojom::PrintMediaSizePtr ToMediaSize( + const printing::PrinterSemanticCapsAndDefaults::Paper& paper) { + gfx::Size size_mil = + gfx::ScaleToRoundedSize(paper.size_um, 1.0f / printing::kMicronsPerMil); + return arc::mojom::PrintMediaSize::New(paper.vendor_id, paper.display_name, + size_mil.width(), size_mil.height()); +} + +} // namespace + +std::string StructTraits<arc::mojom::PrintResolutionDataView, gfx::Size>::id( + const gfx::Size& size) { + return base::StringPrintf("%dx%d", size.width(), size.height()); +} + +std::vector<arc::mojom::PrintMediaSizePtr> +StructTraits<arc::mojom::PrinterCapabilitiesDataView, + printing::PrinterSemanticCapsAndDefaults>:: + media_sizes(const printing::PrinterSemanticCapsAndDefaults& caps) { + std::vector<arc::mojom::PrintMediaSizePtr> sizes; + sizes.reserve(caps.papers.size()); + for (const auto& paper : caps.papers) + sizes.emplace_back(ToMediaSize(paper)); + + return sizes; +} + +arc::mojom::PrintMarginsPtr +StructTraits<arc::mojom::PrinterCapabilitiesDataView, + printing::PrinterSemanticCapsAndDefaults>:: + min_margins(const printing::PrinterSemanticCapsAndDefaults& caps) { + return arc::mojom::PrintMargins::New(0, 0, 0, 0); +} + +arc::mojom::PrintColorMode +StructTraits<arc::mojom::PrinterCapabilitiesDataView, + printing::PrinterSemanticCapsAndDefaults>:: + color_modes(const printing::PrinterSemanticCapsAndDefaults& caps) { + auto color_modes = static_cast<arc::mojom::PrintColorMode>(0); + if (caps.bw_model != printing::UNKNOWN_COLOR_MODEL) { + color_modes = static_cast<arc::mojom::PrintColorMode>( + static_cast<uint32_t>(color_modes) | + static_cast<uint32_t>(arc::mojom::PrintColorMode::MONOCHROME)); + } + if (caps.color_model != printing::UNKNOWN_COLOR_MODEL) { + color_modes = static_cast<arc::mojom::PrintColorMode>( + static_cast<uint32_t>(color_modes) | + static_cast<uint32_t>(arc::mojom::PrintColorMode::COLOR)); + } + return color_modes; +} + +arc::mojom::PrintDuplexMode +StructTraits<arc::mojom::PrinterCapabilitiesDataView, + printing::PrinterSemanticCapsAndDefaults>:: + duplex_modes(const printing::PrinterSemanticCapsAndDefaults& caps) { + arc::mojom::PrintDuplexMode duplex_modes = arc::mojom::PrintDuplexMode::NONE; + if (caps.duplex_capable) { + duplex_modes = static_cast<arc::mojom::PrintDuplexMode>( + static_cast<uint32_t>(duplex_modes) | + static_cast<uint32_t>(arc::mojom::PrintDuplexMode::LONG_EDGE) | + static_cast<uint32_t>(arc::mojom::PrintDuplexMode::SHORT_EDGE)); + } + return duplex_modes; +} + +arc::mojom::PrintAttributesPtr +StructTraits<arc::mojom::PrinterCapabilitiesDataView, + printing::PrinterSemanticCapsAndDefaults>:: + defaults(const printing::PrinterSemanticCapsAndDefaults& caps) { + arc::mojom::PrintDuplexMode default_duplex_mode; + switch (caps.duplex_default) { + case printing::LONG_EDGE: + default_duplex_mode = arc::mojom::PrintDuplexMode::LONG_EDGE; + break; + case printing::SHORT_EDGE: + default_duplex_mode = arc::mojom::PrintDuplexMode::SHORT_EDGE; + break; + default: + default_duplex_mode = arc::mojom::PrintDuplexMode::NONE; + } + return arc::mojom::PrintAttributes::New( + ToMediaSize(caps.default_paper), caps.default_dpi, + arc::mojom::PrintMargins::New(0, 0, 0, 0), + caps.color_default ? arc::mojom::PrintColorMode::COLOR + : arc::mojom::PrintColorMode::MONOCHROME, + default_duplex_mode); +} + +} // namespace mojo
diff --git a/chrome/browser/chromeos/arc/print/print_struct_traits.h b/chrome/browser/chromeos/arc/print/print_struct_traits.h new file mode 100644 index 0000000..52dab60 --- /dev/null +++ b/chrome/browser/chromeos/arc/print/print_struct_traits.h
@@ -0,0 +1,79 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_ARC_PRINT_PRINT_STRUCT_TRAITS_H_ +#define CHROME_BROWSER_CHROMEOS_ARC_PRINT_PRINT_STRUCT_TRAITS_H_ + +#include <string> +#include <vector> + +#include "components/arc/common/print.mojom.h" +#include "printing/backend/print_backend.h" +#include "printing/page_range.h" +#include "ui/gfx/geometry/size.h" + +namespace mojo { + +template <> +struct StructTraits<arc::mojom::PrintPageRangeDataView, printing::PageRange> { + static uint32_t start(const printing::PageRange& r) { return r.from; } + static uint32_t end(const printing::PageRange& r) { return r.to; } + + static bool Read(arc::mojom::PrintPageRangeDataView data, + printing::PageRange* out) { + out->from = data.start(); + out->to = data.end(); + return true; + } +}; + +template <> +struct StructTraits<arc::mojom::PrintResolutionDataView, gfx::Size> { + static uint32_t horizontal_dpi(const gfx::Size& size) { return size.width(); } + static uint32_t vertical_dpi(const gfx::Size& size) { return size.width(); } + static std::string id(const gfx::Size& size); + static std::string label(const gfx::Size& size) { return id(size); } + + static bool Read(arc::mojom::PrintResolutionDataView data, gfx::Size* out) { + *out = gfx::Size(data.horizontal_dpi(), data.vertical_dpi()); + return true; + } +}; + +// TODO(vkuzkokov): PrinterSemanticCapsAndDefaults has no margins, boolean +// duplex_capable, and unlabeled resolutions. +template <> +struct StructTraits<arc::mojom::PrinterCapabilitiesDataView, + printing::PrinterSemanticCapsAndDefaults> { + static std::vector<arc::mojom::PrintMediaSizePtr> media_sizes( + const printing::PrinterSemanticCapsAndDefaults& caps); + + static const std::vector<gfx::Size>& resolutions( + const printing::PrinterSemanticCapsAndDefaults& caps) { + return caps.dpis; + } + + static arc::mojom::PrintMarginsPtr min_margins( + const printing::PrinterSemanticCapsAndDefaults& caps); + + static arc::mojom::PrintColorMode color_modes( + const printing::PrinterSemanticCapsAndDefaults& caps); + + static arc::mojom::PrintDuplexMode duplex_modes( + const printing::PrinterSemanticCapsAndDefaults& caps); + + static arc::mojom::PrintAttributesPtr defaults( + const printing::PrinterSemanticCapsAndDefaults& caps); + + static bool Read(arc::mojom::PrinterCapabilitiesDataView data, + printing::PrinterSemanticCapsAndDefaults* out) { + // This is never used. + NOTREACHED(); + return false; + } +}; + +} // namespace mojo + +#endif // CHROME_BROWSER_CHROMEOS_ARC_PRINT_PRINT_STRUCT_TRAITS_H_
diff --git a/chrome/browser/chromeos/display/display_prefs.cc b/chrome/browser/chromeos/display/display_prefs.cc index 8395218..6a3d5b7 100644 --- a/chrome/browser/chromeos/display/display_prefs.cc +++ b/chrome/browser/chromeos/display/display_prefs.cc
@@ -479,7 +479,7 @@ continue; property_value->SetInteger("rotation", static_cast<int>(info.GetRotation( - display::Display::ROTATION_SOURCE_USER))); + display::Display::RotationSource::USER))); property_value->SetInteger( "ui-scale", static_cast<int>(info.configured_ui_scale() * 1000)); @@ -564,7 +564,7 @@ display::Display::Rotation rotation = GetDisplayManager() ->GetDisplayInfo(display::Display::InternalDisplayId()) - .GetRotation(display::Display::ROTATION_SOURCE_ACCELEROMETER); + .GetRotation(display::Display::RotationSource::ACCELEROMETER); bool rotation_lock = ash::Shell::Get() ->display_manager() ->registered_internal_display_rotation_lock();
diff --git a/chrome/browser/chromeos/display/display_prefs_unittest.cc b/chrome/browser/chromeos/display/display_prefs_unittest.cc index 4b809dd9..f7c8f3a 100644 --- a/chrome/browser/chromeos/display/display_prefs_unittest.cc +++ b/chrome/browser/chromeos/display/display_prefs_unittest.cc
@@ -208,7 +208,7 @@ return ash::Shell::Get() ->display_manager() ->GetDisplayInfo(display::Display::InternalDisplayId()) - .GetRotation(display::Display::ROTATION_SOURCE_ACCELEROMETER); + .GetRotation(display::Display::RotationSource::ACCELEROMETER); } void StoreExternalDisplayMirrorInfo( @@ -321,7 +321,7 @@ window_tree_host_manager->SetOverscanInsets(id1, gfx::Insets(10, 11, 12, 13)); display_manager()->SetDisplayRotation(id1, display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); EXPECT_TRUE(display::test::DisplayManagerTestApi(display_manager()) .SetDisplayUIScale(id1, 1.25f)); EXPECT_FALSE(display::test::DisplayManagerTestApi(display_manager()) @@ -717,7 +717,7 @@ gfx::Insets(10, 11, 12, 13)); display_manager()->SetDisplayRotation(new_primary, display::Display::ROTATE_90, - display::Display::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); // Does not store the preferences locally. EXPECT_FALSE(local_state() @@ -813,11 +813,11 @@ // Populate the properties. display_manager()->SetDisplayRotation(display::Display::InternalDisplayId(), display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); // Reset property to avoid rotation lock display_manager()->SetDisplayRotation(display::Display::InternalDisplayId(), display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); // Open up 270 degrees to trigger tablet mode scoped_refptr<chromeos::AccelerometerUpdate> update(
diff --git a/chrome/browser/chromeos/file_manager/audio_player_browsertest.cc b/chrome/browser/chromeos/file_manager/audio_player_browsertest.cc index 6ac2603..119a3b0 100644 --- a/chrome/browser/chromeos/file_manager/audio_player_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/audio_player_browsertest.cc
@@ -33,7 +33,9 @@ #if defined(MEMORY_SANITIZER) #define MAYBE_OpenAudioOnDownloads DISABLED_OpenAudioOnDownloads #else -#define MAYBE_OpenAudioOnDownloads OpenAudioOnDownloads +// TODO(yamaguchi): Enable after removing root cause of the test flakiness. +// http://crbug.com/804413. +#define MAYBE_OpenAudioOnDownloads DISABLED_OpenAudioOnDownloads #endif IN_PROC_BROWSER_TEST_F(AudioPlayerBrowserTest, MAYBE_OpenAudioOnDownloads) { set_test_case_name("openAudioOnDownloads"); @@ -50,7 +52,9 @@ #if defined(MEMORY_SANITIZER) #define MAYBE_OpenAudioOnDrive DISABLED_OpenAudioOnDrive #else -#define MAYBE_OpenAudioOnDrive OpenAudioOnDrive +// TODO(yamaguchi): Enable after removing root cause of the test flakiness. +// http://crbug.com/804413. +#define MAYBE_OpenAudioOnDrive DISABLED_OpenAudioOnDrive #endif IN_PROC_BROWSER_TEST_F(AudioPlayerBrowserTest, MAYBE_OpenAudioOnDrive) { set_test_case_name("openAudioOnDrive"); @@ -60,7 +64,9 @@ #if defined(MEMORY_SANITIZER) #define MAYBE_TogglePlayState DISABLED_TogglePlayState #else -#define MAYBE_TogglePlayState TogglePlayState +// TODO(yamaguchi): Enable after removing root cause of the test flakiness. +// http://crbug.com/804413. +#define MAYBE_TogglePlayState DISABLED_TogglePlayState #endif IN_PROC_BROWSER_TEST_F(AudioPlayerBrowserTest, MAYBE_TogglePlayState) { set_test_case_name("togglePlayState"); @@ -70,7 +76,9 @@ #if defined(MEMORY_SANITIZER) #define MAYBE_ChangeVolumeLevel DISABLED_ChangeVolumeLevel #else -#define MAYBE_ChangeVolumeLevel ChangeVolumeLevel +// TODO(yamaguchi): Enable after removing root cause of the test flakiness. +// http://crbug.com/804413. +#define MAYBE_ChangeVolumeLevel DISABLED_ChangeVolumeLevel #endif IN_PROC_BROWSER_TEST_F(AudioPlayerBrowserTest, MAYBE_ChangeVolumeLevel) { set_test_case_name("changeVolumeLevel");
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index 78b505a..524ce717 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
@@ -176,8 +176,10 @@ "deleteMenuItemIsDisabledWhenNoItemIsSelected"), TestParameter(NOT_IN_GUEST_MODE, "deleteOneItemFromToolbar"))); +// TODO(yamaguchi):Enable after removing root cause of the test flakiness. +// http://crbug.com/804413. WRAPPED_INSTANTIATE_TEST_CASE_P( - QuickView, + DISABLED_QuickView, FileManagerBrowserTest, ::testing::Values(TestParameter(NOT_IN_GUEST_MODE, "openQuickView"), TestParameter(NOT_IN_GUEST_MODE, "closeQuickView")));
diff --git a/chrome/browser/chromeos/file_manager/gallery_browsertest.cc b/chrome/browser/chromeos/file_manager/gallery_browsertest.cc index 7590f92..9610cdc 100644 --- a/chrome/browser/chromeos/file_manager/gallery_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/gallery_browsertest.cc
@@ -29,14 +29,14 @@ typedef GalleryBrowserTestBase<NOT_IN_GUEST_MODE> GalleryBrowserTest; typedef GalleryBrowserTestBase<IN_GUEST_MODE> GalleryBrowserTestInGuestMode; -// http://crbug.com/804413 +// http://crbug.com/804413. IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, DISABLED_OpenSingleImageOnDownloads) { set_test_case_name("openSingleImageOnDownloads"); StartTest(); } -// http://crbug.com/804413 +// http://crbug.com/804413. IN_PROC_BROWSER_TEST_F(GalleryBrowserTestInGuestMode, DISABLED_OpenSingleImageOnDownloads) { set_test_case_name("openSingleImageOnDownloads"); @@ -104,8 +104,10 @@ #else #define MAYBE_TraverseSlideImagesOnDownloads TraverseSlideImagesOnDownloads #endif +// TODO(yamaguchi):Enable after removing root cause of the test flakiness. +// http://crbug.com/804413. IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, - MAYBE_TraverseSlideImagesOnDownloads) { + DISABLED_TraverseSlideImagesOnDownloads) { set_test_case_name("traverseSlideImagesOnDownloads"); StartTest(); } @@ -506,30 +508,41 @@ #define MAYBE_SelectAllImagesAfterImageDeletionOnDownloads \ SelectAllImagesAfterImageDeletionOnDownloads #endif +// TODO(yamaguchi):Enable after removing root cause of the test flakiness. +// http://crbug.com/804413. IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, - SelectAllImagesAfterImageDeletionOnDownloads) { + DISABLED_SelectAllImagesAfterImageDeletionOnDownloads) { set_test_case_name("selectAllImagesAfterImageDeletionOnDownloads"); StartTest(); } +// TODO(yamaguchi):Enable after removing root cause of the test flakiness. +// http://crbug.com/804413. IN_PROC_BROWSER_TEST_F(GalleryBrowserTestInGuestMode, - SlideshowTraversalOnDownloads) { + DISABLED_SlideshowTraversalOnDownloads) { set_test_case_name("slideshowTraversalOnDownloads"); StartTest(); } -IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, SlideshowTraversalOnDownloads) { +// TODO(yamaguchi):Enable after removing root cause of the test flakiness. +// http://crbug.com/804413. +IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, + DISABLED_SlideshowTraversalOnDownloads) { set_test_case_name("slideshowTraversalOnDownloads"); StartTest(); } -IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, SlideshowTraversalOnDrive) { +// TODO(yamaguchi):Enable after removing root cause of the test flakiness. +// http://crbug.com/804413. +IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, DISABLED_SlideshowTraversalOnDrive) { set_test_case_name("slideshowTraversalOnDrive"); StartTest(); } +// TODO(yamaguchi):Enable after removing root cause of the test flakiness. +// http://crbug.com/804413. IN_PROC_BROWSER_TEST_F(GalleryBrowserTestInGuestMode, - StopStartSlideshowOnDownloads) { + DISABLED_StopStartSlideshowOnDownloads) { set_test_case_name("stopStartSlideshowOnDownloads"); StartTest(); } @@ -541,8 +554,10 @@ #else #define MAYBE_StopStartSlideshowOnDownloads StopStartSlideshowOnDownloads #endif +// TODO(yamaguchi):Enable after removing root cause of the test flakiness. +// http://crbug.com/804413. IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, - MAYBE_StopStartSlideshowOnDownloads) { + DISABLED_StopStartSlideshowOnDownloads) { set_test_case_name("stopStartSlideshowOnDownloads"); StartTest(); }
diff --git a/chrome/browser/chromeos/file_manager/video_player_browsertest.cc b/chrome/browser/chromeos/file_manager/video_player_browsertest.cc index 2a85a32..1bf5ff9 100644 --- a/chrome/browser/chromeos/file_manager/video_player_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/video_player_browsertest.cc
@@ -37,7 +37,10 @@ typedef VideoPlayerBrowserTestBase<IN_GUEST_MODE> VideoPlayerBrowserTestInGuestMode; -IN_PROC_BROWSER_TEST_F(VideoPlayerBrowserTest, OpenSingleVideoOnDownloads) { +// TODO(yamaguchi): Enable after removing root cause of the test flakiness. +// http://crbug.com/804413. +IN_PROC_BROWSER_TEST_F(VideoPlayerBrowserTest, + DISABLED_OpenSingleVideoOnDownloads) { set_test_case_name("openSingleVideoOnDownloads"); StartTest(); }
diff --git a/chrome/browser/chromeos/login/session/user_session_manager.cc b/chrome/browser/chromeos/login/session/user_session_manager.cc index 6e29539..1e70f87 100644 --- a/chrome/browser/chromeos/login/session/user_session_manager.cc +++ b/chrome/browser/chromeos/login/session/user_session_manager.cc
@@ -124,6 +124,7 @@ #include "extensions/common/features/feature_session_type.h" #include "net/cert/sth_distributor.h" #include "rlz/features/features.h" +#include "third_party/cros_system_api/switches/chrome_switches.h" #include "ui/base/ime/chromeos/input_method_descriptor.h" #include "ui/base/ime/chromeos/input_method_manager.h" #include "ui/base/ime/chromeos/input_method_util.h" @@ -274,7 +275,8 @@ about_flags::ConvertFlagsToSwitches(&flags_storage_, &user_flags, flags_ui::kAddSentinels); - UserSessionManager::MaybeAppendPolicySwitches(&user_flags); + UserSessionManager::MaybeAppendPolicySwitches(profile->GetPrefs(), + &user_flags); return user_flags; } @@ -291,19 +293,8 @@ if (user_manager::UserManager::Get()->IsLoggedInAsSupervisedUser()) return false; - // TODO: Remove this special handling for site isolation and isolate origins. auto* current_command_line = base::CommandLine::ForCurrentProcess(); - if (current_command_line->HasSwitch(::switches::kSitePerProcess) != - user_flags.HasSwitch(::switches::kSitePerProcess)) { - out_command_line_difference->insert(::switches::kSitePerProcess); - } - if (current_command_line->GetSwitchValueASCII(::switches::kIsolateOrigins) != - user_flags.GetSwitchValueASCII(::switches::kIsolateOrigins)) { - out_command_line_difference->insert(::switches::kIsolateOrigins); - } - - if (out_command_line_difference->empty() && - about_flags::AreSwitchesIdenticalToCurrentCommandLine( + if (about_flags::AreSwitchesIdenticalToCurrentCommandLine( user_flags, *current_command_line, out_command_line_difference)) { return false; } @@ -352,10 +343,16 @@ } } -void RestartOnTimeout() { +// Calls the real AttemptRestart method. This is used to avoid taking a function +// pointer to chrome::AttemptRestart directly. +void CallChromeAttemptRestart() { + chrome::AttemptRestart(); +} + +void RestartOnTimeout(const base::RepeatingClosure& attempt_restart_closure) { LOG(WARNING) << "Restarting Chrome because the time out was reached." "The session restore has not finished."; - chrome::AttemptRestart(); + attempt_restart_closure.Run(); } bool IsRunningTest() { @@ -406,17 +403,49 @@ // static void UserSessionManager::MaybeAppendPolicySwitches( + PrefService* user_profile_prefs, base::CommandLine* user_flags) { + // Get target values for --site-per-process and --isolate-origins for the user + // session according to policy. Values from command-line flags should not be + // honored at this point, so check |IsManaged()|. + const PrefService::Preference* site_per_process_pref = + user_profile_prefs->FindPreference(prefs::kSitePerProcess); + const PrefService::Preference* isolate_origins_pref = + user_profile_prefs->FindPreference(prefs::kIsolateOrigins); + bool site_per_process = site_per_process_pref->IsManaged() && + site_per_process_pref->GetValue()->GetBool(); + std::string isolate_origins = + isolate_origins_pref->IsManaged() + ? isolate_origins_pref->GetValue()->GetString() + : std::string(); + + // Append sentinels indicating that these values originate from policy. + // This is important, because only command-line switches between the + // |"--policy-switches-begin"| / |"--policy-switches-end"| and the + // |"--flag-switches-begin"| / |"--flag-switches-end"| sentinels will be + // compared when comparing the current command line and the user session + // command line in order to decide if chrome should be restarted. + // We use the policy-style sentinels because these values originate from + // policy, and because login_manager uses the same sentinels when adding the + // login-screen site isolation flags. + bool use_policy_sentinels = site_per_process || !isolate_origins.empty(); + if (use_policy_sentinels) + user_flags->AppendSwitch(chromeos::switches::kPolicySwitchesBegin); + // Inject site isolation and isolate origins command line switch from // user policy. - auto* local_state = g_browser_process->local_state(); - if (local_state->GetBoolean(prefs::kSitePerProcess)) { + if (site_per_process) { user_flags->AppendSwitch(::switches::kSitePerProcess); } - if (local_state->HasPrefPath(prefs::kIsolateOrigins)) { + + if (!isolate_origins.empty()) { user_flags->AppendSwitchASCII( ::switches::kIsolateOrigins, - local_state->GetString(prefs::kIsolateOrigins)); + user_profile_prefs->GetString(prefs::kIsolateOrigins)); + } + + if (use_policy_sentinels) { + user_flags->AppendSwitch(chromeos::switches::kPolicySwitchesEnd); } } @@ -433,6 +462,7 @@ should_obtain_handles_(true), should_launch_browser_(true), waiting_for_child_account_status_(false), + attempt_restart_closure_(base::BindRepeating(&CallChromeAttemptRestart)), weak_factory_(this) { net::NetworkChangeNotifier::AddNetworkChangeObserver(this); user_manager::UserManager::Get()->AddSessionStateObserver(this); @@ -459,6 +489,11 @@ } } +void UserSessionManager::SetAttemptRestartClosureInTests( + const base::RepeatingClosure& attempt_restart_closure) { + attempt_restart_closure_ = attempt_restart_closure; +} + void UserSessionManager::CompleteGuestSessionLogin(const GURL& start_url) { VLOG(1) << "Completing guest session login"; @@ -826,7 +861,7 @@ cryptohome::Identification( user_manager::UserManager::Get()->GetActiveUser()->GetAccountId()), flags); - AttemptRestart(profile); + attempt_restart_closure_.Run(); return true; } @@ -915,7 +950,7 @@ // We need to restart cleanly in this case to make sure OAuth2 RT is // actually saved. - chrome::AttemptRestart(); + attempt_restart_closure_.Run(); } else { // Schedule another flush after session restore for non-ephemeral profile // if not restarting. @@ -1762,7 +1797,7 @@ // Restart unconditionally in case if we are stuck somewhere in a session // restore process. http://crbug.com/520346. base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, base::BindOnce(RestartOnTimeout), + FROM_HERE, base::BindOnce(RestartOnTimeout, attempt_restart_closure_), base::TimeDelta::FromSeconds(kMaxRestartDelaySeconds)); if (running_easy_unlock_key_ops_) { @@ -1773,7 +1808,7 @@ if (session_restore_strategy_ != OAuth2LoginManager::RESTORE_FROM_COOKIE_JAR) { - chrome::AttemptRestart(); + attempt_restart_closure_.Run(); return; } @@ -1784,7 +1819,7 @@ if (login_manager->state() != OAuth2LoginManager::SESSION_RESTORE_PREPARING && login_manager->state() != OAuth2LoginManager::SESSION_RESTORE_IN_PROGRESS) { - chrome::AttemptRestart(); + attempt_restart_closure_.Run(); return; }
diff --git a/chrome/browser/chromeos/login/session/user_session_manager.h b/chrome/browser/chromeos/login/session/user_session_manager.h index 60d78a9..e283e42 100644 --- a/chrome/browser/chromeos/login/session/user_session_manager.h +++ b/chrome/browser/chromeos/login/session/user_session_manager.h
@@ -34,6 +34,7 @@ class AccountId; class GURL; class PrefRegistrySimple; +class PrefService; class Profile; class TokenHandleFetcher; @@ -120,7 +121,8 @@ // Appends additional command switches to the given command line if // SitePerProcess/IsolateOrigins policy is present. - static void MaybeAppendPolicySwitches(base::CommandLine* user_flags); + static void MaybeAppendPolicySwitches(PrefService* user_profile_prefs, + base::CommandLine* user_flags); // Invoked after the tmpfs is successfully mounted. // Asks session_manager to restart Chrome in Guest session mode. @@ -428,6 +430,10 @@ // Controls whether token handle fetching is enabled (used in tests). void SetShouldObtainHandleInTests(bool should_obtain_handles); + // Sets the function which is used to request a chrome restart. + void SetAttemptRestartClosureInTests( + const base::RepeatingClosure& attempt_restart_closure); + // The user pods display type for histogram. enum UserPodsDisplay { // User pods enabling or disabling is possible either via local settings or @@ -543,6 +549,9 @@ std::vector<base::OnceClosure> easy_unlock_key_ops_finished_callbacks_; + // Mapped to |chrome::AttemptRestart|, except in tests. + base::RepeatingClosure attempt_restart_closure_; + base::WeakPtrFactory<UserSessionManager> weak_factory_; DISALLOW_COPY_AND_ASSIGN(UserSessionManager);
diff --git a/chrome/browser/chromeos/login/session/user_session_manager_test_api.cc b/chrome/browser/chromeos/login/session/user_session_manager_test_api.cc index 8b76a10..e25708aa 100644 --- a/chrome/browser/chromeos/login/session/user_session_manager_test_api.cc +++ b/chrome/browser/chromeos/login/session/user_session_manager_test_api.cc
@@ -26,5 +26,10 @@ session_manager_->SetShouldObtainHandleInTests(should_obtain_handle); } +void UserSessionManagerTestApi::SetAttemptRestartClosureInTests( + const base::RepeatingClosure& attempt_restart_closure) { + session_manager_->SetAttemptRestartClosureInTests(attempt_restart_closure); +} + } // namespace test } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/session/user_session_manager_test_api.h b/chrome/browser/chromeos/login/session/user_session_manager_test_api.h index da6e014..bbe43d7 100644 --- a/chrome/browser/chromeos/login/session/user_session_manager_test_api.h +++ b/chrome/browser/chromeos/login/session/user_session_manager_test_api.h
@@ -27,6 +27,10 @@ // Controls whether token handle fetching is enabled (used in tests). void SetShouldObtainTokenHandleInTests(bool should_obtain_handle); + // Sets the function which is used to request a chrome restart. + void SetAttemptRestartClosureInTests( + const base::RepeatingClosure& attempt_restart_closure); + private: UserSessionManager* session_manager_; // not owned
diff --git a/chrome/browser/chromeos/policy/display_rotation_default_handler.cc b/chrome/browser/chromeos/policy/display_rotation_default_handler.cc index a01c42a..5906801 100644 --- a/chrome/browser/chromeos/policy/display_rotation_default_handler.cc +++ b/chrome/browser/chromeos/policy/display_rotation_default_handler.cc
@@ -74,7 +74,7 @@ if (display.rotation() != display_rotation_default_) { display_manager->SetDisplayRotation( id, display_rotation_default_, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); } } }
diff --git a/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc b/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc index 485548a..23f80196 100644 --- a/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc +++ b/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc
@@ -206,7 +206,7 @@ const display::Display::Rotation user_rotation = display::Display::ROTATE_90; GetDisplayManager()->SetDisplayRotation( GetDisplayManager()->first_display_id(), user_rotation, - display::Display::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); EXPECT_EQ(user_rotation, GetRotationOfFirstDisplay()) << "Rotation of primary display after user change"; SetPolicy(policy_rotation); @@ -214,7 +214,7 @@ << "Rotation of primary display after policy overrode user change"; GetDisplayManager()->SetDisplayRotation( GetDisplayManager()->first_display_id(), user_rotation, - display::Display::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); EXPECT_EQ(user_rotation, GetRotationOfFirstDisplay()) << "Rotation of primary display after user overrode policy change"; SetADifferentPolicy(); @@ -237,7 +237,7 @@ SetPolicy(policy_rotation); GetDisplayManager()->SetDisplayRotation( GetDisplayManager()->first_display_id(), user_rotation, - display::Display::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); UnsetPolicy(); EXPECT_EQ(user_rotation, GetRotationOfFirstDisplay()) << "Rotation of primary display after policy was set to " @@ -313,7 +313,7 @@ // Let the user rotate the display to a different orientation, to check that // the policy value is restored after reboot. display_manager->SetDisplayRotation(first_display_id, user_rotation, - display::Display::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); EXPECT_EQ(user_rotation, first_display.rotation()); }
diff --git a/chrome/browser/chromeos/policy/site_isolation_flag_handling_browsertest.cc b/chrome/browser/chromeos/policy/site_isolation_flag_handling_browsertest.cc new file mode 100644 index 0000000..2cd0e332 --- /dev/null +++ b/chrome/browser/chromeos/policy/site_isolation_flag_handling_browsertest.cc
@@ -0,0 +1,352 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <ostream> +#include <string> +#include <vector> + +#include "base/command_line.h" +#include "base/macros.h" +#include "base/stl_util.h" +#include "base/strings/string_util.h" +#include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/chromeos/login/existing_user_controller.h" +#include "chrome/browser/chromeos/login/login_manager_test.h" +#include "chrome/browser/chromeos/login/session/user_session_manager.h" +#include "chrome/browser/chromeos/login/session/user_session_manager_test_api.h" +#include "chrome/browser/chromeos/login/signin_specifics.h" +#include "chrome/browser/chromeos/login/startup_utils.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "chromeos/chromeos_switches.h" +#include "chromeos/cryptohome/cryptohome_parameters.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_session_manager_client.h" +#include "components/policy/core/browser/browser_policy_connector.h" +#include "components/policy/core/common/mock_configuration_policy_provider.h" +#include "components/policy/core/common/policy_map.h" +#include "components/policy/core/common/policy_types.h" +#include "components/policy/policy_constants.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_source.h" +#include "content/public/common/content_switches.h" +#include "content/public/test/test_utils.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/cros_system_api/switches/chrome_switches.h" + +namespace chromeos { +namespace { + +struct Params { + Params(bool login_screen_site_per_process, + std::string login_screen_isolate_origins, + bool user_policy_site_per_process, + std::string user_policy_isolate_origins, + bool expected_request_restart, + std::vector<std::string> expected_flags_for_user) + : login_screen_site_per_process(login_screen_site_per_process), + login_screen_isolate_origins(login_screen_isolate_origins), + user_policy_site_per_process(user_policy_site_per_process), + user_policy_isolate_origins(user_policy_isolate_origins), + expected_request_restart(expected_request_restart), + expected_flags_for_user(expected_flags_for_user) {} + + friend std::ostream& operator<<(std::ostream& os, const Params& p) { + os << "{" << std::endl + << " login_screen_site_per_process: " << p.login_screen_site_per_process + << std::endl + << " login_screen_isolate_origins: " << p.login_screen_isolate_origins + << std::endl + << " user_policy_site_per_process: " << p.user_policy_site_per_process + << std::endl + << " user_policy_isolate_origins: " << p.user_policy_isolate_origins + << std::endl + << " expected_request_restart: " << p.expected_request_restart + << std::endl + << " expected_flags_for_user: " + << base::JoinString(p.expected_flags_for_user, ", ") << std::endl + << "}"; + return os; + } + + // If true, --site-per-process will be passed to the login manager chrome + // instance between policy flag sentinels. + // Note: On Chrome OS, login_manager evaluates device policy and does this. + bool login_screen_site_per_process; + // If non-empty, --isolate-origins=|login_screen_isolate_origins| will be + // passed to the login manager chrome instance between policy flag sentinels. + // Note: On Chrome OS, login_manager evaluates device policy and does this. + std::string login_screen_isolate_origins; + + // If true, the SitePerProcess user policy will be simulated to be set to + // true. + bool user_policy_site_per_process; + // If non-empty, the IsolateOrigins user policy will be simulated to be set + // |user_policy_isolate_origins|. + std::string user_policy_isolate_origins; + + // If true, the test case will expect that AttemptRestart has been called by + // UserSessionManager. + bool expected_request_restart; + // When a restart was requested, the test case verifies that the flags passed + // to |SessionManagerClient::SetFlagsForUser| match + // |expected_flags_for_user|. + std::vector<std::string> expected_flags_for_user; +}; + +// Defines the test cases that will be executed. +const Params kTestCases[] = { + // No site isolation in device or user policy - no restart expected. + Params(false /* login_screen_site_per_process */, + std::string() /* login_screen_isolate_origins */, + false /* user_policy_site_per_process */, + std::string() /* user_policy_isolate_origins */, + false /* expected_request_restart */, + {} /* expected_flags_for_user */), + // SitePerProcess in user policy only - restart expected with + // additional --site-per-process flag. + Params(false /* login_screen_site_per_process */, + std::string() /* login_screen_isolate_origins */, + true /* user_policy_site_per_process */, + std::string() /* user_policy_isolate_origins */, + true /* expected_request_restart */, + {"--policy-switches-begin", "--site-per-process", + "--policy-switches-end"} /* expected_flags_for_user */), + // SitePerProcess in device and user policy - no restart expected. + Params(true /* login_screen_site_per_process */, + std::string() /* login_screen_isolate_origins */, + true /* user_policy_site_per_process */, + std::string() /* user_policy_isolate_origins */, + false /* expected_request_restart */, + {} /* expected_flags_for_user */), + // SitePerProcess only in device policy - restart expected. + Params(true /* login_screen_site_per_process */, + std::string() /* login_screen_isolate_origins */, + false /* user_policy_site_per_process */, + std::string() /* user_policy_isolate_origins */, + true /* expected_request_restart */, + {} /* expected_flags_for_user */), + // IsolateOrigins in user policy only - restart expected with + // additional --isolate-origins flag. + Params(false /* login_screen_site_per_process */, + std::string() /* login_screen_isolate_origins */, + false /* user_policy_site_per_process */, + "https://example.com" /* user_policy_isolate_origins */, + true /* expected_request_restart */, + {"--policy-switches-begin", "--isolate-origins=https://example.com", + "--policy-switches-end"} /* expected_flags_for_user */), + // Equal IsolateOrigins in device and user policy - no restart expected. + Params(false /* login_screen_site_per_process */, + "https://example.com" /* login_screen_isolate_origins */, + false /* user_policy_site_per_process */, + "https://example.com" /* user_policy_isolate_origins */, + false /* expected_request_restart */, + {} /* expected_flags_for_user */), + // Different IsolateOrigins in device and user policy - restart expected. + Params(false /* login_screen_site_per_process */, + "https://example.com" /* login_screen_isolate_origins */, + false /* user_policy_site_per_process */, + "https://example2.com" /* user_policy_isolate_origins */, + true /* expected_request_restart */, + {"--policy-switches-begin", "--isolate-origins=https://example2.com", + "--policy-switches-end"} /* expected_flags_for_user */), + // IsolateOrigins only in device policy - restart expected. + Params(true /* login_screen_site_per_process */, + "https://example.com" /* login_screen_isolate_origins */, + false /* user_policy_site_per_process */, + std::string() /* user_policy_isolate_origins */, + true /* expected_request_restart */, + {} /* expected_flags_for_user */), + // SitePerProcess in device policy, IsolateOrigins in user policy - restart + // expected. + Params(true /* login_screen_site_per_process */, + std::string() /* login_screen_isolate_origins */, + false /* user_policy_site_per_process */, + "https://example.com" /* user_policy_isolate_origins */, + true /* expected_request_restart */, + {"--policy-switches-begin", "--isolate-origins=https://example.com", + "--policy-switches-end"} /* expected_flags_for_user */)}; + +constexpr char kTestUser[] = "test-user@gmail.com"; +constexpr char kTestUserGaiaId[] = "1111111111"; + +class SiteIsolationFlagHandlingTest + : public LoginManagerTest, + public ::testing::WithParamInterface<Params> { + protected: + SiteIsolationFlagHandlingTest() + : LoginManagerTest(false /* should_launch_browser */) {} + + void SetUpCommandLine(base::CommandLine* command_line) override { + LoginManagerTest::SetUpCommandLine(command_line); + + // Simulate login_manager behavior: pass --site-per-process or + // --isolate-origins between policy flag sentinels according to test case + // parameters. + bool use_policy_switches_sentinels = + GetParam().login_screen_site_per_process || + !GetParam().login_screen_isolate_origins.empty(); + if (use_policy_switches_sentinels) + command_line->AppendSwitch(switches::kPolicySwitchesBegin); + + if (GetParam().login_screen_site_per_process) + command_line->AppendSwitch(::switches::kSitePerProcess); + if (!GetParam().login_screen_isolate_origins.empty()) { + command_line->AppendSwitchASCII(::switches::kIsolateOrigins, + GetParam().login_screen_isolate_origins); + } + + if (use_policy_switches_sentinels) + command_line->AppendSwitch(switches::kPolicySwitchesEnd); + } + + void SetUpInProcessBrowserTestFixture() override { + LoginManagerTest::SetUpInProcessBrowserTestFixture(); + + // Set up fake_session_manager_client_ so we can verify the flags for the + // user session. + auto fake_session_manager_client = + std::make_unique<FakeSessionManagerClient>(); + fake_session_manager_client_ = fake_session_manager_client.get(); + DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( + std::move(fake_session_manager_client)); + + // Mark that chrome restart can be requested. + // Note that AttemptRestart() is mocked out in UserSessionManager through + // |SetAttemptRestartClosureInTests| (set up in SetUpOnMainThread). + fake_session_manager_client_->set_supports_restart_to_apply_user_flags( + true); + + // Set up user policy with values given from test case parameters. + EXPECT_CALL(provider_, IsInitializationComplete(testing::_)) + .WillRepeatedly(testing::Return(true)); + + policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); + + policy::PolicyMap values; + if (GetParam().user_policy_site_per_process) { + values.Set(policy::key::kSitePerProcess, policy::POLICY_LEVEL_MANDATORY, + policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, + std::make_unique<base::Value>(true), nullptr); + } + if (!GetParam().user_policy_isolate_origins.empty()) { + values.Set( + policy::key::kIsolateOrigins, policy::POLICY_LEVEL_MANDATORY, + policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, + std::make_unique<base::Value>(GetParam().user_policy_isolate_origins), + nullptr); + } + provider_.UpdateChromePolicy(values); + } + + void SetUpOnMainThread() override { + LoginManagerTest::SetUpOnMainThread(); + + login_wait_loop_ = std::make_unique<base::RunLoop>(); + + // Mock out chrome restart. + test::UserSessionManagerTestApi session_manager_test_api( + UserSessionManager::GetInstance()); + session_manager_test_api.SetAttemptRestartClosureInTests( + base::BindRepeating( + &SiteIsolationFlagHandlingTest::AttemptRestartCalled, + base::Unretained(this))); + + // Observe for user session start. + user_session_started_observer_ = + std::make_unique<content::WindowedNotificationObserver>( + chrome::NOTIFICATION_SESSION_STARTED, + base::BindRepeating( + &SiteIsolationFlagHandlingTest::UserSessionStarted, + base::Unretained(this))); + } + + bool HasAttemptRestartBeenCalled() const { return attempt_restart_called_; } + + FakeSessionManagerClient* fake_session_manager_client() { + return fake_session_manager_client_; + } + + UserContext CreateUserContext(const AccountId& account_id) { + UserContext user_context(account_id); + user_context.SetKey(Key("password")); + return user_context; + } + + // Called when log-in was successful. + bool UserSessionStarted(const content::NotificationSource& source, + const content::NotificationDetails& details) { + login_wait_loop_->Quit(); + return true; + } + + const AccountId test_account_id_ = + AccountId::FromUserEmailGaiaId(kTestUser, kTestUserGaiaId); + + // Used to wait until either login succeeds by starting a user session, or + // chrome requests a restart. + std::unique_ptr<base::RunLoop> login_wait_loop_; + + private: + // Called when chrome requests a restarted. + void AttemptRestartCalled() { + login_wait_loop_->Quit(); + attempt_restart_called_ = true; + } + + // This will be set to |true| when chrome has requested a restart. + bool attempt_restart_called_ = false; + + // Observes for user session start. + std::unique_ptr<content::WindowedNotificationObserver> + user_session_started_observer_; + // Unowned pointer - owned by DBusThreadManager. + FakeSessionManagerClient* fake_session_manager_client_; + policy::MockConfigurationPolicyProvider provider_; + DISALLOW_COPY_AND_ASSIGN(SiteIsolationFlagHandlingTest); +}; + +} // namespace + +IN_PROC_BROWSER_TEST_P(SiteIsolationFlagHandlingTest, PRE_FlagHandlingTest) { + RegisterUser(test_account_id_); + StartupUtils::MarkOobeCompleted(); +} + +IN_PROC_BROWSER_TEST_P(SiteIsolationFlagHandlingTest, FlagHandlingTest) { + // Start user sign-in. We can't use |LoginManagerTest::LoginUser|, because + // it waits for a user session start unconditionally, which will not happen if + // chrome requests a restart to set user-session flags. + ExistingUserController* controller = + ExistingUserController::current_controller(); + ASSERT_TRUE(controller); + controller->Login(CreateUserContext(test_account_id_), SigninSpecifics()); + + // Wait for either the user session to start, or for restart to be requested + // (whichever happens first). + login_wait_loop_->Run(); + + EXPECT_EQ(GetParam().expected_request_restart, HasAttemptRestartBeenCalled()); + + if (!HasAttemptRestartBeenCalled()) + return; + + // Also verify flags if chrome was restart. + std::vector<std::string> flags_for_user; + bool has_flags_for_user = fake_session_manager_client()->GetFlagsForUser( + cryptohome::Identification(test_account_id_), &flags_for_user); + EXPECT_TRUE(has_flags_for_user); + + // Remove flag sentinels. Keep whatever is between those sentinels, to + // verify that we don't pass additional parameters in there. + base::EraseIf(flags_for_user, [](const std::string& flag) { + return flag == "--flag-switches-begin" || flag == "--flag-switches-end"; + }); + EXPECT_EQ(GetParam().expected_flags_for_user, flags_for_user); +} + +INSTANTIATE_TEST_CASE_P(, + SiteIsolationFlagHandlingTest, + ::testing::ValuesIn(kTestCases)); + +} // namespace chromeos
diff --git a/chrome/browser/chromeos/printing/cups_print_job_manager_impl.cc b/chrome/browser/chromeos/printing/cups_print_job_manager_impl.cc index 13f15a0..3f2d3ce 100644 --- a/chrome/browser/chromeos/printing/cups_print_job_manager_impl.cc +++ b/chrome/browser/chromeos/printing/cups_print_job_manager_impl.cc
@@ -306,18 +306,10 @@ // Must be run from the UI thread. void CancelPrintJob(CupsPrintJob* job) override { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - // Copy job_id and printer_id. |job| is about to be freed. - const int job_id = job->job_id(); - const std::string printer_id = job->printer().id(); - - // Stop montioring jobs after we cancel them. The user no longer cares. - jobs_.erase(job->GetUniqueId()); - - query_runner_->PostTask( - FROM_HERE, - base::Bind(&CupsWrapper::CancelJobImpl, - base::Unretained(cups_wrapper_.get()), printer_id, job_id)); + job->set_state(CupsPrintJob::State::STATE_CANCELLED); + NotifyJobCanceled(job); + // Ideally we should wait for IPP response. + FinishPrintJob(job); } bool SuspendPrintJob(CupsPrintJob* job) override { @@ -396,6 +388,20 @@ return true; } + void FinishPrintJob(CupsPrintJob* job) { + // Copy job_id and printer_id. |job| is about to be freed. + const int job_id = job->job_id(); + const std::string printer_id = job->printer().id(); + + // Stop montioring jobs after we cancel them. The user no longer cares. + jobs_.erase(job->GetUniqueId()); + + query_runner_->PostTask( + FROM_HERE, base::BindOnce(&CupsWrapper::CancelJobImpl, + base::Unretained(cups_wrapper_.get()), + printer_id, job_id)); + } + // Schedule a query of CUPS for print job status with a delay of |delay|. void ScheduleQuery(int attempt_count = 1) { const int delay_ms = kPollRate * attempt_count; @@ -473,11 +479,11 @@ if (print_job->expired()) { // Job needs to be forcibly cancelled. RecordJobResult(TIMEOUT_CANCEL); - CancelPrintJob(print_job); + FinishPrintJob(print_job); // Beware, print_job was removed from jobs_ and deleted. } else if (print_job->PipelineDead()) { RecordJobResult(FILTER_FAILED); - CancelPrintJob(print_job); + FinishPrintJob(print_job); } else if (print_job->IsJobFinished()) { // Cleanup completed jobs. VLOG(1) << "Removing Job " << print_job->document_title();
diff --git a/chrome/browser/clipboard/clipboard_read_permission_context.cc b/chrome/browser/clipboard/clipboard_read_permission_context.cc index a0efc75..e74f98b3 100644 --- a/chrome/browser/clipboard/clipboard_read_permission_context.cc +++ b/chrome/browser/clipboard/clipboard_read_permission_context.cc
@@ -8,7 +8,7 @@ #include "chrome/browser/permissions/permission_request_id.h" #include "chrome/common/chrome_features.h" #include "components/content_settings/core/common/content_settings_types.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom.h" ClipboardReadPermissionContext::ClipboardReadPermissionContext(Profile* profile) : PermissionContextBase(profile,
diff --git a/chrome/browser/clipboard/clipboard_write_permission_context.cc b/chrome/browser/clipboard/clipboard_write_permission_context.cc index 23f19150..e27e73c 100644 --- a/chrome/browser/clipboard/clipboard_write_permission_context.cc +++ b/chrome/browser/clipboard/clipboard_write_permission_context.cc
@@ -6,7 +6,7 @@ #include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings_types.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom.h" #include "url/gurl.h" ClipboardWritePermissionContext::ClipboardWritePermissionContext(
diff --git a/chrome/browser/extensions/display_info_provider_chromeos.cc b/chrome/browser/extensions/display_info_provider_chromeos.cc index 1a89d39..855c95c 100644 --- a/chrome/browser/extensions/display_info_provider_chromeos.cc +++ b/chrome/browser/extensions/display_info_provider_chromeos.cc
@@ -656,7 +656,7 @@ } else { display_configuration_controller->SetDisplayRotation( display_id, DegreesToRotation(*info.rotation), - display::Display::ROTATION_SOURCE_USER); + display::Display::RotationSource::USER); } }
diff --git a/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc b/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc index 4b960d51..0bd9137 100644 --- a/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc +++ b/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc
@@ -411,7 +411,7 @@ GetDisplayManager()->SetDisplayRotation( display_id, display::Display::ROTATE_270, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); result = GetAllDisplaysInfo(); @@ -423,7 +423,7 @@ GetDisplayManager()->SetDisplayRotation( display_id, display::Display::ROTATE_180, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); result = GetAllDisplaysInfo(); @@ -435,7 +435,7 @@ GetDisplayManager()->SetDisplayRotation( display_id, display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); result = GetAllDisplaysInfo(); @@ -1167,7 +1167,7 @@ ash::ScreenOrientationControllerTestApi test_api( screen_orientation_controller); test_api.SetDisplayRotation(display::Display::ROTATE_0, - display::Display::ROTATION_SOURCE_ACTIVE); + display::Display::RotationSource::ACTIVE); EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation()); // Exiting tablet mode should restore the initial rotation
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 98491be..481b4f7 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -1603,7 +1603,6 @@ const char kV8CacheOptionsName[] = "V8 caching mode."; const char kV8CacheOptionsDescription[] = "Caching mode for the V8 JavaScript engine."; -const char kV8CacheOptionsParse[] = "Cache V8 parser data."; const char kV8CacheOptionsCode[] = "Cache V8 compiler data."; const char kV8ContextSnapshotName[] = "Use a snapshot to create V8 contexts."; @@ -2055,6 +2054,10 @@ "Whether to use the Google Play Services Location Settings Dialog " "permission dialog."; +const char kModalPermissionDialogViewName[] = "Modal Permission Dialog"; +const char kModalPermissionDialogViewDescription[] = + "Enable this option to use ModalDialogManager for permission Dialogs."; + const char kMediaScreenCaptureName[] = "Experimental ScreenCapture."; const char kMediaScreenCaptureDescription[] = "Enable this option for experimental ScreenCapture feature on Android.";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 0d3be6c..069b0f5 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1250,6 +1250,9 @@ extern const char kLsdPermissionPromptName[]; extern const char kLsdPermissionPromptDescription[]; +extern const char kModalPermissionDialogViewName[]; +extern const char kModalPermissionDialogViewDescription[]; + extern const char kMediaScreenCaptureName[]; extern const char kMediaScreenCaptureDescription[];
diff --git a/chrome/browser/generic_sensor/sensor_permission_context.cc b/chrome/browser/generic_sensor/sensor_permission_context.cc index 08f4c3d3..878fc8bc 100644 --- a/chrome/browser/generic_sensor/sensor_permission_context.cc +++ b/chrome/browser/generic_sensor/sensor_permission_context.cc
@@ -6,7 +6,7 @@ #include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings_types.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom.h" #include "url/gurl.h" SensorPermissionContext::SensorPermissionContext(Profile* profile)
diff --git a/chrome/browser/media/webrtc/media_stream_devices_controller.cc b/chrome/browser/media/webrtc/media_stream_devices_controller.cc index ee0b7fe..f5f6615 100644 --- a/chrome/browser/media/webrtc/media_stream_devices_controller.cc +++ b/chrome/browser/media/webrtc/media_stream_devices_controller.cc
@@ -37,7 +37,7 @@ #include "content/public/common/media_stream_request.h" #include "content/public/common/origin_util.h" #include "extensions/common/constants.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom.h" #if defined(OS_ANDROID) #include <vector>
diff --git a/chrome/browser/metrics/chromeos_metrics_provider.cc b/chrome/browser/metrics/chromeos_metrics_provider.cc index 5495b44..00c38cb 100644 --- a/chrome/browser/metrics/chromeos_metrics_provider.cc +++ b/chrome/browser/metrics/chromeos_metrics_provider.cc
@@ -202,9 +202,9 @@ hardware->set_hardware_class(hardware_class_); display::Display::TouchSupport has_touch = ui::GetInternalDisplayTouchSupport(); - if (has_touch == display::Display::TOUCH_SUPPORT_AVAILABLE) + if (has_touch == display::Display::TouchSupport::AVAILABLE) hardware->set_internal_display_supports_touch(true); - else if (has_touch == display::Display::TOUCH_SUPPORT_UNAVAILABLE) + else if (has_touch == display::Display::TouchSupport::UNAVAILABLE) hardware->set_internal_display_supports_touch(false); }
diff --git a/chrome/browser/permissions/permission_context_base.h b/chrome/browser/permissions/permission_context_base.h index ad0b279..ec5eff6 100644 --- a/chrome/browser/permissions/permission_context_base.h +++ b/chrome/browser/permissions/permission_context_base.h
@@ -16,7 +16,7 @@ #include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings_types.h" #include "components/keyed_service/core/keyed_service.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom.h" class GURL; class PermissionRequestID;
diff --git a/chrome/browser/permissions/permission_context_base_feature_policy_unittest.cc b/chrome/browser/permissions/permission_context_base_feature_policy_unittest.cc index eab8119..b89089b 100644 --- a/chrome/browser/permissions/permission_context_base_feature_policy_unittest.cc +++ b/chrome/browser/permissions/permission_context_base_feature_policy_unittest.cc
@@ -17,7 +17,7 @@ #include "content/public/common/content_features.h" #include "content/public/test/navigation_simulator.h" #include "content/public/test/test_renderer_host.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom.h" #include "url/gurl.h" #include "url/origin.h"
diff --git a/chrome/browser/policy/cloud/device_management_service_browsertest.cc b/chrome/browser/policy/cloud/device_management_service_browsertest.cc index be94037..292c86f3 100644 --- a/chrome/browser/policy/cloud/device_management_service_browsertest.cc +++ b/chrome/browser/policy/cloud/device_management_service_browsertest.cc
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/callback_helpers.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/stl_util.h" @@ -60,6 +61,8 @@ response.mutable_policy_response()->add_response(); } else if (request.has_auto_enrollment_request()) { response.mutable_auto_enrollment_response(); + } else if (request.has_app_install_report_request()) { + response.mutable_app_install_report_response(); } else { FAIL() << "Failed to parse request."; } @@ -261,6 +264,26 @@ run_loop.Run(); } +IN_PROC_BROWSER_TEST_P(DeviceManagementServiceIntegrationTest, + AppInstallReport) { + PerformRegistration(); + + ExpectRequest(); + base::RunLoop run_loop; + EXPECT_CALL(*this, OnJobDone(DM_STATUS_SUCCESS, _, _)) + .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::QuitWhenIdle)); + std::unique_ptr<DeviceManagementRequestJob> job(service_->CreateJob( + DeviceManagementRequestJob::TYPE_UPLOAD_APP_INSTALL_REPORT, + g_browser_process->system_request_context())); + job->SetDMToken(token_); + job->SetClientID("testid"); + job->GetRequest()->mutable_app_install_report_request(); + job->Start(base::AdaptCallbackForRepeating( + base::BindOnce(&DeviceManagementServiceIntegrationTest::OnJobDone, + base::Unretained(this)))); + run_loop.Run(); +} + INSTANTIATE_TEST_CASE_P( DeviceManagementServiceIntegrationTestInstance, DeviceManagementServiceIntegrationTest,
diff --git a/chrome/browser/policy/test/policy_testserver.py b/chrome/browser/policy/test/policy_testserver.py index eb42863..49100a2 100644 --- a/chrome/browser/policy/test/policy_testserver.py +++ b/chrome/browser/policy/test/policy_testserver.py
@@ -330,6 +330,9 @@ response = self.ProcessCheckAndroidManagementRequest( rmsg.check_android_management_request, str(self.GetUniqueParam('oauth_token'))) + elif request_type == 'app_install_report': + response = self.ProcessAppInstallReportRequest( + rmsg.app_install_report_request) else: return (400, 'Invalid request parameter') @@ -725,6 +728,18 @@ else: return (403, response) + def ProcessAppInstallReportRequest(self, app_install_report): + """Handles a push-installed app report upload request. + + Returns: + A tuple of HTTP status code and response data to send to the client. + """ + app_install_report_response = dm.AppInstallReportResponse() + response = dm.DeviceManagementResponse() + response.app_install_report_response.CopyFrom(app_install_report_response) + + return (200, response) + def SetProtoRepeatedField(self, group_message, field, field_value): assert type(field_value) == list entries = group_message.__getattribute__(field.name)
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc index 9ed2c45..ba99093 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc
@@ -6,6 +6,7 @@ #include <memory> #include <string> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -205,6 +206,20 @@ base::Unretained(this), std::move(new_settings)))); } +#if defined(OS_CHROMEOS) +void PrintJobWorker::SetSettingsFromPOD( + std::unique_ptr<printing::PrintSettings> new_settings) { + DCHECK(task_runner_->RunsTasksInCurrentSequence()); + + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::BindOnce( + &HoldRefCallback, base::WrapRefCounted(owner_), + base::BindOnce(&PrintJobWorker::UpdatePrintSettingsFromPOD, + base::Unretained(this), std::move(new_settings)))); +} +#endif + void PrintJobWorker::UpdatePrintSettings( std::unique_ptr<base::DictionaryValue> new_settings) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -213,6 +228,16 @@ GetSettingsDone(result); } +#if defined(OS_CHROMEOS) +void PrintJobWorker::UpdatePrintSettingsFromPOD( + std::unique_ptr<printing::PrintSettings> new_settings) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + PrintingContext::Result result = + printing_context_->UpdatePrintSettingsFromPOD(std::move(new_settings)); + GetSettingsDone(result); +} +#endif + void PrintJobWorker::GetSettingsDone(PrintingContext::Result result) { // Most PrintingContext functions may start a message loop and process // message recursively, so disable recursive task processing.
diff --git a/chrome/browser/printing/print_job_worker.h b/chrome/browser/printing/print_job_worker.h index c46a55d8..4ad10b4 100644 --- a/chrome/browser/printing/print_job_worker.h +++ b/chrome/browser/printing/print_job_worker.h
@@ -54,9 +54,15 @@ bool is_scripted, bool is_modifiable); - // Set the new print settings. + // Set the new print settings from a dictionary value. void SetSettings(std::unique_ptr<base::DictionaryValue> new_settings); +#if defined(OS_CHROMEOS) + // Set the new print settings from a POD type. + void SetSettingsFromPOD( + std::unique_ptr<printing::PrintSettings> new_settings); +#endif + // Starts the printing loop. Every pages are printed as soon as the data is // available. Makes sure the new_document is the right one. void StartPrinting(PrintedDocument* new_document); @@ -129,6 +135,12 @@ // Called on the UI thread to update the print settings. void UpdatePrintSettings(std::unique_ptr<base::DictionaryValue> new_settings); +#if defined(OS_CHROMEOS) + // Called on the UI thread to update the print settings. + void UpdatePrintSettingsFromPOD( + std::unique_ptr<printing::PrintSettings> new_settings); +#endif + // Reports settings back to owner_. void GetSettingsDone(PrintingContext::Result result);
diff --git a/chrome/browser/printing/printer_query.cc b/chrome/browser/printing/printer_query.cc index 913c7d8..4bf55055 100644 --- a/chrome/browser/printing/printer_query.cc +++ b/chrome/browser/printing/printer_query.cc
@@ -99,6 +99,19 @@ std::move(new_settings))); } +#if defined(OS_CHROMEOS) +void PrinterQuery::SetSettingsFromPOD( + std::unique_ptr<printing::PrintSettings> new_settings, + base::OnceClosure callback) { + StartWorker(std::move(callback)); + + worker_->PostTask( + FROM_HERE, + base::BindOnce(&PrintJobWorker::SetSettingsFromPOD, + base::Unretained(worker_.get()), std::move(new_settings))); +} +#endif + void PrinterQuery::StartWorker(base::OnceClosure callback) { DCHECK(!callback_); DCHECK(worker_);
diff --git a/chrome/browser/printing/printer_query.h b/chrome/browser/printing/printer_query.h index 769d653c..e0251a4 100644 --- a/chrome/browser/printing/printer_query.h +++ b/chrome/browser/printing/printer_query.h
@@ -55,6 +55,12 @@ void SetSettings(std::unique_ptr<base::DictionaryValue> new_settings, base::OnceClosure callback); +#if defined(OS_CHROMEOS) + // Updates the current settings with |new_settings|. + void SetSettingsFromPOD(std::unique_ptr<printing::PrintSettings> new_settings, + base::OnceClosure callback); +#endif + // Stops the worker thread since the client is done with this object. void StopWorker();
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js index e7e1c391..1ce088d 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js
@@ -238,10 +238,8 @@ } // Require a current range. - if (!ChromeVoxState.instance.currentRange_) { - new Output().format('@warning_no_current_range').go(); + if (!ChromeVoxState.instance.currentRange_) return true; - } var current = ChromeVoxState.instance.currentRange_;
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.cc b/chrome/browser/ui/autofill/chrome_autofill_client.cc index 28f349d..0865d0c 100644 --- a/chrome/browser/ui/autofill/chrome_autofill_client.cc +++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc
@@ -17,6 +17,7 @@ #include "chrome/browser/password_manager/chrome_password_manager_client.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/signin/signin_promo_util.h" @@ -128,6 +129,12 @@ return ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); } +identity::IdentityManager* ChromeAutofillClient::GetIdentityManager() { + Profile* profile = + Profile::FromBrowserContext(web_contents()->GetBrowserContext()); + return IdentityManagerFactory::GetInstance()->GetForProfile(profile); +} + IdentityProvider* ChromeAutofillClient::GetIdentityProvider() { if (!identity_provider_) { Profile* profile =
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.h b/chrome/browser/ui/autofill/chrome_autofill_client.h index 3dcfa21d..ed59437 100644 --- a/chrome/browser/ui/autofill/chrome_autofill_client.h +++ b/chrome/browser/ui/autofill/chrome_autofill_client.h
@@ -51,6 +51,7 @@ scoped_refptr<AutofillWebDataService> GetDatabase() override; PrefService* GetPrefs() override; syncer::SyncService* GetSyncService() override; + identity::IdentityManager* GetIdentityManager() override; IdentityProvider* GetIdentityProvider() override; ukm::UkmRecorder* GetUkmRecorder() override; AddressNormalizer* GetAddressNormalizer() override;
diff --git a/chrome/browser/ui/views/payments/cvc_unmask_view_controller.cc b/chrome/browser/ui/views/payments/cvc_unmask_view_controller.cc index 1fb75dc..6c9d7ce 100644 --- a/chrome/browser/ui/views/payments/cvc_unmask_view_controller.cc +++ b/chrome/browser/ui/views/payments/cvc_unmask_view_controller.cc
@@ -10,8 +10,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/autofill/risk_util.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" -#include "chrome/browser/signin/signin_manager_factory.h" +#include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/ui/views/autofill/view_util.h" #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" @@ -25,8 +24,6 @@ #include "components/grit/components_scaled_resources.h" #include "components/payments/content/payment_request_state.h" #include "components/payments/core/payment_request_delegate.h" -#include "components/signin/core/browser/profile_identity_provider.h" -#include "components/signin/core/browser/signin_manager.h" #include "components/strings/grit/components_strings.h" #include "components/vector_icons/vector_icons.h" #include "content/public/browser/web_contents.h" @@ -42,20 +39,6 @@ namespace payments { -namespace { - -IdentityProvider* CreateIdentityProviderForWebContents( - content::WebContents* web_contents) { - Profile* profile = - Profile::FromBrowserContext(web_contents->GetBrowserContext()); - return new ProfileIdentityProvider( - SigninManagerFactory::GetForProfile(profile), - ProfileOAuth2TokenServiceFactory::GetForProfile(profile), - base::Closure()); -} - -} // namespace - enum class Tags { CONFIRM_TAG = static_cast<int>(PaymentRequestCommonTags::PAY_BUTTON_TAG), }; @@ -72,13 +55,13 @@ year_combobox_model_(credit_card.expiration_year()), credit_card_(credit_card), web_contents_(web_contents), - identity_provider_(CreateIdentityProviderForWebContents(web_contents)), payments_client_( Profile::FromBrowserContext(web_contents_->GetBrowserContext()) ->GetRequestContext(), Profile::FromBrowserContext(web_contents_->GetBrowserContext()) ->GetPrefs(), - identity_provider_.get(), + IdentityManagerFactory::GetInstance()->GetForProfile( + Profile::FromBrowserContext(web_contents_->GetBrowserContext())), /*unmask_delegate=*/this, /*save_delegate=*/nullptr), full_card_request_(this,
diff --git a/chrome/browser/ui/views/payments/cvc_unmask_view_controller.h b/chrome/browser/ui/views/payments/cvc_unmask_view_controller.h index 68aed8d..dea6c19 100644 --- a/chrome/browser/ui/views/payments/cvc_unmask_view_controller.h +++ b/chrome/browser/ui/views/payments/cvc_unmask_view_controller.h
@@ -104,8 +104,6 @@ views::Textfield* cvc_field_; // owned by the view hierarchy, outlives this. autofill::CreditCard credit_card_; content::WebContents* web_contents_; - // The identity provider, used for Payments integration. - std::unique_ptr<IdentityProvider> identity_provider_; autofill::payments::PaymentsClient payments_client_; autofill::payments::FullCardRequest full_card_request_; base::WeakPtr<autofill::CardUnmaskDelegate> unmask_delegate_;
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc b/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc index 93b5b1f5..62fe9bd 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc +++ b/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc
@@ -23,8 +23,7 @@ namespace { bool TouchSupportAvailable(const display::Display& display) { - return display.touch_support() == - display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE; + return display.touch_support() == display::Display::TouchSupport::AVAILABLE; } // TODO(felixe): More context at crbug.com/738885
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc b/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc index 55379f63..e63d517 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc +++ b/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc
@@ -97,7 +97,7 @@ display::ManagedDisplayInfo::CreateFromSpecWithID("0+0-3000x2000", 1)); display_info.push_back( display::ManagedDisplayInfo::CreateFromSpecWithID("3000+0-800x600", 2)); - display_info[0].set_touch_support(display::Display::TOUCH_SUPPORT_AVAILABLE); + display_info[0].set_touch_support(display::Display::TouchSupport::AVAILABLE); display_manager()->OnNativeDisplaysChanged(display_info); base::RunLoop().RunUntilIdle();
diff --git a/chrome/browser/ui/webui/flags_ui.cc b/chrome/browser/ui/webui/flags_ui.cc index 63701c68..ff91793 100644 --- a/chrome/browser/ui/webui/flags_ui.cc +++ b/chrome/browser/ui/webui/flags_ui.cc
@@ -223,7 +223,8 @@ // Apply additional switches from policy that should not be dropped when // applying flags.. - chromeos::UserSessionManager::MaybeAppendPolicySwitches(&user_flags); + chromeos::UserSessionManager::MaybeAppendPolicySwitches( + Profile::FromWebUI(web_ui())->GetPrefs(), &user_flags); base::CommandLine::StringVector flags; // argv[0] is the program name |base::CommandLine::NO_PROGRAM|.
diff --git a/chrome/browser/usb/usb_tab_helper.cc b/chrome/browser/usb/usb_tab_helper.cc index 53aa706..b991fa8e 100644 --- a/chrome/browser/usb/usb_tab_helper.cc +++ b/chrome/browser/usb/usb_tab_helper.cc
@@ -14,7 +14,7 @@ #include "content/public/common/content_features.h" #include "device/usb/mojo/device_manager_impl.h" #include "mojo/public/cpp/bindings/message.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom.h" #if defined(OS_ANDROID) #include "chrome/browser/android/usb/web_usb_chooser_service_android.h"
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 549ddb6..b3a14edb 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -1603,6 +1603,7 @@ "../browser/chromeos/policy/power_policy_browsertest.cc", "../browser/chromeos/policy/restore_on_startup_browsertest_chromeos.cc", "../browser/chromeos/policy/signin_profile_apps_policy_browsertest.cc", + "../browser/chromeos/policy/site_isolation_flag_handling_browsertest.cc", "../browser/chromeos/policy/unaffiliated_arc_allowed_browsertest.cc", "../browser/chromeos/policy/user_affiliation_browsertest.cc", "../browser/chromeos/policy/user_cloud_external_data_manager_browsertest.cc",
diff --git a/chrome/test/data/nacl/pnacl_url_loader/pnacl_url_loader.cc b/chrome/test/data/nacl/pnacl_url_loader/pnacl_url_loader.cc index 9ef656b..4ec7b52 100644 --- a/chrome/test/data/nacl/pnacl_url_loader/pnacl_url_loader.cc +++ b/chrome/test/data/nacl/pnacl_url_loader/pnacl_url_loader.cc
@@ -22,14 +22,7 @@ command_ = var_message.AsString(); pp::URLRequestInfo request(this); request.SetMethod("GET"); - if (command_.find("Other") != std::string::npos) - request.SetURL("https://www.example.com/echo"); - else - request.SetURL("/echo"); - if (command_.find("CORS") != std::string::npos) - request.SetAllowCrossOriginRequests(true); - if (command_.find("Credentials") != std::string::npos) - request.SetAllowCredentials(true); + request.SetURL("/echo"); loader_.Open(request, factory_.NewCallback(&PnaclUrlLoaderInstance::OnOpen)); return;
diff --git a/chrome/test/data/nacl/pnacl_url_loader/pnacl_url_loader.html b/chrome/test/data/nacl/pnacl_url_loader/pnacl_url_loader.html index 0420ab5..696d2993 100644 --- a/chrome/test/data/nacl/pnacl_url_loader/pnacl_url_loader.html +++ b/chrome/test/data/nacl/pnacl_url_loader/pnacl_url_loader.html
@@ -11,6 +11,7 @@ embed.addEventListener('load', function() { embed.postMessage(location.hash.substr(1)); }, false); + // The code for this plug-in is in pnacl_url_loader.cc. embed.src = 'pnacl_url_loader.nmf'; embed.type = 'application/x-pnacl'; document.body.appendChild(embed);
diff --git a/chromeos/dbus/fake_session_manager_client.cc b/chromeos/dbus/fake_session_manager_client.cc index f88416f0..0215f5a 100644 --- a/chromeos/dbus/fake_session_manager_client.cc +++ b/chromeos/dbus/fake_session_manager_client.cc
@@ -457,12 +457,14 @@ } bool FakeSessionManagerClient::SupportsRestartToApplyUserFlags() const { - return false; + return supports_restart_to_apply_user_flags_; } void FakeSessionManagerClient::SetFlagsForUser( const cryptohome::Identification& cryptohome_id, - const std::vector<std::string>& flags) {} + const std::vector<std::string>& flags) { + flags_for_user_[cryptohome_id] = flags; +} void FakeSessionManagerClient::GetServerBackedStateKeys( StateKeysCallback callback) { @@ -566,6 +568,17 @@ observer.ArcInstanceStopped(clean, container_instance_id); } +bool FakeSessionManagerClient::GetFlagsForUser( + const cryptohome::Identification& cryptohome_id, + std::vector<std::string>* out_flags_for_user) const { + auto iter = flags_for_user_.find(cryptohome_id); + if (iter == flags_for_user_.end()) + return false; + + *out_flags_for_user = iter->second; + return true; +} + const std::string& FakeSessionManagerClient::device_policy() const { return device_policy_; }
diff --git a/chromeos/dbus/fake_session_manager_client.h b/chromeos/dbus/fake_session_manager_client.h index f5ad5a6..d0f201d11 100644 --- a/chromeos/dbus/fake_session_manager_client.h +++ b/chromeos/dbus/fake_session_manager_client.h
@@ -101,6 +101,21 @@ void NotifyArcInstanceStopped(bool clean, const std::string& conainer_instance_id); + // Returns true if flags for |cryptohome_id| have been set. If the return + // value is |true|, |*out_flags_for_user| is filled with the flags passed to + // |SetFlagsForUser|. + bool GetFlagsForUser(const cryptohome::Identification& cryptohome_id, + std::vector<std::string>* out_flags_for_user) const; + + // Sets whether FakeSessionManagerClient should advertise (through + // |SupportsRestartToApplyUserFlags|) that it supports restarting chrome to + // apply user-session flags. The default is |false|. + void set_supports_restart_to_apply_user_flags( + bool supports_restart_to_apply_user_flags) { + supports_restart_to_apply_user_flags_ = + supports_restart_to_apply_user_flags; + } + void set_store_device_policy_success(bool success) { store_device_policy_success_ = success; } @@ -167,6 +182,8 @@ } private: + bool supports_restart_to_apply_user_flags_ = false; + bool store_device_policy_success_ = true; std::string device_policy_; std::map<cryptohome::Identification, std::string> user_policies_; @@ -203,6 +220,10 @@ // multiple FakeSessionManagerOptions. uint32_t options_; + // The last-set flags for user set through |SetFlagsForUser|. + std::map<cryptohome::Identification, std::vector<std::string>> + flags_for_user_; + base::WeakPtrFactory<FakeSessionManagerClient> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(FakeSessionManagerClient); };
diff --git a/components/arc/common/print.mojom b/components/arc/common/print.mojom index 3f03b7f..f74d468c 100644 --- a/components/arc/common/print.mojom +++ b/components/arc/common/print.mojom
@@ -6,12 +6,193 @@ module arc.mojom; -// Next method ID: 1 -interface PrintHost { - Print@0(handle file); +// android.print.PageRange +struct PrintPageRange { + // First page inclusive. + int32 start; + // Last page inclusive. + int32 end; }; +// android.print.PrintAttributes.MediaSize +struct PrintMediaSize { + // Id unique among media sizes. + string id; + // Localized label. + string label; + int32 width_mils; + int32 height_mils; +}; + +// android.print.PrintAttributes.Resolution +struct PrintResolution { + // Id unique among resolutions. + string id; + // Localized label. + string label; + int32 horizontal_dpi; + int32 vertical_dpi; +}; + +// android.print.PrintAttributes.Margins +struct PrintMargins { + int32 left_mils; + int32 top_mils; + int32 right_mils; + int32 bottom_mils; +}; + +// android.print.PrintAttributes.COLOR_MODE_* +[Extensible] +enum PrintColorMode { + MONOCHROME = 1, + COLOR = 2, +}; + +// android.print.PrintAttributes.DUPLEX_MODE_* +[Extensible] +enum PrintDuplexMode { + NONE = 1, + LONG_EDGE = 2, + SHORT_EDGE = 4, +}; + +// android.print.PrintDocumentInfo.CONTENT_TYPE_* +[Extensible] +enum PrintContentType { + UNKNOWN = -1, + DOCUMENT = 0, + PHOTO = 1, +}; + +// android.print.PrintAttributes +struct PrintAttributes { + PrintMediaSize? media_size; + PrintResolution? resolution; + PrintMargins? min_margins; + PrintColorMode color_mode; + PrintDuplexMode duplex_mode; +}; + +struct PrintJobRequest { + // android.printservice.PrintJob fields: + array<int8> id; + string label; + string? printer_id; + int64 creation_time; + int32 copies; + array<PrintPageRange> pages; + PrintAttributes attributes; + // android.print.PrintDocumentInfo fields: + string document_name; + int32 document_page_count; + PrintContentType content_type; + int64 data_size; + // android.printservice.PrintDocument fields: + handle? data; +}; + +// android.print.PrinterInfo.STATUS_* +[Extensible] +enum PrinterStatus { + IDLE = 1, + BUSY = 2, + UNAVAILABLE = 3, +}; + +// android.print.PrinterCapabilitiesInfo +struct PrinterCapabilities { + array<PrintMediaSize> media_sizes; + array<PrintResolution> resolutions; + PrintMargins min_margins; + PrintColorMode color_modes; + PrintDuplexMode duplex_modes; + PrintAttributes defaults; +}; + +// android.print.PrinterInfo +struct PrinterInfo { + // Id unique among printers. + string id; + // Localized name. + string name; + PrinterStatus status; + // Localized description. + string? description; + // Intent for provider-specific settings. + string? info_intent; + PrinterCapabilities? capabilities; +}; + +// android.printservice.PrinterDiscoverySession implementation. +// This is called by container when printing is requested and printer discovery +// has to start. Implemented in embedder. +// The normal order this is called is: +// StartPrinterDiscovery +// StartPrinterStateTracking +// StopPrinterStateTracking +// StopPrinterDiscovery +// DestroyDiscoverySession +// (ValidatePrinters is not used in practice) +// +// Next method ID: 6 +interface PrinterDiscoverySessionHost { + StartPrinterDiscovery@0(array<string> printer_ids); + StopPrinterDiscovery@1(); + ValidatePrinters@2(array<string> printer_ids); + StartPrinterStateTracking@3(string printer_id); + StopPrinterStateTracking@4(string printer_id); + DestroyDiscoverySession@5(); +}; + +// android.printservice.PrinterDiscoverySession final methods proxy. +// This is called by embedder when printer discovery is active. +// Implemented in container. // Next method ID: 2 +interface PrinterDiscoverySessionInstance { + AddPrinters@0(array<PrinterInfo> printers); + RemovePrinters@1(array<string> printers); +}; + +// android.printservice.PrintService.onRequestCancelPrintJob implementation. +// This is called by container when job cancellation was requested. +// Implemented in embedder. +// Next method ID: 1 +interface PrintJobHost { + Cancel@0(); +}; + +// android.printservice.PrintJob proxy. +// This is called by embedder when print job status changes. +// Implemented in container. +// See https://developer.android.com/reference/android/printservice/PrintJob.html +// Next method ID: 7 +interface PrintJobInstance { + Start@0(); + Block@1(string? reason); + Complete@2(); + Fail@3(string? reason); + Cancel@4(); + SetProgress@5(float progress); + SetStatus@6(string? status); +}; + +// android.printservice.PrintService implementation. +// This is called by container to create new discovery sessions and print jobs. +// Implemented in embedder. +// Next method ID: 2 +// Deprecated method ID: 0 +interface PrintHost { + PrintDeprecated@0(handle file); + [MinVersion=1] Print@1(PrintJobInstance instance, PrintJobRequest request) => (PrintJobHost host); + [MinVersion=1] CreateDiscoverySession@2(PrinterDiscoverySessionInstance instance) => + (PrinterDiscoverySessionHost host); +}; + +// This is called by embedder to indicate that it's ready to accept print jobs. +// Implemented in container. +// Next method ID: 2 +// Deprecated method ID: 0 interface PrintInstance { // DEPRECATED: Please use Init@1 instead. InitDeprecated@0(PrintHost host_ptr);
diff --git a/components/arc/common/print.typemap b/components/arc/common/print.typemap new file mode 100644 index 0000000..c8bb925 --- /dev/null +++ b/components/arc/common/print.typemap
@@ -0,0 +1,19 @@ +mojom = "//components/arc/common/print.mojom" +public_headers = [ + "//printing/backend/print_backend.h", + "//printing/page_range.h", + "//ui/gfx/geometry/size.h", +] +traits_headers = [ "//chrome/browser/chromeos/arc/print/print_struct_traits.h" ] +sources = [ + "//chrome/browser/chromeos/arc/print/print_struct_traits.cc", +] +deps = [] +public_deps = [ + "//printing:printing", +] +type_mappings = [ + "arc.mojom.PrintPageRange=printing::PageRange", + "arc.mojom.PrintResolution=gfx::Size", + "arc.mojom.PrinterCapabilities=printing::PrinterSemanticCapsAndDefaults", +]
diff --git a/components/arc/common/typemaps.gni b/components/arc/common/typemaps.gni index 648b5243..5dd1b81f 100644 --- a/components/arc/common/typemaps.gni +++ b/components/arc/common/typemaps.gni
@@ -9,6 +9,7 @@ "//components/arc/common/file_system.typemap", "//components/arc/common/gfx.typemap", "//components/arc/common/intent_helper.typemap", + "//components/arc/common/print.typemap", "//components/arc/common/timer.typemap", "//components/arc/common/video_common.typemap", "//components/arc/common/video_encode_accelerator.typemap",
diff --git a/components/autofill/core/browser/BUILD.gn b/components/autofill/core/browser/BUILD.gn index 490257a..a89e8aae 100644 --- a/components/autofill/core/browser/BUILD.gn +++ b/components/autofill/core/browser/BUILD.gn
@@ -244,6 +244,7 @@ "//components/webdata/common", "//google_apis", "//net", + "//services/identity/public/cpp", "//services/metrics/public/cpp:metrics_cpp", "//services/metrics/public/cpp:ukm_builders", "//sql", @@ -330,6 +331,7 @@ "//components/ukm", "//components/ukm:test_support", "//google_apis:test_support", + "//services/identity/public/cpp:test_support", "//skia", "//testing/gtest", "//third_party/libaddressinput:util", @@ -462,6 +464,7 @@ "//google_apis", "//google_apis:test_support", "//net:test_support", + "//services/identity/public/cpp:test_support", "//services/metrics/public/cpp:ukm_builders", "//sql", "//testing/gmock",
diff --git a/components/autofill/core/browser/DEPS b/components/autofill/core/browser/DEPS index 40eebce..2238940 100644 --- a/components/autofill/core/browser/DEPS +++ b/components/autofill/core/browser/DEPS
@@ -16,6 +16,7 @@ "+google_apis/gaia", "+google_apis/google_api_keys.h", "+net", + "+services/identity/public", "+services/metrics/public", "+sql", "+third_party/fips181",
diff --git a/components/autofill/core/browser/autofill_client.h b/components/autofill/core/browser/autofill_client.h index c44c5ec4..d7503786 100644 --- a/components/autofill/core/browser/autofill_client.h +++ b/components/autofill/core/browser/autofill_client.h
@@ -29,6 +29,10 @@ class RectF; } +namespace identity { +class IdentityManager; +} + namespace syncer { class SyncService; } @@ -102,7 +106,11 @@ // Gets the sync service associated with the client. virtual syncer::SyncService* GetSyncService() = 0; + // Gets the IdentityManager associated with the client. + virtual identity::IdentityManager* GetIdentityManager() = 0; + // Gets the IdentityProvider associated with the client (for OAuth2). + // TODO(https://crbug.com/809435): Remove. virtual IdentityProvider* GetIdentityProvider() = 0; // Gets the UKM service associated with this client (for metrics).
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc index c2efc79..00378fab 100644 --- a/components/autofill/core/browser/autofill_manager.cc +++ b/components/autofill/core/browser/autofill_manager.cc
@@ -1178,7 +1178,7 @@ payments_client_(std::make_unique<payments::PaymentsClient>( driver->GetURLRequestContext(), client->GetPrefs(), - client->GetIdentityProvider(), + client->GetIdentityManager(), /*unmask_delegate=*/this, // save_delegate starts out as nullptr and is set up by the // CreditCardSaveManager owned by form_data_importer_.
diff --git a/components/autofill/core/browser/credit_card_save_manager_unittest.cc b/components/autofill/core/browser/credit_card_save_manager_unittest.cc index d8ba01b..ac38115 100644 --- a/components/autofill/core/browser/credit_card_save_manager_unittest.cc +++ b/components/autofill/core/browser/credit_card_save_manager_unittest.cc
@@ -99,7 +99,7 @@ autofill_driver_->SetURLRequestContext(request_context_.get()); payments_client_ = new payments::TestPaymentsClient( autofill_driver_->GetURLRequestContext(), autofill_client_.GetPrefs(), - autofill_client_.GetIdentityProvider(), + autofill_client_.GetIdentityManager(), /*unmask_delegate=*/nullptr, // Will be set by CreditCardSaveManager's ctor /*save_delegate=*/nullptr);
diff --git a/components/autofill/core/browser/payments/full_card_request_unittest.cc b/components/autofill/core/browser/payments/full_card_request_unittest.cc index 6b2269fb0..3f95ca3a 100644 --- a/components/autofill/core/browser/payments/full_card_request_unittest.cc +++ b/components/autofill/core/browser/payments/full_card_request_unittest.cc
@@ -76,7 +76,7 @@ autofill_client_.SetPrefs(std::move(pref_service)); payments_client_ = std::make_unique<PaymentsClient>( request_context_.get(), autofill_client_.GetPrefs(), - autofill_client_.GetIdentityProvider(), this, nullptr); + autofill_client_.GetIdentityManager(), this, nullptr); request_ = std::make_unique<FullCardRequest>( &autofill_client_, payments_client_.get(), &personal_data_); // Silence the warning from PaymentsClient about matching sync and Payments
diff --git a/components/autofill/core/browser/payments/payments_client.cc b/components/autofill/core/browser/payments/payments_client.cc index 719ad55..f65c821 100644 --- a/components/autofill/core/browser/payments/payments_client.cc +++ b/components/autofill/core/browser/payments/payments_client.cc
@@ -24,13 +24,13 @@ #include "components/autofill/core/browser/payments/payments_request.h" #include "components/autofill/core/browser/payments/payments_service_url.h" #include "components/data_use_measurement/core/data_use_user_data.h" -#include "google_apis/gaia/identity_provider.h" #include "net/base/escape.h" #include "net/base/load_flags.h" #include "net/http/http_status_code.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "net/url_request/url_fetcher.h" #include "net/url_request/url_request_context_getter.h" +#include "services/identity/public/cpp/identity_manager.h" namespace autofill { namespace payments { @@ -56,7 +56,7 @@ "requestContentType=application/json; charset=utf-8&request=%s" "&s7e_1_pan=%s"; -const char kTokenServiceConsumerId[] = "wallet_client"; +const char kTokenFetchId[] = "wallet_client"; const char kPaymentsOAuth2Scope[] = "https://www.googleapis.com/auth/wallet.chrome"; @@ -456,13 +456,12 @@ PaymentsClient::PaymentsClient(net::URLRequestContextGetter* context_getter, PrefService* pref_service, - IdentityProvider* identity_provider, + identity::IdentityManager* identity_manager, PaymentsClientUnmaskDelegate* unmask_delegate, PaymentsClientSaveDelegate* save_delegate) - : OAuth2TokenService::Consumer(kTokenServiceConsumerId), - context_getter_(context_getter), + : context_getter_(context_getter), pref_service_(pref_service), - identity_provider_(identity_provider), + identity_manager_(identity_manager), unmask_delegate_(unmask_delegate), save_delegate_(save_delegate), has_retried_authorization_(false), @@ -581,7 +580,7 @@ void PaymentsClient::CancelRequest() { request_.reset(); url_fetcher_.reset(); - access_token_request_.reset(); + token_fetcher_.reset(); access_token_.clear(); has_retried_authorization_ = false; } @@ -654,46 +653,52 @@ request_->RespondToDelegate(result); } -void PaymentsClient::OnGetTokenSuccess( - const OAuth2TokenService::Request* request, - const std::string& access_token, - const base::Time& expiration_time) { - DCHECK_EQ(request, access_token_request_.get()); +void PaymentsClient::AccessTokenFetchFinished( + const GoogleServiceAuthError& error, + const std::string& access_token) { + // Delete the fetcher only after we leave this method (which is called from + // the fetcher itself). + DCHECK(token_fetcher_); + std::unique_ptr<identity::PrimaryAccountAccessTokenFetcher> + token_fetcher_deleter(std::move(token_fetcher_)); + + if (error.state() != GoogleServiceAuthError::NONE) { + AccessTokenError(error); + return; + } + access_token_ = access_token; if (url_fetcher_) SetOAuth2TokenAndStartRequest(); - - access_token_request_.reset(); } -void PaymentsClient::OnGetTokenFailure( - const OAuth2TokenService::Request* request, - const GoogleServiceAuthError& error) { - DCHECK_EQ(request, access_token_request_.get()); +void PaymentsClient::AccessTokenError(const GoogleServiceAuthError& error) { VLOG(1) << "Unhandled OAuth2 error: " << error.ToString(); if (url_fetcher_) { url_fetcher_.reset(); request_->RespondToDelegate(AutofillClient::PERMANENT_FAILURE); } - access_token_request_.reset(); } void PaymentsClient::StartTokenFetch(bool invalidate_old) { // We're still waiting for the last request to come back. - if (!invalidate_old && access_token_request_) + if (!invalidate_old && token_fetcher_) return; OAuth2TokenService::ScopeSet payments_scopes; payments_scopes.insert(kPaymentsOAuth2Scope); if (invalidate_old) { DCHECK(!access_token_.empty()); - identity_provider_->GetTokenService()->InvalidateAccessToken( - identity_provider_->GetActiveAccountId(), payments_scopes, + identity_manager_->RemoveAccessTokenFromCache( + identity_manager_->GetPrimaryAccountInfo(), payments_scopes, access_token_); } access_token_.clear(); - access_token_request_ = identity_provider_->GetTokenService()->StartRequest( - identity_provider_->GetActiveAccountId(), payments_scopes, this); + token_fetcher_ = identity_manager_->CreateAccessTokenFetcherForPrimaryAccount( + kTokenFetchId, payments_scopes, + base::BindOnce(&PaymentsClient::AccessTokenFetchFinished, + base::Unretained(this)), + identity::PrimaryAccountAccessTokenFetcher::Mode::kImmediate); } void PaymentsClient::SetOAuth2TokenAndStartRequest() {
diff --git a/components/autofill/core/browser/payments/payments_client.h b/components/autofill/core/browser/payments/payments_client.h index 5b10f216..f097be9 100644 --- a/components/autofill/core/browser/payments/payments_client.h +++ b/components/autofill/core/browser/payments/payments_client.h
@@ -13,10 +13,13 @@ #include "components/autofill/core/browser/card_unmask_delegate.h" #include "components/autofill/core/browser/credit_card.h" #include "components/prefs/pref_service.h" -#include "google_apis/gaia/oauth2_token_service.h" +#include "google_apis/gaia/google_service_auth_error.h" #include "net/url_request/url_fetcher_delegate.h" -class IdentityProvider; +namespace identity { +class IdentityManager; +class PrimaryAccountAccessTokenFetcher; +} // namespace identity namespace net { class URLFetcher; @@ -59,8 +62,7 @@ // request will cancel a pending request. // Tests are located in // src/components/autofill/content/browser/payments/payments_client_unittest.cc. -class PaymentsClient : public net::URLFetcherDelegate, - public OAuth2TokenService::Consumer { +class PaymentsClient : public net::URLFetcherDelegate { public: // The names of the fields used to send non-location elements as part of an // address. Used in the implementation and in tests which verify that these @@ -100,11 +102,11 @@ // |context_getter| is reference counted so it has no lifetime or ownership // requirements. |pref_service| is used to get the registered preference - // value, |identity_provider|, |unmask_delegate| and |save_delegate| must all + // value, |identity_manager|, |unmask_delegate| and |save_delegate| must all // outlive |this|. Either delegate might be nullptr. PaymentsClient(net::URLRequestContextGetter* context_getter, PrefService* pref_service, - IdentityProvider* identity_provider, + identity::IdentityManager* identity_manager, PaymentsClientUnmaskDelegate* unmask_delegate, PaymentsClientSaveDelegate* save_delegate); @@ -162,12 +164,12 @@ // net::URLFetcherDelegate: void OnURLFetchComplete(const net::URLFetcher* source) override; - // OAuth2TokenService::Consumer implementation. - void OnGetTokenSuccess(const OAuth2TokenService::Request* request, - const std::string& access_token, - const base::Time& expiration_time) override; - void OnGetTokenFailure(const OAuth2TokenService::Request* request, - const GoogleServiceAuthError& error) override; + // Callback that handles a completed access token request. + void AccessTokenFetchFinished(const GoogleServiceAuthError& error, + const std::string& access_token); + + // Handles a completed access token request in the case of failure. + void AccessTokenError(const GoogleServiceAuthError& error); // Creates |url_fetcher_| based on the current state of |request_|. void InitializeUrlFetcher(); @@ -184,7 +186,7 @@ // The pref service for this client. PrefService* const pref_service_; - IdentityProvider* const identity_provider_; + identity::IdentityManager* const identity_manager_; // Delegates for the results of the various requests to Payments. Both must // outlive |this|. @@ -197,8 +199,8 @@ // The fetcher being used to issue the current request. std::unique_ptr<net::URLFetcher> url_fetcher_; - // The current OAuth2 token request object. - std::unique_ptr<OAuth2TokenService::Request> access_token_request_; + // The current OAuth2 token fetcher. + std::unique_ptr<identity::PrimaryAccountAccessTokenFetcher> token_fetcher_; // The OAuth2 token, or empty if not fetched. std::string access_token_;
diff --git a/components/autofill/core/browser/payments/payments_client_unittest.cc b/components/autofill/core/browser/payments/payments_client_unittest.cc index dcb3d01c..50ef8b7 100644 --- a/components/autofill/core/browser/payments/payments_client_unittest.cc +++ b/components/autofill/core/browser/payments/payments_client_unittest.cc
@@ -20,10 +20,9 @@ #include "components/autofill/core/common/autofill_switches.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/testing_pref_service.h" -#include "google_apis/gaia/fake_identity_provider.h" -#include "google_apis/gaia/fake_oauth2_token_service.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_request_test_util.h" +#include "services/identity/public/cpp/identity_test_environment.h" #include "testing/gtest/include/gtest/gtest.h" namespace autofill { @@ -62,11 +61,10 @@ request_context_ = new net::TestURLRequestContextGetter( base::ThreadTaskRunnerHandle::Get()); - token_service_.reset(new FakeOAuth2TokenService()); - identity_provider_.reset(new FakeIdentityProvider(token_service_.get())); TestingPrefServiceSimple pref_service_; client_.reset(new PaymentsClient(request_context_.get(), &pref_service_, - identity_provider_.get(), this, this)); + identity_test_env_.identity_manager(), + this, this)); } void TearDown() override { client_.reset(); } @@ -110,8 +108,9 @@ base::test::ScopedFeatureList scoped_feature_list_; void StartUnmasking() { - token_service_->AddAccount("example@gmail.com"); - identity_provider_->LogIn("example@gmail.com"); + if (!identity_test_env_.identity_manager()->HasPrimaryAccount()) + identity_test_env_.MakePrimaryAccountAvailable("example@gmail.com"); + PaymentsClient::UnmaskRequestDetails request_details; request_details.billing_customer_number = 111222333444; request_details.card = test::GetMaskedServerCard(); @@ -121,16 +120,18 @@ } void StartGettingUploadDetails() { - token_service_->AddAccount("example@gmail.com"); - identity_provider_->LogIn("example@gmail.com"); + if (!identity_test_env_.identity_manager()->HasPrimaryAccount()) + identity_test_env_.MakePrimaryAccountAvailable("example@gmail.com"); + client_->GetUploadDetails(BuildTestProfiles(), kAllDetectableValues, /*pan_first_six=*/"411111", std::vector<const char*>(), "language-LOCALE"); } void StartUploading(bool include_cvc) { - token_service_->AddAccount("example@gmail.com"); - identity_provider_->LogIn("example@gmail.com"); + if (!identity_test_env_.identity_manager()->HasPrimaryAccount()) + identity_test_env_.MakePrimaryAccountAvailable("example@gmail.com"); + PaymentsClient::UploadRequestDetails request_details; request_details.billing_customer_number = 111222333444; request_details.card = test::GetCreditCard(); @@ -148,8 +149,8 @@ } void IssueOAuthToken() { - token_service_->IssueAllTokensForAccount( - "example@gmail.com", "totally_real_token", + identity_test_env_.WaitForAccessTokenRequestAndRespondWithToken( + "totally_real_token", base::Time::Now() + base::TimeDelta::FromDays(10)); // Verify the auth header. @@ -180,9 +181,8 @@ base::test::ScopedTaskEnvironment scoped_task_environment_; net::TestURLFetcherFactory factory_; scoped_refptr<net::TestURLRequestContextGetter> request_context_; - std::unique_ptr<FakeOAuth2TokenService> token_service_; - std::unique_ptr<FakeIdentityProvider> identity_provider_; std::unique_ptr<PaymentsClient> client_; + identity::IdentityTestEnvironment identity_test_env_; private: DISALLOW_COPY_AND_ASSIGN(PaymentsClientTest); @@ -220,8 +220,7 @@ TEST_F(PaymentsClientTest, OAuthError) { StartUnmasking(); - token_service_->IssueErrorForAllPendingRequestsForAccount( - "example@gmail.com", + identity_test_env_.WaitForAccessTokenRequestAndRespondWithError( GoogleServiceAuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE)); EXPECT_EQ(AutofillClient::PERMANENT_FAILURE, result_); EXPECT_TRUE(real_pan_.empty()); @@ -494,7 +493,10 @@ { StartUnmasking(); - IssueOAuthToken(); + // NOTE: Don't issue an access token here: the issuing of an access token + // first waits for the access token request to be received, but here there + // should be no access token request because PaymentsClient should reuse the + // access token from the previous request. ReturnResponse(net::HTTP_UNAUTHORIZED, ""); // No response yet. EXPECT_EQ(AutofillClient::NONE, result_);
diff --git a/components/autofill/core/browser/payments/test_payments_client.cc b/components/autofill/core/browser/payments/test_payments_client.cc index c8d5be1..845b84d8 100644 --- a/components/autofill/core/browser/payments/test_payments_client.cc +++ b/components/autofill/core/browser/payments/test_payments_client.cc
@@ -12,12 +12,12 @@ TestPaymentsClient::TestPaymentsClient( net::URLRequestContextGetter* context_getter, PrefService* pref_service, - IdentityProvider* identity_provider, + identity::IdentityManager* identity_manager, payments::PaymentsClientUnmaskDelegate* unmask_delegate, payments::PaymentsClientSaveDelegate* save_delegate) : PaymentsClient(context_getter, pref_service, - identity_provider, + identity_manager, unmask_delegate, save_delegate), save_delegate_(save_delegate) {}
diff --git a/components/autofill/core/browser/payments/test_payments_client.h b/components/autofill/core/browser/payments/test_payments_client.h index 49b5ddfc..f8b0f4a 100644 --- a/components/autofill/core/browser/payments/test_payments_client.h +++ b/components/autofill/core/browser/payments/test_payments_client.h
@@ -17,7 +17,7 @@ public: TestPaymentsClient(net::URLRequestContextGetter* context_getter, PrefService* pref_service, - IdentityProvider* identity_provider, + identity::IdentityManager* identity_manager, payments::PaymentsClientUnmaskDelegate* unmask_delegate, payments::PaymentsClientSaveDelegate* save_delegate);
diff --git a/components/autofill/core/browser/test_autofill_client.cc b/components/autofill/core/browser/test_autofill_client.cc index b72be19d..c38a391 100644 --- a/components/autofill/core/browser/test_autofill_client.cc +++ b/components/autofill/core/browser/test_autofill_client.cc
@@ -38,6 +38,10 @@ return nullptr; } +identity::IdentityManager* TestAutofillClient::GetIdentityManager() { + return identity_test_env_.identity_manager(); +} + IdentityProvider* TestAutofillClient::GetIdentityProvider() { return identity_provider_.get(); }
diff --git a/components/autofill/core/browser/test_autofill_client.h b/components/autofill/core/browser/test_autofill_client.h index 4974ed6..c68d545 100644 --- a/components/autofill/core/browser/test_autofill_client.h +++ b/components/autofill/core/browser/test_autofill_client.h
@@ -18,6 +18,7 @@ #include "components/ukm/test_ukm_recorder.h" #include "google_apis/gaia/fake_identity_provider.h" #include "google_apis/gaia/fake_oauth2_token_service.h" +#include "services/identity/public/cpp/identity_test_environment.h" namespace autofill { @@ -32,6 +33,7 @@ scoped_refptr<AutofillWebDataService> GetDatabase() override; PrefService* GetPrefs() override; syncer::SyncService* GetSyncService() override; + identity::IdentityManager* GetIdentityManager() override; IdentityProvider* GetIdentityProvider() override; ukm::UkmRecorder* GetUkmRecorder() override; AddressNormalizer* GetAddressNormalizer() override; @@ -85,6 +87,8 @@ void set_form_origin(const GURL& url) { form_origin_ = url; } private: + identity::IdentityTestEnvironment identity_test_env_; + // NULL by default. std::unique_ptr<PrefService> prefs_; std::unique_ptr<FakeOAuth2TokenService> token_service_;
diff --git a/components/autofill/core/browser/test_autofill_manager.cc b/components/autofill/core/browser/test_autofill_manager.cc index 2fab42d..1ef5b04 100644 --- a/components/autofill/core/browser/test_autofill_manager.cc +++ b/components/autofill/core/browser/test_autofill_manager.cc
@@ -23,7 +23,7 @@ personal_data_(personal_data), context_getter_(driver->GetURLRequestContext()) { set_payments_client(new payments::PaymentsClient( - context_getter_, client->GetPrefs(), client->GetIdentityProvider(), + context_getter_, client->GetPrefs(), client->GetIdentityManager(), /*unmask_delegate=*/this, /*save_delegate=*/nullptr)); }
diff --git a/components/cbor/cbor_reader.cc b/components/cbor/cbor_reader.cc index ff01151..3fdccaaa 100644 --- a/components/cbor/cbor_reader.cc +++ b/components/cbor/cbor_reader.cc
@@ -55,9 +55,12 @@ } // namespace -CBORReader::CBORReader(base::span<const uint8_t>::const_iterator it, +CBORReader::CBORReader(base::span<const uint8_t>::const_iterator begin, const base::span<const uint8_t>::const_iterator end) - : it_(it), end_(end), error_code_(DecoderError::CBOR_NO_ERROR) {} + : begin_(begin), + it_(begin), + end_(end), + error_code_(DecoderError::CBOR_NO_ERROR) {} CBORReader::~CBORReader() {} // static @@ -65,7 +68,8 @@ DecoderError* error_code_out, int max_nesting_level) { CBORReader reader(data.cbegin(), data.cend()); - base::Optional<CBORValue> decoded_cbor = reader.DecodeCBOR(max_nesting_level); + base::Optional<CBORValue> decoded_cbor = + reader.DecodeCompleteDataItem(max_nesting_level); if (decoded_cbor) reader.CheckExtraneousData(); @@ -77,12 +81,82 @@ return decoded_cbor; } -base::Optional<CBORValue> CBORReader::DecodeCBOR(int max_nesting_level) { +// static +base::Optional<CBORValue> CBORReader::Read(base::span<uint8_t const> data, + size_t* num_bytes_consumed, + DecoderError* error_code_out, + int max_nesting_level) { + CBORReader reader(data.cbegin(), data.cend()); + base::Optional<CBORValue> decoded_cbor = + reader.DecodeCompleteDataItem(max_nesting_level); + + if (error_code_out) + *error_code_out = reader.GetErrorCode(); + + if (reader.GetErrorCode() != DecoderError::CBOR_NO_ERROR) { + *num_bytes_consumed = 0; + return base::nullopt; + } + + *num_bytes_consumed = reader.num_bytes_consumed(); + return decoded_cbor; +} + +// static +base::Optional<CBORReader::DataItemHeader> CBORReader::ReadDataItemHeader( + base::span<const uint8_t> data, + size_t* num_bytes_consumed, + DecoderError* error_code_out) { + CBORReader reader(data.cbegin(), data.cend()); + base::Optional<DataItemHeader> decoded_header = reader.DecodeDataItemHeader(); + + if (error_code_out) + *error_code_out = reader.GetErrorCode(); + + if (reader.GetErrorCode() != DecoderError::CBOR_NO_ERROR) { + *num_bytes_consumed = 0; + return base::nullopt; + } + + *num_bytes_consumed = reader.num_bytes_consumed(); + return decoded_header; +} + +base::Optional<CBORValue> CBORReader::DecodeCompleteDataItem( + int max_nesting_level) { if (max_nesting_level < 0 || max_nesting_level > kCBORMaxDepth) { error_code_ = DecoderError::TOO_MUCH_NESTING; return base::nullopt; } + base::Optional<DataItemHeader> header = DecodeDataItemHeader(); + if (!header.has_value()) + return base::nullopt; + + switch (header->type) { + case CBORValue::Type::UNSIGNED: + return DecodeValueToUnsigned(header->value); + case CBORValue::Type::NEGATIVE: + return DecodeValueToNegative(header->value); + case CBORValue::Type::BYTE_STRING: + return ReadByteStringContent(*header); + case CBORValue::Type::STRING: + return ReadStringContent(*header); + case CBORValue::Type::ARRAY: + return ReadArrayContent(*header, max_nesting_level); + case CBORValue::Type::MAP: + return ReadMapContent(*header, max_nesting_level); + case CBORValue::Type::SIMPLE_VALUE: + return DecodeToSimpleValue(*header); + case CBORValue::Type::NONE: + break; + } + + error_code_ = DecoderError::UNSUPPORTED_MAJOR_TYPE; + return base::nullopt; +} + +base::Optional<CBORReader::DataItemHeader> CBORReader::DecodeDataItemHeader() { if (!CanConsume(1)) { error_code_ = DecoderError::INCOMPLETE_CBOR_DATA; return base::nullopt; @@ -96,27 +170,7 @@ if (!ReadVariadicLengthInteger(additional_info, &value)) return base::nullopt; - switch (major_type) { - case CBORValue::Type::UNSIGNED: - return DecodeValueToUnsigned(value); - case CBORValue::Type::NEGATIVE: - return DecodeValueToNegative(value); - case CBORValue::Type::BYTE_STRING: - return ReadBytes(value); - case CBORValue::Type::STRING: - return ReadString(value); - case CBORValue::Type::ARRAY: - return ReadCBORArray(value, max_nesting_level); - case CBORValue::Type::MAP: - return ReadCBORMap(value, max_nesting_level); - case CBORValue::Type::SIMPLE_VALUE: - return ReadSimpleValue(additional_info, value); - case CBORValue::Type::NONE: - break; - } - - error_code_ = DecoderError::UNSUPPORTED_MAJOR_TYPE; - return base::nullopt; + return DataItemHeader{major_type, additional_info, value}; } bool CBORReader::ReadVariadicLengthInteger(uint8_t additional_info, @@ -171,17 +225,17 @@ return CBORValue(unsigned_value.ValueOrDie()); } -base::Optional<CBORValue> CBORReader::ReadSimpleValue(uint8_t additional_info, - uint64_t value) { +base::Optional<CBORValue> CBORReader::DecodeToSimpleValue( + const DataItemHeader& header) { // Floating point numbers are not supported. - if (additional_info > 24 && additional_info < 28) { + if (header.additional_info > 24 && header.additional_info < 28) { error_code_ = DecoderError::UNSUPPORTED_FLOATING_POINT_VALUE; return base::nullopt; } - CHECK_LE(value, 255u); + CHECK_LE(header.value, 255u); CBORValue::SimpleValue possibly_unsupported_simple_value = - static_cast<CBORValue::SimpleValue>(static_cast<int>(value)); + static_cast<CBORValue::SimpleValue>(static_cast<int>(header.value)); switch (possibly_unsupported_simple_value) { case CBORValue::SimpleValue::FALSE_VALUE: case CBORValue::SimpleValue::TRUE_VALUE: @@ -194,7 +248,9 @@ return base::nullopt; } -base::Optional<CBORValue> CBORReader::ReadString(uint64_t num_bytes) { +base::Optional<CBORValue> CBORReader::ReadStringContent( + const CBORReader::DataItemHeader& header) { + uint64_t num_bytes = header.value; if (!CanConsume(num_bytes)) { error_code_ = DecoderError::INCOMPLETE_CBOR_DATA; return base::nullopt; @@ -208,7 +264,9 @@ : base::nullopt; } -base::Optional<CBORValue> CBORReader::ReadBytes(uint64_t num_bytes) { +base::Optional<CBORValue> CBORReader::ReadByteStringContent( + const CBORReader::DataItemHeader& header) { + uint64_t num_bytes = header.value; if (!CanConsume(num_bytes)) { error_code_ = DecoderError::INCOMPLETE_CBOR_DATA; return base::nullopt; @@ -220,11 +278,14 @@ return CBORValue(std::move(cbor_byte_string)); } -base::Optional<CBORValue> CBORReader::ReadCBORArray(uint64_t length, - int max_nesting_level) { +base::Optional<CBORValue> CBORReader::ReadArrayContent( + const CBORReader::DataItemHeader& header, + int max_nesting_level) { + int64_t length = base::checked_cast<int64_t>(header.value); CBORValue::ArrayValue cbor_array; while (length-- > 0) { - base::Optional<CBORValue> cbor_element = DecodeCBOR(max_nesting_level - 1); + base::Optional<CBORValue> cbor_element = + DecodeCompleteDataItem(max_nesting_level - 1); if (!cbor_element.has_value()) return base::nullopt; cbor_array.push_back(std::move(cbor_element.value())); @@ -232,12 +293,16 @@ return CBORValue(std::move(cbor_array)); } -base::Optional<CBORValue> CBORReader::ReadCBORMap(uint64_t length, - int max_nesting_level) { +base::Optional<CBORValue> CBORReader::ReadMapContent( + const CBORReader::DataItemHeader& header, + int max_nesting_level) { + int64_t length = base::checked_cast<int64_t>(header.value); CBORValue::MapValue cbor_map; while (length-- > 0) { - base::Optional<CBORValue> key = DecodeCBOR(max_nesting_level - 1); - base::Optional<CBORValue> value = DecodeCBOR(max_nesting_level - 1); + base::Optional<CBORValue> key = + DecodeCompleteDataItem(max_nesting_level - 1); + base::Optional<CBORValue> value = + DecodeCompleteDataItem(max_nesting_level - 1); if (!key.has_value() || !value.has_value()) return base::nullopt;
diff --git a/components/cbor/cbor_reader.h b/components/cbor/cbor_reader.h index 71c7702..c17c5f7c 100644 --- a/components/cbor/cbor_reader.h +++ b/components/cbor/cbor_reader.h
@@ -69,6 +69,25 @@ OUT_OF_RANGE_INTEGER_VALUE, }; + // Encapsulates information extracted from the header of a CBOR data item, + // which consists of the initial byte, and a variable-length-encoded integer + // (if any). + // + // TODO(crbug.com/811717): This is an CBORReader internal detail which should + // not be exposed outside. We should switch to an event-based interface + // before adding another customer. + struct CBOR_EXPORT DataItemHeader { + // The major type decoded from the initial byte. + CBORValue::Type type; + + // The raw 5-bit additional information from the initial byte. + uint8_t additional_info; + + // The integer |value| decoded from the |additional_info| and the + // variable-length-encoded integer, if any. + uint64_t value; + }; + // CBOR nested depth sufficient for most use cases. static const int kCBORMaxDepth = 16; @@ -79,27 +98,48 @@ // CBOR data- then an empty optional is returned. Optional |error_code_out| // can be provided by the caller to obtain additional information about // decoding failures. + // + // Fails if not all the data was consumed and sets |error_code_out| to + // EXTRANEOUS_DATA in this case. static base::Optional<CBORValue> Read(base::span<const uint8_t> input_data, DecoderError* error_code_out = nullptr, int max_nesting_level = kCBORMaxDepth); + // Never fails with EXTRANEOUS_DATA, but informs the caller of how many bytes + // were consumed through |num_bytes_consumed|. + static base::Optional<CBORValue> Read(base::span<const uint8_t> input_data, + size_t* num_bytes_consumed, + DecoderError* error_code_out = nullptr, + int max_nesting_level = kCBORMaxDepth); + + // Reads and parses the header of CBOR data item from |input_data|. Optional + // |error_code_out| can be provided by the caller to obtain additional + // information about decoding failures. Never fails with EXTRANEOUS_DATA, but + // informs the caller of how many bytes were consumed through + // |num_bytes_consumed|. + static base::Optional<DataItemHeader> ReadDataItemHeader( + base::span<const uint8_t> input_data, + size_t* num_bytes_consumed = nullptr, + DecoderError* error_code_out = nullptr); + // Translates errors to human-readable error messages. static const char* ErrorCodeToString(DecoderError error_code); private: CBORReader(base::span<const uint8_t>::const_iterator it, const base::span<const uint8_t>::const_iterator end); - base::Optional<CBORValue> DecodeCBOR(int max_nesting_level); + base::Optional<DataItemHeader> DecodeDataItemHeader(); + base::Optional<CBORValue> DecodeCompleteDataItem(int max_nesting_level); base::Optional<CBORValue> DecodeValueToNegative(uint64_t value); base::Optional<CBORValue> DecodeValueToUnsigned(uint64_t value); - base::Optional<CBORValue> ReadSimpleValue(uint8_t additional_info, - uint64_t value); + base::Optional<CBORValue> DecodeToSimpleValue(const DataItemHeader& header); bool ReadVariadicLengthInteger(uint8_t additional_info, uint64_t* value); - base::Optional<CBORValue> ReadBytes(uint64_t num_bytes); - base::Optional<CBORValue> ReadString(uint64_t num_bytes); - base::Optional<CBORValue> ReadCBORArray(uint64_t length, - int max_nesting_level); - base::Optional<CBORValue> ReadCBORMap(uint64_t length, int max_nesting_level); + base::Optional<CBORValue> ReadByteStringContent(const DataItemHeader& header); + base::Optional<CBORValue> ReadStringContent(const DataItemHeader& header); + base::Optional<CBORValue> ReadArrayContent(const DataItemHeader& header, + int max_nesting_level); + base::Optional<CBORValue> ReadMapContent(const DataItemHeader& header, + int max_nesting_level); bool CanConsume(uint64_t bytes); void CheckExtraneousData(); bool CheckDuplicateKey(const CBORValue& new_key, CBORValue::MapValue* map); @@ -109,6 +149,9 @@ DecoderError GetErrorCode(); + size_t num_bytes_consumed() const { return it_ - begin_; } + + const base::span<const uint8_t>::const_iterator begin_; base::span<const uint8_t>::const_iterator it_; const base::span<const uint8_t>::const_iterator end_; DecoderError error_code_;
diff --git a/components/cbor/cbor_reader_unittest.cc b/components/cbor/cbor_reader_unittest.cc index 7a6dda8..dd8bbd8 100644 --- a/components/cbor/cbor_reader_unittest.cc +++ b/components/cbor/cbor_reader_unittest.cc
@@ -7,6 +7,7 @@ #include "components/cbor/cbor_reader.h" +#include "base/containers/span.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -14,6 +15,104 @@ https://github.com/cbor/test-vectors/blob/master/appendix_a.json. */ namespace cbor { +namespace { + +std::vector<uint8_t> WithExtraneousData(base::span<const uint8_t> original) { + std::vector<uint8_t> ret(original.cbegin(), original.cend()); + // Add a valid one byte long CBOR data item, namely, an unsigned integer + // with value "1". + ret.push_back(0x01); + return ret; +} + +} // namespace + +TEST(CBORReaderTest, TestDecodeDataItemHeader) { + static const struct { + CBORReader::DataItemHeader expected_header; + const std::vector<uint8_t> cbor_data; + } kTestCases[] = { + {{CBORValue::Type::UNSIGNED, 0, 0}, {0x00}}, + {{CBORValue::Type::UNSIGNED, 24, 24}, {0x18, 0x18}}, + {{CBORValue::Type::UNSIGNED, 25, 12345}, {0x19, 0x30, 0x39}}, + {{CBORValue::Type::UNSIGNED, 27, 1234567890123456789ull}, + {0x1B, 0x11, 0x22, 0x10, 0xF4, 0x7D, 0xE9, 0x81, 0x15}}, + {{CBORValue::Type::NEGATIVE, 24, 255}, {0x38, 0xff}}, + {{CBORValue::Type::NEGATIVE, 26, 12345677}, + {0x3a, 0x00, 0xbc, 0x61, 0x4d}}, + {{CBORValue::Type::BYTE_STRING, 4, 4}, {0x44}}, + {{CBORValue::Type::STRING, 3, 3}, {0x63}}, + {{CBORValue::Type::ARRAY, 24, 25}, {0x98, 0x19}}, + {{CBORValue::Type::MAP, 4, 4}, {0xa4}}, + {{CBORValue::Type::SIMPLE_VALUE, + static_cast<uint8_t>(CBORValue::SimpleValue::FALSE_VALUE), 20}, + {0xf4}}, + }; + + int test_element_index = 0; + for (const auto& test_case : kTestCases) { + SCOPED_TRACE(testing::Message() << "testing case " << test_element_index++); + size_t consumed_bytes; + CBORReader::DecoderError error_code; + base::Optional<CBORReader::DataItemHeader> header = + CBORReader::ReadDataItemHeader(test_case.cbor_data, &consumed_bytes, + &error_code); + + ASSERT_TRUE(header.has_value()); + EXPECT_EQ(header->type, test_case.expected_header.type); + EXPECT_EQ(header->additional_info, + test_case.expected_header.additional_info); + EXPECT_EQ(header->value, test_case.expected_header.value); + EXPECT_EQ(consumed_bytes, test_case.cbor_data.size()); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + + auto cbor_data_with_extra_byte = WithExtraneousData(test_case.cbor_data); + header = CBORReader::ReadDataItemHeader(cbor_data_with_extra_byte, + &consumed_bytes, &error_code); + ASSERT_TRUE(header.has_value()); + EXPECT_EQ(header->type, test_case.expected_header.type); + EXPECT_EQ(header->additional_info, + test_case.expected_header.additional_info); + EXPECT_EQ(header->value, test_case.expected_header.value); + EXPECT_EQ(consumed_bytes, test_case.cbor_data.size()); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + } +} + +TEST(CBORReaderTest, TestDecodeIncompleteDataItemHeader) { + static const std::vector<uint8_t> kTestCases[] = { + // clang-format off + {0x18}, // unsigned with pending 1 byte of numeric value. + {0x99}, // array with pending 2 byte of numeric value (length). + {0xba}, // map with pending 4 byte of numeric value (length). + {0x5b}, // byte string with pending 4 byte of numeric value (length). + {0x3b}, // negative integer with pending 8 byte of numeric value. + {0x99, 0x01}, // array with pending 2 byte of numeric value (length), + // with only 1 byte of additional data. + {0xba, 0x01, 0x02, 0x03}, // map with pending 4 byte of numeric value + // (length), with only 3 bytes of additional + // data. + {0x3b, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07}, // negative integer with pending 8 byte of + // numeric value, with only 7 bytes of + // additional data. + // clang-format on + }; + + int test_element_index = 0; + for (const auto& test_case : kTestCases) { + SCOPED_TRACE(testing::Message() << "testing case " << test_element_index++); + size_t consumed_bytes; + CBORReader::DecoderError error_code; + base::Optional<CBORReader::DataItemHeader> header = + CBORReader::ReadDataItemHeader(test_case, &consumed_bytes, &error_code); + + ASSERT_FALSE(header.has_value()); + EXPECT_EQ(consumed_bytes, 0u); + EXPECT_EQ(error_code, CBORReader::DecoderError::INCOMPLETE_CBOR_DATA); + } +} + TEST(CBORReaderTest, TestReadUint) { struct UintTestCase { const int64_t value; @@ -42,6 +141,21 @@ ASSERT_TRUE(cbor.has_value()); ASSERT_EQ(cbor.value().type(), CBORValue::Type::UNSIGNED); EXPECT_EQ(cbor.value().GetInteger(), test_case.value); + + auto cbor_data_with_extra_byte = WithExtraneousData(test_case.cbor_data); + CBORReader::DecoderError error_code; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::EXTRANEOUS_DATA); + + size_t num_bytes_consumed; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &num_bytes_consumed, + &error_code); + ASSERT_TRUE(cbor.has_value()); + ASSERT_EQ(cbor.value().type(), CBORValue::Type::UNSIGNED); + EXPECT_EQ(cbor.value().GetInteger(), test_case.value); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + EXPECT_EQ(num_bytes_consumed, test_case.cbor_data.size()); } } @@ -120,6 +234,21 @@ ASSERT_TRUE(cbor.has_value()); ASSERT_EQ(cbor.value().type(), CBORValue::Type::NEGATIVE); EXPECT_EQ(cbor.value().GetInteger(), test_case.negative_int); + + auto cbor_data_with_extra_byte = WithExtraneousData(test_case.cbor_data); + CBORReader::DecoderError error_code; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::EXTRANEOUS_DATA); + + size_t num_bytes_consumed; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &num_bytes_consumed, + &error_code); + ASSERT_TRUE(cbor.has_value()); + ASSERT_EQ(cbor.value().type(), CBORValue::Type::NEGATIVE); + EXPECT_EQ(cbor.value().GetInteger(), test_case.negative_int); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + EXPECT_EQ(num_bytes_consumed, test_case.cbor_data.size()); } } @@ -145,6 +274,21 @@ ASSERT_TRUE(cbor.has_value()); ASSERT_EQ(cbor.value().type(), CBORValue::Type::BYTE_STRING); EXPECT_EQ(cbor.value().GetBytestring(), test_case.value); + + auto cbor_data_with_extra_byte = WithExtraneousData(test_case.cbor_data); + CBORReader::DecoderError error_code; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::EXTRANEOUS_DATA); + + size_t num_bytes_consumed; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &num_bytes_consumed, + &error_code); + ASSERT_TRUE(cbor.has_value()); + ASSERT_EQ(cbor.value().type(), CBORValue::Type::BYTE_STRING); + EXPECT_EQ(cbor.value().GetBytestring(), test_case.value); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + EXPECT_EQ(num_bytes_consumed, test_case.cbor_data.size()); } } @@ -172,6 +316,21 @@ ASSERT_TRUE(cbor.has_value()); ASSERT_EQ(cbor.value().type(), CBORValue::Type::STRING); EXPECT_EQ(cbor.value().GetString(), test_case.value); + + auto cbor_data_with_extra_byte = WithExtraneousData(test_case.cbor_data); + CBORReader::DecoderError error_code; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::EXTRANEOUS_DATA); + + size_t num_bytes_consumed; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &num_bytes_consumed, + &error_code); + ASSERT_TRUE(cbor.has_value()); + ASSERT_EQ(cbor.value().type(), CBORValue::Type::STRING); + EXPECT_EQ(cbor.value().GetString(), test_case.value); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + EXPECT_EQ(num_bytes_consumed, test_case.cbor_data.size()); } } @@ -202,6 +361,21 @@ ASSERT_TRUE(cbor.has_value()); ASSERT_EQ(cbor.value().type(), CBORValue::Type::STRING); EXPECT_EQ(cbor.value().GetString(), test_case.value); + + auto cbor_data_with_extra_byte = WithExtraneousData(test_case.cbor_data); + CBORReader::DecoderError error_code; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::EXTRANEOUS_DATA); + + size_t num_bytes_consumed; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &num_bytes_consumed, + &error_code); + ASSERT_TRUE(cbor.has_value()); + ASSERT_EQ(cbor.value().type(), CBORValue::Type::STRING); + EXPECT_EQ(cbor.value().GetString(), test_case.value); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + EXPECT_EQ(num_bytes_consumed, test_case.cbor_data.size()); } } @@ -243,6 +417,21 @@ EXPECT_EQ(cbor_array.GetArray()[i].GetInteger(), static_cast<int64_t>(i + 1)); } + + auto cbor_data_with_extra_byte = WithExtraneousData(kArrayTestCaseCbor); + CBORReader::DecoderError error_code; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::EXTRANEOUS_DATA); + + size_t num_bytes_consumed; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &num_bytes_consumed, + &error_code); + ASSERT_TRUE(cbor.has_value()); + ASSERT_EQ(cbor_array.type(), CBORValue::Type::ARRAY); + ASSERT_THAT(cbor_array.GetArray(), testing::SizeIs(25)); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + EXPECT_EQ(num_bytes_consumed, kArrayTestCaseCbor.size()); } TEST(CBORReaderTest, TestReadMapWithMapValue) { @@ -292,6 +481,21 @@ ASSERT_EQ(cbor_val.GetMap().find(key_aa)->second.type(), CBORValue::Type::STRING); EXPECT_EQ(cbor_val.GetMap().find(key_aa)->second.GetString(), "AA"); + + auto cbor_data_with_extra_byte = WithExtraneousData(kMapTestCaseCbor); + CBORReader::DecoderError error_code; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::EXTRANEOUS_DATA); + + size_t num_bytes_consumed; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &num_bytes_consumed, + &error_code); + ASSERT_TRUE(cbor.has_value()); + ASSERT_EQ(cbor_val.type(), CBORValue::Type::MAP); + ASSERT_EQ(cbor_val.GetMap().size(), 4u); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + EXPECT_EQ(num_bytes_consumed, kMapTestCaseCbor.size()); } TEST(CBORReaderTest, TestReadMapWithIntegerKeys) { @@ -341,6 +545,21 @@ ASSERT_EQ(cbor_val.GetMap().find(key_1111)->second.type(), CBORValue::Type::STRING); EXPECT_EQ(cbor_val.GetMap().find(key_1111)->second.GetString(), "d"); + + auto cbor_data_with_extra_byte = WithExtraneousData(kMapWithIntegerKeyCbor); + CBORReader::DecoderError error_code; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::EXTRANEOUS_DATA); + + size_t num_bytes_consumed; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &num_bytes_consumed, + &error_code); + ASSERT_TRUE(cbor.has_value()); + ASSERT_EQ(cbor_val.type(), CBORValue::Type::MAP); + ASSERT_EQ(cbor_val.GetMap().size(), 4u); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + EXPECT_EQ(num_bytes_consumed, kMapWithIntegerKeyCbor.size()); } TEST(CBORReaderTest, TestReadMapWithNegativeIntegersKeys) { @@ -381,6 +600,21 @@ ASSERT_EQ(cbor_val.GetMap().find(key_100)->second.type(), CBORValue::Type::UNSIGNED); EXPECT_EQ(cbor_val.GetMap().find(key_100)->second.GetInteger(), 3); + + auto cbor_data_with_extra_byte = WithExtraneousData(kMapWithIntegerKeyCbor); + CBORReader::DecoderError error_code; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::EXTRANEOUS_DATA); + + size_t num_bytes_consumed; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &num_bytes_consumed, + &error_code); + ASSERT_TRUE(cbor.has_value()); + ASSERT_EQ(cbor_val.type(), CBORValue::Type::MAP); + ASSERT_EQ(cbor_val.GetMap().size(), 3u); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + EXPECT_EQ(num_bytes_consumed, kMapWithIntegerKeyCbor.size()); } TEST(CBORReaderTest, TestReadMapWithArray) { @@ -421,6 +655,21 @@ EXPECT_EQ(nested_array.GetArray()[i].GetInteger(), static_cast<int64_t>(i + 2)); } + + auto cbor_data_with_extra_byte = WithExtraneousData(kMapArrayTestCaseCbor); + CBORReader::DecoderError error_code; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::EXTRANEOUS_DATA); + + size_t num_bytes_consumed; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &num_bytes_consumed, + &error_code); + ASSERT_TRUE(cbor.has_value()); + ASSERT_EQ(cbor_val.type(), CBORValue::Type::MAP); + ASSERT_EQ(cbor_val.GetMap().size(), 2u); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + EXPECT_EQ(num_bytes_consumed, kMapArrayTestCaseCbor.size()); } TEST(CBORReaderTest, TestReadMapWithTextStringKeys) { @@ -451,6 +700,20 @@ ASSERT_EQ(cbor->GetMap().find(key_foo)->second.type(), CBORValue::Type::STRING); EXPECT_EQ(cbor->GetMap().find(key_foo)->second.GetString(), "bar"); + + auto cbor_data_with_extra_byte = WithExtraneousData(kMapTestCase); + cbor = CBORReader::Read(cbor_data_with_extra_byte, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::EXTRANEOUS_DATA); + + size_t num_bytes_consumed; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &num_bytes_consumed, + &error_code); + ASSERT_TRUE(cbor.has_value()); + ASSERT_EQ(cbor->type(), CBORValue::Type::MAP); + ASSERT_EQ(cbor->GetMap().size(), 2u); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + EXPECT_EQ(num_bytes_consumed, kMapTestCase.size()); } TEST(CBORReaderTest, TestReadMapWithByteStringKeys) { @@ -484,6 +747,20 @@ CBORValue::Type::BYTE_STRING); static const std::vector<uint8_t> kBarBytes{'b', 'a', 'r'}; EXPECT_EQ(cbor->GetMap().find(key_foo)->second.GetBytestring(), kBarBytes); + + auto cbor_data_with_extra_byte = WithExtraneousData(kMapTestCase); + cbor = CBORReader::Read(cbor_data_with_extra_byte, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::EXTRANEOUS_DATA); + + size_t num_bytes_consumed; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &num_bytes_consumed, + &error_code); + ASSERT_TRUE(cbor.has_value()); + ASSERT_EQ(cbor->type(), CBORValue::Type::MAP); + ASSERT_EQ(cbor->GetMap().size(), 2u); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + EXPECT_EQ(num_bytes_consumed, kMapTestCase.size()); } TEST(CBORReaderTest, TestReadMapWithMixedKeys) { @@ -545,6 +822,20 @@ EXPECT_EQ(cbor->GetMap().find(keys[i])->second.GetInteger(), static_cast<int>(i)); } + + auto cbor_data_with_extra_byte = WithExtraneousData(kMapTestCase); + cbor = CBORReader::Read(cbor_data_with_extra_byte, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::EXTRANEOUS_DATA); + + size_t num_bytes_consumed; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &num_bytes_consumed, + &error_code); + ASSERT_TRUE(cbor.has_value()); + ASSERT_EQ(cbor->type(), CBORValue::Type::MAP); + ASSERT_EQ(cbor->GetMap().size(), 6u); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + EXPECT_EQ(num_bytes_consumed, arraysize(kMapTestCase)); } TEST(CBORReaderTest, TestReadNestedMap) { @@ -651,6 +942,21 @@ ASSERT_TRUE(cbor.has_value()); ASSERT_EQ(cbor.value().type(), CBORValue::Type::SIMPLE_VALUE); EXPECT_EQ(cbor.value().GetSimpleValue(), test_case.value); + + auto cbor_data_with_extra_byte = WithExtraneousData(test_case.cbor_data); + CBORReader::DecoderError error_code; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::EXTRANEOUS_DATA); + + size_t num_bytes_consumed; + cbor = CBORReader::Read(cbor_data_with_extra_byte, &num_bytes_consumed, + &error_code); + ASSERT_TRUE(cbor.has_value()); + ASSERT_EQ(cbor.value().type(), CBORValue::Type::SIMPLE_VALUE); + EXPECT_EQ(cbor.value().GetSimpleValue(), test_case.value); + EXPECT_EQ(error_code, CBORReader::DecoderError::CBOR_NO_ERROR); + EXPECT_EQ(num_bytes_consumed, test_case.cbor_data.size()); } }
diff --git a/components/favicon/core/favicon_service.h b/components/favicon/core/favicon_service.h index 0b66c9d..e91ef9d 100644 --- a/components/favicon/core/favicon_service.h +++ b/components/favicon/core/favicon_service.h
@@ -199,9 +199,17 @@ const favicon_base::IconTypeSet& icon_types, const base::flat_set<GURL>& page_urls_to_write) = 0; + // Figures out whether an on-demand favicon can be written for provided + // |page_url| and returns the result via |callback|. The result is false if + // there is an existing cached favicon for |icon_type| or if there is a + // non-expired icon of *any* type for |page_url|. + virtual void CanSetOnDemandFavicons( + const GURL& page_url, + favicon_base::IconType icon_type, + base::OnceCallback<void(bool)> callback) const = 0; + // Same as SetFavicons with three differences: - // 1) It will be a no-op if there is an existing cached favicon for *any* type - // for |page_url|. + // 1) It will be a no-op if CanSetOnDemandFavicons() returns false. // 2) If |icon_url| is known to the database, |bitmaps| will be ignored (i.e. // the icon won't be overwritten) but the mappings from |page_url| to // |icon_url| will be stored (conditioned to point 1 above). @@ -221,7 +229,7 @@ const GURL& icon_url, favicon_base::IconType icon_type, const gfx::Image& image, - base::Callback<void(bool)> callback) = 0; + base::OnceCallback<void(bool)> callback) = 0; // Avoid repeated requests to download missing favicon. virtual void UnableToDownloadFavicon(const GURL& icon_url) = 0;
diff --git a/components/favicon/core/favicon_service_impl.cc b/components/favicon/core/favicon_service_impl.cc index f1ef647..225205b 100644 --- a/components/favicon/core/favicon_service_impl.cc +++ b/components/favicon/core/favicon_service_impl.cc
@@ -250,14 +250,23 @@ page_urls_to_write); } +void FaviconServiceImpl::CanSetOnDemandFavicons( + const GURL& page_url, + favicon_base::IconType icon_type, + base::OnceCallback<void(bool)> callback) const { + history_service_->CanSetOnDemandFavicons(page_url, icon_type, + std::move(callback)); +} + void FaviconServiceImpl::SetOnDemandFavicons( const GURL& page_url, const GURL& icon_url, favicon_base::IconType icon_type, const gfx::Image& image, - base::Callback<void(bool)> callback) { - history_service_->SetOnDemandFavicons( - page_url, icon_type, icon_url, ExtractSkBitmapsToStore(image), callback); + base::OnceCallback<void(bool)> callback) { + history_service_->SetOnDemandFavicons(page_url, icon_type, icon_url, + ExtractSkBitmapsToStore(image), + std::move(callback)); } void FaviconServiceImpl::UnableToDownloadFavicon(const GURL& icon_url) {
diff --git a/components/favicon/core/favicon_service_impl.h b/components/favicon/core/favicon_service_impl.h index d99d7a0..3763665 100644 --- a/components/favicon/core/favicon_service_impl.h +++ b/components/favicon/core/favicon_service_impl.h
@@ -111,11 +111,15 @@ const GURL& page_url_to_read, const favicon_base::IconTypeSet& icon_types, const base::flat_set<GURL>& page_urls_to_write) override; + void CanSetOnDemandFavicons( + const GURL& page_url, + favicon_base::IconType icon_type, + base::OnceCallback<void(bool)> callback) const override; void SetOnDemandFavicons(const GURL& page_url, const GURL& icon_url, favicon_base::IconType icon_type, const gfx::Image& image, - base::Callback<void(bool)> callback) override; + base::OnceCallback<void(bool)> callback) override; void UnableToDownloadFavicon(const GURL& icon_url) override; bool WasUnableToDownloadFavicon(const GURL& icon_url) const override; void ClearUnableToDownloadFavicons() override;
diff --git a/components/favicon/core/large_icon_service_unittest.cc b/components/favicon/core/large_icon_service_unittest.cc index 7b68670..b5f3ba736 100644 --- a/components/favicon/core/large_icon_service_unittest.cc +++ b/components/favicon/core/large_icon_service_unittest.cc
@@ -64,8 +64,8 @@ } ACTION_P(PostBoolReply, p0) { - base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, - base::Bind(arg4, p0)); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(*arg4), p0)); } SkBitmap CreateTestSkBitmap(int w, int h, SkColor color) {
diff --git a/components/favicon/core/test/mock_favicon_service.h b/components/favicon/core/test/mock_favicon_service.h index f0541a3..486c6a3c 100644 --- a/components/favicon/core/test/mock_favicon_service.h +++ b/components/favicon/core/test/mock_favicon_service.h
@@ -112,12 +112,32 @@ void(const GURL& page_url_to_read, const favicon_base::IconTypeSet& icon_types, const base::flat_set<GURL>& page_urls_to_write)); + + void CanSetOnDemandFavicons( + const GURL& page_url, + favicon_base::IconType icon_type, + base::OnceCallback<void(bool)> callback) const override { + // This is a back to get around Gmock's lack of support for move-only types. + return CanSetOnDemandFavicons(page_url, icon_type, &callback); + } + MOCK_CONST_METHOD3(CanSetOnDemandFavicons, + void(const GURL& page_url, + favicon_base::IconType icon_type, + base::OnceCallback<void(bool)>* callback)); + void SetOnDemandFavicons(const GURL& page_url, + const GURL& icon_url, + favicon_base::IconType icon_type, + const gfx::Image& image, + base::OnceCallback<void(bool)> callback) override { + // This is a back to get around Gmock's lack of support for move-only types. + return SetOnDemandFavicons(page_url, icon_url, icon_type, image, &callback); + } MOCK_METHOD5(SetOnDemandFavicons, void(const GURL& page_url, const GURL& icon_url, favicon_base::IconType icon_type, const gfx::Image& image, - base::Callback<void(bool)> callback)); + base::OnceCallback<void(bool)>* callback)); MOCK_METHOD1(UnableToDownloadFavicon, void(const GURL& icon_url)); MOCK_CONST_METHOD1(WasUnableToDownloadFavicon, bool(const GURL& icon_url)); MOCK_METHOD0(ClearUnableToDownloadFavicons, void());
diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc index 2500839..031e8c5 100644 --- a/components/history/core/browser/history_backend.cc +++ b/components/history/core/browser/history_backend.cc
@@ -81,8 +81,6 @@ closure.Run(); } -} // namespace - // How long we'll wait to do a commit, so that things are batched together. const int kCommitIntervalSeconds = 10; @@ -97,6 +95,32 @@ // and is deleted. const int kExpireDaysThreshold = 90; +bool IsFaviconBitmapExpired(base::Time last_updated) { + return (Time::Now() - last_updated) > + TimeDelta::FromDays(kFaviconRefetchDays); +} + +bool AreIconTypesEquivalent(favicon_base::IconType type_a, + favicon_base::IconType type_b) { + if (type_a == type_b) + return true; + + // Two icon types are considered 'equivalent' if both types are one of + // kTouchIcon, kTouchPrecomposedIcon or kWebManifestIcon. + const favicon_base::IconTypeSet equivalent_types = { + favicon_base::IconType::kTouchIcon, + favicon_base::IconType::kTouchPrecomposedIcon, + favicon_base::IconType::kWebManifestIcon}; + + if (equivalent_types.count(type_a) != 0 && + equivalent_types.count(type_b) != 0) { + return true; + } + return false; +} + +} // namespace + QueuedHistoryDBTask::QueuedHistoryDBTask( std::unique_ptr<HistoryDBTask> task, scoped_refptr<base::SingleThreadTaskRunner> origin_loop, @@ -1535,8 +1559,7 @@ return; } - bitmap_result.expired = - (Time::Now() - last_updated) > TimeDelta::FromDays(kFaviconRefetchDays); + bitmap_result.expired = IsFaviconBitmapExpired(last_updated); bitmap_result.fetched_because_of_page_visit = last_requested.is_null(); if (bitmap_result.is_valid()) *favicon_bitmap_result = bitmap_result; @@ -1647,7 +1670,8 @@ // Expire the favicon bitmap because sync can provide incorrect // |bitmap_data|. See crbug.com/474421 for more details. Expiring the // favicon bitmap causes it to be redownloaded the next time that the - // user visits any page which uses |icon_url|. + // user visits any page which uses |icon_url|. It also allows storing an + // on-demand icon along with the icon from sync. thumbnail_db_->SetFaviconBitmap(bitmap_id_sizes[i].bitmap_id, bitmap_data, base::Time()); replaced_bitmap = true; @@ -1673,9 +1697,14 @@ thumbnail_db_->DeleteFaviconBitmap(bitmap_id_sizes[0].bitmap_id); favicon_sizes.erase(favicon_sizes.begin()); } + // Set the new bitmap as expired because the bitmaps from sync/profile + // import/etc. are not authoritative. Expiring the favicon bitmap causes the + // bitmaps to be redownloaded the next time that the user visits any page + // which uses |icon_url|. It also allows storing an on-demand icon along + // with the icon from sync. thumbnail_db_->AddFaviconBitmap(favicon_id, bitmap_data, - FaviconBitmapType::ON_VISIT, - base::Time::Now(), pixel_size); + FaviconBitmapType::ON_VISIT, base::Time(), + pixel_size); favicon_sizes.push_back(pixel_size); } @@ -1817,19 +1846,40 @@ } } +bool HistoryBackend::CanSetOnDemandFavicons(const GURL& page_url, + favicon_base::IconType icon_type) { + if (!thumbnail_db_ || !db_) + return false; + + // We allow writing an on demand favicon of type |icon_type| only if there is + // no icon of such type in the DB (so that we never overwrite anything) and if + // all other icons are expired. This in particular allows writing an on-demand + // icon if there is only an icon from sync (icons from sync are immediately + // set as expired). + std::vector<IconMapping> mapping_data; + thumbnail_db_->GetIconMappingsForPageURL(page_url, &mapping_data); + + for (const IconMapping& mapping : mapping_data) { + if (AreIconTypesEquivalent(mapping.icon_type, icon_type)) + return false; + + base::Time last_updated; + if (thumbnail_db_->GetFaviconLastUpdatedTime(mapping.icon_id, + &last_updated) && + !IsFaviconBitmapExpired(last_updated)) { + return false; + } + } + return true; +} + bool HistoryBackend::SetOnDemandFavicons(const GURL& page_url, favicon_base::IconType icon_type, const GURL& icon_url, const std::vector<SkBitmap>& bitmaps) { - if (!thumbnail_db_ || !db_) + if (!CanSetOnDemandFavicons(page_url, icon_type)) return false; - // Verify there's no known data for the page URL. - if (thumbnail_db_->GetIconMappingsForPageURL(page_url, - /*mapping_data=*/nullptr)) { - return false; - } - return SetFaviconsImpl({page_url}, icon_type, icon_url, bitmaps, FaviconBitmapType::ON_DEMAND); } @@ -2219,14 +2269,6 @@ favicon_base::IconType icon_type, favicon_base::FaviconID icon_id) { bool mappings_changed = false; - - // Two icon types are considered 'equivalent' if both types are one of - // kTouchIcon, kTouchPrecomposedIcon or kWebManifestIcon. - const favicon_base::IconTypeSet equivalent_types = { - favicon_base::IconType::kTouchIcon, - favicon_base::IconType::kTouchPrecomposedIcon, - favicon_base::IconType::kWebManifestIcon}; - // Sets the icon mappings from |page_url| for |icon_type| to the favicon // with |icon_id|. Mappings for |page_url| to favicons of type |icon_type| // with FaviconID other than |icon_id| are removed. All icon mappings for @@ -2246,9 +2288,7 @@ continue; } - if (icon_type == m->icon_type || - (equivalent_types.count(icon_type) != 0 && - equivalent_types.count(m->icon_type) != 0)) { + if (AreIconTypesEquivalent(icon_type, m->icon_type)) { thumbnail_db_->DeleteIconMapping(m->mapping_id); // Removing the icon mapping may have orphaned the associated favicon so
diff --git a/components/history/core/browser/history_backend.h b/components/history/core/browser/history_backend.h index c27b1d27..dac0a0a6 100644 --- a/components/history/core/browser/history_backend.h +++ b/components/history/core/browser/history_backend.h
@@ -338,6 +338,9 @@ const GURL& icon_url, const std::vector<SkBitmap>& bitmaps); + bool CanSetOnDemandFavicons(const GURL& page_url, + favicon_base::IconType icon_type); + void SetFaviconsOutOfDateForPage(const GURL& page_url); void TouchOnDemandFavicon(const GURL& icon_url);
diff --git a/components/history/core/browser/history_backend_unittest.cc b/components/history/core/browser/history_backend_unittest.cc index 0401408..c25a5da 100644 --- a/components/history/core/browser/history_backend_unittest.cc +++ b/components/history/core/browser/history_backend_unittest.cc
@@ -2223,7 +2223,7 @@ kSmallSize); // |page_url| should now be mapped to |icon_url| and the favicon bitmap should - // not be expired. + // be expired. std::vector<IconMapping> icon_mappings; EXPECT_TRUE(backend_->thumbnail_db_->GetIconMappingsForPageURL( page_url, &icon_mappings)); @@ -2232,7 +2232,7 @@ FaviconBitmap favicon_bitmap; EXPECT_TRUE(GetOnlyFaviconBitmap(icon_mappings[0].icon_id, &favicon_bitmap)); - EXPECT_NE(base::Time(), favicon_bitmap.last_updated); + EXPECT_EQ(base::Time(), favicon_bitmap.last_updated); EXPECT_TRUE(BitmapDataEqual('a', favicon_bitmap.bitmap_data)); EXPECT_EQ(kSmallSize, favicon_bitmap.pixel_size); @@ -2336,7 +2336,7 @@ std::vector<FaviconBitmap> favicon_bitmaps; EXPECT_TRUE(GetSortedFaviconBitmaps(icon_mappings[0].icon_id, &favicon_bitmaps)); - EXPECT_NE(base::Time(), favicon_bitmaps[0].last_updated); + EXPECT_EQ(base::Time(), favicon_bitmaps[0].last_updated); EXPECT_TRUE(BitmapDataEqual('c', favicon_bitmaps[0].bitmap_data)); EXPECT_EQ(kTinySize, favicon_bitmaps[0].pixel_size); EXPECT_EQ(base::Time(), favicon_bitmaps[1].last_updated); @@ -2366,7 +2366,7 @@ EXPECT_EQ(kTinySize, favicon_bitmaps[0].pixel_size); // The favicon being merged should take precedence over the preexisting // favicon bitmaps. - EXPECT_NE(base::Time(), favicon_bitmaps[1].last_updated); + EXPECT_EQ(base::Time(), favicon_bitmaps[1].last_updated); EXPECT_TRUE(BitmapDataEqual('d', favicon_bitmaps[1].bitmap_data)); EXPECT_EQ(kSmallSize, favicon_bitmaps[1].pixel_size); }
diff --git a/components/history/core/browser/history_service.cc b/components/history/core/browser/history_service.cc index d1c70e76..8bbf61a 100644 --- a/components/history/core/browser/history_service.cc +++ b/components/history/core/browser/history_service.cc
@@ -662,21 +662,42 @@ page_urls_to_write)); } -void HistoryService::SetOnDemandFavicons(const GURL& page_url, - favicon_base::IconType icon_type, - const GURL& icon_url, - const std::vector<SkBitmap>& bitmaps, - base::Callback<void(bool)> callback) { +void HistoryService::CanSetOnDemandFavicons( + const GURL& page_url, + favicon_base::IconType icon_type, + base::OnceCallback<void(bool)> callback) { DCHECK(backend_task_runner_) << "History service being called after cleanup"; DCHECK(thread_checker_.CalledOnValidThread()); - if (history_client_ && !history_client_->CanAddURL(page_url)) + if (history_client_ && !history_client_->CanAddURL(page_url)) { + std::move(callback).Run(false); return; + } PostTaskAndReplyWithResult( backend_task_runner_.get(), FROM_HERE, - base::Bind(&HistoryBackend::SetOnDemandFavicons, history_backend_, - page_url, icon_type, icon_url, bitmaps), - callback); + base::BindOnce(&HistoryBackend::CanSetOnDemandFavicons, history_backend_, + page_url, icon_type), + std::move(callback)); +} + +void HistoryService::SetOnDemandFavicons( + const GURL& page_url, + favicon_base::IconType icon_type, + const GURL& icon_url, + const std::vector<SkBitmap>& bitmaps, + base::OnceCallback<void(bool)> callback) { + DCHECK(backend_task_runner_) << "History service being called after cleanup"; + DCHECK(thread_checker_.CalledOnValidThread()); + if (history_client_ && !history_client_->CanAddURL(page_url)) { + std::move(callback).Run(false); + return; + } + + PostTaskAndReplyWithResult( + backend_task_runner_.get(), FROM_HERE, + base::BindOnce(&HistoryBackend::SetOnDemandFavicons, history_backend_, + page_url, icon_type, icon_url, bitmaps), + std::move(callback)); } void HistoryService::SetFaviconsOutOfDateForPage(const GURL& page_url) {
diff --git a/components/history/core/browser/history_service.h b/components/history/core/browser/history_service.h index 767bd7e..ca7a095 100644 --- a/components/history/core/browser/history_service.h +++ b/components/history/core/browser/history_service.h
@@ -773,9 +773,16 @@ const favicon_base::IconTypeSet& icon_types, const base::flat_set<GURL>& page_urls_to_write); + // Figures out whether an on-demand favicon can be written for provided + // |page_url| and returns the result via |callback|. The result is false if + // there is an existing cached favicon for |icon_type| or if there is a + // non-expired icon of *any* type for |page_url|. + void CanSetOnDemandFavicons(const GURL& page_url, + favicon_base::IconType icon_type, + base::OnceCallback<void(bool)> callback); + // Same as SetFavicons with three differences: - // 1) It will be a no-op if there is an existing cached favicon for *any* type - // for |page_url|. + // 1) It will be a no-op if CanSetOnDemandFavicons() returns false. // 2) If |icon_url| is known to the database, |bitmaps| will be ignored (i.e. // the icon won't be overwritten) but the mappings from |page_url| to // |icon_url| will be stored (conditioned to point 1 above). @@ -795,7 +802,7 @@ favicon_base::IconType icon_type, const GURL& icon_url, const std::vector<SkBitmap>& bitmaps, - base::Callback<void(bool)> callback); + base::OnceCallback<void(bool)> callback); // Used by the FaviconService to mark the favicon for the page as being out // of date.
diff --git a/components/history/core/browser/thumbnail_database.cc b/components/history/core/browser/thumbnail_database.cc index 235f34c..90d5f27 100644 --- a/components/history/core/browser/thumbnail_database.cc +++ b/components/history/core/browser/thumbnail_database.cc
@@ -660,6 +660,30 @@ return statement.Run(); } +bool ThumbnailDatabase::GetFaviconLastUpdatedTime( + favicon_base::FaviconID icon_id, + base::Time* last_updated) { + sql::Statement statement(db_.GetCachedStatement( + SQL_FROM_HERE, + "SELECT MAX(last_updated) FROM favicon_bitmaps WHERE icon_id=?")); + statement.BindInt64(0, icon_id); + + if (!statement.Step()) + return false; + + // Return false also if there there is no bitmap with |icon_id|. + if (statement.ColumnType(0) == sql::COLUMN_TYPE_NULL) + return false; + + // TODO(jkrcal): Convert other uses of the now deprecated + // base::Time::FromInternalValue to make this file consistent again. + if (last_updated) { + *last_updated = base::Time::FromDeltaSinceWindowsEpoch( + base::TimeDelta::FromMicroseconds(statement.ColumnInt64(0))); + } + return true; +} + favicon_base::FaviconID ThumbnailDatabase::GetFaviconIDForFaviconURL( const GURL& icon_url, favicon_base::IconType icon_type) {
diff --git a/components/history/core/browser/thumbnail_database.h b/components/history/core/browser/thumbnail_database.h index 29ca88b..5196835f 100644 --- a/components/history/core/browser/thumbnail_database.h +++ b/components/history/core/browser/thumbnail_database.h
@@ -137,6 +137,11 @@ // of the bitmaps for |icon_id| to be out of date. bool SetFaviconOutOfDate(favicon_base::FaviconID icon_id); + // Retrieves the newest |last_updated| time across all bitmaps for |icon_id|. + // Returns true if successful and if there is at least one bitmap. + bool GetFaviconLastUpdatedTime(favicon_base::FaviconID icon_id, + base::Time* last_updated); + // Mark all bitmaps of type ON_DEMAND at |icon_url| as requested at |time|. // This postpones their automatic eviction from the database. Not all calls // end up in a write into the DB:
diff --git a/components/history/core/browser/thumbnail_database_unittest.cc b/components/history/core/browser/thumbnail_database_unittest.cc index 3df2a80a..4a3f3d7 100644 --- a/components/history/core/browser/thumbnail_database_unittest.cc +++ b/components/history/core/browser/thumbnail_database_unittest.cc
@@ -290,6 +290,49 @@ EXPECT_EQ(base::Time(), last_requested); } +TEST_F(ThumbnailDatabaseTest, + GetFaviconLastUpdatedTimeReturnsFalseForNoBitmaps) { + ThumbnailDatabase db(nullptr); + ASSERT_EQ(sql::INIT_OK, db.Init(file_name_)); + db.BeginTransaction(); + + GURL url("http://google.com"); + favicon_base::FaviconID icon = + db.AddFavicon(url, favicon_base::IconType::kFavicon); + ASSERT_NE(0, icon); + + base::Time last_updated; + ASSERT_FALSE(db.GetFaviconLastUpdatedTime(icon, &last_updated)); +} + +TEST_F(ThumbnailDatabaseTest, GetFaviconLastUpdatedTimeReturnsMaxTime) { + ThumbnailDatabase db(nullptr); + ASSERT_EQ(sql::INIT_OK, db.Init(file_name_)); + db.BeginTransaction(); + + base::Time add_time1; + ASSERT_TRUE( + base::Time::FromUTCExploded({2017, 5, 0, 1, 0, 0, 0, 0}, &add_time1)); + base::Time add_time2 = add_time1 - base::TimeDelta::FromSeconds(1); + std::vector<unsigned char> data(kBlob1, kBlob1 + sizeof(kBlob1)); + scoped_refptr<base::RefCountedBytes> favicon(new base::RefCountedBytes(data)); + + GURL url("http://google.com"); + favicon_base::FaviconID icon = + db.AddFavicon(url, favicon_base::IconType::kFavicon); + ASSERT_NE(0, icon); + FaviconBitmapID bitmap1 = db.AddFaviconBitmap( + icon, favicon, FaviconBitmapType::ON_VISIT, add_time1, gfx::Size()); + ASSERT_NE(0, bitmap1); + FaviconBitmapID bitmap2 = db.AddFaviconBitmap( + icon, favicon, FaviconBitmapType::ON_VISIT, add_time2, gfx::Size()); + ASSERT_NE(0, bitmap2); + + base::Time last_updated; + ASSERT_TRUE(db.GetFaviconLastUpdatedTime(icon, &last_updated)); + EXPECT_EQ(add_time1, last_updated); +} + TEST_F(ThumbnailDatabaseTest, TouchUpdatesOnDemandFavicons) { ThumbnailDatabase db(nullptr); ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc index 6cb4005..62dd8cae 100644 --- a/components/nacl/renderer/ppb_nacl_private_impl.cc +++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -343,6 +343,12 @@ network::mojom::FetchCredentialsMode::kOmit); } + // Plug-ins should not load via service workers as plug-ins may have their own + // origin checking logic that may get confused if service workers respond with + // resources from another origin. + // https://w3c.github.io/ServiceWorker/#implementer-concerns + request.SetServiceWorkerMode(blink::WebURLRequest::ServiceWorkerMode::kNone); + return request; } @@ -1034,6 +1040,11 @@ CreateAssociatedURLLoader(document, gurl)); blink::WebURLRequest request = CreateWebURLRequest(document, gurl); + // Requests from plug-ins must skip service workers, see the comment in + // CreateWebURLRequest. + DCHECK_EQ(request.GetServiceWorkerMode(), + blink::WebURLRequest::ServiceWorkerMode::kNone); + // ManifestDownloader deletes itself after invoking the callback. ManifestDownloader* manifest_downloader = new ManifestDownloader( std::move(url_loader), load_manager->is_installed(),
diff --git a/components/policy/core/common/cloud/cloud_policy_client.cc b/components/policy/core/common/cloud/cloud_policy_client.cc index 6fc6fd8d..21f0f14 100644 --- a/components/policy/core/common/cloud/cloud_policy_client.cc +++ b/components/policy/core/common/cloud/cloud_policy_client.cc
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/callback_helpers.h" #include "base/guid.h" #include "base/logging.h" #include "base/stl_util.h" @@ -114,6 +115,7 @@ dm_token_ = dm_token; client_id_ = client_id; request_jobs_.clear(); + app_install_report_request_job_ = nullptr; policy_fetch_request_job_.reset(); responses_.clear(); @@ -383,13 +385,46 @@ *request->mutable_session_status_report_request() = *session_status; const DeviceManagementRequestJob::Callback job_callback = - base::Bind(&CloudPolicyClient::OnStatusUploadCompleted, - weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback); + base::AdaptCallbackForRepeating(base::BindOnce( + &CloudPolicyClient::OnReportUploadCompleted, + weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback)); request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } +void CloudPolicyClient::UploadAppInstallReport( + const em::AppInstallReportRequest* app_install_report, + const StatusCallback& callback) { + CHECK(is_registered()); + DCHECK(app_install_report); + + std::unique_ptr<DeviceManagementRequestJob> request_job(service_->CreateJob( + DeviceManagementRequestJob::TYPE_UPLOAD_APP_INSTALL_REPORT, + GetRequestContext())); + request_job->SetDMToken(dm_token_); + request_job->SetClientID(client_id_); + + *request_job->GetRequest()->mutable_app_install_report_request() = + *app_install_report; + + const DeviceManagementRequestJob::Callback job_callback = + base::AdaptCallbackForRepeating(base::BindOnce( + &CloudPolicyClient::OnReportUploadCompleted, + weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback)); + + CancelAppInstallReportUpload(); + app_install_report_request_job_ = request_job.get(); + request_jobs_.push_back(std::move(request_job)); + request_jobs_.back()->Start(job_callback); +} + +void CloudPolicyClient::CancelAppInstallReportUpload() { + if (app_install_report_request_job_) { + RemoveJob(app_install_report_request_job_); + } +} + void CloudPolicyClient::FetchRemoteCommands( std::unique_ptr<RemoteCommandJob::UniqueIDType> last_command_id, const std::vector<em::RemoteCommandResult>& command_results, @@ -702,6 +737,7 @@ dm_token_.clear(); // Cancel all outstanding jobs. request_jobs_.clear(); + app_install_report_request_job_ = nullptr; NotifyRegistrationStateChanged(); } else { NotifyClientError(); @@ -819,6 +855,9 @@ } void CloudPolicyClient::RemoveJob(const DeviceManagementRequestJob* job) { + if (app_install_report_request_job_ == job) { + app_install_report_request_job_ = nullptr; + } for (auto it = request_jobs_.begin(); it != request_jobs_.end(); ++it) { if (it->get() == job) { request_jobs_.erase(it); @@ -830,7 +869,7 @@ NOTREACHED(); } -void CloudPolicyClient::OnStatusUploadCompleted( +void CloudPolicyClient::OnReportUploadCompleted( const DeviceManagementRequestJob* job, const CloudPolicyClient::StatusCallback& callback, DeviceManagementStatus status,
diff --git a/components/policy/core/common/cloud/cloud_policy_client.h b/components/policy/core/common/cloud/cloud_policy_client.h index bd9e2c8a..f6c27330 100644 --- a/components/policy/core/common/cloud/cloud_policy_client.h +++ b/components/policy/core/common/cloud/cloud_policy_client.h
@@ -180,6 +180,16 @@ const enterprise_management::SessionStatusReportRequest* session_status, const StatusCallback& callback); + // Uploads a report on the status of app push-installs. The client must be in + // a registered state. The |callback| will be called when the operation + // completes. + virtual void UploadAppInstallReport( + const enterprise_management::AppInstallReportRequest* app_install_report, + const StatusCallback& callback); + + // Cancels the pending app push-install status report upload, if an. + virtual void CancelAppInstallReportUpload(); + // Attempts to fetch remote commands, with |last_command_id| being the ID of // the last command that finished execution and |command_results| being // results for previous commands which have not been reported yet. The @@ -357,8 +367,8 @@ int net_error, const enterprise_management::DeviceManagementResponse& response); - // Callback for status upload requests. - void OnStatusUploadCompleted( + // Callback for several types of status/report upload requests. + void OnReportUploadCompleted( const DeviceManagementRequestJob* job, const StatusCallback& callback, DeviceManagementStatus status, @@ -449,6 +459,10 @@ // silently cancelled if Unregister() is called. std::vector<std::unique_ptr<DeviceManagementRequestJob>> request_jobs_; + // Only one outstanding app push-install report upload is allowed, and it must + // be accessible so that it can be canceled. + DeviceManagementRequestJob* app_install_report_request_job_ = nullptr; + // The policy responses returned by the last policy fetch operation. ResponseMap responses_; DeviceManagementStatus status_ = DM_STATUS_SUCCESS;
diff --git a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc index 38fc638..8465ae4 100644 --- a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc +++ b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc
@@ -53,6 +53,7 @@ const char kAssetId[] = "fake-asset-id"; const char kLocation[] = "fake-location"; const char kGcmID[] = "fake-gcm-id"; +const char kPackageName[] = "com.example.app"; const int64_t kAgeOfCommand = 123123123; const int64_t kLastCommandId = 123456789; const int64_t kTimestamp = 987654321; @@ -206,6 +207,8 @@ license_two->mutable_license_type()->set_license_type( em::LicenseType_LicenseTypeEnum_KIOSK); license_two->set_available_licenses(0); + + upload_app_install_report_response_.mutable_app_install_report_response(); } void SetUp() override { @@ -361,6 +364,26 @@ MatchProto(check_device_license_request_))); } + void ExpectUploadAppInstallReport(const em::DeviceManagementRequest& request, + MockDeviceManagementJob** async_job) { + if (async_job) { + EXPECT_CALL( + service_, + CreateJob(DeviceManagementRequestJob::TYPE_UPLOAD_APP_INSTALL_REPORT, + request_context_)) + .WillOnce(service_.CreateAsyncJob(async_job)); + } else { + EXPECT_CALL( + service_, + CreateJob(DeviceManagementRequestJob::TYPE_UPLOAD_APP_INSTALL_REPORT, + request_context_)) + .WillOnce(service_.SucceedJob(upload_app_install_report_response_)); + } + EXPECT_CALL(service_, StartJob(dm_protocol::kValueRequestAppInstallReport, + std::string(), std::string(), kDMToken, + client_id_, MatchProto(request))); + } + void CheckPolicyResponse() { ASSERT_TRUE(client_->GetPolicyFor(policy_type_, std::string())); EXPECT_THAT(*client_->GetPolicyFor(policy_type_, std::string()), @@ -400,6 +423,7 @@ em::DeviceManagementResponse gcm_id_update_response_; em::DeviceManagementResponse check_device_license_response_; em::DeviceManagementResponse check_device_license_broken_response_; + em::DeviceManagementResponse upload_app_install_report_response_; base::MessageLoop loop_; std::string client_id_; @@ -1076,4 +1100,76 @@ EXPECT_EQ(DM_STATUS_RESPONSE_DECODING_ERROR, client_->status()); } +TEST_F(CloudPolicyClientTest, UploadAppInstallReport) { + Register(); + em::DeviceManagementRequest request; + request.mutable_app_install_report_request(); + ExpectUploadAppInstallReport(request, nullptr /* async_job */); + EXPECT_CALL(callback_observer_, OnCallbackComplete(true)).Times(1); + + CloudPolicyClient::StatusCallback callback = + base::BindRepeating(&MockStatusCallbackObserver::OnCallbackComplete, + base::Unretained(&callback_observer_)); + + em::AppInstallReportRequest app_install_report; + client_->UploadAppInstallReport(&app_install_report, callback); + EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); +} + +TEST_F(CloudPolicyClientTest, CancelUploadAppInstallReport) { + Register(); + em::DeviceManagementRequest request; + request.mutable_app_install_report_request(); + MockDeviceManagementJob* async_job = nullptr; + ExpectUploadAppInstallReport(request, &async_job); + EXPECT_CALL(callback_observer_, OnCallbackComplete(true)).Times(0); + + CloudPolicyClient::StatusCallback callback = + base::BindRepeating(&MockStatusCallbackObserver::OnCallbackComplete, + base::Unretained(&callback_observer_)); + + em::AppInstallReportRequest app_install_report; + client_->UploadAppInstallReport(&app_install_report, callback); + EXPECT_EQ(1, client_->GetActiveRequestCountForTest()); + + client_->CancelAppInstallReportUpload(); + EXPECT_EQ(0, client_->GetActiveRequestCountForTest()); +} + +TEST_F(CloudPolicyClientTest, UploadAppInstallReportSupersedesPending) { + Register(); + em::DeviceManagementRequest request; + request.mutable_app_install_report_request(); + MockDeviceManagementJob* async_job = nullptr; + ExpectUploadAppInstallReport(request, &async_job); + EXPECT_CALL(callback_observer_, OnCallbackComplete(true)).Times(0); + + CloudPolicyClient::StatusCallback callback = + base::BindRepeating(&MockStatusCallbackObserver::OnCallbackComplete, + base::Unretained(&callback_observer_)); + + em::AppInstallReportRequest app_install_report; + client_->UploadAppInstallReport(&app_install_report, callback); + EXPECT_EQ(1, client_->GetActiveRequestCountForTest()); + Mock::VerifyAndClearExpectations(&service_); + Mock::VerifyAndClearExpectations(&callback_observer_); + + // Starting another app push-install report upload should cancel the pending + // one. + request.mutable_app_install_report_request() + ->add_app_install_report() + ->set_package(kPackageName); + ExpectUploadAppInstallReport(request, &async_job); + EXPECT_CALL(callback_observer_, OnCallbackComplete(true)).Times(1); + + app_install_report.CopyFrom(request.app_install_report_request()); + client_->UploadAppInstallReport(&app_install_report, callback); + EXPECT_EQ(1, client_->GetActiveRequestCountForTest()); + + async_job->SendResponse(DM_STATUS_SUCCESS, + upload_app_install_report_response_); + EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); + EXPECT_EQ(0, client_->GetActiveRequestCountForTest()); +} + } // namespace policy
diff --git a/components/policy/core/common/cloud/cloud_policy_constants.cc b/components/policy/core/common/cloud/cloud_policy_constants.cc index b90ae7a6..60e8ab9 100644 --- a/components/policy/core/common/cloud/cloud_policy_constants.cc +++ b/components/policy/core/common/cloud/cloud_policy_constants.cc
@@ -54,6 +54,7 @@ const char kValueRequestActiveDirectoryPlayActivity[] = "active_directory_play_activity"; const char kValueRequestCheckDeviceLicense[] = "check_device_license"; +const char kValueRequestAppInstallReport[] = "app_install_report"; const char kChromeDevicePolicyType[] = "google/chromeos/device"; #if defined(OS_CHROMEOS)
diff --git a/components/policy/core/common/cloud/cloud_policy_constants.h b/components/policy/core/common/cloud/cloud_policy_constants.h index e8891d3..7bc7e17 100644 --- a/components/policy/core/common/cloud/cloud_policy_constants.h +++ b/components/policy/core/common/cloud/cloud_policy_constants.h
@@ -46,6 +46,7 @@ POLICY_EXPORT extern const char kValueRequestActiveDirectoryEnrollPlayUser[]; POLICY_EXPORT extern const char kValueRequestActiveDirectoryPlayActivity[]; POLICY_EXPORT extern const char kValueRequestCheckDeviceLicense[]; +POLICY_EXPORT extern const char kValueRequestAppInstallReport[]; // Policy type strings for the policy_type field in PolicyFetchRequest. POLICY_EXPORT extern const char kChromeDevicePolicyType[];
diff --git a/components/policy/core/common/cloud/device_management_service.cc b/components/policy/core/common/cloud/device_management_service.cc index c0b6d3e..385ea95 100644 --- a/components/policy/core/common/cloud/device_management_service.cc +++ b/components/policy/core/common/cloud/device_management_service.cc
@@ -158,6 +158,8 @@ return dm_protocol::kValueRequestActiveDirectoryPlayActivity; case DeviceManagementRequestJob::TYPE_REQUEST_LICENSE_TYPES: return dm_protocol::kValueRequestCheckDeviceLicense; + case DeviceManagementRequestJob::TYPE_UPLOAD_APP_INSTALL_REPORT: + return dm_protocol::kValueRequestAppInstallReport; } NOTREACHED() << "Invalid job type " << type; return "";
diff --git a/components/policy/core/common/cloud/device_management_service.h b/components/policy/core/common/cloud/device_management_service.h index 9efde08..b6d0b51e 100644 --- a/components/policy/core/common/cloud/device_management_service.h +++ b/components/policy/core/common/cloud/device_management_service.h
@@ -63,6 +63,7 @@ TYPE_ACTIVE_DIRECTORY_ENROLL_PLAY_USER = 14, TYPE_ACTIVE_DIRECTORY_PLAY_ACTIVITY = 15, TYPE_REQUEST_LICENSE_TYPES = 16, + TYPE_UPLOAD_APP_INSTALL_REPORT = 17, }; typedef base::Callback<
diff --git a/components/policy/core/common/cloud/device_management_service_unittest.cc b/components/policy/core/common/cloud/device_management_service_unittest.cc index f31ea084..6f5031dc 100644 --- a/components/policy/core/common/cloud/device_management_service_unittest.cc +++ b/components/policy/core/common/cloud/device_management_service_unittest.cc
@@ -9,6 +9,7 @@ #include <vector> #include "base/bind.h" +#include "base/callback_helpers.h" #include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" @@ -187,6 +188,20 @@ return job; } + DeviceManagementRequestJob* StartAppInstallReportJob() { + DeviceManagementRequestJob* job = service_->CreateJob( + DeviceManagementRequestJob::TYPE_UPLOAD_APP_INSTALL_REPORT, + request_context_.get()); + job->SetDMToken(kDMToken); + job->SetClientID(kClientID); + job->GetRequest()->mutable_app_install_report_request(); + job->SetRetryCallback(base::BindRepeating( + &DeviceManagementServiceTestBase::OnJobRetry, base::Unretained(this))); + job->Start(base::AdaptCallbackForRepeating(base::BindOnce( + &DeviceManagementServiceTestBase::OnJobDone, base::Unretained(this)))); + return job; + } + void SendResponse(net::TestURLFetcher* fetcher, net::Error error, int http_status, @@ -310,6 +325,18 @@ GetParam().response_); } +TEST_P(DeviceManagementServiceFailedRequestTest, AppInstallReportRequest) { + EXPECT_CALL(*this, OnJobDone(GetParam().expected_status_, _, _)); + EXPECT_CALL(*this, OnJobRetry(_)).Times(0); + std::unique_ptr<DeviceManagementRequestJob> request_job( + StartAppInstallReportJob()); + net::TestURLFetcher* fetcher = GetFetcher(); + ASSERT_TRUE(fetcher); + + SendResponse(fetcher, GetParam().error_, GetParam().http_status_, + GetParam().response_); +} + INSTANTIATE_TEST_CASE_P( DeviceManagementServiceFailedRequestTestInstance, DeviceManagementServiceFailedRequestTest, @@ -574,6 +601,31 @@ SendResponse(fetcher, net::OK, 200, response_data); } +TEST_F(DeviceManagementServiceTest, AppInstallReportRequest) { + em::DeviceManagementResponse expected_response; + expected_response.mutable_app_install_report_response(); + EXPECT_CALL( + *this, OnJobDone(DM_STATUS_SUCCESS, _, MessageEquals(expected_response))); + EXPECT_CALL(*this, OnJobRetry(_)).Times(0); + std::unique_ptr<DeviceManagementRequestJob> request_job( + StartAppInstallReportJob()); + net::TestURLFetcher* fetcher = GetFetcher(); + ASSERT_TRUE(fetcher); + + CheckURLAndQueryParams(fetcher->GetOriginalURL(), + dm_protocol::kValueRequestAppInstallReport, kClientID, + ""); + + std::string expected_data; + ASSERT_TRUE(request_job->GetRequest()->SerializeToString(&expected_data)); + EXPECT_EQ(expected_data, fetcher->upload_data()); + + // Generate the response. + std::string response_data; + ASSERT_TRUE(expected_response.SerializeToString(&response_data)); + SendResponse(fetcher, net::OK, 200, response_data); +} + TEST_F(DeviceManagementServiceTest, CancelRegisterRequest) { EXPECT_CALL(*this, OnJobDone(_, _, _)).Times(0); EXPECT_CALL(*this, OnJobRetry(_)).Times(0); @@ -634,6 +686,18 @@ request_job.reset(); } +TEST_F(DeviceManagementServiceTest, CancelAppInstallReportRequest) { + EXPECT_CALL(*this, OnJobDone(_, _, _)).Times(0); + EXPECT_CALL(*this, OnJobRetry(_)).Times(0); + std::unique_ptr<DeviceManagementRequestJob> request_job( + StartAppInstallReportJob()); + net::TestURLFetcher* fetcher = GetFetcher(); + ASSERT_TRUE(fetcher); + + // There shouldn't be any callbacks. + request_job.reset(); +} + TEST_F(DeviceManagementServiceTest, JobQueueing) { // Start with a non-initialized service. ResetService();
diff --git a/components/viz/common/BUILD.gn b/components/viz/common/BUILD.gn index 151e96d..f377193 100644 --- a/components/viz/common/BUILD.gn +++ b/components/viz/common/BUILD.gn
@@ -133,6 +133,7 @@ "surfaces/parent_local_surface_id_allocator.h", "surfaces/surface_id.cc", "surfaces/surface_id.h", + "surfaces/surface_info.cc", "surfaces/surface_info.h", "switches.cc", "switches.h",
diff --git a/components/viz/common/quads/frame_deadline.h b/components/viz/common/quads/frame_deadline.h index 6f41926..faa992f 100644 --- a/components/viz/common/quads/frame_deadline.h +++ b/components/viz/common/quads/frame_deadline.h
@@ -7,6 +7,8 @@ #include "components/viz/common/viz_common_export.h" +#include "base/time/time.h" + namespace viz { class VIZ_COMMON_EXPORT FrameDeadline {
diff --git a/components/viz/common/surfaces/surface_info.cc b/components/viz/common/surfaces/surface_info.cc new file mode 100644 index 0000000..8528990 --- /dev/null +++ b/components/viz/common/surfaces/surface_info.cc
@@ -0,0 +1,21 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/viz/common/surfaces/surface_info.h" + +#include "base/strings/stringprintf.h" + +namespace viz { + +std::string SurfaceInfo::ToString() const { + return base::StringPrintf("SurfaceInfo(%s, DeviceScaleFactor(%f), Size(%s))", + id_.ToString().c_str(), device_scale_factor_, + size_in_pixels_.ToString().c_str()); +} + +std::ostream& operator<<(std::ostream& out, const SurfaceInfo& surface_info) { + return out << surface_info.ToString(); +} + +} // namespace viz
diff --git a/components/viz/common/surfaces/surface_info.h b/components/viz/common/surfaces/surface_info.h index b40092b..55141b0 100644 --- a/components/viz/common/surfaces/surface_info.h +++ b/components/viz/common/surfaces/surface_info.h
@@ -6,6 +6,7 @@ #define COMPONENTS_VIZ_COMMON_SURFACES_SURFACE_INFO_H_ #include "components/viz/common/surfaces/surface_id.h" +#include "components/viz/common/viz_common_export.h" #include "ui/gfx/geometry/size.h" namespace IPC { @@ -20,7 +21,7 @@ } // namespace mojom // This class contains information about the surface that is being embedded. -class SurfaceInfo { +class VIZ_COMMON_EXPORT SurfaceInfo { public: SurfaceInfo() = default; SurfaceInfo(const SurfaceId& id, @@ -47,6 +48,8 @@ float device_scale_factor() const { return device_scale_factor_; } const gfx::Size& size_in_pixels() const { return size_in_pixels_; } + std::string ToString() const; + private: friend struct mojo::StructTraits<mojom::SurfaceInfoDataView, SurfaceInfo>; friend struct IPC::ParamTraits<SurfaceInfo>; @@ -56,6 +59,9 @@ gfx::Size size_in_pixels_; }; +VIZ_COMMON_EXPORT std::ostream& operator<<(std::ostream& out, + const SurfaceInfo& surface_info); + } // namespace viz #endif // COMPONENTS_VIZ_COMMON_SURFACES_SURFACE_INFO_H_
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn index 3444bca..a00fa494 100644 --- a/components/viz/service/BUILD.gn +++ b/components/viz/service/BUILD.gn
@@ -286,6 +286,7 @@ "frame_sinks/video_detector_unittest.cc", "gl/gpu_service_impl_unittest.cc", "hit_test/hit_test_aggregator_unittest.cc", + "surfaces/surface_dependency_deadline_unittest.cc", "surfaces/surface_hittest_unittest.cc", "surfaces/surface_unittest.cc", ]
diff --git a/components/viz/service/surfaces/surface_dependency_deadline.cc b/components/viz/service/surfaces/surface_dependency_deadline.cc index d15d4f8..bd28f50 100644 --- a/components/viz/service/surfaces/surface_dependency_deadline.cc +++ b/components/viz/service/surfaces/surface_dependency_deadline.cc
@@ -34,9 +34,8 @@ start_time_ = frame_deadline.frame_start_time(); deadline_ = start_time_ + frame_deadline.deadline_in_frames() * frame_deadline.frame_interval(); - bool deadline_in_future = deadline_ > tick_clock_->NowTicks(); begin_frame_source_->AddObserver(this); - return deadline_in_future; + return has_deadline(); } base::Optional<base::TimeDelta> SurfaceDependencyDeadline::Cancel() {
diff --git a/components/viz/service/surfaces/surface_dependency_deadline.h b/components/viz/service/surfaces/surface_dependency_deadline.h index 04ecb0b8..a2be092 100644 --- a/components/viz/service/surfaces/surface_dependency_deadline.h +++ b/components/viz/service/surfaces/surface_dependency_deadline.h
@@ -8,6 +8,7 @@ #include "components/viz/common/frame_sinks/begin_frame_source.h" #include "components/viz/service/surfaces/surface_deadline_client.h" +#include "components/viz/service/viz_service_export.h" namespace base { class TickClock; @@ -17,7 +18,7 @@ class FrameDeadline; -class SurfaceDependencyDeadline : public BeginFrameObserver { +class VIZ_SERVICE_EXPORT SurfaceDependencyDeadline : public BeginFrameObserver { public: SurfaceDependencyDeadline(SurfaceDeadlineClient* client, BeginFrameSource* begin_frame_source,
diff --git a/components/viz/service/surfaces/surface_dependency_deadline_unittest.cc b/components/viz/service/surfaces/surface_dependency_deadline_unittest.cc new file mode 100644 index 0000000..ce631b2 --- /dev/null +++ b/components/viz/service/surfaces/surface_dependency_deadline_unittest.cc
@@ -0,0 +1,132 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/viz/service/surfaces/surface_dependency_deadline.h" +#include "components/viz/common/quads/frame_deadline.h" +#include "components/viz/service/surfaces/surface_deadline_client.h" +#include "components/viz/test/begin_frame_args_test.h" +#include "components/viz/test/fake_external_begin_frame_source.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace viz { +namespace test { + +class FakeSurfaceDeadlineClient : public SurfaceDeadlineClient { + public: + FakeSurfaceDeadlineClient() = default; + ~FakeSurfaceDeadlineClient() = default; + + // SurfaceDeadlineClient implementation: + void OnDeadline(base::TimeDelta duration) override {} + + private: + DISALLOW_COPY_AND_ASSIGN(FakeSurfaceDeadlineClient); +}; + +class FakeSlowBeginFrameSource : public FakeExternalBeginFrameSource { + public: + FakeSlowBeginFrameSource(double refresh_rate, + bool tick_automatically, + base::SimpleTestTickClock* tick_clock) + : FakeExternalBeginFrameSource(refresh_rate, tick_automatically), + tick_clock_(tick_clock) {} + + ~FakeSlowBeginFrameSource() override {} + + // FakeExternalBeginFrameSource overrides: + void AddObserver(BeginFrameObserver* obs) override { + // Advancing time here simulates a slow AddObserver operation. + tick_clock_->Advance(BeginFrameArgs::DefaultInterval()); + FakeExternalBeginFrameSource::AddObserver(obs); + } + + private: + base::SimpleTestTickClock* const tick_clock_; + DISALLOW_COPY_AND_ASSIGN(FakeSlowBeginFrameSource); +}; + +class SurfaceDependencyDeadlineTest : public testing::Test { + public: + SurfaceDependencyDeadlineTest() = default; + + ~SurfaceDependencyDeadlineTest() override {} + + FakeSlowBeginFrameSource* begin_frame_source() { + return begin_frame_source_.get(); + } + + FrameDeadline MakeDefaultDeadline() { + return FrameDeadline(now_src_->NowTicks(), 4u, + BeginFrameArgs::DefaultInterval(), false); + } + + SurfaceDependencyDeadline* deadline() { return deadline_.get(); } + + void SendLateBeginFrame(uint32_t frames_late) { + // Creep the time forward so that any BeginFrameArgs is not equal to the + // last one otherwise we violate the BeginFrameSource contract. + now_src_->Advance(frames_late * BeginFrameArgs::DefaultInterval()); + BeginFrameArgs args = begin_frame_source_->CreateBeginFrameArgs( + BEGINFRAME_FROM_HERE, now_src_.get()); + begin_frame_source_->TestOnBeginFrame(args); + } + + // testing::Test: + void SetUp() override { + testing::Test::SetUp(); + + now_src_ = std::make_unique<base::SimpleTestTickClock>(); + begin_frame_source_ = + std::make_unique<FakeSlowBeginFrameSource>(0.f, false, now_src_.get()); + + deadline_ = std::make_unique<SurfaceDependencyDeadline>( + &client_, begin_frame_source_.get(), now_src_.get()); + } + + void TearDown() override { + deadline_->Cancel(); + deadline_.reset(); + begin_frame_source_.reset(); + now_src_.reset(); + } + + private: + std::unique_ptr<base::SimpleTestTickClock> now_src_; + std::unique_ptr<FakeSlowBeginFrameSource> begin_frame_source_; + FakeSurfaceDeadlineClient client_; + std::unique_ptr<SurfaceDependencyDeadline> deadline_; + + DISALLOW_COPY_AND_ASSIGN(SurfaceDependencyDeadlineTest); +}; + +// This test verifies that if the FrameDeadline is in the past then +// SurfaceDependencyDeadline::Set will return false. +TEST_F(SurfaceDependencyDeadlineTest, DeadlineInPast) { + FrameDeadline frame_deadline = MakeDefaultDeadline(); + SendLateBeginFrame(4u); + EXPECT_FALSE(deadline()->Set(frame_deadline)); + EXPECT_FALSE(deadline()->has_deadline()); +} + +// This test verifies that if Set returns false, then SurfaceDependencyDeadline +// does not have a pending deadline. +TEST_F(SurfaceDependencyDeadlineTest, SetMatchesHasDeadlineIfFalse) { + FrameDeadline frame_deadline = MakeDefaultDeadline(); + SendLateBeginFrame(3u); + EXPECT_FALSE(deadline()->Set(frame_deadline)); + EXPECT_FALSE(deadline()->has_deadline()); +} + +// This test verifies that if Set returns true, then SurfaceDependencyDeadline +// has a pending deadline. +TEST_F(SurfaceDependencyDeadlineTest, SetMatchesHasDeadlineIfTrue) { + FrameDeadline frame_deadline = MakeDefaultDeadline(); + SendLateBeginFrame(2u); + EXPECT_TRUE(deadline()->Set(frame_deadline)); + EXPECT_TRUE(deadline()->has_deadline()); +} + +} // namespace test +} // namespace viz
diff --git a/components/web_contents_delegate_android/DEPS b/components/web_contents_delegate_android/DEPS index a022051..23a65e31 100644 --- a/components/web_contents_delegate_android/DEPS +++ b/components/web_contents_delegate_android/DEPS
@@ -2,7 +2,7 @@ "+content/public/browser", "+content/public/common", "+jni", - "+third_party/WebKit/common", + "+third_party/WebKit/public/mojom", "+ui/android", "+ui/base", "+ui/gfx"
diff --git a/components/web_contents_delegate_android/color_chooser_android.h b/components/web_contents_delegate_android/color_chooser_android.h index 03dd7e51..2b871e73 100644 --- a/components/web_contents_delegate_android/color_chooser_android.h +++ b/components/web_contents_delegate_android/color_chooser_android.h
@@ -12,7 +12,7 @@ #include "base/macros.h" #include "base/strings/string16.h" #include "content/public/browser/color_chooser.h" -#include "third_party/WebKit/common/color_chooser/color_chooser.mojom.h" +#include "third_party/WebKit/public/mojom/color_chooser/color_chooser.mojom.h" using base::android::AttachCurrentThread; using base::android::ScopedJavaLocalRef;
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index f3af8a9..a852d19 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -1004,8 +1004,8 @@ "loader/null_resource_controller.h", "loader/prefetch_url_loader.cc", "loader/prefetch_url_loader.h", - "loader/prefetch_url_loader_factory.cc", - "loader/prefetch_url_loader_factory.h", + "loader/prefetch_url_loader_service.cc", + "loader/prefetch_url_loader_service.h", "loader/redirect_to_file_resource_handler.cc", "loader/redirect_to_file_resource_handler.h", "loader/resource_buffer.cc", @@ -1027,21 +1027,6 @@ "loader/resource_requester_info.h", "loader/resource_scheduler_filter.cc", "loader/resource_scheduler_filter.h", - "loader/signed_exchange_cert_fetcher.cc", - "loader/signed_exchange_cert_fetcher.h", - "loader/signed_exchange_consts.h", - "loader/signed_exchange_handler.cc", - "loader/signed_exchange_handler.h", - "loader/signed_exchange_header.cc", - "loader/signed_exchange_header.h", - "loader/signed_exchange_header_parser.cc", - "loader/signed_exchange_header_parser.h", - "loader/signed_exchange_parser.cc", - "loader/signed_exchange_parser.h", - "loader/signed_exchange_signature_verifier.cc", - "loader/signed_exchange_signature_verifier.h", - "loader/signed_exchange_url_loader_factory_for_non_network_service.cc", - "loader/signed_exchange_url_loader_factory_for_non_network_service.h", "loader/source_stream_to_data_pipe.cc", "loader/source_stream_to_data_pipe.h", "loader/stream_resource_handler.cc", @@ -1060,10 +1045,6 @@ "loader/url_loader_request_handler.h", "loader/wake_lock_resource_throttle.cc", "loader/wake_lock_resource_throttle.h", - "loader/web_package_loader.cc", - "loader/web_package_loader.h", - "loader/web_package_request_handler.cc", - "loader/web_package_request_handler.h", "loader_delegate_impl.cc", "loader_delegate_impl.h", "locks/lock_manager.cc", @@ -1120,6 +1101,8 @@ "media/media_web_contents_observer.h", "media/midi_host.cc", "media/midi_host.h", + "media/mojo_audio_logging_adapter.cc", + "media/mojo_audio_logging_adapter.h", "media/session/audio_focus_delegate.h", "media/session/audio_focus_delegate_android.cc", "media/session/audio_focus_delegate_android.h", @@ -1697,6 +1680,25 @@ "web_contents/web_drag_source_mac.mm", "web_contents/web_drag_utils_win.cc", "web_contents/web_drag_utils_win.h", + "web_package/signed_exchange_cert_fetcher.cc", + "web_package/signed_exchange_cert_fetcher.h", + "web_package/signed_exchange_consts.h", + "web_package/signed_exchange_handler.cc", + "web_package/signed_exchange_handler.h", + "web_package/signed_exchange_header.cc", + "web_package/signed_exchange_header.h", + "web_package/signed_exchange_header_parser.cc", + "web_package/signed_exchange_header_parser.h", + "web_package/signed_exchange_parser.cc", + "web_package/signed_exchange_parser.h", + "web_package/signed_exchange_signature_verifier.cc", + "web_package/signed_exchange_signature_verifier.h", + "web_package/signed_exchange_url_loader_factory_for_non_network_service.cc", + "web_package/signed_exchange_url_loader_factory_for_non_network_service.h", + "web_package/web_package_loader.cc", + "web_package/web_package_loader.h", + "web_package/web_package_request_handler.cc", + "web_package/web_package_request_handler.h", "websockets/websocket_handshake_request_info_impl.cc", "websockets/websocket_handshake_request_info_impl.h", "websockets/websocket_impl.cc",
diff --git a/content/browser/accessibility/accessibility_tree_formatter_android.cc b/content/browser/accessibility/accessibility_tree_formatter_android.cc index 0f9bcde..96396f0 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_android.cc +++ b/content/browser/accessibility/accessibility_tree_formatter_android.cc
@@ -23,29 +23,19 @@ namespace { -const char* const BOOL_ATTRIBUTES[] = {"checkable", - "checked", - "clickable", - "collection", - "collection_item", - "content_invalid", - "disabled", - "dismissable", - "editable_text", - "focusable", - "focused", - "has_character_locations", - "has_non_empty_value", - "heading", - "hierarchical", - "invisible", - "link", - "multiline", - "password", - "range", - "scrollable", - "selected", - "interesting"}; +const char* const BOOL_ATTRIBUTES[] = { + "checkable", "checked", + "clickable", "collection", + "collection_item", "content_invalid", + "disabled", "dismissable", + "editable_text", "focusable", + "focused", "has_character_locations", + "has_image", "has_non_empty_value", + "heading", "hierarchical", + "invisible", "link", + "multiline", "password", + "range", "scrollable", + "selected", "interesting"}; const char* const STRING_ATTRIBUTES[] = { "name", "hint", @@ -123,6 +113,7 @@ dict->SetBoolean("focused", android_node->IsFocused()); dict->SetBoolean("has_character_locations", android_node->HasCharacterLocations()); + dict->SetBoolean("has_image", android_node->HasImage()); dict->SetBoolean("has_non_empty_value", android_node->HasNonEmptyValue()); dict->SetBoolean("heading", android_node->IsHeading()); dict->SetBoolean("hierarchical", android_node->IsHierarchical());
diff --git a/content/browser/accessibility/browser_accessibility_android.cc b/content/browser/accessibility/browser_accessibility_android.cc index e63e2c5c..a5e2045 100644 --- a/content/browser/accessibility/browser_accessibility_android.cc +++ b/content/browser/accessibility/browser_accessibility_android.cc
@@ -1390,6 +1390,18 @@ return false; } +bool BrowserAccessibilityAndroid::HasImage() const { + if (ui::IsImage(GetRole())) + return true; + + for (uint32_t i = 0; i < InternalChildCount(); i++) { + BrowserAccessibility* child = InternalGetChild(i); + if (static_cast<BrowserAccessibilityAndroid*>(child)->HasImage()) + return true; + } + return false; +} + bool BrowserAccessibilityAndroid::HasOnlyTextChildren() const { // This is called from PlatformIsLeaf, so don't call PlatformChildCount // from within this!
diff --git a/content/browser/accessibility/browser_accessibility_android.h b/content/browser/accessibility/browser_accessibility_android.h index e1b518d8..a2c8b6c 100644 --- a/content/browser/accessibility/browser_accessibility_android.h +++ b/content/browser/accessibility/browser_accessibility_android.h
@@ -74,6 +74,7 @@ bool HasNonEmptyValue() const; bool HasCharacterLocations() const; + bool HasImage() const; const char* GetClassName() const; base::string16 GetText() const override;
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc index 7dc5bb15..1d6d2ad4 100644 --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -247,6 +247,7 @@ AddFilter(filters, "hint=*"); AddFilter(filters, "interesting", Filter::DENY); AddFilter(filters, "has_character_locations", Filter::DENY); + AddFilter(filters, "has_image", Filter::DENY); // // General
diff --git a/content/browser/accessibility/web_contents_accessibility_android.cc b/content/browser/accessibility/web_contents_accessibility_android.cc index 4653997..64c70a9 100644 --- a/content/browser/accessibility/web_contents_accessibility_android.cc +++ b/content/browser/accessibility/web_contents_accessibility_android.cc
@@ -710,7 +710,8 @@ base::android::ConvertUTF16ToJavaString(env, node->GetRoleDescription()), base::android::ConvertUTF16ToJavaString(env, node->GetHint()), node->GetIntAttribute(ax::mojom::IntAttribute::kTextSelStart), - node->GetIntAttribute(ax::mojom::IntAttribute::kTextSelEnd)); + node->GetIntAttribute(ax::mojom::IntAttribute::kTextSelEnd), + node->HasImage()); Java_WebContentsAccessibilityImpl_setAccessibilityNodeInfoLollipopAttributes( env, obj, info, node->CanOpenPopup(), node->IsContentInvalid(),
diff --git a/content/browser/appcache/appcache_internals_ui.cc b/content/browser/appcache/appcache_internals_ui.cc index 71bf90c5..f6f494a3 100644 --- a/content/browser/appcache/appcache_internals_ui.cc +++ b/content/browser/appcache/appcache_internals_ui.cc
@@ -249,8 +249,7 @@ BrowserThread::UI, FROM_HERE, base::BindOnce(&AppCacheInternalsUI::OnAppCacheDetailsReady, appcache_internals_ui_, partition_path_, - manifest_gurl.spec(), - base::Passed(&resource_info_vector))); + manifest_gurl.spec(), std::move(resource_info_vector))); } void AppCacheInternalsUI::Proxy::RequestFileDetails(
diff --git a/content/browser/background_sync/background_sync_context.cc b/content/browser/background_sync/background_sync_context.cc index eaa2a6a..625ae34 100644 --- a/content/browser/background_sync/background_sync_context.cc +++ b/content/browser/background_sync/background_sync_context.cc
@@ -50,7 +50,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&BackgroundSyncContext::CreateServiceOnIOThread, this, - base::Passed(&request))); + std::move(request))); } void BackgroundSyncContext::ServiceHadConnectionError(
diff --git a/content/browser/background_sync/background_sync_manager.cc b/content/browser/background_sync/background_sync_manager.cc index f23c0692..2b0a18f 100644 --- a/content/browser/background_sync/background_sync_manager.cc +++ b/content/browser/background_sync/background_sync_manager.cc
@@ -232,8 +232,7 @@ FROM_HERE, base::BindOnce( std::move(callback), BACKGROUND_SYNC_STATUS_STORAGE_ERROR, - base::Passed( - std::vector<std::unique_ptr<BackgroundSyncRegistration>>()))); + std::vector<std::unique_ptr<BackgroundSyncRegistration>>())); return; } @@ -330,8 +329,7 @@ BrowserThread::PostTaskAndReplyWithResult( BrowserThread::UI, FROM_HERE, base::BindOnce(&GetControllerParameters, service_worker_context_, - base::Passed(std::make_unique<BackgroundSyncParameters>( - *parameters_))), + std::make_unique<BackgroundSyncParameters>(*parameters_)), base::BindOnce(&BackgroundSyncManager::InitDidGetControllerParameters, weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } @@ -536,10 +534,9 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, - base::BindOnce( - std::move(callback), BACKGROUND_SYNC_STATUS_OK, - base::Passed(std::make_unique<BackgroundSyncRegistration>( - *existing_registration)))); + base::BindOnce(std::move(callback), BACKGROUND_SYNC_STATUS_OK, + std::make_unique<BackgroundSyncRegistration>( + *existing_registration))); return; } @@ -710,10 +707,9 @@ FireReadyEvents(); base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::BindOnce(std::move(callback), BACKGROUND_SYNC_STATUS_OK, - base::Passed(std::make_unique<BackgroundSyncRegistration>( - new_registration)))); + FROM_HERE, base::BindOnce(std::move(callback), BACKGROUND_SYNC_STATUS_OK, + std::make_unique<BackgroundSyncRegistration>( + new_registration))); } void BackgroundSyncManager::RemoveActiveRegistration(int64_t sw_registration_id, @@ -820,7 +816,7 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), BACKGROUND_SYNC_STATUS_STORAGE_ERROR, - base::Passed(&out_registrations))); + std::move(out_registrations))); return; } @@ -839,7 +835,7 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), BACKGROUND_SYNC_STATUS_OK, - base::Passed(&out_registrations))); + std::move(out_registrations))); } bool BackgroundSyncManager::AreOptionConditionsMet(
diff --git a/content/browser/blob_storage/chrome_blob_storage_context.cc b/content/browser/blob_storage/chrome_blob_storage_context.cc index a62437f..05e3cc1 100644 --- a/content/browser/blob_storage/chrome_blob_storage_context.cc +++ b/content/browser/blob_storage/chrome_blob_storage_context.cc
@@ -120,15 +120,15 @@ BrowserThread::PostAfterStartupTask( FROM_HERE, file_task_runner, base::BindOnce(&RemoveOldBlobStorageDirectories, - base::Passed(&blob_storage_parent), blob_storage_dir)); + std::move(blob_storage_parent), blob_storage_dir)); } if (io_thread_valid) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&ChromeBlobStorageContext::InitializeOnIOThread, blob, - base::Passed(&blob_storage_dir), - base::Passed(&file_task_runner))); + std::move(blob_storage_dir), + std::move(file_task_runner))); } }
diff --git a/content/browser/bluetooth/bluetooth_device_chooser_controller.cc b/content/browser/bluetooth/bluetooth_device_chooser_controller.cc index 1f54fa0f..ce398d75 100644 --- a/content/browser/bluetooth/bluetooth_device_chooser_controller.cc +++ b/content/browser/bluetooth/bluetooth_device_chooser_controller.cc
@@ -614,9 +614,8 @@ void BluetoothDeviceChooserController::PostSuccessCallback( const std::string& device_address) { if (!base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::BindOnce(success_callback_, base::Passed(std::move(options_)), - device_address))) { + FROM_HERE, base::BindOnce(success_callback_, std::move(options_), + device_address))) { LOG(WARNING) << "No TaskRunner."; } }
diff --git a/content/browser/browser_associated_interface_unittest.cc b/content/browser/browser_associated_interface_unittest.cc index 72b9a79..0de9b41 100644 --- a/content/browser/browser_associated_interface_unittest.cc +++ b/content/browser/browser_associated_interface_unittest.cc
@@ -122,7 +122,7 @@ : client_thread_("Test client") { client_thread_.Start(); client_thread_.task_runner()->PostTask( - FROM_HERE, base::BindOnce(&RunTestClient, base::Passed(&pipe))); + FROM_HERE, base::BindOnce(&RunTestClient, std::move(pipe))); } ~TestClientRunner() {
diff --git a/content/browser/byte_stream.cc b/content/browser/byte_stream.cc index 48c6dbbd..010e8d8 100644 --- a/content/browser/byte_stream.cc +++ b/content/browser/byte_stream.cc
@@ -299,8 +299,8 @@ peer_task_runner_->PostTask( FROM_HERE, base::BindOnce(&ByteStreamReaderImpl::TransferData, peer_lifetime_flag_, - peer_, base::Passed(&transfer_buffer), buffer_size, - complete, status)); + peer_, std::move(transfer_buffer), buffer_size, complete, + status)); } ByteStreamReaderImpl::ByteStreamReaderImpl(
diff --git a/content/browser/cache_storage/cache_storage.cc b/content/browser/cache_storage/cache_storage.cc index 4fd7df1..d79bc30 100644 --- a/content/browser/cache_storage/cache_storage.cc +++ b/content/browser/cache_storage/cache_storage.cc
@@ -456,7 +456,7 @@ cache_task_runner_->PostTask( FROM_HERE, base::BindOnce(&DeleteUnreferencedCachesInPool, origin_path_, - base::Passed(&cache_dirs))); + std::move(cache_dirs))); std::move(callback).Run(std::move(index)); } @@ -683,7 +683,7 @@ scheduler_->ScheduleOperation( base::BindOnce(&CacheStorage::MatchCacheImpl, weak_factory_.GetWeakPtr(), - cache_name, base::Passed(std::move(request)), match_params, + cache_name, std::move(request), match_params, scheduler_->WrapCallbackToRunNext(std::move(callback)))); } @@ -702,7 +702,7 @@ scheduler_->ScheduleOperation(base::BindOnce( &CacheStorage::MatchAllCachesImpl, weak_factory_.GetWeakPtr(), - base::Passed(std::move(request)), match_params, + std::move(request), match_params, scheduler_->WrapCallbackToRunNext(std::move(callback)))); } @@ -884,7 +884,7 @@ *cache_index_, base::BindOnce(&CacheStorage::CreateCacheDidWriteIndex, weak_factory_.GetWeakPtr(), std::move(callback), - base::Passed(CreateCacheHandle(cache_ptr)))); + CreateCacheHandle(cache_ptr))); cache_loader_->NotifyCacheCreated(cache_name, CreateCacheHandle(cache_ptr)); if (cache_storage_manager_) @@ -922,10 +922,10 @@ cache_handle.value()->SetObserver(nullptr); cache_index_->DoomCache(cache_name); cache_loader_->WriteIndex( - *cache_index_, base::BindOnce(&CacheStorage::DeleteCacheDidWriteIndex, - weak_factory_.GetWeakPtr(), - base::Passed(std::move(cache_handle)), - std::move(callback))); + *cache_index_, + base::BindOnce(&CacheStorage::DeleteCacheDidWriteIndex, + weak_factory_.GetWeakPtr(), std::move(cache_handle), + std::move(callback))); } void CacheStorage::DeleteCacheDidWriteIndex( @@ -1000,11 +1000,11 @@ // Pass the cache handle along to the callback to keep the cache open until // match is done. CacheStorageCache* cache_ptr = cache_handle.value(); - cache_ptr->Match(std::move(request), match_params, - base::BindOnce(&CacheStorage::MatchCacheDidMatch, - weak_factory_.GetWeakPtr(), - base::Passed(std::move(cache_handle)), - std::move(callback))); + cache_ptr->Match( + std::move(request), match_params, + base::BindOnce(&CacheStorage::MatchCacheDidMatch, + weak_factory_.GetWeakPtr(), std::move(cache_handle), + std::move(callback))); } void CacheStorage::MatchCacheDidMatch( @@ -1027,8 +1027,7 @@ cache_index_->num_entries(), base::BindOnce(&CacheStorage::MatchAllCachesDidMatchAll, weak_factory_.GetWeakPtr(), - base::Passed(base::WrapUnique(match_responses)), - std::move(callback))); + base::WrapUnique(match_responses), std::move(callback))); size_t idx = 0; for (const auto& cache_metadata : cache_index_->ordered_cache_metadata()) { @@ -1039,8 +1038,7 @@ cache_ptr->Match( std::make_unique<ServiceWorkerFetchRequest>(*request), match_params, base::BindOnce(&CacheStorage::MatchAllCachesDidMatch, - weak_factory_.GetWeakPtr(), - base::Passed(std::move(cache_handle)), + weak_factory_.GetWeakPtr(), std::move(cache_handle), &match_responses->at(idx), barrier_closure)); idx++; } @@ -1161,19 +1159,17 @@ std::unique_ptr<int64_t> accumulator(new int64_t(0)); int64_t* accumulator_ptr = accumulator.get(); - base::RepeatingClosure barrier_closure = - base::BarrierClosure(cache_index_->num_entries() + doomed_caches_.size(), - base::BindOnce(&SizeRetrievedFromAllCaches, - base::Passed(std::move(accumulator)), - std::move(callback))); + base::RepeatingClosure barrier_closure = base::BarrierClosure( + cache_index_->num_entries() + doomed_caches_.size(), + base::BindOnce(&SizeRetrievedFromAllCaches, std::move(accumulator), + std::move(callback))); for (const auto& cache_metadata : cache_index_->ordered_cache_metadata()) { auto cache_handle = GetLoadedCache(cache_metadata.name); CacheStorageCache* cache = cache_handle.value(); cache->GetSizeThenClose(base::BindOnce( &CacheStorage::SizeRetrievedFromCache, weak_factory_.GetWeakPtr(), - base::Passed(std::move(cache_handle)), barrier_closure, - accumulator_ptr)); + std::move(cache_handle), barrier_closure, accumulator_ptr)); } for (const auto& cache_it : doomed_caches_) { @@ -1199,11 +1195,10 @@ std::unique_ptr<int64_t> accumulator(new int64_t(0)); int64_t* accumulator_ptr = accumulator.get(); - base::RepeatingClosure barrier_closure = - base::BarrierClosure(cache_index_->num_entries(), - base::BindOnce(&SizeRetrievedFromAllCaches, - base::Passed(std::move(accumulator)), - std::move(callback))); + base::RepeatingClosure barrier_closure = base::BarrierClosure( + cache_index_->num_entries(), + base::BindOnce(&SizeRetrievedFromAllCaches, std::move(accumulator), + std::move(callback))); for (const auto& cache_metadata : cache_index_->ordered_cache_metadata()) { if (cache_metadata.size != CacheStorage::kSizeUnknown) { @@ -1213,10 +1208,9 @@ } CacheStorageCacheHandle cache_handle = GetLoadedCache(cache_metadata.name); CacheStorageCache* cache = cache_handle.value(); - cache->Size(base::BindOnce(&CacheStorage::SizeRetrievedFromCache, - weak_factory_.GetWeakPtr(), - base::Passed(std::move(cache_handle)), - barrier_closure, accumulator_ptr)); + cache->Size(base::BindOnce( + &CacheStorage::SizeRetrievedFromCache, weak_factory_.GetWeakPtr(), + std::move(cache_handle), barrier_closure, accumulator_ptr)); } }
diff --git a/content/browser/cache_storage/cache_storage_cache.cc b/content/browser/cache_storage/cache_storage_cache.cc index 962cd79..f1fce06e 100644 --- a/content/browser/cache_storage/cache_storage_cache.cc +++ b/content/browser/cache_storage/cache_storage_cache.cc
@@ -474,7 +474,7 @@ scheduler_->ScheduleOperation(base::BindOnce( &CacheStorageCache::MatchImpl, weak_ptr_factory_.GetWeakPtr(), - base::Passed(std::move(request)), match_params, + std::move(request), match_params, scheduler_->WrapCallbackToRunNext(std::move(callback)))); } @@ -491,7 +491,7 @@ scheduler_->ScheduleOperation(base::BindOnce( &CacheStorageCache::MatchAllImpl, weak_ptr_factory_.GetWeakPtr(), - base::Passed(std::move(request)), match_params, + std::move(request), match_params, scheduler_->WrapCallbackToRunNext(std::move(callback)))); } @@ -681,7 +681,7 @@ scheduler_->ScheduleOperation(base::BindOnce( &CacheStorageCache::KeysImpl, weak_ptr_factory_.GetWeakPtr(), - base::Passed(std::move(request)), options, + std::move(request), options, scheduler_->WrapCallbackToRunNext(std::move(callback)))); } @@ -801,10 +801,9 @@ // URL. disk_cache::Entry** entry_ptr = &query_cache_context->enumerated_entry; net::CompletionCallback open_entry_callback = - base::AdaptCallbackForRepeating( - base::BindOnce(&CacheStorageCache::QueryCacheDidOpenFastPath, - weak_ptr_factory_.GetWeakPtr(), - base::Passed(std::move(query_cache_context)))); + base::AdaptCallbackForRepeating(base::BindOnce( + &CacheStorageCache::QueryCacheDidOpenFastPath, + weak_ptr_factory_.GetWeakPtr(), std::move(query_cache_context))); int rv = backend_->OpenEntry(request_ptr->url.spec(), entry_ptr, open_entry_callback); if (rv != net::ERR_IO_PENDING) @@ -847,10 +846,10 @@ disk_cache::Backend::Iterator& iterator = *query_cache_context->backend_iterator; disk_cache::Entry** enumerated_entry = &query_cache_context->enumerated_entry; - net::CompletionCallback open_entry_callback = base::AdaptCallbackForRepeating( - base::BindOnce(&CacheStorageCache::QueryCacheFilterEntry, - weak_ptr_factory_.GetWeakPtr(), - base::Passed(std::move(query_cache_context)))); + net::CompletionCallback open_entry_callback = + base::AdaptCallbackForRepeating(base::BindOnce( + &CacheStorageCache::QueryCacheFilterEntry, + weak_ptr_factory_.GetWeakPtr(), std::move(query_cache_context))); int rv = iterator.OpenNextEntry(enumerated_entry, open_entry_callback); @@ -902,11 +901,11 @@ } disk_cache::Entry* entry_ptr = entry.get(); - ReadMetadata(entry_ptr, - base::BindOnce(&CacheStorageCache::QueryCacheDidReadMetadata, - weak_ptr_factory_.GetWeakPtr(), - base::Passed(std::move(query_cache_context)), - base::Passed(std::move(entry)))); + ReadMetadata( + entry_ptr, + base::BindOnce(&CacheStorageCache::QueryCacheDidReadMetadata, + weak_ptr_factory_.GetWeakPtr(), + std::move(query_cache_context), std::move(entry))); } void CacheStorageCache::QueryCacheDidReadMetadata( @@ -1130,7 +1129,7 @@ base::BindOnce(&CacheStorageCache::WriteSideDataDidOpenEntry, weak_ptr_factory_.GetWeakPtr(), std::move(callback), expected_response_time, buffer, buf_len, - base::Passed(std::move(scoped_entry_ptr)))); + std::move(scoped_entry_ptr))); int rv = backend_->OpenEntry(url.spec(), entry_ptr, open_entry_callback); if (rv != net::ERR_IO_PENDING) @@ -1154,7 +1153,7 @@ base::BindOnce(&CacheStorageCache::WriteSideDataDidReadMetaData, weak_ptr_factory_.GetWeakPtr(), std::move(callback), expected_response_time, - buffer, buf_len, base::Passed(std::move(entry)))); + buffer, buf_len, std::move(entry))); } void CacheStorageCache::WriteSideDataDidReadMetaData( @@ -1181,11 +1180,10 @@ side_data_size_before_write = entry->GetDataSize(INDEX_SIDE_DATA); net::CompletionCallback write_side_data_callback = - base::AdaptCallbackForRepeating( - base::BindOnce(&CacheStorageCache::WriteSideDataDidWrite, - weak_ptr_factory_.GetWeakPtr(), std::move(callback), - base::Passed(std::move(entry)), buf_len, - std::move(response), side_data_size_before_write)); + base::AdaptCallbackForRepeating(base::BindOnce( + &CacheStorageCache::WriteSideDataDidWrite, + weak_ptr_factory_.GetWeakPtr(), std::move(callback), std::move(entry), + buf_len, std::move(response), side_data_size_before_write)); int rv = temp_entry_ptr->WriteData( INDEX_SIDE_DATA, 0 /* offset */, buffer.get(), buf_len, @@ -1255,9 +1253,9 @@ std::move(side_data_blob), scheduler_->WrapCallbackToRunNext(std::move(callback))); - scheduler_->ScheduleOperation(base::BindOnce( - &CacheStorageCache::PutImpl, weak_ptr_factory_.GetWeakPtr(), - base::Passed(std::move(put_context)))); + scheduler_->ScheduleOperation(base::BindOnce(&CacheStorageCache::PutImpl, + weak_ptr_factory_.GetWeakPtr(), + std::move(put_context))); } void CacheStorageCache::PutImpl(std::unique_ptr<PutContext> put_context) { @@ -1279,10 +1277,10 @@ CacheStorageCacheQueryParams query_options; query_options.ignore_method = true; query_options.ignore_vary = true; - DeleteImpl(std::move(delete_request), query_options, - base::BindOnce(&CacheStorageCache::PutDidDeleteEntry, - weak_ptr_factory_.GetWeakPtr(), - base::Passed(std::move(put_context)))); + DeleteImpl( + std::move(delete_request), query_options, + base::BindOnce(&CacheStorageCache::PutDidDeleteEntry, + weak_ptr_factory_.GetWeakPtr(), std::move(put_context))); } void CacheStorageCache::PutDidDeleteEntry( @@ -1308,8 +1306,7 @@ net::CompletionCallback create_entry_callback = base::AdaptCallbackForRepeating(base::BindOnce( &CacheStorageCache::PutDidCreateEntry, weak_ptr_factory_.GetWeakPtr(), - base::Passed(std::move(scoped_entry_ptr)), - base::Passed(std::move(put_context)))); + std::move(scoped_entry_ptr), std::move(put_context))); int rv = backend_ptr->CreateEntry(request_ptr->url.spec(), entry_ptr, create_entry_callback); @@ -1379,8 +1376,8 @@ net::CompletionCallback write_headers_callback = base::AdaptCallbackForRepeating( base::BindOnce(&CacheStorageCache::PutDidWriteHeaders, - weak_ptr_factory_.GetWeakPtr(), - base::Passed(std::move(put_context)), buffer->size())); + weak_ptr_factory_.GetWeakPtr(), std::move(put_context), + buffer->size())); rv = temp_entry_ptr->WriteData(INDEX_HEADERS, 0 /* offset */, buffer.get(), buffer->size(), write_headers_callback, @@ -1440,8 +1437,8 @@ blob_to_cache_raw->StreamBlobToCache( std::move(entry), disk_cache_body_index, std::move(blob), base::BindOnce(&CacheStorageCache::PutDidWriteBlobToCache, - weak_ptr_factory_.GetWeakPtr(), - base::Passed(std::move(put_context)), blob_to_cache_key)); + weak_ptr_factory_.GetWeakPtr(), std::move(put_context), + blob_to_cache_key)); } void CacheStorageCache::PutDidWriteBlobToCache( @@ -1532,8 +1529,8 @@ // completes and runs its callback. CalculateCacheSize(base::AdaptCallbackForRepeating( base::BindOnce(&CacheStorageCache::UpdateCacheSizeGotSize, - weak_ptr_factory_.GetWeakPtr(), - base::Passed(CreateCacheHandle()), std::move(callback)))); + weak_ptr_factory_.GetWeakPtr(), CreateCacheHandle(), + std::move(callback)))); } void CacheStorageCache::UpdateCacheSizeGotSize( @@ -1572,7 +1569,7 @@ scheduler_->ScheduleOperation(base::BindOnce( &CacheStorageCache::DeleteImpl, weak_ptr_factory_.GetWeakPtr(), - base::Passed(std::move(request)), operation.match_params, + std::move(request), operation.match_params, scheduler_->WrapCallbackToRunNext(std::move(callback)))); } @@ -1705,7 +1702,7 @@ base::AdaptCallbackForRepeating( base::BindOnce(&CacheStorageCache::CreateBackendDidCreate, weak_ptr_factory_.GetWeakPtr(), std::move(callback), - base::Passed(std::move(backend_ptr)))); + std::move(backend_ptr))); int rv = disk_cache::CreateCacheBackend( cache_type, net::CACHE_BACKEND_SIMPLE, path_, kMaxCacheBytes,
diff --git a/content/browser/cache_storage/cache_storage_dispatcher_host.cc b/content/browser/cache_storage/cache_storage_dispatcher_host.cc index a7f7761..6a2bf56 100644 --- a/content/browser/cache_storage/cache_storage_dispatcher_host.cc +++ b/content/browser/cache_storage/cache_storage_dispatcher_host.cc
@@ -211,10 +211,9 @@ new ServiceWorkerFetchRequest(request.url, request.method, request.headers, request.referrer, request.is_reload)); - cache->Match( - std::move(scoped_request), match_params, - base::BindOnce(&CacheStorageDispatcherHost::OnCacheMatchCallback, this, - thread_id, request_id, base::Passed(it->second.Clone()))); + cache->Match(std::move(scoped_request), match_params, + base::BindOnce(&CacheStorageDispatcherHost::OnCacheMatchCallback, + this, thread_id, request_id, it->second.Clone())); } void CacheStorageDispatcherHost::OnCacheMatchAll( @@ -235,8 +234,7 @@ cache->MatchAll( std::unique_ptr<ServiceWorkerFetchRequest>(), match_params, base::BindOnce(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, - this, thread_id, request_id, - base::Passed(it->second.Clone()))); + this, thread_id, request_id, it->second.Clone())); return; } @@ -248,15 +246,13 @@ cache->MatchAll( std::move(scoped_request), match_params, base::BindOnce(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, - this, thread_id, request_id, - base::Passed(it->second.Clone()))); + this, thread_id, request_id, it->second.Clone())); return; } - cache->Match( - std::move(scoped_request), match_params, - base::BindOnce( - &CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter, this, - thread_id, request_id, base::Passed(it->second.Clone()))); + cache->Match(std::move(scoped_request), match_params, + base::BindOnce( + &CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter, + this, thread_id, request_id, it->second.Clone())); } void CacheStorageDispatcherHost::OnCacheKeys( @@ -277,10 +273,9 @@ new ServiceWorkerFetchRequest(request.url, request.method, request.headers, request.referrer, request.is_reload)); - cache->Keys( - std::move(request_ptr), match_params, - base::BindOnce(&CacheStorageDispatcherHost::OnCacheKeysCallback, this, - thread_id, request_id, base::Passed(it->second.Clone()))); + cache->Keys(std::move(request_ptr), match_params, + base::BindOnce(&CacheStorageDispatcherHost::OnCacheKeysCallback, + this, thread_id, request_id, it->second.Clone())); } void CacheStorageDispatcherHost::OnCacheBatch( @@ -299,7 +294,7 @@ cache->BatchOperation( operations, base::BindOnce(&CacheStorageDispatcherHost::OnCacheBatchCallback, this, - thread_id, request_id, base::Passed(it->second.Clone())), + thread_id, request_id, it->second.Clone()), base::BindOnce(&CacheStorageDispatcherHost::OnBadMessage, this)); } @@ -343,8 +338,7 @@ // Hang on to the cache for a few seconds. This way if the user quickly closes // and reopens it the cache backend won't have to be reinitialized. base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, - base::BindOnce(&StopPreservingCache, base::Passed(cache_handle.Clone())), + FROM_HERE, base::BindOnce(&StopPreservingCache, cache_handle.Clone()), base::TimeDelta::FromSeconds(kCachePreservationSeconds)); CacheID cache_id = StoreCacheReference(std::move(cache_handle));
diff --git a/content/browser/cache_storage/cache_storage_manager.cc b/content/browser/cache_storage/cache_storage_manager.cc index 1a5c76f..c80659b 100644 --- a/content/browser/cache_storage/cache_storage_manager.cc +++ b/content/browser/cache_storage/cache_storage_manager.cc
@@ -299,8 +299,8 @@ base::BindOnce(&ListOriginsAndLastModifiedOnTaskRunner, usages_ptr, root_path_), base::BindOnce(&CacheStorageManager::GetAllOriginsUsageGetSizes, - weak_ptr_factory_.GetWeakPtr(), - base::Passed(std::move(usages)), callback)); + weak_ptr_factory_.GetWeakPtr(), std::move(usages), + callback)); } void CacheStorageManager::GetAllOriginsUsageGetSizes( @@ -321,8 +321,7 @@ base::RepeatingClosure barrier_closure = base::BarrierClosure( usages_ptr->size(), - base::BindOnce(&AllOriginSizesReported, base::Passed(std::move(usages)), - callback)); + base::BindOnce(&AllOriginSizesReported, std::move(usages), callback)); for (CacheStorageUsageInfo& usage : *usages_ptr) { if (usage.total_size_bytes != CacheStorage::kSizeUnknown) { @@ -404,7 +403,7 @@ cache_storage->GetSizeThenCloseAllCaches( base::BindOnce(&CacheStorageManager::DeleteOriginDidClose, weak_ptr_factory_.GetWeakPtr(), origin, callback, - base::Passed(base::WrapUnique(cache_storage)))); + base::WrapUnique(cache_storage))); } void CacheStorageManager::DeleteOriginData(const url::Origin& origin) {
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc index 4e65368d..c924922 100644 --- a/content/browser/child_process_launcher.cc +++ b/content/browser/child_process_launcher.cc
@@ -66,7 +66,7 @@ BrowserThread::PROCESS_LAUNCHER, FROM_HERE, base::BindOnce( &ChildProcessLauncherHelper::SetProcessPriorityOnLauncherThread, - helper_, base::Passed(&to_pass), priority)); + helper_, std::move(to_pass), priority)); } void ChildProcessLauncher::Notify(
diff --git a/content/browser/child_process_launcher_helper.cc b/content/browser/child_process_launcher_helper.cc index eec7bc0..7ee3df4 100644 --- a/content/browser/child_process_launcher_helper.cc +++ b/content/browser/child_process_launcher_helper.cc
@@ -146,7 +146,7 @@ BrowserThread::PostTask( client_thread_id_, FROM_HERE, base::BindOnce(&ChildProcessLauncherHelper::PostLaunchOnClientThread, - this, base::Passed(&process), launch_result)); + this, std::move(process), launch_result)); } void ChildProcessLauncherHelper::PostLaunchOnClientThread( @@ -177,7 +177,7 @@ BrowserThread::PROCESS_LAUNCHER, FROM_HERE, base::BindOnce( &ChildProcessLauncherHelper::ForceNormalProcessTerminationSync, - base::Passed(&process))); + std::move(process))); } } // namespace internal
diff --git a/content/browser/devtools/devtools_interceptor_controller.cc b/content/browser/devtools/devtools_interceptor_controller.cc index 758353a..77de8fe 100644 --- a/content/browser/devtools/devtools_interceptor_controller.cc +++ b/content/browser/devtools/devtools_interceptor_controller.cc
@@ -50,9 +50,8 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&DevToolsNetworkInterceptor::ContinueInterceptedRequest, - interceptor_, interception_id, - base::Passed(std::move(modifications)), - base::Passed(std::move(callback)))); + interceptor_, interception_id, std::move(modifications), + std::move(callback))); } bool DevToolsInterceptorController::ShouldCancelNavigation(
diff --git a/content/browser/devtools/devtools_url_interceptor_request_job.cc b/content/browser/devtools/devtools_url_interceptor_request_job.cc index b35173e6..8babf02 100644 --- a/content/browser/devtools/devtools_url_interceptor_request_job.cc +++ b/content/browser/devtools/devtools_url_interceptor_request_job.cc
@@ -907,7 +907,7 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&ContinueInterceptedRequestCallback::sendFailure, - base::Passed(std::move(callback)), + std::move(callback), protocol::Response::InvalidParams( "Response already processed."))); break; @@ -919,7 +919,7 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&ContinueInterceptedRequestCallback::sendFailure, - base::Passed(std::move(callback)), + std::move(callback), protocol::Response::InvalidParams( "authChallengeResponse not expected."))); break; @@ -928,7 +928,7 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&ContinueInterceptedRequestCallback::sendSuccess, - base::Passed(std::move(callback)))); + std::move(callback))); break; case WaitingForUserResponse::WAITING_FOR_AUTH_ACK: @@ -936,7 +936,7 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&ContinueInterceptedRequestCallback::sendFailure, - base::Passed(std::move(callback)), + std::move(callback), protocol::Response::InvalidParams( "authChallengeResponse required."))); break; @@ -945,12 +945,12 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&ContinueInterceptedRequestCallback::sendSuccess, - base::Passed(std::move(callback)))); + std::move(callback))); } else { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&ContinueInterceptedRequestCallback::sendFailure, - base::Passed(std::move(callback)), + std::move(callback), protocol::Response::InvalidParams( "Unrecognized authChallengeResponse."))); }
diff --git a/content/browser/devtools/devtools_url_request_interceptor.cc b/content/browser/devtools/devtools_url_request_interceptor.cc index 553aa26..3f361e8e 100644 --- a/content/browser/devtools/devtools_url_request_interceptor.cc +++ b/content/browser/devtools/devtools_url_request_interceptor.cc
@@ -77,7 +77,7 @@ BrowserThread::UI, FROM_HERE, base::BindOnce( &ContinueInterceptedRequestCallback::sendFailure, - base::Passed(std::move(callback)), + std::move(callback), protocol::Response::InvalidParams("Invalid InterceptionId."))); return; }
diff --git a/content/browser/devtools/protocol/input_handler.cc b/content/browser/devtools/protocol/input_handler.cc index 92c7089..6e18796 100644 --- a/content/browser/devtools/protocol/input_handler.cc +++ b/content/browser/devtools/protocol/input_handler.cc
@@ -773,8 +773,7 @@ host_->GetRenderWidgetHost()->QueueSyntheticGesture( SyntheticGesture::Create(gesture_params), - base::BindOnce(&SendSynthesizePinchGestureResponse, - base::Passed(std::move(callback)))); + base::BindOnce(&SendSynthesizePinchGestureResponse, std::move(callback))); } void InputHandler::SynthesizeScrollGesture( @@ -854,7 +853,7 @@ base::BindOnce(&InputHandler::OnScrollFinished, weak_factory_.GetWeakPtr(), gesture_params, repeat_count, repeat_delay, interaction_marker_name, id, - base::Passed(std::move(callback)))); + std::move(callback))); } void InputHandler::OnScrollFinished( @@ -876,7 +875,7 @@ base::BindOnce(&InputHandler::SynthesizeRepeatingScroll, weak_factory_.GetWeakPtr(), gesture_params, repeat_count - 1, repeat_delay, interaction_marker_name, - id, base::Passed(std::move(callback))), + id, std::move(callback)), repeat_delay); } else { SendSynthesizeScrollGestureResponse(std::move(callback), result);
diff --git a/content/browser/devtools/protocol/io_handler.cc b/content/browser/devtools/protocol/io_handler.cc index e01d5f29..76e77fe 100644 --- a/content/browser/devtools/protocol/io_handler.cc +++ b/content/browser/devtools/protocol/io_handler.cc
@@ -71,10 +71,9 @@ callback->sendFailure(Response::InvalidParams("Invalid stream handle")); return; } - stream->Read( - offset.fromMaybe(-1), max_size.fromMaybe(kDefaultChunkSize), - base::BindOnce(&IOHandler::ReadComplete, weak_factory_.GetWeakPtr(), - base::Passed(std::move(callback)))); + stream->Read(offset.fromMaybe(-1), max_size.fromMaybe(kDefaultChunkSize), + base::BindOnce(&IOHandler::ReadComplete, + weak_factory_.GetWeakPtr(), std::move(callback))); } void IOHandler::ReadComplete(std::unique_ptr<ReadCallback> callback,
diff --git a/content/browser/devtools/protocol/network_handler.cc b/content/browser/devtools/protocol/network_handler.cc index d7584e4..1564569e 100644 --- a/content/browser/devtools/protocol/network_handler.cc +++ b/content/browser/devtools/protocol/network_handler.cc
@@ -208,7 +208,7 @@ net::URLRequestContext* request_context = context_getter->GetURLRequestContext(); request_context->cookie_store()->DeleteAllAsync( - base::BindOnce(&ClearedCookiesOnIO, base::Passed(std::move(callback)))); + base::BindOnce(&ClearedCookiesOnIO, std::move(callback))); } void DeletedCookiesOnIO(base::OnceClosure callback, uint32_t num_deleted) {
diff --git a/content/browser/devtools/protocol/storage_handler.cc b/content/browser/devtools/protocol/storage_handler.cc index 29eb1b7..9db0af5 100644 --- a/content/browser/devtools/protocol/storage_handler.cc +++ b/content/browser/devtools/protocol/storage_handler.cc
@@ -77,9 +77,8 @@ DCHECK_CURRENTLY_ON(BrowserThread::IO); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::BindOnce(ReportUsageAndQuotaDataOnUIThread, - base::Passed(std::move(callback)), code, usage, quota, - std::move(usage_breakdown))); + base::BindOnce(ReportUsageAndQuotaDataOnUIThread, std::move(callback), + code, usage, quota, std::move(usage_breakdown))); } void GetUsageAndQuotaOnIOThread( @@ -334,7 +333,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&GetUsageAndQuotaOnIOThread, base::RetainedRef(manager), - origin_url, base::Passed(std::move(callback)))); + origin_url, std::move(callback))); } Response StorageHandler::TrackCacheStorageForOrigin(const std::string& origin) {
diff --git a/content/browser/devtools/protocol/tethering_handler.cc b/content/browser/devtools/protocol/tethering_handler.cc index 264599f..494aea4d 100644 --- a/content/browser/devtools/protocol/tethering_handler.cc +++ b/content/browser/devtools/protocol/tethering_handler.cc
@@ -287,8 +287,7 @@ if (bound_sockets_.find(port) != bound_sockets_.end()) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::BindOnce(&BindCallback::sendFailure, - base::Passed(std::move(callback)), + base::BindOnce(&BindCallback::sendFailure, std::move(callback), Response::Error("Port already bound"))); return; } @@ -300,16 +299,15 @@ if (!bound_socket->Listen(port)) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::BindOnce(&BindCallback::sendFailure, - base::Passed(std::move(callback)), + base::BindOnce(&BindCallback::sendFailure, std::move(callback), Response::Error("Could not bind port"))); return; } bound_sockets_[port] = std::move(bound_socket); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::BindOnce(&BindCallback::sendSuccess, - base::Passed(std::move(callback)))); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::BindOnce(&BindCallback::sendSuccess, std::move(callback))); } void TetheringHandler::TetheringImpl::Unbind( @@ -318,16 +316,15 @@ if (it == bound_sockets_.end()) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::BindOnce(&UnbindCallback::sendFailure, - base::Passed(std::move(callback)), + base::BindOnce(&UnbindCallback::sendFailure, std::move(callback), Response::InvalidParams("Port is not bound"))); return; } bound_sockets_.erase(it); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::BindOnce(&UnbindCallback::sendSuccess, - base::Passed(std::move(callback)))); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::BindOnce(&UnbindCallback::sendSuccess, std::move(callback))); } void TetheringHandler::TetheringImpl::Accepted(uint16_t port, @@ -395,7 +392,7 @@ DCHECK(impl_); task_runner_->PostTask( FROM_HERE, base::BindOnce(&TetheringImpl::Bind, base::Unretained(impl_), - port, base::Passed(std::move(callback)))); + port, std::move(callback))); } void TetheringHandler::Unbind( @@ -409,7 +406,7 @@ DCHECK(impl_); task_runner_->PostTask( FROM_HERE, base::BindOnce(&TetheringImpl::Unbind, base::Unretained(impl_), - port, base::Passed(std::move(callback)))); + port, std::move(callback))); } } // namespace protocol
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.cc b/content/browser/devtools/render_frame_devtools_agent_host.cc index b0268046..08862bea 100644 --- a/content/browser/devtools/render_frame_devtools_agent_host.cc +++ b/content/browser/devtools/render_frame_devtools_agent_host.cc
@@ -814,7 +814,7 @@ BrowserThread::UI, FROM_HERE, base::BindOnce( &RenderFrameDevToolsAgentHost::SynchronousSwapCompositorFrame, - dtah.get(), base::Passed(std::move(frame_metadata)))); + dtah.get(), std::move(frame_metadata))); } }
diff --git a/content/browser/dom_storage/local_storage_context_mojo.cc b/content/browser/dom_storage/local_storage_context_mojo.cc index 3eb14b2..0080b99e 100644 --- a/content/browser/dom_storage/local_storage_context_mojo.cc +++ b/content/browser/dom_storage/local_storage_context_mojo.cc
@@ -104,7 +104,7 @@ LocalStorageContextMojo::MigrateString(it.second.string()); } reply_task_runner->PostTask(FROM_HERE, - base::BindOnce(callback, base::Passed(&values))); + base::BindOnce(callback, std::move(values))); } // Helper to convert from OnceCallback to Callback. @@ -919,7 +919,7 @@ database_->GetPrefixed( std::vector<uint8_t>(kMetaPrefix, kMetaPrefix + arraysize(kMetaPrefix)), base::BindOnce(&LocalStorageContextMojo::OnGotMetaData, - weak_ptr_factory_.GetWeakPtr(), base::Passed(&callback))); + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } void LocalStorageContextMojo::OnGotMetaData(
diff --git a/content/browser/download/download_file_impl.cc b/content/browser/download/download_file_impl.cc index cc325f66..4041ffc6 100644 --- a/content/browser/download/download_file_impl.cc +++ b/content/browser/download/download_file_impl.cc
@@ -467,8 +467,7 @@ base::SequencedTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::BindOnce(&DownloadFileImpl::RenameWithRetryInternal, - weak_factory_.GetWeakPtr(), - base::Passed(std::move(parameters))), + weak_factory_.GetWeakPtr(), std::move(parameters)), GetRetryDelayForFailedRename(attempt_number)); return; } @@ -715,7 +714,7 @@ BrowserThread::UI, FROM_HERE, base::BindOnce(&DownloadDestinationObserver::DestinationCompleted, observer_, TotalBytesReceived(), - base::Passed(&hash_state))); + std::move(hash_state))); } } } @@ -851,7 +850,7 @@ BrowserThread::UI, FROM_HERE, base::BindOnce(&DownloadDestinationObserver::DestinationError, observer_, reason, TotalBytesReceived(), - base::Passed(&hash_state))); + std::move(hash_state))); } }
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc index 41383cc..d9fd2b4f 100644 --- a/content/browser/download/download_item_impl.cc +++ b/content/browser/download/download_item_impl.cc
@@ -2075,7 +2075,7 @@ GetDownloadTaskRunner()->PostTask( FROM_HERE, // Will be deleted at end of task execution. - base::BindOnce(&DownloadFileCancel, base::Passed(&download_file_))); + base::BindOnce(&DownloadFileCancel, std::move(download_file_))); // Avoid attempting to reuse the intermediate file by clearing out // current_path_ and received slices. destination_info_.current_path.clear(); @@ -2084,7 +2084,7 @@ GetDownloadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(base::IgnoreResult(&DownloadFileDetach), // Will be deleted at end of task execution. - base::Passed(&download_file_))); + std::move(download_file_))); } // Don't accept any more messages from the DownloadFile, and null // out any previous "all data received". This also breaks links to
diff --git a/content/browser/download/download_resource_handler.cc b/content/browser/download/download_resource_handler.cc index 25e33a5..e0708f0 100644 --- a/content/browser/download/download_resource_handler.cc +++ b/content/browser/download/download_resource_handler.cc
@@ -139,7 +139,7 @@ if (tab_info_) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::BindOnce(&DeleteOnUIThread, base::Passed(&tab_info_))); + base::BindOnce(&DeleteOnUIThread, std::move(tab_info_))); } } @@ -274,8 +274,8 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::BindOnce(&StartOnUIThread, base::Passed(&create_info), - base::Passed(&tab_info_), base::Passed(&stream_reader), + base::BindOnce(&StartOnUIThread, std::move(create_info), + std::move(tab_info_), std::move(stream_reader), render_process_id, render_frame_id, request_info->frame_tree_node_id(), callback)); }
diff --git a/content/browser/download/drag_download_file.cc b/content/browser/download/drag_download_file.cc index 0d4bc59..5835d33 100644 --- a/content/browser/download/drag_download_file.cc +++ b/content/browser/download/drag_download_file.cc
@@ -231,10 +231,10 @@ observer_ = observer; DCHECK(observer_.get()); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::BindOnce(&DragDownloadFileUI::InitiateDownload, - base::Unretained(drag_ui_), - base::Passed(&file_), file_path_)); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::BindOnce(&DragDownloadFileUI::InitiateDownload, + base::Unretained(drag_ui_), std::move(file_), file_path_)); } bool DragDownloadFile::Wait() {
diff --git a/content/browser/frame_host/interstitial_page_impl_browsertest.cc b/content/browser/frame_host/interstitial_page_impl_browsertest.cc index 6acaeca..7e2eaff 100644 --- a/content/browser/frame_host/interstitial_page_impl_browsertest.cc +++ b/content/browser/frame_host/interstitial_page_impl_browsertest.cc
@@ -21,7 +21,7 @@ #include "content/public/test/test_utils.h" #include "content/shell/browser/shell.h" #include "ipc/message_filter.h" -#include "third_party/WebKit/common/clipboard/clipboard.mojom.h" +#include "third_party/WebKit/public/mojom/clipboard/clipboard.mojom.h" #include "ui/base/clipboard/clipboard_monitor.h" #include "ui/base/clipboard/clipboard_observer.h"
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 79f3bf6..4fe8031 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -51,7 +51,7 @@ #include "content/browser/installedapp/installed_app_provider_impl_default.h" #include "content/browser/interface_provider_filtering.h" #include "content/browser/keyboard_lock/keyboard_lock_service_impl.h" -#include "content/browser/loader/prefetch_url_loader_factory.h" +#include "content/browser/loader/prefetch_url_loader_service.h" #include "content/browser/loader/resource_dispatcher_host_impl.h" #include "content/browser/loader/resource_scheduler_filter.h" #include "content/browser/media/capture/audio_mirroring_manager.h" @@ -346,7 +346,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&NotifyRouteChangesOnIO, frame_callback, - base::Passed(std::move(routing_ids)))); + std::move(routing_ids))); } void LookupRenderFrameHostOrProxy(int process_id, @@ -3237,9 +3237,17 @@ StoragePartitionImpl* storage_partition = static_cast<StoragePartitionImpl*>(BrowserContext::GetStoragePartition( GetSiteInstance()->GetBrowserContext(), GetSiteInstance())); - registry_->AddInterface(base::BindRepeating( - &PrefetchURLLoaderFactory::ConnectToService, - base::RetainedRef(storage_partition->GetPrefetchURLLoaderFactory()))); + // TODO(https://crbug.com/813479): Investigate why we need to explicitly + // specify task runner for BrowserThread::IO here. + // Bind calls to the BindRegistry should come on to the IO thread by + // default, but it looks we need this in browser tests (but not in full + // chrome build), i.e. in content/browser/loader/prefetch_browsertest.cc. + registry_->AddInterface( + base::BindRepeating( + &PrefetchURLLoaderService::ConnectToService, + base::RetainedRef(storage_partition->GetPrefetchURLLoaderService()), + frame_tree_node_->frame_tree_node_id()), + BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); } } @@ -4328,7 +4336,8 @@ AudioMirroringManager::GetInstance(), browser_main_loop->user_input_monitor(), GetProcess()->GetID(), GetRoutingID()), - browser_main_loop->media_stream_manager(), std::move(request)); + browser_main_loop->media_stream_manager(), GetProcess()->GetID(), + GetRoutingID(), std::move(request)); } void RenderFrameHostImpl::CreateAudioOutputStreamFactory(
diff --git a/content/browser/frame_host/render_frame_message_filter.cc b/content/browser/frame_host/render_frame_message_filter.cc index ff015217c..ae9700c6 100644 --- a/content/browser/frame_host/render_frame_message_filter.cc +++ b/content/browser/frame_host/render_frame_message_filter.cc
@@ -527,7 +527,7 @@ url, options, base::BindOnce(&RenderFrameMessageFilter::CheckPolicyForCookies, this, render_frame_id, url, site_for_cookies, - base::Passed(&callback))); + std::move(callback))); return; } @@ -540,7 +540,7 @@ url, options, base::BindOnce(&RenderFrameMessageFilter::CheckPolicyForCookies, this, render_frame_id, url, site_for_cookies, - base::Passed(&callback))); + std::move(callback))); } #if BUILDFLAG(ENABLE_PLUGINS)
diff --git a/content/browser/generic_sensor/sensor_provider_proxy_impl.cc b/content/browser/generic_sensor/sensor_provider_proxy_impl.cc index 6e40657e..6c7b9318 100644 --- a/content/browser/generic_sensor/sensor_provider_proxy_impl.cc +++ b/content/browser/generic_sensor/sensor_provider_proxy_impl.cc
@@ -17,7 +17,7 @@ #include "mojo/public/cpp/bindings/strong_binding.h" #include "services/device/public/interfaces/constants.mojom.h" #include "services/service_manager/public/cpp/connector.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom.h" using device::mojom::SensorType;
diff --git a/content/browser/geolocation/geolocation_service_impl.cc b/content/browser/geolocation/geolocation_service_impl.cc index cf811230..0663e79 100644 --- a/content/browser/geolocation/geolocation_service_impl.cc +++ b/content/browser/geolocation/geolocation_service_impl.cc
@@ -8,7 +8,7 @@ #include "content/public/browser/permission_type.h" #include "content/public/browser/render_frame_host.h" #include "content/public/common/content_features.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom.h" namespace content {
diff --git a/content/browser/geolocation/geolocation_service_impl_unittest.cc b/content/browser/geolocation/geolocation_service_impl_unittest.cc index 9e2006f..45f6644 100644 --- a/content/browser/geolocation/geolocation_service_impl_unittest.cc +++ b/content/browser/geolocation/geolocation_service_impl_unittest.cc
@@ -17,7 +17,7 @@ #include "services/device/public/interfaces/geoposition.mojom.h" #include "services/service_manager/public/cpp/bind_source_info.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom.h" using base::test::ScopedFeatureList; using blink::mojom::PermissionStatus;
diff --git a/content/browser/indexed_db/cursor_impl.cc b/content/browser/indexed_db/cursor_impl.cc index 21e361d..281ff4b 100644 --- a/content/browser/indexed_db/cursor_impl.cc +++ b/content/browser/indexed_db/cursor_impl.cc
@@ -50,10 +50,9 @@ scoped_refptr<IndexedDBCallbacks> callbacks( new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_, std::move(callbacks_info), idb_runner_)); - idb_runner_->PostTask( - FROM_HERE, - base::BindOnce(&IDBSequenceHelper::Advance, base::Unretained(helper_), - count, base::Passed(&callbacks))); + idb_runner_->PostTask(FROM_HERE, base::BindOnce(&IDBSequenceHelper::Advance, + base::Unretained(helper_), + count, std::move(callbacks))); } void CursorImpl::Continue( @@ -66,7 +65,7 @@ idb_runner_->PostTask( FROM_HERE, base::BindOnce(&IDBSequenceHelper::Continue, base::Unretained(helper_), - key, primary_key, base::Passed(&callbacks))); + key, primary_key, std::move(callbacks))); } void CursorImpl::Prefetch( @@ -75,10 +74,9 @@ scoped_refptr<IndexedDBCallbacks> callbacks( new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_, std::move(callbacks_info), idb_runner_)); - idb_runner_->PostTask( - FROM_HERE, - base::BindOnce(&IDBSequenceHelper::Prefetch, base::Unretained(helper_), - count, base::Passed(&callbacks))); + idb_runner_->PostTask(FROM_HERE, base::BindOnce(&IDBSequenceHelper::Prefetch, + base::Unretained(helper_), + count, std::move(callbacks))); } void CursorImpl::PrefetchReset(int32_t used_prefetches,
diff --git a/content/browser/indexed_db/database_impl.cc b/content/browser/indexed_db/database_impl.cc index 04b5df52..01ee21d 100644 --- a/content/browser/indexed_db/database_impl.cc +++ b/content/browser/indexed_db/database_impl.cc
@@ -245,7 +245,7 @@ FROM_HERE, base::BindOnce(&IDBSequenceHelper::Get, base::Unretained(helper_), transaction_id, object_store_id, index_id, key_range, - key_only, base::Passed(&callbacks))); + key_only, std::move(callbacks))); } void DatabaseImpl::GetAll( @@ -263,7 +263,7 @@ FROM_HERE, base::BindOnce(&IDBSequenceHelper::GetAll, base::Unretained(helper_), transaction_id, object_store_id, index_id, key_range, - key_only, max_count, base::Passed(&callbacks))); + key_only, max_count, std::move(callbacks))); } void DatabaseImpl::Put( @@ -303,7 +303,7 @@ idb_runner_->PostTask( FROM_HERE, base::BindOnce(&IDBSequenceHelper::AbortWithError, base::Unretained(helper_), transaction_id, - base::Passed(&callbacks), error)); + std::move(callbacks), error)); return; } uint64_t size = handle->size(); @@ -339,9 +339,9 @@ idb_runner_->PostTask( FROM_HERE, base::BindOnce(&IDBSequenceHelper::Put, base::Unretained(helper_), - transaction_id, object_store_id, base::Passed(&value), - base::Passed(&handles), base::Passed(&blob_info), key, - mode, index_keys, base::Passed(&callbacks))); + transaction_id, object_store_id, std::move(value), + std::move(handles), std::move(blob_info), key, mode, + index_keys, std::move(callbacks))); } void DatabaseImpl::SetIndexKeys( @@ -380,7 +380,7 @@ FROM_HERE, base::BindOnce(&IDBSequenceHelper::OpenCursor, base::Unretained(helper_), transaction_id, object_store_id, index_id, key_range, - direction, key_only, task_type, base::Passed(&callbacks))); + direction, key_only, task_type, std::move(callbacks))); } void DatabaseImpl::Count( @@ -396,7 +396,7 @@ FROM_HERE, base::BindOnce(&IDBSequenceHelper::Count, base::Unretained(helper_), transaction_id, object_store_id, index_id, key_range, - base::Passed(&callbacks))); + std::move(callbacks))); } void DatabaseImpl::DeleteRange( @@ -411,7 +411,7 @@ FROM_HERE, base::BindOnce(&IDBSequenceHelper::DeleteRange, base::Unretained(helper_), transaction_id, object_store_id, key_range, - base::Passed(&callbacks))); + std::move(callbacks))); } void DatabaseImpl::Clear( @@ -422,9 +422,9 @@ new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_, std::move(callbacks_info), idb_runner_)); idb_runner_->PostTask( - FROM_HERE, base::BindOnce(&IDBSequenceHelper::Clear, - base::Unretained(helper_), transaction_id, - object_store_id, base::Passed(&callbacks))); + FROM_HERE, + base::BindOnce(&IDBSequenceHelper::Clear, base::Unretained(helper_), + transaction_id, object_store_id, std::move(callbacks))); } void DatabaseImpl::CreateIndex(int64_t transaction_id,
diff --git a/content/browser/indexed_db/indexed_db_callbacks.cc b/content/browser/indexed_db/indexed_db_callbacks.cc index f10c46a..78c22df7 100644 --- a/content/browser/indexed_db/indexed_db_callbacks.cc +++ b/content/browser/indexed_db/indexed_db_callbacks.cc
@@ -62,7 +62,7 @@ [](std::unique_ptr<IndexedDBConnection> connection) { connection->ForceClose(); }, - base::Passed(&connection_))); + std::move(connection_))); } } SafeIOThreadConnectionWrapper(SafeIOThreadConnectionWrapper&& other) = @@ -289,7 +289,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&IOThreadHelper::SendUpgradeNeeded, - base::Unretained(io_helper_.get()), base::Passed(&wrapper), + base::Unretained(io_helper_.get()), std::move(wrapper), old_version, data_loss_info.status, data_loss_info.message, metadata)); @@ -322,7 +322,7 @@ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::BindOnce(&IOThreadHelper::SendSuccessDatabase, base::Unretained(io_helper_.get()), - base::Passed(&wrapper), metadata)); + std::move(wrapper), metadata)); complete_ = true; if (!connection_open_start_time_.is_null()) { @@ -356,8 +356,8 @@ BrowserThread::IO, FROM_HERE, base::BindOnce(&IOThreadHelper::SendSuccessCursor, base::Unretained(io_helper_.get()), - base::Passed(&cursor_wrapper), key, primary_key, - base::Passed(&mojo_value), base::Passed(&blob_info))); + std::move(cursor_wrapper), key, primary_key, + std::move(mojo_value), std::move(blob_info))); complete_ = true; } @@ -381,7 +381,7 @@ BrowserThread::IO, FROM_HERE, base::BindOnce(&IOThreadHelper::SendSuccessCursorContinue, base::Unretained(io_helper_.get()), key, primary_key, - base::Passed(&mojo_value), base::Passed(&blob_info))); + std::move(mojo_value), std::move(blob_info))); complete_ = true; } @@ -406,7 +406,7 @@ BrowserThread::IO, FROM_HERE, base::BindOnce(&IOThreadHelper::SendSuccessCursorPrefetch, base::Unretained(io_helper_.get()), keys, primary_keys, - base::Passed(&mojo_values), *values)); + std::move(mojo_values), *values)); complete_ = true; } @@ -426,8 +426,8 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&IOThreadHelper::SendSuccessValue, - base::Unretained(io_helper_.get()), - base::Passed(&mojo_value), base::Passed(&blob_info))); + base::Unretained(io_helper_.get()), std::move(mojo_value), + std::move(blob_info))); complete_ = true; } @@ -447,7 +447,7 @@ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::BindOnce(&IOThreadHelper::SendSuccessArray, base::Unretained(io_helper_.get()), - base::Passed(&mojo_values), *values)); + std::move(mojo_values), *values)); complete_ = true; }
diff --git a/content/browser/indexed_db/indexed_db_context_impl.cc b/content/browser/indexed_db/indexed_db_context_impl.cc index 7468af45..4817ff4 100644 --- a/content/browser/indexed_db/indexed_db_context_impl.cc +++ b/content/browser/indexed_db/indexed_db_context_impl.cc
@@ -503,7 +503,7 @@ if (factory_.get()) { TaskRunner()->PostTask(FROM_HERE, base::BindOnce(&IndexedDBFactory::ContextDestroyed, - base::Passed(&factory_))); + std::move(factory_))); } if (data_path_.empty())
diff --git a/content/browser/indexed_db/indexed_db_database.cc b/content/browser/indexed_db/indexed_db_database.cc index 54093f6..95032b2 100644 --- a/content/browser/indexed_db/indexed_db_database.cc +++ b/content/browser/indexed_db/indexed_db_database.cc
@@ -624,7 +624,7 @@ transaction->ScheduleAbortTask( base::BindOnce(&IndexedDBDatabase::RenameObjectStoreAbortOperation, this, - object_store_id, base::Passed(&old_name))); + object_store_id, std::move(old_name))); } void IndexedDBDatabase::CreateIndex(IndexedDBTransaction* transaction, @@ -720,7 +720,7 @@ transaction->ScheduleAbortTask( base::BindOnce(&IndexedDBDatabase::DeleteIndexAbortOperation, this, - object_store_id, base::Passed(&index_metadata))); + object_store_id, std::move(index_metadata))); return s; } @@ -763,7 +763,7 @@ transaction->ScheduleAbortTask( base::BindOnce(&IndexedDBDatabase::RenameIndexAbortOperation, this, - object_store_id, index_id, base::Passed(&old_name))); + object_store_id, index_id, std::move(old_name))); } void IndexedDBDatabase::RenameIndexAbortOperation(int64_t object_store_id, @@ -894,7 +894,7 @@ transaction->ScheduleTask(base::BindOnce( &IndexedDBDatabase::GetAllOperation, this, object_store_id, index_id, - base::Passed(&key_range), + std::move(key_range), key_only ? indexed_db::CURSOR_KEY_ONLY : indexed_db::CURSOR_KEY_AND_VALUE, max_count, callbacks)); } @@ -913,7 +913,7 @@ transaction->ScheduleTask(base::BindOnce( &IndexedDBDatabase::GetOperation, this, object_store_id, index_id, - base::Passed(&key_range), + std::move(key_range), key_only ? indexed_db::CURSOR_KEY_ONLY : indexed_db::CURSOR_KEY_AND_VALUE, callbacks)); } @@ -1257,7 +1257,7 @@ params->callbacks = callbacks; params->index_keys = index_keys; transaction->ScheduleTask(base::BindOnce(&IndexedDBDatabase::PutOperation, - this, base::Passed(¶ms))); + this, std::move(params))); } Status IndexedDBDatabase::PutOperation( @@ -1502,7 +1502,7 @@ params->task_type = task_type; params->callbacks = callbacks; transaction->ScheduleTask(base::BindOnce( - &IndexedDBDatabase::OpenCursorOperation, this, base::Passed(¶ms))); + &IndexedDBDatabase::OpenCursorOperation, this, std::move(params))); } Status IndexedDBDatabase::OpenCursorOperation( @@ -1594,9 +1594,9 @@ if (!ValidateObjectStoreIdAndOptionalIndexId(object_store_id, index_id)) return; - transaction->ScheduleTask( - base::BindOnce(&IndexedDBDatabase::CountOperation, this, object_store_id, - index_id, base::Passed(&key_range), callbacks)); + transaction->ScheduleTask(base::BindOnce(&IndexedDBDatabase::CountOperation, + this, object_store_id, index_id, + std::move(key_range), callbacks)); } Status IndexedDBDatabase::CountOperation( @@ -1652,7 +1652,7 @@ transaction->ScheduleTask( base::BindOnce(&IndexedDBDatabase::DeleteRangeOperation, this, - object_store_id, base::Passed(&key_range), callbacks)); + object_store_id, std::move(key_range), callbacks)); } Status IndexedDBDatabase::DeleteRangeOperation( @@ -1739,7 +1739,7 @@ } transaction->ScheduleAbortTask( base::BindOnce(&IndexedDBDatabase::DeleteObjectStoreAbortOperation, this, - base::Passed(&object_store_metadata))); + std::move(object_store_metadata))); return s; }
diff --git a/content/browser/indexed_db/indexed_db_database_callbacks.cc b/content/browser/indexed_db/indexed_db_database_callbacks.cc index 3ea0567..0dcddfd 100644 --- a/content/browser/indexed_db/indexed_db_database_callbacks.cc +++ b/content/browser/indexed_db/indexed_db_database_callbacks.cc
@@ -101,10 +101,10 @@ ::indexed_db::mojom::ObserverChangesPtr changes) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(io_helper_); - BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, - base::BindOnce(&IOThreadHelper::SendChanges, - base::Unretained(io_helper_.get()), - base::Passed(&changes))); + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::BindOnce(&IOThreadHelper::SendChanges, + base::Unretained(io_helper_.get()), std::move(changes))); } IndexedDBDatabaseCallbacks::IOThreadHelper::IOThreadHelper(
diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host.cc b/content/browser/indexed_db/indexed_db_dispatcher_host.cc index c9407f0e..1876af1 100644 --- a/content/browser/indexed_db/indexed_db_dispatcher_host.cc +++ b/content/browser/indexed_db/indexed_db_dispatcher_host.cc
@@ -185,7 +185,7 @@ IDBTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&IDBSequenceHelper::GetDatabaseNamesOnIDBThread, base::Unretained(idb_helper_), - base::Passed(&callbacks), origin)); + std::move(callbacks), origin)); } void IndexedDBDispatcherHost::Open( @@ -211,8 +211,8 @@ IDBTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&IDBSequenceHelper::OpenOnIDBThread, - base::Unretained(idb_helper_), base::Passed(&callbacks), - base::Passed(&database_callbacks), origin, name, version, + base::Unretained(idb_helper_), std::move(callbacks), + std::move(database_callbacks), origin, name, version, transaction_id)); } @@ -233,7 +233,7 @@ IDBTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&IDBSequenceHelper::DeleteDatabaseOnIDBThread, - base::Unretained(idb_helper_), base::Passed(&callbacks), + base::Unretained(idb_helper_), std::move(callbacks), origin, name, force_close)); } @@ -254,8 +254,7 @@ FROM_HERE, base::BindOnce( &IDBSequenceHelper::AbortTransactionsAndCompactDatabaseOnIDBThread, - base::Unretained(idb_helper_), base::Passed(&callback_on_io), - origin)); + base::Unretained(idb_helper_), std::move(callback_on_io), origin)); } void IndexedDBDispatcherHost::AbortTransactionsForDatabase( @@ -275,8 +274,7 @@ FROM_HERE, base::BindOnce( &IDBSequenceHelper::AbortTransactionsForDatabaseOnIDBThread, - base::Unretained(idb_helper_), base::Passed(&callback_on_io), - origin)); + base::Unretained(idb_helper_), std::move(callback_on_io), origin)); } void IndexedDBDispatcherHost::InvalidateWeakPtrsAndClearBindings() {
diff --git a/content/browser/indexed_db/indexed_db_internals_ui.cc b/content/browser/indexed_db/indexed_db_internals_ui.cc index ae07aee1..db14ed0 100644 --- a/content/browser/indexed_db/indexed_db_internals_ui.cc +++ b/content/browser/indexed_db/indexed_db_internals_ui.cc
@@ -117,7 +117,7 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&IndexedDBInternalsUI::OnOriginsReady, - base::Unretained(this), base::Passed(&info_list), + base::Unretained(this), std::move(info_list), is_incognito ? base::FilePath() : context_path)); }
diff --git a/content/browser/loader/cross_site_document_resource_handler.cc b/content/browser/loader/cross_site_document_resource_handler.cc index 9d5d44a6..ea9c678 100644 --- a/content/browser/loader/cross_site_document_resource_handler.cc +++ b/content/browser/loader/cross_site_document_resource_handler.cc
@@ -163,7 +163,7 @@ BrowserThread::UI, FROM_HERE, base::BindOnce( &CrossSiteDocumentResourceHandler::LogBlockedResponseOnUIThread, - base::Passed(resource_request_info->GetWebContentsGetterForRequest()), + resource_request_info->GetWebContentsGetterForRequest(), needed_sniffing, canonical_mime_type, resource_type, http_response_code, content_length)); }
diff --git a/content/browser/loader/mime_sniffing_resource_handler.cc b/content/browser/loader/mime_sniffing_resource_handler.cc index f6178af..b0ea07f31 100644 --- a/content/browser/loader/mime_sniffing_resource_handler.cc +++ b/content/browser/loader/mime_sniffing_resource_handler.cc
@@ -23,7 +23,7 @@ #include "content/browser/loader/resource_dispatcher_host_impl.h" #include "content/browser/loader/resource_request_info_impl.h" #include "content/browser/loader/stream_resource_handler.h" -#include "content/browser/loader/web_package_request_handler.h" +#include "content/browser/web_package/web_package_request_handler.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/plugin_service.h" #include "content/public/browser/resource_context.h"
diff --git a/content/browser/loader/navigation_url_loader_impl.cc b/content/browser/loader/navigation_url_loader_impl.cc index 47a9bf56..00f5505 100644 --- a/content/browser/loader/navigation_url_loader_impl.cc +++ b/content/browser/loader/navigation_url_loader_impl.cc
@@ -60,7 +60,7 @@ base::Unretained(storage_partition->GetURLRequestContext()), base::Unretained(storage_partition->GetFileSystemContext()), service_worker_handle_core, appcache_handle_core, - base::Passed(&request_info), base::Passed(&navigation_ui_data))); + std::move(request_info), std::move(navigation_ui_data))); } NavigationURLLoaderImpl::~NavigationURLLoaderImpl() {
diff --git a/content/browser/loader/navigation_url_loader_impl_core.cc b/content/browser/loader/navigation_url_loader_impl_core.cc index c4428a9a..0889976 100644 --- a/content/browser/loader/navigation_url_loader_impl_core.cc +++ b/content/browser/loader/navigation_url_loader_impl_core.cc
@@ -143,8 +143,8 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&NavigationURLLoaderImpl::NotifyResponseStarted, loader_, - response->DeepCopy(), base::Passed(&body), ssl_info, - base::Passed(&navigation_data), request_id, is_download, + response->DeepCopy(), std::move(body), ssl_info, + std::move(navigation_data), request_id, is_download, is_stream)); }
diff --git a/content/browser/loader/navigation_url_loader_network_service.cc b/content/browser/loader/navigation_url_loader_network_service.cc index df3aba4..0ccf4a2 100644 --- a/content/browser/loader/navigation_url_loader_network_service.cc +++ b/content/browser/loader/navigation_url_loader_network_service.cc
@@ -23,9 +23,7 @@ #include "content/browser/loader/navigation_url_loader_delegate.h" #include "content/browser/loader/resource_dispatcher_host_impl.h" #include "content/browser/loader/resource_request_info_impl.h" -#include "content/browser/loader/signed_exchange_url_loader_factory_for_non_network_service.h" #include "content/browser/loader/url_loader_request_handler.h" -#include "content/browser/loader/web_package_request_handler.h" #include "content/browser/resource_context_impl.h" #include "content/browser/service_worker/service_worker_navigation_handle.h" #include "content/browser/service_worker/service_worker_navigation_handle_core.h" @@ -33,6 +31,8 @@ #include "content/browser/storage_partition_impl.h" #include "content/browser/url_loader_factory_getter.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/browser/web_package/signed_exchange_url_loader_factory_for_non_network_service.h" +#include "content/browser/web_package/web_package_request_handler.h" #include "content/browser/webui/url_data_manager_backend.h" #include "content/browser/webui/web_ui_url_loader_factory.h" #include "content/common/navigation_subresource_loader_params.h" @@ -742,7 +742,7 @@ std::move(url_loader_client_endpoints), std::move(ssl_info), std::move(cloned_navigation_data), global_request_id_, is_download, is_stream, - base::Passed(&downloaded_file))); + std::move(downloaded_file))); } void OnReceiveRedirect(const net::RedirectInfo& redirect_info, @@ -977,9 +977,8 @@ base::RetainedRef(storage_partition->GetURLRequestContext()), base::Unretained(storage_partition->GetFileSystemContext()), base::Unretained(service_worker_navigation_handle_core), - base::Unretained(appcache_handle_core), - base::Passed(std::move(request_info)), - base::Passed(std::move(navigation_ui_data)))); + base::Unretained(appcache_handle_core), std::move(request_info), + std::move(navigation_ui_data))); return; }
diff --git a/content/browser/loader/prefetch_browsertest.cc b/content/browser/loader/prefetch_browsertest.cc index 0b39d36..4273eff 100644 --- a/content/browser/loader/prefetch_browsertest.cc +++ b/content/browser/loader/prefetch_browsertest.cc
@@ -11,7 +11,7 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/test/scoped_feature_list.h" -#include "content/browser/loader/prefetch_url_loader_factory.h" +#include "content/browser/loader/prefetch_url_loader_service.h" #include "content/browser/storage_partition_impl.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_features.h" @@ -72,8 +72,8 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, BindOnce( - &PrefetchURLLoaderFactory::RegisterPrefetchLoaderCallbackForTest, - base::RetainedRef(partition->GetPrefetchURLLoaderFactory()), + &PrefetchURLLoaderService::RegisterPrefetchLoaderCallbackForTest, + base::RetainedRef(partition->GetPrefetchURLLoaderService()), base::BindRepeating(&PrefetchBrowserTest::OnPrefetchURLLoaderCalled, base::Unretained(this)))); }
diff --git a/content/browser/loader/prefetch_url_loader.cc b/content/browser/loader/prefetch_url_loader.cc index 4e34592..2f6b8d4a 100644 --- a/content/browser/loader/prefetch_url_loader.cc +++ b/content/browser/loader/prefetch_url_loader.cc
@@ -4,6 +4,8 @@ #include "content/browser/loader/prefetch_url_loader.h" +#include "net/url_request/url_request_context_getter.h" + namespace content { PrefetchURLLoader::PrefetchURLLoader( @@ -13,10 +15,22 @@ const network::ResourceRequest& resource_request, network::mojom::URLLoaderClientPtr client, const net::MutableNetworkTrafficAnnotationTag& traffic_annotation, - network::mojom::URLLoaderFactory* network_loader_factory) - : network_client_binding_(this), forwarding_client_(std::move(client)) { + network::mojom::URLLoaderFactory* network_loader_factory, + URLLoaderThrottlesGetter url_loader_throttles_getter, + ResourceContext* resource_context, + scoped_refptr<net::URLRequestContextGetter> request_context_getter) + : network_client_binding_(this), + forwarding_client_(std::move(client)), + url_loader_throttles_getter_(url_loader_throttles_getter), + resource_context_(resource_context), + request_context_getter_(std::move(request_context_getter)) { DCHECK(network_loader_factory); + // TODO(kinuko): Hook up the Web Package code that uses these fields. + // (https://crbug.com/803776) + DCHECK(resource_context_); + DCHECK(request_context_getter_); + network::mojom::URLLoaderClientPtr network_client; network_client_binding_.Bind(mojo::MakeRequest(&network_client)); network_client_binding_.set_connection_error_handler(base::BindOnce(
diff --git a/content/browser/loader/prefetch_url_loader.h b/content/browser/loader/prefetch_url_loader.h index 14a1a0c..fa43ecb 100644 --- a/content/browser/loader/prefetch_url_loader.h +++ b/content/browser/loader/prefetch_url_loader.h
@@ -15,14 +15,28 @@ #include "services/network/public/mojom/url_loader_factory.mojom.h" #include "url/gurl.h" +namespace net { +class URLRequestContextGetter; +} + namespace content { +class ResourceContext; +class URLLoaderThrottle; + // PrefetchURLLoader which basically just keeps draining the data. class CONTENT_EXPORT PrefetchURLLoader : public network::mojom::URLLoader, public network::mojom::URLLoaderClient, public mojo::common::DataPipeDrainer::Client { public: + using URLLoaderThrottlesGetter = base::RepeatingCallback< + std::vector<std::unique_ptr<content::URLLoaderThrottle>>()>; + + // |url_loader_throttles_getter|, |resource_context| and + // |request_context_getter| may be used when a prefetch handler + // needs to additionally create a request (e.g. for fetching certificate + // if the prefetch was for a signed exchange). PrefetchURLLoader( int32_t routing_id, int32_t request_id, @@ -30,7 +44,10 @@ const network::ResourceRequest& resource_request, network::mojom::URLLoaderClientPtr client, const net::MutableNetworkTrafficAnnotationTag& traffic_annotation, - network::mojom::URLLoaderFactory* network_loader_factory); + network::mojom::URLLoaderFactory* network_loader_factory, + URLLoaderThrottlesGetter url_loader_throttles_getter, + ResourceContext* resource_context, + scoped_refptr<net::URLRequestContextGetter> request_context_getter); ~PrefetchURLLoader() override; private: @@ -73,6 +90,12 @@ // To be a URLLoader for the client. network::mojom::URLLoaderClientPtr forwarding_client_; + // |url_loader_throttles_getter_| and |resource_context_| should be + // valid as far as |request_context_getter_| returns non-null value. + URLLoaderThrottlesGetter url_loader_throttles_getter_; + ResourceContext* resource_context_; + scoped_refptr<net::URLRequestContextGetter> request_context_getter_; + std::unique_ptr<mojo::common::DataPipeDrainer> pipe_drainer_; DISALLOW_COPY_AND_ASSIGN(PrefetchURLLoader);
diff --git a/content/browser/loader/prefetch_url_loader_factory.cc b/content/browser/loader/prefetch_url_loader_factory.cc deleted file mode 100644 index 0b59bff7..0000000 --- a/content/browser/loader/prefetch_url_loader_factory.cc +++ /dev/null
@@ -1,97 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/loader/prefetch_url_loader_factory.h" - -#include "base/feature_list.h" -#include "content/browser/loader/prefetch_url_loader.h" -#include "content/browser/url_loader_factory_getter.h" -#include "content/common/wrapper_shared_url_loader_factory.h" -#include "content/public/common/resource_type.h" -#include "content/public/common/shared_url_loader_factory.h" -#include "mojo/public/cpp/bindings/strong_binding.h" -#include "services/network/public/cpp/features.h" - -namespace content { - -PrefetchURLLoaderFactory::PrefetchURLLoaderFactory( - scoped_refptr<URLLoaderFactoryGetter> factory_getter) - : loader_factory_getter_(std::move(factory_getter)) {} - -void PrefetchURLLoaderFactory::ConnectToService( - blink::mojom::PrefetchURLLoaderServiceRequest request) { - if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { - // TODO(https://crbug.com/813479): Investigate why we need this branch - // and remove it after we found the root cause. Bind calls to the - // BindRegistry should come on to the IO thread, but it looks we hit - // here in browser tests (but not in full chrome build), i.e. - // in content/browser/loader/prefetch_browsertest.cc. - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::BindOnce(&PrefetchURLLoaderFactory::ConnectToService, this, - std::move(request))); - return; - } - service_bindings_.AddBinding(this, std::move(request)); -} - -void PrefetchURLLoaderFactory::GetFactory( - network::mojom::URLLoaderFactoryRequest request) { - Clone(std::move(request)); -} - -void PrefetchURLLoaderFactory::CreateLoaderAndStart( - network::mojom::URLLoaderRequest request, - int32_t routing_id, - int32_t request_id, - uint32_t options, - const network::ResourceRequest& resource_request, - network::mojom::URLLoaderClientPtr client, - const net::MutableNetworkTrafficAnnotationTag& traffic_annotation, - network::mojom::URLLoaderFactory* network_loader_factory) { - DCHECK_CURRENTLY_ON(BrowserThread::IO); - DCHECK_EQ(RESOURCE_TYPE_PREFETCH, resource_request.resource_type); - - if (prefetch_load_callback_for_testing_) - prefetch_load_callback_for_testing_.Run(); - - // For now we strongly bind the loader to the request, while we can - // also possibly make the new loader owned by the factory so that - // they can live longer than the client (i.e. run in detached mode). - // TODO(kinuko): Revisit this. - mojo::MakeStrongBinding( - std::make_unique<PrefetchURLLoader>( - routing_id, request_id, options, resource_request, std::move(client), - traffic_annotation, network_loader_factory), - std::move(request)); -} - -PrefetchURLLoaderFactory::~PrefetchURLLoaderFactory() = default; - -void PrefetchURLLoaderFactory::CreateLoaderAndStart( - network::mojom::URLLoaderRequest request, - int32_t routing_id, - int32_t request_id, - uint32_t options, - const network::ResourceRequest& resource_request, - network::mojom::URLLoaderClientPtr client, - const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { - DCHECK_CURRENTLY_ON(BrowserThread::IO); - DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService)); - if (!network_loader_factory_ || network_loader_factory_.encountered_error()) { - loader_factory_getter_->GetNetworkFactory()->Clone( - mojo::MakeRequest(&network_loader_factory_)); - } - CreateLoaderAndStart(std::move(request), routing_id, request_id, options, - resource_request, std::move(client), traffic_annotation, - network_loader_factory_.get()); -} - -void PrefetchURLLoaderFactory::Clone( - network::mojom::URLLoaderFactoryRequest request) { - DCHECK_CURRENTLY_ON(BrowserThread::IO); - bindings_.AddBinding(this, std::move(request)); -} - -} // namespace content
diff --git a/content/browser/loader/prefetch_url_loader_factory.h b/content/browser/loader/prefetch_url_loader_factory.h deleted file mode 100644 index 26086fb..0000000 --- a/content/browser/loader/prefetch_url_loader_factory.h +++ /dev/null
@@ -1,86 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_LOADER_PREFETCH_URL_LOADER_FACTORY_H_ -#define CONTENT_BROWSER_LOADER_PREFETCH_URL_LOADER_FACTORY_H_ - -#include "base/callback.h" -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "content/common/content_export.h" -#include "content/public/browser/browser_thread.h" -#include "mojo/public/cpp/bindings/strong_binding_set.h" -#include "services/network/public/mojom/url_loader_factory.mojom.h" -#include "third_party/WebKit/common/loader/prefetch_url_loader_service.mojom.h" - -namespace content { - -class URLLoaderFactoryGetter; - -class CONTENT_EXPORT PrefetchURLLoaderFactory final - : public base::RefCountedThreadSafe<PrefetchURLLoaderFactory, - BrowserThread::DeleteOnIOThread>, - public network::mojom::URLLoaderFactory, - public blink::mojom::PrefetchURLLoaderService { - public: - // |factory_getter| could be null in non-NetworkService case. - explicit PrefetchURLLoaderFactory( - scoped_refptr<URLLoaderFactoryGetter> network_loader_factory); - - void ConnectToService(blink::mojom::PrefetchURLLoaderServiceRequest request); - - // blink::mojom::PrefetchURLLoaderService: - void GetFactory(network::mojom::URLLoaderFactoryRequest request) override; - - // Used only when NetworkService is not enabled (or indirectly via the - // other CreateLoaderAndStart when NetworkService is enabled). - // This creates a loader and starts fetching using the given - // |network_lader_factory|. - void CreateLoaderAndStart( - network::mojom::URLLoaderRequest request, - int32_t routing_id, - int32_t request_id, - uint32_t options, - const network::ResourceRequest& resource_request, - network::mojom::URLLoaderClientPtr client, - const net::MutableNetworkTrafficAnnotationTag& traffic_annotation, - network::mojom::URLLoaderFactory* factory); - - // Register a callback that is fired right before a prefetch load is started - // by this factory. - void RegisterPrefetchLoaderCallbackForTest( - const base::RepeatingClosure& prefetch_load_callback) { - prefetch_load_callback_for_testing_ = prefetch_load_callback; - } - - private: - friend class base::DeleteHelper<content::PrefetchURLLoaderFactory>; - friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; - ~PrefetchURLLoaderFactory() override; - - // network::mojom::URLLoaderFactory: - void CreateLoaderAndStart(network::mojom::URLLoaderRequest request, - int32_t routing_id, - int32_t request_id, - uint32_t options, - const network::ResourceRequest& resource_request, - network::mojom::URLLoaderClientPtr client, - const net::MutableNetworkTrafficAnnotationTag& - traffic_annotation) override; - void Clone(network::mojom::URLLoaderFactoryRequest request) override; - - mojo::BindingSet<network::mojom::URLLoaderFactory> bindings_; - mojo::BindingSet<blink::mojom::PrefetchURLLoaderService> service_bindings_; - - scoped_refptr<URLLoaderFactoryGetter> loader_factory_getter_; - network::mojom::URLLoaderFactoryPtr network_loader_factory_; - - base::RepeatingClosure prefetch_load_callback_for_testing_; - - DISALLOW_COPY_AND_ASSIGN(PrefetchURLLoaderFactory); -}; - -} // namespace content - -#endif // CONTENT_BROWSER_LOADER_PREFETCH_URL_LOADER_FACTORY_H_
diff --git a/content/browser/loader/prefetch_url_loader_service.cc b/content/browser/loader/prefetch_url_loader_service.cc new file mode 100644 index 0000000..dad769e --- /dev/null +++ b/content/browser/loader/prefetch_url_loader_service.cc
@@ -0,0 +1,165 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/loader/prefetch_url_loader_service.h" + +#include "base/feature_list.h" +#include "content/browser/loader/prefetch_url_loader.h" +#include "content/browser/url_loader_factory_getter.h" +#include "content/common/wrapper_shared_url_loader_factory.h" +#include "content/public/browser/content_browser_client.h" +#include "content/public/browser/web_contents.h" +#include "content/public/common/content_client.h" +#include "content/public/common/resource_type.h" +#include "content/public/common/shared_url_loader_factory.h" +#include "content/public/common/url_loader_throttle.h" +#include "mojo/public/cpp/bindings/strong_binding.h" +#include "net/url_request/url_request_context_getter.h" +#include "services/network/public/cpp/features.h" +#include "services/network/public/mojom/url_loader_factory.mojom.h" + +namespace content { + +namespace { + +// Per-frame URLLoaderFactory. Used only when Network Service is enabled. +class PrefetchURLLoaderFactory : public network::mojom::URLLoaderFactory, + public blink::mojom::PrefetchURLLoaderService { + public: + PrefetchURLLoaderFactory( + content::PrefetchURLLoaderService* service, + scoped_refptr<URLLoaderFactoryGetter> loader_factory_getter, + int frame_tree_node_id) + : service_(std::move(service)), + loader_factory_getter_(std::move(loader_factory_getter)), + frame_tree_node_id_(frame_tree_node_id) {} + ~PrefetchURLLoaderFactory() override = default; + + // blink::mojom::PrefetchURLLoaderService: + void GetFactory(network::mojom::URLLoaderFactoryRequest request) override { + Clone(std::move(request)); + } + + private: + // network::mojom::URLLoaderFactory: + void CreateLoaderAndStart(network::mojom::URLLoaderRequest request, + int32_t routing_id, + int32_t request_id, + uint32_t options, + const network::ResourceRequest& resource_request, + network::mojom::URLLoaderClientPtr client, + const net::MutableNetworkTrafficAnnotationTag& + traffic_annotation) override { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService)); + if (!network_loader_factory_ || + network_loader_factory_.encountered_error()) { + loader_factory_getter_->GetNetworkFactory()->Clone( + mojo::MakeRequest(&network_loader_factory_)); + } + service_->CreateLoaderAndStart( + std::move(request), routing_id, request_id, options, resource_request, + std::move(client), traffic_annotation, network_loader_factory_.get(), + frame_tree_node_id_); + } + + void Clone(network::mojom::URLLoaderFactoryRequest request) override { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + bindings_.AddBinding(this, std::move(request)); + } + + scoped_refptr<content::PrefetchURLLoaderService> service_; + + network::mojom::URLLoaderFactoryPtr network_loader_factory_; + scoped_refptr<URLLoaderFactoryGetter> loader_factory_getter_; + int frame_tree_node_id_; + + mojo::BindingSet<network::mojom::URLLoaderFactory> bindings_; + + DISALLOW_COPY_AND_ASSIGN(PrefetchURLLoaderFactory); +}; + +} // namespace + +PrefetchURLLoaderService::PrefetchURLLoaderService( + scoped_refptr<URLLoaderFactoryGetter> factory_getter) + : loader_factory_getter_(std::move(factory_getter)) {} + +void PrefetchURLLoaderService::InitializeResourceContext( + ResourceContext* resource_context, + scoped_refptr<net::URLRequestContextGetter> request_context_getter) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + DCHECK(!resource_context_); + DCHECK(!request_context_getter_); + resource_context_ = resource_context; + request_context_getter_ = request_context_getter; +} + +void PrefetchURLLoaderService::ConnectToService( + int frame_tree_node_id, + blink::mojom::PrefetchURLLoaderServiceRequest request) { + if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::BindOnce(&PrefetchURLLoaderService::ConnectToService, this, + frame_tree_node_id, std::move(request))); + return; + } + service_bindings_.AddBinding( + std::make_unique<PrefetchURLLoaderFactory>(this, loader_factory_getter_, + frame_tree_node_id), + std::move(request)); +} + +void PrefetchURLLoaderService::CreateLoaderAndStart( + network::mojom::URLLoaderRequest request, + int32_t routing_id, + int32_t request_id, + uint32_t options, + const network::ResourceRequest& resource_request, + network::mojom::URLLoaderClientPtr client, + const net::MutableNetworkTrafficAnnotationTag& traffic_annotation, + network::mojom::URLLoaderFactory* network_loader_factory, + int frame_tree_node_id) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + DCHECK_EQ(RESOURCE_TYPE_PREFETCH, resource_request.resource_type); + DCHECK(resource_context_); + + if (prefetch_load_callback_for_testing_) + prefetch_load_callback_for_testing_.Run(); + + // For now we strongly bind the loader to the request, while we can + // also possibly make the new loader owned by the factory so that + // they can live longer than the client (i.e. run in detached mode). + // TODO(kinuko): Revisit this. + mojo::MakeStrongBinding( + std::make_unique<PrefetchURLLoader>( + routing_id, request_id, options, resource_request, std::move(client), + traffic_annotation, network_loader_factory, + base::BindRepeating( + &PrefetchURLLoaderService::CreateURLLoaderThrottles, this, + resource_request, frame_tree_node_id), + resource_context_, request_context_getter_), + std::move(request)); +} + +PrefetchURLLoaderService::~PrefetchURLLoaderService() = default; + +std::vector<std::unique_ptr<content::URLLoaderThrottle>> +PrefetchURLLoaderService::CreateURLLoaderThrottles( + const network::ResourceRequest& request, + int frame_tree_node_id) { + if (!base::FeatureList::IsEnabled(network::features::kNetworkService) || + !request_context_getter_ || + !request_context_getter_->GetURLRequestContext()) + return std::vector<std::unique_ptr<content::URLLoaderThrottle>>(); + + return GetContentClient()->browser()->CreateURLLoaderThrottles( + request, resource_context_, + base::BindRepeating(&WebContents::FromFrameTreeNodeId, + frame_tree_node_id), + nullptr /* navigation_ui_data */, frame_tree_node_id); +} + +} // namespace content
diff --git a/content/browser/loader/prefetch_url_loader_service.h b/content/browser/loader/prefetch_url_loader_service.h new file mode 100644 index 0000000..3de2f44b2 --- /dev/null +++ b/content/browser/loader/prefetch_url_loader_service.h
@@ -0,0 +1,92 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_LOADER_PREFETCH_URL_LOADER_SERVICE_H_ +#define CONTENT_BROWSER_LOADER_PREFETCH_URL_LOADER_SERVICE_H_ + +#include "base/callback.h" +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "content/common/content_export.h" +#include "content/public/browser/browser_thread.h" +#include "mojo/public/cpp/bindings/strong_binding_set.h" +#include "third_party/WebKit/common/loader/prefetch_url_loader_service.mojom.h" + +namespace net { +class URLRequestContextGetter; +} + +namespace content { + +class ResourceContext; +class URLLoaderFactoryGetter; +class URLLoaderThrottle; + +class CONTENT_EXPORT PrefetchURLLoaderService final + : public base::RefCountedThreadSafe<PrefetchURLLoaderService, + BrowserThread::DeleteOnIOThread> { + public: + // |factory_getter| could be null in non-NetworkService case. + // Created on the UI thread. + PrefetchURLLoaderService( + scoped_refptr<URLLoaderFactoryGetter> network_loader_factory); + + // Must be called on the IO thread. The given |resource_context| will + // be valid as far as request_context_getter returns non-null context. + void InitializeResourceContext( + ResourceContext* resource_context, + scoped_refptr<net::URLRequestContextGetter> request_context_getter); + + void ConnectToService(int frame_tree_node_id, + blink::mojom::PrefetchURLLoaderServiceRequest request); + + // Used only when NetworkService is not enabled (or indirectly via the + // other CreateLoaderAndStart when NetworkService is enabled). + // This creates a loader and starts fetching using the given + // |network_lader_factory|. |frame_tree_node_id| may be given and used to + // create necessary throttles when Network Service is enabled when the + // created loader internally makes additional requests. + void CreateLoaderAndStart( + network::mojom::URLLoaderRequest request, + int32_t routing_id, + int32_t request_id, + uint32_t options, + const network::ResourceRequest& resource_request, + network::mojom::URLLoaderClientPtr client, + const net::MutableNetworkTrafficAnnotationTag& traffic_annotation, + network::mojom::URLLoaderFactory* factory, + int frame_tree_node_id = -1); + + // Register a callback that is fired right before a prefetch load is started + // by this service. + void RegisterPrefetchLoaderCallbackForTest( + const base::RepeatingClosure& prefetch_load_callback) { + prefetch_load_callback_for_testing_ = prefetch_load_callback; + } + + private: + friend class base::DeleteHelper<content::PrefetchURLLoaderService>; + friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; + ~PrefetchURLLoaderService(); + + // For URLLoaderThrottlesGetter. + std::vector<std::unique_ptr<content::URLLoaderThrottle>> + CreateURLLoaderThrottles(const network::ResourceRequest& request, + int frame_tree_node_id); + + mojo::StrongBindingSet<blink::mojom::PrefetchURLLoaderService> + service_bindings_; + + scoped_refptr<URLLoaderFactoryGetter> loader_factory_getter_; + ResourceContext* resource_context_ = nullptr; + scoped_refptr<net::URLRequestContextGetter> request_context_getter_; + + base::RepeatingClosure prefetch_load_callback_for_testing_; + + DISALLOW_COPY_AND_ASSIGN(PrefetchURLLoaderService); +}; + +} // namespace content + +#endif // CONTENT_BROWSER_LOADER_PREFETCH_URL_LOADER_SERVICE_H_
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc index d92117c..e7b9e8f 100644 --- a/content/browser/loader/resource_dispatcher_host_impl.cc +++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -2392,8 +2392,8 @@ // requests), we must go to the UI thread and compare the requests using their // WebContents. main_thread_task_runner_->PostTask( - FROM_HERE, base::BindOnce(UpdateLoadStateOnUI, loader_delegate_, - base::Passed(&infos))); + FROM_HERE, + base::BindOnce(UpdateLoadStateOnUI, loader_delegate_, std::move(infos))); } void ResourceDispatcherHostImpl::RecordOutstandingRequestsStats() {
diff --git a/content/browser/loader/resource_message_filter.cc b/content/browser/loader/resource_message_filter.cc index 1c26f3b..75b5bea3 100644 --- a/content/browser/loader/resource_message_filter.cc +++ b/content/browser/loader/resource_message_filter.cc
@@ -8,7 +8,7 @@ #include "base/logging.h" #include "content/browser/appcache/chrome_appcache_service.h" #include "content/browser/blob_storage/chrome_blob_storage_context.h" -#include "content/browser/loader/prefetch_url_loader_factory.h" +#include "content/browser/loader/prefetch_url_loader_service.h" #include "content/browser/loader/resource_dispatcher_host_impl.h" #include "content/browser/loader/resource_requester_info.h" #include "content/browser/loader/url_loader_factory_impl.h" @@ -34,7 +34,7 @@ ChromeBlobStorageContext* blob_storage_context, storage::FileSystemContext* file_system_context, ServiceWorkerContextWrapper* service_worker_context, - PrefetchURLLoaderFactory* prefetch_url_loader_factory, + PrefetchURLLoaderService* prefetch_url_loader_service, const GetContextsCallback& get_contexts_callback, const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_runner) : BrowserMessageFilter(ResourceMsgStart), @@ -47,7 +47,7 @@ file_system_context, service_worker_context, get_contexts_callback)), - prefetch_url_loader_factory_(prefetch_url_loader_factory), + prefetch_url_loader_service_(prefetch_url_loader_service), io_thread_task_runner_(io_thread_runner), weak_ptr_factory_(this) {} @@ -65,7 +65,7 @@ void ResourceMessageFilter::OnChannelClosing() { DCHECK(io_thread_task_runner_->BelongsToCurrentThread()); - prefetch_url_loader_factory_ = nullptr; + prefetch_url_loader_service_ = nullptr; url_loader_factory_ = nullptr; // Unhook us from all pending network requests so they don't get sent to a @@ -118,8 +118,8 @@ // doesn't need to be paired up with SignedExchange feature. if (base::FeatureList::IsEnabled(features::kSignedHTTPExchange) && url_request.resource_type == RESOURCE_TYPE_PREFETCH && - prefetch_url_loader_factory_) { - prefetch_url_loader_factory_->CreateLoaderAndStart( + prefetch_url_loader_service_) { + prefetch_url_loader_service_->CreateLoaderAndStart( std::move(request), routing_id, request_id, options, url_request, std::move(client), traffic_annotation, url_loader_factory_.get()); return;
diff --git a/content/browser/loader/resource_message_filter.h b/content/browser/loader/resource_message_filter.h index 50b807f..c8f2748 100644 --- a/content/browser/loader/resource_message_filter.h +++ b/content/browser/loader/resource_message_filter.h
@@ -32,7 +32,7 @@ namespace content { class ChromeAppCacheService; class ChromeBlobStorageContext; -class PrefetchURLLoaderFactory; +class PrefetchURLLoaderService; class ResourceContext; class ResourceRequesterInfo; class ServiceWorkerContextWrapper; @@ -61,7 +61,7 @@ ChromeBlobStorageContext* blob_storage_context, storage::FileSystemContext* file_system_context, ServiceWorkerContextWrapper* service_worker_context, - PrefetchURLLoaderFactory* prefetch_url_loader_factory, + PrefetchURLLoaderService* prefetch_url_loader_service, const GetContextsCallback& get_contexts_callback, const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_runner); @@ -117,7 +117,7 @@ std::unique_ptr<network::mojom::URLLoaderFactory> url_loader_factory_; - scoped_refptr<PrefetchURLLoaderFactory> prefetch_url_loader_factory_; + scoped_refptr<PrefetchURLLoaderService> prefetch_url_loader_service_; // Task runner for the IO thead. scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_;
diff --git a/content/browser/media/capture/desktop_capture_device.cc b/content/browser/media/capture/desktop_capture_device.cc index fa7b2412..f5fb728 100644 --- a/content/browser/media/capture/desktop_capture_device.cc +++ b/content/browser/media/capture/desktop_capture_device.cc
@@ -538,7 +538,7 @@ thread_.task_runner()->PostTask( FROM_HERE, base::BindOnce(&Core::AllocateAndStart, base::Unretained(core_.get()), - params, base::Passed(&client))); + params, std::move(client))); } void DesktopCaptureDevice::StopAndDeAllocate() {
diff --git a/content/browser/media/media_internals.cc b/content/browser/media/media_internals.cc index d3ddeb03..a0759cac 100644 --- a/content/browser/media/media_internals.cc +++ b/content/browser/media/media_internals.cc
@@ -6,7 +6,6 @@ #include <stddef.h> -#include <memory> #include <tuple> #include <utility> @@ -17,6 +16,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "build/build_config.h" +#include "content/browser/media/mojo_audio_logging_adapter.h" #include "content/browser/renderer_host/media/media_stream_manager.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" @@ -29,6 +29,7 @@ #include "media/base/audio_parameters.h" #include "media/base/media_log_event.h" #include "media/filters/gpu_video_decoder.h" +#include "mojo/public/cpp/bindings/strong_binding.h" #if !defined(OS_ANDROID) #include "media/filters/decrypting_video_decoder.h" @@ -50,10 +51,10 @@ int flag; const char* name; } flags[] = { - { media::AudioParameters::ECHO_CANCELLER, "ECHO_CANCELLER" }, - { media::AudioParameters::DUCKING, "DUCKING" }, - { media::AudioParameters::KEYBOARD_MIC, "KEYBOARD_MIC" }, - { media::AudioParameters::HOTWORD, "HOTWORD" }, + {media::AudioParameters::ECHO_CANCELLER, "ECHO_CANCELLER"}, + {media::AudioParameters::DUCKING, "DUCKING"}, + {media::AudioParameters::KEYBOARD_MIC, "KEYBOARD_MIC"}, + {media::AudioParameters::HOTWORD, "HOTWORD"}, }; std::string ret; @@ -117,36 +118,35 @@ namespace content { -class AudioLogImpl : public media::AudioLog { +class AudioLogImpl : public media::mojom::AudioLog { public: AudioLogImpl(int owner_id, media::AudioLogFactory::AudioComponent component, - content::MediaInternals* media_internals); + content::MediaInternals* media_internals, + int component_id, + int render_process_id, + int render_frame_id); ~AudioLogImpl() override; - void OnCreated(int component_id, - const media::AudioParameters& params, + void OnCreated(const media::AudioParameters& params, const std::string& device_id) override; - void OnStarted(int component_id) override; - void OnStopped(int component_id) override; - void OnClosed(int component_id) override; - void OnError(int component_id) override; - void OnSetVolume(int component_id, double volume) override; - void OnSwitchOutputDevice(int component_id, - const std::string& device_id) override; - void OnLogMessage(int component_id, const std::string& message) override; - - // Called by MediaInternals to update the WebContents title for a stream. - void SendWebContentsTitle(int component_id, - int render_process_id, - int render_frame_id); + void OnStarted() override; + void OnStopped() override; + void OnClosed() override; + void OnError() override; + void OnSetVolume(double volume) override; + void OnLogMessage(const std::string& message) override; private: - void SendSingleStringUpdate(int component_id, - const std::string& key, - const std::string& value); - void StoreComponentMetadata(int component_id, base::DictionaryValue* dict); - std::string FormatCacheKey(int component_id); + // If possible, i.e. a WebContents exists for the given RenderFrameHostID, + // tells an existing AudioLogEntry the WebContents title for easier + // differentiation on the UI. Note that the log entry must be created (by + // calling OnCreated() before calling this method. + void SetWebContentsTitle(); + + void SendSingleStringUpdate(const std::string& key, const std::string& value); + void StoreComponentMetadata(base::DictionaryValue* dict); + std::string FormatCacheKey(); static void SendWebContentsTitleHelper( const std::string& cache_key, @@ -157,24 +157,32 @@ const int owner_id_; const media::AudioLogFactory::AudioComponent component_; content::MediaInternals* const media_internals_; + const int component_id_; + const int render_process_id_; + const int render_frame_id_; DISALLOW_COPY_AND_ASSIGN(AudioLogImpl); }; AudioLogImpl::AudioLogImpl(int owner_id, media::AudioLogFactory::AudioComponent component, - content::MediaInternals* media_internals) + content::MediaInternals* media_internals, + int component_id, + int render_process_id, + int render_frame_id) : owner_id_(owner_id), component_(component), - media_internals_(media_internals) {} + media_internals_(media_internals), + component_id_(component_id), + render_process_id_(render_process_id), + render_frame_id_(render_frame_id) {} AudioLogImpl::~AudioLogImpl() {} -void AudioLogImpl::OnCreated(int component_id, - const media::AudioParameters& params, +void AudioLogImpl::OnCreated(const media::AudioParameters& params, const std::string& device_id) { base::DictionaryValue dict; - StoreComponentMetadata(component_id, &dict); + StoreComponentMetadata(&dict); dict.SetString(kAudioLogStatusKey, "created"); dict.SetString("device_id", device_id); @@ -186,66 +194,56 @@ ChannelLayoutToString(params.channel_layout())); dict.SetString("effects", EffectsToString(params.effects())); - media_internals_->UpdateAudioLog(MediaInternals::CREATE, - FormatCacheKey(component_id), + media_internals_->UpdateAudioLog(MediaInternals::CREATE, FormatCacheKey(), kAudioLogUpdateFunction, &dict); + SetWebContentsTitle(); } -void AudioLogImpl::OnStarted(int component_id) { - SendSingleStringUpdate(component_id, kAudioLogStatusKey, "started"); +void AudioLogImpl::OnStarted() { + SendSingleStringUpdate(kAudioLogStatusKey, "started"); } -void AudioLogImpl::OnStopped(int component_id) { - SendSingleStringUpdate(component_id, kAudioLogStatusKey, "stopped"); +void AudioLogImpl::OnStopped() { + SendSingleStringUpdate(kAudioLogStatusKey, "stopped"); } -void AudioLogImpl::OnClosed(int component_id) { +void AudioLogImpl::OnClosed() { base::DictionaryValue dict; - StoreComponentMetadata(component_id, &dict); + StoreComponentMetadata(&dict); dict.SetString(kAudioLogStatusKey, "closed"); media_internals_->UpdateAudioLog(MediaInternals::UPDATE_AND_DELETE, - FormatCacheKey(component_id), - kAudioLogUpdateFunction, &dict); + FormatCacheKey(), kAudioLogUpdateFunction, + &dict); } -void AudioLogImpl::OnError(int component_id) { - SendSingleStringUpdate(component_id, "error_occurred", "true"); +void AudioLogImpl::OnError() { + SendSingleStringUpdate("error_occurred", "true"); } -void AudioLogImpl::OnSetVolume(int component_id, double volume) { +void AudioLogImpl::OnSetVolume(double volume) { base::DictionaryValue dict; - StoreComponentMetadata(component_id, &dict); + StoreComponentMetadata(&dict); dict.SetDouble("volume", volume); media_internals_->UpdateAudioLog(MediaInternals::UPDATE_IF_EXISTS, - FormatCacheKey(component_id), - kAudioLogUpdateFunction, &dict); + FormatCacheKey(), kAudioLogUpdateFunction, + &dict); } -void AudioLogImpl::OnSwitchOutputDevice(int component_id, - const std::string& device_id) { - base::DictionaryValue dict; - StoreComponentMetadata(component_id, &dict); - dict.SetString("device_id", device_id); - media_internals_->UpdateAudioLog(MediaInternals::UPDATE_IF_EXISTS, - FormatCacheKey(component_id), - kAudioLogUpdateFunction, &dict); -} - -void AudioLogImpl::OnLogMessage(int component_id, const std::string& message) { +void AudioLogImpl::OnLogMessage(const std::string& message) { MediaStreamManager::SendMessageToNativeLog(message); } -void AudioLogImpl::SendWebContentsTitle(int component_id, - int render_process_id, - int render_frame_id) { +void AudioLogImpl::SetWebContentsTitle() { + if (render_process_id_ < 0 || render_frame_id_ < 0) + return; std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); - StoreComponentMetadata(component_id, dict.get()); - SendWebContentsTitleHelper(FormatCacheKey(component_id), std::move(dict), - render_process_id, render_frame_id); + StoreComponentMetadata(dict.get()); + SendWebContentsTitleHelper(FormatCacheKey(), std::move(dict), + render_process_id_, render_frame_id_); } -std::string AudioLogImpl::FormatCacheKey(int component_id) { - return base::StringPrintf("%d:%d:%d", owner_id_, component_, component_id); +std::string AudioLogImpl::FormatCacheKey() { + return base::StringPrintf("%d:%d:%d", owner_id_, component_, component_id_); } // static @@ -256,10 +254,10 @@ int render_frame_id) { // Page title information can only be retrieved from the UI thread. if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::BindOnce(&SendWebContentsTitleHelper, - cache_key, base::Passed(&dict), - render_process_id, render_frame_id)); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::BindOnce(&SendWebContentsTitleHelper, cache_key, std::move(dict), + render_process_id, render_frame_id)); return; } @@ -277,21 +275,19 @@ dict.get()); } -void AudioLogImpl::SendSingleStringUpdate(int component_id, - const std::string& key, +void AudioLogImpl::SendSingleStringUpdate(const std::string& key, const std::string& value) { base::DictionaryValue dict; - StoreComponentMetadata(component_id, &dict); + StoreComponentMetadata(&dict); dict.SetString(key, value); media_internals_->UpdateAudioLog(MediaInternals::UPDATE_IF_EXISTS, - FormatCacheKey(component_id), - kAudioLogUpdateFunction, &dict); + FormatCacheKey(), kAudioLogUpdateFunction, + &dict); } -void AudioLogImpl::StoreComponentMetadata(int component_id, - base::DictionaryValue* dict) { +void AudioLogImpl::StoreComponentMetadata(base::DictionaryValue* dict) { dict->SetInteger("owner_id", owner_id_); - dict->SetInteger("component_id", component_id); + dict->SetInteger("component_id", component_id_); dict->SetInteger("component_type", component_); } @@ -662,8 +658,8 @@ base::string16 audio_stream_update; { base::AutoLock auto_lock(lock_); - audio_stream_update = SerializeUpdate( - "media.onReceiveAudioStreamData", &audio_streams_cached_data_); + audio_stream_update = SerializeUpdate("media.onReceiveAudioStreamData", + &audio_streams_cached_data_); } SendUpdate(audio_stream_update); } @@ -714,19 +710,24 @@ } std::unique_ptr<media::AudioLog> MediaInternals::CreateAudioLog( - AudioComponent component) { - base::AutoLock auto_lock(lock_); - return std::unique_ptr<media::AudioLog>( - new AudioLogImpl(owner_ids_[component]++, component, this)); + AudioComponent component, + int component_id) { + return std::make_unique<MojoAudioLogAdapter>( + CreateMojoAudioLog(component, component_id)); } -void MediaInternals::SetWebContentsTitleForAudioLogEntry( +media::mojom::AudioLogPtr MediaInternals::CreateMojoAudioLog( + media::AudioLogFactory::AudioComponent component, int component_id, int render_process_id, - int render_frame_id, - media::AudioLog* audio_log) { - static_cast<AudioLogImpl*>(audio_log) - ->SendWebContentsTitle(component_id, render_process_id, render_frame_id); + int render_frame_id) { + base::AutoLock auto_lock(lock_); + media::mojom::AudioLogPtr audio_log_ptr; + mojo::MakeStrongBinding(std::make_unique<AudioLogImpl>( + owner_ids_[component]++, component, this, + component_id, render_process_id, render_frame_id), + mojo::MakeRequest(&audio_log_ptr)); + return audio_log_ptr; } void MediaInternals::OnProcessTerminatedForTesting(int process_id) {
diff --git a/content/browser/media/media_internals.h b/content/browser/media/media_internals.h index 4a0fa4e..25b1085d 100644 --- a/content/browser/media/media_internals.h +++ b/content/browser/media/media_internals.h
@@ -7,6 +7,7 @@ #include <list> #include <map> +#include <memory> #include <string> #include <tuple> #include <vector> @@ -24,6 +25,7 @@ #include "media/base/media_log.h" #include "media/capture/video/video_capture_device_descriptor.h" #include "media/capture/video_capture_types.h" +#include "media/mojo/interfaces/audio_logging.mojom.h" namespace media { struct MediaLogEvent; @@ -32,6 +34,8 @@ namespace content { // This class stores information about currently active media. +// TODO(crbug.com/812557): Remove inheritance from media::AudioLogFactory once +// the creation of the AudioManager instance moves to the audio service. class CONTENT_EXPORT MediaInternals : public media::AudioLogFactory, public NotificationObserver { public: @@ -76,19 +80,17 @@ media::VideoCaptureFormats>>& descriptors_and_formats); - // AudioLogFactory implementation. Safe to call from any thread. - std::unique_ptr<media::AudioLog> CreateAudioLog( - AudioComponent component) override; + // media::AudioLogFactory implementation. Safe to call from any thread. + std::unique_ptr<media::AudioLog> CreateAudioLog(AudioComponent component, + int component_id) override; - // If possible, i.e. a WebContents exists for the given RenderFrameHostID, - // tells an existing AudioLogEntry the WebContents title for easier - // differentiation on the UI. Note that the log entry must be created (by - // calling OnCreated with |component_id| on |audio_log|) before calling this - // method. - void SetWebContentsTitleForAudioLogEntry(int component_id, - int render_process_id, - int render_frame_id, - media::AudioLog* audio_log); + // Creates a media::mojom::AudioLogPtr strongly bound to a new + // media::mojom::AudioLog instance. Safe to call from any thread. + media::mojom::AudioLogPtr CreateMojoAudioLog( + AudioComponent component, + int component_id, + int render_process_id = -1, + int render_frame_id = MSG_ROUTING_NONE); void OnProcessTerminatedForTesting(int process_id); @@ -136,7 +138,7 @@ base::Lock lock_; bool can_update_; base::DictionaryValue audio_streams_cached_data_; - int owner_ids_[AUDIO_COMPONENT_MAX]; + int owner_ids_[media::AudioLogFactory::AUDIO_COMPONENT_MAX]; std::unique_ptr<MediaInternalsUMAHandler> uma_handler_; DISALLOW_COPY_AND_ASSIGN(MediaInternals);
diff --git a/content/browser/media/media_internals_unittest.cc b/content/browser/media/media_internals_unittest.cc index 01363b8..f36be5c 100644 --- a/content/browser/media/media_internals_unittest.cc +++ b/content/browser/media/media_internals_unittest.cc
@@ -232,7 +232,8 @@ base::Unretained(this))), test_params_(MakeAudioParams()), test_component_(GetParam()), - audio_log_(media_internals_->CreateAudioLog(test_component_)) { + audio_log_(media_internals_->CreateAudioLog(test_component_, + kTestComponentID)) { media_internals_->AddUpdateCallback(update_cb_); } @@ -257,7 +258,7 @@ }; TEST_P(MediaInternalsAudioLogTest, AudioLogCreateStartStopErrorClose) { - audio_log_->OnCreated(kTestComponentID, test_params_, kTestDeviceID); + audio_log_->OnCreated(test_params_, kTestDeviceID); base::RunLoop().RunUntilIdle(); ExpectString("channel_layout", @@ -272,12 +273,12 @@ ExpectStatus("created"); // Verify OnStarted(). - audio_log_->OnStarted(kTestComponentID); + audio_log_->OnStarted(); base::RunLoop().RunUntilIdle(); ExpectStatus("started"); // Verify OnStopped(). - audio_log_->OnStopped(kTestComponentID); + audio_log_->OnStopped(); base::RunLoop().RunUntilIdle(); ExpectStatus("stopped"); @@ -285,22 +286,22 @@ const char kErrorKey[] = "error_occurred"; std::string no_value; ASSERT_FALSE(update_data_.GetString(kErrorKey, &no_value)); - audio_log_->OnError(kTestComponentID); + audio_log_->OnError(); base::RunLoop().RunUntilIdle(); ExpectString(kErrorKey, "true"); // Verify OnClosed(). - audio_log_->OnClosed(kTestComponentID); + audio_log_->OnClosed(); base::RunLoop().RunUntilIdle(); ExpectStatus("closed"); } TEST_P(MediaInternalsAudioLogTest, AudioLogCreateClose) { - audio_log_->OnCreated(kTestComponentID, test_params_, kTestDeviceID); + audio_log_->OnCreated(test_params_, kTestDeviceID); base::RunLoop().RunUntilIdle(); ExpectStatus("created"); - audio_log_->OnClosed(kTestComponentID); + audio_log_->OnClosed(); base::RunLoop().RunUntilIdle(); ExpectStatus("closed"); }
diff --git a/content/browser/media/mojo_audio_logging_adapter.cc b/content/browser/media/mojo_audio_logging_adapter.cc new file mode 100644 index 0000000..c3ee310 --- /dev/null +++ b/content/browser/media/mojo_audio_logging_adapter.cc
@@ -0,0 +1,49 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/media/mojo_audio_logging_adapter.h" + +#include <utility> + +#include "content/browser/media/media_internals.h" +#include "mojo/public/cpp/bindings/interface_request.h" +#include "mojo/public/cpp/bindings/strong_binding.h" + +namespace content { + +MojoAudioLogAdapter::MojoAudioLogAdapter(media::mojom::AudioLogPtr audio_log) + : audio_log_(std::move(audio_log)) {} + +MojoAudioLogAdapter::~MojoAudioLogAdapter() = default; + +void MojoAudioLogAdapter::OnCreated(const media::AudioParameters& params, + const std::string& device_id) { + audio_log_->OnCreated(params, device_id); +} + +void MojoAudioLogAdapter::OnStarted() { + audio_log_->OnStarted(); +} + +void MojoAudioLogAdapter::OnStopped() { + audio_log_->OnStopped(); +} + +void MojoAudioLogAdapter::OnClosed() { + audio_log_->OnClosed(); +} + +void MojoAudioLogAdapter::OnError() { + audio_log_->OnError(); +} + +void MojoAudioLogAdapter::OnSetVolume(double volume) { + audio_log_->OnSetVolume(volume); +} + +void MojoAudioLogAdapter::OnLogMessage(const std::string& message) { + audio_log_->OnLogMessage(message); +} + +} // namespace content
diff --git a/content/browser/media/mojo_audio_logging_adapter.h b/content/browser/media/mojo_audio_logging_adapter.h new file mode 100644 index 0000000..020d6244 --- /dev/null +++ b/content/browser/media/mojo_audio_logging_adapter.h
@@ -0,0 +1,45 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_MEDIA_MOJO_AUDIO_LOGGING_ADAPTER_H_ +#define CONTENT_BROWSER_MEDIA_MOJO_AUDIO_LOGGING_ADAPTER_H_ + +#include <map> +#include <string> + +#include "base/macros.h" +#include "base/sequence_checker.h" +#include "content/common/content_export.h" +#include "media/audio/audio_logging.h" +#include "media/mojo/interfaces/audio_logging.mojom.h" + +namespace content { + +// This class wraps a media::mojom::AudioLogPtr into a media::AudioLog. +// TODO(crbug.com/812557): Move this class to the audio service once the audio +// service is in charge of creating and owning the AudioManager. +class CONTENT_EXPORT MojoAudioLogAdapter : public media::AudioLog { + public: + explicit MojoAudioLogAdapter(media::mojom::AudioLogPtr audio_log); + ~MojoAudioLogAdapter() override; + + // media::AudioLog implementation. + void OnCreated(const media::AudioParameters& params, + const std::string& device_id) override; + void OnStarted() override; + void OnStopped() override; + void OnClosed() override; + void OnError() override; + void OnSetVolume(double volume) override; + void OnLogMessage(const std::string& message) override; + + private: + media::mojom::AudioLogPtr audio_log_; + + DISALLOW_COPY_AND_ASSIGN(MojoAudioLogAdapter); +}; + +} // namespace content + +#endif // CONTENT_BROWSER_MEDIA_MOJO_AUDIO_LOGGING_ADAPTER_H_
diff --git a/content/browser/notifications/platform_notification_context_impl.cc b/content/browser/notifications/platform_notification_context_impl.cc index 60d9514..823750bf 100644 --- a/content/browser/notifications/platform_notification_context_impl.cc +++ b/content/browser/notifications/platform_notification_context_impl.cc
@@ -60,7 +60,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&PlatformNotificationContextImpl::InitializeOnIO, this, - base::Passed(&displayed_notifications), false)); + std::move(displayed_notifications), false)); return; } @@ -77,7 +77,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&PlatformNotificationContextImpl::InitializeOnIO, this, - base::Passed(&displayed_notifications), + std::move(displayed_notifications), supports_synchronization)); } @@ -132,7 +132,7 @@ base::BindOnce(&PlatformNotificationContextImpl::CreateServiceOnIO, this, render_process_id, origin, browser_context_->GetResourceContext(), - base::Passed(&request))); + std::move(request))); } void PlatformNotificationContextImpl::CreateServiceOnIO( @@ -212,7 +212,7 @@ &PlatformNotificationContextImpl:: SynchronizeDisplayedNotificationsForServiceWorkerRegistrationOnIO, this, origin, service_worker_registration_id, callback, - base::Passed(¬ification_ids), supports_synchronization)); + std::move(notification_ids), supports_synchronization)); } void PlatformNotificationContextImpl::
diff --git a/content/browser/payments/payment_app_context_impl.cc b/content/browser/payments/payment_app_context_impl.cc index 8a2f059..c73d0ff 100644 --- a/content/browser/payments/payment_app_context_impl.cc +++ b/content/browser/payments/payment_app_context_impl.cc
@@ -45,7 +45,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&PaymentAppContextImpl::CreatePaymentManagerOnIO, this, - base::Passed(&request))); + std::move(request))); } void PaymentAppContextImpl::PaymentManagerHadConnectionError(
diff --git a/content/browser/payments/payment_app_database.cc b/content/browser/payments/payment_app_database.cc index 591053e..1069edc3 100644 --- a/content/browser/payments/payment_app_database.cc +++ b/content/browser/payments/payment_app_database.cc
@@ -207,8 +207,7 @@ icons, base::BindOnce(&PaymentAppDatabase::DidFetchedPaymentInstrumentIcon, weak_ptr_factory_.GetWeakPtr(), scope, instrument_key, - base::Passed(std::move(instrument)), - base::Passed(std::move(callback)))); + std::move(instrument), std::move(callback))); } else { service_worker_context_->FindReadyRegistrationForPattern( scope, @@ -413,7 +412,7 @@ registration_id, base::BindOnce(&PaymentAppDatabase::DidFindRegistrationToSetPaymentApp, weak_ptr_factory_.GetWeakPtr(), instrument_key, name, - enabled_methods, base::Passed(std::move(callback)))); + enabled_methods, std::move(callback))); } void PaymentAppDatabase::DidFindRegistrationToSetPaymentApp(
diff --git a/content/browser/payments/payment_app_provider_impl.cc b/content/browser/payments/payment_app_provider_impl.cc index e6b2f1ba..523d5c7 100644 --- a/content/browser/payments/payment_app_provider_impl.cc +++ b/content/browser/payments/payment_app_provider_impl.cc
@@ -193,9 +193,8 @@ void DidGetAllPaymentAppsOnIO( PaymentAppProvider::GetAllPaymentAppsCallback callback, PaymentAppProvider::PaymentApps apps) { - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::BindOnce(std::move(callback), base::Passed(std::move(apps)))); + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, + base::BindOnce(std::move(callback), std::move(apps))); } void GetAllPaymentAppsOnIO(
diff --git a/content/browser/permissions/permission_service_impl.cc b/content/browser/permissions/permission_service_impl.cc index 4954df4..8b9cede6 100644 --- a/content/browser/permissions/permission_service_impl.cc +++ b/content/browser/permissions/permission_service_impl.cc
@@ -116,7 +116,7 @@ permissions.push_back(std::move(permission)); RequestPermissions(std::move(permissions), user_gesture, base::BindOnce(&PermissionRequestResponseCallbackWrapper, - base::Passed(&callback))); + std::move(callback))); } void PermissionServiceImpl::RequestPermissions(
diff --git a/content/browser/push_messaging/push_messaging_manager.cc b/content/browser/push_messaging/push_messaging_manager.cc index 2dc71a60..396fbfc 100644 --- a/content/browser/push_messaging/push_messaging_manager.cc +++ b/content/browser/push_messaging/push_messaging_manager.cc
@@ -392,7 +392,7 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&Core::RegisterOnUI, base::Unretained(ui_core_.get()), - base::Passed(&data))); + std::move(data))); } else { // There is no existing registration and the sender_info passed in was // empty, but perhaps there is a stored sender id we can use. @@ -416,7 +416,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&PushMessagingManager::SendSubscriptionSuccess, - io_parent_, base::Passed(&data), + io_parent_, std::move(data), mojom::PushRegistrationStatus::SUCCESS_FROM_CACHE, push_subscription_id, p256dh, auth)); } else { @@ -428,7 +428,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&PushMessagingManager::SendSubscriptionError, - io_parent_, base::Passed(&data), + io_parent_, std::move(data), mojom::PushRegistrationStatus::RENDERER_SHUTDOWN)); return; } @@ -482,7 +482,7 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&Core::RegisterOnUI, base::Unretained(ui_core_.get()), - base::Passed(&data))); + std::move(data))); } void PushMessagingManager::Core::RegisterOnUI( @@ -497,7 +497,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&PushMessagingManager::SendSubscriptionError, - io_parent_, base::Passed(&data), + io_parent_, std::move(data), mojom::PushRegistrationStatus::SERVICE_NOT_AVAILABLE)); } else { // Prevent websites from detecting incognito mode, by emulating what would @@ -508,7 +508,7 @@ BrowserThread::IO, FROM_HERE, base::BindOnce( &PushMessagingManager::SendSubscriptionError, io_parent_, - base::Passed(&data), + std::move(data), mojom::PushRegistrationStatus::INCOGNITO_PERMISSION_DENIED)); } else { RenderFrameHost* render_frame_host = @@ -527,7 +527,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&PushMessagingManager::SendSubscriptionError, - io_parent_, base::Passed(&data), + io_parent_, std::move(data), mojom::PushRegistrationStatus:: INCOGNITO_PERMISSION_DENIED)); @@ -578,7 +578,7 @@ BrowserThread::IO, FROM_HERE, base::BindOnce( &PushMessagingManager::SendSubscriptionError, io_parent_, - base::Passed(&data), + std::move(data), mojom::PushRegistrationStatus::INCOGNITO_PERMISSION_DENIED)); } @@ -593,13 +593,13 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&PushMessagingManager::PersistRegistrationOnIO, - io_parent_, base::Passed(&data), push_registration_id, + io_parent_, std::move(data), push_registration_id, p256dh, auth)); } else { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&PushMessagingManager::SendSubscriptionError, io_parent_, - base::Passed(&data), status)); + std::move(data), status)); } } @@ -714,7 +714,7 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&Core::UnregisterFromService, - base::Unretained(ui_core_.get()), base::Passed(&callback), + base::Unretained(ui_core_.get()), std::move(callback), service_worker_registration_id, requesting_origin, sender_id)); } @@ -733,7 +733,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&PushMessagingManager::DidUnregister, io_parent_, - base::Passed(&callback), + std::move(callback), mojom::PushUnregistrationStatus::SERVICE_NOT_AVAILABLE)); return; } @@ -755,7 +755,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&PushMessagingManager::DidUnregister, io_parent_, - base::Passed(&callback), unregistration_status)); + std::move(callback), unregistration_status)); } void PushMessagingManager::DidUnregister(
diff --git a/content/browser/renderer_host/clipboard_host_impl.h b/content/browser/renderer_host/clipboard_host_impl.h index b7a4ec1..68c18c4c 100644 --- a/content/browser/renderer_host/clipboard_host_impl.h +++ b/content/browser/renderer_host/clipboard_host_impl.h
@@ -19,7 +19,7 @@ #include "content/common/content_export.h" #include "content/public/browser/browser_associated_interface.h" #include "content/public/browser/browser_message_filter.h" -#include "third_party/WebKit/common/clipboard/clipboard.mojom.h" +#include "third_party/WebKit/public/mojom/clipboard/clipboard.mojom.h" #include "ui/base/clipboard/clipboard.h" class GURL;
diff --git a/content/browser/renderer_host/media/audio_input_delegate_impl.cc b/content/browser/renderer_host/media/audio_input_delegate_impl.cc index 46e0e23..1761500 100644 --- a/content/browser/renderer_host/media/audio_input_delegate_impl.cc +++ b/content/browser/renderer_host/media/audio_input_delegate_impl.cc
@@ -107,7 +107,7 @@ int render_process_id, int render_frame_id, AudioInputDeviceManager* audio_input_device_manager, - media::AudioLog* audio_log, + media::mojom::AudioLogPtr audio_log, AudioInputDeviceManager::KeyboardMicRegistration keyboard_mic_registration, uint32_t shared_memory_count, int stream_id, @@ -152,10 +152,9 @@ return base::WrapUnique(new AudioInputDelegateImpl( audio_manager, mirroring_manager, user_input_monitor, - possibly_modified_parameters, render_process_id, render_frame_id, - audio_log, std::move(keyboard_mic_registration), stream_id, - automatic_gain_control, subscriber, device, std::move(writer), - std::move(foreign_socket))); + possibly_modified_parameters, render_process_id, std::move(audio_log), + std::move(keyboard_mic_registration), stream_id, automatic_gain_control, + subscriber, device, std::move(writer), std::move(foreign_socket))); } AudioInputDelegateImpl::AudioInputDelegateImpl( @@ -164,8 +163,7 @@ media::UserInputMonitor* user_input_monitor, const media::AudioParameters& audio_parameters, int render_process_id, - int render_frame_id, - media::AudioLog* audio_log, + media::mojom::AudioLogPtr audio_log, AudioInputDeviceManager::KeyboardMicRegistration keyboard_mic_registration, int stream_id, bool automatic_gain_control, @@ -177,7 +175,7 @@ controller_event_handler_(), writer_(std::move(writer)), foreign_socket_(std::move(foreign_socket)), - audio_log_(audio_log), + audio_log_(std::move(audio_log)), controller_(), keyboard_mic_registration_(std::move(keyboard_mic_registration)), stream_id_(stream_id), @@ -225,14 +223,12 @@ } DCHECK(controller_); - audio_log_->OnCreated(stream_id, audio_parameters, device_id); - MediaInternals::GetInstance()->SetWebContentsTitleForAudioLogEntry( - stream_id, render_process_id_, render_frame_id, audio_log_); + audio_log_->OnCreated(audio_parameters, device_id); } AudioInputDelegateImpl::~AudioInputDelegateImpl() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - audio_log_->OnClosed(stream_id_); + audio_log_->OnClosed(); LogMessage(stream_id_, "Closing stream"); BrowserThread::PostTask( @@ -258,7 +254,7 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); LogMessage(stream_id_, "OnRecordStream"); controller_->Record(); - audio_log_->OnStarted(stream_id_); + audio_log_->OnStarted(); } void AudioInputDelegateImpl::OnSetVolume(double volume) { @@ -266,7 +262,7 @@ DCHECK_GE(volume, 0); DCHECK_LE(volume, 1); controller_->SetVolume(volume); - audio_log_->OnSetVolume(stream_id_, volume); + audio_log_->OnSetVolume(volume); } void AudioInputDelegateImpl::SendCreatedNotification(bool initially_muted) { @@ -283,7 +279,7 @@ void AudioInputDelegateImpl::OnError() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - audio_log_->OnError(stream_id_); + audio_log_->OnError(); subscriber_->OnStreamError(stream_id_); }
diff --git a/content/browser/renderer_host/media/audio_input_delegate_impl.h b/content/browser/renderer_host/media/audio_input_delegate_impl.h index b0cdaf0..76812c8 100644 --- a/content/browser/renderer_host/media/audio_input_delegate_impl.h +++ b/content/browser/renderer_host/media/audio_input_delegate_impl.h
@@ -13,9 +13,9 @@ #include "content/browser/renderer_host/media/audio_input_device_manager.h" #include "content/common/content_export.h" #include "media/audio/audio_input_delegate.h" +#include "media/mojo/interfaces/audio_logging.mojom.h" namespace media { -class AudioLog; class AudioManager; class AudioInputController; class AudioInputSyncWriter; @@ -43,7 +43,7 @@ int render_process_id, int render_frame_id, AudioInputDeviceManager* audio_input_device_manager, - media::AudioLog* audio_log, + media::mojom::AudioLogPtr audio_log, AudioInputDeviceManager::KeyboardMicRegistration keyboard_mic_registration, uint32_t shared_memory_count, @@ -65,8 +65,7 @@ media::UserInputMonitor* user_input_monitor, const media::AudioParameters& audio_parameters, int render_process_id, - int render_frame_id, - media::AudioLog* audio_log, + media::mojom::AudioLogPtr audio_log, AudioInputDeviceManager::KeyboardMicRegistration keyboard_mic_registration, int stream_id, @@ -91,7 +90,7 @@ std::unique_ptr<ControllerEventHandler> controller_event_handler_; std::unique_ptr<media::AudioInputSyncWriter> writer_; std::unique_ptr<base::CancelableSyncSocket> foreign_socket_; - media::AudioLog* const audio_log_; + media::mojom::AudioLogPtr const audio_log_; scoped_refptr<media::AudioInputController> controller_; const AudioInputDeviceManager::KeyboardMicRegistration keyboard_mic_registration_;
diff --git a/content/browser/renderer_host/media/audio_input_delegate_impl_unittest.cc b/content/browser/renderer_host/media/audio_input_delegate_impl_unittest.cc index 03fd04f..47e404a 100644 --- a/content/browser/renderer_host/media/audio_input_delegate_impl_unittest.cc +++ b/content/browser/renderer_host/media/audio_input_delegate_impl_unittest.cc
@@ -146,9 +146,7 @@ : thread_bundle_(base::in_place), audio_manager_(std::make_unique<media::TestAudioThread>()), audio_system_(&audio_manager_), - media_stream_manager_(&audio_system_, audio_manager_.GetTaskRunner()), - audio_log_(MediaInternals::GetInstance()->CreateAudioLog( - media::AudioLogFactory::AUDIO_INPUT_CONTROLLER)) { + media_stream_manager_(&audio_system_, audio_manager_.GetTaskRunner()) { audio_manager_.SetMakeInputStreamCB( base::BindRepeating(&ExpectNoInputStreamCreation)); audio_manager_.SetMakeOutputStreamCB( @@ -180,7 +178,9 @@ return AudioInputDelegateImpl::Create( &audio_manager_, AudioMirroringManager::GetInstance(), &user_input_monitor_, kRenderProcessId, kRenderFrameId, - media_stream_manager_.audio_input_device_manager(), audio_log_.get(), + media_stream_manager_.audio_input_device_manager(), + MediaInternals::GetInstance()->CreateMojoAudioLog( + media::AudioLogFactory::AUDIO_INPUT_CONTROLLER, kStreamId), AudioInputDeviceManager::KeyboardMicRegistration(), shared_memory_count, kStreamId, session_id, enable_agc, ValidAudioParameters(), &event_handler_); @@ -192,7 +192,6 @@ MediaStreamManager media_stream_manager_; NiceMock<MockUserInputMonitor> user_input_monitor_; StrictMock<MockEventHandler> event_handler_; - std::unique_ptr<media::AudioLog> audio_log_; private: DISALLOW_COPY_AND_ASSIGN(AudioInputDelegateTest);
diff --git a/content/browser/renderer_host/media/audio_input_renderer_host.cc b/content/browser/renderer_host/media/audio_input_renderer_host.cc index 0d40319..227de774 100644 --- a/content/browser/renderer_host/media/audio_input_renderer_host.cc +++ b/content/browser/renderer_host/media/audio_input_renderer_host.cc
@@ -47,9 +47,7 @@ audio_manager_(audio_manager), media_stream_manager_(media_stream_manager), audio_mirroring_manager_(audio_mirroring_manager), - user_input_monitor_(user_input_monitor), - audio_log_(MediaInternals::GetInstance()->CreateAudioLog( - media::AudioLogFactory::AUDIO_INPUT_CONTROLLER)) {} + user_input_monitor_(user_input_monitor) {} AudioInputRendererHost::~AudioInputRendererHost() { DCHECK_CURRENTLY_ON(BrowserThread::IO); @@ -176,14 +174,19 @@ return; } + media::mojom::AudioLogPtr audio_log_ptr = + MediaInternals::GetInstance()->CreateMojoAudioLog( + media::AudioLogFactory::AUDIO_INPUT_CONTROLLER, stream_id, + render_process_id_, render_frame_id); + std::unique_ptr<media::AudioInputDelegate> delegate = AudioInputDelegateImpl::Create( audio_manager_, audio_mirroring_manager_, user_input_monitor_, render_process_id_, render_frame_id, - media_stream_manager_->audio_input_device_manager(), audio_log_.get(), - std::move(keyboard_mic_registration), config.shared_memory_count, - stream_id, session_id, config.automatic_gain_control, config.params, - this); + media_stream_manager_->audio_input_device_manager(), + std::move(audio_log_ptr), std::move(keyboard_mic_registration), + config.shared_memory_count, stream_id, session_id, + config.automatic_gain_control, config.params, this); if (!delegate) { // Error was logged by AudioInputDelegateImpl::Create.
diff --git a/content/browser/renderer_host/media/audio_input_renderer_host.h b/content/browser/renderer_host/media/audio_input_renderer_host.h index dd37e0a2..72a0778d 100644 --- a/content/browser/renderer_host/media/audio_input_renderer_host.h +++ b/content/browser/renderer_host/media/audio_input_renderer_host.h
@@ -38,7 +38,6 @@ namespace media { class AudioManager; -class AudioLog; class UserInputMonitor; } @@ -193,8 +192,6 @@ // Raw pointer of the UserInputMonitor. media::UserInputMonitor* const user_input_monitor_; - std::unique_ptr<media::AudioLog> audio_log_; - // A map of stream IDs to audio sources. AudioInputDelegateMap delegates_;
diff --git a/content/browser/renderer_host/media/audio_output_delegate_impl.cc b/content/browser/renderer_host/media/audio_output_delegate_impl.cc index fdb523a2..98e7b64e2 100644 --- a/content/browser/renderer_host/media/audio_output_delegate_impl.cc +++ b/content/browser/renderer_host/media/audio_output_delegate_impl.cc
@@ -99,7 +99,7 @@ std::unique_ptr<media::AudioOutputDelegate> AudioOutputDelegateImpl::Create( EventHandler* handler, media::AudioManager* audio_manager, - media::AudioLog* audio_log, + media::mojom::AudioLogPtr audio_log, AudioMirroringManager* mirroring_manager, MediaObserver* media_observer, int stream_id, @@ -116,9 +116,10 @@ return nullptr; return std::make_unique<AudioOutputDelegateImpl>( - std::move(reader), std::move(socket), handler, audio_manager, audio_log, - mirroring_manager, media_observer, stream_id, render_frame_id, - render_process_id, params, std::move(observer), output_device_id); + std::move(reader), std::move(socket), handler, audio_manager, + std::move(audio_log), mirroring_manager, media_observer, stream_id, + render_frame_id, render_process_id, params, std::move(observer), + output_device_id); } AudioOutputDelegateImpl::AudioOutputDelegateImpl( @@ -126,7 +127,7 @@ std::unique_ptr<base::CancelableSyncSocket> foreign_socket, EventHandler* handler, media::AudioManager* audio_manager, - media::AudioLog* audio_log, + media::mojom::AudioLogPtr audio_log, AudioMirroringManager* mirroring_manager, MediaObserver* media_observer, int stream_id, @@ -136,7 +137,7 @@ media::mojom::AudioOutputStreamObserverPtr observer, const std::string& output_device_id) : subscriber_(handler), - audio_log_(audio_log), + audio_log_(std::move(audio_log)), reader_(std::move(reader)), foreign_socket_(std::move(foreign_socket)), mirroring_manager_(mirroring_manager), @@ -170,7 +171,7 @@ AudioOutputDelegateImpl::~AudioOutputDelegateImpl() { DCHECK_CURRENTLY_ON(BrowserThread::IO); UpdatePlayingState(false); - audio_log_->OnClosed(stream_id_); + audio_log_->OnClosed(); // Since the ownership of |controller_| is shared, we instead use its Close // method to stop callbacks from it. |controller_| will call the closure (on @@ -195,8 +196,8 @@ // removed. mirroring_manager->RemoveDiverter(controller.get()); }, - mirroring_manager_, base::Passed(&controller_event_handler_), - base::Passed(&reader_), controller_)); + mirroring_manager_, std::move(controller_event_handler_), + std::move(reader_), controller_)); } int AudioOutputDelegateImpl::GetStreamId() { @@ -206,13 +207,13 @@ void AudioOutputDelegateImpl::OnPlayStream() { DCHECK_CURRENTLY_ON(BrowserThread::IO); controller_->Play(); - audio_log_->OnStarted(stream_id_); + audio_log_->OnStarted(); } void AudioOutputDelegateImpl::OnPauseStream() { DCHECK_CURRENTLY_ON(BrowserThread::IO); controller_->Pause(); - audio_log_->OnStopped(stream_id_); + audio_log_->OnStopped(); } void AudioOutputDelegateImpl::OnSetVolume(double volume) { @@ -220,7 +221,7 @@ DCHECK_GE(volume, 0); DCHECK_LE(volume, 1); controller_->SetVolume(volume); - audio_log_->OnSetVolume(stream_id_, volume); + audio_log_->OnSetVolume(volume); } void AudioOutputDelegateImpl::SendCreatedNotification() { @@ -263,7 +264,7 @@ void AudioOutputDelegateImpl::OnError() { DCHECK_CURRENTLY_ON(BrowserThread::IO); - audio_log_->OnError(stream_id_); + audio_log_->OnError(); subscriber_->OnStreamError(stream_id_); }
diff --git a/content/browser/renderer_host/media/audio_output_delegate_impl.h b/content/browser/renderer_host/media/audio_output_delegate_impl.h index 9002594..dae9af1 100644 --- a/content/browser/renderer_host/media/audio_output_delegate_impl.h +++ b/content/browser/renderer_host/media/audio_output_delegate_impl.h
@@ -12,6 +12,7 @@ #include "base/memory/weak_ptr.h" #include "content/common/content_export.h" #include "media/audio/audio_output_delegate.h" +#include "media/mojo/interfaces/audio_logging.mojom.h" #include "media/mojo/interfaces/audio_output_stream.mojom.h" namespace content { @@ -20,7 +21,6 @@ } namespace media { -class AudioLog; class AudioManager; class AudioOutputController; class AudioParameters; @@ -37,7 +37,7 @@ static std::unique_ptr<AudioOutputDelegate> Create( EventHandler* handler, media::AudioManager* audio_manager, - media::AudioLog* audio_log, + media::mojom::AudioLogPtr audio_log, AudioMirroringManager* mirroring_manager, MediaObserver* media_observer, int stream_id, @@ -52,7 +52,7 @@ std::unique_ptr<base::CancelableSyncSocket> foreign_socket, EventHandler* handler, media::AudioManager* audio_manager, - media::AudioLog* audio_log, + media::mojom::AudioLogPtr audio_log, AudioMirroringManager* mirroring_manager, MediaObserver* media_observer, int stream_id, @@ -83,7 +83,7 @@ // This is the event handler which |this| send notifications to. EventHandler* subscriber_; - media::AudioLog* const audio_log_; + const media::mojom::AudioLogPtr audio_log_; // |controller_event_handler_| proxies events from controller to |this|. // |controller_event_handler_|, |reader_| and |mirroring_manager_| will // outlive |this|, see the destructor for details.
diff --git a/content/browser/renderer_host/media/audio_output_delegate_impl_unittest.cc b/content/browser/renderer_host/media/audio_output_delegate_impl_unittest.cc index 4a514d2..f43a1499 100644 --- a/content/browser/renderer_host/media/audio_output_delegate_impl_unittest.cc +++ b/content/browser/renderer_host/media/audio_output_delegate_impl_unittest.cc
@@ -118,6 +118,28 @@ MOCK_METHOD1(DidChangeAudibleState, void(bool)); }; +class DummyMojoAudioLogImpl : public media::mojom::AudioLog { + public: + DummyMojoAudioLogImpl() = default; + ~DummyMojoAudioLogImpl() override = default; + + void OnCreated(const media::AudioParameters& params, + const std::string& device_id) override {} + void OnStarted() override {} + void OnStopped() override {} + void OnClosed() override {} + void OnError() override {} + void OnSetVolume(double volume) override {} + void OnLogMessage(const std::string& message) override {} +}; + +media::mojom::AudioLogPtr CreateDummyMojoAudioLog() { + media::mojom::AudioLogPtr audio_log_ptr; + mojo::MakeStrongBinding(std::make_unique<DummyMojoAudioLogImpl>(), + mojo::MakeRequest(&audio_log_ptr)); + return audio_log_ptr; +} + } // namespace class AudioOutputDelegateTest : public testing::Test { @@ -135,8 +157,6 @@ audio_manager_.reset(new media::FakeAudioManager( std::make_unique<media::AudioThreadImpl>(), &log_factory_)); - audio_log_ = log_factory_.CreateAudioLog( - media::AudioLogFactory::AUDIO_OUTPUT_CONTROLLER); } ~AudioOutputDelegateTest() { audio_manager_->Shutdown(); } @@ -174,11 +194,9 @@ Params(), socket.get()); AudioOutputDelegateImpl delegate( std::move(reader), std::move(socket), &event_handler_, - audio_manager_.get(), audio_log_.get(), - - &mirroring_manager_, &media_observer_, kStreamId, kRenderFrameId, - kRenderProcessId, Params(), std::move(observer_ptr), - kDefaultDeviceId); + audio_manager_.get(), CreateDummyMojoAudioLog(), &mirroring_manager_, + &media_observer_, kStreamId, kRenderFrameId, kRenderProcessId, + Params(), std::move(observer_ptr), kDefaultDeviceId); SyncWithAllThreads(); @@ -217,11 +235,9 @@ AudioOutputDelegateImpl delegate( std::move(reader), std::move(socket), &event_handler_, - audio_manager_.get(), audio_log_.get(), - - &mirroring_manager_, &media_observer_, kStreamId, kRenderFrameId, - kRenderProcessId, Params(), std::move(observer_ptr), - kDefaultDeviceId); + audio_manager_.get(), CreateDummyMojoAudioLog(), &mirroring_manager_, + &media_observer_, kStreamId, kRenderFrameId, kRenderProcessId, + Params(), std::move(observer_ptr), kDefaultDeviceId); if (!use_bound_observer) observer_binding->Close(); @@ -253,11 +269,9 @@ Params(), socket.get()); AudioOutputDelegateImpl delegate( std::move(reader), std::move(socket), &event_handler_, - audio_manager_.get(), audio_log_.get(), - - &mirroring_manager_, &media_observer_, kStreamId, kRenderFrameId, - kRenderProcessId, Params(), std::move(observer_ptr), - kDefaultDeviceId); + audio_manager_.get(), CreateDummyMojoAudioLog(), &mirroring_manager_, + &media_observer_, kStreamId, kRenderFrameId, kRenderProcessId, + Params(), std::move(observer_ptr), kDefaultDeviceId); delegate.OnPauseStream(); @@ -290,11 +304,9 @@ AudioOutputDelegateImpl delegate( std::move(reader), std::move(socket), &event_handler_, - audio_manager_.get(), audio_log_.get(), - - &mirroring_manager_, &media_observer_, kStreamId, kRenderFrameId, - kRenderProcessId, Params(), std::move(observer_ptr), - kDefaultDeviceId); + audio_manager_.get(), CreateDummyMojoAudioLog(), &mirroring_manager_, + &media_observer_, kStreamId, kRenderFrameId, kRenderProcessId, + Params(), std::move(observer_ptr), kDefaultDeviceId); delegate.OnPlayStream(); delegate.OnPauseStream(); @@ -327,11 +339,9 @@ AudioOutputDelegateImpl delegate( std::move(reader), std::move(socket), &event_handler_, - audio_manager_.get(), audio_log_.get(), - - &mirroring_manager_, &media_observer_, kStreamId, kRenderFrameId, - kRenderProcessId, Params(), std::move(observer_ptr), - kDefaultDeviceId); + audio_manager_.get(), CreateDummyMojoAudioLog(), &mirroring_manager_, + &media_observer_, kStreamId, kRenderFrameId, kRenderProcessId, + Params(), std::move(observer_ptr), kDefaultDeviceId); delegate.OnPlayStream(); delegate.OnPlayStream(); @@ -362,11 +372,9 @@ Params(), socket.get()); AudioOutputDelegateImpl delegate( std::move(reader), std::move(socket), &event_handler_, - audio_manager_.get(), audio_log_.get(), - - &mirroring_manager_, &media_observer_, kStreamId, kRenderFrameId, - kRenderProcessId, Params(), std::move(observer_ptr), - kDefaultDeviceId); + audio_manager_.get(), CreateDummyMojoAudioLog(), &mirroring_manager_, + &media_observer_, kStreamId, kRenderFrameId, kRenderProcessId, + Params(), std::move(observer_ptr), kDefaultDeviceId); delegate.GetControllerForTesting()->StartDiverting(&stream); @@ -392,10 +400,9 @@ Params(), socket.get()); AudioOutputDelegateImpl delegate( std::move(reader), std::move(socket), &event_handler_, - audio_manager_.get(), audio_log_.get(), - - &mirroring_manager_, &media_observer_, kStreamId, kRenderFrameId, - kRenderProcessId, Params(), nullptr, kDefaultDeviceId); + audio_manager_.get(), CreateDummyMojoAudioLog(), &mirroring_manager_, + &media_observer_, kStreamId, kRenderFrameId, kRenderProcessId, + Params(), nullptr, kDefaultDeviceId); delegate.GetControllerForTesting()->StartDiverting(&stream); @@ -429,11 +436,9 @@ Params(), socket.get()); AudioOutputDelegateImpl delegate( std::move(reader), std::move(socket), &event_handler_, - audio_manager_.get(), audio_log_.get(), - - &mirroring_manager_, &media_observer_, kStreamId, kRenderFrameId, - kRenderProcessId, Params(), std::move(observer_ptr), - kDefaultDeviceId); + audio_manager_.get(), CreateDummyMojoAudioLog(), &mirroring_manager_, + &media_observer_, kStreamId, kRenderFrameId, kRenderProcessId, + Params(), std::move(observer_ptr), kDefaultDeviceId); delegate.OnPlayStream(); delegate.GetControllerForTesting()->StartDiverting(&stream); @@ -471,7 +476,7 @@ Params(), socket.get()); auto delegate = std::make_unique<AudioOutputDelegateImpl>( std::move(reader), std::move(socket), &event_handler_, - audio_manager_.get(), audio_log_.get(), &mirroring_manager_, + audio_manager_.get(), CreateDummyMojoAudioLog(), &mirroring_manager_, &media_observer_, kStreamId, kRenderFrameId, kRenderProcessId, Params(), std::move(observer_ptr), kDefaultDeviceId); @@ -504,7 +509,7 @@ Params(), socket.get()); AudioOutputDelegateImpl delegate( std::move(reader), std::move(socket), &event_handler_, - audio_manager_.get(), audio_log_.get(), &mirroring_manager_, + audio_manager_.get(), CreateDummyMojoAudioLog(), &mirroring_manager_, &media_observer_, kStreamId, kRenderFrameId, kRenderProcessId, Params(), std::move(observer_ptr), kDefaultDeviceId); } @@ -530,11 +535,9 @@ Params(), socket.get()); AudioOutputDelegateImpl delegate( std::move(reader), std::move(socket), &event_handler_, - audio_manager_.get(), audio_log_.get(), - - &mirroring_manager_, &media_observer_, kStreamId, kRenderFrameId, - kRenderProcessId, Params(), std::move(observer_ptr), - kDefaultDeviceId); + audio_manager_.get(), CreateDummyMojoAudioLog(), &mirroring_manager_, + &media_observer_, kStreamId, kRenderFrameId, kRenderProcessId, + Params(), std::move(observer_ptr), kDefaultDeviceId); SyncWithAllThreads(); @@ -562,11 +565,9 @@ Params(), socket.get()); AudioOutputDelegateImpl delegate( std::move(reader), std::move(socket), &event_handler_, - audio_manager_.get(), audio_log_.get(), - - &mirroring_manager_, &media_observer_, kStreamId, kRenderFrameId, - kRenderProcessId, Params(), std::move(observer_ptr), - kDefaultDeviceId); + audio_manager_.get(), CreateDummyMojoAudioLog(), &mirroring_manager_, + &media_observer_, kStreamId, kRenderFrameId, kRenderProcessId, + Params(), std::move(observer_ptr), kDefaultDeviceId); SyncWithAllThreads(); delegate.GetControllerForTesting()->OnError(); @@ -582,7 +583,6 @@ StrictMock<MockEventHandler> event_handler_; StrictMock<MockObserver> media_observer_; media::FakeAudioLogFactory log_factory_; - std::unique_ptr<media::AudioLog> audio_log_; private: void SyncWithAllThreads() {
diff --git a/content/browser/renderer_host/media/audio_renderer_host.cc b/content/browser/renderer_host/media/audio_renderer_host.cc index 8ff03ee..95603242 100644 --- a/content/browser/renderer_host/media/audio_renderer_host.cc +++ b/content/browser/renderer_host/media/audio_renderer_host.cc
@@ -30,6 +30,7 @@ #include "media/audio/audio_logging.h" #include "media/base/audio_bus.h" #include "media/base/limits.h" +#include "media/mojo/interfaces/audio_logging.mojom.h" #include "media/mojo/interfaces/audio_output_stream.mojom.h" #include "mojo/public/cpp/bindings/strong_binding.h" @@ -69,11 +70,8 @@ media_stream_manager_(media_stream_manager), authorization_handler_(audio_system, media_stream_manager, - render_process_id_), - audio_log_(MediaInternals::GetInstance()->CreateAudioLog( - media::AudioLogFactory::AUDIO_OUTPUT_CONTROLLER)) { + render_process_id_) { DCHECK(audio_manager_); - DCHECK(audio_log_); } AudioRendererHost::~AudioRendererHost() { @@ -286,16 +284,19 @@ MediaObserver* const media_observer = GetContentClient()->browser()->GetMediaObserver(); - audio_log_->OnCreated(stream_id, params, device_unique_id); - MediaInternals::GetInstance()->SetWebContentsTitleForAudioLogEntry( - stream_id, render_process_id_, render_frame_id, audio_log_.get()); - media::mojom::AudioOutputStreamObserverPtr observer_ptr; + media::mojom::AudioLogPtr audio_log_ptr = + MediaInternals::GetInstance()->CreateMojoAudioLog( + media::AudioLogFactory::AUDIO_OUTPUT_CONTROLLER, stream_id, + render_process_id_, render_frame_id); + audio_log_ptr->OnCreated(params, device_unique_id); + media::mojom::AudioOutputStreamObserverPtr observer_ptr; mojo::MakeStrongBinding(std::make_unique<AudioOutputStreamObserverImpl>( render_process_id_, render_frame_id, stream_id), mojo::MakeRequest(&observer_ptr)); + auto delegate = AudioOutputDelegateImpl::Create( - this, audio_manager_, audio_log_.get(), mirroring_manager_, + this, audio_manager_, std::move(audio_log_ptr), mirroring_manager_, media_observer, stream_id, render_frame_id, render_process_id_, params, std::move(observer_ptr), device_unique_id); if (delegate)
diff --git a/content/browser/renderer_host/media/audio_renderer_host.h b/content/browser/renderer_host/media/audio_renderer_host.h index 1c05483..f9506bf 100644 --- a/content/browser/renderer_host/media/audio_renderer_host.h +++ b/content/browser/renderer_host/media/audio_renderer_host.h
@@ -58,7 +58,6 @@ } namespace media { -class AudioLog; class AudioManager; class AudioParameters; class AudioSystem; @@ -200,8 +199,6 @@ AudioOutputAuthorizationHandler authorization_handler_; - const std::unique_ptr<media::AudioLog> audio_log_; - // A list of the current open streams. AudioOutputDelegateVector delegates_;
diff --git a/content/browser/renderer_host/media/in_process_launched_video_capture_device.cc b/content/browser/renderer_host/media/in_process_launched_video_capture_device.cc index cd18e8e..cb2cbf641 100644 --- a/content/browser/renderer_host/media/in_process_launched_video_capture_device.cc +++ b/content/browser/renderer_host/media/in_process_launched_video_capture_device.cc
@@ -53,7 +53,7 @@ device_task_runner_->PostTask( FROM_HERE, base::BindOnce(&media::VideoCaptureDevice::GetPhotoState, - base::Unretained(device_.get()), base::Passed(&callback))); + base::Unretained(device_.get()), std::move(callback))); } void InProcessLaunchedVideoCaptureDevice::SetPhotoOptions( @@ -64,10 +64,9 @@ // was scheduled for shutdown and destruction, and because this task is // guaranteed to run before the task that destroys the |device|. device_task_runner_->PostTask( - FROM_HERE, - base::BindOnce(&media::VideoCaptureDevice::SetPhotoOptions, - base::Unretained(device_.get()), base::Passed(&settings), - base::Passed(&callback))); + FROM_HERE, base::BindOnce(&media::VideoCaptureDevice::SetPhotoOptions, + base::Unretained(device_.get()), + std::move(settings), std::move(callback))); } void InProcessLaunchedVideoCaptureDevice::TakePhoto( @@ -79,7 +78,7 @@ device_task_runner_->PostTask( FROM_HERE, base::BindOnce(&media::VideoCaptureDevice::TakePhoto, - base::Unretained(device_.get()), base::Passed(&callback))); + base::Unretained(device_.get()), std::move(callback))); } void InProcessLaunchedVideoCaptureDevice::MaybeSuspendDevice() { @@ -123,7 +122,7 @@ FROM_HERE, base::BindOnce(&InProcessLaunchedVideoCaptureDevice:: SetDesktopCaptureWindowIdOnDeviceThread, base::Unretained(this), device_.get(), - window_id, base::Passed(&done_cb))); + window_id, std::move(done_cb))); } void InProcessLaunchedVideoCaptureDevice::OnUtilizationReport(
diff --git a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc index 0d03c5e..934e7ba 100644 --- a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc +++ b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
@@ -94,10 +94,9 @@ base::OnceClosure start_capture_closure; // Use of Unretained |this| is safe, because |done_cb| guarantees that |this| // stays alive. - ReceiveDeviceCallback after_start_capture_callback = - media::BindToCurrentLoop(base::BindOnce( - &InProcessVideoCaptureDeviceLauncher::OnDeviceStarted, - base::Unretained(this), callbacks, base::Passed(&done_cb))); + ReceiveDeviceCallback after_start_capture_callback = media::BindToCurrentLoop( + base::BindOnce(&InProcessVideoCaptureDeviceLauncher::OnDeviceStarted, + base::Unretained(this), callbacks, std::move(done_cb))); switch (stream_type) { case MEDIA_DEVICE_VIDEO_CAPTURE: { @@ -108,14 +107,13 @@ NOTREACHED(); return; } - start_capture_closure = - base::BindOnce(&InProcessVideoCaptureDeviceLauncher:: - DoStartDeviceCaptureOnDeviceThread, - base::Unretained(this), device_id, params, - base::Passed(CreateDeviceClient( - kMaxNumberOfBuffers, std::move(receiver), - std::move(receiver_on_io_thread))), - std::move(after_start_capture_callback)); + start_capture_closure = base::BindOnce( + &InProcessVideoCaptureDeviceLauncher:: + DoStartDeviceCaptureOnDeviceThread, + base::Unretained(this), device_id, params, + CreateDeviceClient(kMaxNumberOfBuffers, std::move(receiver), + std::move(receiver_on_io_thread)), + std::move(after_start_capture_callback)); break; } @@ -156,14 +154,13 @@ break; } #endif // !defined(OS_ANDROID) - start_capture_closure = - base::BindOnce(&InProcessVideoCaptureDeviceLauncher:: - DoStartDesktopCaptureOnDeviceThread, - base::Unretained(this), desktop_id, params, - base::Passed(CreateDeviceClient( - kMaxNumberOfBuffers, std::move(receiver), - std::move(receiver_on_io_thread))), - std::move(after_start_capture_callback)); + start_capture_closure = base::BindOnce( + &InProcessVideoCaptureDeviceLauncher:: + DoStartDesktopCaptureOnDeviceThread, + base::Unretained(this), desktop_id, params, + CreateDeviceClient(kMaxNumberOfBuffers, std::move(receiver), + std::move(receiver_on_io_thread)), + std::move(after_start_capture_callback)); break; } #endif // defined(ENABLE_SCREEN_CAPTURE)
diff --git a/content/browser/renderer_host/media/media_devices_dispatcher_host.cc b/content/browser/renderer_host/media/media_devices_dispatcher_host.cc index 056390f..dbb2070 100644 --- a/content/browser/renderer_host/media/media_devices_dispatcher_host.cc +++ b/content/browser/renderer_host/media/media_devices_dispatcher_host.cc
@@ -150,8 +150,7 @@ ->salt_and_origin_callback(), render_process_id_, render_frame_id_), base::BindOnce(&MediaDevicesDispatcherHost::GetDefaultVideoInputDeviceID, - weak_factory_.GetWeakPtr(), - base::Passed(&client_callback))); + weak_factory_.GetWeakPtr(), std::move(client_callback))); } void MediaDevicesDispatcherHost::GetAllVideoInputDeviceFormats( @@ -178,8 +177,7 @@ ->salt_and_origin_callback(), render_process_id_, render_frame_id_), base::BindOnce(&MediaDevicesDispatcherHost::GetDefaultAudioInputDeviceID, - weak_factory_.GetWeakPtr(), - base::Passed(&client_callback))); + weak_factory_.GetWeakPtr(), std::move(client_callback))); } void MediaDevicesDispatcherHost::AddMediaDevicesListener( @@ -284,7 +282,7 @@ render_process_id_, render_frame_id_), base::BindOnce( &MediaDevicesDispatcherHost::EnumerateVideoDevicesForFormats, - weak_factory_.GetWeakPtr(), base::Passed(&client_callback), device_id, + weak_factory_.GetWeakPtr(), std::move(client_callback), device_id, try_in_use_first)); }
diff --git a/content/browser/renderer_host/media/media_devices_manager.cc b/content/browser/renderer_host/media/media_devices_manager.cc index 9511c1c..dd6e6b11 100644 --- a/content/browser/renderer_host/media/media_devices_manager.cc +++ b/content/browser/renderer_host/media/media_devices_manager.cc
@@ -268,7 +268,7 @@ base::BindOnce(&MediaDevicesManager::CheckPermissionsForEnumerateDevices, weak_factory_.GetWeakPtr(), render_process_id, render_frame_id, group_id_salt_base, requested_types, - base::Passed(&callback))); + std::move(callback))); } uint32_t MediaDevicesManager::SubscribeDeviceChangeNotifications( @@ -418,7 +418,7 @@ requested_types, render_process_id, render_frame_id, base::BindOnce(&MediaDevicesManager::OnPermissionsCheckDone, weak_factory_.GetWeakPtr(), group_id_salt_base, - requested_types, base::Passed(&callback), + requested_types, std::move(callback), salt_and_origin.first, salt_and_origin.second)); }
diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host.cc index e06cd64..17593bdb 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host.cc +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host.cc
@@ -118,7 +118,7 @@ render_frame_id_), base::BindOnce(&MediaStreamDispatcherHost::DoGenerateStream, weak_factory_.GetWeakPtr(), page_request_id, controls, - user_gesture, base::Passed(&callback))); + user_gesture, std::move(callback))); } void MediaStreamDispatcherHost::DoGenerateStream( @@ -170,7 +170,7 @@ render_frame_id_), base::BindOnce(&MediaStreamDispatcherHost::DoOpenDevice, weak_factory_.GetWeakPtr(), page_request_id, device_id, - type, base::Passed(&callback))); + type, std::move(callback))); } void MediaStreamDispatcherHost::DoOpenDevice(
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc index 3560ed3b..b4ecdb2 100644 --- a/content/browser/renderer_host/media/media_stream_manager.cc +++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -109,7 +109,7 @@ media::mojom::JpegDecodeAcceleratorRequest request) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::BindOnce(&CreateJpegDecodeAcceleratorOnIOThread, - base::Passed(std::move(request)))); + std::move(request))); } void ParseStreamType(const StreamControls& controls,
diff --git a/content/browser/renderer_host/media/media_stream_ui_proxy.cc b/content/browser/renderer_host/media/media_stream_ui_proxy.cc index 16f7c23..07a03018 100644 --- a/content/browser/renderer_host/media/media_stream_ui_proxy.cc +++ b/content/browser/renderer_host/media/media_stream_ui_proxy.cc
@@ -16,7 +16,7 @@ #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "media/capture/video/fake_video_capture_device.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom.h" #include "url/gurl.h" #include "url/origin.h"
diff --git a/content/browser/renderer_host/media/render_frame_audio_input_stream_factory.cc b/content/browser/renderer_host/media/render_frame_audio_input_stream_factory.cc index df48bb6..2af4e2a 100644 --- a/content/browser/renderer_host/media/render_frame_audio_input_stream_factory.cc +++ b/content/browser/renderer_host/media/render_frame_audio_input_stream_factory.cc
@@ -22,11 +22,14 @@ RenderFrameAudioInputStreamFactory::CreateDelegateCallback create_delegate_callback, content::MediaStreamManager* media_stream_manager, + int render_process_id, + int render_frame_id, mojom::RendererAudioInputStreamFactoryRequest request) { std::unique_ptr<RenderFrameAudioInputStreamFactoryHandle, BrowserThread::DeleteOnIOThread> handle(new RenderFrameAudioInputStreamFactoryHandle( - std::move(create_delegate_callback), media_stream_manager)); + std::move(create_delegate_callback), media_stream_manager, + render_process_id, render_frame_id)); // Unretained is safe since |*handle| must be posted to the IO thread prior to // deletion. BrowserThread::PostTask( @@ -45,8 +48,13 @@ RenderFrameAudioInputStreamFactoryHandle( RenderFrameAudioInputStreamFactory::CreateDelegateCallback create_delegate_callback, - MediaStreamManager* media_stream_manager) - : impl_(std::move(create_delegate_callback), media_stream_manager), + MediaStreamManager* media_stream_manager, + int render_process_id, + int render_frame_id) + : impl_(std::move(create_delegate_callback), + media_stream_manager, + render_process_id, + render_frame_id), binding_(&impl_) {} void RenderFrameAudioInputStreamFactoryHandle::Init( @@ -57,11 +65,13 @@ RenderFrameAudioInputStreamFactory::RenderFrameAudioInputStreamFactory( CreateDelegateCallback create_delegate_callback, - MediaStreamManager* media_stream_manager) + MediaStreamManager* media_stream_manager, + int render_process_id, + int render_frame_id) : create_delegate_callback_(std::move(create_delegate_callback)), media_stream_manager_(media_stream_manager), - audio_log_(MediaInternals::GetInstance()->CreateAudioLog( - media::AudioLogFactory::AUDIO_INPUT_CONTROLLER)), + render_process_id_(render_process_id), + render_frame_id_(render_frame_id), weak_ptr_factory_(this) { DCHECK(create_delegate_callback_); // No thread-hostile state has been initialized yet, so we don't have to bind @@ -113,13 +123,18 @@ DCHECK_CURRENTLY_ON(BrowserThread::IO); int stream_id = ++next_stream_id_; + media::mojom::AudioLogPtr audio_log_ptr = + MediaInternals::GetInstance()->CreateMojoAudioLog( + media::AudioLogFactory::AUDIO_INPUT_CONTROLLER, stream_id, + render_process_id_, render_frame_id_); + // Unretained is safe since |this| owns |streams_|. streams_.insert(std::make_unique<AudioInputStreamHandle>( std::move(client), base::BindOnce( create_delegate_callback_, base::Unretained(media_stream_manager_->audio_input_device_manager()), - audio_log_.get(), std::move(keyboard_mic_registration), + std::move(audio_log_ptr), std::move(keyboard_mic_registration), shared_memory_count, stream_id, session_id, automatic_gain_control, audio_params), base::BindOnce(&RenderFrameAudioInputStreamFactory::RemoveStream,
diff --git a/content/browser/renderer_host/media/render_frame_audio_input_stream_factory.h b/content/browser/renderer_host/media/render_frame_audio_input_stream_factory.h index 11fde4d1..530591f 100644 --- a/content/browser/renderer_host/media/render_frame_audio_input_stream_factory.h +++ b/content/browser/renderer_host/media/render_frame_audio_input_stream_factory.h
@@ -21,11 +21,11 @@ #include "content/common/media/renderer_audio_input_stream_factory.mojom.h" #include "content/public/browser/browser_thread.h" #include "media/audio/audio_input_delegate.h" +#include "media/mojo/interfaces/audio_logging.mojom.h" #include "mojo/public/cpp/bindings/binding.h" namespace media { class AudioParameters; -class AudioLog; } // namespace media namespace content { @@ -42,7 +42,7 @@ using CreateDelegateCallback = base::RepeatingCallback<std::unique_ptr<media::AudioInputDelegate>( AudioInputDeviceManager* audio_input_device_manager, - media::AudioLog* audio_log, + media::mojom::AudioLogPtr audio_log, AudioInputDeviceManager::KeyboardMicRegistration keyboard_mic_registration, uint32_t shared_memory_count, @@ -54,7 +54,9 @@ RenderFrameAudioInputStreamFactory( CreateDelegateCallback create_delegate_callback, - MediaStreamManager* media_stream_manager); + MediaStreamManager* media_stream_manager, + int render_process_id, + int render_frame_id); ~RenderFrameAudioInputStreamFactory() override; @@ -83,7 +85,8 @@ const CreateDelegateCallback create_delegate_callback_; MediaStreamManager* media_stream_manager_; - const std::unique_ptr<media::AudioLog> audio_log_; + const int render_process_id_; + const int render_frame_id_; InputStreamSet streams_; int next_stream_id_ = 0; @@ -103,6 +106,8 @@ CreateFactory(RenderFrameAudioInputStreamFactory::CreateDelegateCallback create_delegate_callback, MediaStreamManager* media_stream_manager, + int render_process_id, + int render_frame_id, mojom::RendererAudioInputStreamFactoryRequest request); ~RenderFrameAudioInputStreamFactoryHandle(); @@ -111,7 +116,9 @@ RenderFrameAudioInputStreamFactoryHandle( RenderFrameAudioInputStreamFactory::CreateDelegateCallback create_delegate_callback, - MediaStreamManager* media_stream_manager); + MediaStreamManager* media_stream_manager, + int render_process_id, + int render_frame_id); void Init(mojom::RendererAudioInputStreamFactoryRequest request);
diff --git a/content/browser/renderer_host/media/render_frame_audio_input_stream_factory_unittest.cc b/content/browser/renderer_host/media/render_frame_audio_input_stream_factory_unittest.cc index 68b691f..f2d2892 100644 --- a/content/browser/renderer_host/media/render_frame_audio_input_stream_factory_unittest.cc +++ b/content/browser/renderer_host/media/render_frame_audio_input_stream_factory_unittest.cc
@@ -42,6 +42,8 @@ const int kBitsPerSample = 16; const int kSamplesPerBuffer = kSampleFrequency / 100; const bool kInitiallyMuted = false; +const int kRenderProcessID = -1; +const int kRenderFrameID = MSG_ROUTING_NONE; media::AudioParameters GetTestAudioParameters() { return media::AudioParameters(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, @@ -88,7 +90,7 @@ std::unique_ptr<media::AudioInputDelegate> CreateFakeDelegate( media::AudioInputDelegate::EventHandler** event_handler_out, AudioInputDeviceManager* audio_input_device_manager, - media::AudioLog* audio_log, + media::mojom::AudioLogPtr audio_log, AudioInputDeviceManager::KeyboardMicRegistration keyboard_mic_registration, uint32_t shared_memory_count, int stream_id, @@ -113,6 +115,8 @@ factory_handle_(RenderFrameAudioInputStreamFactoryHandle::CreateFactory( base::BindRepeating(&CreateFakeDelegate, &event_handler_), &media_stream_manager_, + kRenderProcessID, + kRenderFrameID, mojo::MakeRequest(&factory_ptr_))) {} ~RenderFrameAudioInputStreamFactoryTest() override {
diff --git a/content/browser/renderer_host/media/renderer_audio_output_stream_factory_context_impl.cc b/content/browser/renderer_host/media/renderer_audio_output_stream_factory_context_impl.cc index 0885ada0..c1ea731 100644 --- a/content/browser/renderer_host/media/renderer_audio_output_stream_factory_context_impl.cc +++ b/content/browser/renderer_host/media/renderer_audio_output_stream_factory_context_impl.cc
@@ -15,6 +15,7 @@ #include "content/public/browser/content_browser_client.h" #include "content/public/common/content_features.h" #include "media/audio/audio_system.h" +#include "media/mojo/interfaces/audio_logging.mojom.h" namespace content { @@ -30,8 +31,6 @@ authorization_handler_(audio_system_, media_stream_manager_, render_process_id), - audio_log_(MediaInternals::GetInstance()->CreateAudioLog( - media::AudioLogFactory::AUDIO_OUTPUT_CONTROLLER)), render_process_id_(render_process_id) {} RendererAudioOutputStreamFactoryContextImpl:: @@ -66,12 +65,14 @@ MediaObserver* const media_observer = GetContentClient()->browser()->GetMediaObserver(); - audio_log_->OnCreated(stream_id, params, unique_device_id); - MediaInternals::GetInstance()->SetWebContentsTitleForAudioLogEntry( - stream_id, render_process_id_, render_frame_id, audio_log_.get()); + media::mojom::AudioLogPtr audio_log_ptr = + MediaInternals::GetInstance()->CreateMojoAudioLog( + media::AudioLogFactory::AUDIO_OUTPUT_CONTROLLER, stream_id, + render_process_id_, render_frame_id); + audio_log_ptr->OnCreated(params, unique_device_id); return AudioOutputDelegateImpl::Create( - handler, audio_manager_, audio_log_.get(), + handler, audio_manager_, std::move(audio_log_ptr), AudioMirroringManager::GetInstance(), media_observer, stream_id, render_frame_id, render_process_id_, params, std::move(stream_observer), unique_device_id);
diff --git a/content/browser/renderer_host/media/renderer_audio_output_stream_factory_context_impl.h b/content/browser/renderer_host/media/renderer_audio_output_stream_factory_context_impl.h index cdd18f70..95e5ec5a 100644 --- a/content/browser/renderer_host/media/renderer_audio_output_stream_factory_context_impl.h +++ b/content/browser/renderer_host/media/renderer_audio_output_stream_factory_context_impl.h
@@ -12,7 +12,6 @@ #include "content/browser/renderer_host/media/render_frame_audio_output_stream_factory.h" #include "content/browser/renderer_host/media/renderer_audio_output_stream_factory_context.h" #include "content/public/browser/browser_thread.h" -#include "media/audio/audio_logging.h" namespace media { class AudioManager; @@ -78,7 +77,6 @@ media::AudioManager* const audio_manager_; MediaStreamManager* const media_stream_manager_; const AudioOutputAuthorizationHandler authorization_handler_; - const std::unique_ptr<media::AudioLog> audio_log_; const int render_process_id_; DISALLOW_COPY_AND_ASSIGN(RendererAudioOutputStreamFactoryContextImpl);
diff --git a/content/browser/renderer_host/media/service_launched_video_capture_device.cc b/content/browser/renderer_host/media/service_launched_video_capture_device.cc index 1d12c4c..04dfb41 100644 --- a/content/browser/renderer_host/media/service_launched_video_capture_device.cc +++ b/content/browser/renderer_host/media/service_launched_video_capture_device.cc
@@ -26,7 +26,7 @@ DCHECK(sequence_checker_.CalledOnValidSequence()); device_->GetPhotoState(base::BindOnce( &ServiceLaunchedVideoCaptureDevice::OnGetPhotoStateResponse, - base::Unretained(this), base::Passed(&callback))); + base::Unretained(this), std::move(callback))); } void ServiceLaunchedVideoCaptureDevice::SetPhotoOptions( @@ -37,7 +37,7 @@ std::move(settings), base::BindOnce( &ServiceLaunchedVideoCaptureDevice::OnSetPhotoOptionsResponse, - base::Unretained(this), base::Passed(&callback))); + base::Unretained(this), std::move(callback))); } void ServiceLaunchedVideoCaptureDevice::TakePhoto( @@ -45,7 +45,7 @@ DCHECK(sequence_checker_.CalledOnValidSequence()); device_->TakePhoto( base::BindOnce(&ServiceLaunchedVideoCaptureDevice::OnTakePhotoResponse, - base::Unretained(this), base::Passed(&callback))); + base::Unretained(this), std::move(callback))); } void ServiceLaunchedVideoCaptureDevice::MaybeSuspendDevice() {
diff --git a/content/browser/renderer_host/media/service_video_capture_device_launcher.cc b/content/browser/renderer_host/media/service_video_capture_device_launcher.cc index 9dfb2d3..369d69b1 100644 --- a/content/browser/renderer_host/media/service_video_capture_device_launcher.cc +++ b/content/browser/renderer_host/media/service_video_capture_device_launcher.cc
@@ -117,8 +117,8 @@ // Use of Unretained |this| is safe, because |done_cb_| guarantees // that |this| stays alive. &ServiceVideoCaptureDeviceLauncher::OnCreateDeviceCallback, - base::Unretained(this), params, base::Passed(&device), - std::move(receiver), base::Passed(&connection_lost_cb))); + base::Unretained(this), params, std::move(device), + std::move(receiver), std::move(connection_lost_cb))); state_ = State::DEVICE_START_IN_PROGRESS; }
diff --git a/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc b/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc index 2be279b5..7bffbb0 100644 --- a/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc +++ b/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc
@@ -165,7 +165,7 @@ // ensure the data pointers remain valid. out_frame->AddDestructionObserver(base::BindOnce( [](std::unique_ptr<media::VideoCaptureBufferHandle> handle) {}, - base::Passed(&out_buffer_access))); + std::move(out_buffer_access))); out_frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE, frame_format.frame_rate);
diff --git a/content/browser/renderer_host/p2p/socket_host.cc b/content/browser/renderer_host/p2p/socket_host.cc index 2f2567d..8173bcfd 100644 --- a/content/browser/renderer_host/p2p/socket_host.cc +++ b/content/browser/renderer_host/p2p/socket_host.cc
@@ -285,9 +285,8 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&P2PSocketHost::DumpRtpPacketOnIOThread, - weak_ptr_factory_.GetWeakPtr(), - base::Passed(&header_buffer), header_length, - rtp_packet_length, incoming)); + weak_ptr_factory_.GetWeakPtr(), std::move(header_buffer), + header_length, rtp_packet_length, incoming)); } void P2PSocketHost::DumpRtpPacketOnIOThread( @@ -306,7 +305,7 @@ // |packet_dump_callback_| must be called on the UI thread. BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::BindOnce(packet_dump_callback_, base::Passed(&packet_header), + base::BindOnce(packet_dump_callback_, std::move(packet_header), header_length, packet_length, incoming)); }
diff --git a/content/browser/renderer_host/pepper/pepper_file_io_host.cc b/content/browser/renderer_host/pepper/pepper_file_io_host.cc index c40b6ae..41722ed 100644 --- a/content/browser/renderer_host/pepper/pepper_file_io_host.cc +++ b/content/browser/renderer_host/pepper/pepper_file_io_host.cc
@@ -98,7 +98,7 @@ callback.Run(std::move(file), on_close_callback); } else { task_runner->PostTaskAndReply( - FROM_HERE, base::BindOnce(&FileCloser, base::Passed(&file)), + FROM_HERE, base::BindOnce(&FileCloser, std::move(file)), base::BindOnce(&DidCloseFile, on_close_callback)); } }
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 8bbb25ca..8abc030 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc
@@ -298,9 +298,9 @@ if (error != CacheStorageError::kSuccess || !cache_handle.value()) return; CacheStorageCache* cache = cache_handle.value(); - cache->WriteSideData(base::BindOnce(&NoOpCacheStorageErrorCallback, - base::Passed(std::move(cache_handle))), - url, expected_response_time, buf, buf_len); + cache->WriteSideData( + base::BindOnce(&NoOpCacheStorageErrorCallback, std::move(cache_handle)), + url, expected_response_time, buf, buf_len); } void RenderMessageFilter::OnMediaLogEvents(
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index ef311bc..27e7412 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1724,7 +1724,7 @@ blob_storage_context.get(), storage_partition_impl_->GetFileSystemContext(), storage_partition_impl_->GetServiceWorkerContext(), - storage_partition_impl_->GetPrefetchURLLoaderFactory(), + storage_partition_impl_->GetPrefetchURLLoaderService(), get_contexts_callback, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
diff --git a/content/browser/service_manager/service_manager_context.cc b/content/browser/service_manager/service_manager_context.cc index c1df2b4..663ee9b 100644 --- a/content/browser/service_manager/service_manager_context.cc +++ b/content/browser/service_manager/service_manager_context.cc
@@ -342,8 +342,8 @@ ->PostTask( FROM_HERE, base::BindOnce(&InProcessServiceManagerContext::StartOnIOThread, - this, base::Passed(&manifest_provider), - base::Passed(&packaged_services_service_info))); + this, std::move(manifest_provider), + std::move(packaged_services_service_info))); } void ShutDown() {
diff --git a/content/browser/service_worker/embedded_worker_test_helper.cc b/content/browser/service_worker/embedded_worker_test_helper.cc index 3c0857e4..ea5a921 100644 --- a/content/browser/service_worker/embedded_worker_test_helper.cc +++ b/content/browser/service_worker/embedded_worker_test_helper.cc
@@ -846,7 +846,7 @@ callback) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&EmbeddedWorkerTestHelper::OnActivateEvent, - AsWeakPtr(), base::Passed(&callback))); + AsWeakPtr(), std::move(callback))); } void EmbeddedWorkerTestHelper::OnBackgroundFetchAbortEventStub( @@ -856,7 +856,7 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&EmbeddedWorkerTestHelper::OnBackgroundFetchAbortEvent, - AsWeakPtr(), developer_id, base::Passed(&callback))); + AsWeakPtr(), developer_id, std::move(callback))); } void EmbeddedWorkerTestHelper::OnBackgroundFetchClickEventStub( @@ -867,8 +867,7 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&EmbeddedWorkerTestHelper::OnBackgroundFetchClickEvent, - AsWeakPtr(), developer_id, state, - base::Passed(&callback))); + AsWeakPtr(), developer_id, state, std::move(callback))); } void EmbeddedWorkerTestHelper::OnBackgroundFetchFailEventStub( @@ -879,8 +878,7 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&EmbeddedWorkerTestHelper::OnBackgroundFetchFailEvent, - AsWeakPtr(), developer_id, fetches, - base::Passed(&callback))); + AsWeakPtr(), developer_id, fetches, std::move(callback))); } void EmbeddedWorkerTestHelper::OnBackgroundFetchedEventStub( @@ -893,7 +891,7 @@ FROM_HERE, base::BindOnce(&EmbeddedWorkerTestHelper::OnBackgroundFetchedEvent, AsWeakPtr(), developer_id, unique_id, fetches, - base::Passed(&callback))); + std::move(callback))); } void EmbeddedWorkerTestHelper::OnExtendableMessageEventStub( @@ -903,8 +901,7 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&EmbeddedWorkerTestHelper::OnExtendableMessageEvent, - AsWeakPtr(), base::Passed(&event), - base::Passed(&callback))); + AsWeakPtr(), std::move(event), std::move(callback))); } void EmbeddedWorkerTestHelper::OnInstallEventStub( @@ -956,7 +953,7 @@ FROM_HERE, base::BindOnce(&EmbeddedWorkerTestHelper::OnNotificationClickEvent, AsWeakPtr(), notification_id, notification_data, - action_index, reply, base::Passed(&callback))); + action_index, reply, std::move(callback))); } void EmbeddedWorkerTestHelper::OnNotificationCloseEventStub( @@ -968,7 +965,7 @@ FROM_HERE, base::BindOnce(&EmbeddedWorkerTestHelper::OnNotificationCloseEvent, AsWeakPtr(), notification_id, notification_data, - base::Passed(&callback))); + std::move(callback))); } void EmbeddedWorkerTestHelper::OnPushEventStub( @@ -976,7 +973,7 @@ mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback callback) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&EmbeddedWorkerTestHelper::OnPushEvent, - AsWeakPtr(), payload, base::Passed(&callback))); + AsWeakPtr(), payload, std::move(callback))); } void EmbeddedWorkerTestHelper::OnAbortPaymentEventStub( @@ -985,8 +982,8 @@ callback) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&EmbeddedWorkerTestHelper::OnAbortPaymentEvent, - AsWeakPtr(), base::Passed(&response_callback), - base::Passed(&callback))); + AsWeakPtr(), std::move(response_callback), + std::move(callback))); } void EmbeddedWorkerTestHelper::OnCanMakePaymentEventStub( @@ -997,9 +994,8 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&EmbeddedWorkerTestHelper::OnCanMakePaymentEvent, - AsWeakPtr(), base::Passed(&event_data), - base::Passed(&response_callback), - base::Passed(&callback))); + AsWeakPtr(), std::move(event_data), + std::move(response_callback), std::move(callback))); } void EmbeddedWorkerTestHelper::OnPaymentRequestEventStub( @@ -1010,9 +1006,8 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&EmbeddedWorkerTestHelper::OnPaymentRequestEvent, - AsWeakPtr(), base::Passed(&event_data), - base::Passed(&response_callback), - base::Passed(&callback))); + AsWeakPtr(), std::move(event_data), + std::move(response_callback), std::move(callback))); } EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() {
diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc index f7cd8e5..3bdb236b 100644 --- a/content/browser/service_worker/service_worker_browsertest.cc +++ b/content/browser/service_worker/service_worker_browsertest.cc
@@ -2816,10 +2816,9 @@ new ServiceWorkerFetchRequest()); scoped_request->url = url_; CacheStorageCache* cache = cache_handle.value(); - cache->Match( - std::move(scoped_request), CacheStorageCacheQueryParams(), - base::BindOnce(&self::OnCacheStorageCacheMatchCallback, this, result, - continuation, base::Passed(std::move(cache_handle)))); + cache->Match(std::move(scoped_request), CacheStorageCacheQueryParams(), + base::BindOnce(&self::OnCacheStorageCacheMatchCallback, this, + result, continuation, std::move(cache_handle))); } void OnCacheStorageCacheMatchCallback(
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc index d59c9c7..31adacf 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.cc +++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -1043,7 +1043,7 @@ ServiceWorkerMetrics::EventType::NAVIGATION_HINT, base::BindOnce( &ServiceWorkerContextWrapper::DidStartServiceWorkerForNavigationHint, - this, registration->pattern(), base::Passed(std::move(callback)))); + this, registration->pattern(), std::move(callback))); } void ServiceWorkerContextWrapper::DidStartServiceWorkerForNavigationHint(
diff --git a/content/browser/service_worker/service_worker_fetch_dispatcher.cc b/content/browser/service_worker/service_worker_fetch_dispatcher.cc index 95ba232..3e50624 100644 --- a/content/browser/service_worker/service_worker_fetch_dispatcher.cc +++ b/content/browser/service_worker/service_worker_fetch_dispatcher.cc
@@ -599,8 +599,10 @@ // Pass |url_loader_assets_| to the callback to keep the URL loader related // assets alive while the FetchEvent is ongoing in the service worker. if (ServiceWorkerUtils::IsServicificationEnabled()) { - DCHECK(request_); - DCHECK(!legacy_request_); + // TODO(shimazu): Change CHECK to DCHECK after the cause of + // https://crbug.com/810685 is found. + CHECK(request_); + CHECK(!legacy_request_); auto params = mojom::DispatchFetchEventParams::New(); params->request = *request_; // When S13nServiceWorker is enabled, we come here only for navigations. @@ -613,8 +615,10 @@ base::Unretained(version_.get()), event_finish_id, url_loader_assets_)); } else { - DCHECK(!request_); - DCHECK(legacy_request_); + // TODO(shimazu): Change CHECK to DCHECK after the cause of + // https://crbug.com/810685 is found. + CHECK(!request_); + CHECK(legacy_request_); version_->event_dispatcher()->DispatchLegacyFetchEvent( *legacy_request_, std::move(preload_handle_), std::move(response_callback_ptr),
diff --git a/content/browser/service_worker/service_worker_installed_scripts_sender_unittest.cc b/content/browser/service_worker/service_worker_installed_scripts_sender_unittest.cc index b195ab2..f4a596d 100644 --- a/content/browser/service_worker/service_worker_installed_scripts_sender_unittest.cc +++ b/content/browser/service_worker/service_worker_installed_scripts_sender_unittest.cc
@@ -43,7 +43,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&ReadDataPipeInternal, handle, result, - base::Passed(&quit_closure))); + std::move(quit_closure))); return; case MOJO_RESULT_OK: EXPECT_NE(nullptr, buffer);
diff --git a/content/browser/service_worker/service_worker_url_request_job.cc b/content/browser/service_worker/service_worker_url_request_job.cc index 6dcaa56..684e9b30 100644 --- a/content/browser/service_worker/service_worker_url_request_job.cc +++ b/content/browser/service_worker/service_worker_url_request_job.cc
@@ -761,6 +761,8 @@ // Set up a request for reading the blob. // |body_as_blob| must be kept around until we call this to ensure that // it's alive. + // TODO(falken): Can we just read |body_as_blob| directly like in + // ServiceWorkerURLLoaderJob? if (!response.blob_uuid.empty() && blob_storage_context_) { SetResponseBodyType(BLOB); std::unique_ptr<storage::BlobDataHandle> blob_data_handle =
diff --git a/content/browser/speech/speech_recognizer_impl.cc b/content/browser/speech/speech_recognizer_impl.cc index e09035b..b89e70c 100644 --- a/content/browser/speech/speech_recognizer_impl.cc +++ b/content/browser/speech/speech_recognizer_impl.cc
@@ -189,8 +189,9 @@ audio_manager_(audio_manager), recognition_engine_(engine), endpointer_(kAudioSampleRate), - audio_log_(MediaInternals::GetInstance()->CreateAudioLog( - media::AudioLogFactory::AUDIO_INPUT_CONTROLLER)), + audio_log_(MediaInternals::GetInstance()->CreateMojoAudioLog( + media::AudioLogFactory::AUDIO_INPUT_CONTROLLER, + 0 /* component_id */)), is_dispatching_event_(false), provisional_results_(provisional_results), end_of_utterance_(false), @@ -275,7 +276,7 @@ if (audio_controller_.get()) { audio_controller_->Close(base::BindOnce( &KeepAudioControllerRefcountedForDtor, audio_controller_)); - audio_log_->OnClosed(0); + audio_log_->OnClosed(); } } @@ -646,7 +647,7 @@ SpeechRecognitionError(SPEECH_RECOGNITION_ERROR_AUDIO_CAPTURE)); } - audio_log_->OnCreated(0, input_parameters, device_id_); + audio_log_->OnCreated(input_parameters, device_id_); // The endpointer needs to estimate the environment/background noise before // starting to treat the audio as user input. We wait in the state @@ -654,7 +655,7 @@ // to user input mode. endpointer_.SetEnvironmentEstimationMode(); audio_controller_->Record(); - audio_log_->OnStarted(0); + audio_log_->OnStarted(); return STATE_STARTING; } @@ -857,7 +858,7 @@ base::BindOnce(&SpeechRecognizerImpl::OnAudioClosed, this, base::RetainedRef(audio_controller_))); audio_controller_ = nullptr; // The controller is still refcounted by Bind. - audio_log_->OnClosed(0); + audio_log_->OnClosed(); } int SpeechRecognizerImpl::GetElapsedTimeMs() const {
diff --git a/content/browser/speech/speech_recognizer_impl.h b/content/browser/speech/speech_recognizer_impl.h index b509fef..9fed729 100644 --- a/content/browser/speech/speech_recognizer_impl.h +++ b/content/browser/speech/speech_recognizer_impl.h
@@ -17,13 +17,13 @@ #include "content/public/common/speech_recognition_error.h" #include "content/public/common/speech_recognition_result.h" #include "media/audio/audio_input_controller.h" -#include "media/audio/audio_logging.h" +#include "media/mojo/interfaces/audio_logging.mojom.h" #include "net/url_request/url_request_context_getter.h" namespace media { class AudioBus; class AudioSystem; -} +} // namespace media namespace content { @@ -174,7 +174,7 @@ std::unique_ptr<SpeechRecognitionEngine> recognition_engine_; Endpointer endpointer_; scoped_refptr<media::AudioInputController> audio_controller_; - std::unique_ptr<media::AudioLog> audio_log_; + media::mojom::AudioLogPtr audio_log_; int num_samples_recorded_; float audio_level_; bool is_dispatching_event_;
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index 9a01999..a22a210 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc
@@ -25,7 +25,7 @@ #include "content/browser/child_process_security_policy_impl.h" #include "content/browser/fileapi/browser_file_system_helper.h" #include "content/browser/gpu/shader_cache_factory.h" -#include "content/browser/loader/prefetch_url_loader_factory.h" +#include "content/browser/loader/prefetch_url_loader_service.h" #include "content/browser/notifications/platform_notification_context_impl.h" #include "content/common/dom_storage/dom_storage_types.h" #include "content/public/browser/browser_context.h" @@ -688,8 +688,8 @@ partition->appcache_service_->set_url_loader_factory_getter( partition->url_loader_factory_getter_.get()); - partition->prefetch_url_loader_factory_ = - base::MakeRefCounted<PrefetchURLLoaderFactory>( + partition->prefetch_url_loader_service_ = + base::MakeRefCounted<PrefetchURLLoaderService>( partition->url_loader_factory_getter_); return partition; @@ -840,8 +840,8 @@ return blob_registry_.get(); } -PrefetchURLLoaderFactory* StoragePartitionImpl::GetPrefetchURLLoaderFactory() { - return prefetch_url_loader_factory_.get(); +PrefetchURLLoaderService* StoragePartitionImpl::GetPrefetchURLLoaderService() { + return prefetch_url_loader_service_.get(); } void StoragePartitionImpl::OpenLocalStorage( @@ -1058,9 +1058,8 @@ // Use OwnsReference instead of Increment/DecrementTaskCount* // to handle the cookie store being destroyed and the callback // thus not being called. - base::BindOnce( - &OwnsReference::Callback, - base::Passed(std::make_unique<OwnsReference>(this))))); + base::BindOnce(&OwnsReference::Callback, + std::make_unique<OwnsReference>(this)))); } if (remove_mask_ & REMOVE_DATA_MASK_INDEXEDDB ||
diff --git a/content/browser/storage_partition_impl.h b/content/browser/storage_partition_impl.h index 54f7073..3cff4c97 100644 --- a/content/browser/storage_partition_impl.h +++ b/content/browser/storage_partition_impl.h
@@ -49,7 +49,7 @@ class BackgroundFetchContext; class BlobRegistryWrapper; class BlobURLLoaderFactory; -class PrefetchURLLoaderFactory; +class PrefetchURLLoaderService; class CONTENT_EXPORT StoragePartitionImpl : public StoragePartition, @@ -144,7 +144,7 @@ BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap(); BlobURLLoaderFactory* GetBlobURLLoaderFactory(); BlobRegistryWrapper* GetBlobRegistry(); - PrefetchURLLoaderFactory* GetPrefetchURLLoaderFactory(); + PrefetchURLLoaderService* GetPrefetchURLLoaderService(); // mojom::StoragePartitionService interface. void OpenLocalStorage( @@ -310,7 +310,7 @@ scoped_refptr<BluetoothAllowedDevicesMap> bluetooth_allowed_devices_map_; scoped_refptr<BlobURLLoaderFactory> blob_url_loader_factory_; scoped_refptr<BlobRegistryWrapper> blob_registry_; - scoped_refptr<PrefetchURLLoaderFactory> prefetch_url_loader_factory_; + scoped_refptr<PrefetchURLLoaderService> prefetch_url_loader_service_; // BindingSet for StoragePartitionService, using the process id as the // binding context type. The process id can subsequently be used during
diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc index 972dcb3..f1e60fa 100644 --- a/content/browser/storage_partition_impl_map.cc +++ b/content/browser/storage_partition_impl_map.cc
@@ -28,6 +28,7 @@ #include "content/browser/blob_storage/chrome_blob_storage_context.h" #include "content/browser/devtools/devtools_url_request_interceptor.h" #include "content/browser/fileapi/browser_file_system_helper.h" +#include "content/browser/loader/prefetch_url_loader_service.h" #include "content/browser/loader/resource_request_info_impl.h" #include "content/browser/resource_context_impl.h" #include "content/browser/service_worker/service_worker_request_handler.h" @@ -520,7 +521,7 @@ file_access_runner_->PostTaskAndReply( FROM_HERE, base::BindOnce(&BlockingGarbageCollect, storage_root, file_access_runner_, - base::Passed(&active_paths)), + std::move(active_paths)), done); } @@ -573,6 +574,13 @@ partition->GetServiceWorkerContext(), browser_context_->GetResourceContext())); + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::BindOnce(&PrefetchURLLoaderService::InitializeResourceContext, + partition->GetPrefetchURLLoaderService(), + browser_context_->GetResourceContext(), + base::RetainedRef(partition->GetURLRequestContext()))); + // We do not call InitializeURLRequestContext() for media contexts because, // other than the HTTP cache, the media contexts share the same backing // objects as their associated "normal" request context. Thus, the previous
diff --git a/content/browser/tracing/tracing_controller_browsertest.cc b/content/browser/tracing/tracing_controller_browsertest.cc index a65ee7a..0e0fab6a 100644 --- a/content/browser/tracing/tracing_controller_browsertest.cc +++ b/content/browser/tracing/tracing_controller_browsertest.cc
@@ -80,10 +80,9 @@ scoped_refptr<base::RefCountedString> chunk_ptr = base::RefCountedString::TakeString(&trace_); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::BindOnce(done_callback_, base::Passed(std::move(metadata)), - base::RetainedRef(chunk_ptr))); + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, + base::BindOnce(done_callback_, std::move(metadata), + base::RetainedRef(chunk_ptr))); } protected:
diff --git a/content/browser/tracing/tracing_controller_impl_data_endpoint.cc b/content/browser/tracing/tracing_controller_impl_data_endpoint.cc index 586f096a..f452c25 100644 --- a/content/browser/tracing/tracing_controller_impl_data_endpoint.cc +++ b/content/browser/tracing/tracing_controller_impl_data_endpoint.cc
@@ -40,7 +40,7 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::BindOnce(completion_callback_, base::Passed(std::move(metadata)), + base::BindOnce(completion_callback_, std::move(metadata), base::RetainedRef(str))); } @@ -139,7 +139,7 @@ background_task_runner_->PostTask( FROM_HERE, base::BindOnce(&CompressedTraceDataEndpoint::CompressOnBackgroundThread, - this, base::Passed(std::move(chunk)))); + this, std::move(chunk))); } void ReceiveTraceFinalContents( @@ -147,7 +147,7 @@ background_task_runner_->PostTask( FROM_HERE, base::BindOnce(&CompressedTraceDataEndpoint::CloseOnBackgroundThread, - this, base::Passed(std::move(metadata)))); + this, std::move(metadata))); } private:
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index 0a7c603..493edbc1 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -53,7 +53,7 @@ #include "services/device/public/interfaces/geolocation_context.mojom.h" #include "services/device/public/interfaces/wake_lock.mojom.h" #include "services/metrics/public/cpp/ukm_recorder.h" -#include "third_party/WebKit/common/color_chooser/color_chooser.mojom.h" +#include "third_party/WebKit/public/mojom/color_chooser/color_chooser.mojom.h" #include "third_party/WebKit/public/platform/WebDragOperation.h" #include "ui/accessibility/ax_modes.h" #include "ui/base/page_transition_types.h"
diff --git a/content/browser/web_package/OWNERS b/content/browser/web_package/OWNERS new file mode 100644 index 0000000..9c88dda --- /dev/null +++ b/content/browser/web_package/OWNERS
@@ -0,0 +1,7 @@ +kinuko@chromium.org +kouhei@chromium.org +horo@chromium.org +ksakamoto@chromium.org + +# TEAM: loading-dev@chromium.org +# COMPONENT: Blink>Loader
diff --git a/content/browser/loader/signed_exchange_cert_fetcher.cc b/content/browser/web_package/signed_exchange_cert_fetcher.cc similarity index 99% rename from content/browser/loader/signed_exchange_cert_fetcher.cc rename to content/browser/web_package/signed_exchange_cert_fetcher.cc index af2d13f..90fb0ee 100644 --- a/content/browser/loader/signed_exchange_cert_fetcher.cc +++ b/content/browser/web_package/signed_exchange_cert_fetcher.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/signed_exchange_cert_fetcher.h" +#include "content/browser/web_package/signed_exchange_cert_fetcher.h" #include "base/numerics/safe_conversions.h" #include "base/strings/string_piece.h"
diff --git a/content/browser/loader/signed_exchange_cert_fetcher.h b/content/browser/web_package/signed_exchange_cert_fetcher.h similarity index 95% rename from content/browser/loader/signed_exchange_cert_fetcher.h rename to content/browser/web_package/signed_exchange_cert_fetcher.h index 88b33ae..7925995f 100644 --- a/content/browser/loader/signed_exchange_cert_fetcher.h +++ b/content/browser/web_package/signed_exchange_cert_fetcher.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_CERT_CETCHER_H_ -#define CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_CERT_CETCHER_H_ +#ifndef CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_CERT_CETCHER_H_ +#define CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_CERT_CETCHER_H_ #include <string> #include <vector> @@ -111,4 +111,4 @@ } // namespace content -#endif // CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_CERT_CETCHER_H_ +#endif // CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_CERT_CETCHER_H_
diff --git a/content/browser/loader/signed_exchange_cert_fetcher_unittest.cc b/content/browser/web_package/signed_exchange_cert_fetcher_unittest.cc similarity index 99% rename from content/browser/loader/signed_exchange_cert_fetcher_unittest.cc rename to content/browser/web_package/signed_exchange_cert_fetcher_unittest.cc index 8f45e46..00efc6b6 100644 --- a/content/browser/loader/signed_exchange_cert_fetcher_unittest.cc +++ b/content/browser/web_package/signed_exchange_cert_fetcher_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/signed_exchange_cert_fetcher.h" +#include "content/browser/web_package/signed_exchange_cert_fetcher.h" #include "base/optional.h" #include "base/strings/string_piece.h"
diff --git a/content/browser/loader/signed_exchange_consts.h b/content/browser/web_package/signed_exchange_consts.h similarity index 82% rename from content/browser/loader/signed_exchange_consts.h rename to content/browser/web_package/signed_exchange_consts.h index fcac0bd7..ad8dcd8 100644 --- a/content/browser/loader/signed_exchange_consts.h +++ b/content/browser/web_package/signed_exchange_consts.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_CONSTS_H_ -#define CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_CONSTS_H_ +#ifndef CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_CONSTS_H_ +#define CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_CONSTS_H_ namespace content { @@ -25,4 +25,4 @@ } // namespace content -#endif // CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_CONSTS_H_ +#endif // CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_CONSTS_H_
diff --git a/content/browser/loader/signed_exchange_handler.cc b/content/browser/web_package/signed_exchange_handler.cc similarity index 97% rename from content/browser/loader/signed_exchange_handler.cc rename to content/browser/web_package/signed_exchange_handler.cc index 6729146..6c1488f 100644 --- a/content/browser/loader/signed_exchange_handler.cc +++ b/content/browser/web_package/signed_exchange_handler.cc
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/signed_exchange_handler.h" +#include "content/browser/web_package/signed_exchange_handler.h" #include "base/feature_list.h" #include "components/cbor/cbor_reader.h" #include "content/browser/loader/merkle_integrity_source_stream.h" -#include "content/browser/loader/signed_exchange_cert_fetcher.h" -#include "content/browser/loader/signed_exchange_consts.h" -#include "content/browser/loader/signed_exchange_header_parser.h" +#include "content/browser/web_package/signed_exchange_cert_fetcher.h" +#include "content/browser/web_package/signed_exchange_consts.h" +#include "content/browser/web_package/signed_exchange_header_parser.h" #include "content/public/common/content_features.h" #include "content/public/common/shared_url_loader_factory.h" #include "content/public/common/url_loader_throttle.h"
diff --git a/content/browser/loader/signed_exchange_handler.h b/content/browser/web_package/signed_exchange_handler.h similarity index 94% rename from content/browser/loader/signed_exchange_handler.h rename to content/browser/web_package/signed_exchange_handler.h index a74aef2..7ce43e6 100644 --- a/content/browser/loader/signed_exchange_handler.h +++ b/content/browser/web_package/signed_exchange_handler.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_HANDLER_H_ -#define CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_HANDLER_H_ +#ifndef CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_HANDLER_H_ +#define CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_HANDLER_H_ #include <string> @@ -97,4 +97,4 @@ } // namespace content -#endif // CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_HANDLER_H_ +#endif // CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_HANDLER_H_
diff --git a/content/browser/loader/signed_exchange_header.cc b/content/browser/web_package/signed_exchange_header.cc similarity index 91% rename from content/browser/loader/signed_exchange_header.cc rename to content/browser/web_package/signed_exchange_header.cc index 16c5f77..1d885dc 100644 --- a/content/browser/loader/signed_exchange_header.cc +++ b/content/browser/web_package/signed_exchange_header.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/signed_exchange_header.h" +#include "content/browser/web_package/signed_exchange_header.h" #include <utility>
diff --git a/content/browser/loader/signed_exchange_header.h b/content/browser/web_package/signed_exchange_header.h similarity index 88% rename from content/browser/loader/signed_exchange_header.h rename to content/browser/web_package/signed_exchange_header.h index 61eb248e..c83df578 100644 --- a/content/browser/loader/signed_exchange_header.h +++ b/content/browser/web_package/signed_exchange_header.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_HEADER_H_ -#define CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_HEADER_H_ +#ifndef CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_HEADER_H_ +#define CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_HEADER_H_ #include <map> #include <string> @@ -50,4 +50,4 @@ } // namespace content -#endif // CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_HEADER_H_ +#endif // CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_HEADER_H_
diff --git a/content/browser/loader/signed_exchange_header_parser.cc b/content/browser/web_package/signed_exchange_header_parser.cc similarity index 98% rename from content/browser/loader/signed_exchange_header_parser.cc rename to content/browser/web_package/signed_exchange_header_parser.cc index 5e21de7..c1e7f87 100644 --- a/content/browser/loader/signed_exchange_header_parser.cc +++ b/content/browser/web_package/signed_exchange_header_parser.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/signed_exchange_header_parser.h" +#include "content/browser/web_package/signed_exchange_header_parser.h" #include <map> #include "base/base64.h"
diff --git a/content/browser/loader/signed_exchange_header_parser.h b/content/browser/web_package/signed_exchange_header_parser.h similarity index 87% rename from content/browser/loader/signed_exchange_header_parser.h rename to content/browser/web_package/signed_exchange_header_parser.h index d24d09f6..e2a884ceb 100644 --- a/content/browser/loader/signed_exchange_header_parser.h +++ b/content/browser/web_package/signed_exchange_header_parser.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_HEADER_PARSER_H_ -#define CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_HEADER_PARSER_H_ +#ifndef CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_HEADER_PARSER_H_ +#define CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_HEADER_PARSER_H_ #include <stdint.h> #include <string> @@ -48,4 +48,4 @@ } // namespace content -#endif // CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_HEADER_PARSER_H_ +#endif // CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_HEADER_PARSER_H_
diff --git a/content/browser/loader/signed_exchange_header_parser_unittest.cc b/content/browser/web_package/signed_exchange_header_parser_unittest.cc similarity index 98% rename from content/browser/loader/signed_exchange_header_parser_unittest.cc rename to content/browser/web_package/signed_exchange_header_parser_unittest.cc index 43db9ec..eb6e18c8 100644 --- a/content/browser/loader/signed_exchange_header_parser_unittest.cc +++ b/content/browser/web_package/signed_exchange_header_parser_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/signed_exchange_header_parser.h" +#include "content/browser/web_package/signed_exchange_header_parser.h" #include "testing/gtest/include/gtest/gtest.h" namespace content {
diff --git a/content/browser/loader/signed_exchange_parser.cc b/content/browser/web_package/signed_exchange_parser.cc similarity index 90% rename from content/browser/loader/signed_exchange_parser.cc rename to content/browser/web_package/signed_exchange_parser.cc index b0c1257..a87f001 100644 --- a/content/browser/loader/signed_exchange_parser.cc +++ b/content/browser/web_package/signed_exchange_parser.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/signed_exchange_parser.h" +#include "content/browser/web_package/signed_exchange_parser.h" namespace content {
diff --git a/content/browser/loader/signed_exchange_parser.h b/content/browser/web_package/signed_exchange_parser.h similarity index 94% rename from content/browser/loader/signed_exchange_parser.h rename to content/browser/web_package/signed_exchange_parser.h index baba326..40d149c 100644 --- a/content/browser/loader/signed_exchange_parser.h +++ b/content/browser/web_package/signed_exchange_parser.h
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_PARSER_H_ -#define CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_PARSER_H_ +#ifndef CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_PARSER_H_ +#define CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_PARSER_H_ #include <stdint.h> #include "base/callback.h" #include "base/containers/span.h" #include "base/macros.h" -#include "content/browser/loader/signed_exchange_header.h" +#include "content/browser/web_package/signed_exchange_header.h" #include "content/common/content_export.h" namespace content { @@ -119,4 +119,4 @@ } // namespace content -#endif // CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_PARSER_H_ +#endif // CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_PARSER_H_
diff --git a/content/browser/loader/signed_exchange_signature_verifier.cc b/content/browser/web_package/signed_exchange_signature_verifier.cc similarity index 97% rename from content/browser/loader/signed_exchange_signature_verifier.cc rename to content/browser/web_package/signed_exchange_signature_verifier.cc index 0370546..64254bc 100644 --- a/content/browser/loader/signed_exchange_signature_verifier.cc +++ b/content/browser/web_package/signed_exchange_signature_verifier.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/signed_exchange_signature_verifier.h" +#include "content/browser/web_package/signed_exchange_signature_verifier.h" #include "base/containers/span.h" #include "base/strings/string_number_conversions.h" @@ -10,8 +10,8 @@ #include "base/strings/string_util.h" #include "components/cbor/cbor_values.h" #include "components/cbor/cbor_writer.h" -#include "content/browser/loader/signed_exchange_consts.h" -#include "content/browser/loader/signed_exchange_header_parser.h" +#include "content/browser/web_package/signed_exchange_consts.h" +#include "content/browser/web_package/signed_exchange_header_parser.h" #include "crypto/signature_verifier.h" #include "net/cert/asn1_util.h" #include "net/cert/x509_util.h"
diff --git a/content/browser/loader/signed_exchange_signature_verifier.h b/content/browser/web_package/signed_exchange_signature_verifier.h similarity index 83% rename from content/browser/loader/signed_exchange_signature_verifier.h rename to content/browser/web_package/signed_exchange_signature_verifier.h index a7781002..d30dde0 100644 --- a/content/browser/loader/signed_exchange_signature_verifier.h +++ b/content/browser/web_package/signed_exchange_signature_verifier.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_SIGNATURE_VERIFIER_H_ -#define CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_SIGNATURE_VERIFIER_H_ +#ifndef CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_SIGNATURE_VERIFIER_H_ +#define CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_SIGNATURE_VERIFIER_H_ #include <map> #include <string> @@ -11,7 +11,7 @@ #include "base/memory/ref_counted.h" #include "base/optional.h" -#include "content/browser/loader/signed_exchange_header_parser.h" +#include "content/browser/web_package/signed_exchange_header_parser.h" #include "content/common/content_export.h" #include "net/cert/x509_certificate.h" @@ -52,4 +52,4 @@ } // namespace content -#endif // CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_SIGNATURE_VERIFIER_H_ +#endif // CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_SIGNATURE_VERIFIER_H_
diff --git a/content/browser/loader/signed_exchange_signature_verifier_unittest.cc b/content/browser/web_package/signed_exchange_signature_verifier_unittest.cc similarity index 97% rename from content/browser/loader/signed_exchange_signature_verifier_unittest.cc rename to content/browser/web_package/signed_exchange_signature_verifier_unittest.cc index add88ca8..17ade678 100644 --- a/content/browser/loader/signed_exchange_signature_verifier_unittest.cc +++ b/content/browser/web_package/signed_exchange_signature_verifier_unittest.cc
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/signed_exchange_signature_verifier.h" +#include "content/browser/web_package/signed_exchange_signature_verifier.h" -#include "content/browser/loader/signed_exchange_header_parser.h" +#include "content/browser/web_package/signed_exchange_header_parser.h" #include "net/cert/x509_certificate.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/content/browser/loader/signed_exchange_url_loader_factory_for_non_network_service.cc b/content/browser/web_package/signed_exchange_url_loader_factory_for_non_network_service.cc similarity index 96% rename from content/browser/loader/signed_exchange_url_loader_factory_for_non_network_service.cc rename to content/browser/web_package/signed_exchange_url_loader_factory_for_non_network_service.cc index 353388a..ce522a3 100644 --- a/content/browser/loader/signed_exchange_url_loader_factory_for_non_network_service.cc +++ b/content/browser/web_package/signed_exchange_url_loader_factory_for_non_network_service.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/signed_exchange_url_loader_factory_for_non_network_service.h" +#include "content/browser/web_package/signed_exchange_url_loader_factory_for_non_network_service.h" #include "base/feature_list.h" #include "content/browser/loader/resource_requester_info.h"
diff --git a/content/browser/loader/signed_exchange_url_loader_factory_for_non_network_service.h b/content/browser/web_package/signed_exchange_url_loader_factory_for_non_network_service.h similarity index 86% rename from content/browser/loader/signed_exchange_url_loader_factory_for_non_network_service.h rename to content/browser/web_package/signed_exchange_url_loader_factory_for_non_network_service.h index 1f6b29d..8ae02c93 100644 --- a/content/browser/loader/signed_exchange_url_loader_factory_for_non_network_service.h +++ b/content/browser/web_package/signed_exchange_url_loader_factory_for_non_network_service.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_URL_LOADER_FACTORY_FOR_NON_NETWORK_SERVICE_H_ -#define CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_URL_LOADER_FACTORY_FOR_NON_NETWORK_SERVICE_H_ +#ifndef CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_URL_LOADER_FACTORY_FOR_NON_NETWORK_SERVICE_H_ +#define CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_URL_LOADER_FACTORY_FOR_NON_NETWORK_SERVICE_H_ #include "content/public/common/resource_type.h" #include "content/public/common/shared_url_loader_factory.h" @@ -52,4 +52,4 @@ } // namespace content -#endif // CONTENT_BROWSER_LOADER_SIGNED_EXCHANGE_URL_LOADER_FACTORY_FOR_NON_NETWORK_SERVICE_H_ +#endif // CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_URL_LOADER_FACTORY_FOR_NON_NETWORK_SERVICE_H_
diff --git a/content/browser/loader/web_package_loader.cc b/content/browser/web_package/web_package_loader.cc similarity index 97% rename from content/browser/loader/web_package_loader.cc rename to content/browser/web_package/web_package_loader.cc index a7c46d0..122da91 100644 --- a/content/browser/loader/web_package_loader.cc +++ b/content/browser/web_package/web_package_loader.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/web_package_loader.h" +#include "content/browser/web_package/web_package_loader.h" #include <memory> #include "base/feature_list.h" #include "base/strings/stringprintf.h" #include "content/browser/loader/data_pipe_to_source_stream.h" -#include "content/browser/loader/signed_exchange_handler.h" #include "content/browser/loader/source_stream_to_data_pipe.h" +#include "content/browser/web_package/signed_exchange_handler.h" #include "content/public/common/content_features.h" #include "content/public/common/shared_url_loader_factory.h" #include "net/cert/cert_status_flags.h" @@ -163,8 +163,7 @@ } void WebPackageLoader::OnComplete( - const network::URLLoaderCompletionStatus& status) { -} + const network::URLLoaderCompletionStatus& status) {} void WebPackageLoader::FollowRedirect() { NOTREACHED();
diff --git a/content/browser/loader/web_package_loader.h b/content/browser/web_package/web_package_loader.h similarity index 96% rename from content/browser/loader/web_package_loader.h rename to content/browser/web_package/web_package_loader.h index 3f4dde9..a7acc45 100644 --- a/content/browser/loader/web_package_loader.h +++ b/content/browser/web_package/web_package_loader.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_LOADER_WEB_PACKAGE_LOADER_H_ -#define CONTENT_BROWSER_LOADER_WEB_PACKAGE_LOADER_H_ +#ifndef CONTENT_BROWSER_WEB_PACKAGE_WEB_PACKAGE_LOADER_H_ +#define CONTENT_BROWSER_WEB_PACKAGE_WEB_PACKAGE_LOADER_H_ #include "base/optional.h" #include "mojo/public/cpp/bindings/binding.h" @@ -127,4 +127,4 @@ } // namespace content -#endif // CONTENT_BROWSER_LOADER_WEB_PACKAGE_LOADER_H_ +#endif // CONTENT_BROWSER_WEB_PACKAGE_WEB_PACKAGE_LOADER_H_
diff --git a/content/browser/loader/web_package_request_handler.cc b/content/browser/web_package/web_package_request_handler.cc similarity index 96% rename from content/browser/loader/web_package_request_handler.cc rename to content/browser/web_package/web_package_request_handler.cc index cd2e0d0d..91a5860 100644 --- a/content/browser/loader/web_package_request_handler.cc +++ b/content/browser/web_package/web_package_request_handler.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/web_package_request_handler.h" +#include "content/browser/web_package/web_package_request_handler.h" #include <memory> #include "base/bind.h" #include "base/feature_list.h" -#include "content/browser/loader/web_package_loader.h" +#include "content/browser/web_package/web_package_loader.h" #include "content/common/throttling_url_loader.h" #include "content/public/common/content_features.h" #include "content/public/common/shared_url_loader_factory.h"
diff --git a/content/browser/loader/web_package_request_handler.h b/content/browser/web_package/web_package_request_handler.h similarity index 91% rename from content/browser/loader/web_package_request_handler.h rename to content/browser/web_package/web_package_request_handler.h index ffc2e7b..dda5c7e 100644 --- a/content/browser/loader/web_package_request_handler.h +++ b/content/browser/web_package/web_package_request_handler.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_LOADER_WEB_PACKAGE_REQUEST_HANDLER_H_ -#define CONTENT_BROWSER_LOADER_WEB_PACKAGE_REQUEST_HANDLER_H_ +#ifndef CONTENT_BROWSER_WEB_PACKAGE_WEB_PACKAGE_REQUEST_HANDLER_H_ +#define CONTENT_BROWSER_WEB_PACKAGE_WEB_PACKAGE_REQUEST_HANDLER_H_ #include "base/memory/weak_ptr.h" #include "content/browser/loader/url_loader_request_handler.h" @@ -61,4 +61,4 @@ } // namespace content -#endif // CONTENT_BROWSER_LOADER_WEB_PACKAGE_REQUEST_HANDLER_H_ +#endif // CONTENT_BROWSER_WEB_PACKAGE_WEB_PACKAGE_REQUEST_HANDLER_H_
diff --git a/content/browser/loader/web_package_request_handler_browsertest.cc b/content/browser/web_package/web_package_request_handler_browsertest.cc similarity index 100% rename from content/browser/loader/web_package_request_handler_browsertest.cc rename to content/browser/web_package/web_package_request_handler_browsertest.cc
diff --git a/content/browser/webrtc/webrtc_content_browsertest_base.cc b/content/browser/webrtc/webrtc_content_browsertest_base.cc index 46290cc..afa6c43 100644 --- a/content/browser/webrtc/webrtc_content_browsertest_base.cc +++ b/content/browser/webrtc/webrtc_content_browsertest_base.cc
@@ -125,7 +125,7 @@ *result = received; finished_callback.Run(); }, - base::Passed(run_loop.QuitClosure()), &has_devices)); + run_loop.QuitClosure(), &has_devices)); run_loop.Run(); return has_devices; }
diff --git a/content/browser/websockets/websocket_manager.cc b/content/browser/websockets/websocket_manager.cc index e2b6a22..ce41b4a 100644 --- a/content/browser/websockets/websocket_manager.cc +++ b/content/browser/websockets/websocket_manager.cc
@@ -99,7 +99,7 @@ BrowserThread::IO, FROM_HERE, base::BindOnce(&WebSocketManager::DoCreateWebSocket, base::Unretained(handle->manager()), frame_id, - std::move(origin), base::Passed(&request))); + std::move(origin), std::move(request))); } WebSocketManager::WebSocketManager(int process_id,
diff --git a/content/common/content_switches_internal.cc b/content/common/content_switches_internal.cc index 5124c600..27c25d3 100644 --- a/content/common/content_switches_internal.cc +++ b/content/common/content_switches_internal.cc
@@ -80,8 +80,6 @@ v8_cache_options = base::FieldTrialList::FindFullName("V8CacheOptions"); if (v8_cache_options == "none") { return V8_CACHE_OPTIONS_NONE; - } else if (v8_cache_options == "parse") { - return V8_CACHE_OPTIONS_PARSE; } else if (v8_cache_options == "code") { return V8_CACHE_OPTIONS_CODE; } else {
diff --git a/content/common/frame.mojom b/content/common/frame.mojom index 82f4100..3e99690 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom
@@ -13,7 +13,7 @@ import "mojo/public/mojom/base/string16.mojom"; import "services/network/public/mojom/url_loader.mojom"; import "services/service_manager/public/mojom/interface_provider.mojom"; -import "third_party/WebKit/common/feature_policy/feature_policy.mojom"; +import "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom"; import "third_party/WebKit/public/platform/referrer.mojom"; import "third_party/WebKit/public/web/commit_result.mojom"; import "third_party/WebKit/public/web/window_features.mojom";
diff --git a/content/common/service_manager/child_connection.cc b/content/common/service_manager/child_connection.cc index 40609de..3a78244 100644 --- a/content/common/service_manager/child_connection.cc +++ b/content/common/service_manager/child_connection.cc
@@ -35,7 +35,7 @@ child_identity_ = child_identity; io_task_runner_->PostTask( FROM_HERE, base::BindOnce(&IOThreadContext::InitializeOnIOThread, this, - child_identity, base::Passed(&service_pipe))); + child_identity, std::move(service_pipe))); } void BindInterface(const std::string& interface_name, @@ -43,7 +43,7 @@ io_task_runner_->PostTask( FROM_HERE, base::BindOnce(&IOThreadContext::BindInterfaceOnIOThread, this, - interface_name, base::Passed(&interface_pipe))); + interface_name, std::move(interface_pipe))); } void ShutDown() {
diff --git a/content/common/service_worker/service_worker_loader_helpers.cc b/content/common/service_worker/service_worker_loader_helpers.cc index a1c31c12..acb16b1 100644 --- a/content/common/service_worker/service_worker_loader_helpers.cc +++ b/content/common/service_worker/service_worker_loader_helpers.cc
@@ -43,38 +43,6 @@ } // namespace // static -std::unique_ptr<ServiceWorkerFetchRequest> -ServiceWorkerLoaderHelpers::CreateFetchRequest( - const network::ResourceRequest& request) { - auto new_request = std::make_unique<ServiceWorkerFetchRequest>(); - new_request->mode = request.fetch_request_mode; - new_request->is_main_resource_load = ServiceWorkerUtils::IsMainResourceType( - static_cast<ResourceType>(request.resource_type)); - new_request->request_context_type = - static_cast<RequestContextType>(request.fetch_request_context_type); - new_request->frame_type = request.fetch_frame_type; - new_request->url = request.url; - new_request->method = request.method; - // |blob_uuid| and |blob_size| aren't used in MojoBlobs, so just clear them. - // The caller is responsible for setting the MojoBlob field |blob| if needed. - new_request->blob_uuid.clear(); - new_request->blob_size = 0; - new_request->credentials_mode = request.fetch_credentials_mode; - new_request->cache_mode = - ServiceWorkerFetchRequest::GetCacheModeFromLoadFlags(request.load_flags); - new_request->redirect_mode = request.fetch_redirect_mode; - new_request->keepalive = request.keepalive; - new_request->is_reload = ui::PageTransitionCoreTypeIs( - static_cast<ui::PageTransition>(request.transition_type), - ui::PAGE_TRANSITION_RELOAD); - new_request->referrer = Referrer( - GURL(request.referrer), Referrer::NetReferrerPolicyToBlinkReferrerPolicy( - request.referrer_policy)); - new_request->fetch_type = ServiceWorkerFetchType::FETCH; - return new_request; -} - -// static void ServiceWorkerLoaderHelpers::SaveResponseHeaders( const int status_code, const std::string& status_text,
diff --git a/content/common/service_worker/service_worker_loader_helpers.h b/content/common/service_worker/service_worker_loader_helpers.h index 8e216b8d..9a4833f 100644 --- a/content/common/service_worker/service_worker_loader_helpers.h +++ b/content/common/service_worker/service_worker_loader_helpers.h
@@ -23,9 +23,6 @@ //(e.g., ServiceWorkerURLLoaderJob and ServiceWorkerSubresourceLoader). class ServiceWorkerLoaderHelpers { public: - static std::unique_ptr<ServiceWorkerFetchRequest> CreateFetchRequest( - const network::ResourceRequest& request); - // Populates |out_head->headers| with the given |status_code|, |status_text|, // and |headers|. static void SaveResponseHeaders(const int status_code,
diff --git a/content/common/service_worker/service_worker_types.h b/content/common/service_worker/service_worker_types.h index f04c862..99e0ab7 100644 --- a/content/common/service_worker/service_worker_types.h +++ b/content/common/service_worker/service_worker_types.h
@@ -111,7 +111,16 @@ ServiceWorkerFetchType fetch_type = ServiceWorkerFetchType::FETCH; }; -// Represents a response to a fetch. +// Roughly corresponds to the Fetch API's Response type. This struct has several +// users: +// - Service Worker API: The renderer sends the browser this type to +// represent the response a service worker provided to FetchEvent#respondWith. +// - Background Fetch API: Uses this type to represent responses to background +// fetches. +// - Cache Storage API: Uses this type to represent responses to requests. +// Note that the Fetch API does not use this type; it uses ResourceResponse +// instead. +// TODO(falken): Can everyone just use ResourceResponse? struct CONTENT_EXPORT ServiceWorkerResponse { ServiceWorkerResponse(); ServiceWorkerResponse( @@ -144,7 +153,6 @@ // ServiceWorkerFetchResponseCallback. std::string blob_uuid; uint64_t blob_size; - // |blob| is only used when features::kMojoBlobs is enabled. scoped_refptr<storage::BlobHandle> blob; blink::mojom::ServiceWorkerResponseError error; base::Time response_time;
diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/KitKatWebContentsAccessibility.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/KitKatWebContentsAccessibility.java index b1a34467..6a8409f 100644 --- a/content/public/android/java/src/org/chromium/content/browser/accessibility/KitKatWebContentsAccessibility.java +++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/KitKatWebContentsAccessibility.java
@@ -34,11 +34,12 @@ @Override protected void setAccessibilityNodeInfoKitKatAttributes(AccessibilityNodeInfo node, boolean isRoot, boolean isEditableText, String role, String roleDescription, - String hint, int selectionStartIndex, int selectionEndIndex) { + String hint, int selectionStartIndex, int selectionEndIndex, boolean hasImage) { Bundle bundle = node.getExtras(); bundle.putCharSequence("AccessibilityNodeInfo.chromeRole", role); bundle.putCharSequence("AccessibilityNodeInfo.roleDescription", roleDescription); bundle.putCharSequence("AccessibilityNodeInfo.hint", hint); + if (hasImage) bundle.putCharSequence("AccessibilityNodeInfo.hasImage", "true"); if (isRoot) { bundle.putCharSequence( "ACTION_ARGUMENT_HTML_ELEMENT_STRING_VALUES", mSupportedHtmlElementTypes);
diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/OWebContentsAccessibility.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/OWebContentsAccessibility.java index 50cf2d7..d2419e7 100644 --- a/content/public/android/java/src/org/chromium/content/browser/accessibility/OWebContentsAccessibility.java +++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/OWebContentsAccessibility.java
@@ -41,9 +41,9 @@ @Override protected void setAccessibilityNodeInfoKitKatAttributes(AccessibilityNodeInfo node, boolean isRoot, boolean isEditableText, String role, String roleDescription, - String hint, int selectionStartIndex, int selectionEndIndex) { + String hint, int selectionStartIndex, int selectionEndIndex, boolean hasImage) { super.setAccessibilityNodeInfoKitKatAttributes(node, isRoot, isEditableText, role, - roleDescription, hint, selectionStartIndex, selectionEndIndex); + roleDescription, hint, selectionStartIndex, selectionEndIndex, hasImage); node.setHintText(hint); }
diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityImpl.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityImpl.java index 6d2a751..387dec1f 100644 --- a/content/public/android/java/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityImpl.java +++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityImpl.java
@@ -1221,7 +1221,7 @@ @CalledByNative protected void setAccessibilityNodeInfoKitKatAttributes(AccessibilityNodeInfo node, boolean isRoot, boolean isEditableText, String role, String roleDescription, - String hint, int selectionStartIndex, int selectionEndIndex) { + String hint, int selectionStartIndex, int selectionEndIndex, boolean hasImage) { // Requires KitKat or higher. }
diff --git a/content/public/browser/utility_process_mojo_client.h b/content/public/browser/utility_process_mojo_client.h index 4bce6f2..f38a1a66 100644 --- a/content/public/browser/utility_process_mojo_client.h +++ b/content/public/browser/utility_process_mojo_client.h
@@ -107,7 +107,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&Helper::StartOnIOThread, base::Unretained(this), - mojo_interface_name, base::Passed(&interface_pipe))); + mojo_interface_name, std::move(interface_pipe))); } void set_exposed_directory(const base::FilePath& directory) {
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index 59585eb..4b512a0 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h
@@ -21,7 +21,7 @@ #include "content/public/common/media_stream_request.h" #include "content/public/common/previews_state.h" #include "content/public/common/window_container_type.mojom.h" -#include "third_party/WebKit/common/color_chooser/color_chooser.mojom.h" +#include "third_party/WebKit/public/mojom/color_chooser/color_chooser.mojom.h" #include "third_party/WebKit/public/platform/WebDisplayMode.h" #include "third_party/WebKit/public/platform/WebDragOperation.h" #include "third_party/WebKit/public/platform/WebSecurityStyle.h"
diff --git a/content/public/common/web_preferences.cc b/content/public/common/web_preferences.cc index 41a3b6e..e1470563 100644 --- a/content/public/common/web_preferences.cc +++ b/content/public/common/web_preferences.cc
@@ -29,7 +29,6 @@ STATIC_ASSERT_ENUM(V8_CACHE_OPTIONS_DEFAULT, WebSettings::kV8CacheOptionsDefault); STATIC_ASSERT_ENUM(V8_CACHE_OPTIONS_NONE, WebSettings::kV8CacheOptionsNone); -STATIC_ASSERT_ENUM(V8_CACHE_OPTIONS_PARSE, WebSettings::kV8CacheOptionsParse); STATIC_ASSERT_ENUM(V8_CACHE_OPTIONS_CODE, WebSettings::kV8CacheOptionsCode); STATIC_ASSERT_ENUM(V8_CACHE_OPTIONS_LAST, WebSettings::kV8CacheOptionsCode);
diff --git a/content/public/common/web_preferences.h b/content/public/common/web_preferences.h index 35ff8d0..f0308abc 100644 --- a/content/public/common/web_preferences.h +++ b/content/public/common/web_preferences.h
@@ -39,7 +39,6 @@ enum V8CacheOptions { V8_CACHE_OPTIONS_DEFAULT, V8_CACHE_OPTIONS_NONE, - V8_CACHE_OPTIONS_PARSE, V8_CACHE_OPTIONS_CODE, V8_CACHE_OPTIONS_LAST = V8_CACHE_OPTIONS_CODE };
diff --git a/content/public/test/service_worker_test_helpers.cc b/content/public/test/service_worker_test_helpers.cc index 42b9d4e..b7142bc 100644 --- a/content/public/test/service_worker_test_helpers.cc +++ b/content/public/test/service_worker_test_helpers.cc
@@ -95,7 +95,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&StopServiceWorkerForPattern, context, pattern, - base::Passed(&completion_callback_ui))); + std::move(completion_callback_ui))); return; } auto* context_wrapper = static_cast<ServiceWorkerContextWrapper*>(context);
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc index 81d0a29..dcd5daf 100644 --- a/content/renderer/gpu/render_widget_compositor.cc +++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -1067,7 +1067,7 @@ DidCompositeAndReadback, base::Unretained(callback), result->AsSkBitmap())); }, - callback, base::Passed(&main_thread_task_runner))); + callback, std::move(main_thread_task_runner))); auto swap_promise = delegate_->RequestCopyOfOutputForLayoutTest(std::move(request));
diff --git a/content/renderer/indexed_db/indexed_db_callbacks_impl.cc b/content/renderer/indexed_db/indexed_db_callbacks_impl.cc index 651315b..294a9ace 100644 --- a/content/renderer/indexed_db/indexed_db_callbacks_impl.cc +++ b/content/renderer/indexed_db/indexed_db_callbacks_impl.cc
@@ -154,7 +154,7 @@ callback_runner_->PostTask( FROM_HERE, base::BindOnce(&InternalState::UpgradeNeeded, - base::Unretained(internal_state_), base::Passed(&database), + base::Unretained(internal_state_), std::move(database), old_version, data_loss, data_loss_message, metadata)); } @@ -164,7 +164,7 @@ callback_runner_->PostTask(FROM_HERE, base::BindOnce(&InternalState::SuccessDatabase, base::Unretained(internal_state_), - base::Passed(&database), metadata)); + std::move(database), metadata)); } void IndexedDBCallbacksImpl::SuccessCursor( @@ -175,8 +175,8 @@ callback_runner_->PostTask( FROM_HERE, base::BindOnce(&InternalState::SuccessCursor, - base::Unretained(internal_state_), base::Passed(&cursor), - key, primary_key, base::Passed(&value))); + base::Unretained(internal_state_), std::move(cursor), key, + primary_key, std::move(value))); } void IndexedDBCallbacksImpl::SuccessValue( @@ -184,7 +184,7 @@ callback_runner_->PostTask( FROM_HERE, base::BindOnce(&InternalState::SuccessValue, - base::Unretained(internal_state_), base::Passed(&value))); + base::Unretained(internal_state_), std::move(value))); } void IndexedDBCallbacksImpl::SuccessCursorContinue( @@ -194,7 +194,7 @@ callback_runner_->PostTask( FROM_HERE, base::BindOnce(&InternalState::SuccessCursorContinue, base::Unretained(internal_state_), key, - primary_key, base::Passed(&value))); + primary_key, std::move(value))); } void IndexedDBCallbacksImpl::SuccessCursorPrefetch( @@ -204,7 +204,7 @@ callback_runner_->PostTask( FROM_HERE, base::BindOnce(&InternalState::SuccessCursorPrefetch, base::Unretained(internal_state_), keys, - primary_keys, base::Passed(&values))); + primary_keys, std::move(values))); } void IndexedDBCallbacksImpl::SuccessArray( @@ -212,7 +212,7 @@ callback_runner_->PostTask( FROM_HERE, base::BindOnce(&InternalState::SuccessArray, - base::Unretained(internal_state_), base::Passed(&values))); + base::Unretained(internal_state_), std::move(values))); } void IndexedDBCallbacksImpl::SuccessKey(const IndexedDBKey& key) {
diff --git a/content/renderer/indexed_db/indexed_db_database_callbacks_impl.cc b/content/renderer/indexed_db/indexed_db_database_callbacks_impl.cc index 1f2f698d..bf65516 100644 --- a/content/renderer/indexed_db/indexed_db_database_callbacks_impl.cc +++ b/content/renderer/indexed_db/indexed_db_database_callbacks_impl.cc
@@ -116,7 +116,7 @@ callback_runner_->PostTask( FROM_HERE, base::BindOnce(&BuildObservationsAndNotify, base::Unretained(callbacks_), - base::Passed(&changes))); + std::move(changes))); } } // namespace content
diff --git a/content/renderer/indexed_db/webidbcursor_impl.cc b/content/renderer/indexed_db/webidbcursor_impl.cc index 11c0918..57ed3b3 100644 --- a/content/renderer/indexed_db/webidbcursor_impl.cc +++ b/content/renderer/indexed_db/webidbcursor_impl.cc
@@ -67,7 +67,7 @@ IndexedDBDispatcher::ThreadSpecificInstance()->RegisterCursor(this); io_runner_->PostTask(FROM_HERE, base::BindOnce(&IOThreadHelper::Bind, base::Unretained(helper_), - base::Passed(&cursor_info))); + std::move(cursor_info))); } WebIDBCursorImpl::~WebIDBCursorImpl() { @@ -98,7 +98,7 @@ io_runner_->PostTask( FROM_HERE, base::BindOnce(&IOThreadHelper::Advance, base::Unretained(helper_), count, - base::Passed(&callbacks_impl))); + std::move(callbacks_impl))); } void WebIDBCursorImpl::Continue(WebIDBKeyView key, @@ -127,7 +127,7 @@ io_runner_->PostTask( FROM_HERE, base::BindOnce(&IOThreadHelper::Prefetch, base::Unretained(helper_), - prefetch_amount_, base::Passed(&callbacks_impl))); + prefetch_amount_, std::move(callbacks_impl))); // Increase prefetch_amount_ exponentially. prefetch_amount_ *= 2; @@ -153,7 +153,7 @@ base::BindOnce(&IOThreadHelper::Continue, base::Unretained(helper_), IndexedDBKeyBuilder::Build(key), IndexedDBKeyBuilder::Build(primary_key), - base::Passed(&callbacks_impl))); + std::move(callbacks_impl))); } void WebIDBCursorImpl::PostSuccessHandlerCallback() {
diff --git a/content/renderer/indexed_db/webidbdatabase_impl.cc b/content/renderer/indexed_db/webidbdatabase_impl.cc index 65b7404..8766e36 100644 --- a/content/renderer/indexed_db/webidbdatabase_impl.cc +++ b/content/renderer/indexed_db/webidbdatabase_impl.cc
@@ -171,7 +171,7 @@ callback_runner_(std::move(callback_runner)) { io_runner_->PostTask(FROM_HERE, base::BindOnce(&IOThreadHelper::Bind, base::Unretained(helper_), - base::Passed(&database_info))); + std::move(database_info))); } WebIDBDatabaseImpl::~WebIDBDatabaseImpl() { @@ -275,7 +275,7 @@ FROM_HERE, base::BindOnce(&IOThreadHelper::Get, base::Unretained(helper_), transaction_id, object_store_id, index_id, IndexedDBKeyRangeBuilder::Build(key_range), - key_only, base::Passed(&callbacks_impl))); + key_only, std::move(callbacks_impl))); } void WebIDBDatabaseImpl::GetAll(long long transaction_id, @@ -296,7 +296,7 @@ base::BindOnce(&IOThreadHelper::GetAll, base::Unretained(helper_), transaction_id, object_store_id, index_id, IndexedDBKeyRangeBuilder::Build(key_range), max_count, - key_only, base::Passed(&callbacks_impl))); + key_only, std::move(callbacks_impl))); } void WebIDBDatabaseImpl::Put(long long transaction_id, @@ -356,8 +356,8 @@ io_runner_->PostTask( FROM_HERE, base::BindOnce(&IOThreadHelper::Put, base::Unretained(helper_), - transaction_id, object_store_id, base::Passed(&mojo_value), - key, put_mode, base::Passed(&callbacks_impl), + transaction_id, object_store_id, std::move(mojo_value), + key, put_mode, std::move(callbacks_impl), ConvertWebIndexKeys(index_ids, index_keys))); } @@ -381,10 +381,10 @@ const WebVector<long long>& web_index_ids) { std::vector<int64_t> index_ids(web_index_ids.Data(), web_index_ids.Data() + web_index_ids.size()); - io_runner_->PostTask( - FROM_HERE, base::BindOnce(&IOThreadHelper::SetIndexesReady, - base::Unretained(helper_), transaction_id, - object_store_id, base::Passed(&index_ids))); + io_runner_->PostTask(FROM_HERE, + base::BindOnce(&IOThreadHelper::SetIndexesReady, + base::Unretained(helper_), transaction_id, + object_store_id, std::move(index_ids))); } void WebIDBDatabaseImpl::OpenCursor(long long transaction_id, @@ -406,7 +406,7 @@ base::BindOnce(&IOThreadHelper::OpenCursor, base::Unretained(helper_), transaction_id, object_store_id, index_id, IndexedDBKeyRangeBuilder::Build(key_range), direction, - key_only, task_type, base::Passed(&callbacks_impl))); + key_only, task_type, std::move(callbacks_impl))); } void WebIDBDatabaseImpl::Count(long long transaction_id, @@ -425,7 +425,7 @@ base::BindOnce(&IOThreadHelper::Count, base::Unretained(helper_), transaction_id, object_store_id, index_id, IndexedDBKeyRangeBuilder::Build(key_range), - base::Passed(&callbacks_impl))); + std::move(callbacks_impl))); } void WebIDBDatabaseImpl::Delete(long long transaction_id, @@ -443,7 +443,7 @@ base::BindOnce(&IOThreadHelper::DeleteRange, base::Unretained(helper_), transaction_id, object_store_id, IndexedDBKeyRangeBuilder::Build(primary_key), - base::Passed(&callbacks_impl))); + std::move(callbacks_impl))); } void WebIDBDatabaseImpl::DeleteRange(long long transaction_id, @@ -461,7 +461,7 @@ base::BindOnce(&IOThreadHelper::DeleteRange, base::Unretained(helper_), transaction_id, object_store_id, IndexedDBKeyRangeBuilder::Build(key_range), - base::Passed(&callbacks_impl))); + std::move(callbacks_impl))); } void WebIDBDatabaseImpl::Clear(long long transaction_id, @@ -474,10 +474,9 @@ base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_, callback_runner_); io_runner_->PostTask( - FROM_HERE, - base::BindOnce(&IOThreadHelper::Clear, base::Unretained(helper_), - transaction_id, object_store_id, - base::Passed(&callbacks_impl))); + FROM_HERE, base::BindOnce(&IOThreadHelper::Clear, + base::Unretained(helper_), transaction_id, + object_store_id, std::move(callbacks_impl))); } void WebIDBDatabaseImpl::CreateIndex(long long transaction_id,
diff --git a/content/renderer/indexed_db/webidbfactory_impl.cc b/content/renderer/indexed_db/webidbfactory_impl.cc index 52cb7ce7..d84706b 100644 --- a/content/renderer/indexed_db/webidbfactory_impl.cc +++ b/content/renderer/indexed_db/webidbfactory_impl.cc
@@ -75,8 +75,8 @@ io_runner_->PostTask( FROM_HERE, base::BindOnce(&IOThreadHelper::GetDatabaseNames, - base::Unretained(io_helper_), - base::Passed(&callbacks_impl), url::Origin(origin))); + base::Unretained(io_helper_), std::move(callbacks_impl), + url::Origin(origin))); } void WebIDBFactoryImpl::Open( @@ -95,10 +95,10 @@ base::WrapUnique(database_callbacks), std::move(task_runner)); io_runner_->PostTask( FROM_HERE, - base::BindOnce( - &IOThreadHelper::Open, base::Unretained(io_helper_), name.Utf16(), - version, transaction_id, base::Passed(&callbacks_impl), - base::Passed(&database_callbacks_impl), url::Origin(origin))); + base::BindOnce(&IOThreadHelper::Open, base::Unretained(io_helper_), + name.Utf16(), version, transaction_id, + std::move(callbacks_impl), + std::move(database_callbacks_impl), url::Origin(origin))); } void WebIDBFactoryImpl::DeleteDatabase( @@ -113,8 +113,8 @@ io_runner_->PostTask( FROM_HERE, base::BindOnce(&IOThreadHelper::DeleteDatabase, base::Unretained(io_helper_), name.Utf16(), - base::Passed(&callbacks_impl), - url::Origin(origin), force_close)); + std::move(callbacks_impl), url::Origin(origin), + force_close)); } WebIDBFactoryImpl::IOThreadHelper::IOThreadHelper(
diff --git a/content/renderer/input/input_event_filter.cc b/content/renderer/input/input_event_filter.cc index e8865d7..13fe23e 100644 --- a/content/renderer/input/input_event_filter.cc +++ b/content/renderer/input/input_event_filter.cc
@@ -287,7 +287,7 @@ void InputEventFilter::SendMessage(std::unique_ptr<IPC::Message> message) { CHECK(io_task_runner_->PostTask( FROM_HERE, base::BindOnce(&InputEventFilter::SendMessageOnIOThread, this, - base::Passed(&message)))) + std::move(message)))) << "PostTask failed"; }
diff --git a/content/renderer/installedapp/related_apps_fetcher.cc b/content/renderer/installedapp/related_apps_fetcher.cc index 7cade92..2e18b20 100644 --- a/content/renderer/installedapp/related_apps_fetcher.cc +++ b/content/renderer/installedapp/related_apps_fetcher.cc
@@ -25,7 +25,7 @@ void>> callbacks) { manifest_manager_->RequestManifest( base::BindOnce(&RelatedAppsFetcher::OnGetManifestForRelatedApplications, - base::Unretained(this), base::Passed(&callbacks))); + base::Unretained(this), std::move(callbacks))); } void RelatedAppsFetcher::OnGetManifestForRelatedApplications(
diff --git a/content/renderer/media/gpu/gpu_video_accelerator_factories_impl.cc b/content/renderer/media/gpu/gpu_video_accelerator_factories_impl.cc index 75973baf..fec4f64a 100644 --- a/content/renderer/media/gpu/gpu_video_accelerator_factories_impl.cc +++ b/content/renderer/media/gpu/gpu_video_accelerator_factories_impl.cc
@@ -93,8 +93,7 @@ FROM_HERE, base::BindOnce(&GpuVideoAcceleratorFactoriesImpl:: BindVideoEncodeAcceleratorProviderOnTaskRunner, - base::Unretained(this), - base::Passed(&unbound_vea_provider))); + base::Unretained(this), std::move(unbound_vea_provider))); } GpuVideoAcceleratorFactoriesImpl::~GpuVideoAcceleratorFactoriesImpl() {}
diff --git a/content/renderer/media/stream/media_stream_video_track.cc b/content/renderer/media/stream/media_stream_video_track.cc index d06c52f..c894c97b 100644 --- a/content/renderer/media/stream/media_stream_video_track.cc +++ b/content/renderer/media/stream/media_stream_video_track.cc
@@ -137,7 +137,7 @@ callback.reset(new VideoCaptureDeliverFrameCB(it->second)); callbacks_.erase(it); task_runner->PostTask( - FROM_HERE, base::BindOnce(&ResetCallback, base::Passed(&callback))); + FROM_HERE, base::BindOnce(&ResetCallback, std::move(callback))); return; } }
diff --git a/content/renderer/media/stream/video_track_adapter.cc b/content/renderer/media/stream/video_track_adapter.cc index 8db30cbd..141f58f 100644 --- a/content/renderer/media/stream/video_track_adapter.cc +++ b/content/renderer/media/stream/video_track_adapter.cc
@@ -190,7 +190,7 @@ callbacks_.erase(it); renderer_task_runner_->PostTask( FROM_HERE, base::BindOnce(&ResetCallbackOnMainRenderThread, - base::Passed(&callback))); + std::move(callback))); return; }
diff --git a/content/renderer/media/webrtc/peer_connection_tracker.cc b/content/renderer/media/webrtc/peer_connection_tracker.cc index 431a2c7..ac58776 100644 --- a/content/renderer/media/webrtc/peer_connection_tracker.cc +++ b/content/renderer/media/webrtc/peer_connection_tracker.cc
@@ -330,7 +330,7 @@ if (!list->empty()) { main_thread_->PostTask( FROM_HERE, base::BindOnce(&InternalStatsObserver::OnCompleteImpl, - base::Passed(&list), lid_)); + std::move(list), lid_)); } }
diff --git a/content/renderer/media/webrtc/rtc_certificate_generator.cc b/content/renderer/media/webrtc/rtc_certificate_generator.cc index 24003b70..0c29b6de 100644 --- a/content/renderer/media/webrtc/rtc_certificate_generator.cc +++ b/content/renderer/media/webrtc/rtc_certificate_generator.cc
@@ -72,7 +72,7 @@ FROM_HERE, base::BindOnce( &RTCCertificateGeneratorRequest::GenerateCertificateOnWorkerThread, - this, key_params, expires_ms, base::Passed(&transition))); + this, key_params, expires_ms, std::move(transition))); } private: @@ -91,10 +91,9 @@ main_thread_->PostTask( FROM_HERE, - base::BindOnce( - &RTCCertificateGeneratorRequest::DoCallbackOnMainThread, this, - base::Passed(std::move(observer)), - base::Passed(std::make_unique<RTCCertificate>(certificate)))); + base::BindOnce(&RTCCertificateGeneratorRequest::DoCallbackOnMainThread, + this, std::move(observer), + std::make_unique<RTCCertificate>(certificate))); } void DoCallbackOnMainThread(
diff --git a/content/renderer/media/webrtc/rtc_data_channel_handler.cc b/content/renderer/media/webrtc/rtc_data_channel_handler.cc index f2369de35..aa5b721 100644 --- a/content/renderer/media/webrtc/rtc_data_channel_handler.cc +++ b/content/renderer/media/webrtc/rtc_data_channel_handler.cc
@@ -106,7 +106,7 @@ new webrtc::DataBuffer(buffer)); main_thread_->PostTask( FROM_HERE, base::BindOnce(&RtcDataChannelHandler::Observer::OnMessageImpl, - this, base::Passed(&new_buffer))); + this, std::move(new_buffer))); } void RtcDataChannelHandler::Observer::OnStateChangeImpl(
diff --git a/content/renderer/media/webrtc/rtc_peer_connection_handler.cc b/content/renderer/media/webrtc/rtc_peer_connection_handler.cc index 07b7486..9c68fbc6e 100644 --- a/content/renderer/media/webrtc/rtc_peer_connection_handler.cc +++ b/content/renderer/media/webrtc/rtc_peer_connection_handler.cc
@@ -1253,7 +1253,7 @@ main_thread_->PostTask( FROM_HERE, base::BindOnce(&RTCPeerConnectionHandler::Observer::OnDataChannelImpl, - this, base::Passed(&handler))); + this, std::move(handler))); } void OnRenegotiationNeeded() override { @@ -1826,9 +1826,8 @@ std::unique_ptr<blink::WebRTCStatsReportCallback> callback) { DCHECK(thread_checker_.CalledOnValidThread()); signaling_thread()->PostTask( - FROM_HERE, - base::BindOnce(&GetRTCStatsOnSignalingThread, task_runner_, - native_peer_connection_, base::Passed(&callback))); + FROM_HERE, base::BindOnce(&GetRTCStatsOnSignalingThread, task_runner_, + native_peer_connection_, std::move(callback))); } std::unique_ptr<blink::WebRTCRtpSender> RTCPeerConnectionHandler::AddTrack(
diff --git a/content/renderer/media/webrtc/webrtc_media_stream_adapter.cc b/content/renderer/media/webrtc/webrtc_media_stream_adapter.cc index f98f799..dbe19c6 100644 --- a/content/renderer/media/webrtc/webrtc_media_stream_adapter.cc +++ b/content/renderer/media/webrtc/webrtc_media_stream_adapter.cc
@@ -204,7 +204,7 @@ FROM_HERE, base::BindOnce(&RemoteWebRtcMediaStreamAdapter::InitializeOnMainThread, weak_factory_.GetWeakPtr(), webrtc_stream_->label(), - base::Passed(&adapter_refs), + std::move(adapter_refs), webrtc_stream_->GetAudioTracks().size(), webrtc_stream_->GetVideoTracks().size())); }
diff --git a/content/renderer/media/webrtc/webrtc_media_stream_track_adapter_map.cc b/content/renderer/media/webrtc/webrtc_media_stream_track_adapter_map.cc index 183d53f..63d13f8 100644 --- a/content/renderer/media/webrtc/webrtc_media_stream_track_adapter_map.cc +++ b/content/renderer/media/webrtc/webrtc_media_stream_track_adapter_map.cc
@@ -175,8 +175,8 @@ base::BindOnce( &WebRtcMediaStreamTrackAdapterMap::OnRemoteTrackAdapterInitialized, this, - base::Passed(base::WrapUnique( - new AdapterRef(this, AdapterRef::Type::kRemote, new_adapter))))); + base::WrapUnique( + new AdapterRef(this, AdapterRef::Type::kRemote, new_adapter)))); return base::WrapUnique( new AdapterRef(this, AdapterRef::Type::kRemote, new_adapter)); }
diff --git a/content/renderer/media/webrtc/webrtc_set_remote_description_observer.cc b/content/renderer/media/webrtc/webrtc_set_remote_description_observer.cc index 9d162d9..479313f 100644 --- a/content/renderer/media/webrtc/webrtc_set_remote_description_observer.cc +++ b/content/renderer/media/webrtc/webrtc_set_remote_description_observer.cc
@@ -94,7 +94,7 @@ main_thread_->PostTask( FROM_HERE, base::BindOnce(&WebRtcSetRemoteDescriptionObserverHandler:: OnSetRemoteDescriptionCompleteOnMainThread, - this, base::Passed(&states_or_error))); + this, std::move(states_or_error))); } void WebRtcSetRemoteDescriptionObserverHandler::
diff --git a/content/renderer/media/webrtc/webrtc_set_remote_description_observer_unittest.cc b/content/renderer/media/webrtc/webrtc_set_remote_description_observer_unittest.cc index 4d004a03..82ccfc9 100644 --- a/content/renderer/media/webrtc/webrtc_set_remote_description_observer_unittest.cc +++ b/content/renderer/media/webrtc/webrtc_set_remote_description_observer_unittest.cc
@@ -85,7 +85,7 @@ base::BindOnce( &WebRtcSetRemoteDescriptionObserverHandlerTest:: InvokeOnSetRemoteDescriptionCompleteOnSignalingThread, - base::Unretained(this), base::Passed(&error), + base::Unretained(this), std::move(error), base::Unretained(&run_loop))); run_loop.Run(); }
diff --git a/content/renderer/media_recorder/audio_track_recorder.cc b/content/renderer/media_recorder/audio_track_recorder.cc index 4cc1ceda..0fa6e1b 100644 --- a/content/renderer/media_recorder/audio_track_recorder.cc +++ b/content/renderer/media_recorder/audio_track_recorder.cc
@@ -93,7 +93,7 @@ encoder_thread_.task_runner()->PostTask( FROM_HERE, base::BindOnce(&AudioTrackEncoder::EncodeAudio, encoder_, - base::Passed(&audio_data), capture_time)); + std::move(audio_data), capture_time)); } void AudioTrackRecorder::Pause() {
diff --git a/content/renderer/media_recorder/vea_encoder.cc b/content/renderer/media_recorder/vea_encoder.cc index 4934b0a..26e51c2 100644 --- a/content/renderer/media_recorder/vea_encoder.cc +++ b/content/renderer/media_recorder/vea_encoder.cc
@@ -114,7 +114,7 @@ origin_task_runner_->PostTask( FROM_HERE, base::BindOnce(OnFrameEncodeCompleted, on_encoded_video_callback_, - front_frame.first, base::Passed(&data), nullptr, + front_frame.first, std::move(data), nullptr, front_frame.second, keyframe)); UseOutputBitstreamBufferId(bitstream_buffer_id); }
diff --git a/content/renderer/media_recorder/vpx_encoder.cc b/content/renderer/media_recorder/vpx_encoder.cc index 84c5a00..37314021 100644 --- a/content/renderer/media_recorder/vpx_encoder.cc +++ b/content/renderer/media_recorder/vpx_encoder.cc
@@ -59,8 +59,8 @@ VpxEncoder::~VpxEncoder() { main_task_runner_->PostTask( FROM_HERE, - base::BindOnce(&VpxEncoder::ShutdownEncoder, - base::Passed(&encoding_thread_), base::Passed(&encoder_))); + base::BindOnce(&VpxEncoder::ShutdownEncoder, std::move(encoding_thread_), + std::move(encoder_))); } bool VpxEncoder::CanEncodeAlphaChannel() { @@ -134,8 +134,8 @@ origin_task_runner_->PostTask( FROM_HERE, base::BindOnce(OnFrameEncodeCompleted, on_encoded_video_callback_, - video_params, base::Passed(&data), - base::Passed(&alpha_data), capture_timestamp, keyframe)); + video_params, std::move(data), std::move(alpha_data), + capture_timestamp, keyframe)); } void VpxEncoder::DoEncode(vpx_codec_ctx_t* const encoder,
diff --git a/content/renderer/mus/render_widget_window_tree_client_factory.cc b/content/renderer/mus/render_widget_window_tree_client_factory.cc index d413d47..8915f9b 100644 --- a/content/renderer/mus/render_widget_window_tree_client_factory.cc +++ b/content/renderer/mus/render_widget_window_tree_client_factory.cc
@@ -70,9 +70,9 @@ render_widget_window_tree_client_request) override { main_thread_task_runner_->PostTask( FROM_HERE, - base::BindOnce( - &BindMusConnectionOnMainThread, routing_id, base::Passed(&request), - base::Passed(&render_widget_window_tree_client_request))); + base::BindOnce(&BindMusConnectionOnMainThread, routing_id, + std::move(request), + std::move(render_widget_window_tree_client_request))); } scoped_refptr<base::SequencedTaskRunner> main_thread_task_runner_;
diff --git a/content/renderer/pepper/pepper_audio_encoder_host.cc b/content/renderer/pepper/pepper_audio_encoder_host.cc index d9a8797..7a740801 100644 --- a/content/renderer/pepper/pepper_audio_encoder_host.cc +++ b/content/renderer/pepper/pepper_audio_encoder_host.cc
@@ -489,10 +489,9 @@ // Destroy the encoder and the audio/bitstream buffers on the media thread // to avoid freeing memory the encoder might still be working on. media_task_runner_->PostTask( - FROM_HERE, - base::BindOnce(&StopAudioEncoder, base::Passed(std::move(encoder_)), - base::Passed(std::move(audio_buffer_manager_)), - base::Passed(std::move(bitstream_buffer_manager_)))); + FROM_HERE, base::BindOnce(&StopAudioEncoder, std::move(encoder_), + std::move(audio_buffer_manager_), + std::move(bitstream_buffer_manager_))); } // static
diff --git a/content/renderer/pepper/pepper_url_loader_host.cc b/content/renderer/pepper/pepper_url_loader_host.cc index 9b01074f..3f41b5b 100644 --- a/content/renderer/pepper/pepper_url_loader_host.cc +++ b/content/renderer/pepper/pepper_url_loader_host.cc
@@ -257,12 +257,10 @@ web_request.SetRequestContext(WebURLRequest::kRequestContextPlugin); web_request.SetPluginChildID(renderer_ppapi_host_->GetPluginChildId()); - // The requests from the plugins with private permission which can bypass same - // origin must skip the ServiceWorker. - web_request.SetServiceWorkerMode( - host()->permissions().HasPermission(ppapi::PERMISSION_PRIVATE) - ? WebURLRequest::ServiceWorkerMode::kNone - : WebURLRequest::ServiceWorkerMode::kAll); + // Requests from plug-ins must skip service workers, see the comment in + // CreateWebURLRequest. + DCHECK_EQ(web_request.GetServiceWorkerMode(), + WebURLRequest::ServiceWorkerMode::kNone); WebAssociatedURLLoaderOptions options; if (!has_universal_access_) {
diff --git a/content/renderer/pepper/url_request_info_util.cc b/content/renderer/pepper/url_request_info_util.cc index 1a7cad58..5a169e6 100644 --- a/content/renderer/pepper/url_request_info_util.cc +++ b/content/renderer/pepper/url_request_info_util.cc
@@ -178,6 +178,12 @@ dest->SetSiteForCookies(frame->GetDocument().SiteForCookies()); + // Plug-ins should not load via service workers as plug-ins may have their own + // origin checking logic that may get confused if service workers respond with + // resources from another origin. + // https://w3c.github.io/ServiceWorker/#implementer-concerns + dest->SetServiceWorkerMode(WebURLRequest::ServiceWorkerMode::kNone); + const std::string& headers = data->headers; if (!headers.empty()) { net::HttpUtil::HeadersIterator it(headers.begin(), headers.end(), "\n\r");
diff --git a/content/renderer/pepper/video_decoder_shim.cc b/content/renderer/pepper/video_decoder_shim.cc index 63d241f5..62fc729 100644 --- a/content/renderer/pepper/video_decoder_shim.cc +++ b/content/renderer/pepper/video_decoder_shim.cc
@@ -821,7 +821,7 @@ main_task_runner_->PostTask( FROM_HERE, base::BindOnce(&VideoDecoderShim::OnOutputComplete, shim_, - base::Passed(&pending_frame))); + std::move(pending_frame))); } void VideoDecoderShim::DecoderImpl::OnResetComplete() {
diff --git a/content/renderer/push_messaging/push_messaging_client.cc b/content/renderer/push_messaging/push_messaging_client.cc index f0450f4..1f106783 100644 --- a/content/renderer/push_messaging/push_messaging_client.cc +++ b/content/renderer/push_messaging/push_messaging_client.cc
@@ -57,10 +57,10 @@ if (options.application_server_key.IsEmpty()) { RenderFrameImpl::FromRoutingID(routing_id()) ->GetManifestManager() - .RequestManifest( - base::BindOnce(&PushMessagingClient::DidGetManifest, - base::Unretained(this), service_worker_registration, - options, user_gesture, base::Passed(&callbacks))); + .RequestManifest(base::BindOnce(&PushMessagingClient::DidGetManifest, + base::Unretained(this), + service_worker_registration, options, + user_gesture, std::move(callbacks))); } else { PushSubscriptionOptions content_options; content_options.user_visible_only = options.user_visible_only; @@ -122,7 +122,7 @@ // Safe to use base::Unretained because |push_messaging_manager_ |is // owned by |this|. base::BindOnce(&PushMessagingClient::DidSubscribe, base::Unretained(this), - base::Passed(&callbacks))); + std::move(callbacks))); } void PushMessagingClient::DidSubscribe(
diff --git a/content/renderer/push_messaging/push_provider.cc b/content/renderer/push_messaging/push_provider.cc index a7f1c3b9..d3891939 100644 --- a/content/renderer/push_messaging/push_provider.cc +++ b/content/renderer/push_messaging/push_provider.cc
@@ -140,7 +140,7 @@ if (!main_thread_task_runner->BelongsToCurrentThread()) { main_thread_task_runner->PostTask( FROM_HERE, - base::BindOnce(&PushProvider::GetInterface, base::Passed(&request))); + base::BindOnce(&PushProvider::GetInterface, std::move(request))); } else { GetInterface(std::move(request)); } @@ -198,7 +198,7 @@ // Safe to use base::Unretained because |push_messaging_manager_ |is owned // by |this|. base::BindOnce(&PushProvider::DidSubscribe, base::Unretained(this), - base::Passed(&callbacks))); + std::move(callbacks))); } void PushProvider::DidSubscribe( @@ -240,7 +240,7 @@ // Safe to use base::Unretained because |push_messaging_manager_ |is owned // by |this|. base::BindOnce(&PushProvider::DidUnsubscribe, base::Unretained(this), - base::Passed(&callbacks))); + std::move(callbacks))); } void PushProvider::DidUnsubscribe( @@ -273,7 +273,7 @@ // Safe to use base::Unretained because |push_messaging_manager_ |is owned // by |this|. base::BindOnce(&PushProvider::DidGetSubscription, base::Unretained(this), - base::Passed(&callbacks))); + std::move(callbacks))); } void PushProvider::DidGetSubscription(
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 2f59e7d..e638940 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -1810,17 +1810,20 @@ void RenderFrameImpl::BindEngagement( blink::mojom::EngagementClientAssociatedRequest request) { - engagement_binding_.Bind(std::move(request)); + engagement_binding_.Bind(std::move(request), + GetTaskRunner(blink::TaskType::kInternalIPC)); } void RenderFrameImpl::BindFullscreen( mojom::FullscreenVideoElementHandlerAssociatedRequest request) { - fullscreen_binding_.Bind(std::move(request)); + fullscreen_binding_.Bind(std::move(request), + GetTaskRunner(blink::TaskType::kInternalIPC)); } void RenderFrameImpl::BindMediaEngagement( blink::mojom::MediaEngagementClientAssociatedRequest request) { - media_engagement_binding_.Bind(std::move(request)); + media_engagement_binding_.Bind(std::move(request), + GetTaskRunner(blink::TaskType::kInternalIPC)); } void RenderFrameImpl::BindFrame( @@ -1832,12 +1835,14 @@ void RenderFrameImpl::BindFrameBindingsControl( mojom::FrameBindingsControlAssociatedRequest request) { - frame_bindings_control_binding_.Bind(std::move(request)); + frame_bindings_control_binding_.Bind( + std::move(request), GetTaskRunner(blink::TaskType::kInternalIPC)); } void RenderFrameImpl::BindFrameNavigationControl( mojom::FrameNavigationControlAssociatedRequest request) { - frame_navigation_control_binding_.Bind(std::move(request)); + frame_navigation_control_binding_.Bind( + std::move(request), GetTaskRunner(blink::TaskType::kInternalIPC)); } blink::mojom::ManifestManager& RenderFrameImpl::GetManifestManager() { @@ -7054,7 +7059,8 @@ void RenderFrameImpl::OnHostZoomClientRequest( mojom::HostZoomAssociatedRequest request) { DCHECK(!host_zoom_binding_.is_bound()); - host_zoom_binding_.Bind(std::move(request)); + host_zoom_binding_.Bind(std::move(request), + GetTaskRunner(blink::TaskType::kInternalIPC)); } void RenderFrameImpl::CheckIfAudioSinkExistsAndIsAuthorized(
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index f70df3d..405640c 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h
@@ -95,7 +95,7 @@ #include "url/origin.h" #if defined(OS_MACOSX) -#include "third_party/WebKit/common/clipboard/clipboard.mojom.h" +#include "third_party/WebKit/public/mojom/clipboard/clipboard.mojom.h" #endif #if BUILDFLAG(ENABLE_PLUGINS)
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index a09cbb09..00f013b 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -410,7 +410,7 @@ task_runner->PostTask( FROM_HERE, base::BindOnce(&CreateSingleSampleMetricsProvider, std::move(task_runner), - connector, base::Passed(&request))); + connector, std::move(request))); } class RendererLocalSurfaceIdProvider : public viz::LocalSurfaceIdProvider {
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc index ee1e624a..859cbebc 100644 --- a/content/renderer/service_worker/service_worker_context_client.cc +++ b/content/renderer/service_worker/service_worker_context_client.cc
@@ -336,11 +336,6 @@ map, std::forward<Args>(args)..., base::Time::Now()); } -void OnResponseBlobDispatchDone( - const blink::WebServiceWorkerResponse& response) { - // This frees the ref to the internal data of |response|. -} - template <typename Signature> class CallbackWrapperOnWorkerThread; @@ -995,7 +990,7 @@ main_thread_task_runner_->PostTask( FROM_HERE, base::BindOnce(&EmbeddedWorkerInstanceClientImpl::WorkerContextDestroyed, - base::Passed(&embedded_worker_client_))); + std::move(embedded_worker_client_))); } void ServiceWorkerContextClient::CountFeature(uint32_t feature) { @@ -1109,20 +1104,16 @@ const mojom::ServiceWorkerFetchResponseCallbackPtr& response_callback = context_->fetch_response_callbacks[fetch_event_id]; - if (response.blob_uuid.size()) { + if (!response.blob_uuid.empty()) { + // TODO(falken): Can we just keep |response.blob| and call OnResponse + // directly? blink::mojom::BlobPtr blob_ptr; - if (response.blob) { - blob_ptr = response.blob->TakeBlobPtr(); - response.blob = nullptr; - response_callback->OnResponseBlob( - response, std::move(blob_ptr), - base::Time::FromDoubleT(event_dispatch_time)); - } else { - // TODO(kinuko): Remove this hack once kMojoBlobs is enabled by default. - response_callback->OnResponseLegacyBlob( - response, base::Time::FromDoubleT(event_dispatch_time), - base::BindOnce(&OnResponseBlobDispatchDone, web_response)); - } + DCHECK(response.blob); + blob_ptr = response.blob->TakeBlobPtr(); + response.blob = nullptr; + response_callback->OnResponseBlob( + response, std::move(blob_ptr), + base::Time::FromDoubleT(event_dispatch_time)); } else { response_callback->OnResponse(response, base::Time::FromDoubleT(event_dispatch_time));
diff --git a/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.cc b/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.cc index 157340b..291c24b 100644 --- a/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.cc +++ b/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.cc
@@ -177,7 +177,7 @@ std::move(script_info->body), script_info->body_size); receivers->Start(base::BindOnce(&Internal::OnScriptReceived, weak_factory_.GetWeakPtr(), - base::Passed(&script_info))); + std::move(script_info))); DCHECK(!base::ContainsKey(running_receivers_, script_url)); running_receivers_[script_url] = std::move(receivers); }
diff --git a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc index 96a3333..6fceda5 100644 --- a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc +++ b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
@@ -407,7 +407,7 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&AddDevice, base::WrapRefCounted(adapter_ptr), - base::Passed(GetHeartRateDevice(adapter_ptr)))); + GetHeartRateDevice(adapter_ptr))); return GetDiscoverySession(); })); @@ -465,7 +465,7 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&AddDevice, base::WrapRefCounted(adapter_ptr), - base::Passed(&glucose_device))); + std::move(glucose_device))); // Add uuid and notify of device changed. changing_battery_ptr->AddUUID(BluetoothUUID(kBatteryServiceUUID)); @@ -516,7 +516,7 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&AddDevice, base::WrapRefCounted(adapter_ptr), - base::Passed(&glucose_device))); + std::move(glucose_device))); // Post task to remove ConnectedHeartRateDevice. base::ThreadTaskRunnerHandle::Get()->PostTask(
diff --git a/content/shell/renderer/layout_test/test_media_stream_video_renderer.cc b/content/shell/renderer/layout_test/test_media_stream_video_renderer.cc index 4da4f90e..e5a2e38 100644 --- a/content/shell/renderer/layout_test/test_media_stream_video_renderer.cc +++ b/content/shell/renderer/layout_test/test_media_stream_video_renderer.cc
@@ -9,6 +9,7 @@ #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "media/base/video_frame.h" +#include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_test_support.h" namespace content { @@ -18,7 +19,7 @@ const base::TimeDelta& frame_duration, const base::Closure& error_cb, const MediaStreamVideoRenderer::RepaintCB& repaint_cb) - : task_runner_(base::ThreadTaskRunnerHandle::Get()), + : task_runner_(blink::scheduler::GetSingleThreadTaskRunnerForTesting()), io_task_runner_(io_task_runner), size_(size), state_(kStopped),
diff --git a/content/shell/test_runner/pixel_dump.cc b/content/shell/test_runner/pixel_dump.cc index 4d3d223..f6b75f2 100644 --- a/content/shell/test_runner/pixel_dump.cc +++ b/content/shell/test_runner/pixel_dump.cc
@@ -157,7 +157,7 @@ web_frame->GetTaskRunner(blink::TaskType::kInternalTest) ->PostTask(FROM_HERE, base::BindOnce(&CapturePixelsForPrinting, base::Unretained(web_frame), - base::Passed(std::move(callback)))); + std::move(callback))); } base::OnceCallback<void(const SkBitmap&)> @@ -172,8 +172,7 @@ if (wr.IsEmpty()) return original_callback; - return base::BindOnce(&DrawSelectionRect, wr, - base::Passed(std::move(original_callback))); + return base::BindOnce(&DrawSelectionRect, wr, std::move(original_callback)); } void CopyImageAtAndCapturePixels(
diff --git a/content/shell/test_runner/test_runner_for_specific_view.cc b/content/shell/test_runner/test_runner_for_specific_view.cc index 2b5e0dc..b47ed35 100644 --- a/content/shell/test_runner/test_runner_for_specific_view.cc +++ b/content/shell/test_runner/test_runner_for_specific_view.cc
@@ -235,7 +235,7 @@ web_view()->MainFrame()->ToWebLocalFrame(), base::BindOnce(&TestRunnerForSpecificView::CapturePixelsCallback, weak_factory_.GetWeakPtr(), - base::Passed(std::move(persistent_callback)))); + std::move(persistent_callback))); } void TestRunnerForSpecificView::CapturePixelsCallback( @@ -295,7 +295,7 @@ web_view()->MainFrame()->ToWebLocalFrame(), x, y, base::BindOnce(&TestRunnerForSpecificView::CapturePixelsCallback, weak_factory_.GetWeakPtr(), - base::Passed(std::move(persistent_callback)))); + std::move(persistent_callback))); } void TestRunnerForSpecificView::GetManifestThen(
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 0d518849..3ff735c 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -745,7 +745,6 @@ "../browser/loader/reload_cache_control_browsertest.cc", "../browser/loader/resource_dispatcher_host_browsertest.cc", "../browser/loader/resource_scheduler_browsertest.cc", - "../browser/loader/web_package_request_handler_browsertest.cc", "../browser/manifest/manifest_browsertest.cc", "../browser/media/encrypted_media_browsertest.cc", "../browser/media/media_browsertest.cc", @@ -820,6 +819,7 @@ "../browser/web_contents/web_contents_impl_browsertest.cc", "../browser/web_contents/web_contents_view_aura_browsertest.cc", "../browser/web_contents_binding_set_browsertest.cc", + "../browser/web_package/web_package_request_handler_browsertest.cc", "../browser/webkit_browsertest.cc", "../browser/webui/web_ui_browsertest.cc", "../browser/webui/web_ui_mojo_browsertest.cc", @@ -1328,9 +1328,6 @@ "../browser/loader/resource_buffer_unittest.cc", "../browser/loader/resource_dispatcher_host_unittest.cc", "../browser/loader/resource_loader_unittest.cc", - "../browser/loader/signed_exchange_cert_fetcher_unittest.cc", - "../browser/loader/signed_exchange_header_parser_unittest.cc", - "../browser/loader/signed_exchange_signature_verifier_unittest.cc", "../browser/loader/source_stream_to_data_pipe_unittest.cc", "../browser/loader/temporary_file_stream_unittest.cc", "../browser/loader/test_resource_handler.cc", @@ -1491,6 +1488,9 @@ "../browser/web_contents/web_contents_view_mac_unittest.mm", "../browser/web_contents/web_drag_dest_mac_unittest.mm", "../browser/web_contents/web_drag_source_mac_unittest.mm", + "../browser/web_package/signed_exchange_cert_fetcher_unittest.cc", + "../browser/web_package/signed_exchange_header_parser_unittest.cc", + "../browser/web_package/signed_exchange_signature_verifier_unittest.cc", "../browser/websockets/websocket_manager_unittest.cc", "../browser/webui/url_data_manager_backend_unittest.cc", "../browser/webui/web_ui_data_source_unittest.cc",
diff --git a/content/test/data/accessibility/html/img-expected-android.txt b/content/test/data/accessibility/html/img-expected-android.txt index b43cea6..1d3eb951 100644 --- a/content/test/data/accessibility/html/img-expected-android.txt +++ b/content/test/data/accessibility/html/img-expected-android.txt
@@ -1,7 +1,7 @@ -android.webkit.WebView focusable focused scrollable -++android.view.View -++++android.widget.Image role_description='graphic' name='pipe' +android.webkit.WebView focusable focused has_image scrollable +++android.view.View has_image +++++android.widget.Image role_description='graphic' has_image name='pipe' ++++android.view.View name=' ' -++++android.widget.Image role_description='graphic' +++++android.widget.Image role_description='graphic' has_image ++++android.view.View name=' ' -++++android.widget.Image role_description='graphic' name=' ' \ No newline at end of file +++++android.widget.Image role_description='graphic' has_image name=' '
diff --git a/content/test/data/accessibility/html/img.html b/content/test/data/accessibility/html/img.html index 4e143ab8..8e7671f 100644 --- a/content/test/data/accessibility/html/img.html +++ b/content/test/data/accessibility/html/img.html
@@ -1,6 +1,7 @@ <!-- @MAC-ALLOW:AXRoleDescription='image' @WIN-ALLOW:xml-roles:* +@ANDROID-ALLOW:has_image --> <html> <body>
diff --git a/content/test/fuzzer/signed_exchange_cert_fetcher_parser_fuzzer.cc b/content/test/fuzzer/signed_exchange_cert_fetcher_parser_fuzzer.cc index baa227e..b38c88d 100644 --- a/content/test/fuzzer/signed_exchange_cert_fetcher_parser_fuzzer.cc +++ b/content/test/fuzzer/signed_exchange_cert_fetcher_parser_fuzzer.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/signed_exchange_cert_fetcher.h" // nogncheck +#include "content/browser/web_package/signed_exchange_cert_fetcher.h" // nogncheck #include "base/strings/string_piece.h"
diff --git a/content/test/fuzzer/signed_exchange_header_parser_fuzzer.cc b/content/test/fuzzer/signed_exchange_header_parser_fuzzer.cc index 8bd1aa61..a1834bc3 100644 --- a/content/test/fuzzer/signed_exchange_header_parser_fuzzer.cc +++ b/content/test/fuzzer/signed_exchange_header_parser_fuzzer.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/signed_exchange_header_parser.h" // nogncheck +#include "content/browser/web_package/signed_exchange_header_parser.h" // nogncheck namespace content {
diff --git a/content/test/mock_platform_notification_service.cc b/content/test/mock_platform_notification_service.cc index b6dd0ba..1e35fb3c 100644 --- a/content/test/mock_platform_notification_service.cc +++ b/content/test/mock_platform_notification_service.cc
@@ -98,7 +98,7 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::BindOnce(callback, base::Passed(&displayed_notifications), + base::BindOnce(callback, std::move(displayed_notifications), true /* supports_synchronization */)); }
diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn index 30b71904..40513f36 100644 --- a/extensions/BUILD.gn +++ b/extensions/BUILD.gn
@@ -1,6 +1,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/jumbo.gni") import("//extensions/features/features.gni") import("//testing/test.gni") import("//tools/grit/grit_rule.gni") @@ -56,7 +57,7 @@ ] } -static_library("test_support") { +jumbo_static_library("test_support") { testonly = true sources = [ "browser/api/declarative/test_rules_registry.cc",
diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn index ce05fe34..f5b40ea 100644 --- a/extensions/browser/BUILD.gn +++ b/extensions/browser/BUILD.gn
@@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/config/features.gni") +import("//build/config/jumbo.gni") import("//extensions/features/features.gni") assert(enable_extensions) @@ -35,7 +36,7 @@ ] } -source_set("browser_sources") { +jumbo_source_set("browser_sources") { visibility = [ "./*" ] sources = [ @@ -479,7 +480,7 @@ } } -source_set("test_support") { +jumbo_source_set("test_support") { testonly = true sources = [ "preload_check_test_util.cc",
diff --git a/extensions/browser/api/system_display/display_info_provider.cc b/extensions/browser/api/system_display/display_info_provider.cc index 3df8d0f..a4345b6 100644 --- a/extensions/browser/api/system_display/display_info_provider.cc +++ b/extensions/browser/api/system_display/display_info_provider.cc
@@ -72,10 +72,10 @@ unit.work_area.width = work_area.width(); unit.work_area.height = work_area.height(); unit.has_touch_support = - display.touch_support() == display::Display::TOUCH_SUPPORT_AVAILABLE; + display.touch_support() == display::Display::TouchSupport::AVAILABLE; unit.has_accelerometer_support = display.accelerometer_support() == - display::Display::ACCELEROMETER_SUPPORT_AVAILABLE; + display::Display::AccelerometerSupport::AVAILABLE; return unit; }
diff --git a/extensions/common/BUILD.gn b/extensions/common/BUILD.gn index a7c7c5c0..bcbd37b5 100644 --- a/extensions/common/BUILD.gn +++ b/extensions/common/BUILD.gn
@@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/config/features.gni") +import("//build/config/jumbo.gni") import("//components/nacl/features.gni") import("//extensions/features/features.gni") import("//mojo/public/tools/bindings/mojom.gni") @@ -40,7 +41,7 @@ # This must be a static library because extensions common depends on # GetTrustedICAPublicKey in extensions/browser which isn't always linked # in. TODO(brettw): This reverse dependency should be fixed. - static_library("common") { + jumbo_static_library("common") { sources = [ "alias.h", "api/bluetooth/bluetooth_manifest_data.cc",
diff --git a/extensions/renderer/BUILD.gn b/extensions/renderer/BUILD.gn index fd6ee280..5c3222c 100644 --- a/extensions/renderer/BUILD.gn +++ b/extensions/renderer/BUILD.gn
@@ -3,11 +3,12 @@ # found in the LICENSE file. import("//build/config/features.gni") +import("//build/config/jumbo.gni") import("//extensions/features/features.gni") assert(enable_extensions) -source_set("renderer") { +jumbo_source_set("renderer") { sources = [ "activity_log_converter_strategy.cc", "activity_log_converter_strategy.h", @@ -352,7 +353,7 @@ } } -static_library("unit_test_support") { +jumbo_static_library("unit_test_support") { # Sources that are shared between chrome-based renderer unit tests and # top-level extensions renderer unit tests. testonly = true
diff --git a/ios/build/bots/scripts/run.py b/ios/build/bots/scripts/run.py index 0e5b0e3..8cba112 100755 --- a/ios/build/bots/scripts/run.py +++ b/ios/build/bots/scripts/run.py
@@ -149,7 +149,7 @@ parser.add_argument( '-s', '--shards', - help='Number of shards to split test cases. (Not implemented yet)', + help='Number of shards to split test cases.', metavar='n', type=int, )
diff --git a/ios/build/bots/scripts/test_runner.py b/ios/build/bots/scripts/test_runner.py index 59f309e..1e2c9486 100644 --- a/ios/build/bots/scripts/test_runner.py +++ b/ios/build/bots/scripts/test_runner.py
@@ -4,17 +4,23 @@ """Test runners for iOS.""" +from multiprocessing import pool + import argparse import collections import errno +import json import os import plistlib +import re import shutil import subprocess import sys import tempfile import time +from multiprocessing import pool + import find_xcode import gtest_utils import xctest_utils @@ -198,6 +204,46 @@ return True +def shard_xctest(object_path, shards, test_cases=None): + """Gets EarlGrey test methods inside a test target and splits them into shards + + Args: + object_path: Path of the test target bundle. + shards: Number of shards to split tests. + test_cases: Passed in test cases to run. + + Returns: + A list of test shards. + """ + cmd = ['otool', '-ov', object_path] + test_pattern = re.compile( + 'imp -\[(?P<testSuite>[A-Za-z_][A-Za-z0-9_]*Test[Case]*) ' + '(?P<testMethod>test[A-Za-z0-9_]*)\]') + test_names = test_pattern.findall(subprocess.check_output(cmd)) + + # If test_cases are passed in, only shard the intersection of them and the + # listed tests. Format of passed-in test_cases can be either 'testSuite' or + # 'testSuite/testMethod'. The listed tests are tuples of ('testSuite', + # 'testMethod'). The intersection includes both test suites and test methods. + tests_set = set() + if test_cases: + for test in test_names: + test_method = '%s/%s' % (test[0], test[1]) + if test[0] in test_cases or test_method in test_cases: + tests_set.add(test_method) + else: + for test in test_names: + # 'ChromeTestCase' is the parent class of all EarlGrey test classes. It + # has no real tests. + if 'ChromeTestCase' != test[0]: + tests_set.add('%s/%s' % (test[0], test[1])) + + tests = sorted(tests_set) + shard_len = len(tests)/shards + (len(tests) % shards > 0) + test_shards=[tests[i:i + shard_len] for i in range(0, len(tests), shard_len)] + return test_shards + + class TestRunner(object): """Base class containing common functionality.""" @@ -349,7 +395,20 @@ shutil.rmtree(DERIVED_DATA) os.mkdir(DERIVED_DATA) - def _run(self, cmd): + def run_tests(self, test_shard=None): + """Runs passed-in tests. + + Args: + test_shard: Test cases to be included in the run. + + Return: + out: (list) List of strings of subprocess's output. + udid: (string) Name of the simulator device in the run. + returncode: (int) Return code of subprocess. + """ + raise NotImplementedError + + def _run(self, cmd, shards=1): """Runs the specified command, parsing GTest output. Args: @@ -358,33 +417,51 @@ Returns: GTestResult instance. """ - print ' '.join(cmd) - print - result = gtest_utils.GTestResult(cmd) if self.xctest_path: parser = xctest_utils.XCTestLogParser() else: parser = gtest_utils.GTestLogParser() - proc = subprocess.Popen( - cmd, - env=self.get_launch_env(), - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - ) + if shards > 1: + test_shards = shard_xctest( + os.path.join(self.app_path, self.app_name), + shards, + self.test_cases + ) - while True: - line = proc.stdout.readline() - if not line: - break - line = line.rstrip() - parser.ProcessLine(line) - print line + thread_pool = pool.ThreadPool(processes=shards) + for out, name, ret in thread_pool.imap_unordered( + self.run_tests, test_shards): + print "Simulator %s" % name + for line in out: + print line + parser.ProcessLine(line) + returncode = ret if ret else 0 + thread_pool.close() + thread_pool.join() + else: + # TODO(crbug.com/812705): Implement test sharding for unit tests. + # TODO(crbug.com/812712): Use thread pool for DeviceTestRunner as well. + proc = subprocess.Popen( + cmd, + env=self.get_launch_env(), + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + ) + while True: + line = proc.stdout.readline() + if not line: + break + line = line.rstrip() + parser.ProcessLine(line) + print line + sys.stdout.flush() + + proc.wait() sys.stdout.flush() - proc.wait() - sys.stdout.flush() + returncode = proc.returncode for test in parser.FailedTests(include_flaky=True): # Test cases are named as <test group>.<test case>. If the test case @@ -396,12 +473,12 @@ result.passed_tests.extend(parser.PassedTests(include_flaky=True)) - print '%s returned %s' % (cmd[0], proc.returncode) + print '%s returned %s' % (cmd[0], returncode) print # iossim can return 5 if it exits noncleanly even if all tests passed. # Therefore we cannot rely on process exit code to determine success. - result.finalize(proc.returncode, parser.CompletedWithoutFailure()) + result.finalize(returncode, parser.CompletedWithoutFailure()) return result def launch(self): @@ -409,7 +486,7 @@ self.set_up() cmd = self.get_launch_command() try: - result = self._run(cmd) + result = self._run(cmd=cmd, shards=self.shards or 1) if result.crashed and not result.crashed_test: # If the app crashed but not during any particular test case, assume # it crashed on startup. Try one more time. @@ -558,7 +635,6 @@ self.platform = platform self.start_time = None self.version = version - # TODO(crbug.com/808267): Implement iOS test sharding. self.shards = shards @staticmethod @@ -672,7 +748,81 @@ shutil.rmtree(self.homedir, ignore_errors=True) self.homedir = '' - def get_launch_command(self, test_filter=None, invert=False): + def run_tests(self, test_shard=None): + """Runs passed-in tests. Builds a command and create a simulator to + run tests. + Args: + test_shard: Test cases to be included in the run. + + Return: + out: (list) List of strings of subprocess's output. + udid: (string) Name of the simulator device in the run. + returncode: (int) Return code of subprocess. + """ + udid = self.getSimulator() + cmd = self.sharding_cmd[:] + cmd.extend(['-u', udid]) + if test_shard: + for test in test_shard: + cmd.extend(['-t', test]) + + cmd.append(self.app_path) + if self.xctest_path: + cmd.append(self.xctest_path) + + proc = subprocess.Popen( + cmd, + env=self.get_launch_env(), + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + ) + + out = [] + while True: + line = proc.stdout.readline() + if not line: + break + out.append(line.rstrip()) + + self.deleteSimulator(udid) + return (out, udid, proc.returncode) + + def getSimulator(self): + """Creates a simulator device by device types and runtimes. Returns the + udid for the created simulator instance. + + Returns: + An udid of a simulator device. + """ + simctl_list = json.loads(subprocess.check_output( + ['xcrun', 'simctl', 'list', '-j'])) + runtimes = simctl_list['runtimes'] + devices = simctl_list['devicetypes'] + + device_type_id = '' + for device in devices: + if device['name'] == self.platform: + device_type_id = device['identifier'] + + runtime_id = '' + for runtime in runtimes: + if runtime['name'] == 'iOS %s' % self.version: + runtime_id = runtime['identifier'] + + name = '%s test' % self.platform + print 'creating simulator %s' % name + udid = subprocess.check_output([ + 'xcrun', 'simctl', 'create', name, device_type_id, runtime_id]).rstrip() + print udid + return udid + + def deleteSimulator(self, udid=None): + """Removes dynamically created simulator devices.""" + if udid: + print 'deleting simulator %s' % udid + subprocess.check_output(['xcrun', 'simctl', 'delete', udid]) + + def get_launch_command(self, test_filter=None, invert=False, test_shard=None): """Returns the command that can be used to launch the test app. Args: @@ -689,27 +839,31 @@ '-s', self.version, ] - if test_filter: - if self.xctest_path: - # iossim doesn't support inverted filters for XCTests. - if not invert: - for test in test_filter: - cmd.extend(['-t', test]) - else: - kif_filter = get_kif_test_filter(test_filter, invert=invert) - gtest_filter = get_gtest_filter(test_filter, invert=invert) - cmd.extend(['-e', 'GKIF_SCENARIO_FILTER=%s' % kif_filter]) - cmd.extend(['-c', '--gtest_filter=%s' % gtest_filter]) - elif self.xctest_path and not invert: - for test_case in self.test_cases: - cmd.extend(['-t', test_case]) - for env_var in self.env_vars: cmd.extend(['-e', env_var]) for test_arg in self.test_args: cmd.extend(['-c', test_arg]) + if self.xctest_path: + self.sharding_cmd = cmd[:] + if test_filter: + # iossim doesn't support inverted filters for XCTests. + if not invert: + for test in test_filter: + cmd.extend(['-t', test]) + elif test_shard: + for test in test_shard: + cmd.extend(['-t', test]) + elif not invert: + for test_case in self.test_cases: + cmd.extend(['-t', test_case]) + elif test_filter: + kif_filter = get_kif_test_filter(test_filter, invert=invert) + gtest_filter = get_gtest_filter(test_filter, invert=invert) + cmd.extend(['-e', 'GKIF_SCENARIO_FILTER=%s' % kif_filter]) + cmd.extend(['-c', '--gtest_filter=%s' % gtest_filter]) + cmd.append(self.app_path) if self.xctest_path: cmd.append(self.xctest_path)
diff --git a/ios/build/bots/scripts/test_runner_test.py b/ios/build/bots/scripts/test_runner_test.py index ca81faf9..2d3ac68 100755 --- a/ios/build/bots/scripts/test_runner_test.py +++ b/ios/build/bots/scripts/test_runner_test.py
@@ -181,7 +181,7 @@ return @staticmethod - def _run(command): + def _run(cmd, shards=None): return collections.namedtuple('result', ['crashed', 'crashed_test'])( crashed=True, crashed_test=None) @@ -204,8 +204,45 @@ with self.assertRaises(test_runner.AppLaunchError): tr.launch() + def test_run(self): + """Ensures the _run method is correct with test sharding.""" + def shard_xctest(object_path, shards, test_cases=None): + return [['a/1', 'b/2'], ['c/3', 'd/4'], ['e/5']] + + def run_tests(self, test_shard=None): + out = [] + for test in test_shard: + testname = test.split('/') + out.append('Test Case \'-[%s %s]\' started.' % + (testname[0], testname[1])) + out.append('Test Case \'-[%s %s]\' passed (0.1 seconds)' % + (testname[0], testname[1])) + return (out, 0, 0) + + tr = test_runner.SimulatorTestRunner( + 'fake-app', + 'fake-iossim', + 'platform', + 'os', + 'xcode-version', + 'xcode-build', + 'out-dir', + ) + self.mock(test_runner, 'shard_xctest', shard_xctest) + self.mock(test_runner.SimulatorTestRunner, 'run_tests', run_tests) + + tr.xctest_path = 'fake.xctest' + cmd = tr.get_launch_command() + result = tr._run(cmd=cmd, shards=3) + self.assertIn('a/1', result.passed_tests) + self.assertIn('b/2', result.passed_tests) + self.assertIn('c/3', result.passed_tests) + self.assertIn('d/4', result.passed_tests) + self.assertIn('e/5', result.passed_tests) + def test_get_launch_command(self): - """Ensures test filters are set correctly for launch command""" + """Ensures launch command is correct with test_filters, test sharding and + test_cases.""" tr = test_runner.SimulatorTestRunner( 'fake-app', 'fake-iossim', @@ -245,7 +282,7 @@ return @staticmethod - def _run(command): + def _run(cmd, shards=None): result = collections.namedtuple( 'result', [ 'crashed', @@ -255,7 +292,7 @@ 'passed_tests', ], ) - if '-e' not in command: + if '-e' not in cmd: # First run, has no test filter supplied. Mock a crash. return result( crashed=True,
diff --git a/ios/chrome/browser/ui/BUILD.gn b/ios/chrome/browser/ui/BUILD.gn index 40c0efaa..7b8e36c 100644 --- a/ios/chrome/browser/ui/BUILD.gn +++ b/ios/chrome/browser/ui/BUILD.gn
@@ -98,6 +98,7 @@ testonly = true sources = [ "browser_container_view_unittest.mm", + "browser_view_controller_helper_unittest.mm", "browser_view_controller_unittest.mm", "chrome_web_view_factory_unittest.mm", "file_locations_unittest.mm", @@ -117,6 +118,7 @@ ":ui_internal", "//base", "//base/test:test_support", + "//components/bookmarks/browser", "//components/bookmarks/test", "//components/payments/core", "//components/prefs:test_support", @@ -140,8 +142,8 @@ "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/ntp:ntp_controller", "//ios/chrome/browser/ui/toolbar", - "//ios/chrome/browser/ui/toolbar:test_support", "//ios/chrome/browser/ui/toolbar/public", + "//ios/chrome/browser/ui/toolbar/test", "//ios/chrome/browser/web:web_internal", "//ios/chrome/browser/web_state_list", "//ios/chrome/browser/web_state_list:test_support", @@ -239,6 +241,8 @@ "browser_view_controller.mm", "browser_view_controller_dependency_factory.h", "browser_view_controller_dependency_factory.mm", + "browser_view_controller_helper.h", + "browser_view_controller_helper.mm", "chrome_web_view_factory.h", "chrome_web_view_factory.mm", "external_file_controller.h",
diff --git a/ios/chrome/browser/ui/autofill/BUILD.gn b/ios/chrome/browser/ui/autofill/BUILD.gn index 01345b7..58edfcd 100644 --- a/ios/chrome/browser/ui/autofill/BUILD.gn +++ b/ios/chrome/browser/ui/autofill/BUILD.gn
@@ -31,6 +31,7 @@ "//ios/chrome/browser/autofill", "//ios/chrome/browser/browser_state", "//ios/chrome/browser/infobars", + "//ios/chrome/browser/signin", "//ios/chrome/browser/ssl", "//ios/chrome/browser/ui", "//ios/chrome/browser/ui/autofill/cells",
diff --git a/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.h b/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.h index 8d9638af..ad7e386 100644 --- a/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.h +++ b/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.h
@@ -48,6 +48,7 @@ PersonalDataManager* GetPersonalDataManager() override; PrefService* GetPrefs() override; syncer::SyncService* GetSyncService() override; + identity::IdentityManager* GetIdentityManager() override; IdentityProvider* GetIdentityProvider() override; ukm::UkmRecorder* GetUkmRecorder() override; AddressNormalizer* GetAddressNormalizer() override; @@ -97,6 +98,7 @@ PersonalDataManager* personal_data_manager_; web::WebState* web_state_; __weak id<AutofillClientIOSBridge> bridge_; + identity::IdentityManager* identity_manager_; std::unique_ptr<IdentityProvider> identity_provider_; scoped_refptr<AutofillWebDataService> autofill_web_data_service_; infobars::InfoBarManager* infobar_manager_;
diff --git a/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm b/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm index a1fb3aa..d4dd9ed 100644 --- a/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm +++ b/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm
@@ -23,6 +23,7 @@ #include "ios/chrome/browser/autofill/address_normalizer_factory.h" #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" #include "ios/chrome/browser/infobars/infobar_utils.h" +#include "ios/chrome/browser/signin/identity_manager_factory.h" #import "ios/chrome/browser/ssl/insecure_input_tab_helper.h" #include "ios/chrome/browser/ui/autofill/card_unmask_prompt_view_bridge.h" #include "ios/chrome/browser/web_data_service_factory.h" @@ -46,6 +47,9 @@ browser_state->GetOriginalChromeBrowserState())), web_state_(web_state), bridge_(bridge), + identity_manager_( + IdentityManagerFactory::GetInstance()->GetForBrowserState( + browser_state)), identity_provider_(std::move(identity_provider)), autofill_web_data_service_( ios::WebDataServiceFactory::GetAutofillWebDataForBrowserState( @@ -78,6 +82,10 @@ return nullptr; } +identity::IdentityManager* ChromeAutofillClientIOS::GetIdentityManager() { + return identity_manager_; +} + IdentityProvider* ChromeAutofillClientIOS::GetIdentityProvider() { return identity_provider_.get(); }
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index 9fe35b2..541d591 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -123,6 +123,7 @@ #include "ios/chrome/browser/ui/bookmarks/bookmark_model_bridge_observer.h" #import "ios/chrome/browser/ui/browser_container_view.h" #import "ios/chrome/browser/ui/browser_view_controller_dependency_factory.h" +#import "ios/chrome/browser/ui/browser_view_controller_helper.h" #import "ios/chrome/browser/ui/bubble/bubble_util.h" #import "ios/chrome/browser/ui/bubble/bubble_view_controller_presenter.h" #import "ios/chrome/browser/ui/chrome_web_view_factory.h" @@ -203,7 +204,6 @@ #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_base_feature.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_constants.h" #include "ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h" -#include "ios/chrome/browser/ui/toolbar/toolbar_model_ios.h" #import "ios/chrome/browser/ui/toolbar/toolbar_snapshot_providing.h" #import "ios/chrome/browser/ui/toolbar/toolbar_ui.h" #import "ios/chrome/browser/ui/toolbar/toolbar_ui_broadcasting_util.h" @@ -283,6 +283,8 @@ namespace { +const size_t kMaxURLDisplayChars = 32 * 1024; + typedef NS_ENUM(NSInteger, ContextMenuHistogram) { // Note: these values must match the ContextMenuOption enum in histograms.xml. ACTION_OPEN_IN_NEW_TAB = 0, @@ -454,7 +456,7 @@ // Facade objects used by |_toolbarCoordinator|. // Must outlive |_toolbarCoordinator|. std::unique_ptr<ToolbarModelDelegateIOS> _toolbarModelDelegate; - std::unique_ptr<ToolbarModelIOS> _toolbarModelIOS; + std::unique_ptr<ToolbarModel> _toolbarModel; // Controller for edge swipe gestures for page and tab navigation. SideSwipeController* _sideSwipeController; @@ -672,6 +674,8 @@ @property(nonatomic, weak) UIView* tabStripView; // Helper for saving images. @property(nonatomic, strong) ImageSaver* imageSaver; +// Helper for the bvc. +@property(nonatomic, strong) BrowserViewControllerHelper* helper; // The user agent type used to load the currently visible page. User agent // type is NONE if there is no visible page or visible page is a native @@ -951,6 +955,7 @@ @synthesize footerFullscreenProgress = _footerFullscreenProgress; @synthesize toolbarInterface = _toolbarInterface; @synthesize imageSaver = _imageSaver; +@synthesize helper = _helper; // DialogPresenterDelegate property @synthesize dialogPresenterDelegateIsPresenting = _dialogPresenterDelegateIsPresenting; @@ -1574,6 +1579,11 @@ UIViewAutoresizing initialViewAutoresizing = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + // Clip the content to the bounds of the view. This prevents the WebView to + // overflow outside of the BVC, which is particularly visible during rotation. + // The WebView is overflowing its bounds to be displayed below the toolbars. + self.view.clipsToBounds = YES; + self.contentArea = [[BrowserContainerView alloc] initWithFrame:initialViewsRect]; self.contentArea.autoresizingMask = initialViewAutoresizing; @@ -1723,7 +1733,8 @@ [_toolbarUIUpdater stopUpdating]; _toolbarUIUpdater = nil; _toolbarModelDelegate = nil; - _toolbarModelIOS = nil; + _toolbarModel = nil; + self.helper = nil; [self.tabStripCoordinator stop]; self.tabStripCoordinator = nil; self.tabStripView = nil; @@ -1957,8 +1968,9 @@ // Create the toolbar model and controller. _toolbarModelDelegate.reset( new ToolbarModelDelegateIOS([_model webStateList])); - _toolbarModelIOS.reset([_dependencyFactory - newToolbarModelIOSWithDelegate:_toolbarModelDelegate.get()]); + _toolbarModel = std::make_unique<ToolbarModelImpl>( + _toolbarModelDelegate.get(), kMaxURLDisplayChars); + self.helper = [_dependencyFactory newBrowserViewControllerHelper]; if (IsUIRefreshPhase1Enabled()) { PrimaryToolbarCoordinator* topToolbarCoordinator = @@ -2064,7 +2076,7 @@ // The height of the secondary toolbar with the bottom safe area inset included. // Returns 0 if the toolbar should be hidden. - (CGFloat)secondaryToolbarHeightWithInset { - if (!IsSplitToolbarMode()) + if (!IsSplitToolbarMode(self)) return 0; UIView* secondaryToolbar = @@ -2131,7 +2143,7 @@ // both browser state and tab model are valid. - (void)addUIFunctionalityForModelAndBrowserState { DCHECK(_browserState); - DCHECK(_toolbarModelIOS); + DCHECK(_toolbarModel); DCHECK(_model); DCHECK([self isViewLoaded]); @@ -2202,7 +2214,7 @@ initWithBaseViewController:self browserState:_browserState dispatcher:self.dispatcher]; - [_paymentRequestManager setToolbarModel:_toolbarModelIOS.get()]; + [_paymentRequestManager setToolbarModel:_toolbarModel.get()]; [_paymentRequestManager setActiveWebState:[_model currentTab].webState]; } } @@ -2334,7 +2346,7 @@ - (void)updateToolbar { // If the BVC has been partially torn down for low memory, wait for the // view rebuild to handle toolbar updates. - if (!(_toolbarModelIOS && _browserState)) + if (!(self.helper && _browserState)) return; Tab* tab = [_model currentTab]; @@ -2342,7 +2354,8 @@ return; [self.toolbarInterface updateToolsMenu]; - if (_insertedTabWasPrerenderedTab && !_toolbarModelIOS->IsLoading()) + if (_insertedTabWasPrerenderedTab && + ![self.helper isToolbarLoading:self.currentWebState]) [self.primaryToolbarCoordinator showPrerenderingAnimation]; auto* findHelper = FindTabHelper::FromWebState(tab.webState); @@ -4253,7 +4266,7 @@ _locationBarEditCancelledLoad = NO; web::WebState* webState = [_model currentTab].webState; - if (!_toolbarModelIOS->IsLoading() && webState) + if (webState && ![self.helper isToolbarLoading:webState]) webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL, false /* check_for_repost */); } @@ -4262,16 +4275,19 @@ - (void)locationBarBeganEdit { // On handsets, if a page is currently loading it should be stopped. - if (!IsIPadIdiom() && _toolbarModelIOS->IsLoading()) { + if (!IsIPadIdiom() && [self.helper isToolbarLoading:self.currentWebState]) { [self.dispatcher stopLoading]; _locationBarEditCancelledLoad = YES; } } -- (ToolbarModelIOS*)toolbarModelIOS { - return _toolbarModelIOS.get(); +- (ToolbarModel*)toolbarModel { + return _toolbarModel.get(); } +- (BOOL)shouldDisplayHintText { + return [[_model currentTab].webController wantsLocationBarHintText]; +} #pragma mark - ToolsMenuConfigurationProvider @@ -4332,7 +4348,7 @@ - (BOOL)shouldHighlightBookmarkButtonForToolsMenuCoordinator: (ToolsMenuCoordinator*)coordinator { - return [_model currentTab] ? _toolbarModelIOS->IsCurrentTabBookmarked() : NO; + return [self.helper isWebStateBookmarked:self.currentWebState]; } - (BOOL)shouldShowFindBarForToolsMenuCoordinator: @@ -4346,8 +4362,9 @@ } - (BOOL)isTabLoadingForToolsMenuCoordinator:(ToolsMenuCoordinator*)coordinator { - return ([_model currentTab] && !IsIPadIdiom()) ? _toolbarModelIOS->IsLoading() - : NO; + return ([_model currentTab] && !IsIPadIdiom()) + ? [self.helper isToolbarLoading:self.currentWebState] + : NO; } #pragma mark - BrowserCommands @@ -4378,7 +4395,8 @@ [self initializeBookmarkInteractionController]; [_bookmarkInteractionController presentBookmarkForTab:[_model currentTab] - currentlyBookmarked:_toolbarModelIOS->IsCurrentTabBookmarkedByUser()]; + currentlyBookmarked: + [self.helper isWebStateBookmarkedByUser:self.currentWebState]]; } - (void)openNewTab:(OpenNewTabCommand*)command {
diff --git a/ios/chrome/browser/ui/browser_view_controller_dependency_factory.h b/ios/chrome/browser/ui/browser_view_controller_dependency_factory.h index fb872345..b334e5e 100644 --- a/ios/chrome/browser/ui/browser_view_controller_dependency_factory.h +++ b/ios/chrome/browser/ui/browser_view_controller_dependency_factory.h
@@ -10,6 +10,7 @@ @class AlertCoordinator; @protocol ApplicationCommands; @protocol BrowserCommands; +@class BrowserViewControllerHelper; @class KeyCommandsProvider; @class MessageBubbleView; @protocol OmniboxFocuser; @@ -19,8 +20,6 @@ @protocol Toolbar; @protocol ToolbarCommands; @protocol ToolbarCoordinatorDelegate; -class ToolbarModelDelegateIOS; -class ToolbarModelIOS; class WebStateList; @protocol UrlLoader; @@ -48,8 +47,7 @@ - (void)showPassKitErrorInfoBarForManager: (infobars::InfoBarManager*)infoBarManager; -- (ToolbarModelIOS*)newToolbarModelIOSWithDelegate: - (ToolbarModelDelegateIOS*)delegate; +- (BrowserViewControllerHelper*)newBrowserViewControllerHelper; - (id<Toolbar>)newToolbarControllerWithDelegate: (id<ToolbarCoordinatorDelegate>)delegate
diff --git a/ios/chrome/browser/ui/browser_view_controller_dependency_factory.mm b/ios/chrome/browser/ui/browser_view_controller_dependency_factory.mm index 2e2229c..2992d193 100644 --- a/ios/chrome/browser/ui/browser_view_controller_dependency_factory.mm +++ b/ios/chrome/browser/ui/browser_view_controller_dependency_factory.mm
@@ -14,11 +14,11 @@ #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/tabs/tab_model.h" #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" +#import "ios/chrome/browser/ui/browser_view_controller_helper.h" #import "ios/chrome/browser/ui/key_commands_provider.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_base_feature.h" #import "ios/chrome/browser/ui/toolbar/toolbar_adapter.h" #include "ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h" -#include "ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.h" #include "ios/chrome/grit/ios_strings.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util_mac.h" @@ -55,9 +55,8 @@ nullptr, l10n_util::GetStringUTF16(IDS_IOS_GENERIC_PASSKIT_ERROR), true); } -- (ToolbarModelIOS*)newToolbarModelIOSWithDelegate: - (ToolbarModelDelegateIOS*)delegate { - return new ToolbarModelImplIOS(delegate); +- (BrowserViewControllerHelper*)newBrowserViewControllerHelper { + return [[BrowserViewControllerHelper alloc] init]; } - (id<Toolbar>)
diff --git a/ios/chrome/browser/ui/browser_view_controller_helper.h b/ios/chrome/browser/ui/browser_view_controller_helper.h new file mode 100644 index 0000000..6a3f809a --- /dev/null +++ b/ios/chrome/browser/ui/browser_view_controller_helper.h
@@ -0,0 +1,30 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_BROWSER_VIEW_CONTROLLER_HELPER_H_ +#define IOS_CHROME_BROWSER_UI_BROWSER_VIEW_CONTROLLER_HELPER_H_ + +#import <UIKit/UIKit.h> + +namespace web { +class WebState; +} // namespace web + +// Helper for the BrowserViewController. +@interface BrowserViewControllerHelper : NSObject + +// Returns true if the current tab of |webState| is currently loading. +- (BOOL)isToolbarLoading:(web::WebState*)webState; + +// Returns true if |webState|'s current tab's URL is bookmarked, either by the +// user or by a managed bookmarks. +- (BOOL)isWebStateBookmarked:(web::WebState*)webState; + +// Returns true if |webState|'s current tab's URL is bookmarked by the user; +// returns false if the URL is bookmarked only in managed bookmarks. +- (BOOL)isWebStateBookmarkedByUser:(web::WebState*)webState; + +@end + +#endif // IOS_CHROME_BROWSER_UI_BROWSER_VIEW_CONTROLLER_HELPER_H_
diff --git a/ios/chrome/browser/ui/browser_view_controller_helper.mm b/ios/chrome/browser/ui/browser_view_controller_helper.mm new file mode 100644 index 0000000..950c6cd --- /dev/null +++ b/ios/chrome/browser/ui/browser_view_controller_helper.mm
@@ -0,0 +1,53 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/ui/browser_view_controller_helper.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +#include "components/bookmarks/browser/bookmark_model.h" +#include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" +#include "ios/chrome/browser/browser_state/chrome_browser_state.h" +#include "ios/chrome/browser/chrome_url_constants.h" +#import "ios/web/public/web_state/web_state.h" + +namespace { +bookmarks::BookmarkModel* GetBookmarkModelForWebState( + web::WebState* web_state) { + if (!web_state) + return nullptr; + web::BrowserState* browser_state = web_state->GetBrowserState(); + if (!browser_state) + return nullptr; + return ios::BookmarkModelFactory::GetForBrowserState( + ios::ChromeBrowserState::FromBrowserState(browser_state)); +} +} // namespace + +@implementation BrowserViewControllerHelper + +- (BOOL)isToolbarLoading:(web::WebState*)webState { + // Please note, this notion of isLoading is slightly different from WebState's + // IsLoading(). + return webState && webState->IsLoading() && + !webState->GetLastCommittedURL().SchemeIs(kChromeUIScheme); +} + +- (BOOL)isWebStateBookmarked:(web::WebState*)webState { + bookmarks::BookmarkModel* bookmarkModel = + GetBookmarkModelForWebState(webState); + return bookmarkModel && + bookmarkModel->IsBookmarked(webState->GetLastCommittedURL()); +} + +- (BOOL)isWebStateBookmarkedByUser:(web::WebState*)webState { + bookmarks::BookmarkModel* bookmarkModel = + GetBookmarkModelForWebState(webState); + return bookmarkModel && bookmarkModel->GetMostRecentlyAddedUserNodeForURL( + webState->GetLastCommittedURL()); +} + +@end
diff --git a/ios/chrome/browser/ui/browser_view_controller_helper_unittest.mm b/ios/chrome/browser/ui/browser_view_controller_helper_unittest.mm new file mode 100644 index 0000000..6fe6b29d --- /dev/null +++ b/ios/chrome/browser/ui/browser_view_controller_helper_unittest.mm
@@ -0,0 +1,102 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/ui/browser_view_controller_helper.h" + +#import <Foundation/Foundation.h> + +#include <memory> + +#include "base/message_loop/message_loop.h" +#include "base/strings/utf_string_conversions.h" +#include "components/bookmarks/browser/bookmark_model.h" +#include "components/bookmarks/test/bookmark_test_helpers.h" +#include "components/toolbar/test_toolbar_model.h" +#include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" +#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" +#import "ios/chrome/browser/ui/toolbar/test/toolbar_test_navigation_manager.h" +#import "ios/chrome/browser/ui/toolbar/test/toolbar_test_web_state.h" +#import "ios/testing/ocmock_complex_type_helper.h" +#import "ios/web/public/test/fakes/test_navigation_manager.h" +#import "ios/web/public/test/fakes/test_web_state.h" +#include "ios/web/public/test/test_web_thread.h" +#include "ios/web/public/test/test_web_thread_bundle.h" +#include "testing/gtest_mac.h" +#include "testing/platform_test.h" +#include "third_party/ocmock/gtest_support.h" +#include "third_party/ocmock/ocmock_extensions.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { + +static const char kWebUrl[] = "http://www.chromium.org"; +static const char kNativeUrl[] = "chrome://version"; + +class BrowserViewControllerHelperTest : public PlatformTest { + protected: + void SetUp() override { + PlatformTest::SetUp(); + TestChromeBrowserState::Builder test_cbs_builder; + chrome_browser_state_ = test_cbs_builder.Build(); + chrome_browser_state_->CreateBookmarkModel(true); + bookmarks::test::WaitForBookmarkModelToLoad( + ios::BookmarkModelFactory::GetForBrowserState( + chrome_browser_state_.get())); + + web_state_ = std::make_unique<ToolbarTestWebState>(); + web_state_->SetBrowserState(chrome_browser_state_.get()); + + helper_ = [[BrowserViewControllerHelper alloc] init]; + } + + web::TestWebThreadBundle thread_bundle_; + std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; + std::unique_ptr<ToolbarTestWebState> web_state_; + BrowserViewControllerHelper* helper_; +}; + +TEST_F(BrowserViewControllerHelperTest, TestWhenCurrentWebStateIsNull) { + EXPECT_FALSE([helper_ isToolbarLoading:nullptr]); + EXPECT_FALSE([helper_ isWebStateBookmarked:nullptr]); +} + +TEST_F(BrowserViewControllerHelperTest, TestIsLoading) { + // An active webstate that is loading. + web_state_->SetLoading(true); + EXPECT_TRUE([helper_ isToolbarLoading:web_state_.get()]); + + // An active webstate that is not loading. + web_state_->SetLoading(false); + EXPECT_FALSE([helper_ isToolbarLoading:web_state_.get()]); + + // An active webstate that is pointing at a native URL. + web_state_->SetLoading(true); + web_state_->SetCurrentURL(GURL(kNativeUrl)); + EXPECT_FALSE([helper_ isToolbarLoading:web_state_.get()]); +} + +TEST_F(BrowserViewControllerHelperTest, TestisWebStateBookmarked) { + // Set the curent tab to |kWebUrl| and create a bookmark for |kWebUrl|, then + // verify that the toolbar model indicates that the URL is bookmarked. + web_state_->SetCurrentURL(GURL(kWebUrl)); + bookmarks::BookmarkModel* bookmark_model = + ios::BookmarkModelFactory::GetForBrowserState( + chrome_browser_state_.get()); + const bookmarks::BookmarkNode* bookmarks = + bookmark_model->bookmark_bar_node(); + const bookmarks::BookmarkNode* node = + bookmark_model->AddURL(bookmarks, bookmarks->child_count(), + base::UTF8ToUTF16(kWebUrl), GURL(kWebUrl)); + EXPECT_TRUE([helper_ isWebStateBookmarked:web_state_.get()]); + + // Remove the bookmark and verify the toolbar model indicates that the URL is + // not bookmarked. + bookmark_model->Remove(node); + EXPECT_FALSE([helper_ isWebStateBookmarked:web_state_.get()]); +} + +} // namespace
diff --git a/ios/chrome/browser/ui/browser_view_controller_unittest.mm b/ios/chrome/browser/ui/browser_view_controller_unittest.mm index 999dd5ca..24a85a9 100644 --- a/ios/chrome/browser/ui/browser_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/browser_view_controller_unittest.mm
@@ -35,11 +35,11 @@ #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" #import "ios/chrome/browser/ui/browser_view_controller.h" #import "ios/chrome/browser/ui/browser_view_controller_dependency_factory.h" +#import "ios/chrome/browser/ui/browser_view_controller_helper.h" #import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/ntp/new_tab_page_controller.h" #import "ios/chrome/browser/ui/page_not_available_controller.h" #import "ios/chrome/browser/ui/toolbar/public/omnibox_focuser.h" -#include "ios/chrome/browser/ui/toolbar/test_toolbar_model_ios.h" #include "ios/chrome/browser/ui/ui_util.h" #import "ios/chrome/browser/web/error_page_content.h" #import "ios/chrome/browser/web/passkit_dialog_provider.h" @@ -247,9 +247,7 @@ [OCMockObject niceMockForClass:[PKAddPassesViewController class]]; passKitViewController_ = passKitController; - // Set up a fake toolbar model for the dependency factory to return. - // It will be owned (and destroyed) by the BVC. - toolbarModelIOS_ = new TestToolbarModelIOS(); + bvcHelper_ = [[BrowserViewControllerHelper alloc] init]; // Create fake WTC. TestWebToolbarController* testWTC = [[TestWebToolbarController alloc] init]; @@ -257,9 +255,7 @@ // Set up a stub dependency factory. id factory = [OCMockObject mockForClass:[BrowserViewControllerDependencyFactory class]]; - [[[factory stub] andReturnValue:OCMOCK_VALUE(toolbarModelIOS_)] - newToolbarModelIOSWithDelegate:static_cast<ToolbarModelDelegateIOS*>( - [OCMArg anyPointer])]; + [[[factory stub] andReturn:bvcHelper_] newBrowserViewControllerHelper]; [[[factory stub] andReturn:testWTC] newToolbarControllerWithDelegate:[OCMArg any] urlLoader:[OCMArg any] @@ -304,7 +300,7 @@ std::unique_ptr<WebStateImpl> webStateImpl_; Tab* tab_; TabModel* tabModel_; - ToolbarModelIOS* toolbarModelIOS_; + BrowserViewControllerHelper* bvcHelper_; PKAddPassesViewController* passKitViewController_; OCMockObject* dependencyFactory_; BrowserViewController* bvc_; @@ -384,7 +380,10 @@ OCMockObject* tabMock = static_cast<OCMockObject*>(tab_); // Have the TestToolbarModel indicate that a page load is in progress. - static_cast<TestToolbarModelIOS*>(toolbarModelIOS_)->set_is_loading(true); + id partialMock = OCMPartialMock(bvcHelper_); + OCMExpect([partialMock isToolbarLoading:static_cast<web::WebState*>( + [OCMArg anyPointer])]) + .andReturn(YES); // The tab should stop loading on iPhones. [bvc_ locationBarBeganEdit];
diff --git a/ios/chrome/browser/ui/content_suggestions/BUILD.gn b/ios/chrome/browser/ui/content_suggestions/BUILD.gn index 3a28cc6..e162ec8 100644 --- a/ios/chrome/browser/ui/content_suggestions/BUILD.gn +++ b/ios/chrome/browser/ui/content_suggestions/BUILD.gn
@@ -67,8 +67,8 @@ "//ios/chrome/browser/ui/toolbar", "//ios/chrome/browser/ui/toolbar:toolbar_ui", "//ios/chrome/browser/ui/toolbar/adaptive:adaptive_ui", + "//ios/chrome/browser/ui/toolbar/buttons", "//ios/chrome/browser/ui/toolbar/clean:toolbar", - "//ios/chrome/browser/ui/toolbar/clean:toolbar_components_ui", "//ios/chrome/browser/ui/toolbar/public", "//ios/chrome/browser/web_state_list", "//ios/chrome/common/app_group",
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm index c0b01b28..af181e2 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm
@@ -33,8 +33,8 @@ #import "ios/chrome/browser/ui/ntp/notification_promo_whats_new.h" #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.h" #import "ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_view_controller.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_visibility_configuration.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.h" #import "ios/chrome/browser/ui/toolbar/clean/toolbar_mediator.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #import "ios/chrome/browser/web_state_list/web_state_list.h"
diff --git a/ios/chrome/browser/ui/location_bar/BUILD.gn b/ios/chrome/browser/ui/location_bar/BUILD.gn index fca6215..adda4ada 100644 --- a/ios/chrome/browser/ui/location_bar/BUILD.gn +++ b/ios/chrome/browser/ui/location_bar/BUILD.gn
@@ -36,7 +36,7 @@ "//ios/chrome/browser/ui/omnibox:omnibox_internal", "//ios/chrome/browser/ui/omnibox/popup", "//ios/chrome/browser/ui/qr_scanner/requirements", - "//ios/chrome/browser/ui/toolbar/clean:toolbar_components_ui", + "//ios/chrome/browser/ui/toolbar/buttons", "//ios/chrome/browser/ui/toolbar/keyboard_assist:keyboard_assist", "//ios/chrome/browser/ui/toolbar/public", "//ios/chrome/browser/ui/toolbar/public:toolbar_base_feature", @@ -76,10 +76,10 @@ ":location_bar", "//base", "//base/test:test_support", + "//components/toolbar:test_support", "//ios/chrome/app/strings", "//ios/chrome/browser", "//ios/chrome/browser/browser_state:test_support", - "//ios/chrome/browser/ui/toolbar:test_support", "//ios/chrome/browser/ui/toolbar/clean:toolbar", "//ios/chrome/browser/ui/toolbar/test", "//ios/chrome/browser/web_state_list",
diff --git a/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm b/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm index 2ce3ada..90884b7d 100644 --- a/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm +++ b/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm
@@ -29,7 +29,6 @@ #import "ios/chrome/browser/ui/toolbar/keyboard_assist/toolbar_assistive_keyboard_delegate.h" #import "ios/chrome/browser/ui/toolbar/keyboard_assist/toolbar_assistive_keyboard_views.h" #import "ios/chrome/browser/ui/toolbar/public/web_toolbar_controller_constants.h" -#include "ios/chrome/browser/ui/toolbar/toolbar_model_ios.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #import "ios/chrome/browser/ui/url_loader.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" @@ -141,7 +140,7 @@ if (!_locationBarController) return; _locationBarController->SetShouldShowHintText( - [self.delegate toolbarModelIOS]->ShouldDisplayHintText()); + [self.delegate shouldDisplayHintText]); _locationBarController->OnToolbarUpdated(); } @@ -261,8 +260,7 @@ } - (ToolbarModel*)toolbarModel { - ToolbarModelIOS* toolbarModelIOS = [self.delegate toolbarModelIOS]; - return toolbarModelIOS ? toolbarModelIOS->GetToolbarModel() : nullptr; + return [self.delegate toolbarModel]; } #pragma mark - private
diff --git a/ios/chrome/browser/ui/location_bar/location_bar_coordinator_unittest.mm b/ios/chrome/browser/ui/location_bar/location_bar_coordinator_unittest.mm index dd4276b9..6162755 100644 --- a/ios/chrome/browser/ui/location_bar/location_bar_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/location_bar/location_bar_coordinator_unittest.mm
@@ -6,9 +6,9 @@ #include <memory> +#include "components/toolbar/test_toolbar_model.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #import "ios/chrome/browser/ui/toolbar/clean/toolbar_coordinator_delegate.h" -#include "ios/chrome/browser/ui/toolbar/test_toolbar_model_ios.h" #include "ios/chrome/browser/web_state_list/fake_web_state_list_delegate.h" #include "ios/chrome/browser/web_state_list/web_state_list.h" #import "ios/chrome/browser/web_state_list/web_state_opener.h" @@ -25,7 +25,7 @@ @end @implementation TestToolbarCoordinatorDelegate { - std::unique_ptr<ToolbarModelIOS> _model; + std::unique_ptr<ToolbarModel> _model; } - (void)locationBarDidBecomeFirstResponder { @@ -35,14 +35,18 @@ - (void)locationBarBeganEdit { } -- (ToolbarModelIOS*)toolbarModelIOS { +- (ToolbarModel*)toolbarModel { if (!_model) { - _model = std::make_unique<TestToolbarModelIOS>(); + _model = std::make_unique<TestToolbarModel>(); } return _model.get(); } +- (BOOL)shouldDisplayHintText { + return NO; +} + @end namespace {
diff --git a/ios/chrome/browser/ui/ntp/BUILD.gn b/ios/chrome/browser/ui/ntp/BUILD.gn index ef4a6d7..3964187 100644 --- a/ios/chrome/browser/ui/ntp/BUILD.gn +++ b/ios/chrome/browser/ui/ntp/BUILD.gn
@@ -37,6 +37,7 @@ "//ios/chrome/browser/ui/toolbar:resource_macros", "//ios/chrome/browser/ui/toolbar:toolbar_ui", "//ios/chrome/browser/ui/toolbar/clean:toolbar_ui", + "//ios/chrome/browser/ui/toolbar/legacy", "//ios/chrome/browser/ui/toolbar/public", "//ios/chrome/browser/ui/toolbar/public:toolbar_base_feature", "//ios/chrome/common",
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm b/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm index 2925557..ed6e28d 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm +++ b/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm
@@ -30,7 +30,6 @@ #import "ios/chrome/browser/ui/ntp/new_tab_page_view.h" #import "ios/chrome/browser/ui/ntp/recent_tabs/legacy_recent_tabs_table_coordinator.h" #import "ios/chrome/browser/ui/rtl_geometry.h" -#include "ios/chrome/browser/ui/toolbar/toolbar_model_ios.h" #include "ios/chrome/browser/ui/ui_util.h" #include "ios/chrome/grit/ios_strings.h" #import "ios/web/web_state/ui/crw_swipe_recognizer_provider.h"
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.h b/ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.h index 217ab76..aebff38 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.h +++ b/ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.h
@@ -5,7 +5,7 @@ #ifndef IOS_CHROME_BROWSER_UI_NTP_NEW_TAB_PAGE_TOOLBAR_CONTROLLER_H_ #define IOS_CHROME_BROWSER_UI_NTP_NEW_TAB_PAGE_TOOLBAR_CONTROLLER_H_ -#import "ios/chrome/browser/ui/toolbar/toolbar_controller.h" +#import "ios/chrome/browser/ui/toolbar/legacy/toolbar_controller.h" @protocol ApplicationCommands; @protocol BrowserCommands;
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.mm b/ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.mm index be5c1f75c..275895f 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.mm +++ b/ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.mm
@@ -12,10 +12,10 @@ #import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/rtl_geometry.h" +#import "ios/chrome/browser/ui/toolbar/legacy/toolbar_controller+protected.h" #import "ios/chrome/browser/ui/toolbar/public/fakebox_focuser.h" #import "ios/chrome/browser/ui/toolbar/public/omnibox_focuser.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_constants.h" -#import "ios/chrome/browser/ui/toolbar/toolbar_controller+protected.h" #include "ios/chrome/browser/ui/toolbar/toolbar_resource_macros.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #include "ui/base/l10n/l10n_util.h"
diff --git a/ios/chrome/browser/ui/omnibox/BUILD.gn b/ios/chrome/browser/ui/omnibox/BUILD.gn index 918dee0c..148518d 100644 --- a/ios/chrome/browser/ui/omnibox/BUILD.gn +++ b/ios/chrome/browser/ui/omnibox/BUILD.gn
@@ -102,7 +102,7 @@ "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/fullscreen", "//ios/chrome/browser/ui/omnibox/popup", - "//ios/chrome/browser/ui/toolbar/clean:toolbar_components_ui", + "//ios/chrome/browser/ui/toolbar/buttons", "//ios/chrome/browser/ui/toolbar/public", "//ios/chrome/browser/ui/toolbar/public:toolbar_base_feature", "//ios/chrome/browser/ui/util",
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.mm b/ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.mm index a88c439..1637b4c1 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.mm +++ b/ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.mm
@@ -22,7 +22,7 @@ #include "ios/chrome/browser/ui/omnibox/omnibox_util.h" #import "ios/chrome/browser/ui/reversed_animation.h" #include "ios/chrome/browser/ui/rtl_geometry.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_constants.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_base_feature.h" #import "ios/chrome/browser/ui/toolbar/public/web_toolbar_controller_constants.h" #include "ios/chrome/browser/ui/ui_util.h"
diff --git a/ios/chrome/browser/ui/omnibox_perftest.mm b/ios/chrome/browser/ui/omnibox_perftest.mm index 60706f9..5e62ba7 100644 --- a/ios/chrome/browser/ui/omnibox_perftest.mm +++ b/ios/chrome/browser/ui/omnibox_perftest.mm
@@ -9,6 +9,7 @@ #import "base/test/ios/wait_util.h" #include "base/time/time.h" #include "components/toolbar/test_toolbar_model.h" +#include "components/toolbar/toolbar_model_impl.h" #include "ios/chrome/browser/autocomplete/autocomplete_classifier_factory.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/search_engines/template_url_service_factory.h" @@ -16,7 +17,6 @@ #import "ios/chrome/browser/ui/toolbar/clean/toolbar_coordinator.h" #import "ios/chrome/browser/ui/toolbar/clean/toolbar_coordinator_delegate.h" #include "ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h" -#include "ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.h" #import "ios/chrome/browser/ui/util/named_guide.h" #include "ios/chrome/browser/web_state_list/fake_web_state_list_delegate.h" #include "ios/chrome/browser/web_state_list/web_state_list.h" @@ -34,6 +34,8 @@ namespace { +const size_t kMaxURLDisplayChars = 32 * 1024; + // Descends down a view hierarchy until the first view of |specificClass| // is found. Returns nil if a view of |specificClass| cannot be found. UIView* FindViewByClass(UIView* topView, Class specificClass) { @@ -93,15 +95,15 @@ // Creates the Toolbar for testing and sizes it to the width of the screen. toolbar_model_delegate_.reset( new ToolbarModelDelegateIOS(web_state_list_.get())); - toolbar_model_ios_.reset( - new ToolbarModelImplIOS(toolbar_model_delegate_.get())); + toolbar_model_ = std::make_unique<ToolbarModelImpl>( + toolbar_model_delegate_.get(), kMaxURLDisplayChars); // The OCMOCK_VALUE macro doesn't like std::unique_ptr, but it works just // fine if a temporary variable is used. - ToolbarModelIOS* model_for_mock = toolbar_model_ios_.get(); + ToolbarModel* model_for_mock = toolbar_model_.get(); id toolbarDelegate = OCMProtocolMock(@protocol(ToolbarCoordinatorDelegate)); [[[toolbarDelegate stub] andReturnValue:OCMOCK_VALUE(model_for_mock)] - toolbarModelIOS]; + toolbarModel]; coordinator_ = [[ToolbarCoordinator alloc] init]; coordinator_.delegate = toolbarDelegate; @@ -221,7 +223,7 @@ FakeWebStateListDelegate web_state_list_delegate_; std::unique_ptr<WebStateList> web_state_list_; std::unique_ptr<ToolbarModelDelegateIOS> toolbar_model_delegate_; - std::unique_ptr<ToolbarModelIOS> toolbar_model_ios_; + std::unique_ptr<ToolbarModel> toolbar_model_; ToolbarCoordinator* coordinator_; UIWindow* window_; KeyboardAppearanceListener* keyboard_listener_;
diff --git a/ios/chrome/browser/ui/payments/BUILD.gn b/ios/chrome/browser/ui/payments/BUILD.gn index c4a01d3..ee03214 100644 --- a/ios/chrome/browser/ui/payments/BUILD.gn +++ b/ios/chrome/browser/ui/payments/BUILD.gn
@@ -70,6 +70,7 @@ "//components/payments/mojom", "//components/signin/core/browser", "//components/strings", + "//components/toolbar", "//components/url_formatter", "//ios/chrome/app/strings", "//ios/chrome/app/theme", @@ -89,7 +90,6 @@ "//ios/chrome/browser/ui/coordinators:chrome_coordinators", "//ios/chrome/browser/ui/icons", "//ios/chrome/browser/ui/payments/cells", - "//ios/chrome/browser/ui/toolbar", "//ios/third_party/material_components_ios", "//ios/third_party/material_roboto_font_loader_ios", "//ios/web",
diff --git a/ios/chrome/browser/ui/payments/payment_request_manager.h b/ios/chrome/browser/ui/payments/payment_request_manager.h index c35f4ff..74e1346b 100644 --- a/ios/chrome/browser/ui/payments/payment_request_manager.h +++ b/ios/chrome/browser/ui/payments/payment_request_manager.h
@@ -17,7 +17,7 @@ extern NSString* const kNotSupportedError; @protocol ApplicationCommands; -class ToolbarModelIOS; +class ToolbarModel; namespace ios { class ChromeBrowserState; @@ -33,9 +33,8 @@ // interface. @interface PaymentRequestManager : NSObject -// IOS specific version of ToolbarModel that is used for grabbing security -// info. -@property(nonatomic, assign) ToolbarModelIOS* toolbarModel; +// ToolbarModel that is used for grabbing security info. +@property(nonatomic, assign) ToolbarModel* toolbarModel; // The WebState being observed for invocations of the Payment Request API. // Should outlive this instance. May be nullptr.
diff --git a/ios/chrome/browser/ui/payments/payment_request_manager.mm b/ios/chrome/browser/ui/payments/payment_request_manager.mm index 142b077..ac71694 100644 --- a/ios/chrome/browser/ui/payments/payment_request_manager.mm +++ b/ios/chrome/browser/ui/payments/payment_request_manager.mm
@@ -40,6 +40,7 @@ #include "components/payments/core/web_payment_request.h" #include "components/payments/mojom/payment_request_data.mojom.h" #include "components/prefs/pref_service.h" +#include "components/toolbar/toolbar_model.h" #include "components/url_formatter/elide_url.h" #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" #include "ios/chrome/browser/autofill/validation_rules_storage_factory.h" @@ -55,7 +56,6 @@ #import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/payments/js_payment_request_manager.h" #import "ios/chrome/browser/ui/payments/payment_request_coordinator.h" -#include "ios/chrome/browser/ui/toolbar/toolbar_model_ios.h" #include "ios/web/public/favicon_status.h" #include "ios/web/public/navigation_item.h" #include "ios/web/public/navigation_manager.h" @@ -899,7 +899,7 @@ return NO; } - if (!_toolbarModel) { + if (!self.toolbarModel) { return NO; } @@ -925,7 +925,7 @@ // If the scheme is cryptographic, the SSL certificate must also be valid. return !security_state::IsSchemeCryptographic(lastCommittedURL) || security_state::IsSslCertificateValid( - _toolbarModel->GetToolbarModel()->GetSecurityLevel(true)); + self.toolbarModel->GetSecurityLevel(true)); } #pragma mark - PaymentRequestUIDelegate
diff --git a/ios/chrome/browser/ui/qr_scanner/BUILD.gn b/ios/chrome/browser/ui/qr_scanner/BUILD.gn index 2adca92..40fc17fa 100644 --- a/ios/chrome/browser/ui/qr_scanner/BUILD.gn +++ b/ios/chrome/browser/ui/qr_scanner/BUILD.gn
@@ -74,7 +74,6 @@ "//ios/chrome/browser/ui/location_bar", "//ios/chrome/browser/ui/omnibox", "//ios/chrome/browser/ui/toolbar", - "//ios/chrome/browser/ui/toolbar:test_support", "//ios/chrome/browser/ui/toolbar/clean:toolbar", "//ios/chrome/browser/ui/toolbar/public:toolbar_base_feature", "//ios/chrome/test/app:test_support",
diff --git a/ios/chrome/browser/ui/stack_view/BUILD.gn b/ios/chrome/browser/ui/stack_view/BUILD.gn index 455c7af..7330d18c3 100644 --- a/ios/chrome/browser/ui/stack_view/BUILD.gn +++ b/ios/chrome/browser/ui/stack_view/BUILD.gn
@@ -15,6 +15,8 @@ "card_view.mm", "close_button.h", "close_button.mm", + "new_tab_button.h", + "new_tab_button.mm", "page_animation_util.h", "page_animation_util.mm", "stack_card.h", @@ -60,6 +62,7 @@ "//ios/chrome/browser/ui/tab_switcher", "//ios/chrome/browser/ui/toolbar", "//ios/chrome/browser/ui/toolbar:toolbar_ui", + "//ios/chrome/browser/ui/toolbar/legacy", "//ios/chrome/browser/ui/toolbar/public", "//ios/chrome/browser/ui/toolbar/public:toolbar_base_feature", "//ios/chrome/browser/ui/tools_menu",
diff --git a/ios/chrome/browser/ui/toolbar/new_tab_button.h b/ios/chrome/browser/ui/stack_view/new_tab_button.h similarity index 81% rename from ios/chrome/browser/ui/toolbar/new_tab_button.h rename to ios/chrome/browser/ui/stack_view/new_tab_button.h index f94b2e3d..b0bbb36e 100644 --- a/ios/chrome/browser/ui/toolbar/new_tab_button.h +++ b/ios/chrome/browser/ui/stack_view/new_tab_button.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_NEW_TAB_BUTTON_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_NEW_TAB_BUTTON_H_ +#ifndef IOS_CHROME_BROWSER_UI_STACK_VIEW_NEW_TAB_BUTTON_H_ +#define IOS_CHROME_BROWSER_UI_STACK_VIEW_NEW_TAB_BUTTON_H_ #import <UIKit/UIKit.h> @@ -20,4 +20,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_NEW_TAB_BUTTON_H_ +#endif // IOS_CHROME_BROWSER_UI_STACK_VIEW_NEW_TAB_BUTTON_H_
diff --git a/ios/chrome/browser/ui/toolbar/new_tab_button.mm b/ios/chrome/browser/ui/stack_view/new_tab_button.mm similarity index 97% rename from ios/chrome/browser/ui/toolbar/new_tab_button.mm rename to ios/chrome/browser/ui/stack_view/new_tab_button.mm index a3de1f1..8db1300d 100644 --- a/ios/chrome/browser/ui/toolbar/new_tab_button.mm +++ b/ios/chrome/browser/ui/stack_view/new_tab_button.mm
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/ui/toolbar/new_tab_button.h" +#import "ios/chrome/browser/ui/stack_view/new_tab_button.h" #include "base/logging.h" #import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
diff --git a/ios/chrome/browser/ui/stack_view/stack_view_controller.mm b/ios/chrome/browser/ui/stack_view/stack_view_controller.mm index 9ae8929..d87a9b5b 100644 --- a/ios/chrome/browser/ui/stack_view/stack_view_controller.mm +++ b/ios/chrome/browser/ui/stack_view/stack_view_controller.mm
@@ -45,12 +45,12 @@ #import "ios/chrome/browser/ui/stack_view/card_stack_pinch_gesture_recognizer.h" #import "ios/chrome/browser/ui/stack_view/card_view.h" #import "ios/chrome/browser/ui/stack_view/close_button.h" +#import "ios/chrome/browser/ui/stack_view/new_tab_button.h" #import "ios/chrome/browser/ui/stack_view/page_animation_util.h" #import "ios/chrome/browser/ui/stack_view/stack_card.h" #import "ios/chrome/browser/ui/stack_view/stack_view_controller_private.h" #import "ios/chrome/browser/ui/stack_view/stack_view_toolbar_controller.h" #import "ios/chrome/browser/ui/stack_view/title_label.h" -#import "ios/chrome/browser/ui/toolbar/new_tab_button.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_base_feature.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_constants.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_utils.h"
diff --git a/ios/chrome/browser/ui/stack_view/stack_view_toolbar_controller.h b/ios/chrome/browser/ui/stack_view/stack_view_toolbar_controller.h index e39de50..f6d4b9d 100644 --- a/ios/chrome/browser/ui/stack_view/stack_view_toolbar_controller.h +++ b/ios/chrome/browser/ui/stack_view/stack_view_toolbar_controller.h
@@ -7,7 +7,7 @@ #import <UIKit/UIKit.h> -#import "ios/chrome/browser/ui/toolbar/toolbar_controller.h" +#import "ios/chrome/browser/ui/toolbar/legacy/toolbar_controller.h" @protocol ApplicationCommands; @protocol BrowserCommands;
diff --git a/ios/chrome/browser/ui/stack_view/stack_view_toolbar_controller.mm b/ios/chrome/browser/ui/stack_view/stack_view_toolbar_controller.mm index 2d53dc8e..a9b12347 100644 --- a/ios/chrome/browser/ui/stack_view/stack_view_toolbar_controller.mm +++ b/ios/chrome/browser/ui/stack_view/stack_view_toolbar_controller.mm
@@ -12,9 +12,9 @@ #import "ios/chrome/browser/ui/commands/open_new_tab_command.h" #import "ios/chrome/browser/ui/image_util/image_util.h" #import "ios/chrome/browser/ui/rtl_geometry.h" -#import "ios/chrome/browser/ui/toolbar/new_tab_button.h" +#import "ios/chrome/browser/ui/stack_view/new_tab_button.h" +#import "ios/chrome/browser/ui/toolbar/legacy/toolbar_controller+protected.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_constants.h" -#import "ios/chrome/browser/ui/toolbar/toolbar_controller+protected.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/ui/toolbar/BUILD.gn b/ios/chrome/browser/ui/toolbar/BUILD.gn index 7fffc035..2d7caff 100644 --- a/ios/chrome/browser/ui/toolbar/BUILD.gn +++ b/ios/chrome/browser/ui/toolbar/BUILD.gn
@@ -7,23 +7,10 @@ sources = [ "legacy_toolbar_coordinator.h", "legacy_toolbar_coordinator.mm", - "legacy_toolbar_view.h", - "legacy_toolbar_view.mm", - "new_tab_button.h", - "new_tab_button.mm", "toolbar_adapter.h", "toolbar_adapter.mm", - "toolbar_controller+protected.h", - "toolbar_controller.h", - "toolbar_controller.mm", "toolbar_model_delegate_ios.h", "toolbar_model_delegate_ios.mm", - "toolbar_model_impl_ios.h", - "toolbar_model_impl_ios.mm", - "toolbar_model_ios.h", - "toolbar_view_delegate.h", - "tools_menu_button_observer_bridge.h", - "tools_menu_button_observer_bridge.mm", ] deps = [ ":resource_macros", @@ -80,8 +67,8 @@ "//ios/chrome/browser/ui/omnibox/popup", "//ios/chrome/browser/ui/popup_menu", "//ios/chrome/browser/ui/qr_scanner/requirements", + "//ios/chrome/browser/ui/toolbar/buttons", "//ios/chrome/browser/ui/toolbar/clean:toolbar", - "//ios/chrome/browser/ui/toolbar/clean:toolbar_components_ui", "//ios/chrome/browser/ui/toolbar/clean:toolbar_ui", "//ios/chrome/browser/ui/toolbar/keyboard_assist", "//ios/chrome/browser/ui/tools_menu", @@ -159,34 +146,14 @@ ] } -source_set("test_support") { - configs += [ "//build/config/compiler:enable_arc" ] - testonly = true - sources = [ - "test_toolbar_model_ios.h", - "test_toolbar_model_ios.mm", - ] - deps = [ - ":toolbar", - "//base", - "//components/toolbar", - "//components/toolbar:test_support", - "//ios/chrome/browser/tabs", - "//ios/web/public/test/fakes", - ] -} - source_set("unit_tests") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true sources = [ "legacy_toolbar_ui_updater_unittest.mm", - "toolbar_controller_unittest.mm", - "toolbar_model_impl_ios_unittest.mm", "toolbar_ui_broadcasting_util_unittest.mm", ] deps = [ - ":test_support", ":toolbar", ":toolbar_ui", ":toolbar_ui_broadcasting_util", @@ -200,6 +167,7 @@ "//ios/chrome/browser/tabs", "//ios/chrome/browser/ui", "//ios/chrome/browser/ui/broadcaster", + "//ios/chrome/browser/ui/toolbar/legacy", "//ios/chrome/browser/ui/toolbar/test", "//ios/chrome/browser/web_state_list", "//ios/chrome/browser/web_state_list:test_support", @@ -231,6 +199,7 @@ "//ios/chrome/browser/ui/ntp:ntp_internal", "//ios/chrome/browser/ui/omnibox:omnibox_internal", "//ios/chrome/browser/ui/toolbar/clean:toolbar_ui", + "//ios/chrome/browser/ui/toolbar/legacy", "//ios/chrome/browser/ui/tools_menu/public", "//ios/chrome/test/app:test_support", "//ios/chrome/test/earl_grey:test_support",
diff --git a/ios/chrome/browser/ui/toolbar/adaptive/BUILD.gn b/ios/chrome/browser/ui/toolbar/adaptive/BUILD.gn index f1294b8..7526d75 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive/BUILD.gn +++ b/ios/chrome/browser/ui/toolbar/adaptive/BUILD.gn
@@ -33,8 +33,8 @@ "//ios/chrome/browser/ui/omnibox/popup", "//ios/chrome/browser/ui/orchestrator", "//ios/chrome/browser/ui/toolbar", + "//ios/chrome/browser/ui/toolbar/buttons", "//ios/chrome/browser/ui/toolbar/clean:toolbar", - "//ios/chrome/browser/ui/toolbar/clean:toolbar_components_ui", "//ios/chrome/browser/ui/toolbar/public", "//ios/chrome/browser/ui/tools_menu", "//ios/chrome/browser/ui/tools_menu/public", @@ -67,7 +67,7 @@ "//ios/chrome/browser/ui/fullscreen:ui", "//ios/chrome/browser/ui/history_popup/requirements", "//ios/chrome/browser/ui/orchestrator", - "//ios/chrome/browser/ui/toolbar/clean:toolbar_components_ui", + "//ios/chrome/browser/ui/toolbar/buttons", "//ios/chrome/browser/ui/toolbar/clean:toolbar_ui", "//ios/chrome/browser/ui/toolbar/public", "//ios/chrome/browser/ui/util", @@ -85,11 +85,13 @@ ] deps = [ + ":adaptive_ui", "//base", "//components/strings", "//ios/chrome/app/strings", "//ios/chrome/browser/ui:ui_util", "//ios/chrome/browser/ui/toolbar/public", + "//ios/chrome/browser/ui/util", "//ios/chrome/test/app:test_support", "//ios/chrome/test/earl_grey:test_support", "//ios/testing/earl_grey:earl_grey_support",
diff --git a/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_coordinator+subclassing.h b/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_coordinator+subclassing.h index 1302260..19bb368f 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_coordinator+subclassing.h +++ b/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_coordinator+subclassing.h
@@ -7,7 +7,7 @@ #import "ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_coordinator.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_type.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_type.h" @class ToolbarButtonFactory; namespace web {
diff --git a/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_coordinator.mm b/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_coordinator.mm index 1eb4e47..b2e8a24 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_coordinator.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_coordinator.mm
@@ -11,12 +11,12 @@ #import "ios/chrome/browser/ui/ntp/ntp_util.h" #import "ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_coordinator+subclassing.h" #import "ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_view_controller.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_visibility_configuration.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/tools_menu_button_observer_bridge.h" #import "ios/chrome/browser/ui/toolbar/clean/toolbar_mediator.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h" #import "ios/chrome/browser/ui/toolbar/public/web_toolbar_controller_constants.h" -#import "ios/chrome/browser/ui/toolbar/tools_menu_button_observer_bridge.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
diff --git a/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_egtest.mm b/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_egtest.mm index 8ebcf06..da271d3 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_egtest.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_egtest.mm
@@ -6,9 +6,12 @@ #import <XCTest/XCTest.h> #include "components/strings/grit/components_strings.h" +#import "ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_view.h" +#import "ios/chrome/browser/ui/toolbar/adaptive/secondary_toolbar_view.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_constants.h" #include "ios/chrome/browser/ui/ui_util.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" +#import "ios/chrome/browser/ui/util/top_view_controller.h" #include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/test/app/bookmarks_test_util.h" #import "ios/chrome/test/app/chrome_test_util.h" @@ -45,15 +48,18 @@ return std::move(http_response); } +// Returns a matcher for the bookmark button. id<GREYMatcher> BookmarkButton() { return chrome_test_util::ButtonWithAccessibilityLabelId(IDS_TOOLTIP_STAR); } +// Returns a matcher for the visible share button. id<GREYMatcher> ShareButton() { return grey_allOf(grey_accessibilityID(kToolbarShareButtonIdentifier), grey_sufficientlyVisible(), nil); } +// Returns a matcher for a UIResponder object being first responder. id<GREYMatcher> firstResponder() { MatchesBlock matches = ^BOOL(UIResponder* responder) { return [responder isFirstResponder]; @@ -67,6 +73,92 @@ descriptionBlock:describe], nil); } + +// Returns a matcher for elements being subviews of the PrimaryToolbarView and +// sufficientlyVisible. +id<GREYMatcher> VisibleInPrimaryToolbar() { + return grey_allOf(grey_ancestor(grey_kindOfClass([PrimaryToolbarView class])), + grey_sufficientlyVisible(), nil); +} + +// Returns a matcher for elements being subviews of the SecondaryToolbarView and +// sufficientlyVisible. +id<GREYMatcher> VisibleInSecondaryToolbar() { + return grey_allOf( + grey_ancestor(grey_kindOfClass([SecondaryToolbarView class])), + grey_sufficientlyVisible(), nil); +} + +// Check that the button displayed are the ones which should be displayed in the +// environment described by |traitCollection|. +void CheckToolbarButtonVisibility(UITraitCollection* traitCollection) { + if (traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassCompact && + traitCollection.verticalSizeClass != UIUserInterfaceSizeClassCompact) { + // Split toolbar. + + // Test the visibility of the primary toolbar buttons. + [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] + assertWithMatcher:VisibleInPrimaryToolbar()]; + [[EarlGrey selectElementWithMatcher:chrome_test_util::ForwardButton()] + assertWithMatcher:VisibleInPrimaryToolbar()]; + [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] + assertWithMatcher:VisibleInPrimaryToolbar()]; + + // Test the visibility of the secondary toolbar buttons. + [[EarlGrey selectElementWithMatcher:chrome_test_util:: + ButtonWithAccessibilityLabelId( + IDS_IOS_TOOLBAR_SHOW_TABS)] + assertWithMatcher:VisibleInSecondaryToolbar()]; + [[EarlGrey selectElementWithMatcher:ShareButton()] + assertWithMatcher:VisibleInSecondaryToolbar()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID( + kToolbarOmniboxButtonIdentifier)] + assertWithMatcher:VisibleInSecondaryToolbar()]; + [[EarlGrey selectElementWithMatcher:BookmarkButton()] + assertWithMatcher:VisibleInSecondaryToolbar()]; + [[EarlGrey selectElementWithMatcher:chrome_test_util:: + ButtonWithAccessibilityLabelId( + IDS_IOS_TOOLBAR_SETTINGS)] + assertWithMatcher:VisibleInSecondaryToolbar()]; + } else { + // Unsplit toolbar. + + // Test the visibility of the primary toolbar buttons. + [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] + assertWithMatcher:VisibleInPrimaryToolbar()]; + [[EarlGrey selectElementWithMatcher:chrome_test_util::ForwardButton()] + assertWithMatcher:VisibleInPrimaryToolbar()]; + [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] + assertWithMatcher:VisibleInPrimaryToolbar()]; + [[EarlGrey selectElementWithMatcher:ShareButton()] + assertWithMatcher:VisibleInPrimaryToolbar()]; + [[EarlGrey selectElementWithMatcher:BookmarkButton()] + assertWithMatcher:VisibleInPrimaryToolbar()]; + [[EarlGrey selectElementWithMatcher:chrome_test_util:: + ButtonWithAccessibilityLabelId( + IDS_IOS_TOOLBAR_SETTINGS)] + assertWithMatcher:VisibleInPrimaryToolbar()]; + + // The secondary toolbar is not visible. + [[EarlGrey + selectElementWithMatcher:grey_kindOfClass([SecondaryToolbarView class])] + assertWithMatcher:grey_not(grey_sufficientlyVisible())]; + + if (traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact) { + // Unsplit in compact height, the stack view button is visible. + [[EarlGrey selectElementWithMatcher:chrome_test_util:: + ButtonWithAccessibilityLabelId( + IDS_IOS_TOOLBAR_SHOW_TABS)] + assertWithMatcher:VisibleInPrimaryToolbar()]; + } else { + // Unsplit in Regular x Regular, the reload/stop button is visible. + [[EarlGrey selectElementWithMatcher:chrome_test_util:: + ButtonWithAccessibilityLabelId( + IDS_IOS_ACCNAME_RELOAD)] + assertWithMatcher:VisibleInPrimaryToolbar()]; + } + } +} } #pragma mark - TestCase @@ -233,21 +325,54 @@ // Verifies the existence and state of toolbar UI elements. - (void)testToolbarUI { - id<GREYMatcher> bookmarkButton = - chrome_test_util::ButtonWithAccessibilityLabelId(IDS_TOOLTIP_STAR); - - // Navigate to a page and verify the back button is enabled. + // Load a page to have the toolbar visible (hidden on NTP). [ChromeEarlGrey loadURL:GURL("chrome://version")]; - [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] - assertWithMatcher:grey_interactable()]; - // Check that the bookmark button is visible on compact width. - if (IsCompactWidth()) { - [[EarlGrey selectElementWithMatcher:bookmarkButton] - assertWithMatcher:grey_sufficientlyVisible()]; + // Get the original trait collection. + UIViewController* topViewController = + top_view_controller::TopPresentedViewController(); + UITraitCollection* originalTraitCollection = + topViewController.traitCollection; + + // Check the button visibility. + CheckToolbarButtonVisibility(originalTraitCollection); + + UITraitCollection* secondTraitCollection = nil; + if (IsIPadIdiom()) { + // Simulate a multitasking by overriding the trait collections of the view + // controllers. The rotation doesn't work on iPad. + UITraitCollection* horizontalCompact = [UITraitCollection + traitCollectionWithHorizontalSizeClass:UIUserInterfaceSizeClassCompact]; + secondTraitCollection = + [UITraitCollection traitCollectionWithTraitsFromCollections:@[ + originalTraitCollection, horizontalCompact + ]]; + for (UIViewController* child in topViewController.childViewControllers) { + [topViewController setOverrideTraitCollection:secondTraitCollection + forChildViewController:child]; + } + + } else { + // On iPhone rotate to test the the landscape orientation. + [EarlGrey rotateDeviceToOrientation:UIDeviceOrientationLandscapeLeft + errorOrNil:nil]; + secondTraitCollection = topViewController.traitCollection; } - // TODO(crbug.com/801145): Test more pieces of UI. + // Check the visiblity after a size class change. + CheckToolbarButtonVisibility(secondTraitCollection); + + if (IsIPadIdiom()) { + // Remove the override. + for (UIViewController* child in topViewController.childViewControllers) { + [topViewController setOverrideTraitCollection:originalTraitCollection + forChildViewController:child]; + } + } else { + // Cancel the rotation. + [EarlGrey rotateDeviceToOrientation:UIDeviceOrientationPortrait + errorOrNil:nil]; + } } @end
diff --git a/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_view_controller.h b/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_view_controller.h index 388a3c4..fb3964b0 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_view_controller.h +++ b/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_view_controller.h
@@ -7,8 +7,8 @@ #import <UIKit/UIKit.h> +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_type.h" #import "ios/chrome/browser/ui/toolbar/clean/toolbar_consumer.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_type.h" @protocol ApplicationCommands; @protocol BrowserCommands;
diff --git a/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_view_controller.mm b/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_view_controller.mm index 6840a40..aa0a9af 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_view_controller.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_view_controller.mm
@@ -7,11 +7,11 @@ #import "base/logging.h" #include "base/metrics/user_metrics.h" #import "ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_view.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_constants.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tab_grid_button.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" #import "ios/chrome/browser/ui/toolbar/public/omnibox_focuser.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_constants.h" #import "ios/third_party/material_components_ios/src/components/ProgressView/src/MaterialProgressView.h"
diff --git a/ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_coordinator.mm b/ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_coordinator.mm index 4b431a2ba..c32f492 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_coordinator.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_coordinator.mm
@@ -22,7 +22,7 @@ #import "ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_view_controller.h" #import "ios/chrome/browser/ui/toolbar/clean/toolbar_coordinator_delegate.h" #import "ios/chrome/browser/ui/toolbar/public/web_toolbar_controller_constants.h" -#include "ios/chrome/browser/ui/toolbar/toolbar_model_ios.h" +#import "ios/chrome/browser/ui/uikit_ui_util.h" #import "ios/chrome/browser/ui/url_loader.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" #include "ios/web/public/referrer.h"
diff --git a/ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_view.mm b/ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_view.mm index 42438fc..fad8d312 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_view.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_view.mm
@@ -5,12 +5,12 @@ #import "ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_view.h" #include "base/logging.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_configuration.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_constants.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tab_grid_button.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" #import "ios/chrome/browser/ui/util/constraints_ui_util.h" #import "ios/third_party/material_components_ios/src/components/ProgressView/src/MaterialProgressView.h"
diff --git a/ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_view_controller.mm b/ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_view_controller.mm index a1d472e..9883d33 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_view_controller.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_view_controller.mm
@@ -12,11 +12,11 @@ #import "ios/chrome/browser/ui/history_popup/requirements/tab_history_constants.h" #import "ios/chrome/browser/ui/toolbar/adaptive/adaptive_toolbar_view_controller+subclassing.h" #import "ios/chrome/browser/ui/toolbar/adaptive/primary_toolbar_view.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_configuration.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_constants.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" #import "ios/chrome/browser/ui/util/named_guide.h" #import "ios/third_party/material_components_ios/src/components/ProgressView/src/MaterialProgressView.h"
diff --git a/ios/chrome/browser/ui/toolbar/adaptive/secondary_toolbar_view.mm b/ios/chrome/browser/ui/toolbar/adaptive/secondary_toolbar_view.mm index be2900e..9707d0e 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive/secondary_toolbar_view.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive/secondary_toolbar_view.mm
@@ -5,11 +5,11 @@ #import "ios/chrome/browser/ui/toolbar/adaptive/secondary_toolbar_view.h" #include "base/logging.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_configuration.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tab_grid_button.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" #import "ios/chrome/browser/ui/util/constraints_ui_util.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/ui/toolbar/adaptive/secondary_toolbar_view_controller.mm b/ios/chrome/browser/ui/toolbar/adaptive/secondary_toolbar_view_controller.mm index 5bb93af5..ac3b284d 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive/secondary_toolbar_view_controller.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive/secondary_toolbar_view_controller.mm
@@ -5,8 +5,8 @@ #import "ios/chrome/browser/ui/toolbar/adaptive/secondary_toolbar_view_controller.h" #import "ios/chrome/browser/ui/toolbar/adaptive/secondary_toolbar_view.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_constants.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" #import "ios/chrome/browser/ui/util/named_guide.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/ui/toolbar/buttons/BUILD.gn b/ios/chrome/browser/ui/toolbar/buttons/BUILD.gn new file mode 100644 index 0000000..b046600 --- /dev/null +++ b/ios/chrome/browser/ui/toolbar/buttons/BUILD.gn
@@ -0,0 +1,49 @@ +# Copyright 2018 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +source_set("buttons") { + sources = [ + "toolbar_button.h", + "toolbar_button.mm", + "toolbar_button_factory.h", + "toolbar_button_factory.mm", + "toolbar_button_tints.h", + "toolbar_button_tints.mm", + "toolbar_button_visibility_configuration.h", + "toolbar_button_visibility_configuration.mm", + "toolbar_component_options.h", + "toolbar_configuration.h", + "toolbar_configuration.mm", + "toolbar_constants.h", + "toolbar_constants.mm", + "toolbar_style.h", + "toolbar_tab_grid_button.h", + "toolbar_tab_grid_button.mm", + "toolbar_tools_menu_button.h", + "toolbar_tools_menu_button.mm", + "toolbar_type.h", + "tools_menu_button_observer_bridge.h", + "tools_menu_button_observer_bridge.mm", + ] + deps = [ + "//base", + "//components/reading_list/core", + "//components/reading_list/ios", + "//components/strings", + "//ios/chrome/app/strings", + "//ios/chrome/app/theme", + "//ios/chrome/browser/ui", + "//ios/chrome/browser/ui/commands", + "//ios/chrome/browser/ui/toolbar:resource_macros", + "//ios/chrome/browser/ui/toolbar/public", + "//ios/chrome/browser/ui/toolbar/public:toolbar_base_feature", + "//ios/chrome/browser/ui/util", + "//ios/public/provider/chrome/browser", + "//ios/public/provider/chrome/browser/images", + "//ios/third_party/material_components_ios", + "//ui/base", + ] + libs = [ "UIKit.framework" ] + configs += [ "//build/config/compiler:enable_arc" ] +}
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_button.h b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button.h similarity index 85% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_button.h rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_button.h index 65f40ecd..518555b 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_button.h +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_BUTTON_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_BUTTON_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_H_ #import <UIKit/UIKit.h> -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_component_options.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_component_options.h" #import "ios/chrome/browser/ui/util/named_guide.h" // UIButton subclass used as a Toolbar component. @@ -38,4 +38,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_BUTTON_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_H_
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_button.mm b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button.mm similarity index 98% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_button.mm rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_button.mm index 806779b..812bad6d 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_button.mm +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button.mm
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #import "ios/chrome/browser/ui/util/constraints_ui_util.h"
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.h b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h similarity index 90% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.h rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h index 0e10f60f..9404daa5 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.h +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_BUTTON_FACTORY_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_BUTTON_FACTORY_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_FACTORY_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_FACTORY_H_ #import <UIKit/UIKit.h> -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_style.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_style.h" @protocol ApplicationCommands; @protocol BrowserCommands; @@ -81,4 +81,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_BUTTON_FACTORY_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_FACTORY_H_
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.mm b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.mm similarity index 97% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.mm rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.mm index 118aba95..9514d75 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.mm +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.mm
@@ -2,19 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h" #include "base/ios/ios_util.h" #include "components/strings/grit/components_strings.h" #import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/rtl_geometry.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_visibility_configuration.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_configuration.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_constants.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tab_grid_button.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" #import "ios/chrome/browser/ui/toolbar/public/omnibox_focuser.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_base_feature.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_constants.h"
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_button_tints.h b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_tints.h similarity index 76% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_button_tints.h rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_button_tints.h index 611f789..6549968 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_button_tints.h +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_tints.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_BUTTON_TINTS_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_BUTTON_TINTS_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_TINTS_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_TINTS_H_ #import <UIKit/UIKit.h> @@ -21,4 +21,4 @@ } // namespace toolbar -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_BUTTON_TINTS_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_TINTS_H_
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_button_tints.mm b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_tints.mm similarity index 94% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_button_tints.mm rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_button_tints.mm index 8447c0b..97a918ef 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_button_tints.mm +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_tints.mm
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ios/chrome/browser/ui/toolbar/clean/toolbar_button_tints.h" +#include "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_tints.h" #include "base/logging.h" #import "ios/chrome/browser/ui/uikit_ui_util.h"
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_button_visibility_configuration.h b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.h similarity index 81% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_button_visibility_configuration.h rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.h index e0aebfa2..cebf50f 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_button_visibility_configuration.h +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_BUTTON_VISIBILITY_CONFIGURATION_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_BUTTON_VISIBILITY_CONFIGURATION_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_VISIBILITY_CONFIGURATION_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_VISIBILITY_CONFIGURATION_H_ #import <UIKit/UIKit.h> -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_component_options.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_type.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_component_options.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_type.h" // Toolbar button configuration object giving access to visibility mask for each // button. @@ -50,4 +50,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_BUTTON_VISIBILITY_CONFIGURATION_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_VISIBILITY_CONFIGURATION_H_
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_button_visibility_configuration.mm b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.mm similarity index 97% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_button_visibility_configuration.mm rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.mm index d8f9cbe..0401486 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_button_visibility_configuration.mm +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.mm
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_visibility_configuration.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_component_options.h b/ios/chrome/browser/ui/toolbar/buttons/toolbar_component_options.h similarity index 90% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_component_options.h rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_component_options.h index f7e84ff8..a1a1c96 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_component_options.h +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_component_options.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_COMPONENT_OPTIONS_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_COMPONENT_OPTIONS_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_COMPONENT_OPTIONS_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_COMPONENT_OPTIONS_H_ // List of different SizeClass states. If a Visibility Mask bit is TRUE then the // component could be visible for that SizeClass. In order for a component to be @@ -42,4 +42,4 @@ ToolbarComponentVisibilityIPhoneOnly = 1 << 5, }; -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_COMPONENT_OPTIONS_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_COMPONENT_OPTIONS_H_
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_configuration.h b/ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.h similarity index 86% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_configuration.h rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.h index 7ae9c8e..0d17bd0 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_configuration.h +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_CONFIGURATION_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_CONFIGURATION_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_CONFIGURATION_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_CONFIGURATION_H_ #import <UIKit/UIKit.h> -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_style.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_style.h" // Toolbar configuration object giving access to styling elements. @interface ToolbarConfiguration : NSObject @@ -52,4 +52,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_CONFIGURATION_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_CONFIGURATION_H_
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_configuration.mm b/ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.mm similarity index 95% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_configuration.mm rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.mm index e8b9b95f..7c615e6 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_configuration.mm +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.mm
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_configuration.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.h" #import "base/logging.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_constants.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h" #import "ios/chrome/browser/ui/toolbar/public/web_toolbar_controller_constants.h" #include "ios/chrome/browser/ui/ui_util.h" #import "ios/chrome/browser/ui/uikit_ui_util.h"
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_constants.h b/ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h similarity index 92% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_constants.h rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h index e3b2d9f..a49ab7d 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_constants.h +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_CONSTANTS_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_CONSTANTS_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_CONSTANTS_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_CONSTANTS_H_ #import <CoreGraphics/CoreGraphics.h> #import <Foundation/Foundation.h> @@ -65,4 +65,4 @@ extern const CGFloat kIcongnitoAdaptiveLocationBackgroundColor; extern const CGFloat kAdaptiveLocationBarBackgroundAlpha; -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_CONSTANTS_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_CONSTANTS_H_
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_constants.mm b/ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.mm similarity index 96% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_constants.mm rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.mm index ccb73ff..5d1ae5bb 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_constants.mm +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.mm
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_constants.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_style.h b/ios/chrome/browser/ui/toolbar/buttons/toolbar_style.h similarity index 68% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_style.h rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_style.h index 90b376c..74f5036 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_style.h +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_style.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_STYLE_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_STYLE_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_STYLE_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_STYLE_H_ // Enum defining the different styles for the toolbar. The value of the enum are // used as array accessor. @@ -14,4 +14,4 @@ INCOGNITO = 1 }; -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_STYLE_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_STYLE_H_
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_tab_grid_button.h b/ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.h similarity index 60% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_tab_grid_button.h rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.h index 650216d..ac29b56 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_tab_grid_button.h +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.h
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_TAB_GRID_BUTTON_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_TAB_GRID_BUTTON_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_TAB_GRID_BUTTON_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_TAB_GRID_BUTTON_H_ -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button.h" // ToolbarButton for displaying the number of tab. @interface ToolbarTabGridButton : ToolbarButton @@ -16,4 +16,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_TAB_GRID_BUTTON_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_TAB_GRID_BUTTON_H_
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_tab_grid_button.mm b/ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.mm similarity index 93% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_tab_grid_button.mm rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.mm index 34f4d23c..cf044bd 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_tab_grid_button.mm +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.mm
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tab_grid_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_constants.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_base_feature.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_constants.h" #import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h b/ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h similarity index 82% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h index ccda6ec..ca5f7542 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_TOOLS_MENU_BUTTON_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_TOOLS_MENU_BUTTON_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_TOOLS_MENU_BUTTON_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_TOOLS_MENU_BUTTON_H_ #import <UIKit/UIKit.h> -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_constants.h" // ColoredButton specialization that updates the tint color when the tools menu @@ -39,4 +39,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_TOOLS_MENU_BUTTON_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_TOOLS_MENU_BUTTON_H_
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.mm b/ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.mm similarity index 98% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.mm rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.mm index 1eb4208..df6805e 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.mm +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.mm
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" #import <QuartzCore/CAAnimation.h> #import <QuartzCore/CAMediaTimingFunction.h> #include "base/logging.h" #include "ios/chrome/browser/ui/rtl_geometry.h" -#include "ios/chrome/browser/ui/toolbar/clean/toolbar_button_tints.h" +#include "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_tints.h" #include "ios/chrome/browser/ui/ui_util.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_type.h b/ios/chrome/browser/ui/toolbar/buttons/toolbar_type.h similarity index 69% rename from ios/chrome/browser/ui/toolbar/clean/toolbar_type.h rename to ios/chrome/browser/ui/toolbar/buttons/toolbar_type.h index 96da69f3..2485273 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_type.h +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_type.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_TYPE_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_TYPE_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_TYPE_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_TYPE_H_ // Enum defining the different styles for the toolbar. typedef NS_ENUM(NSInteger, ToolbarType) { @@ -16,4 +16,4 @@ LEGACY = 2, }; -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_CLEAN_TOOLBAR_TYPE_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_TYPE_H_
diff --git a/ios/chrome/browser/ui/toolbar/tools_menu_button_observer_bridge.h b/ios/chrome/browser/ui/toolbar/buttons/tools_menu_button_observer_bridge.h similarity index 75% rename from ios/chrome/browser/ui/toolbar/tools_menu_button_observer_bridge.h rename to ios/chrome/browser/ui/toolbar/buttons/tools_menu_button_observer_bridge.h index 52ac187..a86504d 100644 --- a/ios/chrome/browser/ui/toolbar/tools_menu_button_observer_bridge.h +++ b/ios/chrome/browser/ui/toolbar/buttons/tools_menu_button_observer_bridge.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLS_MENU_BUTTON_OBSERVER_BRIDGE_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLS_MENU_BUTTON_OBSERVER_BRIDGE_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLS_MENU_BUTTON_OBSERVER_BRIDGE_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLS_MENU_BUTTON_OBSERVER_BRIDGE_H_ #import <UIKit/UIKit.h> @@ -24,4 +24,4 @@ - (instancetype)init NS_UNAVAILABLE; @end -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLS_MENU_BUTTON_OBSERVER_BRIDGE_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLS_MENU_BUTTON_OBSERVER_BRIDGE_H_
diff --git a/ios/chrome/browser/ui/toolbar/tools_menu_button_observer_bridge.mm b/ios/chrome/browser/ui/toolbar/buttons/tools_menu_button_observer_bridge.mm similarity index 92% rename from ios/chrome/browser/ui/toolbar/tools_menu_button_observer_bridge.mm rename to ios/chrome/browser/ui/toolbar/buttons/tools_menu_button_observer_bridge.mm index 66d4211..d8a4f4c1 100644 --- a/ios/chrome/browser/ui/toolbar/tools_menu_button_observer_bridge.mm +++ b/ios/chrome/browser/ui/toolbar/buttons/tools_menu_button_observer_bridge.mm
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/ui/toolbar/tools_menu_button_observer_bridge.h" +#import "ios/chrome/browser/ui/toolbar/buttons/tools_menu_button_observer_bridge.h" #include <memory> #include "base/logging.h" #include "components/reading_list/core/reading_list_model.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/toolbar/clean/BUILD.gn b/ios/chrome/browser/ui/toolbar/clean/BUILD.gn index f6d54b1..58a6deb 100644 --- a/ios/chrome/browser/ui/toolbar/clean/BUILD.gn +++ b/ios/chrome/browser/ui/toolbar/clean/BUILD.gn
@@ -14,7 +14,6 @@ configs += [ "//build/config/compiler:enable_arc" ] deps = [ - ":toolbar_components_ui", ":toolbar_ui", "//base", "//components/bookmarks/browser", @@ -37,6 +36,7 @@ "//ios/chrome/browser/ui/ntp:util", "//ios/chrome/browser/ui/omnibox", "//ios/chrome/browser/ui/omnibox:omnibox_internal", + "//ios/chrome/browser/ui/toolbar/buttons", "//ios/chrome/browser/ui/toolbar/keyboard_assist", "//ios/chrome/browser/ui/toolbar/public", "//ios/chrome/browser/ui/tools_menu:configuration", @@ -64,7 +64,6 @@ "toolbar_view_controller.mm", ] deps = [ - ":toolbar_components_ui", "//base", "//ios/chrome/app/theme", "//ios/chrome/browser/ui", @@ -72,6 +71,7 @@ "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/fullscreen:ui", "//ios/chrome/browser/ui/history_popup/requirements", + "//ios/chrome/browser/ui/toolbar/buttons", "//ios/chrome/browser/ui/toolbar/public", "//ios/chrome/browser/ui/toolbar/public:toolbar_base_feature", "//ios/chrome/browser/ui/util", @@ -83,48 +83,6 @@ configs += [ "//build/config/compiler:enable_arc" ] } -source_set("toolbar_components_ui") { - sources = [ - "toolbar_button.h", - "toolbar_button.mm", - "toolbar_button_factory.h", - "toolbar_button_factory.mm", - "toolbar_button_tints.h", - "toolbar_button_tints.mm", - "toolbar_button_visibility_configuration.h", - "toolbar_button_visibility_configuration.mm", - "toolbar_component_options.h", - "toolbar_configuration.h", - "toolbar_configuration.mm", - "toolbar_constants.h", - "toolbar_constants.mm", - "toolbar_style.h", - "toolbar_tab_grid_button.h", - "toolbar_tab_grid_button.mm", - "toolbar_tools_menu_button.h", - "toolbar_tools_menu_button.mm", - "toolbar_type.h", - ] - deps = [ - "//base", - "//components/strings", - "//ios/chrome/app/strings", - "//ios/chrome/app/theme", - "//ios/chrome/browser/ui", - "//ios/chrome/browser/ui/commands", - "//ios/chrome/browser/ui/toolbar:resource_macros", - "//ios/chrome/browser/ui/toolbar/public", - "//ios/chrome/browser/ui/toolbar/public:toolbar_base_feature", - "//ios/chrome/browser/ui/util", - "//ios/public/provider/chrome/browser", - "//ios/public/provider/chrome/browser/images", - "//ios/third_party/material_components_ios", - "//ui/base", - ] - libs = [ "UIKit.framework" ] - configs += [ "//build/config/compiler:enable_arc" ] -} - source_set("unit_tests") { testonly = true
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_button_updater.mm b/ios/chrome/browser/ui/toolbar/clean/toolbar_button_updater.mm index 228ec7c..1470889 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_button_updater.mm +++ b/ios/chrome/browser/ui/toolbar/clean/toolbar_button_updater.mm
@@ -4,7 +4,7 @@ #import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_updater.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_constants.h" #import "ios/chrome/browser/ui/voice/voice_search_notification_names.h"
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_coordinator.mm b/ios/chrome/browser/ui/toolbar/clean/toolbar_coordinator.mm index 08493a6..73385db 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_coordinator.mm +++ b/ios/chrome/browser/ui/toolbar/clean/toolbar_coordinator.mm
@@ -21,17 +21,16 @@ #import "ios/chrome/browser/ui/ntp/ntp_util.h" #import "ios/chrome/browser/ui/omnibox/omnibox_popup_positioner.h" #import "ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_style.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/tools_menu_button_observer_bridge.h" #import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_updater.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_visibility_configuration.h" #import "ios/chrome/browser/ui/toolbar/clean/toolbar_coordinator_delegate.h" #import "ios/chrome/browser/ui/toolbar/clean/toolbar_mediator.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_style.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h" #import "ios/chrome/browser/ui/toolbar/clean/toolbar_view_controller.h" #import "ios/chrome/browser/ui/toolbar/public/web_toolbar_controller_constants.h" -#include "ios/chrome/browser/ui/toolbar/toolbar_model_ios.h" -#import "ios/chrome/browser/ui/toolbar/tools_menu_button_observer_bridge.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #import "ios/chrome/browser/ui/url_loader.h" #import "ios/chrome/browser/ui/voice/text_to_speech_player.h"
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_coordinator_delegate.h b/ios/chrome/browser/ui/toolbar/clean/toolbar_coordinator_delegate.h index 01c6ec7..76418d1f 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_coordinator_delegate.h +++ b/ios/chrome/browser/ui/toolbar/clean/toolbar_coordinator_delegate.h
@@ -7,7 +7,7 @@ #import <Foundation/Foundation.h> -class ToolbarModelIOS; +class ToolbarModel; // Protocol receiving notification when the some events occur in the // ToolbarCoordinator @@ -20,7 +20,10 @@ // Called when the location bar receives a key press. - (void)locationBarBeganEdit; // Returns the toolbar model. -- (ToolbarModelIOS*)toolbarModelIOS; +- (ToolbarModel*)toolbarModel; +// Whether the hint text should be displayed in the location bar. +// TODO(crbug.com/800266): This is not needed with the adaptive toolbar. +- (BOOL)shouldDisplayHintText; @end
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_view.mm b/ios/chrome/browser/ui/toolbar/clean/toolbar_view.mm index a85c948..f482510f 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_view.mm +++ b/ios/chrome/browser/ui/toolbar/clean/toolbar_view.mm
@@ -5,11 +5,11 @@ #import "ios/chrome/browser/ui/toolbar/clean/toolbar_view.h" #import "base/mac/foundation_util.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_configuration.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_constants.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_constants.h" #import "ios/chrome/browser/ui/toolbar/public/web_toolbar_controller_constants.h" #import "ios/chrome/browser/ui/uikit_ui_util.h"
diff --git a/ios/chrome/browser/ui/toolbar/clean/toolbar_view_controller.mm b/ios/chrome/browser/ui/toolbar/clean/toolbar_view_controller.mm index 9d5d6fc..78cb4ba 100644 --- a/ios/chrome/browser/ui/toolbar/clean/toolbar_view_controller.mm +++ b/ios/chrome/browser/ui/toolbar/clean/toolbar_view_controller.mm
@@ -16,13 +16,13 @@ #import "ios/chrome/browser/ui/fullscreen/fullscreen_scroll_end_animator.h" #import "ios/chrome/browser/ui/fullscreen/fullscreen_scroll_to_top_animator.h" #include "ios/chrome/browser/ui/rtl_geometry.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_factory.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_component_options.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" #import "ios/chrome/browser/ui/toolbar/clean/toolbar_button_updater.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_component_options.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_configuration.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_constants.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h" #import "ios/chrome/browser/ui/toolbar/clean/toolbar_view.h" #import "ios/chrome/browser/ui/toolbar/public/omnibox_focuser.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_base_feature.h"
diff --git a/ios/chrome/browser/ui/toolbar/legacy/BUILD.gn b/ios/chrome/browser/ui/toolbar/legacy/BUILD.gn new file mode 100644 index 0000000..c2c9035 --- /dev/null +++ b/ios/chrome/browser/ui/toolbar/legacy/BUILD.gn
@@ -0,0 +1,53 @@ +# Copyright 2018 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +source_set("legacy") { + configs += [ "//build/config/compiler:enable_arc" ] + sources = [ + "legacy_toolbar_view.h", + "legacy_toolbar_view.mm", + "toolbar_controller+protected.h", + "toolbar_controller.h", + "toolbar_controller.mm", + ] + deps = [ + "//base", + "//base:i18n", + "//ios/chrome/app/strings", + "//ios/chrome/app/theme", + "//ios/chrome/browser/ui", + "//ios/chrome/browser/ui/activity_services/requirements", + "//ios/chrome/browser/ui/bubble", + "//ios/chrome/browser/ui/commands", + "//ios/chrome/browser/ui/fullscreen:ui", + "//ios/chrome/browser/ui/image_util", + "//ios/chrome/browser/ui/toolbar:resource_macros", + "//ios/chrome/browser/ui/toolbar/buttons", + "//ios/chrome/browser/ui/toolbar/buttons", + "//ios/chrome/browser/ui/toolbar/public", + "//ios/chrome/browser/ui/tools_menu:configuration", + "//ios/chrome/browser/ui/tools_menu/public", + "//ios/chrome/browser/ui/util", + "//ios/chrome/common:timing", + "//ios/third_party/material_components_ios", + ] +} + +source_set("unit_tests") { + configs += [ "//build/config/compiler:enable_arc" ] + testonly = true + sources = [ + "toolbar_controller_unittest.mm", + ] + deps = [ + ":legacy", + "//base", + "//ios/chrome/browser/ui:ui_util", + "//ios/testing:ocmock_support", + "//ios/web/public/test", + "//ios/web/public/test/fakes", + "//testing/gtest", + "//third_party/ocmock", + ] +}
diff --git a/ios/chrome/browser/ui/toolbar/legacy_toolbar_view.h b/ios/chrome/browser/ui/toolbar/legacy/legacy_toolbar_view.h similarity index 70% rename from ios/chrome/browser/ui/toolbar/legacy_toolbar_view.h rename to ios/chrome/browser/ui/toolbar/legacy/legacy_toolbar_view.h index 283c861..06e2799 100644 --- a/ios/chrome/browser/ui/toolbar/legacy_toolbar_view.h +++ b/ios/chrome/browser/ui/toolbar/legacy/legacy_toolbar_view.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_LEGACY_TOOLBAR_VIEW_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_LEGACY_TOOLBAR_VIEW_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_LEGACY_LEGACY_TOOLBAR_VIEW_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_LEGACY_LEGACY_TOOLBAR_VIEW_H_ #import <UIKit/UIKit.h> @@ -16,8 +16,6 @@ bundle:(NSBundle*)bundle NS_UNAVAILABLE; - (instancetype)initWithCoder:(NSCoder*)coder NS_UNAVAILABLE; -// The delegate used to handle frame changes and windows events. -@property(nonatomic, weak) id<ToolbarViewDelegate> delegate; // Records whether or not the toolbar is currently involved in a transition // animation. @property(nonatomic, assign, getter=isAnimatingTransition) @@ -25,4 +23,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_LEGACY_TOOLBAR_VIEW_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_LEGACY_LEGACY_TOOLBAR_VIEW_H_
diff --git a/ios/chrome/browser/ui/toolbar/legacy_toolbar_view.mm b/ios/chrome/browser/ui/toolbar/legacy/legacy_toolbar_view.mm similarity index 79% rename from ios/chrome/browser/ui/toolbar/legacy_toolbar_view.mm rename to ios/chrome/browser/ui/toolbar/legacy/legacy_toolbar_view.mm index 2134270f3b..25643b1 100644 --- a/ios/chrome/browser/ui/toolbar/legacy_toolbar_view.mm +++ b/ios/chrome/browser/ui/toolbar/legacy/legacy_toolbar_view.mm
@@ -2,14 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/ui/toolbar/legacy_toolbar_view.h" +#import "ios/chrome/browser/ui/toolbar/legacy/legacy_toolbar_view.h" -#import "ios/chrome/browser/ui/toolbar/toolbar_view_delegate.h" #include "ios/chrome/browser/ui/ui_util.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + @implementation LegacyToolbarView -@synthesize delegate = delegate_; @synthesize animatingTransition = animatingTransition_; @synthesize hitTestBoundsContraintRelaxed = hitTestBoundsContraintRelaxed_; @@ -55,21 +57,6 @@ return hitView; } -- (void)setFrame:(CGRect)frame { - [super setFrame:frame]; - [delegate_ toolbarDidLayout]; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - [delegate_ toolbarDidLayout]; -} - -- (void)didMoveToWindow { - [super didMoveToWindow]; - [delegate_ windowDidChange]; -} - - (id<CAAction>)actionForLayer:(CALayer*)layer forKey:(NSString*)event { // Don't allow UIView block-based animations if we're already performing // explicit transition animations. @@ -78,9 +65,4 @@ return [super actionForLayer:layer forKey:event]; } -- (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { - [super traitCollectionDidChange:previousTraitCollection]; - [delegate_ traitCollectionDidChange]; -} - @end
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_controller+protected.h b/ios/chrome/browser/ui/toolbar/legacy/toolbar_controller+protected.h similarity index 93% rename from ios/chrome/browser/ui/toolbar/toolbar_controller+protected.h rename to ios/chrome/browser/ui/toolbar/legacy/toolbar_controller+protected.h index 77de5c40..553b1b6 100644 --- a/ios/chrome/browser/ui/toolbar/toolbar_controller+protected.h +++ b/ios/chrome/browser/ui/toolbar/legacy/toolbar_controller+protected.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_CONTROLLER_PROTECTED_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_CONTROLLER_PROTECTED_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_LEGACY_TOOLBAR_CONTROLLER_PROTECTED_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_LEGACY_TOOLBAR_CONTROLLER_PROTECTED_H_ +#import "ios/chrome/browser/ui/toolbar/legacy/toolbar_controller.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_constants.h" -#import "ios/chrome/browser/ui/toolbar/toolbar_controller.h" @interface ToolbarController (Protected) @@ -105,4 +105,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_CONTROLLER_PROTECTED_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_LEGACY_TOOLBAR_CONTROLLER_PROTECTED_H_
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_controller.h b/ios/chrome/browser/ui/toolbar/legacy/toolbar_controller.h similarity index 92% rename from ios/chrome/browser/ui/toolbar/toolbar_controller.h rename to ios/chrome/browser/ui/toolbar/legacy/toolbar_controller.h index 54742d5..fc1ce7b 100644 --- a/ios/chrome/browser/ui/toolbar/toolbar_controller.h +++ b/ios/chrome/browser/ui/toolbar/legacy/toolbar_controller.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_CONTROLLER_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_CONTROLLER_H_ +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_LEGACY_TOOLBAR_CONTROLLER_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_LEGACY_TOOLBAR_CONTROLLER_H_ #import <UIKit/UIKit.h> #import "ios/chrome/browser/ui/activity_services/requirements/activity_service_positioner.h" #import "ios/chrome/browser/ui/fullscreen/fullscreen_ui_element.h" -#import "ios/chrome/browser/ui/toolbar/legacy_toolbar_view.h" +#import "ios/chrome/browser/ui/toolbar/legacy/legacy_toolbar_view.h" #import "ios/chrome/browser/ui/toolbar/public/abstract_toolbar.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_controller_constants.h" #import "ios/chrome/browser/ui/tools_menu/public/tools_menu_presentation_provider.h" @@ -75,4 +75,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_CONTROLLER_H_ +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_LEGACY_TOOLBAR_CONTROLLER_H_
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_controller.mm b/ios/chrome/browser/ui/toolbar/legacy/toolbar_controller.mm similarity index 98% rename from ios/chrome/browser/ui/toolbar/toolbar_controller.mm rename to ios/chrome/browser/ui/toolbar/legacy/toolbar_controller.mm index 30ad764..5d1417a 100644 --- a/ios/chrome/browser/ui/toolbar/toolbar_controller.mm +++ b/ios/chrome/browser/ui/toolbar/legacy/toolbar_controller.mm
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/ui/toolbar/toolbar_controller.h" +#import "ios/chrome/browser/ui/toolbar/legacy/toolbar_controller.h" #include <QuartzCore/QuartzCore.h> @@ -25,11 +25,11 @@ #import "ios/chrome/browser/ui/image_util/image_util.h" #import "ios/chrome/browser/ui/reversed_animation.h" #include "ios/chrome/browser/ui/rtl_geometry.h" -#import "ios/chrome/browser/ui/toolbar/clean/toolbar_tools_menu_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/tools_menu_button_observer_bridge.h" +#import "ios/chrome/browser/ui/toolbar/legacy/toolbar_controller+protected.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_utils.h" -#import "ios/chrome/browser/ui/toolbar/toolbar_controller+protected.h" #include "ios/chrome/browser/ui/toolbar/toolbar_resource_macros.h" -#import "ios/chrome/browser/ui/toolbar/tools_menu_button_observer_bridge.h" #import "ios/chrome/browser/ui/tools_menu/tools_menu_configuration.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #import "ios/chrome/browser/ui/util/constraints_ui_util.h" @@ -599,7 +599,6 @@ [self fadeInStandardControls]; } - #pragma mark - ToolsMenuPresentationProvider - (UIButton*)presentingButtonForToolsMenuCoordinator:
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_controller_unittest.mm b/ios/chrome/browser/ui/toolbar/legacy/toolbar_controller_unittest.mm similarity index 95% rename from ios/chrome/browser/ui/toolbar/toolbar_controller_unittest.mm rename to ios/chrome/browser/ui/toolbar/legacy/toolbar_controller_unittest.mm index a91c1c8..95b9525 100644 --- a/ios/chrome/browser/ui/toolbar/toolbar_controller_unittest.mm +++ b/ios/chrome/browser/ui/toolbar/legacy/toolbar_controller_unittest.mm
@@ -5,8 +5,8 @@ #import <Foundation/Foundation.h> #include "base/format_macros.h" -#import "ios/chrome/browser/ui/toolbar/toolbar_controller+protected.h" -#import "ios/chrome/browser/ui/toolbar/toolbar_controller.h" +#import "ios/chrome/browser/ui/toolbar/legacy/toolbar_controller+protected.h" +#import "ios/chrome/browser/ui/toolbar/legacy/toolbar_controller.h" #import "ios/chrome/browser/ui/ui_util.h" #include "testing/gtest_mac.h" #include "testing/platform_test.h"
diff --git a/ios/chrome/browser/ui/toolbar/test_toolbar_model_ios.h b/ios/chrome/browser/ui/toolbar/test_toolbar_model_ios.h deleted file mode 100644 index d9c7adc..0000000 --- a/ios/chrome/browser/ui/toolbar/test_toolbar_model_ios.h +++ /dev/null
@@ -1,56 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_MODEL_IOS_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_MODEL_IOS_H_ - -#import <UIKit/UIKit.h> - -#include <memory> - -#include "components/toolbar/test_toolbar_model.h" -#include "ios/chrome/browser/ui/toolbar/toolbar_model_ios.h" - -class TestToolbarModelIOS : public ToolbarModelIOS { - public: - TestToolbarModelIOS(); - ~TestToolbarModelIOS() override; - - // ToolbarModelIOS implementation: - ToolbarModel* GetToolbarModel() override; - bool IsLoading() override; - CGFloat GetLoadProgressFraction() override; - bool CanGoBack() override; - bool CanGoForward() override; - bool IsCurrentTabNativePage() override; - bool IsCurrentTabBookmarked() override; - bool IsCurrentTabBookmarkedByUser() override; - bool ShouldDisplayHintText() override; - - void set_is_loading(bool is_loading) { is_loading_ = is_loading; } - void set_load_progress_fraction(CGFloat load_progress_fraction) { - load_progress_fraction_ = load_progress_fraction; - } - void set_can_go_back(bool can_go_back) { can_go_back_ = can_go_back; } - void set_can_go_forward(bool can_go_forward) { - can_go_forward_ = can_go_forward; - } - void set_is_current_tab_native_page(bool is_current_tab_native_page) { - is_current_tab_native_page_ = is_current_tab_native_page; - } - void set_is_current_tab_bookmarked(bool is_current_tab_bookmarked) { - is_current_tab_bookmarked_ = is_current_tab_bookmarked; - } - - private: - std::unique_ptr<TestToolbarModel> test_toolbar_model_; - bool is_loading_; - CGFloat load_progress_fraction_; - bool can_go_back_; - bool can_go_forward_; - bool is_current_tab_native_page_; - bool is_current_tab_bookmarked_; -}; - -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_MODEL_IOS_H_
diff --git a/ios/chrome/browser/ui/toolbar/test_toolbar_model_ios.mm b/ios/chrome/browser/ui/toolbar/test_toolbar_model_ios.mm deleted file mode 100644 index da4c58f..0000000 --- a/ios/chrome/browser/ui/toolbar/test_toolbar_model_ios.mm +++ /dev/null
@@ -1,62 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ios/chrome/browser/ui/toolbar/test_toolbar_model_ios.h" - -#include "components/toolbar/toolbar_model_impl.h" -#import "ios/chrome/browser/tabs/tab.h" - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -TestToolbarModelIOS::TestToolbarModelIOS() - : ToolbarModelIOS(), - is_loading_(false), - load_progress_fraction_(0.0), - can_go_back_(false), - can_go_forward_(false), - is_current_tab_native_page_(false), - is_current_tab_bookmarked_(false) { - test_toolbar_model_.reset(new TestToolbarModel()); -} - -TestToolbarModelIOS::~TestToolbarModelIOS() {} - -ToolbarModel* TestToolbarModelIOS::GetToolbarModel() { - return test_toolbar_model_.get(); -} - -bool TestToolbarModelIOS::IsLoading() { - return is_loading_; -} - -CGFloat TestToolbarModelIOS::GetLoadProgressFraction() { - return load_progress_fraction_; -} - -bool TestToolbarModelIOS::CanGoBack() { - return can_go_back_; -} - -bool TestToolbarModelIOS::CanGoForward() { - return can_go_forward_; -} - -bool TestToolbarModelIOS::IsCurrentTabNativePage() { - return is_current_tab_native_page_; -} - -bool TestToolbarModelIOS::IsCurrentTabBookmarked() { - return is_current_tab_bookmarked_; -} - -bool TestToolbarModelIOS::IsCurrentTabBookmarkedByUser() { - return is_current_tab_bookmarked_; -} - -bool TestToolbarModelIOS::ShouldDisplayHintText() { - return false; -} -
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_egtest.mm b/ios/chrome/browser/ui/toolbar/toolbar_egtest.mm index d349d833..dd73752 100644 --- a/ios/chrome/browser/ui/toolbar/toolbar_egtest.mm +++ b/ios/chrome/browser/ui/toolbar/toolbar_egtest.mm
@@ -12,7 +12,7 @@ #import "ios/chrome/browser/ui/ntp/new_tab_page_controller.h" #import "ios/chrome/browser/ui/omnibox/omnibox_popup_row.h" #import "ios/chrome/browser/ui/toolbar/clean/toolbar_view.h" -#import "ios/chrome/browser/ui/toolbar/toolbar_controller.h" +#import "ios/chrome/browser/ui/toolbar/legacy/toolbar_controller.h" #include "ios/chrome/browser/ui/tools_menu/public/tools_menu_constants.h" #include "ios/chrome/browser/ui/ui_util.h" #include "ios/chrome/grit/ios_strings.h"
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h b/ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h index 58259dc5..da242b14 100644 --- a/ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h +++ b/ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h
@@ -23,15 +23,6 @@ explicit ToolbarModelDelegateIOS(WebStateList* web_state_list); ~ToolbarModelDelegateIOS() override; - // Returns the active WebState. - web::WebState* GetActiveWebState() const; - - private: - // Helper method to extract the NavigationItem from which the states are - // retrieved. If this returns null (which can happens during initialization), - // default values are used. - web::NavigationItem* GetNavigationItem() const; - // ToolbarModelDelegate implementation: base::string16 FormattedStringWithEquivalentMeaning( const GURL& url, @@ -44,6 +35,15 @@ const gfx::VectorIcon* GetVectorIconOverride() const override; bool IsOfflinePage() const override; + private: + // Helper method to extract the NavigationItem from which the states are + // retrieved. If this returns null (which can happens during initialization), + // default values are used. + web::NavigationItem* GetNavigationItem() const; + + // Returns the active WebState. + web::WebState* GetActiveWebState() const; + WebStateList* web_state_list_; // weak DISALLOW_COPY_AND_ASSIGN(ToolbarModelDelegateIOS);
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.h b/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.h deleted file mode 100644 index 6b53dac..0000000 --- a/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.h +++ /dev/null
@@ -1,38 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_IOS_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_IOS_H_ - -#import <UIKit/UIKit.h> - -#include <memory> - -#include "ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h" -#include "ios/chrome/browser/ui/toolbar/toolbar_model_ios.h" - -class ToolbarModelImplIOS : public ToolbarModelIOS { - public: - explicit ToolbarModelImplIOS(ToolbarModelDelegateIOS* delegate); - ~ToolbarModelImplIOS() override; - - // ToolbarModelIOS implementation: - ToolbarModel* GetToolbarModel() override; - bool IsLoading() override; - CGFloat GetLoadProgressFraction() override; - bool CanGoBack() override; - bool CanGoForward() override; - bool IsCurrentTabNativePage() override; - bool IsCurrentTabBookmarked() override; - bool IsCurrentTabBookmarkedByUser() override; - bool ShouldDisplayHintText() override; - - private: - ToolbarModelDelegateIOS* delegate_; - std::unique_ptr<ToolbarModel> toolbar_model_; - - DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModelImplIOS); -}; - -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_IOS_H_
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm b/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm deleted file mode 100644 index 5eca57e..0000000 --- a/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm +++ /dev/null
@@ -1,106 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.h" - -#include "components/bookmarks/browser/bookmark_model.h" -#include "components/toolbar/toolbar_model_impl.h" -#include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" -#include "ios/chrome/browser/browser_state/chrome_browser_state.h" -#include "ios/chrome/browser/chrome_url_constants.h" -#import "ios/chrome/browser/tabs/legacy_tab_helper.h" -#include "ios/chrome/browser/tabs/tab.h" -#import "ios/chrome/browser/tabs/tab_private.h" -#include "ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h" -#import "ios/web/public/navigation_manager.h" -#import "ios/web/public/web_state/web_state.h" -#import "ios/web/web_state/ui/crw_web_controller.h" - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -namespace { -const size_t kMaxURLDisplayChars = 32 * 1024; - -bookmarks::BookmarkModel* GetBookmarkModelForWebState( - web::WebState* web_state) { - if (!web_state) - return nullptr; - web::BrowserState* browser_state = web_state->GetBrowserState(); - if (!browser_state) - return nullptr; - return ios::BookmarkModelFactory::GetForBrowserState( - ios::ChromeBrowserState::FromBrowserState(browser_state)); -} -} // namespace - -ToolbarModelImplIOS::ToolbarModelImplIOS(ToolbarModelDelegateIOS* delegate) { - delegate_ = delegate; - toolbar_model_.reset(new ToolbarModelImpl(delegate, kMaxURLDisplayChars)); -} - -ToolbarModelImplIOS::~ToolbarModelImplIOS() {} - -ToolbarModel* ToolbarModelImplIOS::GetToolbarModel() { - return toolbar_model_.get(); -} - -bool ToolbarModelImplIOS::IsLoading() { - // Please note, ToolbarModel's notion of isLoading is slightly different from - // WebState's IsLoading(). - web::WebState* web_state = delegate_->GetActiveWebState(); - return web_state && web_state->IsLoading() && !IsCurrentTabNativePage(); -} - -CGFloat ToolbarModelImplIOS::GetLoadProgressFraction() { - web::WebState* webState = delegate_->GetActiveWebState(); - return webState ? webState->GetLoadingProgress() : 0.0; -} - -bool ToolbarModelImplIOS::CanGoBack() { - if (!delegate_) - return false; - web::WebState* web_state = delegate_->GetActiveWebState(); - return web_state && web_state->GetNavigationManager()->CanGoBack(); -} - -bool ToolbarModelImplIOS::CanGoForward() { - if (!delegate_) - return false; - web::WebState* web_state = delegate_->GetActiveWebState(); - return web_state && web_state->GetNavigationManager()->CanGoForward(); -} - -bool ToolbarModelImplIOS::IsCurrentTabNativePage() { - web::WebState* web_state = delegate_->GetActiveWebState(); - return web_state && - web_state->GetLastCommittedURL().SchemeIs(kChromeUIScheme); -} - -bool ToolbarModelImplIOS::IsCurrentTabBookmarked() { - web::WebState* web_state = delegate_->GetActiveWebState(); - bookmarks::BookmarkModel* bookmarkModel = - GetBookmarkModelForWebState(web_state); - return web_state && bookmarkModel && - bookmarkModel->IsBookmarked(web_state->GetLastCommittedURL()); -} - -bool ToolbarModelImplIOS::IsCurrentTabBookmarkedByUser() { - web::WebState* web_state = delegate_->GetActiveWebState(); - bookmarks::BookmarkModel* bookmarkModel = - GetBookmarkModelForWebState(web_state); - return web_state && bookmarkModel && - bookmarkModel->GetMostRecentlyAddedUserNodeForURL( - web_state->GetLastCommittedURL()); -} - -bool ToolbarModelImplIOS::ShouldDisplayHintText() { - web::WebState* web_state = delegate_->GetActiveWebState(); - if (!web_state) - return false; - - Tab* tab = LegacyTabHelper::GetTabForWebState(web_state); - return tab && [tab.webController wantsLocationBarHintText]; -}
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios_unittest.mm b/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios_unittest.mm deleted file mode 100644 index 2223947..0000000 --- a/ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios_unittest.mm +++ /dev/null
@@ -1,172 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import <Foundation/Foundation.h> - -#include <memory> - -#include "base/message_loop/message_loop.h" -#include "base/strings/utf_string_conversions.h" -#include "components/bookmarks/browser/bookmark_model.h" -#include "components/bookmarks/test/bookmark_test_helpers.h" -#include "components/toolbar/test_toolbar_model.h" -#include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" -#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" -#import "ios/chrome/browser/ui/toolbar/test/toolbar_test_navigation_manager.h" -#import "ios/chrome/browser/ui/toolbar/test/toolbar_test_web_state.h" -#include "ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h" -#include "ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.h" -#include "ios/chrome/browser/web_state_list/fake_web_state_list_delegate.h" -#include "ios/chrome/browser/web_state_list/web_state_list.h" -#import "ios/chrome/browser/web_state_list/web_state_opener.h" -#import "ios/testing/ocmock_complex_type_helper.h" -#import "ios/web/public/test/fakes/test_navigation_manager.h" -#import "ios/web/public/test/fakes/test_web_state.h" -#include "ios/web/public/test/test_web_thread.h" -#include "ios/web/public/test/test_web_thread_bundle.h" -#include "testing/gtest_mac.h" -#include "testing/platform_test.h" -#include "third_party/ocmock/gtest_support.h" -#include "third_party/ocmock/ocmock_extensions.h" - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -namespace { - -static const char kWebUrl[] = "http://www.chromium.org"; -static const char kNativeUrl[] = "chrome://version"; - -class ToolbarModelImplIOSTest : public PlatformTest { - protected: - void SetUp() override { - PlatformTest::SetUp(); - TestChromeBrowserState::Builder test_cbs_builder; - chrome_browser_state_ = test_cbs_builder.Build(); - chrome_browser_state_->CreateBookmarkModel(true); - bookmarks::test::WaitForBookmarkModelToLoad( - ios::BookmarkModelFactory::GetForBrowserState( - chrome_browser_state_.get())); - - // Create a WebStateList that will always return the test WebState as - // the active WebState. - web_state_list_ = std::make_unique<WebStateList>(&web_state_list_delegate_); - std::unique_ptr<ToolbarTestWebState> web_state = - std::make_unique<ToolbarTestWebState>(); - web_state->SetBrowserState(chrome_browser_state_.get()); - web_state_ = web_state.get(); - web_state_list_->InsertWebState( - 0, std::move(web_state), - WebStateList::INSERT_FORCE_INDEX | WebStateList::INSERT_ACTIVATE, - WebStateOpener()); - - toolbarModelDelegate_.reset( - new ToolbarModelDelegateIOS(web_state_list_.get())); - toolbarModel_.reset(new ToolbarModelImplIOS(toolbarModelDelegate_.get())); - } - - web::TestWebThreadBundle thread_bundle_; - std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; - FakeWebStateListDelegate web_state_list_delegate_; - std::unique_ptr<WebStateList> web_state_list_; - ToolbarTestWebState* web_state_; - std::unique_ptr<ToolbarModelDelegateIOS> toolbarModelDelegate_; - std::unique_ptr<ToolbarModelIOS> toolbarModel_; -}; - -TEST_F(ToolbarModelImplIOSTest, TestWhenCurrentWebStateIsNull) { - // The test fixture adds one WebState to the WebStateList, so remove it before - // running this test. - ASSERT_EQ(1, web_state_list_->count()); - std::unique_ptr<web::WebState> closed_web_state( - web_state_list_->DetachWebStateAt(0)); - ASSERT_TRUE(web_state_list_->empty()); - - EXPECT_FALSE(toolbarModel_->IsLoading()); - EXPECT_EQ(0, toolbarModel_->GetLoadProgressFraction()); - EXPECT_FALSE(toolbarModel_->CanGoBack()); - EXPECT_FALSE(toolbarModel_->CanGoForward()); - EXPECT_FALSE(toolbarModel_->IsCurrentTabNativePage()); - EXPECT_FALSE(toolbarModel_->IsCurrentTabBookmarked()); -} - -TEST_F(ToolbarModelImplIOSTest, TestIsLoading) { - // An active webstate that is loading. - web_state_->SetLoading(true); - EXPECT_TRUE(toolbarModel_->IsLoading()); - - // An active webstate that is not loading. - web_state_->SetLoading(false); - EXPECT_FALSE(toolbarModel_->IsLoading()); - - // An active webstate that is pointing at a native URL. - web_state_->SetLoading(true); - web_state_->SetCurrentURL(GURL(kNativeUrl)); - EXPECT_FALSE(toolbarModel_->IsLoading()); -} - -TEST_F(ToolbarModelImplIOSTest, TestGetLoadProgressFraction) { - const CGFloat kExpectedProgress = 0.42; - web_state_->set_loading_progress(kExpectedProgress); - EXPECT_FLOAT_EQ(kExpectedProgress, toolbarModel_->GetLoadProgressFraction()); -} - -TEST_F(ToolbarModelImplIOSTest, TestCanGoBack) { - web_state_->SetNavigationManager( - std::make_unique<ToolbarTestNavigationManager>()); - ToolbarTestNavigationManager* manager = - static_cast<ToolbarTestNavigationManager*>( - web_state_->GetNavigationManager()); - - manager->set_can_go_back(true); - EXPECT_TRUE(toolbarModel_->CanGoBack()); - - manager->set_can_go_back(false); - EXPECT_FALSE(toolbarModel_->CanGoBack()); -} - -TEST_F(ToolbarModelImplIOSTest, TestCanGoForward) { - web_state_->SetNavigationManager( - std::make_unique<ToolbarTestNavigationManager>()); - ToolbarTestNavigationManager* manager = - static_cast<ToolbarTestNavigationManager*>( - web_state_->GetNavigationManager()); - - manager->set_can_go_forward(true); - EXPECT_TRUE(toolbarModel_->CanGoForward()); - - manager->set_can_go_forward(false); - EXPECT_FALSE(toolbarModel_->CanGoForward()); -} - -TEST_F(ToolbarModelImplIOSTest, TestIsCurrentTabNativePage) { - web_state_->SetCurrentURL(GURL(kNativeUrl)); - EXPECT_TRUE(toolbarModel_->IsCurrentTabNativePage()); - - web_state_->SetCurrentURL(GURL(kWebUrl)); - EXPECT_FALSE(toolbarModel_->IsCurrentTabNativePage()); -} - -TEST_F(ToolbarModelImplIOSTest, TestIsCurrentTabBookmarked) { - // Set the curent tab to |kWebUrl| and create a bookmark for |kWebUrl|, then - // verify that the toolbar model indicates that the URL is bookmarked. - web_state_->SetCurrentURL(GURL(kWebUrl)); - bookmarks::BookmarkModel* bookmark_model = - ios::BookmarkModelFactory::GetForBrowserState( - chrome_browser_state_.get()); - const bookmarks::BookmarkNode* bookmarks = - bookmark_model->bookmark_bar_node(); - const bookmarks::BookmarkNode* node = - bookmark_model->AddURL(bookmarks, bookmarks->child_count(), - base::UTF8ToUTF16(kWebUrl), GURL(kWebUrl)); - EXPECT_TRUE(toolbarModel_->IsCurrentTabBookmarked()); - - // Remove the bookmark and verify the toolbar model indicates that the URL is - // not bookmarked. - bookmark_model->Remove(node); - EXPECT_FALSE(toolbarModel_->IsCurrentTabBookmarked()); -} - -} // namespace
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_model_ios.h b/ios/chrome/browser/ui/toolbar/toolbar_model_ios.h deleted file mode 100644 index 9c98fbe..0000000 --- a/ios/chrome/browser/ui/toolbar/toolbar_model_ios.h +++ /dev/null
@@ -1,52 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IOS_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IOS_H_ - -#import <UIKit/UIKit.h> - -#include "components/toolbar/toolbar_model.h" - -// This class adds some IOS specific methods to the ToolbarModel. -// It does not inherit from ToolbarModel on purpose. -class ToolbarModelIOS { - public: - virtual ~ToolbarModelIOS() {} - - // Returns the |ToolbarModel| contained by this instance. - virtual ToolbarModel* GetToolbarModel() = 0; - - // Returns true if the current tab is currently loading. - virtual bool IsLoading() = 0; - - // Returns the fraction of the current tab's page load that has completed as a - // number between 0.0 and 1.0. - virtual CGFloat GetLoadProgressFraction() = 0; - - // Returns true if the current tab can go back in history. - virtual bool CanGoBack() = 0; - - // Returns true if the current tab can go forward in history. - virtual bool CanGoForward() = 0; - - // Returns true if the current tab is a native page. - virtual bool IsCurrentTabNativePage() = 0; - - // Returns true if the current tab's URL is bookmarked, either by the user or - // by a managed bookmarks. - virtual bool IsCurrentTabBookmarked() = 0; - - // Returns true if the current tab's URL is bookmarked by the user; returns - // false if the URL is bookmarked only in managed bookmarks. - virtual bool IsCurrentTabBookmarkedByUser() = 0; - - // Returns true if the current toolbar should display the hint text. - virtual bool ShouldDisplayHintText() = 0; - - protected: - ToolbarModelIOS() {} -}; - -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IOS_H_
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_view_delegate.h b/ios/chrome/browser/ui/toolbar/toolbar_view_delegate.h deleted file mode 100644 index e7e85d2..0000000 --- a/ios/chrome/browser/ui/toolbar/toolbar_view_delegate.h +++ /dev/null
@@ -1,26 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_VIEW_DELEGATE_H_ -#define IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_VIEW_DELEGATE_H_ - -#import <Foundation/Foundation.h> - -// A delegate protocol to pass UIView information about the toolbar. -// TODO(crbug.com/683793): Remove this protocol when toolbars are presented via -// UIViewControllers, as this can already be accomplished through that API. -@protocol ToolbarViewDelegate<NSObject> - -// Called when the toolbar view performs a layout pass. -- (void)toolbarDidLayout; - -// Called when the toolbar view is transferred to a new parent window. -- (void)windowDidChange; - -// Called when the toolbar view's trait collection changes. -- (void)traitCollectionDidChange; - -@end - -#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_VIEW_DELEGATE_H_
diff --git a/ios/chrome/browser/ui/ui_util.h b/ios/chrome/browser/ui/ui_util.h index dc2dd9a..78f957e 100644 --- a/ios/chrome/browser/ui/ui_util.h +++ b/ios/chrome/browser/ui/ui_util.h
@@ -48,10 +48,6 @@ // Returns the height of the status bar, accounting for orientation. CGFloat StatusBarHeight(); -// Returns whether the toolbar is split between top and bottom toolbar or if it -// is displayed as only one toolbar. -bool IsSplitToolbarMode(); - // Returns the closest pixel-aligned value less than |value|, taking the scale // factor into account. At a scale of 1, equivalent to floor(). CGFloat AlignValueToPixel(CGFloat value);
diff --git a/ios/chrome/browser/ui/ui_util.mm b/ios/chrome/browser/ui/ui_util.mm index 2b6ce22..5f0432f 100644 --- a/ios/chrome/browser/ui/ui_util.mm +++ b/ios/chrome/browser/ui/ui_util.mm
@@ -89,10 +89,6 @@ return isCompactHeight ? 0 : 20; } -bool IsSplitToolbarMode() { - return IsCompactWidth() && !IsCompactHeight(); -} - CGFloat AlignValueToPixel(CGFloat value) { static CGFloat scale = [[UIScreen mainScreen] scale]; return floor(value * scale) / scale;
diff --git a/ios/chrome/browser/ui/uikit_ui_util.h b/ios/chrome/browser/ui/uikit_ui_util.h index 0f653c12..2b08768 100644 --- a/ios/chrome/browser/ui/uikit_ui_util.h +++ b/ios/chrome/browser/ui/uikit_ui_util.h
@@ -202,6 +202,17 @@ // vertical size class. bool IsCompactHeight(); +// Whether the |environment| has a compact vertical size class. +bool IsCompactHeight(id<UITraitEnvironment> environment); + +// Returns whether the toolbar is split between top and bottom toolbar or if it +// is displayed as only one toolbar. +bool IsSplitToolbarMode(); + +// Returns whether the |environment|'s toolbar is split between top and bottom +// toolbar or if it is displayed as only one toolbar. +bool IsSplitToolbarMode(id<UITraitEnvironment> environment); + // Returns the current first responder. UIResponder* GetFirstResponder();
diff --git a/ios/chrome/browser/ui/uikit_ui_util.mm b/ios/chrome/browser/ui/uikit_ui_util.mm index 4b440350..8f90bea 100644 --- a/ios/chrome/browser/ui/uikit_ui_util.mm +++ b/ios/chrome/browser/ui/uikit_ui_util.mm
@@ -546,11 +546,22 @@ } bool IsCompactHeight() { - return [UIApplication sharedApplication] - .keyWindow.traitCollection.verticalSizeClass == + return IsCompactHeight([UIApplication sharedApplication].keyWindow); +} + +bool IsCompactHeight(id<UITraitEnvironment> environment) { + return environment.traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact; } +bool IsSplitToolbarMode() { + return IsCompactWidth() && !IsCompactHeight(); +} + +bool IsSplitToolbarMode(id<UITraitEnvironment> environment) { + return IsCompactWidth(environment) && !IsCompactHeight(environment); +} + // Returns the current first responder. UIResponder* GetFirstResponder() { DCHECK_CURRENTLY_ON(web::WebThread::UI);
diff --git a/ios/chrome/test/BUILD.gn b/ios/chrome/test/BUILD.gn index edbcddb..5532bac 100644 --- a/ios/chrome/test/BUILD.gn +++ b/ios/chrome/test/BUILD.gn
@@ -227,6 +227,7 @@ "//ios/chrome/browser/ui/tabs:unit_tests", "//ios/chrome/browser/ui/toolbar:unit_tests", "//ios/chrome/browser/ui/toolbar/clean:unit_tests", + "//ios/chrome/browser/ui/toolbar/legacy:unit_tests", "//ios/chrome/browser/ui/tools_menu:unit_tests", "//ios/chrome/browser/ui/util:unit_tests", "//ios/chrome/browser/ui/voice:unit_tests",
diff --git a/ios/web_view/internal/autofill/cwv_autofill_controller.mm b/ios/web_view/internal/autofill/cwv_autofill_controller.mm index 7e3d590..32e9b09 100644 --- a/ios/web_view/internal/autofill/cwv_autofill_controller.mm +++ b/ios/web_view/internal/autofill/cwv_autofill_controller.mm
@@ -26,6 +26,7 @@ #import "ios/web_view/internal/autofill/cwv_autofill_suggestion_internal.h" #import "ios/web_view/internal/autofill/web_view_autofill_client_ios.h" #include "ios/web_view/internal/autofill/web_view_personal_data_manager_factory.h" +#include "ios/web_view/internal/signin/web_view_identity_manager_factory.h" #include "ios/web_view/internal/signin/web_view_oauth2_token_service_factory.h" #include "ios/web_view/internal/signin/web_view_signin_manager_factory.h" #include "ios/web_view/internal/web_view_browser_state.h" @@ -92,7 +93,10 @@ browserState->GetPrefs(), ios_web_view::WebViewPersonalDataManagerFactory::GetForBrowserState( browserState), - _webState, self, std::move(identityProvider), + _webState, self, + ios_web_view::WebViewIdentityManagerFactory::GetInstance() + ->GetForBrowserState(browserState), + std::move(identityProvider), ios_web_view::WebViewWebDataServiceWrapperFactory:: GetAutofillWebDataForBrowserState( browserState, ServiceAccessType::EXPLICIT_ACCESS)));
diff --git a/ios/web_view/internal/autofill/web_view_autofill_client_ios.h b/ios/web_view/internal/autofill/web_view_autofill_client_ios.h index b6e341ee..2675196d 100644 --- a/ios/web_view/internal/autofill/web_view_autofill_client_ios.h +++ b/ios/web_view/internal/autofill/web_view_autofill_client_ios.h
@@ -31,6 +31,7 @@ PersonalDataManager* personal_data_manager, web::WebState* web_state, id<AutofillClientIOSBridge> bridge, + identity::IdentityManager* identity_manager, std::unique_ptr<IdentityProvider> identity_provider, scoped_refptr<AutofillWebDataService> autofill_web_data_service); ~WebViewAutofillClientIOS() override; @@ -39,6 +40,7 @@ PersonalDataManager* GetPersonalDataManager() override; PrefService* GetPrefs() override; syncer::SyncService* GetSyncService() override; + identity::IdentityManager* GetIdentityManager() override; IdentityProvider* GetIdentityProvider() override; ukm::UkmRecorder* GetUkmRecorder() override; AddressNormalizer* GetAddressNormalizer() override; @@ -88,6 +90,7 @@ PersonalDataManager* personal_data_manager_; web::WebState* web_state_; __weak id<AutofillClientIOSBridge> bridge_; + identity::IdentityManager* identity_manager_; std::unique_ptr<IdentityProvider> identity_provider_; scoped_refptr<AutofillWebDataService> autofill_web_data_service_;
diff --git a/ios/web_view/internal/autofill/web_view_autofill_client_ios.mm b/ios/web_view/internal/autofill/web_view_autofill_client_ios.mm index fc3ac81d..136923d 100644 --- a/ios/web_view/internal/autofill/web_view_autofill_client_ios.mm +++ b/ios/web_view/internal/autofill/web_view_autofill_client_ios.mm
@@ -22,12 +22,14 @@ PersonalDataManager* personal_data_manager, web::WebState* web_state, id<AutofillClientIOSBridge> bridge, + identity::IdentityManager* identity_manager, std::unique_ptr<IdentityProvider> identity_provider, scoped_refptr<AutofillWebDataService> autofill_web_data_service) : pref_service_(pref_service), personal_data_manager_(personal_data_manager), web_state_(web_state), bridge_(bridge), + identity_manager_(identity_manager), identity_provider_(std::move(identity_provider)), autofill_web_data_service_(autofill_web_data_service) {} @@ -48,6 +50,10 @@ return nullptr; } +identity::IdentityManager* WebViewAutofillClientIOS::GetIdentityManager() { + return identity_manager_; +} + IdentityProvider* WebViewAutofillClientIOS::GetIdentityProvider() { return identity_provider_.get(); }
diff --git a/media/audio/audio_logging.h b/media/audio/audio_logging.h index 6bfd9041..117e42b 100644 --- a/media/audio/audio_logging.h +++ b/media/audio/audio_logging.h
@@ -13,9 +13,7 @@ class AudioParameters; -// AudioLog logs state information about an active audio component. Each method -// takes a |component_id| along with method specific information. Its methods -// are safe to call from any thread. +// AudioLog logs state information about an active audio component. class AudioLog { public: virtual ~AudioLog() {} @@ -23,47 +21,33 @@ // Called when an audio component is created. |params| are the parameters of // the created stream. |device_id| is the id of the audio device opened by // the created stream. - virtual void OnCreated(int component_id, - const media::AudioParameters& params, + virtual void OnCreated(const media::AudioParameters& params, const std::string& device_id) = 0; // Called when an audio component is started, generally this is synonymous // with "playing." - virtual void OnStarted(int component_id) = 0; + virtual void OnStarted() = 0; // Called when an audio component is stopped, generally this is synonymous // with "paused." - virtual void OnStopped(int component_id) = 0; + virtual void OnStopped() = 0; // Called when an audio component is closed, generally this is synonymous // with "deleted." - virtual void OnClosed(int component_id) = 0; + virtual void OnClosed() = 0; // Called when an audio component encounters an error. - virtual void OnError(int component_id) = 0; + virtual void OnError() = 0; // Called when an audio component changes volume. |volume| is the new volume. - virtual void OnSetVolume(int component_id, double volume) = 0; - - // Called when an audio component switches output device. |device_id| is the - // new audio output device. - virtual void OnSwitchOutputDevice(int component_id, - const std::string& device_id) = 0; + virtual void OnSetVolume(double volume) = 0; // Called when an audio component wants to forward a log message. - virtual void OnLogMessage(int component_id, const std::string& message) = 0; + virtual void OnLogMessage(const std::string& message) = 0; }; -// AudioLogFactory dispenses AudioLog instances to owning classes for tracking -// AudioComponent behavior. All AudioComponents have the concept of an owning -// class: -// -// - AudioInputRendererHost for AudioInputController -// - AudioRendererHost for AudioOutputController -// - AudioOutputDispatcherImpl for AudioOutputStream -// -// Each of these owning classes may own multiple instances of each component, as -// such each AudioLog supports logging for multiple instances. +// AudioLogFactory dispenses AudioLog instances for tracking AudioComponent +// behavior. class AudioLogFactory { public: enum AudioComponent { @@ -77,11 +61,11 @@ AUDIO_COMPONENT_MAX }; - // Create a new AudioLog object for tracking the behavior for one or more - // instances of the given component. Each instance of an "owning" class must - // create its own AudioLog. - virtual std::unique_ptr<AudioLog> CreateAudioLog( - AudioComponent component) = 0; + // Create a new AudioLog object for tracking the behavior for one instance of + // the given component. Each instance of an "owning" class must create its + // own AudioLog. + virtual std::unique_ptr<AudioLog> CreateAudioLog(AudioComponent component, + int component_id) = 0; protected: virtual ~AudioLogFactory() {}
diff --git a/media/audio/audio_manager.h b/media/audio/audio_manager.h index 6bcc2f5..9b419ea5 100644 --- a/media/audio/audio_manager.h +++ b/media/audio/audio_manager.h
@@ -171,7 +171,8 @@ // Create a new AudioLog object for tracking the behavior for one or more // instances of the given component. See AudioLogFactory for more details. virtual std::unique_ptr<AudioLog> CreateAudioLog( - AudioLogFactory::AudioComponent component) = 0; + AudioLogFactory::AudioComponent component, + int component_id) = 0; // Get debug recording manager. This can only be called on AudioManager's // thread (GetTaskRunner()).
diff --git a/media/audio/audio_manager_base.cc b/media/audio/audio_manager_base.cc index 450a31a..e8dd29e 100644 --- a/media/audio/audio_manager_base.cc +++ b/media/audio/audio_manager_base.cc
@@ -555,8 +555,9 @@ } std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog( - AudioLogFactory::AudioComponent component) { - return audio_log_factory_->CreateAudioLog(component); + AudioLogFactory::AudioComponent component, + int component_id) { + return audio_log_factory_->CreateAudioLog(component, component_id); } void AudioManagerBase::InitializeDebugRecording() {
diff --git a/media/audio/audio_manager_base.h b/media/audio/audio_manager_base.h index dcb27ec..e8568d9 100644 --- a/media/audio/audio_manager_base.h +++ b/media/audio/audio_manager_base.h
@@ -52,7 +52,8 @@ void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override; std::unique_ptr<AudioLog> CreateAudioLog( - AudioLogFactory::AudioComponent component) override; + AudioLogFactory::AudioComponent component, + int component_id) override; void SetMaxStreamCountForTesting(int max_input, int max_output) final;
diff --git a/media/audio/audio_output_dispatcher_impl.cc b/media/audio/audio_output_dispatcher_impl.cc index 1ed7374..c955993 100644 --- a/media/audio/audio_output_dispatcher_impl.cc +++ b/media/audio/audio_output_dispatcher_impl.cc
@@ -5,10 +5,12 @@ #include "media/audio/audio_output_dispatcher_impl.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/compiler_specific.h" #include "base/single_thread_task_runner.h" +#include "base/stl_util.h" #include "base/time/time.h" #include "media/audio/audio_logging.h" #include "media/audio/audio_manager.h" @@ -29,8 +31,6 @@ close_delay, this, &AudioOutputDispatcherImpl::CloseAllIdleStreams), - audio_log_( - audio_manager->CreateAudioLog(AudioLogFactory::AUDIO_OUTPUT_STREAM)), audio_stream_id_(0), weak_factory_(this) { DCHECK(audio_manager->GetTaskRunner()->BelongsToCurrentThread()); @@ -88,10 +88,11 @@ double volume = 0; stream_proxy->GetVolume(&volume); physical_stream->SetVolume(volume); - const int stream_id = audio_stream_ids_[physical_stream]; - audio_log_->OnSetVolume(stream_id, volume); + DCHECK(base::ContainsKey(audio_logs_, physical_stream)); + AudioLog* const audio_log = audio_logs_[physical_stream].get(); + audio_log->OnSetVolume(volume); physical_stream->Start(callback); - audio_log_->OnStarted(stream_id); + audio_log->OnStarted(); proxy_to_physical_map_[stream_proxy] = physical_stream; close_timer_.Reset(); @@ -114,7 +115,8 @@ if (it != proxy_to_physical_map_.end()) { AudioOutputStream* physical_stream = it->second; physical_stream->SetVolume(volume); - audio_log_->OnSetVolume(audio_stream_ids_[physical_stream], volume); + DCHECK(base::ContainsKey(audio_logs_, physical_stream)); + audio_logs_[physical_stream]->OnSetVolume(volume); } } @@ -137,10 +139,12 @@ bool AudioOutputDispatcherImpl::CreateAndOpenStream() { DCHECK(audio_manager()->GetTaskRunner()->BelongsToCurrentThread()); const int stream_id = audio_stream_id_++; + std::unique_ptr<AudioLog> audio_log = audio_manager()->CreateAudioLog( + AudioLogFactory::AUDIO_OUTPUT_STREAM, stream_id); AudioOutputStream* stream = audio_manager()->MakeAudioOutputStream( params_, device_id_, - base::Bind(&AudioLog::OnLogMessage, base::Unretained(audio_log_.get()), - stream_id)); + base::BindRepeating(&AudioLog::OnLogMessage, + base::Unretained(audio_log.get()))); if (!stream) return false; @@ -149,9 +153,8 @@ return false; } - audio_stream_ids_[stream] = stream_id; - audio_log_->OnCreated( - stream_id, params_, device_id_); + audio_log->OnCreated(params_, device_id_); + audio_logs_[stream] = std::move(audio_log); idle_streams_.push_back(stream); return true; @@ -170,10 +173,10 @@ AudioOutputStream* stream = idle_streams_[i]; stream->Close(); - AudioStreamIDMap::iterator it = audio_stream_ids_.find(stream); - DCHECK(it != audio_stream_ids_.end()); - audio_log_->OnClosed(it->second); - audio_stream_ids_.erase(it); + auto it = audio_logs_.find(stream); + DCHECK(it != audio_logs_.end()); + it->second->OnClosed(); + audio_logs_.erase(it); } idle_streams_.erase(idle_streams_.begin() + keep_alive, idle_streams_.end()); } @@ -181,7 +184,8 @@ void AudioOutputDispatcherImpl::StopPhysicalStream(AudioOutputStream* stream) { DCHECK(audio_manager()->GetTaskRunner()->BelongsToCurrentThread()); stream->Stop(); - audio_log_->OnStopped(audio_stream_ids_[stream]); + DCHECK(base::ContainsKey(audio_logs_, stream)); + audio_logs_[stream]->OnStopped(); idle_streams_.push_back(stream); close_timer_.Reset(); }
diff --git a/media/audio/audio_output_dispatcher_impl.h b/media/audio/audio_output_dispatcher_impl.h index 4702221..dcea811 100644 --- a/media/audio/audio_output_dispatcher_impl.h +++ b/media/audio/audio_output_dispatcher_impl.h
@@ -82,9 +82,9 @@ typedef base::flat_map<AudioOutputProxy*, AudioOutputStream*> AudioStreamMap; AudioStreamMap proxy_to_physical_map_; - std::unique_ptr<AudioLog> audio_log_; - typedef base::flat_map<AudioOutputStream*, int> AudioStreamIDMap; - AudioStreamIDMap audio_stream_ids_; + using AudioLogMap = + base::flat_map<AudioOutputStream*, std::unique_ptr<media::AudioLog>>; + AudioLogMap audio_logs_; int audio_stream_id_; base::WeakPtrFactory<AudioOutputDispatcherImpl> weak_factory_;
diff --git a/media/audio/fake_audio_log_factory.cc b/media/audio/fake_audio_log_factory.cc index d097a80..54f0648d 100644 --- a/media/audio/fake_audio_log_factory.cc +++ b/media/audio/fake_audio_log_factory.cc
@@ -4,7 +4,6 @@ #include "media/audio/fake_audio_log_factory.h" -#include <memory> #include <string> namespace media { @@ -13,24 +12,22 @@ public: FakeAudioLogImpl() = default; ~FakeAudioLogImpl() override = default; - void OnCreated(int component_id, - const media::AudioParameters& params, + void OnCreated(const media::AudioParameters& params, const std::string& device_id) override {} - void OnStarted(int component_id) override {} - void OnStopped(int component_id) override {} - void OnClosed(int component_id) override {} - void OnError(int component_id) override {} - void OnSetVolume(int component_id, double volume) override {} - void OnSwitchOutputDevice(int component_id, - const std::string& device_id) override {} - void OnLogMessage(int component_id, const std::string& message) override {} + void OnStarted() override {} + void OnStopped() override {} + void OnClosed() override {} + void OnError() override {} + void OnSetVolume(double volume) override {} + void OnLogMessage(const std::string& message) override {} }; FakeAudioLogFactory::FakeAudioLogFactory() = default; FakeAudioLogFactory::~FakeAudioLogFactory() = default; std::unique_ptr<AudioLog> FakeAudioLogFactory::CreateAudioLog( - AudioComponent component) { + AudioComponent component, + int component_id) { return std::make_unique<FakeAudioLogImpl>(); }
diff --git a/media/audio/fake_audio_log_factory.h b/media/audio/fake_audio_log_factory.h index 2a6d62a9..7c8cfd8 100644 --- a/media/audio/fake_audio_log_factory.h +++ b/media/audio/fake_audio_log_factory.h
@@ -5,6 +5,8 @@ #ifndef MEDIA_AUDIO_FAKE_AUDIO_LOG_FACTORY_H_ #define MEDIA_AUDIO_FAKE_AUDIO_LOG_FACTORY_H_ +#include <memory> + #include "base/compiler_specific.h" #include "base/macros.h" #include "media/audio/audio_logging.h" @@ -17,7 +19,8 @@ public: FakeAudioLogFactory(); ~FakeAudioLogFactory() override; - std::unique_ptr<AudioLog> CreateAudioLog(AudioComponent component) override; + std::unique_ptr<AudioLog> CreateAudioLog(AudioComponent component, + int component_id) override; private: DISALLOW_COPY_AND_ASSIGN(FakeAudioLogFactory);
diff --git a/media/audio/mock_audio_manager.cc b/media/audio/mock_audio_manager.cc index f2ea15d4..9f0686f 100644 --- a/media/audio/mock_audio_manager.cc +++ b/media/audio/mock_audio_manager.cc
@@ -121,7 +121,8 @@ } std::unique_ptr<AudioLog> MockAudioManager::CreateAudioLog( - AudioLogFactory::AudioComponent component) { + AudioLogFactory::AudioComponent component, + int component_id) { return nullptr; }
diff --git a/media/audio/mock_audio_manager.h b/media/audio/mock_audio_manager.h index 8f6bcf5c..dd8cce8a 100644 --- a/media/audio/mock_audio_manager.h +++ b/media/audio/mock_audio_manager.h
@@ -56,7 +56,8 @@ void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override; std::unique_ptr<AudioLog> CreateAudioLog( - AudioLogFactory::AudioComponent component) override; + AudioLogFactory::AudioComponent component, + int component_id) override; void InitializeDebugRecording() override; AudioDebugRecordingManager* GetAudioDebugRecordingManager() override;
diff --git a/media/mojo/interfaces/BUILD.gn b/media/mojo/interfaces/BUILD.gn index cb5f225f..952e5bbb 100644 --- a/media/mojo/interfaces/BUILD.gn +++ b/media/mojo/interfaces/BUILD.gn
@@ -11,6 +11,7 @@ sources = [ "audio_decoder.mojom", "audio_input_stream.mojom", + "audio_logging.mojom", "audio_output_stream.mojom", "audio_parameters.mojom", "cdm_proxy.mojom",
diff --git a/media/mojo/interfaces/audio_logging.mojom b/media/mojo/interfaces/audio_logging.mojom new file mode 100644 index 0000000..36027ed --- /dev/null +++ b/media/mojo/interfaces/audio_logging.mojom
@@ -0,0 +1,38 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module media.mojom; + +import "media/mojo/interfaces/audio_parameters.mojom"; + +// This interface is implemented by the browser process to log state information +// about an active audio component. +interface AudioLog { + // Called when an audio component is created. |params| are the parameters of + // the created stream. |device_id| is the id of the audio device opened by + // the created stream. + OnCreated(media.mojom.AudioParameters params, + string device_id); + + // Called when an audio component is started, generally this is synonymous + // with "playing." + OnStarted(); + + // Called when an audio component is stopped, generally this is synonymous + // with "paused." + OnStopped(); + + // Called when an audio component is closed, generally this is synonymous + // with "deleted." + OnClosed(); + + // Called when an audio component encounters an error. + OnError(); + + // Called when an audio component changes volume. |volume| is the new volume. + OnSetVolume(double volume); + + // Called when an audio component wants to forward a log message. + OnLogMessage(string message); +};
diff --git a/net/spdy/core/spdy_protocol.h b/net/spdy/core/spdy_protocol.h index 7bf99ee7..053db395 100644 --- a/net/spdy/core/spdy_protocol.h +++ b/net/spdy/core/spdy_protocol.h
@@ -118,7 +118,6 @@ enum SpdyControlFlags { CONTROL_FLAG_NONE = 0x00, CONTROL_FLAG_FIN = 0x01, - CONTROL_FLAG_UNIDIRECTIONAL = 0x02, }; enum SpdyPingFlags {
diff --git a/notification_helper/com_server_module.cc b/notification_helper/com_server_module.cc index e6783db..8585715 100644 --- a/notification_helper/com_server_module.cc +++ b/notification_helper/com_server_module.cc
@@ -22,8 +22,8 @@ // The reset policy of the event MUST BE set to MANUAL to avoid signaling the // event in IsSignaled() itself, which is called by IsEventSignaled(). ComServerModule::ComServerModule() - : com_object_released_(base::WaitableEvent::ResetPolicy::MANUAL, - base::WaitableEvent::InitialState::NOT_SIGNALED) {} + : object_zero_count_(base::WaitableEvent::ResetPolicy::MANUAL, + base::WaitableEvent::InitialState::NOT_SIGNALED) {} ComServerModule::~ComServerModule() = default; @@ -41,7 +41,7 @@ // method is invoked when the last instance object of the module is released. auto& module = Microsoft::WRL::Module<Microsoft::WRL::OutOfProcDisableCaching>::Create( - this, &ComServerModule::SignalObjectReleaseEvent); + this, &ComServerModule::SignalObjectCountZero); // Usually COM module classes statically define their CLSID at compile time // through the use of various macros, and WRL::Module internals takes care of @@ -99,15 +99,15 @@ } bool ComServerModule::IsEventSignaled() { - return com_object_released_.IsSignaled(); + return object_zero_count_.IsSignaled(); } void ComServerModule::WaitForZeroObjectCount() { - com_object_released_.Wait(); + object_zero_count_.Wait(); } -void ComServerModule::SignalObjectReleaseEvent() { - com_object_released_.Signal(); +void ComServerModule::SignalObjectCountZero() { + object_zero_count_.Signal(); } } // namespace notification_helper
diff --git a/notification_helper/com_server_module.h b/notification_helper/com_server_module.h index 375575c..216217e 100644 --- a/notification_helper/com_server_module.h +++ b/notification_helper/com_server_module.h
@@ -35,15 +35,15 @@ // Waits for all instance objects are released from the module. void WaitForZeroObjectCount(); - // Signals the COM object release event. - void SignalObjectReleaseEvent(); + // Sends out the signal that all objects are now released from the module. + void SignalObjectCountZero(); // Identifiers of registered class objects. Used for unregistration. DWORD cookies_[1] = {0}; // This event starts "unsignaled", and is signaled when the last instance // object is released from the module. - base::WaitableEvent com_object_released_; + base::WaitableEvent object_zero_count_; DISALLOW_COPY_AND_ASSIGN(ComServerModule); };
diff --git a/notification_helper/notification_activator.h b/notification_helper/notification_activator.h index 9a39c34..77c3d97 100644 --- a/notification_helper/notification_activator.h +++ b/notification_helper/notification_activator.h
@@ -33,6 +33,7 @@ protected: ~NotificationActivator() override; + private: DISALLOW_COPY_AND_ASSIGN(NotificationActivator); };
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc index 2e89dfb..2c61a87 100644 --- a/pdf/pdfium/pdfium_engine.cc +++ b/pdf/pdfium/pdfium_engine.cc
@@ -881,14 +881,7 @@ double left, double top, double right, - double bottom) { - PDFiumEngine* engine = static_cast<PDFiumEngine*>(param); - engine->client_->UpdateCursor(PP_CURSORTYPE_IBEAM); - std::vector<pp::Rect> tickmarks; - pp::Rect rect(left, top, right, bottom); - tickmarks.push_back(rect); - engine->client_->UpdateTickMarks(tickmarks); -} + double bottom) {} void PDFiumEngine::Form_SetCurrentPage(FPDF_FORMFILLINFO* param, FPDF_DOCUMENT document, @@ -2103,6 +2096,19 @@ case FPDF_FORMFIELD_TEXTFIELD: cursor = PP_CURSORTYPE_IBEAM; break; +#if defined(PDF_ENABLE_XFA) + case FPDF_FORMFIELD_XFA_CHECKBOX: + case FPDF_FORMFIELD_XFA_COMBOBOX: + case FPDF_FORMFIELD_XFA_IMAGEFIELD: + case FPDF_FORMFIELD_XFA_LISTBOX: + case FPDF_FORMFIELD_XFA_PUSHBUTTON: + case FPDF_FORMFIELD_XFA_SIGNATURE: + cursor = PP_CURSORTYPE_HAND; + break; + case FPDF_FORMFIELD_XFA_TEXTFIELD: + cursor = PP_CURSORTYPE_IBEAM; + break; +#endif default: cursor = PP_CURSORTYPE_POINTER; break;
diff --git a/printing/printing_context.cc b/printing/printing_context.cc index 9cdde9f..89d86f24 100644 --- a/printing/printing_context.cc +++ b/printing/printing_context.cc
@@ -141,4 +141,16 @@ page_count); } +#if defined(OS_CHROMEOS) +PrintingContext::Result PrintingContext::UpdatePrintSettingsFromPOD( + std::unique_ptr<PrintSettings> job_settings) { + ResetSettings(); + settings_ = *job_settings; + + return UpdatePrinterSettings(false /* external_preview */, + false /* show_system_dialog */, + 0 /* page_count is only used on Android */); +} +#endif + } // namespace printing
diff --git a/printing/printing_context.h b/printing/printing_context.h index 9a08e4c..88593790 100644 --- a/printing/printing_context.h +++ b/printing/printing_context.h
@@ -86,6 +86,12 @@ // settings information. |ranges| has the new page range settings. Result UpdatePrintSettings(const base::DictionaryValue& job_settings); +#if defined(OS_CHROMEOS) + // Updates Print Settings. + Result UpdatePrintSettingsFromPOD( + std::unique_ptr<PrintSettings> job_settings); +#endif + // Does platform specific setup of the printer before the printing. Signal the // printer that a document is about to be spooled. // Warning: This function enters a message loop. That may cause side effects
diff --git a/printing/units.h b/printing/units.h index 0e19d04..8a5774fe8 100644 --- a/printing/units.h +++ b/printing/units.h
@@ -12,6 +12,10 @@ // Length of a thousandth of inches in 0.01mm unit. const int kHundrethsMMPerInch = 2540; +// Mil is a thousandth of an inch. +constexpr float kMicronsPerMil = 25.4f; +constexpr int kMilsPerInch = 1000; + // Length of an inch in CSS's 1pt unit. // http://dev.w3.org/csswg/css3-values/#absolute-length-units-cm-mm.-in-pt-pc const int kPointsPerInch = 72;
diff --git a/services/identity/public/cpp/identity_test_utils.cc b/services/identity/public/cpp/identity_test_utils.cc index 328e3a9..99083cfe 100644 --- a/services/identity/public/cpp/identity_test_utils.cc +++ b/services/identity/public/cpp/identity_test_utils.cc
@@ -69,6 +69,8 @@ ProfileOAuth2TokenService* token_service, IdentityManager* identity_manager, const std::string& email) { + DCHECK(!signin_manager->IsAuthenticated()); + DCHECK(!identity_manager->HasPrimaryAccount()); std::string gaia_id = "gaia_id_for_" + email; std::string refresh_token = "refresh_token_for_" + email;
diff --git a/services/network/public/cpp/BUILD.gn b/services/network/public/cpp/BUILD.gn index 8e1aae8..cf02653 100644 --- a/services/network/public/cpp/BUILD.gn +++ b/services/network/public/cpp/BUILD.gn
@@ -16,6 +16,8 @@ "cors/cors_url_loader.h", "cors/cors_url_loader_factory.cc", "cors/cors_url_loader_factory.h", + "cors/preflight_result.cc", + "cors/preflight_result.h", "features.cc", "features.h", "mutable_network_traffic_annotation_tag_mojom_traits.h", @@ -102,6 +104,7 @@ sources = [ "cors/cors_unittest.cc", + "cors/preflight_result_unittest.cc", "mutable_network_traffic_annotation_tag_mojom_traits_unittest.cc", "mutable_partial_network_traffic_annotation_tag_mojom_traits_unittest.cc", "network_mojom_traits_unittest.cc",
diff --git a/services/network/public/cpp/cors/preflight_result.cc b/services/network/public/cpp/cors/preflight_result.cc new file mode 100644 index 0000000..63e30ad --- /dev/null +++ b/services/network/public/cpp/cors/preflight_result.cc
@@ -0,0 +1,212 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/network/public/cpp/cors/preflight_result.h" + +#include "base/memory/ptr_util.h" +#include "base/strings/string_number_conversions.h" +#include "base/strings/string_split.h" +#include "base/time/default_tick_clock.h" +#include "base/time/tick_clock.h" +#include "base/time/time.h" +#include "net/http/http_request_headers.h" +#include "services/network/public/cpp/cors/cors.h" + +namespace network { + +namespace cors { + +namespace { + +// Timeout values below are at the discretion of the user agent. + +// Default cache expiry time for an entry that does not have +// Access-Control-Max-Age header in its CORS-preflight response. +constexpr base::TimeDelta kDefaultTimeout = base::TimeDelta::FromSeconds(5); + +// Maximum cache expiry time. Even if a CORS-preflight response contains +// Access-Control-Max-Age header that specifies a longer expiry time, this +// maximum time is applied. +// +// Note: Should be short enough to minimize the risk of using a poisoned cache +// after switching to a secure network. +// TODO(toyoshim): Consider to invalidate all entries when network configuration +// is changed. See also discussion at https://crbug.com/131368. +constexpr base::TimeDelta kMaxTimeout = base::TimeDelta::FromSeconds(600); + +// Holds TickClock instance to overwrite TimeTicks::Now() for testing. +base::TickClock* tick_clock_for_testing = nullptr; + +base::TimeTicks Now() { + if (tick_clock_for_testing) + return tick_clock_for_testing->NowTicks(); + return base::TimeTicks::Now(); +} + +bool ParseAccessControlMaxAge(const base::Optional<std::string>& max_age, + base::TimeDelta* expiry_delta) { + DCHECK(expiry_delta); + + if (!max_age) + return false; + + uint64_t delta; + if (!base::StringToUint64(*max_age, &delta)) + return false; + + *expiry_delta = base::TimeDelta::FromSeconds(delta); + if (*expiry_delta > kMaxTimeout) + *expiry_delta = kMaxTimeout; + return true; +} + +// At this moment, this function always succeeds. +bool ParseAccessControlAllowList(const base::Optional<std::string>& string, + base::flat_set<std::string>* set, + bool insert_in_lower_case) { + DCHECK(set); + + if (!string) + return true; + + for (const auto& value : base::SplitString( + *string, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) { + // TODO(toyoshim): Strict ABNF header field checks want to be applied, e.g. + // strict VCHAR check of RFC-7230. + set->insert(insert_in_lower_case ? base::ToLowerASCII(value) : value); + } + return true; +} + +} // namespace + +// static +void PreflightResult::SetTickClockForTesting(base::TickClock* tick_clock) { + tick_clock_for_testing = tick_clock; +} + +// static +std::unique_ptr<PreflightResult> PreflightResult::Create( + const mojom::FetchCredentialsMode credentials_mode, + const base::Optional<std::string>& allow_methods_header, + const base::Optional<std::string>& allow_headers_header, + const base::Optional<std::string>& max_age_header, + base::Optional<mojom::CORSError>* detected_error) { + std::unique_ptr<PreflightResult> result = + base::WrapUnique(new PreflightResult(credentials_mode)); + base::Optional<mojom::CORSError> error = + result->Parse(allow_methods_header, allow_headers_header, max_age_header); + if (error) { + if (detected_error) + *detected_error = error; + return nullptr; + } + return result; +} + +PreflightResult::PreflightResult( + const mojom::FetchCredentialsMode credentials_mode) + : credentials_(credentials_mode == mojom::FetchCredentialsMode::kInclude) {} + +PreflightResult::~PreflightResult() = default; + +base::Optional<mojom::CORSError> +PreflightResult::EnsureAllowedCrossOriginMethod( + const std::string& method) const { + // Request method is normalized to upper case, and comparison is performed in + // case-sensitive way, that means access control header should provide an + // upper case method list. + const std::string normalized_method = base::ToUpperASCII(method); + if (methods_.find(normalized_method) != methods_.end() || + IsCORSSafelistedMethod(normalized_method)) { + return base::nullopt; + } + + if (!credentials_ && methods_.find("*") != methods_.end()) + return base::nullopt; + + return mojom::CORSError::kMethodDisallowedByPreflightResponse; +} + +base::Optional<mojom::CORSError> +PreflightResult::EnsureAllowedCrossOriginHeaders( + const net::HttpRequestHeaders& headers, + std::string* detected_header) const { + if (!credentials_ && headers_.find("*") != headers_.end()) + return base::nullopt; + + for (const auto& header : headers.GetHeaderVector()) { + // Header list check is performed in case-insensitive way. Here, we have a + // parsed header list set in lower case, and search each header in lower + // case. + const std::string key = base::ToLowerASCII(header.key); + if (headers_.find(key) == headers_.end() && + !IsCORSSafelistedHeader(key, header.value)) { + // Forbidden headers are forbidden to be used by JavaScript, and checked + // beforehand. But user-agents may add these headers internally, and it's + // fine. + if (IsForbiddenHeader(key)) + continue; + if (detected_header) + *detected_header = header.key; + return mojom::CORSError::kHeaderDisallowedByPreflightResponse; + } + } + return base::nullopt; +} + +bool PreflightResult::EnsureAllowedRequest( + mojom::FetchCredentialsMode credentials_mode, + const std::string& method, + const net::HttpRequestHeaders& headers) const { + if (absolute_expiry_time_ <= Now()) + return false; + + if (!credentials_ && + credentials_mode == mojom::FetchCredentialsMode::kInclude) { + return false; + } + + if (EnsureAllowedCrossOriginMethod(method)) + return false; + + if (EnsureAllowedCrossOriginHeaders(headers, nullptr)) + return false; + + return true; +} + +base::Optional<mojom::CORSError> PreflightResult::Parse( + const base::Optional<std::string>& allow_methods_header, + const base::Optional<std::string>& allow_headers_header, + const base::Optional<std::string>& max_age_header) { + DCHECK(methods_.empty()); + DCHECK(headers_.empty()); + + // Keeps parsed method case for case-sensitive search. + if (!ParseAccessControlAllowList(allow_methods_header, &methods_, false)) + return mojom::CORSError::kInvalidAllowMethodsPreflightResponse; + + // Holds parsed headers in lower case for case-insensitive search. + if (!ParseAccessControlAllowList(allow_headers_header, &headers_, true)) + return mojom::CORSError::kInvalidAllowHeadersPreflightResponse; + + base::TimeDelta expiry_delta; + if (max_age_header) { + // Set expiry_delta to 0 on invalid Access-Control-Max-Age headers so to + // invalidate the entry immediately. CORS-preflight response should be still + // usable for the request that initiates the CORS-preflight. + if (!ParseAccessControlMaxAge(max_age_header, &expiry_delta)) + expiry_delta = base::TimeDelta(); + } else { + expiry_delta = kDefaultTimeout; + } + absolute_expiry_time_ = Now() + expiry_delta; + + return base::nullopt; +} + +} // namespace cors + +} // namespace network
diff --git a/services/network/public/cpp/cors/preflight_result.h b/services/network/public/cpp/cors/preflight_result.h new file mode 100644 index 0000000..52b30fdf --- /dev/null +++ b/services/network/public/cpp/cors/preflight_result.h
@@ -0,0 +1,100 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SERVICES_NETWORK_PUBLIC_CPP_CORS_PREFLIGHT_RESULT_H_ +#define SERVICES_NETWORK_PUBLIC_CPP_CORS_PREFLIGHT_RESULT_H_ + +#include <memory> +#include <string> + +#include "base/component_export.h" +#include "base/containers/flat_set.h" +#include "base/optional.h" +#include "services/network/public/mojom/cors.mojom-shared.h" +#include "services/network/public/mojom/fetch_api.mojom-shared.h" + +namespace base { +class TickClock; +} // namespace base + +namespace net { +class HttpRequestHeaders; +} // namespace net + +namespace network { + +namespace cors { + +// Holds CORS-preflight request results, and provides access check methods. +// Each instance can be cached by CORS-preflight cache. +// See https://fetch.spec.whatwg.org/#concept-cache. +class COMPONENT_EXPORT(NETWORK_CPP) PreflightResult final { + public: + static void SetTickClockForTesting(base::TickClock* tick_clock); + + // Creates a PreflightResult instance from a CORS-preflight result. Returns + // nullptr and |detected_error| is populated with the failed reason if the + // passed parameters contain an invalid entry, and the pointer is valid. + static std::unique_ptr<PreflightResult> Create( + const mojom::FetchCredentialsMode credentials_mode, + const base::Optional<std::string>& allow_methods_header, + const base::Optional<std::string>& allow_headers_header, + const base::Optional<std::string>& max_age_header, + base::Optional<mojom::CORSError>* detected_error); + ~PreflightResult(); + + // Checks if the given |method| is allowed by the CORS-preflight response. + base::Optional<mojom::CORSError> EnsureAllowedCrossOriginMethod( + const std::string& method) const; + + // Checks if the given all |headers| are allowed by the CORS-preflight + // response. |detected_header| indicates the disallowed header name if the + // pointer is valid. + // This does not reject when the headers contain forbidden headers + // (https://fetch.spec.whatwg.org/#forbidden-header-name) because they may be + // added by the user agent. They must be checked separately and rejected for + // JavaScript-initiated requests. + base::Optional<mojom::CORSError> EnsureAllowedCrossOriginHeaders( + const net::HttpRequestHeaders& headers, + std::string* detected_header) const; + + // Checks if the given combination of |credentials_mode|, |method|, and + // |headers| is allowed by the CORS-preflight response. + // This also does not reject the forbidden headers as + // EnsureAllowCrossOriginHeaders does not. + bool EnsureAllowedRequest(mojom::FetchCredentialsMode credentials_mode, + const std::string& method, + const net::HttpRequestHeaders& headers) const; + + // Refers the cache expiry time. + base::TimeTicks absolute_expiry_time() const { return absolute_expiry_time_; } + + protected: + explicit PreflightResult(const mojom::FetchCredentialsMode credentials_mode); + + base::Optional<mojom::CORSError> Parse( + const base::Optional<std::string>& allow_methods_header, + const base::Optional<std::string>& allow_headers_header, + const base::Optional<std::string>& max_age_header); + + private: + // Holds an absolute time when the result should be expired in the + // CORS-preflight cache. + base::TimeTicks absolute_expiry_time_; + + // Corresponds to the fields of the CORS-preflight cache with the same name in + // the fetch spec. + // |headers_| holds strings in lower case for case-insensitive search. + bool credentials_; + base::flat_set<std::string> methods_; + base::flat_set<std::string> headers_; + + DISALLOW_COPY_AND_ASSIGN(PreflightResult); +}; + +} // namespace cors + +} // namespace network + +#endif // SERVICES_NETWORK_PUBLIC_CPP_CORS_PREFLIGHT_RESULT_H_
diff --git a/services/network/public/cpp/cors/preflight_result_unittest.cc b/services/network/public/cpp/cors/preflight_result_unittest.cc new file mode 100644 index 0000000..a0395df --- /dev/null +++ b/services/network/public/cpp/cors/preflight_result_unittest.cc
@@ -0,0 +1,245 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/network/public/cpp/cors/preflight_result.h" + +#include "base/test/simple_test_tick_clock.h" +#include "base/time/time.h" +#include "net/http/http_request_headers.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace network { + +namespace cors { + +namespace { + +using PreflightResultTest = ::testing::Test; + +struct TestCase { + const std::string allow_methods; + const std::string allow_headers; + const mojom::FetchCredentialsMode cache_credentials_mode; + + const std::string request_method; + const std::string request_headers; + const mojom::FetchCredentialsMode request_credentials_mode; + + const base::Optional<mojom::CORSError> expected_result; +}; + +const TestCase method_cases[] = { + // Found in the preflight response. + {"OPTIONS", "", mojom::FetchCredentialsMode::kOmit, "OPTIONS", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + {"GET", "", mojom::FetchCredentialsMode::kOmit, "GET", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + {"HEAD", "", mojom::FetchCredentialsMode::kOmit, "HEAD", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + {"POST", "", mojom::FetchCredentialsMode::kOmit, "POST", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + {"PUT", "", mojom::FetchCredentialsMode::kOmit, "PUT", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + {"DELETE", "", mojom::FetchCredentialsMode::kOmit, "DELETE", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + + // Found in the safe list. + {"", "", mojom::FetchCredentialsMode::kOmit, "GET", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + {"", "", mojom::FetchCredentialsMode::kOmit, "HEAD", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + {"", "", mojom::FetchCredentialsMode::kOmit, "POST", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + + // By '*'. + {"*", "", mojom::FetchCredentialsMode::kOmit, "OPTIONS", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + + // Cache allowing multiple methods. + {"GET, PUT, DELETE", "", mojom::FetchCredentialsMode::kOmit, "GET", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + {"GET, PUT, DELETE", "", mojom::FetchCredentialsMode::kOmit, "PUT", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + {"GET, PUT, DELETE", "", mojom::FetchCredentialsMode::kOmit, "DELETE", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + + // Not found in the preflight response and the safe lit. + {"", "", mojom::FetchCredentialsMode::kOmit, "OPTIONS", "", + mojom::FetchCredentialsMode::kOmit, + mojom::CORSError::kMethodDisallowedByPreflightResponse}, + {"", "", mojom::FetchCredentialsMode::kOmit, "PUT", "", + mojom::FetchCredentialsMode::kOmit, + mojom::CORSError::kMethodDisallowedByPreflightResponse}, + {"", "", mojom::FetchCredentialsMode::kOmit, "DELETE", "", + mojom::FetchCredentialsMode::kOmit, + mojom::CORSError::kMethodDisallowedByPreflightResponse}, + {"GET", "", mojom::FetchCredentialsMode::kOmit, "PUT", "", + mojom::FetchCredentialsMode::kOmit, + mojom::CORSError::kMethodDisallowedByPreflightResponse}, + {"GET, POST, DELETE", "", mojom::FetchCredentialsMode::kOmit, "PUT", "", + mojom::FetchCredentialsMode::kOmit, + mojom::CORSError::kMethodDisallowedByPreflightResponse}, + + // Request method is normalized to upper-case, but allowed methods is not. + // Comparison is in case-sensitive, that means allowed methods should be in + // upper case. + {"put", "", mojom::FetchCredentialsMode::kOmit, "PUT", "", + mojom::FetchCredentialsMode::kOmit, + mojom::CORSError::kMethodDisallowedByPreflightResponse}, + {"put", "", mojom::FetchCredentialsMode::kOmit, "put", "", + mojom::FetchCredentialsMode::kOmit, + mojom::CORSError::kMethodDisallowedByPreflightResponse}, + {"PUT", "", mojom::FetchCredentialsMode::kOmit, "put", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + // ... But, GET is always allowed by the safe list. + {"get", "", mojom::FetchCredentialsMode::kOmit, "GET", "", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, +}; + +const TestCase header_cases[] = { + // Found in the preflight response. + {"GET", "X-MY-HEADER", mojom::FetchCredentialsMode::kOmit, "GET", + "X-MY-HEADER:t", mojom::FetchCredentialsMode::kOmit, base::nullopt}, + {"GET", "X-MY-HEADER, Y-MY-HEADER", mojom::FetchCredentialsMode::kOmit, + "GET", "X-MY-HEADER:t\r\nY-MY-HEADER:t", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + {"GET", "x-my-header, Y-MY-HEADER", mojom::FetchCredentialsMode::kOmit, + "GET", "X-MY-HEADER:t\r\ny-my-header:t", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + + // Found in the safe list. + {"GET", "", mojom::FetchCredentialsMode::kOmit, "GET", "Accept:*/*", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + + // By '*'. + {"GET", "*", mojom::FetchCredentialsMode::kOmit, "GET", "xyzzy:t", + mojom::FetchCredentialsMode::kOmit, base::nullopt}, + {"GET", "*", mojom::FetchCredentialsMode::kInclude, "GET", "xyzzy:t", + mojom::FetchCredentialsMode::kOmit, + mojom::CORSError::kHeaderDisallowedByPreflightResponse}, + + // Forbidden headers can pass. + {"GET", "", mojom::FetchCredentialsMode::kOmit, "GET", + "Host: www.google.com", mojom::FetchCredentialsMode::kOmit, base::nullopt}, + + // Not found in the preflight response and the safe list. + {"GET", "", mojom::FetchCredentialsMode::kOmit, "GET", "X-MY-HEADER:t", + mojom::FetchCredentialsMode::kOmit, + mojom::CORSError::kHeaderDisallowedByPreflightResponse}, + {"GET", "X-SOME-OTHER-HEADER", mojom::FetchCredentialsMode::kOmit, "GET", + "X-MY-HEADER:t", mojom::FetchCredentialsMode::kOmit, + mojom::CORSError::kHeaderDisallowedByPreflightResponse}, + {"GET", "X-MY-HEADER", mojom::FetchCredentialsMode::kOmit, "GET", + "X-MY-HEADER:t\r\nY-MY-HEADER:t", mojom::FetchCredentialsMode::kOmit, + mojom::CORSError::kHeaderDisallowedByPreflightResponse}, +}; + +TEST_F(PreflightResultTest, MaxAge) { + std::unique_ptr<base::SimpleTestTickClock> tick_clock = + std::make_unique<base::SimpleTestTickClock>(); + PreflightResult::SetTickClockForTesting(tick_clock.get()); + + std::unique_ptr<PreflightResult> result1 = + PreflightResult::Create(mojom::FetchCredentialsMode::kOmit, base::nullopt, + base::nullopt, std::string("573"), nullptr); + EXPECT_EQ(base::TimeTicks() + base::TimeDelta::FromSeconds(573), + result1->absolute_expiry_time()); + + // Negative values are invalid. The preflight result itself can be usable, but + // should not cache such results. PreflightResult expresses it as a result + // with 'Access-Control-Max-Age: 0'. + std::unique_ptr<PreflightResult> result2 = + PreflightResult::Create(mojom::FetchCredentialsMode::kOmit, base::nullopt, + base::nullopt, std::string("-765"), nullptr); + EXPECT_EQ(base::TimeTicks(), result2->absolute_expiry_time()); + + PreflightResult::SetTickClockForTesting(nullptr); +}; + +TEST_F(PreflightResultTest, EnsureMethods) { + for (const auto& test : method_cases) { + std::unique_ptr<PreflightResult> result = + PreflightResult::Create(test.cache_credentials_mode, test.allow_methods, + test.allow_headers, base::nullopt, nullptr); + ASSERT_TRUE(result); + EXPECT_EQ(test.expected_result, + result->EnsureAllowedCrossOriginMethod(test.request_method)); + } +} + +TEST_F(PreflightResultTest, EnsureHeaders) { + for (const auto& test : header_cases) { + std::unique_ptr<PreflightResult> result = + PreflightResult::Create(test.cache_credentials_mode, test.allow_methods, + test.allow_headers, base::nullopt, nullptr); + ASSERT_TRUE(result); + net::HttpRequestHeaders headers; + headers.AddHeadersFromString(test.request_headers); + EXPECT_EQ(test.expected_result, + result->EnsureAllowedCrossOriginHeaders(headers, nullptr)); + } +} + +TEST_F(PreflightResultTest, EnsureRequest) { + for (const auto& test : method_cases) { + std::unique_ptr<PreflightResult> result = + PreflightResult::Create(test.cache_credentials_mode, test.allow_methods, + test.allow_headers, base::nullopt, nullptr); + ASSERT_TRUE(result); + net::HttpRequestHeaders headers; + if (!test.request_headers.empty()) + headers.AddHeadersFromString(test.request_headers); + EXPECT_EQ(test.expected_result == base::nullopt, + result->EnsureAllowedRequest(test.request_credentials_mode, + test.request_method, headers)); + } + + for (const auto& test : header_cases) { + std::unique_ptr<PreflightResult> result = + PreflightResult::Create(test.cache_credentials_mode, test.allow_methods, + test.allow_headers, base::nullopt, nullptr); + ASSERT_TRUE(result); + net::HttpRequestHeaders headers; + if (!test.request_headers.empty()) + headers.AddHeadersFromString(test.request_headers); + EXPECT_EQ(test.expected_result == base::nullopt, + result->EnsureAllowedRequest(test.request_credentials_mode, + test.request_method, headers)); + } + + struct { + const mojom::FetchCredentialsMode cache_credentials_mode; + const mojom::FetchCredentialsMode request_credentials_mode; + const bool expected_result; + } credentials_cases[] = { + // Different credential modes. + {mojom::FetchCredentialsMode::kInclude, + mojom::FetchCredentialsMode::kOmit, true}, + {mojom::FetchCredentialsMode::kInclude, + mojom::FetchCredentialsMode::kInclude, true}, + + // Credential mode mismatch. + {mojom::FetchCredentialsMode::kOmit, mojom::FetchCredentialsMode::kOmit, + true}, + {mojom::FetchCredentialsMode::kOmit, + mojom::FetchCredentialsMode::kInclude, false}, + }; + + for (const auto& test : credentials_cases) { + std::unique_ptr<PreflightResult> result = + PreflightResult::Create(test.cache_credentials_mode, std::string("GET"), + base::nullopt, base::nullopt, nullptr); + ASSERT_TRUE(result); + net::HttpRequestHeaders headers; + EXPECT_EQ(test.expected_result, + result->EnsureAllowedRequest(test.request_credentials_mode, "GET", + headers)); + } +} + +} // namespace + +} // namespace cors + +} // namespace network
diff --git a/services/network/public/mojom/cors.mojom b/services/network/public/mojom/cors.mojom index b44434d7..57d4cee 100644 --- a/services/network/public/mojom/cors.mojom +++ b/services/network/public/mojom/cors.mojom
@@ -30,6 +30,20 @@ kPreflightMissingAllowExternal, kPreflightInvalidAllowExternal, + // Failed to parse Access-Control-Allow-Methods response header field in + // CORS-preflight response. + kInvalidAllowMethodsPreflightResponse, + + // Failed to parse Access-Control-Allow-Headers response header field in + // CORS-preflight response. + kInvalidAllowHeadersPreflightResponse, + + // Not allowed by Access-Control-Allow-Methods in CORS-preflight response. + kMethodDisallowedByPreflightResponse, + + // Not allowed by Access-Control-Allow-Headers in CORS-preflight response. + kHeaderDisallowedByPreflightResponse, + // Redirect kRedirectDisallowedScheme, kRedirectContainsCredentials,
diff --git a/testing/buildbot/filters/fuchsia.base_unittests.filter b/testing/buildbot/filters/fuchsia.base_unittests.filter index 4fd43f5d..4e6c464 100644 --- a/testing/buildbot/filters/fuchsia.base_unittests.filter +++ b/testing/buildbot/filters/fuchsia.base_unittests.filter
@@ -83,3 +83,6 @@ # Flaky, https://crbug.com/811881 -AddressSpaceRandomizationTest.RandomBitCorrelations* + +# Flaky, https://crbug.com/813651 +-TaskSchedulerWorkerPoolCheckTlsReuse.CheckCleanupWorkers
diff --git a/testing/buildbot/filters/fuchsia.content_unittests.filter b/testing/buildbot/filters/fuchsia.content_unittests.filter index 29afdafa..0d7d8e5 100644 --- a/testing/buildbot/filters/fuchsia.content_unittests.filter +++ b/testing/buildbot/filters/fuchsia.content_unittests.filter
@@ -59,3 +59,6 @@ -RenderWidgetHostViewAuraOverscrollTest.TouchGestureEndDispatchedAfterOverscrollComplete -RenderWidgetHostViewAuraWheelScrollLatchingEnabledTest.TimerBasedWheelEventPhaseInfo -RenderWidgetHostViewAuraAsyncWheelEventsEnabledTest.TimerBasedWheelEventPhaseInfo + +# Flaky, https://crbug.com/813795. +-RTCRtpSenderTest.ReplaceTrackSetsTrack
diff --git a/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter b/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter index 27aa0d96..3b8ed70 100644 --- a/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter +++ b/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter
@@ -519,15 +519,6 @@ # Finish ServiceWorker networking glue rewrite. # http://crbug.com/715640 --ChromeServiceWorkerFetchPPAPIPrivateTest.OtherOrigin --ChromeServiceWorkerFetchPPAPIPrivateTest.OtherOriginCORS --ChromeServiceWorkerFetchPPAPIPrivateTest.OtherOriginCORSCredentials --ChromeServiceWorkerFetchPPAPIPrivateTest.OtherOriginCredentials --ChromeServiceWorkerFetchPPAPIPrivateTest.SameOrigin --ChromeServiceWorkerFetchPPAPIPrivateTest.SameOriginCORS --ChromeServiceWorkerFetchPPAPIPrivateTest.SameOriginCORSCredentials --ChromeServiceWorkerFetchPPAPIPrivateTest.SameOriginCredentials --ChromeServiceWorkerFetchPPAPITest.SameOrigin -ServiceWorkerAppTest.RegisterAndPostMessage -ServiceWorkerBackgroundSyncTestWithJSBindings/ServiceWorkerBackgroundSyncTest.Sync/0 -ServiceWorkerBackgroundSyncTestWithNativeBindings/ServiceWorkerBackgroundSyncTest.Sync/0
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG index ff7381e..37ee027b 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -71,7 +71,7 @@ crbug.com/591099 accessibility/canvas-fallback-content.html [ Failure ] crbug.com/591099 accessibility/color-well.html [ Failure ] crbug.com/591099 accessibility/computed-name.html [ Timeout ] -crbug.com/591099 accessibility/computed-role.html [ Pass Timeout ] +crbug.com/591099 accessibility/computed-role.html [ Timeout ] crbug.com/714962 accessibility/css-first-letter-children.html [ Failure ] crbug.com/591099 accessibility/css-generated-content.html [ Failure ] crbug.com/591099 accessibility/css-styles.html [ Failure ] @@ -1045,8 +1045,6 @@ crbug.com/591099 external/wpt/acid/acid3/numbered-tests.html [ Crash ] crbug.com/591099 external/wpt/acid/acid3/test.html [ Crash ] crbug.com/591099 external/wpt/compat/webkit-text-fill-color-property-005.html [ Pass ] -crbug.com/591099 external/wpt/content-security-policy/reporting/report-original-url.sub.html [ Pass Timeout ] -crbug.com/591099 external/wpt/content-security-policy/style-src/style-src-multiple-policies-multiple-hashing-algorithms.html [ Pass Timeout ] crbug.com/591099 external/wpt/credential-management/federatedcredential-framed-get.sub.https.html [ Pass ] crbug.com/591099 external/wpt/credential-management/passwordcredential-framed-get.sub.https.html [ Pass ] crbug.com/591099 external/wpt/css/CSS2/floats/floats-rule3-outside-left-002.xht [ Pass ] @@ -1060,7 +1058,6 @@ crbug.com/591099 external/wpt/css/CSS2/normal-flow/max-height-percentage-002.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/max-width-applies-to-005.xht [ Pass ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/root-box-001.xht [ Failure ] -crbug.com/591099 external/wpt/css/CSS2/positioning/abspos-007.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/CSS2/positioning/positioning-float-001.xht [ Pass ] crbug.com/591099 external/wpt/css/CSS2/text/text-decoration-applies-to-015.xht [ Failure ] crbug.com/714962 external/wpt/css/css-backgrounds/background-attachment-local/attachment-local-clipping-color-5.html [ Failure ] @@ -1134,9 +1131,17 @@ crbug.com/591099 external/wpt/css/css-multicol/multicol-basic-003.html [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-basic-004.html [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-basic-007.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-multicol/multicol-basic-008.xht [ Failure Pass ] +crbug.com/591099 external/wpt/css/css-multicol/multicol-basic-008.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-block-no-clip-001.xht [ Pass ] crbug.com/591099 external/wpt/css/css-multicol/multicol-br-inside-avoidcolumn-001.xht [ Failure ] +crbug.com/591099 external/wpt/css/css-multicol/multicol-breaking-000.html [ Failure ] +crbug.com/591099 external/wpt/css/css-multicol/multicol-breaking-001.html [ Failure ] +crbug.com/591099 external/wpt/css/css-multicol/multicol-breaking-002.html [ Failure ] +crbug.com/591099 external/wpt/css/css-multicol/multicol-breaking-003.html [ Failure ] +crbug.com/591099 external/wpt/css/css-multicol/multicol-breaking-nobackground-000.html [ Failure ] +crbug.com/591099 external/wpt/css/css-multicol/multicol-breaking-nobackground-001.html [ Failure ] +crbug.com/591099 external/wpt/css/css-multicol/multicol-breaking-nobackground-002.html [ Failure ] +crbug.com/591099 external/wpt/css/css-multicol/multicol-breaking-nobackground-003.html [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-clip-001.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-clip-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-collapsing-001.xht [ Failure ] @@ -1179,7 +1184,7 @@ crbug.com/591099 external/wpt/css/css-multicol/multicol-height-001.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-height-block-child-001.xht [ Failure ] crbug.com/714962 external/wpt/css/css-multicol/multicol-inherit-001.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-multicol/multicol-inherit-002.xht [ Failure Pass ] +crbug.com/591099 external/wpt/css/css-multicol/multicol-inherit-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-inherit-003.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-list-item-001.xht [ Failure ] crbug.com/714962 external/wpt/css/css-multicol/multicol-margin-001.xht [ Failure ] @@ -1241,7 +1246,7 @@ crbug.com/591099 external/wpt/css/css-multicol/multicol-table-cell-height-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-table-cell-vertical-align-001.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-width-001.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-multicol/multicol-width-002.xht [ Failure Pass ] +crbug.com/591099 external/wpt/css/css-multicol/multicol-width-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-width-003.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-width-ch-001.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-width-count-001.xht [ Failure ] @@ -1250,14 +1255,11 @@ crbug.com/714962 external/wpt/css/css-multicol/multicol-width-large-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-width-small-001.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-zero-height-001.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-paint-api/geometry-border-image-004.https.html [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-paint-api/paint2d-filter.https.html [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-paint-api/paint2d-rects.https.html [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-paint-api/parse-input-arguments-013.https.html [ Failure Pass ] crbug.com/714962 external/wpt/css/css-paint-api/style-before-pseudo.https.html [ Failure ] crbug.com/714962 external/wpt/css/css-paint-api/style-first-letter-pseudo.https.html [ Failure ] crbug.com/591099 external/wpt/css/css-position/position-relative-table-tbody-top.html [ Pass ] crbug.com/591099 external/wpt/css/css-position/position-sticky-nested-inline.html [ Crash ] +crbug.com/591099 external/wpt/css/css-position/position-sticky-overflow-padding.html [ Failure ] crbug.com/591099 external/wpt/css/css-position/position-sticky-writing-modes.html [ Failure ] crbug.com/591099 external/wpt/css/css-pseudo/first-letter-003.html [ Pass ] crbug.com/591099 external/wpt/css/css-rhythm/line-height-step-basic-001.html [ Failure ] @@ -1308,7 +1310,7 @@ crbug.com/591099 external/wpt/css/css-shapes/shape-outside/shape-image/shape-image-021.html [ Failure ] crbug.com/591099 external/wpt/css/css-shapes/shape-outside/shape-image/shape-image-022.html [ Failure ] crbug.com/591099 external/wpt/css/css-shapes/shape-outside/shape-image/shape-image-023.html [ Failure ] -crbug.com/591099 external/wpt/css/css-shapes/shape-outside/shape-image/shape-image-025.html [ Failure Pass ] +crbug.com/591099 external/wpt/css/css-shapes/shape-outside/shape-image/shape-image-025.html [ Failure ] crbug.com/591099 external/wpt/css/css-shapes/shape-outside/supported-shapes/circle/shape-outside-circle-013.html [ Failure ] crbug.com/591099 external/wpt/css/css-shapes/shape-outside/supported-shapes/circle/shape-outside-circle-014.html [ Failure ] crbug.com/591099 external/wpt/css/css-shapes/shape-outside/supported-shapes/circle/shape-outside-circle-015.html [ Failure ] @@ -1347,7 +1349,7 @@ crbug.com/591099 external/wpt/css/css-shapes/shape-outside/supported-shapes/inset/shape-outside-inset-012.html [ Failure ] crbug.com/591099 external/wpt/css/css-shapes/shape-outside/supported-shapes/inset/shape-outside-inset-013.html [ Failure ] crbug.com/591099 external/wpt/css/css-shapes/shape-outside/supported-shapes/inset/shape-outside-inset-014.html [ Failure ] -crbug.com/591099 external/wpt/css/css-shapes/shape-outside/supported-shapes/inset/shape-outside-inset-015.html [ Failure Pass ] +crbug.com/591099 external/wpt/css/css-shapes/shape-outside/supported-shapes/inset/shape-outside-inset-015.html [ Failure ] crbug.com/591099 external/wpt/css/css-shapes/shape-outside/supported-shapes/polygon/shape-outside-polygon-007.html [ Failure ] crbug.com/591099 external/wpt/css/css-shapes/shape-outside/supported-shapes/polygon/shape-outside-polygon-008.html [ Failure ] crbug.com/591099 external/wpt/css/css-shapes/shape-outside/supported-shapes/polygon/shape-outside-polygon-009.html [ Failure ] @@ -1387,8 +1389,6 @@ crbug.com/591099 external/wpt/css/css-tables/fixup-dynamic-anonymous-table-001.html [ Pass ] crbug.com/591099 external/wpt/css/css-tables/floats/floats-wrap-bfc-006c.xht [ Pass ] crbug.com/591099 external/wpt/css/css-tables/height-distribution/percentage-sizing-of-table-cell-children.html [ Failure ] -crbug.com/591099 external/wpt/css/css-tables/html-to-css-mapping-1.html [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-tables/html-to-css-mapping-2.html [ Failure Pass ] crbug.com/591099 external/wpt/css/css-tables/html5-table-formatting-fixed-layout-1.html [ Crash ] crbug.com/591099 external/wpt/css/css-tables/table-model-fixup-2.html [ Failure ] crbug.com/591099 external/wpt/css/css-tables/visibility-collapse-rowcol-001.html [ Crash ] @@ -1404,7 +1404,7 @@ crbug.com/591099 external/wpt/css/css-text-decor/text-emphasis-position-below-right-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-text-decor/text-emphasis-style-002.html [ Failure ] crbug.com/591099 external/wpt/css/css-text-decor/text-emphasis-style-006.html [ Failure ] -crbug.com/591099 external/wpt/css/css-text-decor/text-emphasis-style-007.html [ Failure Pass ] +crbug.com/591099 external/wpt/css/css-text-decor/text-emphasis-style-007.html [ Failure ] crbug.com/591099 external/wpt/css/css-text-decor/text-emphasis-style-008.html [ Failure ] crbug.com/591099 external/wpt/css/css-text-decor/text-emphasis-style-010.html [ Failure ] crbug.com/591099 external/wpt/css/css-text-decor/text-emphasis-style-012.html [ Failure ] @@ -1418,17 +1418,11 @@ crbug.com/591099 external/wpt/css/css-text/i18n/css3-text-line-break-opclns-118.html [ Pass ] crbug.com/591099 external/wpt/css/css-text/i18n/css3-text-line-break-opclns-255.html [ Pass ] crbug.com/591099 external/wpt/css/css-text/i18n/css3-text-line-break-opclns-259.html [ Pass ] -crbug.com/591099 external/wpt/css/css-transforms/transform-abspos-005.html [ Failure Pass ] crbug.com/714962 external/wpt/css/css-transforms/transform-abspos-006.html [ Failure ] -crbug.com/714962 external/wpt/css/css-transforms/transform-abspos-007.html [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-transforms/transform-background-006.html [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-transforms/transform-inline-001.html [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-transforms/transform-abspos-007.html [ Failure ] crbug.com/714962 external/wpt/css/css-transforms/transform-origin-006.html [ Failure ] -crbug.com/591099 external/wpt/css/css-transforms/transform-rotate-001.html [ Failure Pass ] crbug.com/591099 external/wpt/css/css-transforms/transform-transformed-tr-percent-height-child.html [ Failure ] crbug.com/591099 external/wpt/css/css-transforms/transform3d-perspective-008.html [ Pass ] -crbug.com/591099 external/wpt/css/css-typed-om/CSSMatrixComponent-DOMMatrix-mutable.html [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-typed-om/stylevalue-subclasses/numeric-objects/numeric-factory.tentative.html [ Failure Pass ] crbug.com/591099 external/wpt/css/css-ui/box-sizing-007.html [ Failure ] crbug.com/591099 external/wpt/css/css-ui/box-sizing-008.html [ Failure ] crbug.com/591099 external/wpt/css/css-ui/box-sizing-009.html [ Failure ] @@ -1459,8 +1453,8 @@ crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-003.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-005.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-007.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-009.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-011.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-009.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-011.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-013.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-015.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-017.xht [ Failure ] @@ -1469,12 +1463,12 @@ crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-023.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-025.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-027.xht [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-029.xht [ Failure ] +crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-029.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-031.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-033.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-035.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-035.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-037.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-039.xht [ Failure ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-039.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-041.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-043.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-045.xht [ Failure ] @@ -1494,23 +1488,23 @@ crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-073.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-075.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-077.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-079.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-079.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-081.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-083.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-085.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-087.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-087.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-089.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-091.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-093.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-095.xht [ Failure Pass ] +crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-095.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-097.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-103.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-103.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-105.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-107.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-109.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-111.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-113.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-115.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-115.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-117.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-119.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-121.xht [ Failure ] @@ -1523,7 +1517,7 @@ crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-135.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-137.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-139.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-141.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-141.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-143.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-145.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-147.xht [ Failure Pass ] @@ -1536,9 +1530,9 @@ crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-161.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-163.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-165.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-167.xht [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-169.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-171.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-167.xht [ Failure ] +crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-169.xht [ Failure ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-171.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-173.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-175.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-177.xht [ Failure ] @@ -1555,7 +1549,7 @@ crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-199.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-201.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-203.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-205.xht [ Failure Pass ] +crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-205.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-207.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-209.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-211.xht [ Failure Pass ] @@ -1575,13 +1569,13 @@ crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-010.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-012.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-014.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-016.xht [ Failure Pass ] +crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-016.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-018.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-020.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-022.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-024.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-026.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-028.xht [ Failure Pass ] +crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-028.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-030.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-032.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-034.xht [ Failure ] @@ -1596,7 +1590,7 @@ crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-052.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-054.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-056.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-058.xht [ Failure ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-058.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-060.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-062.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-064.xht [ Failure Pass ] @@ -1605,10 +1599,10 @@ crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-070.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-072.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-074.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-076.xht [ Failure Pass ] +crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-076.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-078.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-080.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-082.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-082.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-084.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-086.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-088.xht [ Failure ] @@ -1628,7 +1622,7 @@ crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-120.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-122.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-124.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-126.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-126.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-128.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-130.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-132.xht [ Failure ] @@ -1674,7 +1668,7 @@ crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-212.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-214.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-216.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-218.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-218.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-220.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-222.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-224.xht [ Failure ] @@ -1687,7 +1681,7 @@ crbug.com/591099 external/wpt/css/css-writing-modes/available-size-012.html [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/available-size-017.html [ Pass ] crbug.com/591099 external/wpt/css/css-writing-modes/available-size-018.html [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes/block-flow-direction-vrl-002.xht [ Failure Pass ] +crbug.com/591099 external/wpt/css/css-writing-modes/block-flow-direction-vrl-002.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/block-flow-direction-vrl-005.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/block-flow-direction-vrl-006.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/block-flow-direction-vrl-009.xht [ Failure ] @@ -1695,7 +1689,7 @@ crbug.com/714962 external/wpt/css/css-writing-modes/block-flow-direction-vrl-012.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/block-flow-direction-vrl-013.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/block-flow-direction-vrl-021.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes/block-flow-direction-vrl-024.xht [ Failure Pass ] +crbug.com/591099 external/wpt/css/css-writing-modes/block-flow-direction-vrl-024.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/block-flow-direction-vrl-025.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/ch-units-vrl-008.html [ Pass ] crbug.com/591099 external/wpt/css/css-writing-modes/clearance-calculations-vrl-002.xht [ Failure ] @@ -1710,12 +1704,12 @@ crbug.com/591099 external/wpt/css/css-writing-modes/float-contiguous-vrl-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/float-contiguous-vrl-004.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/float-contiguous-vrl-006.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes/float-contiguous-vrl-008.xht [ Failure Pass ] +crbug.com/591099 external/wpt/css/css-writing-modes/float-contiguous-vrl-008.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/float-shrink-to-fit-vrl-008.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/float-vlr-005.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-writing-modes/float-vlr-007.xht [ Failure ] +crbug.com/714962 external/wpt/css/css-writing-modes/float-vlr-007.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-writing-modes/float-vlr-013.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes/float-vrl-004.xht [ Failure ] +crbug.com/591099 external/wpt/css/css-writing-modes/float-vrl-004.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-writing-modes/float-vrl-006.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/float-vrl-008.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/float-vrl-012.xht [ Failure ] @@ -1726,7 +1720,7 @@ crbug.com/714962 external/wpt/css/css-writing-modes/inline-block-alignment-orthogonal-vrl-002.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/inline-block-alignment-orthogonal-vrl-004.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/inline-table-alignment-002.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/inline-table-alignment-004.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/inline-table-alignment-004.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/line-box-direction-vrl-006.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/line-box-direction-vrl-009.xht [ Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/line-box-direction-vrl-011.xht [ Failure ] @@ -1765,12 +1759,12 @@ crbug.com/714962 external/wpt/css/css-writing-modes/percent-padding-vrl-006.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/row-progression-vrl-002.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/row-progression-vrl-004.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/row-progression-vrl-006.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/row-progression-vrl-006.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/row-progression-vrl-008.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/sizing-orthog-htb-in-vlr-001.xht [ Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/sizing-orthog-htb-in-vrl-003.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/sizing-orthog-htb-in-vrl-007.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/sizing-orthog-htb-in-vrl-008.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/sizing-orthog-htb-in-vrl-008.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/sizing-orthog-htb-in-vrl-009.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/sizing-orthog-htb-in-vrl-011.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/sizing-orthog-htb-in-vrl-012.xht [ Failure ] @@ -1795,16 +1789,16 @@ crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-007.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-009.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/text-align-vlr-011.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-013.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-013.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-015.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-017.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-019.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-002.xht [ Failure ] +crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-002.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-004.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-006.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-008.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-010.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-012.xht [ Failure ] +crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-012.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-014.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-016.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-018.xht [ Failure ] @@ -1812,9 +1806,9 @@ crbug.com/591099 external/wpt/css/css-writing-modes/text-baseline-vrl-006.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/text-combine-upright-decorations-001.html [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/text-combine-upright-layout-rules-001.html [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/text-indent-vlr-003.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/text-indent-vlr-003.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/text-indent-vlr-005.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/text-indent-vlr-011.xht [ Failure Pass ] +crbug.com/714962 external/wpt/css/css-writing-modes/text-indent-vlr-011.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/text-indent-vlr-013.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/text-indent-vrl-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/text-indent-vrl-004.xht [ Failure ] @@ -1863,7 +1857,6 @@ crbug.com/626703 external/wpt/css/cssom/stylesheet-replacedata-dynamic.html [ Failure ] crbug.com/591099 external/wpt/css/geometry/interfaces.html [ Timeout ] crbug.com/591099 external/wpt/css/geometry/interfaces.worker.html [ Timeout ] -crbug.com/591099 external/wpt/css/reference/pass_if_filler_text_match_bold.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/selectors/focus-within-001.html [ Failure ] crbug.com/591099 external/wpt/css/selectors/focus-within-004.html [ Failure ] crbug.com/714962 external/wpt/css/selectors/focus-within-007.html [ Failure ] @@ -1898,6 +1891,7 @@ crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/variables/variable-font-face-01.html [ Failure Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/variables/variable-font-face-02.html [ Failure Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/writing-modes-3/text-combine-upright-break-inside-001.html [ Failure ] +crbug.com/591099 external/wpt/custom-elements/builtin-coverage.html [ Timeout ] crbug.com/591099 external/wpt/dom/interfaces.html [ Timeout ] crbug.com/591099 external/wpt/dom/nodes/Document-contentType/contentType/contenttype_datauri_02.html [ Pass ] crbug.com/591099 external/wpt/dom/nodes/Element-classlist.html [ Timeout ] @@ -1915,8 +1909,7 @@ crbug.com/591099 external/wpt/dom/ranges/Range-mutations-dataChange.html [ Timeout ] crbug.com/591099 external/wpt/dom/ranges/Range-set.html [ Timeout ] crbug.com/591099 external/wpt/dom/ranges/Range-surroundContents.html [ Timeout ] -crbug.com/591099 external/wpt/domxpath/xml_xpath_runner.html [ Pass Timeout ] -crbug.com/591099 external/wpt/editing/other/extra-text-nodes.html [ Failure Pass ] +crbug.com/591099 external/wpt/domxpath/xml_xpath_runner.html [ Timeout ] crbug.com/591099 external/wpt/editing/run/backcolor.html [ Pass Timeout ] crbug.com/591099 external/wpt/editing/run/bold.html [ Timeout ] crbug.com/591099 external/wpt/editing/run/fontname.html [ Timeout ] @@ -1938,7 +1931,6 @@ crbug.com/591099 external/wpt/editing/run/justifyfull.html [ Timeout ] crbug.com/591099 external/wpt/editing/run/justifyleft.html [ Timeout ] crbug.com/591099 external/wpt/editing/run/justifyright.html [ Timeout ] -crbug.com/591099 external/wpt/editing/run/misc.html [ Failure Pass ] crbug.com/591099 external/wpt/editing/run/multitest.html [ Timeout ] crbug.com/591099 external/wpt/editing/run/outdent.html [ Timeout ] crbug.com/591099 external/wpt/editing/run/removeformat.html [ Timeout ] @@ -2045,21 +2037,15 @@ crbug.com/591099 external/wpt/feature-policy/payment-allowed-by-feature-policy.https.sub.html [ Pass ] crbug.com/591099 external/wpt/feature-policy/payment-disabled-by-feature-policy.https.sub.html [ Pass ] crbug.com/591099 external/wpt/fetch/api/redirect/redirect-location-worker.html [ Pass Timeout ] -crbug.com/591099 external/wpt/fetch/api/response/response-clone.html [ Failure Pass ] -crbug.com/591099 external/wpt/fetch/api/response/response-idl.html [ Failure Pass ] -crbug.com/591099 external/wpt/fetch/http-cache/vary.html [ Failure Pass ] crbug.com/591099 external/wpt/geolocation-API/PositionOptions.https.html [ Failure ] crbug.com/591099 external/wpt/html-media-capture/capture_audio_cancel-manual.html [ Failure ] crbug.com/591099 external/wpt/html-media-capture/capture_image_cancel-manual.html [ Failure ] crbug.com/591099 external/wpt/html-media-capture/capture_video_cancel-manual.html [ Failure ] -crbug.com/591099 external/wpt/html/browsers/browsing-the-web/unloading-documents/005.html [ Failure Pass ] -crbug.com/591099 external/wpt/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4.html [ Failure Pass ] crbug.com/591099 external/wpt/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-goes-cross-origin-domain.sub.html [ Pass ] crbug.com/591099 external/wpt/html/browsers/windows/noreferrer-window-name.html [ Timeout ] crbug.com/591099 external/wpt/html/dom/documents/dom-tree-accessors/Document.currentScript.html [ Pass ] crbug.com/591099 external/wpt/html/dom/documents/resource-metadata-management/document-lastModified-01.html [ Pass ] crbug.com/591099 external/wpt/html/dom/interfaces.html [ Timeout ] -crbug.com/591099 external/wpt/html/dom/reflection-forms.html [ Failure Pass ] crbug.com/591099 external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/utf-16be.html [ Timeout ] crbug.com/591099 external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/utf-16le.html [ Timeout ] crbug.com/591099 external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/utf-8.html [ Timeout ] @@ -2069,24 +2055,21 @@ crbug.com/591099 external/wpt/html/rendering/non-replaced-elements/the-fieldset-element-0/legend-block-formatting-context.html [ Failure ] crbug.com/591099 external/wpt/html/rendering/replaced-elements/svg-embedded-sizing/svg-in-img-auto.html [ Failure ] crbug.com/591099 external/wpt/html/rendering/replaced-elements/svg-embedded-sizing/svg-in-img-percentage.html [ Failure ] -crbug.com/591099 external/wpt/html/rendering/replaced-elements/svg-inline-sizing/svg-inline.html [ Failure Timeout ] +crbug.com/591099 external/wpt/html/rendering/replaced-elements/svg-inline-sizing/svg-inline.html [ Timeout ] crbug.com/714962 external/wpt/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change.html [ Failure ] crbug.com/591099 external/wpt/html/semantics/document-metadata/the-link-element/stylesheet-change-href.html [ Failure ] -crbug.com/591099 external/wpt/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-invoke-set-src-networkState.html [ Failure Pass ] -crbug.com/591099 external/wpt/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-remove-source.html [ Failure Pass ] crbug.com/591099 external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-webvtt-non-snap-to-lines.html [ Failure ] -crbug.com/591099 external/wpt/html/semantics/grouping-content/the-li-element/grouping-li-reftest-002.html [ Failure Pass ] +crbug.com/591099 external/wpt/html/semantics/grouping-content/the-li-element/grouping-li-reftest-002.html [ Failure ] crbug.com/591099 external/wpt/html/semantics/grouping-content/the-li-element/grouping-li-reftest-list-owner-menu.html [ Failure ] crbug.com/591099 external/wpt/html/semantics/grouping-content/the-li-element/grouping-li-reftest-list-owner-skip-no-boxes.html [ Failure ] crbug.com/591099 external/wpt/html/semantics/grouping-content/the-ol-element/grouping-ol-rev-reftest-001.html [ Failure ] crbug.com/591099 external/wpt/html/semantics/grouping-content/the-ol-element/grouping-ol-start-reftest-001.html [ Failure ] -crbug.com/591099 external/wpt/html/semantics/grouping-content/the-ol-element/grouping-ol-start-reftest-002.html [ Failure Pass ] +crbug.com/591099 external/wpt/html/semantics/grouping-content/the-ol-element/grouping-ol-start-reftest-002.html [ Failure ] crbug.com/591099 external/wpt/html/semantics/grouping-content/the-ol-element/grouping-ol-type-reftest-001.html [ Failure ] crbug.com/591099 external/wpt/html/semantics/grouping-content/the-ol-element/grouping-ol-type-reftest-002.html [ Failure ] crbug.com/591099 external/wpt/html/semantics/grouping-content/the-ol-element/grouping-ol-type-reftest-003.html [ Failure ] crbug.com/591099 external/wpt/html/semantics/interactive-elements/the-dialog-element/abspos-dialog-layout.html [ Failure ] crbug.com/591099 external/wpt/html/semantics/interactive-elements/the-dialog-element/centering.html [ Crash ] -crbug.com/591099 external/wpt/html/semantics/scripting-1/the-script-element/execution-timing/030.html [ Failure Pass ] crbug.com/591099 external/wpt/html/semantics/scripting-1/the-script-element/module/choice-of-error-2.html [ Pass ] crbug.com/591099 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/dynamic-imports.html [ Pass ] crbug.com/591099 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/propagate-nonce-external-classic.html [ Pass ] @@ -2094,12 +2077,9 @@ crbug.com/591099 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/propagate-nonce-inline-classic.html [ Pass ] crbug.com/591099 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/propagate-nonce-inline-module.html [ Pass ] crbug.com/591099 external/wpt/html/semantics/scripting-1/the-script-element/module/error-type-3.html [ Pass ] -crbug.com/591099 external/wpt/html/semantics/scripting-1/the-script-element/module/instantiation-error-4.html [ Failure Pass ] -crbug.com/591099 external/wpt/html/semantics/text-level-semantics/the-b-element/b-usage.html [ Failure Pass ] crbug.com/591099 external/wpt/html/syntax/parsing/html5lib_isindex.html?run_type=uri [ Pass ] crbug.com/591099 external/wpt/html/syntax/parsing/html5lib_isindex.html?run_type=write [ Pass ] crbug.com/591099 external/wpt/html/syntax/parsing/html5lib_isindex.html?run_type=write_single [ Pass ] -crbug.com/591099 external/wpt/html/syntax/parsing/html5lib_menuitem-element.html?run_type=uri [ Failure Pass ] crbug.com/591099 external/wpt/html/syntax/parsing/html5lib_menuitem-element.html?run_type=write_single [ Pass ] crbug.com/591099 external/wpt/html/syntax/parsing/html5lib_tests19.html?run_type=uri [ Pass ] crbug.com/591099 external/wpt/html/syntax/parsing/html5lib_tests19.html?run_type=write [ Pass ] @@ -2110,7 +2090,7 @@ crbug.com/591099 external/wpt/html/syntax/parsing/named-character-references.html [ Timeout ] crbug.com/591099 external/wpt/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-1.htm [ Pass Timeout ] crbug.com/591099 external/wpt/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-4.htm [ Pass Timeout ] -crbug.com/591099 external/wpt/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-7.htm [ Failure Pass Timeout ] +crbug.com/591099 external/wpt/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-7.htm [ Pass Timeout ] crbug.com/591099 external/wpt/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-8.htm [ Timeout ] crbug.com/591099 external/wpt/http/basic-auth-cache-test.html [ Timeout ] crbug.com/591099 external/wpt/innerText/getter.html [ Crash ] @@ -2118,16 +2098,12 @@ crbug.com/714962 external/wpt/intersection-observer/root-margin.html [ Failure ] crbug.com/591099 external/wpt/intersection-observer/same-document-root.html [ Failure ] crbug.com/591099 external/wpt/longtask-timing/longtask-in-sibling-iframe.html [ Pass Timeout ] -crbug.com/591099 external/wpt/media-source/mediasource-addsourcebuffer-mode.html [ Failure Pass ] crbug.com/591099 external/wpt/media-source/mediasource-getvideoplaybackquality.html [ Timeout ] crbug.com/591099 external/wpt/mediacapture-streams/MediaStreamTrack-getSettings.https.html [ Pass ] -crbug.com/591099 external/wpt/mimesniff/mime-types/parsing.any.html [ Failure Timeout ] +crbug.com/591099 external/wpt/mimesniff/mime-types/parsing.any.html [ Timeout ] crbug.com/591099 external/wpt/mimesniff/mime-types/parsing.any.worker.html [ Timeout ] -crbug.com/591099 external/wpt/mixed-content/audio-tag/no-opt-in/same-host-http/top-level/no-redirect/optionally-blockable/no-opt-in-allows.https.html [ Failure Pass ] -crbug.com/591099 external/wpt/notifications/lang.html [ Failure Pass ] crbug.com/591099 external/wpt/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.nocontext.worker.html [ Crash ] crbug.com/591099 external/wpt/offscreen-canvas/the-offscreen-canvas/offscreencanvas.getcontext.worker.html [ Pass ] -crbug.com/591099 external/wpt/offscreen-canvas/the-offscreen-canvas/size.attributes.parse.junk.html [ Failure Pass ] crbug.com/591099 external/wpt/payment-request/payment-allowed-by-feature-policy.https.sub.html [ Pass ] crbug.com/591099 external/wpt/payment-request/payment-disabled-by-feature-policy.https.sub.html [ Pass ] crbug.com/591099 external/wpt/performance-timeline/po-callback-mutate.any.html [ Pass ] @@ -2180,30 +2156,14 @@ crbug.com/591099 external/wpt/service-workers/service-worker/clients-get.https.html [ Pass ] crbug.com/591099 external/wpt/service-workers/service-worker/navigation-preload/resource-timing.https.html [ Pass ] crbug.com/591099 external/wpt/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint.html [ Failure ] -crbug.com/591099 external/wpt/speech-api/SpeechSynthesis-speak-ownership.html [ Failure Pass ] -crbug.com/591099 external/wpt/streams/piping/close-propagation-forward.dedicatedworker.html [ Failure Pass ] -crbug.com/591099 external/wpt/streams/readable-byte-streams/brand-checks.dedicatedworker.html [ Failure Pass ] -crbug.com/591099 external/wpt/streams/transform-streams/properties.sharedworker.html [ Failure Pass ] -crbug.com/591099 external/wpt/streams/writable-streams/properties.dedicatedworker.html [ Failure Pass ] crbug.com/591099 external/wpt/svg/interfaces.html [ Timeout ] crbug.com/591099 external/wpt/svg/linking/reftests/href-filter-element.html [ Failure ] crbug.com/591099 external/wpt/svg/path/bearing/absolute.svg [ Pass ] -crbug.com/591099 external/wpt/uievents/auxclick/auxclick_event-manual.html [ Failure Pass ] crbug.com/591099 external/wpt/uievents/order-of-events/focus-events/focus-manual.html [ Timeout ] crbug.com/714962 external/wpt/uievents/order-of-events/mouse-events/click-cancel.html [ Failure Pass ] -crbug.com/591099 external/wpt/url/a-element-xhtml.xhtml [ Failure Pass ] -crbug.com/591099 external/wpt/url/historical.any.worker.html [ Failure Pass ] -crbug.com/591099 external/wpt/url/url-constructor.html [ Failure Pass ] crbug.com/591099 external/wpt/url/url-setters.html [ Pass Timeout ] crbug.com/591099 external/wpt/wasm/wasm_local_iframe_test.html [ Failure ] -crbug.com/591099 external/wpt/web-animations/interfaces/Animation/finished.html [ Failure Pass ] -crbug.com/591099 external/wpt/web-animations/timing-model/animation-effects/phases-and-states.html [ Failure Pass ] crbug.com/591099 external/wpt/webmessaging/broadcastchannel/sandbox.html [ Failure ] -crbug.com/591099 external/wpt/webrtc/RTCConfiguration-bundlePolicy.html [ Failure Pass ] -crbug.com/591099 external/wpt/webrtc/RTCPeerConnection-getIdentityAssertion.html [ Failure Pass ] -crbug.com/591099 external/wpt/webrtc/RTCRtpParameters-rtcp.html [ Failure Pass ] -crbug.com/591099 external/wpt/webrtc/RTCRtpSender-getCapabilities.html [ Failure Pass ] -crbug.com/591099 external/wpt/webrtc/RTCSctpTransport-constructor.html [ Failure Pass ] crbug.com/591099 external/wpt/webrtc/interfaces.html [ Pass Timeout ] crbug.com/591099 external/wpt/webrtc/interfaces.https.html [ Pass Timeout ] crbug.com/591099 external/wpt/websockets/binary/001.html?wss [ Pass ] @@ -2256,7 +2216,6 @@ crbug.com/591099 external/wpt/websockets/opening-handshake/005.html [ Pass ] crbug.com/591099 external/wpt/websockets/unload-a-document/001.html [ Pass ] crbug.com/591099 external/wpt/websockets/unload-a-document/001.html?wss [ Pass ] -crbug.com/591099 external/wpt/websockets/unload-a-document/002.html [ Failure Pass ] crbug.com/591099 external/wpt/webstorage/storage_setitem.html [ Pass Timeout ] crbug.com/591099 external/wpt/webusb/usb-allowed-by-feature-policy.https.sub.html [ Pass ] crbug.com/591099 external/wpt/webusb/usb-disabled-by-feature-policy.https.sub.html [ Pass ] @@ -2289,7 +2248,7 @@ crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/font_properties.html [ Failure ] crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/font_shorthand.html [ Failure ] crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/italic_object/italic_animation_with_timestamp.html [ Pass ] -crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/italic_object/italic_font_properties.html [ Failure Pass ] +crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/italic_object/italic_font_properties.html [ Failure ] crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/italic_object/italic_font_shorthand.html [ Failure ] crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/italic_object/italic_white-space_pre_wrapped.html [ Pass ] crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/text-decoration_underline.html [ Pass ] @@ -2297,7 +2256,7 @@ crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/underline_object/underline_font_shorthand.html [ Failure ] crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/underline_object/underline_text-shadow.html [ Pass ] crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/voice_object/voice_font_properties.html [ Failure ] -crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/voice_object/voice_font_shorthand.html [ Failure Pass ] +crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/voice_object/voice_font_shorthand.html [ Failure ] crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/voice_object/voice_voice_attribute.html [ Pass ] crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/voice_object/voice_with_class.html [ Pass ] crbug.com/591099 external/wpt/workers/Worker_terminate_event_queue.htm [ Timeout ] @@ -2414,7 +2373,6 @@ crbug.com/591099 fast/block/positioning/relative-overflow-replaced.html [ Failure ] crbug.com/591099 fast/block/positioning/rtl-static-positioning.html [ Failure ] crbug.com/591099 fast/block/positioning/table-cell-static-position.html [ Failure ] -crbug.com/591099 fast/block/positioning/trailing-space-test.html [ Failure ] crbug.com/591099 fast/block/positioning/vertical-rl/002.html [ Failure ] crbug.com/591099 fast/body-propagation/background-image/003-declarative.xhtml [ Failure Pass ] crbug.com/591099 fast/body-propagation/background-image/004-declarative.xhtml [ Failure Pass ] @@ -2481,7 +2439,7 @@ crbug.com/591099 fast/box-shadow/scaled-box-shadow.html [ Failure ] crbug.com/591099 fast/box-shadow/spread.html [ Failure Pass ] crbug.com/591099 fast/box-shadow/transform-fringing.html [ Failure Pass ] -crbug.com/591099 fast/box-sizing/replaced.html [ Failure ] +crbug.com/591099 fast/box-sizing/replaced.html [ Failure Pass ] crbug.com/591099 fast/canvas-api/toDataURL-supportedTypes.html [ Failure ] crbug.com/591099 fast/canvas/canvas-drawImage-animated-images.html [ Failure ] crbug.com/591099 fast/canvas/canvas-measure-bidi-text.html [ Failure ] @@ -2631,7 +2589,7 @@ crbug.com/591099 fast/css-grid-layout/minmax-min-content-column-resolution-rows.html [ Failure ] crbug.com/591099 fast/css-grid-layout/minmax-spanning-resolution-columns.html [ Failure ] crbug.com/591099 fast/css-grid-layout/minmax-spanning-resolution-rows.html [ Failure ] -crbug.com/591099 fast/css-grid-layout/named-grid-line-get-set.html [ Timeout ] +crbug.com/591099 fast/css-grid-layout/named-grid-line-get-set.html [ Pass Timeout ] crbug.com/591099 fast/css-grid-layout/named-grid-lines-with-named-grid-areas-dynamic-get-set.html [ Failure ] crbug.com/591099 fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution.html [ Failure ] crbug.com/591099 fast/css-grid-layout/percent-grid-item-in-percent-grid-track-in-percent-grid.html [ Failure ] @@ -2790,7 +2748,7 @@ crbug.com/591099 fast/css/image-orientation/image-orientation-from-image-composited.html [ Failure ] crbug.com/591099 fast/css/image-orientation/image-orientation-from-image.html [ Failure ] crbug.com/591099 fast/css/import-rule-regression-11590.html [ Failure ] -crbug.com/591099 fast/css/import_with_baseurl.html [ Failure ] +crbug.com/591099 fast/css/import_with_baseurl.html [ Failure Pass ] crbug.com/591099 fast/css/inline-element-line-break.html [ Failure Pass ] crbug.com/591099 fast/css/inline-properties-important.html [ Failure Pass ] crbug.com/591099 fast/css/inline-table-empty-non-auto.html [ Failure ] @@ -3166,7 +3124,7 @@ crbug.com/591099 fast/events/media-element-focus-tab.html [ Failure ] crbug.com/591099 fast/events/menu-key-context-menu-document-pinch-zoom.html [ Failure ] crbug.com/714962 fast/events/middleClickAutoscroll-latching.html [ Pass Timeout ] -crbug.com/714962 fast/events/mouse-down-on-pseudo-element-remove-crash.html [ Failure Pass ] +crbug.com/714962 fast/events/mouse-down-on-pseudo-element-remove-crash.html [ Failure ] crbug.com/591099 fast/events/mouse-drag-from-frame-to-other-frame.html [ Failure ] crbug.com/591099 fast/events/mouse-event-buttons-attribute.html [ Timeout ] crbug.com/714962 fast/events/mouse-events-on-textarea-resize.html [ Failure Pass ] @@ -5218,7 +5176,7 @@ crbug.com/591099 http/tests/security/local-JavaScript-from-remote.html [ Failure ] crbug.com/591099 http/tests/security/local-iFrame-from-remote.html [ Failure ] crbug.com/591099 http/tests/security/local-image-from-remote.html [ Failure ] -crbug.com/591099 http/tests/security/setDomainRelaxationForbiddenForURLScheme.html [ Crash ] +crbug.com/591099 http/tests/security/setDomainRelaxationForbiddenForURLScheme.html [ Crash Pass ] crbug.com/591099 http/tests/security/shape-image-cors-allow-origin.html [ Failure ] crbug.com/591099 http/tests/security/shape-image-cors-data-url.html [ Failure ] crbug.com/591099 http/tests/security/shape-image-cors-same-origin.html [ Failure ] @@ -6163,7 +6121,7 @@ crbug.com/591099 storage/indexeddb/cursor-advance.html [ Pass Timeout ] crbug.com/591099 storage/indexeddb/cursor-continue-validity.html [ Timeout ] crbug.com/591099 storage/indexeddb/cursor-key-order.html [ Timeout ] -crbug.com/591099 storage/indexeddb/cursor-update.html [ Pass Timeout ] +crbug.com/591099 storage/indexeddb/cursor-update.html [ Timeout ] crbug.com/591099 storage/indexeddb/deleted-objects.html [ Timeout ] crbug.com/714962 storage/indexeddb/empty-blob-file.html [ Failure Pass ] crbug.com/591099 storage/indexeddb/exceptions.html [ Timeout ] @@ -6240,7 +6198,7 @@ crbug.com/714962 svg/as-background-image/svg-as-background-body.html [ Failure ] crbug.com/591099 svg/as-background-image/svg-as-background-with-relative-size.html [ Failure Pass ] crbug.com/591099 svg/as-background-image/svg-as-background-with-viewBox.html [ Failure Pass ] -crbug.com/591099 svg/as-background-image/svg-as-background.html [ Failure ] +crbug.com/591099 svg/as-background-image/svg-as-background.html [ Failure Pass ] crbug.com/591099 svg/as-background-image/svg-as-tiled-background.html [ Failure Pass ] crbug.com/591099 svg/as-border-image/svg-as-border-image-2.html [ Failure ] crbug.com/591099 svg/as-border-image/svg-as-border-image.html [ Failure ] @@ -6335,7 +6293,7 @@ crbug.com/714962 svg/dynamic-updates/SVGMaskElement-svgdom-x-prop.html [ Failure Pass ] crbug.com/714962 svg/dynamic-updates/SVGMaskElement-svgdom-y-prop.html [ Failure Pass ] crbug.com/591099 svg/filters/feTurbulence-bad-seeds.html [ Failure ] -crbug.com/591099 svg/foreign-object-under-shadow-root-under-hidden.html [ Failure Timeout ] +crbug.com/591099 svg/foreign-object-under-shadow-root-under-hidden.html [ Failure ] crbug.com/591099 svg/foreignObject/background-render-phase.html [ Failure Pass ] crbug.com/591099 svg/foreignObject/clip.html [ Failure Pass ] crbug.com/591099 svg/foreignObject/filter.html [ Failure Pass ] @@ -6372,7 +6330,7 @@ crbug.com/591099 svg/parser/whitespace-length-invalid-1.html [ Pass Timeout ] crbug.com/591099 svg/parser/whitespace-length-invalid-2.html [ Pass Timeout ] crbug.com/591099 svg/parser/whitespace-length-invalid-3.html [ Pass Timeout ] -crbug.com/591099 svg/parser/whitespace-length-invalid-4.html [ Timeout ] +crbug.com/591099 svg/parser/whitespace-length-invalid-4.html [ Pass Timeout ] crbug.com/591099 svg/parser/whitespace-number.html [ Timeout ] crbug.com/591099 svg/text/bbox-with-glyph-overflow-on-path.html [ Failure ] crbug.com/591099 svg/text/bbox-with-glyph-overflow-zoomed.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 394fc49..360f8418 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -290,7 +290,6 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/replaced-intrinsic-002.xht [ Failure ] ### virtual/layout_ng/external/wpt/css/CSS2/positioning -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/abspos-007.xht [ Failure ] crbug.com/704961 [ Mac ] virtual/layout_ng/external/wpt/css/CSS2/positioning/abspos-027.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/position-relative-035.xht [ Failure ] @@ -1061,7 +1060,7 @@ crbug.com/492664 external/wpt/css/css-writing-modes/clip-rect-vrl-008.xht [ Failure ] crbug.com/492664 external/wpt/css/css-writing-modes/line-box-direction-vrl-009.xht [ Failure ] -crbug.com/813545 [ Win7 ] media/video-transformed.html [ Pass Failure ] +crbug.com/813545 [ Win7 Mac ] media/video-transformed.html [ Pass Failure ] crbug.com/637255 [ Win10 ] media/video-transformed.html [ Pass Failure ] # These tests pass but images do not match because tests are stricter than the spec. @@ -1190,6 +1189,7 @@ crbug.com/662010 [ Win7 ] http/tests/csspaint/invalidation-background-image.html [ Skip ] crbug.com/807152 vr/VRDisplay_rAF_fires_with_window_rAF.html [ Pass Failure ] +crbug.com/813697 [ Win7 ] vr/getFrameData_oneframeupdate.html [ Pass Failure ] # These tests are skipped as there is no touch support on Mac. crbug.com/613672 [ Mac ] fast/events/touch/multi-touch-user-gesture.html [ Skip ] @@ -1705,6 +1705,7 @@ crbug.com/805463 external/wpt/acid/acid3/numbered-tests.html [ Skip ] # ====== New tests from wpt-importer added here ====== +crbug.com/626703 [ Retina ] external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-intrinsic-ratio-003v.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-intrinsic-ratio-006v.html [ Failure ] crbug.com/626703 external/wpt/css/css-fonts/font-variant-06.xht [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-intrinsic-ratio-001v.html [ Failure ] @@ -3030,6 +3031,7 @@ # Sheriff failures 2017-10-04 crbug.com/770691 [ Win7 Linux Mac10.11 ] media/controls/lazy-loaded-style.html [ Failure Pass ] crbug.com/770691 [ Win7 Linux Mac10.11 ] virtual/new-remote-playback-pipeline/media/controls/lazy-loaded-style.html [ Failure Pass ] +crbug.com/770691 [ Mac10.11 ] media/controls/repaint-on-resize.html [ Failure Pass ] crbug.com/807191 fast/media/mq-color-gamut-picture.html [ Pass Failure Timeout ] @@ -3136,7 +3138,7 @@ crbug.com/789533 virtual/gpu/fast/canvas/OffscreenCanvas-2d-imageSmoothing.html [ Pass Failure Timeout ] # Sheriff failures 2017-11-30 -crbug.com/789921 [ Win7 ] media/video-controls-overflow-menu-last-button-visible.html [ Pass Failure ] +crbug.com/789921 [ Win7 Mac ] media/video-controls-overflow-menu-last-button-visible.html [ Pass Failure ] crbug.com/789111 virtual/pwa-full-code-cache/http/tests/devtools/service-workers/service-worker-v8-cache.js [ Pass Failure Timeout ] crbug.com/790025 virtual/gpu-rasterization/images/image-hover-display-alt.html [ Failure Pass ] @@ -3283,6 +3285,12 @@ # End of Root Layer Scrolling expectations ################################################################################ +crbug.com/813775 external/wpt/service-workers/service-worker/multipart-image.https.html [ Pass Failure ] +crbug.com/813775 virtual/outofblink-cors/external/wpt/service-workers/service-worker/multipart-image.https.html [ Pass Failure ] +crbug.com/813775 virtual/navigation-mojo-response/external/wpt/service-workers/service-worker/multipart-image.https.html [ Pass Failure ] + +crbug.com/813468 [ Mac ] virtual/navigation-mojo-response/http/tests/serviceworker/chromium/memory-cache.html [ Failure Pass ] + # TODO(ricea): Remove these once fetch abort implementation is complete crbug.com/750599 external/wpt/fetch/api/abort/general-serviceworker.https.html [ Timeout ] crbug.com/750599 external/wpt/fetch/api/abort/general-sharedworker.html [ Timeout ] @@ -3310,3 +3318,8 @@ crbug.com/812941 [ Win7 ] external/wpt/css/css-multicol/multicol-rule-color-inherit-001.xht [ Failure Pass ] crbug.com/812941 [ Win7 ] external/wpt/css/css-multicol/multicol-span-all-margin-nested-firstchild-001.xht [ Failure Pass ] crbug.com/812941 [ Win7 ] external/wpt/css/css-multicol/multicol-table-cell-vertical-align-001.xht [ Failure Pass ] + +crbug.com/813704 [ Win7 Mac ] http/tests/images/png-partial-load-as-document.html [ Failure Pass ] + +# TODO(rakuco): Remove after the corresponding bug is solved on the infra side. +crbug.com/813762 external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/javascript-url-abort-return-value-string.tentative.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/accessibility/aom-computed-accessible-node.html b/third_party/WebKit/LayoutTests/accessibility/aom-computed-accessible-node.html index 9078d87..fa19d854 100644 --- a/third_party/WebKit/LayoutTests/accessibility/aom-computed-accessible-node.html +++ b/third_party/WebKit/LayoutTests/accessibility/aom-computed-accessible-node.html
@@ -19,19 +19,17 @@ assert_true(internals.runtimeFlags.accessibilityObjectModelEnabled); }, "Make sure that Accessibility Object Model is enabled"); -test(async function(test) { - var element = document.getElementById("button1"); - var computedAXNode = await window.getComputedAccessibleNode(element) +promise_test(async t => { + const element = document.getElementById("button1"); + let computedAXNode = await getComputedAccessibleNode(element); assert_true(computedAXNode != null); }, 'Ensure that a non null value is returned from getComputedAccessibleNode'); - -test(async function(test) { - var element = document.getElementById("button1"); - - var computedAXNode1 = await window.getComputedAccessibleNode(element); - var computedAXNode2 = await window.getComputedAccessibleNode(element); - assert_true(computedAXNode1 === computedAXNode2); +promise_test(async t => { + const element = document.getElementById("button1"); + let computedAXNode1 = await getComputedAccessibleNode(element); + let computedAXNode2 = await getComputedAccessibleNode(element); + assert_false(computedAXNode1 === computedAXNode2); }, "Multiple calls to getComputedAccessibleNode will return the same node."); </script> @@ -39,9 +37,9 @@ <script> -test(async function(test) { +promise_test(async t => { var button1 = document.getElementById("button1"); - var button1CAXNode = await window.getComputedAccessibleNode(button1); + let button1CAXNode = await getComputedAccessibleNode(button1); assert_equals(button1CAXNode.name, "Click"); assert_equals(button1CAXNode.role, "button"); @@ -49,8 +47,7 @@ button1.style.display = "none"; var button2 = document.getElementById("button2"); - var button2CAXNode = await window.getComputedAccessibleNode(button2); - + let button2CAXNode = await getComputedAccessibleNode(button2); assert_equals(button2CAXNode.name, "axButton"); assert_equals(button2CAXNode.role, "button"); @@ -69,7 +66,7 @@ <script> -async_test(async function(test) { +promise_test(async function(test) { var radio1 = document.getElementById("radio1"); var caxNode1 = await window.getComputedAccessibleNode(radio1); var radio2 = document.getElementById("radio2"); @@ -93,8 +90,6 @@ caxNode1.ensureUpToDate(); assert_equals(caxNode1.name, "pasta"); - - test.done(); }, "ComputedAccessibleNode.ensureUpToDate");
diff --git a/third_party/WebKit/LayoutTests/accessibility/aom-computed-boolean-properties.html b/third_party/WebKit/LayoutTests/accessibility/aom-computed-boolean-properties.html index a4e32de1..573f29a 100644 --- a/third_party/WebKit/LayoutTests/accessibility/aom-computed-boolean-properties.html +++ b/third_party/WebKit/LayoutTests/accessibility/aom-computed-boolean-properties.html
@@ -11,7 +11,7 @@ --> -<div id="aria-atomic" aria-atomic="true">POD</div> +<div id="aria-atomic" aria-live="polite" aria-atomic="true">POD</div> <div id="alert-atomic" role="alert">Achtung!</div> <script> @@ -20,7 +20,7 @@ assert_true(internals.runtimeFlags.accessibilityObjectModelEnabled); }, "Make sure that Accessibility Object Model is enabled"); -test(async function(t) { +promise_test(async function(t) { // atomic attribute is implicitly set for role=alert. var divElement = document.getElementById("aria-atomic"); var alertElement = document.getElementById("alert-atomic");
diff --git a/third_party/WebKit/LayoutTests/accessibility/aom-computed-int-properties.html b/third_party/WebKit/LayoutTests/accessibility/aom-computed-int-properties.html index 9b0a224..19a2887 100644 --- a/third_party/WebKit/LayoutTests/accessibility/aom-computed-int-properties.html +++ b/third_party/WebKit/LayoutTests/accessibility/aom-computed-int-properties.html
@@ -23,7 +23,7 @@ assert_true(internals.runtimeFlags.accessibilityObjectModelEnabled); }, "Make sure that Accessibility Object Model is enabled"); -test(async function(test) { +promise_test(async function(test) { var element = document.getElementById("no-int-props"); computedAXNode = await window.getComputedAccessibleNode(element); assert_equals(computedAXNode.role, "button"); @@ -38,7 +38,7 @@ assert_equals(computedAXNode.setSize, null); }, "computedAccessibleNode has nullable int properties."); -test(async function(test) { +promise_test(async function(test) { var listitem = document.getElementById("listitem"); computedAXNode = await window.getComputedAccessibleNode(listitem); assert_equals(computedAXNode.posInSet, 3); @@ -53,7 +53,7 @@ <script> -test(async function(test) { +promise_test(async function(test) { var heading1 = document.getElementById("first-heading"); var heading2 = document.getElementById("second-heading"); var heading3 = document.getElementById("third-heading");
diff --git a/third_party/WebKit/LayoutTests/accessibility/aom-computed-relation-accessors.html b/third_party/WebKit/LayoutTests/accessibility/aom-computed-relation-accessors.html index 887b67e5..5d35217b 100644 --- a/third_party/WebKit/LayoutTests/accessibility/aom-computed-relation-accessors.html +++ b/third_party/WebKit/LayoutTests/accessibility/aom-computed-relation-accessors.html
@@ -23,37 +23,34 @@ assert_true(internals.runtimeFlags.accessibilityObjectModelEnabled); }, "Make sure that Accessibility Object Model is enabled"); -test(async function(test) { +promise_test(async function(test) { var element = document.getElementById("option1"); var computedAXNode = await window.getComputedAccessibleNode(element); var computedParent = computedAXNode.parent; assert_false(computedParent === null); assert_equals(computedParent.name, "container"); - assert_true(computedParent.firstChild === computedAXNode); - - // Parent of listbox should be null. - assert_equals(computedParent.parent, null); + // TODO(meredithl): assert_true(computedParent.firstChild === computedAXNode); }, "ComputedAccessibleNode.parent."); -test(async function(test) { +promise_test(async function(test) { var element = document.getElementById("listbox"); var computedAXNode = await window.getComputedAccessibleNode(element); var computedChild = computedAXNode.firstChild assert_false(computedChild === null); assert_equals(computedChild.name, "Option 1"); - assert_true(computedChild.parent === computedAXNode); + // TODO(meredithl): assert_true(computedChild.parent === computedAXNode); }, "ComputedAccessibleNode.firstChild."); -test(async function(test) { +promise_test(async function(test) { var element = document.getElementById("listbox"); var computedAXNode = await window.getComputedAccessibleNode(element); var computedChild = computedAXNode.lastChild; assert_false(computedChild === null); assert_equals(computedChild.name, "Option 3"); - assert_true(computedChild.parent === computedAXNode); + // TODO(meredithl): assert_true(computedChild.parent === computedAXNode); }, "ComputedAccessibleNode.lastChild."); -test(async function(test) { +promise_test(async function(test) { var element = document.getElementById("option2"); var computedAXNode = await window.getComputedAccessibleNode(element); var computedSibling = computedAXNode.previousSibling; @@ -62,10 +59,10 @@ // Check that a call to non-existant sibling is null. assert_equals(computedSibling.previousSibling, null); - assert_true(computedSibling.nextSibling === computedAXNode); + // TODO(meredithl): assert_true(computedSibling.nextSibling === computedAXNode); }, "ComputedAccessibleNode.previousSibling"); -test(async function(test) { +promise_test(async function(test) { var element = document.getElementById("option2"); var computedAXNode = await window.getComputedAccessibleNode(element); var computedSibling = computedAXNode.nextSibling; @@ -74,7 +71,7 @@ // Check that a call to non-existant sibling is null. assert_equals(computedSibling.nextSibling, null); - assert_true(computedSibling.previousSibling === computedAXNode); + // TODO(meredithl): assert_true(computedSibling.previousSibling === computedAXNode); }, "ComputedAccessibleNode.nextSibling"); </script>
diff --git a/third_party/WebKit/LayoutTests/accessibility/aom-computed-string-properties.html b/third_party/WebKit/LayoutTests/accessibility/aom-computed-string-properties.html index 6787e60..bf82835 100644 --- a/third_party/WebKit/LayoutTests/accessibility/aom-computed-string-properties.html +++ b/third_party/WebKit/LayoutTests/accessibility/aom-computed-string-properties.html
@@ -19,13 +19,13 @@ assert_true(internals.runtimeFlags.accessibilityObjectModelEnabled); }, "Make sure that Accessibility Object Model is enabled"); -test(async function(test) { +promise_test(async function(test) { var element = document.getElementById("button1"); var computedAXNode = await window.getComputedAccessibleNode(element); assert_equals(computedAXNode.role, "button"); }, "ComputedAccessibleNode.role"); -test(async function(test) { +promise_test(async function(test) { var element = document.getElementById("button1"); var computedAXNode = await window.getComputedAccessibleNode(element); assert_equals(computedAXNode.name, "Click"); @@ -37,7 +37,7 @@ <script> -test(async function(test) { +promise_test(async function(test) { var element = document.getElementById("button2"); var computedAXNode = await window.getComputedAccessibleNode(element); assert_equals(computedAXNode.name, "axButton"); @@ -49,7 +49,7 @@ <script> -test(async function(test) { +promise_test(async function(test) { var element = document.getElementById("shortcut"); var computedAXNode = await window.getComputedAccessibleNode(element); assert_equals(computedAXNode.keyShortcuts, "Alt+Shift+P"); @@ -61,7 +61,7 @@ <script> -test(async function(test) { +promise_test(async function(test) { var element = document.getElementById("fullname"); computedAXNode = await window.getComputedAccessibleNode(element); assert_equals(computedAXNode.placeholder, "Jordan Doe"); @@ -73,7 +73,7 @@ <script> -test(async function(test) { +promise_test(async function(test) { var element = document.getElementById("button3"); computedAXNode = await window.getComputedAccessibleNode(element); assert_equals(computedAXNode.role, "button"); @@ -86,7 +86,7 @@ <input id="no-autocomplete" role="combobox" aria-autocomplete="none"></input> <script> -test(async function(test) { +promise_test(async function(test) { var bothElement = document.getElementById("both-autocomplete"); var noneElement = document.getElementById("no-autocomplete"); var bothCAXNode = await window.getComputedAccessibleNode(bothElement);
diff --git a/third_party/WebKit/LayoutTests/custom-elements/spec/create-element.html b/third_party/WebKit/LayoutTests/custom-elements/spec/create-element.html index 3fc2a4ea..c1d78cb7 100644 --- a/third_party/WebKit/LayoutTests/custom-elements/spec/create-element.html +++ b/third_party/WebKit/LayoutTests/custom-elements/spec/create-element.html
@@ -11,7 +11,6 @@ // 1. If localName does not match the Name production, then throw an InvalidCharacterError // 2. If context object is an HTML document, let localName be converted to ASCII lowercase // 5. If 'is' is non-null and definition is null, then throw a NotFoundError -// 6. If 'is' is non-null, then set is attribute to 'is' // https://dom.spec.whatwg.org/#internal-createelementns-steps // 4. If 'is' is non-null and definition is null, then throw a NotFoundError @@ -73,12 +72,6 @@ test_with_window((w) => { setup(w); - assert_equals(w.document.createElement('a-a').getAttribute('is'), null); - assert_equals(w.document.createElement('div', {is : 'b-b'}).getAttribute('is'), 'b-b'); -}, 'createElement 6. If \'is\' is non-null, then set is-attribute to \'is\''); - -test_with_window((w) => { - setup(w); assert_equals(w.document.createElementNS('http://www.w3.org/1999/xhtml', 'a-A').constructor, w.HTMLElement); assert_true(w.document.createElementNS('http://www.w3.org/1999/xhtml', 'dIv', {is: 'b-b'}) instanceof w.HTMLUnknownElement); }, 'createElementNS 4. If \'is\' is non-null and definition is null, then throw a NotFoundError');
diff --git a/third_party/WebKit/LayoutTests/editing/deleting/delete_only_secondlast_item.html b/third_party/WebKit/LayoutTests/editing/deleting/delete_only_secondlast_item.html new file mode 100644 index 0000000..8e6b915 --- /dev/null +++ b/third_party/WebKit/LayoutTests/editing/deleting/delete_only_secondlast_item.html
@@ -0,0 +1,33 @@ +<!DOCTYPE html> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="../assert_selection.js"></script> +<script> +selection_test( + [ + '<div contenteditable="true">', + '<table>', + '<tr><td>', + '<li></li>', + '<li>|</li>', + '</td></tr>', + '</table>', + '</div>' + ], + 'Delete', + [ + '<div contenteditable="true">', + '<table>', + '<tbody>', + '<tr><td>', + '<li>', + '<br>|<br>', + '</li>', + '</td></tr>', + '</tbody>', + '</table>', + '</div>' + ], + 'Deleting last item in two element table list, should not delete the table.'); +</script> +
diff --git a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json index 1c3ed11..f398093 100644 --- a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json +++ b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json
@@ -128204,6 +128204,11 @@ {} ] ], + "custom-elements/parser/serializing-html-fragments-expected.txt": [ + [ + {} + ] + ], "custom-elements/reactions/resources/reactions.js": [ [ {} @@ -132184,6 +132189,16 @@ {} ] ], + "html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/support/iframe-and-links.html": [ + [ + {} + ] + ], + "html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/support/set-child-loaded.html": [ + [ + {} + ] + ], "html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-form-submit-1.html": [ [ {} @@ -153319,6 +153334,11 @@ {} ] ], + "streams/readable-byte-streams/construct-byob-request.js": [ + [ + {} + ] + ], "streams/readable-byte-streams/detached-buffers-expected.txt": [ [ {} @@ -176566,12 +176586,6 @@ {} ] ], - "css/css-typed-om/styleMap-update-function.html": [ - [ - "/css/css-typed-om/styleMap-update-function.html", - {} - ] - ], "css/css-typed-om/stylevalue-normalization/normalize-ident.tentative.html": [ [ "/css/css-typed-om/stylevalue-normalization/normalize-ident.tentative.html", @@ -176932,6 +176946,12 @@ {} ] ], + "css/css-typed-om/the-stylepropertymap/declared/clear.html": [ + [ + "/css/css-typed-om/the-stylepropertymap/declared/clear.html", + {} + ] + ], "css/css-typed-om/the-stylepropertymap/declared/declared.tentative.html": [ [ "/css/css-typed-om/the-stylepropertymap/declared/declared.tentative.html", @@ -176992,18 +177012,18 @@ {} ] ], - "css/css-typed-om/the-stylepropertymap/declared/update.tentative.html": [ - [ - "/css/css-typed-om/the-stylepropertymap/declared/update.tentative.html", - {} - ] - ], "css/css-typed-om/the-stylepropertymap/inline/append.tentative.html": [ [ "/css/css-typed-om/the-stylepropertymap/inline/append.tentative.html", {} ] ], + "css/css-typed-om/the-stylepropertymap/inline/clear.html": [ + [ + "/css/css-typed-om/the-stylepropertymap/inline/clear.html", + {} + ] + ], "css/css-typed-om/the-stylepropertymap/inline/delete-invalid.html": [ [ "/css/css-typed-om/the-stylepropertymap/inline/delete-invalid.html", @@ -177058,12 +177078,6 @@ {} ] ], - "css/css-typed-om/the-stylepropertymap/inline/update.tentative.html": [ - [ - "/css/css-typed-om/the-stylepropertymap/inline/update.tentative.html", - {} - ] - ], "css/css-typed-om/the-stylepropertymap/properties/animation-direction.html": [ [ "/css/css-typed-om/the-stylepropertymap/properties/animation-direction.html", @@ -185638,6 +185652,18 @@ {} ] ], + "html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/javascript-url-abort-return-value-string.tentative.html": [ + [ + "/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/javascript-url-abort-return-value-string.tentative.html", + {} + ] + ], + "html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/javascript-url-abort-return-value-undefined.tentative.html": [ + [ + "/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/javascript-url-abort-return-value-undefined.tentative.html", + {} + ] + ], "html/browsers/browsing-the-web/navigating-across-documents/javascript-url-global-scope.html": [ [ "/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-global-scope.html", @@ -220484,6 +220510,30 @@ {} ] ], + "streams/readable-byte-streams/construct-byob-request.dedicatedworker.html": [ + [ + "/streams/readable-byte-streams/construct-byob-request.dedicatedworker.html", + {} + ] + ], + "streams/readable-byte-streams/construct-byob-request.html": [ + [ + "/streams/readable-byte-streams/construct-byob-request.html", + {} + ] + ], + "streams/readable-byte-streams/construct-byob-request.serviceworker.https.html": [ + [ + "/streams/readable-byte-streams/construct-byob-request.serviceworker.https.html", + {} + ] + ], + "streams/readable-byte-streams/construct-byob-request.sharedworker.html": [ + [ + "/streams/readable-byte-streams/construct-byob-request.sharedworker.html", + {} + ] + ], "streams/readable-byte-streams/detached-buffers.dedicatedworker.html": [ [ "/streams/readable-byte-streams/detached-buffers.dedicatedworker.html", @@ -243088,7 +243138,7 @@ "support" ], "beacon/headers/header-content-type.html": [ - "86ea95acb53498323dde13266834bb4bd2f3ad35", + "aee7b4c817f064e871d10cc80da8d25759c16158", "testharness" ], "beacon/headers/header-referrer-no-referrer-when-downgrade.https-expected.txt": [ @@ -292828,7 +292878,7 @@ "testharness" ], "css/css-typed-om/interfaces-expected.txt": [ - "52ab62361e79d1f2c99a6da847ca6640c6cad954", + "4f24bb5c6861e8c039229bef04df9abdc74c9981", "support" ], "css/css-typed-om/interfaces.html": [ @@ -292843,10 +292893,6 @@ "4465d71eb78c55793d0fb9929cb50b658effde4e", "support" ], - "css/css-typed-om/styleMap-update-function.html": [ - "a1dee75d914b68753af742ce8e6dbbac0397a9a6", - "testharness" - ], "css/css-typed-om/stylevalue-normalization/normalize-ident.tentative.html": [ "162ce70613e78bb007ea24ea525ec78ef17cd3bd", "testharness" @@ -292908,7 +292954,7 @@ "testharness" ], "css/css-typed-om/stylevalue-serialization/cssTransformValue.tentative.html": [ - "3026dd75aeafc3c2119953e813fba0ff8c401d4d", + "b9f6251545dfbce6ab0e5e971dee8e8f0480024e", "testharness" ], "css/css-typed-om/stylevalue-serialization/cssUnitValue.tentative.html": [ @@ -292980,7 +293026,7 @@ "testharness" ], "css/css-typed-om/stylevalue-subclasses/cssTransformValue.tentative.html": [ - "ff3980baee17a3ef3b692854169d89c1983226db", + "8e93576c2420beeea12d4e6268fb830df2bf8969", "testharness" ], "css/css-typed-om/stylevalue-subclasses/cssTranslate.tentative.html": [ @@ -292988,7 +293034,7 @@ "testharness" ], "css/css-typed-om/stylevalue-subclasses/cssUnparsedValue.html": [ - "16725f5047477a1a8837e464935af3da0a01deb2", + "46d36ae2dc68f3f3f1cee5d85cb5f496b7c3fa67", "testharness" ], "css/css-typed-om/stylevalue-subclasses/cssUrlImageValue-interface.html": [ @@ -293111,6 +293157,10 @@ "6a408857cd88d03a4a00ee2127a3825380d2565f", "testharness" ], + "css/css-typed-om/the-stylepropertymap/declared/clear.html": [ + "4371bc63c151b5c93d070543d2bde6fa79c01fec", + "testharness" + ], "css/css-typed-om/the-stylepropertymap/declared/declared.tentative.html": [ "7a6bbc1b04f6d1ee82332ddbf58a27604645a86b", "testharness" @@ -293151,14 +293201,14 @@ "23c875b8bb41344e9c4ffc0753f8f8fb36171d8b", "testharness" ], - "css/css-typed-om/the-stylepropertymap/declared/update.tentative.html": [ - "797aeb1b92addefc6bb5e76c6939a9a2d3a4de97", - "testharness" - ], "css/css-typed-om/the-stylepropertymap/inline/append.tentative.html": [ "df640de5b24c8276459a1a7fbc8a02cc97db6223", "testharness" ], + "css/css-typed-om/the-stylepropertymap/inline/clear.html": [ + "c05f6fc32157d61f4a391ac5cd5c1e334c8e2329", + "testharness" + ], "css/css-typed-om/the-stylepropertymap/inline/delete-invalid.html": [ "df4903a2c18099bb5291a307f50778ee757824ed", "testharness" @@ -293195,10 +293245,6 @@ "68095148a2ede91974f5df04d29a64bcad3ab2f6", "testharness" ], - "css/css-typed-om/the-stylepropertymap/inline/update.tentative.html": [ - "197b30d860a97f20a8c25a5357f5b2e096c7b2fd", - "testharness" - ], "css/css-typed-om/the-stylepropertymap/interface-expected.txt": [ "b0486af1b6c199f18c32658ab24fc3925c3b41a3", "support" @@ -293216,7 +293262,7 @@ "testharness" ], "css/css-typed-om/the-stylepropertymap/properties/border-width.html": [ - "9a3cb4f96aa14f9a63261434ec46331447821965", + "1383d1d87c7128b3059162d344f26586049a6460", "testharness" ], "css/css-typed-om/the-stylepropertymap/properties/bottom.html": [ @@ -293228,7 +293274,7 @@ "testharness" ], "css/css-typed-om/the-stylepropertymap/properties/height.html": [ - "aa7fdef188168368bbf8d867c96712bb9c77d857", + "36b8677eb45f8555da4381e1644624df2f2060e0", "testharness" ], "css/css-typed-om/the-stylepropertymap/properties/left.html": [ @@ -293244,7 +293290,7 @@ "testharness" ], "css/css-typed-om/the-stylepropertymap/properties/padding.html": [ - "45d4a9a76054d2f867c28e7cda8f006d90551770", + "70c2e29badef7528469bcf11e1cb7bbc6cd519ea", "testharness" ], "css/css-typed-om/the-stylepropertymap/properties/position.html": [ @@ -293252,7 +293298,7 @@ "testharness" ], "css/css-typed-om/the-stylepropertymap/properties/resources/testsuite.js": [ - "47c67533580e1b1a1e6e2c7cdc7a1d94bc3d40f6", + "3ac46f9655cf07f63761850d38eb0c0cebdd98bf", "support" ], "css/css-typed-om/the-stylepropertymap/properties/right.html": [ @@ -293292,7 +293338,7 @@ "testharness" ], "css/css-typed-om/the-stylepropertymap/properties/width.html": [ - "b6f2104ac9a5a4e288b83e5d4db6077ba72a0bad", + "d429f7a88012179ef3d604b79b3db4aaba0ca426", "testharness" ], "css/css-typed-om/the-stylepropertymap/properties/z-index.html": [ @@ -308731,6 +308777,10 @@ "a62669ffcc75d54df38b65e33463566238c8644c", "testharness" ], + "custom-elements/parser/serializing-html-fragments-expected.txt": [ + "9330e0e726c1f9c124b64375a8f927f2fa7c05c6", + "support" + ], "custom-elements/parser/serializing-html-fragments.html": [ "cee443e8fbf77d347a7d97fdbdf497af2181d2c1", "testharness" @@ -309640,7 +309690,7 @@ "testharness" ], "dom/nodes/Document-importNode.html": [ - "32984edec25513c574054959e6a96e8cd1b3805f", + "f964472c2c036a4718bdbf216a0e7da31bc7ec1d", "testharness" ], "dom/nodes/DocumentType-literal-xhtml.xhtml": [ @@ -314920,7 +314970,7 @@ "support" ], "fetch/nosniff/script.html": [ - "cfbd6d0996251d5f311a70d889af3a11552eb844", + "aae78384af3ed1871602eac5a5fa26467d997578", "testharness" ], "fetch/nosniff/stylesheet.html": [ @@ -316099,6 +316149,22 @@ "3842ac825b9fb33d0d95ef99f77c8c7d02a88e9a", "support" ], + "html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/javascript-url-abort-return-value-string.tentative.html": [ + "62b5dc2524966d41e734c778932504dfa18fc132", + "testharness" + ], + "html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/javascript-url-abort-return-value-undefined.tentative.html": [ + "97ab442d3d409bb73851a334f5ba28824fd6224d", + "testharness" + ], + "html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/support/iframe-and-links.html": [ + "ef3648a44ec979ebdb6fbd55a4cd9757855ed2d6", + "support" + ], + "html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/support/set-child-loaded.html": [ + "b7be55c8262599acc8abad9ce403c945284008ae", + "support" + ], "html/browsers/browsing-the-web/navigating-across-documents/javascript-url-global-scope.html": [ "d678c54e2c20d5f240fd68790ea4e03512db2c8a", "testharness" @@ -335248,7 +335314,7 @@ "support" ], "interfaces/css-typed-om.idl": [ - "de163687e4848c63126511aff81a80eabe2cd9c0", + "2bfd527a102cce31448b33eec999db8607ab5ffd", "support" ], "interfaces/cssom-view.idl": [ @@ -357999,6 +358065,26 @@ "6f3911baf77e26af2d7e7d7472caae4df6d5a27e", "testharness" ], + "streams/readable-byte-streams/construct-byob-request.dedicatedworker.html": [ + "44f4d42b8a31c794b6252660f5cde8b0cbcc6fcb", + "testharness" + ], + "streams/readable-byte-streams/construct-byob-request.html": [ + "22d393a61721610e5f5fd4cd628a14fd6f08094b", + "testharness" + ], + "streams/readable-byte-streams/construct-byob-request.js": [ + "8d8167bc34049d473efb892c915efea4830d92d1", + "support" + ], + "streams/readable-byte-streams/construct-byob-request.serviceworker.https.html": [ + "79dbbe66a34ca531fc532e37f6c11483a917cf9e", + "testharness" + ], + "streams/readable-byte-streams/construct-byob-request.sharedworker.html": [ + "2a8a870d82e13cccac5b59de0ece4b8e9ff2775f", + "testharness" + ], "streams/readable-byte-streams/detached-buffers-expected.txt": [ "f2ddef38a426a9afa6a7b3c83fdd6cc041eba645", "support" @@ -358048,11 +358134,11 @@ "testharness" ], "streams/readable-byte-streams/general.html": [ - "9e349695974543b322e5c1447352e0ab4dc490e6", + "d459dc11abad3162f0c412f1346820541df38d53", "testharness" ], "streams/readable-byte-streams/general.js": [ - "8d37d5948078b71d3f80e3799ea0dd6d818e933b", + "a7262a490c4a913811c8d0c489b06a567a448fc6", "support" ], "streams/readable-byte-streams/general.serviceworker.https-expected.txt": [
diff --git a/third_party/WebKit/LayoutTests/external/wpt/cors/preflight-cache-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/cors/preflight-cache-expected.txt deleted file mode 100644 index 392f06d..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/cors/preflight-cache-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This is a testharness.js-based test. -PASS Test preflight -PASS preflight for x-print should be cached -PASS age = 0, should not be cached -FAIL age = -1, should not be cached assert_equals: did preflight expected "1" but got "0" -PASS preflight first request, second from cache, wait, third should preflight again -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/interfaces-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/interfaces-expected.txt index 54e2bfa..74ca24c 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/interfaces-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/interfaces-expected.txt
@@ -26,7 +26,7 @@ PASS StylePropertyMap interface: operation append(DOMString, [object Object],[object Object]) PASS StylePropertyMap interface: operation delete(DOMString) PASS StylePropertyMap interface: operation set(DOMString, [object Object],[object Object]) -PASS StylePropertyMap interface: operation update(DOMString, UpdateFunction) +PASS StylePropertyMap interface: operation clear() PASS CSSUnparsedValue interface: existence and properties of interface object PASS CSSUnparsedValue interface object length PASS CSSUnparsedValue interface object name
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/styleMap-update-function.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/styleMap-update-function.html deleted file mode 100644 index 19f6399..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/styleMap-update-function.html +++ /dev/null
@@ -1,17 +0,0 @@ -<!DOCTYPE html> -<meta charset="utf-8"> -<title>styleMap objects provide an 'update' function</title> -<meta name="author" title="Shane Stephens"> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<body> - <div id='element'></div> - <div id="log"></div> - <script> - test(function() { - element.attributeStyleMap.set('width', new CSSUnitValue(42, 'px')); - element.attributeStyleMap.update('width', length => new CSSUnitValue(length.value + 20, length.unit)) - assert_equals(element.attributeStyleMap.get('width').value, 62, 'update expected to apply callback to old value in map'); - }); - </script> -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/stylevalue-serialization/cssTransformValue.tentative.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/stylevalue-serialization/cssTransformValue.tentative.html index dc87e81..0184cbd 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/stylevalue-serialization/cssTransformValue.tentative.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/stylevalue-serialization/cssTransformValue.tentative.html
@@ -65,6 +65,11 @@ desc: 'CSSPerspective' }, { + value: new CSSPerspective(CSS.px(-1)), + cssText: 'perspective(calc(-1px))', + desc: 'CSSPerspective with negative length' + }, + { value: new CSSTransformValue([new CSSPerspective(CSS.px(1))]), cssText: 'perspective(1px)', desc: 'CSSTransformValue with a single transform'
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/stylevalue-subclasses/cssTransformValue.tentative.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/stylevalue-subclasses/cssTransformValue.tentative.html index bc1ace6..47dc05db 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/stylevalue-subclasses/cssTransformValue.tentative.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/stylevalue-subclasses/cssTransformValue.tentative.html
@@ -26,6 +26,39 @@ }, 'CSSTransformValue can be constructed with multiple transforms'); test(() => { + const values = [ + new CSSScale(1, 1), + new CSSTranslate(CSS.px(1), CSS.px(1)), + new CSSRotate(CSS.deg(90)) + ]; + + const transform = new CSSTransformValue(values); + assert_style_value_array_equals(transform, values); + + values.pop(); + var new_value = new CSSRotate(CSS.deg(45)); + values[2] = new_value; + transform[2] = new_value; + assert_style_value_array_equals(transform, values); +}, 'CSSTransformValue.set correctly sets the CSSTransformComponent at the given index'); + +test(() => { + const values = [ + new CSSScale(1, 1), + new CSSTranslate(CSS.px(1), CSS.px(1)), + new CSSRotate(CSS.deg(90)) + ]; + + const transform = new CSSTransformValue(values); + assert_style_value_array_equals(transform, values); + + var new_value = new CSSRotate(CSS.deg(45)); + values[3] = new_value; + transform[3] = new_value; + assert_style_value_array_equals(transform, values); +}, 'Setting a component in CSSTransformValue correctly appends the CSSTransformComponent if index specified is greater than length'); + +test(() => { const transform = new CSSTransformValue([ new CSSScale(1, 1), new CSSTranslate(CSS.px(1), CSS.px(1), CSS.px(1)),
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue.html index 8af27e1..f337032 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue.html
@@ -5,6 +5,7 @@ <meta name="assert" content="Test CSSUnparsedValue constructor and members"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> +<script src="../resources/testhelper.js"></script> <body> <div id="log"> <script> @@ -47,4 +48,44 @@ }, 'CSSUnparsedValue can be constructed from ' + description); } +test(() => { + let result = new CSSUnparsedValue([new CSSVariableReferenceValue('--foo')]); + + result[0] = 'A'; + assert_equals(result[0], 'A', 'Item should be updated to new value'); +}, 'Can update item in CSSUnparsedValue to a string'); + +test(() => { + let result = new CSSUnparsedValue(['foo']); + + result[0] = new CSSVariableReferenceValue('--A'); + assert_style_value_equals(result[0], new CSSVariableReferenceValue('--A'), + 'Item should be updated to new value'); +}, 'Can update item in CSSUnparsedValue to a variable reference'); + +test(() => { + let result = new CSSUnparsedValue([]); + + result[0] = new CSSVariableReferenceValue('--A'); + assert_equals(result.length, 1, + 'Length of CSSUnparsedValue should have increased'); + assert_style_value_equals(result[0], new CSSVariableReferenceValue('--A'), + 'New item should be appended'); + + result[1] = 'foo'; + assert_equals(result.length, 2, + 'Length of CSSUnparsedValue should have increased'); + assert_equals(result[1], 'foo', 'New item should be appended'); +}, 'Can append items to CSSUnparsedValue'); + +test(() => { + const result = new CSSUnparsedValue(['foo', 'bar']); + assert_equals(result[3], undefined); +}, 'Getting invalid index in CSSUnparsedValue returns undefined'); + +test(() => { + let result = new CSSUnparsedValue(['foo', 'bar']); + assert_throws(new RangeError(), () => result[3] = 'foo'); +}, 'Setting invalid index in CSSUnparsedValue throws RangeError'); + </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/declared/clear.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/declared/clear.html new file mode 100644 index 0000000..e6bdd4ff --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/declared/clear.html
@@ -0,0 +1,40 @@ +<!doctype html> +<meta charset="utf-8"> +<title>Declared StylePropertyMap.clear</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-clear"> +<meta name="assert" content="Test declared StylePropertyMap.clear" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +test(t => { + let styleMap = createInlineStyleMap(t, ''); + styleMap.clear(); + assert_array_equals([...styleMap], []); +}, 'Clearing an empty CSS rule is a no-op'); + +test(t => { + let styleMap = createInlineStyleMap(t, '--foo: auto; width: 10px; transition-duration: 1s, 2s'); + + styleMap.clear(); + assert_equals(styleMap.get('--foo'), null, + 'Custom properties should be cleared'); + assert_equals(styleMap.get('width'), null, + 'CSS properties should be cleared'); + assert_equals(styleMap.get('transition-duration'), null, + 'List-valued properties should be cleared'); + assert_array_equals([...styleMap], []); +}, 'Can clear a CSS rule containing properties'); + +test(t => { + let [rule, styleMap] = createRuleWithDeclaredStyleMap(t, 'width: 10px;'); + styleMap.clear(); + + assert_equals(rule.style.width, '', 'CSS rule style should be cleared'); +}, 'Declared StylePropertyMap.clear updates the CSS rule'); + +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/declared/update.tentative.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/declared/update.tentative.html deleted file mode 100644 index 8602e2cb..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/declared/update.tentative.html +++ /dev/null
@@ -1,88 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<title>StylePropertyMap.update tests</title> -<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#update-a-value-in-a-stylepropertymap"> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="../../resources/testhelper.js"></script> -<body> -<script> -'use strict'; - -const gInvalidTestCases = [ - { property: 'lemon', value: 'ade', desc: 'an unsupported property name' }, - { property: null, value: 'foo', desc: 'an null property name' }, - { property: 'width', value: CSS.deg(0), desc: 'an invalid CSSStyleValue' }, - { property: 'width', value: '10px', desc: 'a String' }, -]; - -for (const {property, value, desc} of gInvalidTestCases) { - test(t => { - let styleMap = createDeclaredStyleMap(t, ''); - assert_throws(new TypeError(), () => styleMap.update(property, () => value)); - }, 'Updating a StylePropertyMap with ' + desc + ' throws TypeError'); -} - -test(t => { - let styleMap = createDeclaredStyleMap(t, ''); - - styleMap.update('width', () => CSS.px(10)); - assert_style_value_array_equals(styleMap.get('width'), CSS.px(10)); - - styleMap.update('width', () => CSS.px(20)); - assert_style_value_array_equals(styleMap.get('width'), CSS.px(20)); -}, 'Updating a property with CSSStyleValue updates its value'); - -test(t => { - let styleMap = createDeclaredStyleMap(t, ''); - - styleMap.update('transition-duration', () => CSS.s(1)); - assert_style_value_array_equals(styleMap.getAll('transition-duration'), [CSS.s(1)]); - - styleMap.update('transition-duration', () => CSS.s(2)); - assert_style_value_array_equals(styleMap.getAll('transition-duration'), [CSS.s(2)]); -}, 'Updating a list-valued property with CSSStyleValue updates its value'); - -test(t => { - let styleMap = createDeclaredStyleMap(t, ''); - - styleMap.update('--foo', () => new CSSUnparsedValue(['auto'])); - assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue(['auto'])); - - styleMap.update('--foo', () => new CSSUnparsedValue(['20px'])); - assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue(['20px'])); -}, 'Updating a custom property with CSSStyleValue updates its value'); - -test(t => { - let styleMap = createDeclaredStyleMap(t, ''); - styleMap.update('width', oldValue => { - assert_equals(oldValue, null); - return CSS.px(10); - }); -}, 'Calling StylePropertyMap.update on an empty property model calls update function with null'); - -test(t => { - let styleMap = createDeclaredStyleMap(t, 'width: 10px'); - styleMap.update('width', oldValue => { - assert_style_value_equals(oldValue, CSS.px(10)); - return CSS.px(20); - }); -}, 'Calling StylePropertyMap.update on an existing property calls update function with old value'); - -test(t => { - let styleMap = createDeclaredStyleMap(t, 'transition-duration: 1s, 2s'); - styleMap.update('transition-duration', oldValue => { - assert_style_value_equals(oldValue, CSS.s(1)); - return CSS.s(2); - }); -}, 'Calling StylePropertyMap.update on an existing list-valued property calls update function with first value'); - -test(t => { - let styleMap = createDeclaredStyleMap(t, 'width: 10px'); - - styleMap.update('wIdTh', () => CSS.px(20)); - const result = styleMap.get('width'); - assert_style_value_equals(result, CSS.px(20)); -}, 'StylePropertyMap.update is case-insensitive'); - -</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/inline/clear.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/inline/clear.html new file mode 100644 index 0000000..24ca699 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/inline/clear.html
@@ -0,0 +1,40 @@ +<!doctype html> +<meta charset="utf-8"> +<title>Inline StylePropertyMap.clear</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-clear"> +<meta name="assert" content="Test inline StylePropertyMap.clear" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +test(t => { + let styleMap = createInlineStyleMap(t, ''); + styleMap.clear(); + assert_array_equals([...styleMap], []); +}, 'Clearing an empty inline style is a no-op'); + +test(t => { + let styleMap = createInlineStyleMap(t, '--foo: auto; width: 10px; transition-duration: 1s, 2s'); + + styleMap.clear(); + assert_equals(styleMap.get('--foo'), null, + 'Custom properties should be cleared'); + assert_equals(styleMap.get('width'), null, + 'CSS properties should be cleared'); + assert_equals(styleMap.get('transition-duration'), null, + 'List-valued properties should be cleared'); + assert_array_equals([...styleMap], []); +}, 'Can clear an inline style containing properties'); + +test(t => { + let [elem, styleMap] = createElementWithInlineStyleMap(t, 'width: 10px;'); + styleMap.clear(); + + assert_equals(elem.style.width, '', 'Element inline style should be cleared'); +}, 'Inline StylePropertyMap.clear updates the element inline style'); + +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/inline/update.tentative.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/inline/update.tentative.html deleted file mode 100644 index 77f2c105..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/inline/update.tentative.html +++ /dev/null
@@ -1,88 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<title>StylePropertyMap.update tests</title> -<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#update-a-value-in-a-stylepropertymap"> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="../../resources/testhelper.js"></script> -<body> -<script> -'use strict'; - -const gInvalidTestCases = [ - { property: 'lemon', value: 'ade', desc: 'an unsupported property name' }, - { property: null, value: 'foo', desc: 'an null property name' }, - { property: 'width', value: CSS.deg(0), desc: 'an invalid CSSStyleValue' }, - { property: 'width', value: '10px', desc: 'a String' }, -]; - -for (const {property, value, desc} of gInvalidTestCases) { - test(t => { - let styleMap = createInlineStyleMap(t, ''); - assert_throws(new TypeError(), () => styleMap.update(property, () => value)); - }, 'Updating a StylePropertyMap with ' + desc + ' throws TypeError'); -} - -test(t => { - let styleMap = createInlineStyleMap(t, ''); - - styleMap.update('width', () => CSS.px(10)); - assert_style_value_array_equals(styleMap.get('width'), CSS.px(10)); - - styleMap.update('width', () => CSS.px(20)); - assert_style_value_array_equals(styleMap.get('width'), CSS.px(20)); -}, 'Updating a property with CSSStyleValue updates its value'); - -test(t => { - let styleMap = createInlineStyleMap(t, ''); - - styleMap.update('transition-duration', () => CSS.s(1)); - assert_style_value_array_equals(styleMap.getAll('transition-duration'), [CSS.s(1)]); - - styleMap.update('transition-duration', () => CSS.s(2)); - assert_style_value_array_equals(styleMap.getAll('transition-duration'), [CSS.s(2)]); -}, 'Updating a list-valued property with CSSStyleValue updates its value'); - -test(t => { - let styleMap = createInlineStyleMap(t, ''); - - styleMap.update('--foo', () => new CSSUnparsedValue(['auto'])); - assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue(['auto'])); - - styleMap.update('--foo', () => new CSSUnparsedValue(['20px'])); - assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue(['20px'])); -}, 'Updating a custom property with CSSStyleValue updates its value'); - -test(t => { - let styleMap = createInlineStyleMap(t, ''); - styleMap.update('width', oldValue => { - assert_equals(oldValue, null); - return CSS.px(10); - }); -}, 'Calling StylePropertyMap.update on an empty property model calls update function with null'); - -test(t => { - let styleMap = createInlineStyleMap(t, 'width: 10px'); - styleMap.update('width', oldValue => { - assert_style_value_equals(oldValue, CSS.px(10)); - return CSS.px(20); - }); -}, 'Calling StylePropertyMap.update on an existing property calls update function with old value'); - -test(t => { - let styleMap = createInlineStyleMap(t, 'transition-duration: 1s, 2s'); - styleMap.update('transition-duration', oldValue => { - assert_style_value_equals(oldValue, CSS.s(1)); - return CSS.s(2); - }); -}, 'Calling StylePropertyMap.update on an existing list-valued property calls update function with first value'); - -test(t => { - let styleMap = createInlineStyleMap(t, 'width: 10px'); - - styleMap.update('wIdTh', () => CSS.px(20)); - const result = styleMap.get('width'); - assert_style_value_equals(result, CSS.px(20)); -}, 'StylePropertyMap.update is case-insensitive'); - -</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/border-width.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/border-width.html index d1fe0b0a7..5066637f 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/border-width.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/border-width.html
@@ -21,10 +21,23 @@ runPropertyTests('border-' + suffix + '-width', [ // Computed value is 0 when border-style is 'none'. // FIXME: Add separate test where border-style is not 'none' or 'hidden'. - { syntax: 'thin', computed: assert_is_zero_px }, - { syntax: 'medium', computed: assert_is_zero_px }, - { syntax: 'thick', computed: assert_is_zero_px }, - { syntax: '<length>' }, + { + syntax: 'thin', + computed: (_, result) => assert_is_zero_px(result) + }, + { + syntax: 'medium', + computed: (_, result) => assert_is_zero_px(result) + }, + { + syntax: 'thick', + computed: (_, result) => assert_is_zero_px(result) + }, + { + syntax: '<length>', + specified: assert_is_equal_with_range_handling, + computed: (_, result) => assert_is_zero_px(result) + }, ]); }
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/height.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/height.html index 7d126ec..4ec1a7a 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/height.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/height.html
@@ -15,8 +15,8 @@ runPropertyTests('height', [ { syntax: 'auto' }, - { syntax: '<percentage>' }, - { syntax: '<length>' }, + { syntax: '<percentage>', specified: assert_is_equal_with_range_handling }, + { syntax: '<length>', specified: assert_is_equal_with_range_handling }, ]); </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/padding.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/padding.html index c740ae7..42761f52 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/padding.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/padding.html
@@ -15,8 +15,14 @@ for (const suffix of ['top', 'left', 'right', 'bottom']) { runPropertyTests('padding-' + suffix, [ - { syntax: '<percentage>' }, - { syntax: '<length>' }, + { + syntax: '<percentage>', + specified: assert_is_equal_with_range_handling + }, + { + syntax: '<length>', + specified: assert_is_equal_with_range_handling + }, ]); }
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/resources/testsuite.js b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/resources/testsuite.js index f0c0a1f..bb607ed 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/resources/testsuite.js +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/resources/testsuite.js
@@ -9,6 +9,13 @@ 'specified calc must be a CSSMathSum'); } +function assert_is_equal_with_range_handling(input, result) { + if (input instanceof CSSUnitValue && input.value < 0) + assert_style_value_equals(result, new CSSMathSum(input)); + else + assert_style_value_equals(result, input); +} + const gTestSyntaxExamples = { '<length>': { description: 'a length', @@ -21,21 +28,21 @@ description: "a negative em", input: new CSSUnitValue(-3.14, 'em'), // 'ems' are relative units, so just check that it computes to px - defaultComputed: result => assert_is_unit('px', result) + defaultComputed: (_, result) => assert_is_unit('px', result) }, { description: "a positive cm", input: new CSSUnitValue(3.14, 'cm'), // 'cms' are relative units, so just check that it computes to px - defaultComputed: result => assert_is_unit('px', result) + defaultComputed: (_, result) => assert_is_unit('px', result) }, { description: "a calc length", input: new CSSMathSum(new CSSUnitValue(0, 'px'), new CSSUnitValue(0, 'em')), // Specified/computed calcs are usually simplified. // FIXME: Test this properly - defaultSpecified: assert_is_calc_sum, - defaultComputed: result => assert_is_unit('px', result) + defaultSpecified: (_, result) => assert_is_calc_sum(result), + defaultComputed: (_, result) => assert_is_unit('px', result) } ], }, @@ -59,8 +66,8 @@ input: new CSSMathSum(new CSSUnitValue(0, 'percent'), new CSSUnitValue(0, 'percent')), // Specified/computed calcs are usually simplified. // FIXME: Test this properly - defaultSpecified: assert_is_calc_sum, - defaultComputed: result => assert_is_unit('percent', result) + defaultSpecified: (_, result) => assert_is_calc_sum(result), + defaultComputed: (_, result) => assert_is_unit('percent', result) } ], }, @@ -84,8 +91,8 @@ input: new CSSMathSum(new CSSUnitValue(0, 's'), new CSSUnitValue(0, 'ms')), // Specified/computed calcs are usually simplified. // FIXME: Test this properly - defaultSpecified: assert_is_calc_sum, - defaultComputed: result => assert_is_unit('s', result) + defaultSpecified: (_, result) => assert_is_calc_sum(result), + defaultComputed: (_, result) => assert_is_unit('s', result) } ], }, @@ -104,7 +111,7 @@ { description: "a PNG image", input: new CSSURLImageValue('/media/1x1.png'), - defaultComputed: result => { + defaultComputed: (_, result) => { // URLs compute to absolute URLs assert_true(result instanceof CSSURLImageValue, 'Computed value should be a CSSURLImageValue'); @@ -143,7 +150,7 @@ // specified style const specifiedResult = element.attributeStyleMap.get(propertyName); if (specified || example.defaultSpecified) { - (specified || example.defaultSpecified)(specifiedResult); + (specified || example.defaultSpecified)(example.input, specifiedResult); } else { assert_not_equals(specifiedResult, null, 'Specified value must not be null'); @@ -156,7 +163,7 @@ // computed style const computedResult = element.computedStyleMap().get(propertyName); if (computed || example.defaultComputed) { - (computed || example.defaultComputed)(computedResult); + (computed || example.defaultComputed)(example.input, computedResult); } else { assert_not_equals(computedResult, null, 'Computed value must not be null'); @@ -196,12 +203,20 @@ // } // // If a callback is passed to |specified|, then the callback will be passed -// the result of calling get() on the inline style map (specified values). +// two arguments: +// 1. The input test case +// 2. The result of calling get() on the inline style map (specified values). +// // The callback should check if the result is expected using assert_* functions. // If no callback is passed, then we assert that the result is the same as // the input. // // Same goes for |computed|, but with the computed style map (computed values). +// +// FIXME: The reason we pass argument #2 is that it's sometimes difficult to +// compute exactly what the expected result should be (e.g. browser-specific +// values). Once we can do that, we can remove argument #2 and just return +// the expected result. function runPropertyTests(propertyName, testCases) { let syntaxTested = new Set();
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/width.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/width.html index 021a87fb..f79eda1 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/width.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-typed-om/the-stylepropertymap/properties/width.html
@@ -15,8 +15,14 @@ runPropertyTests('width', [ { syntax: 'auto' }, - { syntax: '<percentage>' }, - { syntax: '<length>' }, + { + syntax: '<percentage>', + specified: assert_is_equal_with_range_handling + }, + { + syntax: '<length>', + specified: assert_is_equal_with_range_handling + }, ]); </script>
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/parser/serializing-html-fragments-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/parser/serializing-html-fragments-expected.txt similarity index 72% rename from third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/parser/serializing-html-fragments-expected.txt rename to third_party/WebKit/LayoutTests/external/wpt/custom-elements/parser/serializing-html-fragments-expected.txt index b9df486..b88d3aff 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/parser/serializing-html-fragments-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/parser/serializing-html-fragments-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. FAIL "is" value should be serialized if the custom element has no "is" content attribute assert_equals: expected "<p is=\"my-p\" class=\"foo\"></p>" but got "<p class=\"foo\"></p>" -PASS "is" value should be serialized even for an undefined element +FAIL "is" value should be serialized even for an undefined element assert_equals: expected "<p is=\"your-p\"></p>" but got "<p></p>" PASS "is" content attribute should be serialized even if the element is a customized built-in element Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/dom/nodes/Document-importNode.html b/third_party/WebKit/LayoutTests/external/wpt/dom/nodes/Document-importNode.html index 32e2f316..d27cce6 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/dom/nodes/Document-importNode.html +++ b/third_party/WebKit/LayoutTests/external/wpt/dom/nodes/Document-importNode.html
@@ -54,4 +54,14 @@ assert_equals(newDiv.ownerDocument, document); assert_equals(newDiv.firstChild, null); }, "False 'deep' argument.") + +test(function() { + let doc = document.implementation.createHTMLDocument("Title"); + doc.body.setAttributeNS("http://example.com/", "p:name", "value"); + let originalAttr = doc.body.getAttributeNodeNS("http://example.com/", "name"); + let imported = document.importNode(originalAttr, true); + assert_equals(imported.prefix, originalAttr.prefix); + assert_equals(imported.namespaceURI, originalAttr.namespaceURI); + assert_equals(imported.localName, originalAttr.localName); +}, "Import an Attr node with namespace/prefix correctly."); </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/cors/cors-preflight-star.any.js b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/cors/cors-preflight-star.any.js index 8a18b51..44255d8 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/cors/cors-preflight-star.any.js +++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/cors/cors-preflight-star.any.js
@@ -32,13 +32,18 @@ }, "CORS that " + (succeeds ? "succeeds" : "fails") + " with credentials: " + withCredentials + "; method: " + useMethod + " (allowed: " + allowMethod + "); header: " + useHeader + " (allowed: " + allowHeader + ")") } +// "GET" does not pass the case-sensitive method check, but in the safe list. preflightTest(true, false, "get", "x-test", "GET", ["X-Test", "1"]) +// Headers check is case-insensitive, and "*" works as any for method. preflightTest(true, false, "*", "x-test", "SUPER", ["X-Test", "1"]) +// "*" works as any only without credentials. preflightTest(true, false, "*", "*", "OK", ["X-Test", "1"]) preflightTest(false, true, "*", "*", "OK", ["X-Test", "1"]) preflightTest(false, true, "*", "", "PUT", []) preflightTest(true, true, "PUT", "*", "PUT", []) -preflightTest(false, true, "put", "*", "PUT", []) preflightTest(false, true, "get", "*", "GET", ["X-Test", "1"]) preflightTest(false, true, "*", "*", "GET", ["X-Test", "1"]) +// Exact character match works even for "*" with credentials. preflightTest(true, true, "*", "*", "*", ["*", "1"]) +// "PUT" does not pass the case-sensitive method check, and not in the safe list. +preflightTest(false, true, "put", "*", "PUT", [])
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/nosniff/script.html b/third_party/WebKit/LayoutTests/external/wpt/fetch/nosniff/script.html index 6532e3db..e0b5dac7 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/fetch/nosniff/script.html +++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/nosniff/script.html
@@ -5,7 +5,7 @@ var log = function() {}, // see comment below p = function() {}, // see comment below fails = [null, "", "x", "x/x", "text/html", "text/json"], - passes = ["text/javascript", "text/ecmascript", "text/ecmascript;blah"] + passes = ["text/javascript", "text/ecmascript", "text/ecmascript;blah", "text/javascript1.0"] // Ideally we'd also check whether the scripts in fact execute, but that would involve // timers and might get a bit racy without cross-browser support for the execute events.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/javascript-url-abort-return-value-string.tentative.html b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/javascript-url-abort-return-value-string.tentative.html new file mode 100644 index 0000000..f626a79 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/javascript-url-abort-return-value-string.tentative.html
@@ -0,0 +1,28 @@ +<!doctype html> +<title>Aborting fetch for javascript:string navigation</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#navigate"> +<link rel="help" href="https://github.com/whatwg/html/issues/2590"> +<div id="log"></div> +<iframe src="support/iframe-and-links.html"></iframe> +<script> +async_test(test => { + onload = () => { + const child = document.querySelector('iframe').contentWindow; + child.document.querySelector("#slowLink").click(); + // The step below is in a timeout. The framed page can't communicate back mid-parse because that + // would involve running script, which makes that navigation "mature", and we need to do this + // before it matures. + test.step_timeout(() => { + child.document.querySelector("#javascriptStringLink").click(); + child.document.querySelector("iframe").onload = test.step_func_done(() => { + assert_false(child.childLoaded, 'child.childLoaded'); + }); + }, 100); + }; + window.javascriptStringDocLoaded = test.step_func(() => { + assert_unreached("javascript: URL doc replaced the document, should be targeted to child iframe."); + }); +}); +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/javascript-url-abort-return-value-undefined.tentative.html b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/javascript-url-abort-return-value-undefined.tentative.html new file mode 100644 index 0000000..80a0d27a --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/javascript-url-abort-return-value-undefined.tentative.html
@@ -0,0 +1,25 @@ +<!doctype html> +<title>Not aborting fetch for javascript:undefined navigation</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#navigate"> +<link rel="help" href="https://github.com/whatwg/html/issues/2590"> +<div id="log"></div> +<iframe src="support/iframe-and-links.html"></iframe> +<script> +async_test(test => { + onload = () => { + const child = document.querySelector('iframe').contentWindow; + child.document.querySelector("#slowLink").click(); + // The step below is in a timeout. The framed page can't communicate back mid-parse because that + // would involve running script, which makes that navigation "mature", and we need to do this + // before it matures. + test.step_timeout(() => { + child.document.querySelector("#javascriptUndefinedLink").click(); + child.document.querySelector("iframe").onload = test.step_func_done(() => { + assert_true(child.childLoaded, 'child.childLoaded'); + }); + }, 100); + }; +}); +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/support/iframe-and-links.html b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/support/iframe-and-links.html new file mode 100644 index 0000000..545b098 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/support/iframe-and-links.html
@@ -0,0 +1,18 @@ +<!doctype html> + +<iframe name="iframe"></iframe> + +<!-- slow link's response is delayed by 1 second --> +<!-- https://wptserve.readthedocs.io/en/latest/pipes.html#trickle --> +<a target="iframe" href="set-child-loaded.html?pipe=trickle(d1)" id="slowLink">slow link</a> +<a target="iframe" href="javascript:'javascript:string <script> parent.javascriptStringDocLoaded(); </script>'" id="javascriptStringLink">javascript:string link</a> +<a target="iframe" href="javascript:undefined" id="javascriptUndefinedLink">javascript:undefined link</a> + +<script> +// set-child-loaded.html (the slow link) sets this to true. +window.childLoaded = false; + +// Do nothing when the javascript:string doc has loaded, if it's correctly targeted to the above iframe. +// However, if it replaces this document, it needs to fail the test (handled in the parent). +function javascriptStringDocLoaded() {} +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/support/set-child-loaded.html b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/support/set-child-loaded.html new file mode 100644 index 0000000..a4b34ad --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-abort/support/set-child-loaded.html
@@ -0,0 +1,5 @@ +<!doctype html> +set-child-loaded.html +<script> +parent.childLoaded = true; +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/interfaces/css-typed-om.idl b/third_party/WebKit/LayoutTests/external/wpt/interfaces/css-typed-om.idl index 64df3c16..bbe1dca 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/interfaces/css-typed-om.idl +++ b/third_party/WebKit/LayoutTests/external/wpt/interfaces/css-typed-om.idl
@@ -24,7 +24,7 @@ void append(DOMString property, (CSSStyleValue or DOMString)... values); void delete(DOMString property); void set(DOMString property, (CSSStyleValue or DOMString)... values); - void update(DOMString property, UpdateFunction updateFunction); + void clear(); }; [Exposed=(Window, Worker, PaintWorklet, LayoutWorklet)]
diff --git a/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.dedicatedworker.html b/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.dedicatedworker.html new file mode 100644 index 0000000..887e334 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.dedicatedworker.html
@@ -0,0 +1,11 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>construct-byob-request.js dedicated worker wrapper file</title> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<script> +'use strict'; +fetch_tests_from_worker(new Worker('construct-byob-request.js')); +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.html b/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.html new file mode 100644 index 0000000..4e071e70 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.html
@@ -0,0 +1,10 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>construct-byob-request.js browser context wrapper file</title> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<script src="../resources/rs-utils.js"></script> + +<script src="construct-byob-request.js"></script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.js b/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.js new file mode 100644 index 0000000..29fdac5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.js
@@ -0,0 +1,82 @@ +'use strict'; + +// Prior to whatwg/stream#870 it was possible to construct a ReadableStreamBYOBRequest directly. This made it possible +// to construct requests that were out-of-sync with the state of the ReadableStream. They could then be used to call +// internal operations, resulting in asserts or bad behaviour. This file contains regression tests for the change. + +if (self.importScripts) { + self.importScripts('../resources/rs-utils.js'); + self.importScripts('/resources/testharness.js'); +} + +function getRealByteStreamController() { + let controller; + new ReadableStream({ + start(c) { + controller = c; + }, + type: 'bytes' + }); + return controller; +} + +const ReadableByteStreamController = getRealByteStreamController().constructor; + +// Create an object pretending to have prototype |prototype|, of type |type|. |type| is one of "undefined", "null", +// "fake", or "real". "real" will call the realObjectCreator function to get a real instance of the object. +function createDummyObject(prototype, type, realObjectCreator) { + switch (type) { + case 'undefined': + return undefined; + + case 'null': + return null; + + case 'fake': + return Object.create(prototype); + + case 'real': + return realObjectCreator(); + } + + throw new Error('not reached'); +} + +const dummyTypes = ['undefined', 'null', 'fake', 'real']; + +function runTests(ReadableStreamBYOBRequest) { + for (const controllerType of dummyTypes) { + const controller = createDummyObject(ReadableByteStreamController.prototype, controllerType, + getRealByteStreamController); + for (const viewType of dummyTypes) { + const view = createDummyObject(Uint8Array.prototype, viewType, () => new Uint8Array(16)); + test(() => { + assert_throws(new TypeError(), () => new ReadableStreamBYOBRequest(controller, view), + 'constructor should throw'); + }, `ReadableStreamBYOBRequest constructor should throw when passed a ${controllerType} ` + + `ReadableByteStreamController and a ${viewType} view`); + } + } +} + +function getConstructorAndRunTests() { + let ReadableStreamBYOBRequest; + const rs = new ReadableStream({ + pull(controller) { + const byobRequest = controller.byobRequest; + ReadableStreamBYOBRequest = byobRequest.constructor; + byobRequest.respond(4); + }, + type: 'bytes' + }); + rs.getReader({ mode: 'byob' }).read(new Uint8Array(8)).then(() => { + runTests(ReadableStreamBYOBRequest); + done(); + }); +} + +// We can only get at the ReadableStreamBYOBRequest constructor asynchronously, so we need to make the test harness wait +// for us to explicitly tell it all our tests have run. +setup({ explicit_done: true }); + +getConstructorAndRunTests();
diff --git a/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.serviceworker.https.html b/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.serviceworker.https.html new file mode 100644 index 0000000..abf70cb --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.serviceworker.https.html
@@ -0,0 +1,12 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>construct-byob-request.js service worker wrapper file</title> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script> + +<script> +'use strict'; +service_worker_test('construct-byob-request.js', 'Service worker test setup'); +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.sharedworker.html b/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.sharedworker.html new file mode 100644 index 0000000..6f7ef5c --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/construct-byob-request.sharedworker.html
@@ -0,0 +1,11 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>construct-byob-request.js shared worker wrapper file</title> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<script> +'use strict'; +fetch_tests_from_worker(new SharedWorker('construct-byob-request.js')); +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/general.html b/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/general.html index 32de3b2..717f386 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/general.html +++ b/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/general.html
@@ -6,5 +6,6 @@ <script src="/resources/testharnessreport.js"></script> <script src="../resources/rs-utils.js"></script> +<script src="../resources/test-utils.js"></script> <script src="general.js"></script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/general.js b/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/general.js index edbe1c83..4207277d 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/general.js +++ b/third_party/WebKit/LayoutTests/external/wpt/streams/readable-byte-streams/general.js
@@ -2,6 +2,7 @@ if (self.importScripts) { self.importScripts('../resources/rs-utils.js'); + self.importScripts('../resources/test-utils.js'); self.importScripts('/resources/testharness.js'); } @@ -1883,6 +1884,93 @@ 'errored in it'); promise_test(() => { + let byobRequest; + const rs = new ReadableStream({ + pull(controller) { + byobRequest = controller.byobRequest; + byobRequest.respond(4); + }, + type: 'bytes' + }); + const reader = rs.getReader({ mode: 'byob' }); + const view = new Uint8Array(16); + return reader.read(view).then(() => { + assert_throws(new TypeError(), () => byobRequest.respond(4), 'respond() should throw a TypeError'); + }); +}, 'calling respond() twice on the same byobRequest should throw'); + +promise_test(() => { + let byobRequest; + const newView = () => new Uint8Array(16); + const rs = new ReadableStream({ + pull(controller) { + byobRequest = controller.byobRequest; + byobRequest.respondWithNewView(newView()); + }, + type: 'bytes' + }); + const reader = rs.getReader({ mode: 'byob' }); + return reader.read(newView()).then(() => { + assert_throws(new TypeError(), () => byobRequest.respondWithNewView(newView()), + 'respondWithNewView() should throw a TypeError'); + }); +}, 'calling respondWithNewView() twice on the same byobRequest should throw'); + +promise_test(() => { + let byobRequest; + let resolvePullCalledPromise; + const pullCalledPromise = new Promise(resolve => { + resolvePullCalledPromise = resolve; + }); + let resolvePull; + const rs = new ReadableStream({ + pull(controller) { + byobRequest = controller.byobRequest; + resolvePullCalledPromise(); + return new Promise(resolve => { + resolvePull = resolve; + }); + }, + type: 'bytes' + }); + const reader = rs.getReader({ mode: 'byob' }); + const readPromise = reader.read(new Uint8Array(16)); + return pullCalledPromise.then(() => { + const cancelPromise = reader.cancel('meh'); + resolvePull(); + byobRequest.respond(0); + return Promise.all([readPromise, cancelPromise]).then(() => { + assert_throws(new TypeError(), () => byobRequest.respond(0), 'respond() should throw'); + }); + }); +}, 'calling respond(0) twice on the same byobRequest should throw even when closed'); + +promise_test(() => { + let resolvePullCalledPromise; + const pullCalledPromise = new Promise(resolve => { + resolvePullCalledPromise = resolve; + }); + let resolvePull; + const rs = new ReadableStream({ + pull() { + resolvePullCalledPromise(); + return new Promise(resolve => { + resolvePull = resolve; + }); + }, + type: 'bytes' + }); + const reader = rs.getReader({ mode: 'byob' }); + reader.read(new Uint8Array(16)); + return pullCalledPromise.then(() => { + resolvePull(); + return delay(0).then(() => { + assert_throws(new TypeError(), () => reader.releaseLock(), 'releaseLock() should throw'); + }); + }); +}, 'pull() resolving should not make releaseLock() possible'); + +promise_test(() => { // Tests https://github.com/whatwg/streams/issues/686 let controller;
diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/input-color-in-content.html b/third_party/WebKit/LayoutTests/fast/dom/shadow/input-color-in-content.html index a064324..0a1d8d3 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/shadow/input-color-in-content.html +++ b/third_party/WebKit/LayoutTests/fast/dom/shadow/input-color-in-content.html
@@ -3,7 +3,7 @@ <body> <script src="../../../resources/js-test.js"></script> <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> -<script src="file:///gen/third_party/WebKit/common/color_chooser/color_chooser.mojom.js"></script> +<script src="file:///gen/third_party/WebKit/public/mojom/color_chooser/color_chooser.mojom.js"></script> <script src="../../forms/color/mock-colorchooser.js"></script> <div id="host" tabindex="1"> <input id="target" type="color" value="#000000">
diff --git a/third_party/WebKit/LayoutTests/fast/forms/color/display-none-input-color-chooser-shown.html b/third_party/WebKit/LayoutTests/fast/forms/color/display-none-input-color-chooser-shown.html index 5aac8ea..c496c5dd 100644 --- a/third_party/WebKit/LayoutTests/fast/forms/color/display-none-input-color-chooser-shown.html +++ b/third_party/WebKit/LayoutTests/fast/forms/color/display-none-input-color-chooser-shown.html
@@ -2,7 +2,7 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> -<script src="file:///gen/third_party/WebKit/common/color_chooser/color_chooser.mojom.js"></script> +<script src="file:///gen/third_party/WebKit/public/mojom/color_chooser/color_chooser.mojom.js"></script> <script src="../../forms/color/mock-colorchooser.js"></script> <input id="colorPick" type="color" /> <label for="colorPick" id="labelPick">Pick a color</label>
diff --git a/third_party/WebKit/LayoutTests/fast/forms/color/input-color-chooser-shown-readonly.html b/third_party/WebKit/LayoutTests/fast/forms/color/input-color-chooser-shown-readonly.html index 9010d13a..afa6df5 100644 --- a/third_party/WebKit/LayoutTests/fast/forms/color/input-color-chooser-shown-readonly.html +++ b/third_party/WebKit/LayoutTests/fast/forms/color/input-color-chooser-shown-readonly.html
@@ -4,7 +4,7 @@ <script src="../../../resources/js-test.js"></script> <script src="../resources/common.js"></script> <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> -<script src="file:///gen/third_party/WebKit/common/color_chooser/color_chooser.mojom.js"></script> +<script src="file:///gen/third_party/WebKit/public/mojom/color_chooser/color_chooser.mojom.js"></script> <script src="../../forms/color/mock-colorchooser.js"></script> <div id="host" tabindex="1"> <input id="target" type="color" value="#000000" readonly>
diff --git a/third_party/WebKit/LayoutTests/fast/forms/color/input-color-chooser-shown.html b/third_party/WebKit/LayoutTests/fast/forms/color/input-color-chooser-shown.html index a0c5f1a..5ca21a8 100644 --- a/third_party/WebKit/LayoutTests/fast/forms/color/input-color-chooser-shown.html +++ b/third_party/WebKit/LayoutTests/fast/forms/color/input-color-chooser-shown.html
@@ -4,7 +4,7 @@ <script src="../../../resources/js-test.js"></script> <script src="../resources/common.js"></script> <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> -<script src="file:///gen/third_party/WebKit/common/color_chooser/color_chooser.mojom.js"></script> +<script src="file:///gen/third_party/WebKit/public/mojom/color_chooser/color_chooser.mojom.js"></script> <script src="../../forms/color/mock-colorchooser.js"></script> <div id="host" tabindex="1"> <input id="target" type="color" value="#000000">
diff --git a/third_party/WebKit/LayoutTests/http/tests/multipart/invalid-multipart-image.html b/third_party/WebKit/LayoutTests/http/tests/multipart/invalid-multipart-image.html new file mode 100644 index 0000000..c1b3a29 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/multipart/invalid-multipart-image.html
@@ -0,0 +1,16 @@ +<!DOCTYPE html> +<title>Test for loading invalid multipart image</title> +<script src="../../../resources/testharness.js"></script> +<script src="../../../resources/testharnessreport.js"></script> +<script> +async_test(t => { + const img = document.createElement('img'); + img.onload = t.step_func(() => { + assert_unreached('The image should not be loaded'); + }); + img.onerror = t.step_func_done((e) => { + assert_equals(e.type, 'error'); + }); + img.src = 'resources/invalid-multipart-image.php'; +}, 'invalid multipart image should not be loaded'); +</script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/multipart/resources/invalid-multipart-image.php b/third_party/WebKit/LayoutTests/http/tests/multipart/resources/invalid-multipart-image.php new file mode 100644 index 0000000..5b9eb7d --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/multipart/resources/invalid-multipart-image.php
@@ -0,0 +1,22 @@ +<?php + $boundary = "cutHere"; + + function sendPart($data) + { + global $boundary; + echo("Content-Type: image/png\r\n\r\n"); + echo($data); + echo("--$boundary\r\n"); + flush(); + } + + header("Content-Type: multipart/x-mixed-replace; boundary=$boundary"); + echo("--$boundary\r\n"); + ob_end_flush(); + + $invalidImage = "Invalid PNG data"; + sendPart($invalidImage); + + $validImage = file_get_contents("2x2-green.png"); + sendPart($validImage); +?>
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/Document-createElement-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/Document-createElement-expected.txt deleted file mode 100644 index cef218a..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/Document-createElement-expected.txt +++ /dev/null
@@ -1,40 +0,0 @@ -This is a testharness.js-based test. -PASS document.createElement must create an instance of custom elements -PASS document.createElement must create an instance of autonomous custom elements when it has is attribute -PASS document.createElement must report a TypeError when the result of Construct is not a DOM node -PASS document.createElement must report a TypeError when the result of Construct is a TextNode -PASS document.createElement must report a NotSupportedError when attribute is added by setAttribute during construction -PASS document.createElement must report a NotSupportedError when attribute is added by attributes.setNamedItem during construction -PASS document.createElement must not report a NotSupportedError when attribute is added and removed during construction -PASS document.createElement must report a NotSupportedError when a Text child is added during construction -PASS document.createElement must report a NotSupportedError when a Comment child is added during construction -PASS document.createElement must report a NotSupportedError when an element child is added during construction -PASS document.createElement must not report a NotSupportedError when an element child is added and removed during construction -PASS document.createElement must report a NotSupportedError when the element gets inserted into another element during construction -PASS document.createElement must not report a NotSupportedError when the element is inserted and removed from another element during construction -PASS document.createElement must report a NotSupportedError when the element is adopted into a the document of the template elements during construction -PASS document.createElement must report a NotSupportedError when the element is inserted into a the document of the template elements during construction -PASS document.createElement must not report a NotSupportedError when the element is adopted back from a the document of the template elements during construction -PASS document.createElement must report a NotSupportedError when the element is adopted into a a new document during construction -PASS document.createElement must report a NotSupportedError when the element is inserted into a a new document during construction -PASS document.createElement must not report a NotSupportedError when the element is adopted back from a a new document during construction -PASS document.createElement must report a NotSupportedError when the element is adopted into a a cloned document during construction -PASS document.createElement must report a NotSupportedError when the element is inserted into a a cloned document during construction -PASS document.createElement must not report a NotSupportedError when the element is adopted back from a a cloned document during construction -PASS document.createElement must report a NotSupportedError when the element is adopted into a a document created by createHTMLDocument during construction -PASS document.createElement must report a NotSupportedError when the element is inserted into a a document created by createHTMLDocument during construction -PASS document.createElement must not report a NotSupportedError when the element is adopted back from a a document created by createHTMLDocument during construction -PASS document.createElement must report a NotSupportedError when the element is adopted into a an HTML document created by createDocument during construction -PASS document.createElement must report a NotSupportedError when the element is inserted into a an HTML document created by createDocument during construction -PASS document.createElement must not report a NotSupportedError when the element is adopted back from a an HTML document created by createDocument during construction -PASS document.createElement must report a NotSupportedError when the element is adopted into a the document of an iframe during construction -PASS document.createElement must report a NotSupportedError when the element is inserted into a the document of an iframe during construction -PASS document.createElement must not report a NotSupportedError when the element is adopted back from a the document of an iframe during construction -PASS document.createElement must report a NotSupportedError when the element is adopted into a an HTML document fetched by XHR during construction -PASS document.createElement must report a NotSupportedError when the element is inserted into a an HTML document fetched by XHR during construction -PASS document.createElement must not report a NotSupportedError when the element is adopted back from a an HTML document fetched by XHR during construction -PASS document.createElement must report a NotSupportedError when the local name of the element does not match that of the custom element -PASS document.createElement must report an exception thrown by a custom element constructor -FAIL document.createElement with unknown "is" value should create "undefined" state element assert_false: expected false got true -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/Document-createElementNS-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/Document-createElementNS-expected.txt deleted file mode 100644 index 08200e72..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/Document-createElementNS-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This is a testharness.js-based test. -PASS autonomous: document.createElementNS should create custom elements with prefixes. -PASS autonomous: document.createElementNS should check namespaces. -PASS autonomous: document.createElementNS should not create HTMLUnknownElement for a valid custom element name -FAIL builtin: document.createElementNS should create custom elements with prefixes. assert_false: expected false got true -FAIL builtin: document.createElementNS should check namespaces. assert_false: expected false got true -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/builtin-coverage-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/builtin-coverage-expected.txt deleted file mode 100644 index 471803f..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/builtin-coverage-expected.txt +++ /dev/null
@@ -1,892 +0,0 @@ -This is a testharness.js-based test. -Found 444 tests; 333 PASS, 111 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS a: Define a customized built-in element -FAIL a: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyA extends HTMLAnchorElement { - constructor() { - super(); - } -}" but got function "function HTMLAnchorElement() { [native code] }" -PASS a: document.createElement() should instantiate a customized built-in element -PASS a: innerHTML should instantiate a customized built-in element -PASS abbr: Define a customized built-in element -FAIL abbr: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyAbbr extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS abbr: document.createElement() should instantiate a customized built-in element -PASS abbr: innerHTML should instantiate a customized built-in element -PASS address: Define a customized built-in element -FAIL address: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyAddress extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS address: document.createElement() should instantiate a customized built-in element -PASS address: innerHTML should instantiate a customized built-in element -PASS area: Define a customized built-in element -FAIL area: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyArea extends HTMLAreaElement { - constructor() { - super(); - } -}" but got function "function HTMLAreaElement() { [native code] }" -PASS area: document.createElement() should instantiate a customized built-in element -PASS area: innerHTML should instantiate a customized built-in element -PASS article: Define a customized built-in element -FAIL article: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyArticle extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS article: document.createElement() should instantiate a customized built-in element -PASS article: innerHTML should instantiate a customized built-in element -PASS aside: Define a customized built-in element -FAIL aside: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyAside extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS aside: document.createElement() should instantiate a customized built-in element -PASS aside: innerHTML should instantiate a customized built-in element -PASS audio: Define a customized built-in element -FAIL audio: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyAudio extends HTMLAudioElement { - constructor() { - super(); - } -}" but got function "function HTMLAudioElement() { [native code] }" -PASS audio: document.createElement() should instantiate a customized built-in element -PASS audio: innerHTML should instantiate a customized built-in element -PASS b: Define a customized built-in element -FAIL b: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyB extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS b: document.createElement() should instantiate a customized built-in element -PASS b: innerHTML should instantiate a customized built-in element -PASS base: Define a customized built-in element -FAIL base: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyBase extends HTMLBaseElement { - constructor() { - super(); - } -}" but got function "function HTMLBaseElement() { [native code] }" -PASS base: document.createElement() should instantiate a customized built-in element -PASS base: innerHTML should instantiate a customized built-in element -PASS bdi: Define a customized built-in element -FAIL bdi: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyBdi extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS bdi: document.createElement() should instantiate a customized built-in element -PASS bdi: innerHTML should instantiate a customized built-in element -PASS bdo: Define a customized built-in element -FAIL bdo: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyBdo extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS bdo: document.createElement() should instantiate a customized built-in element -PASS bdo: innerHTML should instantiate a customized built-in element -PASS blockquote: Define a customized built-in element -FAIL blockquote: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyBlockquote extends HTMLQuoteElement { - constructor() { - super(); - } -}" but got function "function HTMLQuoteElement() { [native code] }" -PASS blockquote: document.createElement() should instantiate a customized built-in element -PASS blockquote: innerHTML should instantiate a customized built-in element -PASS body: Define a customized built-in element -FAIL body: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyBody extends HTMLBodyElement { - constructor() { - super(); - } -}" but got function "function HTMLBodyElement() { [native code] }" -PASS body: document.createElement() should instantiate a customized built-in element -PASS body: document parser should instantiate a customized built-in element -PASS br: Define a customized built-in element -FAIL br: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyBr extends HTMLBRElement { - constructor() { - super(); - } -}" but got function "function HTMLBRElement() { [native code] }" -PASS br: document.createElement() should instantiate a customized built-in element -PASS br: innerHTML should instantiate a customized built-in element -PASS button: Define a customized built-in element -FAIL button: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyButton extends HTMLButtonElement { - constructor() { - super(); - } -}" but got function "function HTMLButtonElement() { [native code] }" -PASS button: document.createElement() should instantiate a customized built-in element -PASS button: innerHTML should instantiate a customized built-in element -PASS canvas: Define a customized built-in element -FAIL canvas: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyCanvas extends HTMLCanvasElement { - constructor() { - super(); - } -}" but got function "function HTMLCanvasElement() { [native code] }" -PASS canvas: document.createElement() should instantiate a customized built-in element -PASS canvas: innerHTML should instantiate a customized built-in element -PASS caption: Define a customized built-in element -FAIL caption: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyCaption extends HTMLTableCaptionElement { - constructor() { - super(); - } -}" but got function "function HTMLTableCaptionElement() { [native code] }" -PASS caption: document.createElement() should instantiate a customized built-in element -PASS caption: innerHTML should instantiate a customized built-in element -PASS cite: Define a customized built-in element -FAIL cite: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyCite extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS cite: document.createElement() should instantiate a customized built-in element -PASS cite: innerHTML should instantiate a customized built-in element -PASS code: Define a customized built-in element -FAIL code: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyCode extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS code: document.createElement() should instantiate a customized built-in element -PASS code: innerHTML should instantiate a customized built-in element -PASS col: Define a customized built-in element -FAIL col: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyCol extends HTMLTableColElement { - constructor() { - super(); - } -}" but got function "function HTMLTableColElement() { [native code] }" -PASS col: document.createElement() should instantiate a customized built-in element -PASS col: innerHTML should instantiate a customized built-in element -PASS colgroup: Define a customized built-in element -FAIL colgroup: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyColgroup extends HTMLTableColElement { - constructor() { - super(); - } -}" but got function "function HTMLTableColElement() { [native code] }" -PASS colgroup: document.createElement() should instantiate a customized built-in element -PASS colgroup: innerHTML should instantiate a customized built-in element -PASS data: Define a customized built-in element -FAIL data: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyData extends HTMLDataElement { - constructor() { - super(); - } -}" but got function "function HTMLDataElement() { [native code] }" -PASS data: document.createElement() should instantiate a customized built-in element -PASS data: innerHTML should instantiate a customized built-in element -PASS dd: Define a customized built-in element -FAIL dd: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDd extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS dd: document.createElement() should instantiate a customized built-in element -PASS dd: innerHTML should instantiate a customized built-in element -PASS del: Define a customized built-in element -FAIL del: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDel extends HTMLModElement { - constructor() { - super(); - } -}" but got function "function HTMLModElement() { [native code] }" -PASS del: document.createElement() should instantiate a customized built-in element -PASS del: innerHTML should instantiate a customized built-in element -PASS details: Define a customized built-in element -FAIL details: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDetails extends HTMLDetailsElement { - constructor() { - super(); - } -}" but got function "function HTMLDetailsElement() { [native code] }" -PASS details: document.createElement() should instantiate a customized built-in element -PASS details: innerHTML should instantiate a customized built-in element -PASS dfn: Define a customized built-in element -FAIL dfn: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDfn extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS dfn: document.createElement() should instantiate a customized built-in element -PASS dfn: innerHTML should instantiate a customized built-in element -PASS div: Define a customized built-in element -FAIL div: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDiv extends HTMLDivElement { - constructor() { - super(); - } -}" but got function "function HTMLDivElement() { [native code] }" -PASS div: document.createElement() should instantiate a customized built-in element -PASS div: innerHTML should instantiate a customized built-in element -PASS dl: Define a customized built-in element -FAIL dl: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDl extends HTMLDListElement { - constructor() { - super(); - } -}" but got function "function HTMLDListElement() { [native code] }" -PASS dl: document.createElement() should instantiate a customized built-in element -PASS dl: innerHTML should instantiate a customized built-in element -PASS dt: Define a customized built-in element -FAIL dt: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDt extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS dt: document.createElement() should instantiate a customized built-in element -PASS dt: innerHTML should instantiate a customized built-in element -PASS em: Define a customized built-in element -FAIL em: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyEm extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS em: document.createElement() should instantiate a customized built-in element -PASS em: innerHTML should instantiate a customized built-in element -PASS embed: Define a customized built-in element -FAIL embed: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyEmbed extends HTMLEmbedElement { - constructor() { - super(); - } -}" but got function "function HTMLEmbedElement() { [native code] }" -PASS embed: document.createElement() should instantiate a customized built-in element -PASS embed: innerHTML should instantiate a customized built-in element -PASS fieldset: Define a customized built-in element -FAIL fieldset: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyFieldset extends HTMLFieldSetElement { - constructor() { - super(); - } -}" but got function "function HTMLFieldSetElement() { [native code] }" -PASS fieldset: document.createElement() should instantiate a customized built-in element -PASS fieldset: innerHTML should instantiate a customized built-in element -PASS figcaption: Define a customized built-in element -FAIL figcaption: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyFigcaption extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS figcaption: document.createElement() should instantiate a customized built-in element -PASS figcaption: innerHTML should instantiate a customized built-in element -PASS figure: Define a customized built-in element -FAIL figure: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyFigure extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS figure: document.createElement() should instantiate a customized built-in element -PASS figure: innerHTML should instantiate a customized built-in element -PASS footer: Define a customized built-in element -FAIL footer: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyFooter extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS footer: document.createElement() should instantiate a customized built-in element -PASS footer: innerHTML should instantiate a customized built-in element -PASS form: Define a customized built-in element -FAIL form: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyForm extends HTMLFormElement { - constructor() { - super(); - } -}" but got function "function HTMLFormElement() { [native code] }" -PASS form: document.createElement() should instantiate a customized built-in element -PASS form: innerHTML should instantiate a customized built-in element -PASS h1: Define a customized built-in element -FAIL h1: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyH1 extends HTMLHeadingElement { - constructor() { - super(); - } -}" but got function "function HTMLHeadingElement() { [native code] }" -PASS h1: document.createElement() should instantiate a customized built-in element -PASS h1: innerHTML should instantiate a customized built-in element -PASS h2: Define a customized built-in element -FAIL h2: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyH2 extends HTMLHeadingElement { - constructor() { - super(); - } -}" but got function "function HTMLHeadingElement() { [native code] }" -PASS h2: document.createElement() should instantiate a customized built-in element -PASS h2: innerHTML should instantiate a customized built-in element -PASS h3: Define a customized built-in element -FAIL h3: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyH3 extends HTMLHeadingElement { - constructor() { - super(); - } -}" but got function "function HTMLHeadingElement() { [native code] }" -PASS h3: document.createElement() should instantiate a customized built-in element -PASS h3: innerHTML should instantiate a customized built-in element -PASS h4: Define a customized built-in element -FAIL h4: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyH4 extends HTMLHeadingElement { - constructor() { - super(); - } -}" but got function "function HTMLHeadingElement() { [native code] }" -PASS h4: document.createElement() should instantiate a customized built-in element -PASS h4: innerHTML should instantiate a customized built-in element -PASS h5: Define a customized built-in element -FAIL h5: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyH5 extends HTMLHeadingElement { - constructor() { - super(); - } -}" but got function "function HTMLHeadingElement() { [native code] }" -PASS h5: document.createElement() should instantiate a customized built-in element -PASS h5: innerHTML should instantiate a customized built-in element -PASS h6: Define a customized built-in element -FAIL h6: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyH6 extends HTMLHeadingElement { - constructor() { - super(); - } -}" but got function "function HTMLHeadingElement() { [native code] }" -PASS h6: document.createElement() should instantiate a customized built-in element -PASS h6: innerHTML should instantiate a customized built-in element -PASS header: Define a customized built-in element -FAIL header: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyHeader extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS header: document.createElement() should instantiate a customized built-in element -PASS header: innerHTML should instantiate a customized built-in element -PASS hgroup: Define a customized built-in element -FAIL hgroup: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyHgroup extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS hgroup: document.createElement() should instantiate a customized built-in element -PASS hgroup: innerHTML should instantiate a customized built-in element -PASS hr: Define a customized built-in element -FAIL hr: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyHr extends HTMLHRElement { - constructor() { - super(); - } -}" but got function "function HTMLHRElement() { [native code] }" -PASS hr: document.createElement() should instantiate a customized built-in element -PASS hr: innerHTML should instantiate a customized built-in element -PASS html: Define a customized built-in element -FAIL html: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyHtml extends HTMLHtmlElement { - constructor() { - super(); - } -}" but got function "function HTMLHtmlElement() { [native code] }" -PASS html: document.createElement() should instantiate a customized built-in element -PASS html: document parser should instantiate a customized built-in element -PASS i: Define a customized built-in element -FAIL i: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyI extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS i: document.createElement() should instantiate a customized built-in element -PASS i: innerHTML should instantiate a customized built-in element -PASS iframe: Define a customized built-in element -FAIL iframe: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyIframe extends HTMLIFrameElement { - constructor() { - super(); - } -}" but got function "function HTMLIFrameElement() { [native code] }" -PASS iframe: document.createElement() should instantiate a customized built-in element -PASS iframe: innerHTML should instantiate a customized built-in element -PASS img: Define a customized built-in element -FAIL img: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyImg extends HTMLImageElement { - constructor() { - super(); - } -}" but got function "function HTMLImageElement() { [native code] }" -PASS img: document.createElement() should instantiate a customized built-in element -PASS img: innerHTML should instantiate a customized built-in element -PASS input: Define a customized built-in element -FAIL input: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyInput extends HTMLInputElement { - constructor() { - super(); - } -}" but got function "function HTMLInputElement() { [native code] }" -PASS input: document.createElement() should instantiate a customized built-in element -PASS input: innerHTML should instantiate a customized built-in element -PASS ins: Define a customized built-in element -FAIL ins: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyIns extends HTMLModElement { - constructor() { - super(); - } -}" but got function "function HTMLModElement() { [native code] }" -PASS ins: document.createElement() should instantiate a customized built-in element -PASS ins: innerHTML should instantiate a customized built-in element -PASS kbd: Define a customized built-in element -FAIL kbd: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyKbd extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS kbd: document.createElement() should instantiate a customized built-in element -PASS kbd: innerHTML should instantiate a customized built-in element -PASS label: Define a customized built-in element -FAIL label: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyLabel extends HTMLLabelElement { - constructor() { - super(); - } -}" but got function "function HTMLLabelElement() { [native code] }" -PASS label: document.createElement() should instantiate a customized built-in element -PASS label: innerHTML should instantiate a customized built-in element -PASS legend: Define a customized built-in element -FAIL legend: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyLegend extends HTMLLegendElement { - constructor() { - super(); - } -}" but got function "function HTMLLegendElement() { [native code] }" -PASS legend: document.createElement() should instantiate a customized built-in element -PASS legend: innerHTML should instantiate a customized built-in element -PASS li: Define a customized built-in element -FAIL li: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyLi extends HTMLLIElement { - constructor() { - super(); - } -}" but got function "function HTMLLIElement() { [native code] }" -PASS li: document.createElement() should instantiate a customized built-in element -PASS li: innerHTML should instantiate a customized built-in element -PASS link: Define a customized built-in element -FAIL link: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyLink extends HTMLLinkElement { - constructor() { - super(); - } -}" but got function "function HTMLLinkElement() { [native code] }" -PASS link: document.createElement() should instantiate a customized built-in element -PASS link: innerHTML should instantiate a customized built-in element -PASS main: Define a customized built-in element -FAIL main: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyMain extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS main: document.createElement() should instantiate a customized built-in element -PASS main: innerHTML should instantiate a customized built-in element -PASS map: Define a customized built-in element -FAIL map: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyMap extends HTMLMapElement { - constructor() { - super(); - } -}" but got function "function HTMLMapElement() { [native code] }" -PASS map: document.createElement() should instantiate a customized built-in element -PASS map: innerHTML should instantiate a customized built-in element -PASS mark: Define a customized built-in element -FAIL mark: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyMark extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS mark: document.createElement() should instantiate a customized built-in element -PASS mark: innerHTML should instantiate a customized built-in element -PASS menu: Define a customized built-in element -FAIL menu: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyMenu extends HTMLMenuElement { - constructor() { - super(); - } -}" but got function "function HTMLMenuElement() { [native code] }" -PASS menu: document.createElement() should instantiate a customized built-in element -PASS menu: innerHTML should instantiate a customized built-in element -PASS meta: Define a customized built-in element -FAIL meta: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyMeta extends HTMLMetaElement { - constructor() { - super(); - } -}" but got function "function HTMLMetaElement() { [native code] }" -PASS meta: document.createElement() should instantiate a customized built-in element -PASS meta: innerHTML should instantiate a customized built-in element -PASS meter: Define a customized built-in element -FAIL meter: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyMeter extends HTMLMeterElement { - constructor() { - super(); - } -}" but got function "function HTMLMeterElement() { [native code] }" -PASS meter: document.createElement() should instantiate a customized built-in element -PASS meter: innerHTML should instantiate a customized built-in element -PASS nav: Define a customized built-in element -FAIL nav: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyNav extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS nav: document.createElement() should instantiate a customized built-in element -PASS nav: innerHTML should instantiate a customized built-in element -PASS noscript: Define a customized built-in element -FAIL noscript: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyNoscript extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS noscript: document.createElement() should instantiate a customized built-in element -PASS noscript: innerHTML should instantiate a customized built-in element -PASS object: Define a customized built-in element -FAIL object: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyObject extends HTMLObjectElement { - constructor() { - super(); - } -}" but got function "function HTMLObjectElement() { [native code] }" -PASS object: document.createElement() should instantiate a customized built-in element -PASS object: innerHTML should instantiate a customized built-in element -PASS ol: Define a customized built-in element -FAIL ol: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyOl extends HTMLOListElement { - constructor() { - super(); - } -}" but got function "function HTMLOListElement() { [native code] }" -PASS ol: document.createElement() should instantiate a customized built-in element -PASS ol: innerHTML should instantiate a customized built-in element -PASS optgroup: Define a customized built-in element -FAIL optgroup: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyOptgroup extends HTMLOptGroupElement { - constructor() { - super(); - } -}" but got function "function HTMLOptGroupElement() { [native code] }" -PASS optgroup: document.createElement() should instantiate a customized built-in element -PASS optgroup: innerHTML should instantiate a customized built-in element -PASS option: Define a customized built-in element -FAIL option: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyOption extends HTMLOptionElement { - constructor() { - super(); - } -}" but got function "function HTMLOptionElement() { [native code] }" -PASS option: document.createElement() should instantiate a customized built-in element -PASS option: innerHTML should instantiate a customized built-in element -PASS output: Define a customized built-in element -FAIL output: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyOutput extends HTMLOutputElement { - constructor() { - super(); - } -}" but got function "function HTMLOutputElement() { [native code] }" -PASS output: document.createElement() should instantiate a customized built-in element -PASS output: innerHTML should instantiate a customized built-in element -PASS p: Define a customized built-in element -FAIL p: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyP extends HTMLParagraphElement { - constructor() { - super(); - } -}" but got function "function HTMLParagraphElement() { [native code] }" -PASS p: document.createElement() should instantiate a customized built-in element -PASS p: innerHTML should instantiate a customized built-in element -PASS param: Define a customized built-in element -FAIL param: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyParam extends HTMLParamElement { - constructor() { - super(); - } -}" but got function "function HTMLParamElement() { [native code] }" -PASS param: document.createElement() should instantiate a customized built-in element -PASS param: innerHTML should instantiate a customized built-in element -PASS picture: Define a customized built-in element -FAIL picture: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyPicture extends HTMLPictureElement { - constructor() { - super(); - } -}" but got function "function HTMLPictureElement() { [native code] }" -PASS picture: document.createElement() should instantiate a customized built-in element -PASS picture: innerHTML should instantiate a customized built-in element -PASS pre: Define a customized built-in element -FAIL pre: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyPre extends HTMLPreElement { - constructor() { - super(); - } -}" but got function "function HTMLPreElement() { [native code] }" -PASS pre: document.createElement() should instantiate a customized built-in element -PASS pre: innerHTML should instantiate a customized built-in element -PASS progress: Define a customized built-in element -FAIL progress: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyProgress extends HTMLProgressElement { - constructor() { - super(); - } -}" but got function "function HTMLProgressElement() { [native code] }" -PASS progress: document.createElement() should instantiate a customized built-in element -PASS progress: innerHTML should instantiate a customized built-in element -PASS q: Define a customized built-in element -FAIL q: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyQ extends HTMLQuoteElement { - constructor() { - super(); - } -}" but got function "function HTMLQuoteElement() { [native code] }" -PASS q: document.createElement() should instantiate a customized built-in element -PASS q: innerHTML should instantiate a customized built-in element -PASS rp: Define a customized built-in element -FAIL rp: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyRp extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS rp: document.createElement() should instantiate a customized built-in element -PASS rp: innerHTML should instantiate a customized built-in element -PASS rt: Define a customized built-in element -FAIL rt: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyRt extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS rt: document.createElement() should instantiate a customized built-in element -PASS rt: innerHTML should instantiate a customized built-in element -PASS ruby: Define a customized built-in element -FAIL ruby: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyRuby extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS ruby: document.createElement() should instantiate a customized built-in element -PASS ruby: innerHTML should instantiate a customized built-in element -PASS s: Define a customized built-in element -FAIL s: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyS extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS s: document.createElement() should instantiate a customized built-in element -PASS s: innerHTML should instantiate a customized built-in element -PASS samp: Define a customized built-in element -FAIL samp: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySamp extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS samp: document.createElement() should instantiate a customized built-in element -PASS samp: innerHTML should instantiate a customized built-in element -PASS script: Define a customized built-in element -FAIL script: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyScript extends HTMLScriptElement { - constructor() { - super(); - } -}" but got function "function HTMLScriptElement() { [native code] }" -PASS script: document.createElement() should instantiate a customized built-in element -PASS script: innerHTML should instantiate a customized built-in element -PASS section: Define a customized built-in element -FAIL section: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySection extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS section: document.createElement() should instantiate a customized built-in element -PASS section: innerHTML should instantiate a customized built-in element -PASS select: Define a customized built-in element -FAIL select: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySelect extends HTMLSelectElement { - constructor() { - super(); - } -}" but got function "function HTMLSelectElement() { [native code] }" -PASS select: document.createElement() should instantiate a customized built-in element -PASS select: innerHTML should instantiate a customized built-in element -PASS small: Define a customized built-in element -FAIL small: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySmall extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS small: document.createElement() should instantiate a customized built-in element -PASS small: innerHTML should instantiate a customized built-in element -PASS source: Define a customized built-in element -FAIL source: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySource extends HTMLSourceElement { - constructor() { - super(); - } -}" but got function "function HTMLSourceElement() { [native code] }" -PASS source: document.createElement() should instantiate a customized built-in element -PASS source: innerHTML should instantiate a customized built-in element -PASS span: Define a customized built-in element -FAIL span: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySpan extends HTMLSpanElement { - constructor() { - super(); - } -}" but got function "function HTMLSpanElement() { [native code] }" -PASS span: document.createElement() should instantiate a customized built-in element -PASS span: innerHTML should instantiate a customized built-in element -PASS strong: Define a customized built-in element -FAIL strong: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyStrong extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS strong: document.createElement() should instantiate a customized built-in element -PASS strong: innerHTML should instantiate a customized built-in element -PASS style: Define a customized built-in element -FAIL style: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyStyle extends HTMLStyleElement { - constructor() { - super(); - } -}" but got function "function HTMLStyleElement() { [native code] }" -PASS style: document.createElement() should instantiate a customized built-in element -PASS style: innerHTML should instantiate a customized built-in element -PASS sub: Define a customized built-in element -FAIL sub: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySub extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS sub: document.createElement() should instantiate a customized built-in element -PASS sub: innerHTML should instantiate a customized built-in element -PASS summary: Define a customized built-in element -FAIL summary: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySummary extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS summary: document.createElement() should instantiate a customized built-in element -PASS summary: innerHTML should instantiate a customized built-in element -PASS sup: Define a customized built-in element -FAIL sup: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySup extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS sup: document.createElement() should instantiate a customized built-in element -PASS sup: innerHTML should instantiate a customized built-in element -PASS table: Define a customized built-in element -FAIL table: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTable extends HTMLTableElement { - constructor() { - super(); - } -}" but got function "function HTMLTableElement() { [native code] }" -PASS table: document.createElement() should instantiate a customized built-in element -PASS table: innerHTML should instantiate a customized built-in element -PASS tbody: Define a customized built-in element -FAIL tbody: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTbody extends HTMLTableSectionElement { - constructor() { - super(); - } -}" but got function "function HTMLTableSectionElement() { [native code] }" -PASS tbody: document.createElement() should instantiate a customized built-in element -PASS tbody: innerHTML should instantiate a customized built-in element -PASS td: Define a customized built-in element -FAIL td: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTd extends HTMLTableCellElement { - constructor() { - super(); - } -}" but got function "function HTMLTableCellElement() { [native code] }" -PASS td: document.createElement() should instantiate a customized built-in element -PASS td: innerHTML should instantiate a customized built-in element -PASS template: Define a customized built-in element -FAIL template: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTemplate extends HTMLTemplateElement { - constructor() { - super(); - } -}" but got function "function HTMLTemplateElement() { [native code] }" -PASS template: document.createElement() should instantiate a customized built-in element -PASS template: innerHTML should instantiate a customized built-in element -PASS textarea: Define a customized built-in element -FAIL textarea: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTextarea extends HTMLTextAreaElement { - constructor() { - super(); - } -}" but got function "function HTMLTextAreaElement() { [native code] }" -PASS textarea: document.createElement() should instantiate a customized built-in element -PASS textarea: innerHTML should instantiate a customized built-in element -PASS tfoot: Define a customized built-in element -FAIL tfoot: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTfoot extends HTMLTableSectionElement { - constructor() { - super(); - } -}" but got function "function HTMLTableSectionElement() { [native code] }" -PASS tfoot: document.createElement() should instantiate a customized built-in element -PASS tfoot: innerHTML should instantiate a customized built-in element -PASS th: Define a customized built-in element -FAIL th: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTh extends HTMLTableCellElement { - constructor() { - super(); - } -}" but got function "function HTMLTableCellElement() { [native code] }" -PASS th: document.createElement() should instantiate a customized built-in element -PASS th: innerHTML should instantiate a customized built-in element -PASS thead: Define a customized built-in element -FAIL thead: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyThead extends HTMLTableSectionElement { - constructor() { - super(); - } -}" but got function "function HTMLTableSectionElement() { [native code] }" -PASS thead: document.createElement() should instantiate a customized built-in element -PASS thead: innerHTML should instantiate a customized built-in element -PASS time: Define a customized built-in element -FAIL time: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTime extends HTMLTimeElement { - constructor() { - super(); - } -}" but got function "function HTMLTimeElement() { [native code] }" -PASS time: document.createElement() should instantiate a customized built-in element -PASS time: innerHTML should instantiate a customized built-in element -PASS title: Define a customized built-in element -FAIL title: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTitle extends HTMLTitleElement { - constructor() { - super(); - } -}" but got function "function HTMLTitleElement() { [native code] }" -PASS title: document.createElement() should instantiate a customized built-in element -PASS title: innerHTML should instantiate a customized built-in element -PASS tr: Define a customized built-in element -FAIL tr: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTr extends HTMLTableRowElement { - constructor() { - super(); - } -}" but got function "function HTMLTableRowElement() { [native code] }" -PASS tr: document.createElement() should instantiate a customized built-in element -PASS tr: innerHTML should instantiate a customized built-in element -PASS track: Define a customized built-in element -FAIL track: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTrack extends HTMLTrackElement { - constructor() { - super(); - } -}" but got function "function HTMLTrackElement() { [native code] }" -PASS track: document.createElement() should instantiate a customized built-in element -PASS track: innerHTML should instantiate a customized built-in element -PASS u: Define a customized built-in element -FAIL u: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyU extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS u: document.createElement() should instantiate a customized built-in element -PASS u: innerHTML should instantiate a customized built-in element -PASS ul: Define a customized built-in element -FAIL ul: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyUl extends HTMLUListElement { - constructor() { - super(); - } -}" but got function "function HTMLUListElement() { [native code] }" -PASS ul: document.createElement() should instantiate a customized built-in element -PASS ul: innerHTML should instantiate a customized built-in element -PASS var: Define a customized built-in element -FAIL var: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyVar extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS var: document.createElement() should instantiate a customized built-in element -PASS var: innerHTML should instantiate a customized built-in element -PASS video: Define a customized built-in element -FAIL video: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyVideo extends HTMLVideoElement { - constructor() { - super(); - } -}" but got function "function HTMLVideoElement() { [native code] }" -PASS video: document.createElement() should instantiate a customized built-in element -PASS video: innerHTML should instantiate a customized built-in element -PASS wbr: Define a customized built-in element -FAIL wbr: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyWbr extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS wbr: document.createElement() should instantiate a customized built-in element -PASS wbr: innerHTML should instantiate a customized built-in element -PASS datalist: Define a customized built-in element -FAIL datalist: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class extends HTMLDataListElement { - constructor() { - super(); - } - }" but got function "function HTMLDataListElement() { [native code] }" -PASS datalist: document.createElement() should instantiate a customized built-in element -PASS datalist: innerHTML should instantiate a customized built-in element -PASS dialog: Define a customized built-in element -FAIL dialog: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDialog extends HTMLDialogElement { - constructor() { - super(); - } - }" but got function "function HTMLDialogElement() { [native code] }" -PASS dialog: document.createElement() should instantiate a customized built-in element -PASS dialog: innerHTML should instantiate a customized built-in element -PASS slot: Define a customized built-in element -FAIL slot: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class extends HTMLSlotElement { - constructor() { - super(); - } - }" but got function "function HTMLSlotElement() { [native code] }" -PASS slot: document.createElement() should instantiate a customized built-in element -PASS slot: innerHTML should instantiate a customized built-in element -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/upgrading/Node-cloneNode-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/upgrading/Node-cloneNode-expected.txt deleted file mode 100644 index d452c554..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/upgrading/Node-cloneNode-expected.txt +++ /dev/null
@@ -1,13 +0,0 @@ -This is a testharness.js-based test. -PASS Node.prototype.cloneNode(false) must be able to clone a custom element -PASS Node.prototype.cloneNode(false) must be able to clone as a autonomous custom element when it contains is attribute -FAIL Node.prototype.cloneNode(false) must be able to clone as a customized built-in element when it has an inconsistent "is" attribute assert_true: A cloned custom element must be an instance of the custom element even with an inconsistent "is" attribute expected true got false -PASS Node.prototype.cloneNode(false) must be able to clone a custom element inside an iframe -PASS Node.prototype.cloneNode(true) must be able to clone a descendent custom element -PASS Node.prototype.cloneNode(true) must set parentNode, previousSibling, and nextSibling before upgrading custom elements -PASS HTMLElement constructor must throw an InvalidStateError when the top of the construction stack is marked AlreadyConstructed due to a custom element constructor constructing itself after super() call -PASS HTMLElement constructor must throw an InvalidStateError when the top of the construction stack is marked AlreadyConstructed due to a custom element constructor constructing itself before super() call -PASS Upgrading a custom element must throw InvalidStateError when the custom element's constructor returns another element -PASS Inserting an element must not try to upgrade a custom element when it had already failed to upgrade once -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/construct-byob-request-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/construct-byob-request-expected.txt new file mode 100644 index 0000000..1bb3c16 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/construct-byob-request-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL construct-byob-request.js browser context wrapper file Uncaught RangeError: bytes type is not yet implemented +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/construct-byob-request.dedicatedworker-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/construct-byob-request.dedicatedworker-expected.txt new file mode 100644 index 0000000..b4cca16 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/construct-byob-request.dedicatedworker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Untitled Uncaught RangeError: bytes type is not yet implemented +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/construct-byob-request.serviceworker.https-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/construct-byob-request.serviceworker.https-expected.txt new file mode 100644 index 0000000..a92ddfd --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/construct-byob-request.serviceworker.https-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Service worker test setup assert_unreached: unregister and register should not fail: Failed to register a ServiceWorker: ServiceWorker script evaluation failed Reached unreachable code +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/construct-byob-request.sharedworker-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/construct-byob-request.sharedworker-expected.txt new file mode 100644 index 0000000..b4cca16 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/construct-byob-request.sharedworker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Untitled Uncaught RangeError: bytes type is not yet implemented +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/general-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/general-expected.txt new file mode 100644 index 0000000..3d6778f6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/general-expected.txt
@@ -0,0 +1,83 @@ +This is a testharness.js-based test. +Found 76 tests; 2 PASS, 74 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS getReader({mode: "byob"}) throws on non-bytes streams +FAIL ReadableStream with byte source can be constructed with no errors bytes type is not yet implemented +FAIL getReader({mode}) must perform ToString() bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct and expect start and pull being called bytes type is not yet implemented +FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct with highWaterMark of 0 bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when closed bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when errored bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read() bytes type is not yet implemented +FAIL ReadableStream with byte source: autoAllocateChunkSize bytes type is not yet implemented +FAIL ReadableStream with byte source: Mix of auto allocate and BYOB bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Push source that doesn't understand pull signal bytes type is not yet implemented +FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ + pull: 'foo', + type: 'bytes' + })" threw object "RangeError: bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") +FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with too big value bytes type is not yet implemented +FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), read(view), then cancel() bytes type is not yet implemented +FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw if close()-ed more than once bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw on enqueue() after close() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls bytes type is not yet implemented +FAIL ReadableStream with byte source: read() twice, then enqueue() twice bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), close() and respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), big enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with zero-length view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read() on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL calling respond() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respondWithNewView() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respond(0) twice on the same byobRequest should throw even when closed bytes type is not yet implemented +FAIL pull() resolving should not make releaseLock() possible bytes type is not yet implemented +FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction bytes type is not yet implemented +FAIL ReadableStreamBYOBReader can be constructed directly bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" bytes type is not yet implemented +PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/general.dedicatedworker-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/general.dedicatedworker-expected.txt new file mode 100644 index 0000000..3d6778f6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/general.dedicatedworker-expected.txt
@@ -0,0 +1,83 @@ +This is a testharness.js-based test. +Found 76 tests; 2 PASS, 74 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS getReader({mode: "byob"}) throws on non-bytes streams +FAIL ReadableStream with byte source can be constructed with no errors bytes type is not yet implemented +FAIL getReader({mode}) must perform ToString() bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct and expect start and pull being called bytes type is not yet implemented +FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct with highWaterMark of 0 bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when closed bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when errored bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read() bytes type is not yet implemented +FAIL ReadableStream with byte source: autoAllocateChunkSize bytes type is not yet implemented +FAIL ReadableStream with byte source: Mix of auto allocate and BYOB bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Push source that doesn't understand pull signal bytes type is not yet implemented +FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ + pull: 'foo', + type: 'bytes' + })" threw object "RangeError: bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") +FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with too big value bytes type is not yet implemented +FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), read(view), then cancel() bytes type is not yet implemented +FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw if close()-ed more than once bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw on enqueue() after close() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls bytes type is not yet implemented +FAIL ReadableStream with byte source: read() twice, then enqueue() twice bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), close() and respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), big enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with zero-length view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read() on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL calling respond() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respondWithNewView() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respond(0) twice on the same byobRequest should throw even when closed bytes type is not yet implemented +FAIL pull() resolving should not make releaseLock() possible bytes type is not yet implemented +FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction bytes type is not yet implemented +FAIL ReadableStreamBYOBReader can be constructed directly bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" bytes type is not yet implemented +PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/general.serviceworker.https-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/general.serviceworker.https-expected.txt new file mode 100644 index 0000000..bce9964 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/general.serviceworker.https-expected.txt
@@ -0,0 +1,83 @@ +This is a testharness.js-based test. +PASS Service worker test setup +PASS getReader({mode: "byob"}) throws on non-bytes streams +FAIL ReadableStream with byte source can be constructed with no errors bytes type is not yet implemented +FAIL getReader({mode}) must perform ToString() bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct and expect start and pull being called bytes type is not yet implemented +FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct with highWaterMark of 0 bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when closed bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when errored bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read() bytes type is not yet implemented +FAIL ReadableStream with byte source: autoAllocateChunkSize bytes type is not yet implemented +FAIL ReadableStream with byte source: Mix of auto allocate and BYOB bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Push source that doesn't understand pull signal bytes type is not yet implemented +FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ + pull: 'foo', + type: 'bytes' + })" threw object "RangeError: bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") +FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with too big value bytes type is not yet implemented +FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), read(view), then cancel() bytes type is not yet implemented +FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw if close()-ed more than once bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw on enqueue() after close() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls bytes type is not yet implemented +FAIL ReadableStream with byte source: read() twice, then enqueue() twice bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), close() and respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), big enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with zero-length view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read() on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL calling respond() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respondWithNewView() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respond(0) twice on the same byobRequest should throw even when closed bytes type is not yet implemented +FAIL pull() resolving should not make releaseLock() possible bytes type is not yet implemented +FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction bytes type is not yet implemented +FAIL ReadableStreamBYOBReader can be constructed directly bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" bytes type is not yet implemented +PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/general.sharedworker-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/general.sharedworker-expected.txt new file mode 100644 index 0000000..3d6778f6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/streams/readable-byte-streams/general.sharedworker-expected.txt
@@ -0,0 +1,83 @@ +This is a testharness.js-based test. +Found 76 tests; 2 PASS, 74 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS getReader({mode: "byob"}) throws on non-bytes streams +FAIL ReadableStream with byte source can be constructed with no errors bytes type is not yet implemented +FAIL getReader({mode}) must perform ToString() bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct and expect start and pull being called bytes type is not yet implemented +FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct with highWaterMark of 0 bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when closed bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when errored bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read() bytes type is not yet implemented +FAIL ReadableStream with byte source: autoAllocateChunkSize bytes type is not yet implemented +FAIL ReadableStream with byte source: Mix of auto allocate and BYOB bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Push source that doesn't understand pull signal bytes type is not yet implemented +FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ + pull: 'foo', + type: 'bytes' + })" threw object "RangeError: bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") +FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with too big value bytes type is not yet implemented +FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), read(view), then cancel() bytes type is not yet implemented +FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw if close()-ed more than once bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw on enqueue() after close() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls bytes type is not yet implemented +FAIL ReadableStream with byte source: read() twice, then enqueue() twice bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), close() and respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), big enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with zero-length view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read() on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL calling respond() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respondWithNewView() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respond(0) twice on the same byobRequest should throw even when closed bytes type is not yet implemented +FAIL pull() resolving should not make releaseLock() possible bytes type is not yet implemented +FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction bytes type is not yet implemented +FAIL ReadableStreamBYOBReader can be constructed directly bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" bytes type is not yet implemented +PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/Document-createElement-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/Document-createElement-expected.txt deleted file mode 100644 index cef218a..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/Document-createElement-expected.txt +++ /dev/null
@@ -1,40 +0,0 @@ -This is a testharness.js-based test. -PASS document.createElement must create an instance of custom elements -PASS document.createElement must create an instance of autonomous custom elements when it has is attribute -PASS document.createElement must report a TypeError when the result of Construct is not a DOM node -PASS document.createElement must report a TypeError when the result of Construct is a TextNode -PASS document.createElement must report a NotSupportedError when attribute is added by setAttribute during construction -PASS document.createElement must report a NotSupportedError when attribute is added by attributes.setNamedItem during construction -PASS document.createElement must not report a NotSupportedError when attribute is added and removed during construction -PASS document.createElement must report a NotSupportedError when a Text child is added during construction -PASS document.createElement must report a NotSupportedError when a Comment child is added during construction -PASS document.createElement must report a NotSupportedError when an element child is added during construction -PASS document.createElement must not report a NotSupportedError when an element child is added and removed during construction -PASS document.createElement must report a NotSupportedError when the element gets inserted into another element during construction -PASS document.createElement must not report a NotSupportedError when the element is inserted and removed from another element during construction -PASS document.createElement must report a NotSupportedError when the element is adopted into a the document of the template elements during construction -PASS document.createElement must report a NotSupportedError when the element is inserted into a the document of the template elements during construction -PASS document.createElement must not report a NotSupportedError when the element is adopted back from a the document of the template elements during construction -PASS document.createElement must report a NotSupportedError when the element is adopted into a a new document during construction -PASS document.createElement must report a NotSupportedError when the element is inserted into a a new document during construction -PASS document.createElement must not report a NotSupportedError when the element is adopted back from a a new document during construction -PASS document.createElement must report a NotSupportedError when the element is adopted into a a cloned document during construction -PASS document.createElement must report a NotSupportedError when the element is inserted into a a cloned document during construction -PASS document.createElement must not report a NotSupportedError when the element is adopted back from a a cloned document during construction -PASS document.createElement must report a NotSupportedError when the element is adopted into a a document created by createHTMLDocument during construction -PASS document.createElement must report a NotSupportedError when the element is inserted into a a document created by createHTMLDocument during construction -PASS document.createElement must not report a NotSupportedError when the element is adopted back from a a document created by createHTMLDocument during construction -PASS document.createElement must report a NotSupportedError when the element is adopted into a an HTML document created by createDocument during construction -PASS document.createElement must report a NotSupportedError when the element is inserted into a an HTML document created by createDocument during construction -PASS document.createElement must not report a NotSupportedError when the element is adopted back from a an HTML document created by createDocument during construction -PASS document.createElement must report a NotSupportedError when the element is adopted into a the document of an iframe during construction -PASS document.createElement must report a NotSupportedError when the element is inserted into a the document of an iframe during construction -PASS document.createElement must not report a NotSupportedError when the element is adopted back from a the document of an iframe during construction -PASS document.createElement must report a NotSupportedError when the element is adopted into a an HTML document fetched by XHR during construction -PASS document.createElement must report a NotSupportedError when the element is inserted into a an HTML document fetched by XHR during construction -PASS document.createElement must not report a NotSupportedError when the element is adopted back from a an HTML document fetched by XHR during construction -PASS document.createElement must report a NotSupportedError when the local name of the element does not match that of the custom element -PASS document.createElement must report an exception thrown by a custom element constructor -FAIL document.createElement with unknown "is" value should create "undefined" state element assert_false: expected false got true -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/Document-createElementNS-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/Document-createElementNS-expected.txt deleted file mode 100644 index 08200e72..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/Document-createElementNS-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This is a testharness.js-based test. -PASS autonomous: document.createElementNS should create custom elements with prefixes. -PASS autonomous: document.createElementNS should check namespaces. -PASS autonomous: document.createElementNS should not create HTMLUnknownElement for a valid custom element name -FAIL builtin: document.createElementNS should create custom elements with prefixes. assert_false: expected false got true -FAIL builtin: document.createElementNS should check namespaces. assert_false: expected false got true -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/builtin-coverage-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/builtin-coverage-expected.txt deleted file mode 100644 index 471803f..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/builtin-coverage-expected.txt +++ /dev/null
@@ -1,892 +0,0 @@ -This is a testharness.js-based test. -Found 444 tests; 333 PASS, 111 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS a: Define a customized built-in element -FAIL a: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyA extends HTMLAnchorElement { - constructor() { - super(); - } -}" but got function "function HTMLAnchorElement() { [native code] }" -PASS a: document.createElement() should instantiate a customized built-in element -PASS a: innerHTML should instantiate a customized built-in element -PASS abbr: Define a customized built-in element -FAIL abbr: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyAbbr extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS abbr: document.createElement() should instantiate a customized built-in element -PASS abbr: innerHTML should instantiate a customized built-in element -PASS address: Define a customized built-in element -FAIL address: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyAddress extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS address: document.createElement() should instantiate a customized built-in element -PASS address: innerHTML should instantiate a customized built-in element -PASS area: Define a customized built-in element -FAIL area: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyArea extends HTMLAreaElement { - constructor() { - super(); - } -}" but got function "function HTMLAreaElement() { [native code] }" -PASS area: document.createElement() should instantiate a customized built-in element -PASS area: innerHTML should instantiate a customized built-in element -PASS article: Define a customized built-in element -FAIL article: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyArticle extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS article: document.createElement() should instantiate a customized built-in element -PASS article: innerHTML should instantiate a customized built-in element -PASS aside: Define a customized built-in element -FAIL aside: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyAside extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS aside: document.createElement() should instantiate a customized built-in element -PASS aside: innerHTML should instantiate a customized built-in element -PASS audio: Define a customized built-in element -FAIL audio: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyAudio extends HTMLAudioElement { - constructor() { - super(); - } -}" but got function "function HTMLAudioElement() { [native code] }" -PASS audio: document.createElement() should instantiate a customized built-in element -PASS audio: innerHTML should instantiate a customized built-in element -PASS b: Define a customized built-in element -FAIL b: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyB extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS b: document.createElement() should instantiate a customized built-in element -PASS b: innerHTML should instantiate a customized built-in element -PASS base: Define a customized built-in element -FAIL base: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyBase extends HTMLBaseElement { - constructor() { - super(); - } -}" but got function "function HTMLBaseElement() { [native code] }" -PASS base: document.createElement() should instantiate a customized built-in element -PASS base: innerHTML should instantiate a customized built-in element -PASS bdi: Define a customized built-in element -FAIL bdi: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyBdi extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS bdi: document.createElement() should instantiate a customized built-in element -PASS bdi: innerHTML should instantiate a customized built-in element -PASS bdo: Define a customized built-in element -FAIL bdo: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyBdo extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS bdo: document.createElement() should instantiate a customized built-in element -PASS bdo: innerHTML should instantiate a customized built-in element -PASS blockquote: Define a customized built-in element -FAIL blockquote: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyBlockquote extends HTMLQuoteElement { - constructor() { - super(); - } -}" but got function "function HTMLQuoteElement() { [native code] }" -PASS blockquote: document.createElement() should instantiate a customized built-in element -PASS blockquote: innerHTML should instantiate a customized built-in element -PASS body: Define a customized built-in element -FAIL body: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyBody extends HTMLBodyElement { - constructor() { - super(); - } -}" but got function "function HTMLBodyElement() { [native code] }" -PASS body: document.createElement() should instantiate a customized built-in element -PASS body: document parser should instantiate a customized built-in element -PASS br: Define a customized built-in element -FAIL br: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyBr extends HTMLBRElement { - constructor() { - super(); - } -}" but got function "function HTMLBRElement() { [native code] }" -PASS br: document.createElement() should instantiate a customized built-in element -PASS br: innerHTML should instantiate a customized built-in element -PASS button: Define a customized built-in element -FAIL button: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyButton extends HTMLButtonElement { - constructor() { - super(); - } -}" but got function "function HTMLButtonElement() { [native code] }" -PASS button: document.createElement() should instantiate a customized built-in element -PASS button: innerHTML should instantiate a customized built-in element -PASS canvas: Define a customized built-in element -FAIL canvas: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyCanvas extends HTMLCanvasElement { - constructor() { - super(); - } -}" but got function "function HTMLCanvasElement() { [native code] }" -PASS canvas: document.createElement() should instantiate a customized built-in element -PASS canvas: innerHTML should instantiate a customized built-in element -PASS caption: Define a customized built-in element -FAIL caption: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyCaption extends HTMLTableCaptionElement { - constructor() { - super(); - } -}" but got function "function HTMLTableCaptionElement() { [native code] }" -PASS caption: document.createElement() should instantiate a customized built-in element -PASS caption: innerHTML should instantiate a customized built-in element -PASS cite: Define a customized built-in element -FAIL cite: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyCite extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS cite: document.createElement() should instantiate a customized built-in element -PASS cite: innerHTML should instantiate a customized built-in element -PASS code: Define a customized built-in element -FAIL code: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyCode extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS code: document.createElement() should instantiate a customized built-in element -PASS code: innerHTML should instantiate a customized built-in element -PASS col: Define a customized built-in element -FAIL col: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyCol extends HTMLTableColElement { - constructor() { - super(); - } -}" but got function "function HTMLTableColElement() { [native code] }" -PASS col: document.createElement() should instantiate a customized built-in element -PASS col: innerHTML should instantiate a customized built-in element -PASS colgroup: Define a customized built-in element -FAIL colgroup: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyColgroup extends HTMLTableColElement { - constructor() { - super(); - } -}" but got function "function HTMLTableColElement() { [native code] }" -PASS colgroup: document.createElement() should instantiate a customized built-in element -PASS colgroup: innerHTML should instantiate a customized built-in element -PASS data: Define a customized built-in element -FAIL data: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyData extends HTMLDataElement { - constructor() { - super(); - } -}" but got function "function HTMLDataElement() { [native code] }" -PASS data: document.createElement() should instantiate a customized built-in element -PASS data: innerHTML should instantiate a customized built-in element -PASS dd: Define a customized built-in element -FAIL dd: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDd extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS dd: document.createElement() should instantiate a customized built-in element -PASS dd: innerHTML should instantiate a customized built-in element -PASS del: Define a customized built-in element -FAIL del: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDel extends HTMLModElement { - constructor() { - super(); - } -}" but got function "function HTMLModElement() { [native code] }" -PASS del: document.createElement() should instantiate a customized built-in element -PASS del: innerHTML should instantiate a customized built-in element -PASS details: Define a customized built-in element -FAIL details: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDetails extends HTMLDetailsElement { - constructor() { - super(); - } -}" but got function "function HTMLDetailsElement() { [native code] }" -PASS details: document.createElement() should instantiate a customized built-in element -PASS details: innerHTML should instantiate a customized built-in element -PASS dfn: Define a customized built-in element -FAIL dfn: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDfn extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS dfn: document.createElement() should instantiate a customized built-in element -PASS dfn: innerHTML should instantiate a customized built-in element -PASS div: Define a customized built-in element -FAIL div: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDiv extends HTMLDivElement { - constructor() { - super(); - } -}" but got function "function HTMLDivElement() { [native code] }" -PASS div: document.createElement() should instantiate a customized built-in element -PASS div: innerHTML should instantiate a customized built-in element -PASS dl: Define a customized built-in element -FAIL dl: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDl extends HTMLDListElement { - constructor() { - super(); - } -}" but got function "function HTMLDListElement() { [native code] }" -PASS dl: document.createElement() should instantiate a customized built-in element -PASS dl: innerHTML should instantiate a customized built-in element -PASS dt: Define a customized built-in element -FAIL dt: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDt extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS dt: document.createElement() should instantiate a customized built-in element -PASS dt: innerHTML should instantiate a customized built-in element -PASS em: Define a customized built-in element -FAIL em: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyEm extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS em: document.createElement() should instantiate a customized built-in element -PASS em: innerHTML should instantiate a customized built-in element -PASS embed: Define a customized built-in element -FAIL embed: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyEmbed extends HTMLEmbedElement { - constructor() { - super(); - } -}" but got function "function HTMLEmbedElement() { [native code] }" -PASS embed: document.createElement() should instantiate a customized built-in element -PASS embed: innerHTML should instantiate a customized built-in element -PASS fieldset: Define a customized built-in element -FAIL fieldset: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyFieldset extends HTMLFieldSetElement { - constructor() { - super(); - } -}" but got function "function HTMLFieldSetElement() { [native code] }" -PASS fieldset: document.createElement() should instantiate a customized built-in element -PASS fieldset: innerHTML should instantiate a customized built-in element -PASS figcaption: Define a customized built-in element -FAIL figcaption: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyFigcaption extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS figcaption: document.createElement() should instantiate a customized built-in element -PASS figcaption: innerHTML should instantiate a customized built-in element -PASS figure: Define a customized built-in element -FAIL figure: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyFigure extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS figure: document.createElement() should instantiate a customized built-in element -PASS figure: innerHTML should instantiate a customized built-in element -PASS footer: Define a customized built-in element -FAIL footer: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyFooter extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS footer: document.createElement() should instantiate a customized built-in element -PASS footer: innerHTML should instantiate a customized built-in element -PASS form: Define a customized built-in element -FAIL form: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyForm extends HTMLFormElement { - constructor() { - super(); - } -}" but got function "function HTMLFormElement() { [native code] }" -PASS form: document.createElement() should instantiate a customized built-in element -PASS form: innerHTML should instantiate a customized built-in element -PASS h1: Define a customized built-in element -FAIL h1: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyH1 extends HTMLHeadingElement { - constructor() { - super(); - } -}" but got function "function HTMLHeadingElement() { [native code] }" -PASS h1: document.createElement() should instantiate a customized built-in element -PASS h1: innerHTML should instantiate a customized built-in element -PASS h2: Define a customized built-in element -FAIL h2: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyH2 extends HTMLHeadingElement { - constructor() { - super(); - } -}" but got function "function HTMLHeadingElement() { [native code] }" -PASS h2: document.createElement() should instantiate a customized built-in element -PASS h2: innerHTML should instantiate a customized built-in element -PASS h3: Define a customized built-in element -FAIL h3: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyH3 extends HTMLHeadingElement { - constructor() { - super(); - } -}" but got function "function HTMLHeadingElement() { [native code] }" -PASS h3: document.createElement() should instantiate a customized built-in element -PASS h3: innerHTML should instantiate a customized built-in element -PASS h4: Define a customized built-in element -FAIL h4: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyH4 extends HTMLHeadingElement { - constructor() { - super(); - } -}" but got function "function HTMLHeadingElement() { [native code] }" -PASS h4: document.createElement() should instantiate a customized built-in element -PASS h4: innerHTML should instantiate a customized built-in element -PASS h5: Define a customized built-in element -FAIL h5: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyH5 extends HTMLHeadingElement { - constructor() { - super(); - } -}" but got function "function HTMLHeadingElement() { [native code] }" -PASS h5: document.createElement() should instantiate a customized built-in element -PASS h5: innerHTML should instantiate a customized built-in element -PASS h6: Define a customized built-in element -FAIL h6: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyH6 extends HTMLHeadingElement { - constructor() { - super(); - } -}" but got function "function HTMLHeadingElement() { [native code] }" -PASS h6: document.createElement() should instantiate a customized built-in element -PASS h6: innerHTML should instantiate a customized built-in element -PASS header: Define a customized built-in element -FAIL header: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyHeader extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS header: document.createElement() should instantiate a customized built-in element -PASS header: innerHTML should instantiate a customized built-in element -PASS hgroup: Define a customized built-in element -FAIL hgroup: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyHgroup extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS hgroup: document.createElement() should instantiate a customized built-in element -PASS hgroup: innerHTML should instantiate a customized built-in element -PASS hr: Define a customized built-in element -FAIL hr: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyHr extends HTMLHRElement { - constructor() { - super(); - } -}" but got function "function HTMLHRElement() { [native code] }" -PASS hr: document.createElement() should instantiate a customized built-in element -PASS hr: innerHTML should instantiate a customized built-in element -PASS html: Define a customized built-in element -FAIL html: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyHtml extends HTMLHtmlElement { - constructor() { - super(); - } -}" but got function "function HTMLHtmlElement() { [native code] }" -PASS html: document.createElement() should instantiate a customized built-in element -PASS html: document parser should instantiate a customized built-in element -PASS i: Define a customized built-in element -FAIL i: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyI extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS i: document.createElement() should instantiate a customized built-in element -PASS i: innerHTML should instantiate a customized built-in element -PASS iframe: Define a customized built-in element -FAIL iframe: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyIframe extends HTMLIFrameElement { - constructor() { - super(); - } -}" but got function "function HTMLIFrameElement() { [native code] }" -PASS iframe: document.createElement() should instantiate a customized built-in element -PASS iframe: innerHTML should instantiate a customized built-in element -PASS img: Define a customized built-in element -FAIL img: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyImg extends HTMLImageElement { - constructor() { - super(); - } -}" but got function "function HTMLImageElement() { [native code] }" -PASS img: document.createElement() should instantiate a customized built-in element -PASS img: innerHTML should instantiate a customized built-in element -PASS input: Define a customized built-in element -FAIL input: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyInput extends HTMLInputElement { - constructor() { - super(); - } -}" but got function "function HTMLInputElement() { [native code] }" -PASS input: document.createElement() should instantiate a customized built-in element -PASS input: innerHTML should instantiate a customized built-in element -PASS ins: Define a customized built-in element -FAIL ins: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyIns extends HTMLModElement { - constructor() { - super(); - } -}" but got function "function HTMLModElement() { [native code] }" -PASS ins: document.createElement() should instantiate a customized built-in element -PASS ins: innerHTML should instantiate a customized built-in element -PASS kbd: Define a customized built-in element -FAIL kbd: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyKbd extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS kbd: document.createElement() should instantiate a customized built-in element -PASS kbd: innerHTML should instantiate a customized built-in element -PASS label: Define a customized built-in element -FAIL label: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyLabel extends HTMLLabelElement { - constructor() { - super(); - } -}" but got function "function HTMLLabelElement() { [native code] }" -PASS label: document.createElement() should instantiate a customized built-in element -PASS label: innerHTML should instantiate a customized built-in element -PASS legend: Define a customized built-in element -FAIL legend: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyLegend extends HTMLLegendElement { - constructor() { - super(); - } -}" but got function "function HTMLLegendElement() { [native code] }" -PASS legend: document.createElement() should instantiate a customized built-in element -PASS legend: innerHTML should instantiate a customized built-in element -PASS li: Define a customized built-in element -FAIL li: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyLi extends HTMLLIElement { - constructor() { - super(); - } -}" but got function "function HTMLLIElement() { [native code] }" -PASS li: document.createElement() should instantiate a customized built-in element -PASS li: innerHTML should instantiate a customized built-in element -PASS link: Define a customized built-in element -FAIL link: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyLink extends HTMLLinkElement { - constructor() { - super(); - } -}" but got function "function HTMLLinkElement() { [native code] }" -PASS link: document.createElement() should instantiate a customized built-in element -PASS link: innerHTML should instantiate a customized built-in element -PASS main: Define a customized built-in element -FAIL main: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyMain extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS main: document.createElement() should instantiate a customized built-in element -PASS main: innerHTML should instantiate a customized built-in element -PASS map: Define a customized built-in element -FAIL map: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyMap extends HTMLMapElement { - constructor() { - super(); - } -}" but got function "function HTMLMapElement() { [native code] }" -PASS map: document.createElement() should instantiate a customized built-in element -PASS map: innerHTML should instantiate a customized built-in element -PASS mark: Define a customized built-in element -FAIL mark: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyMark extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS mark: document.createElement() should instantiate a customized built-in element -PASS mark: innerHTML should instantiate a customized built-in element -PASS menu: Define a customized built-in element -FAIL menu: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyMenu extends HTMLMenuElement { - constructor() { - super(); - } -}" but got function "function HTMLMenuElement() { [native code] }" -PASS menu: document.createElement() should instantiate a customized built-in element -PASS menu: innerHTML should instantiate a customized built-in element -PASS meta: Define a customized built-in element -FAIL meta: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyMeta extends HTMLMetaElement { - constructor() { - super(); - } -}" but got function "function HTMLMetaElement() { [native code] }" -PASS meta: document.createElement() should instantiate a customized built-in element -PASS meta: innerHTML should instantiate a customized built-in element -PASS meter: Define a customized built-in element -FAIL meter: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyMeter extends HTMLMeterElement { - constructor() { - super(); - } -}" but got function "function HTMLMeterElement() { [native code] }" -PASS meter: document.createElement() should instantiate a customized built-in element -PASS meter: innerHTML should instantiate a customized built-in element -PASS nav: Define a customized built-in element -FAIL nav: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyNav extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS nav: document.createElement() should instantiate a customized built-in element -PASS nav: innerHTML should instantiate a customized built-in element -PASS noscript: Define a customized built-in element -FAIL noscript: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyNoscript extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS noscript: document.createElement() should instantiate a customized built-in element -PASS noscript: innerHTML should instantiate a customized built-in element -PASS object: Define a customized built-in element -FAIL object: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyObject extends HTMLObjectElement { - constructor() { - super(); - } -}" but got function "function HTMLObjectElement() { [native code] }" -PASS object: document.createElement() should instantiate a customized built-in element -PASS object: innerHTML should instantiate a customized built-in element -PASS ol: Define a customized built-in element -FAIL ol: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyOl extends HTMLOListElement { - constructor() { - super(); - } -}" but got function "function HTMLOListElement() { [native code] }" -PASS ol: document.createElement() should instantiate a customized built-in element -PASS ol: innerHTML should instantiate a customized built-in element -PASS optgroup: Define a customized built-in element -FAIL optgroup: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyOptgroup extends HTMLOptGroupElement { - constructor() { - super(); - } -}" but got function "function HTMLOptGroupElement() { [native code] }" -PASS optgroup: document.createElement() should instantiate a customized built-in element -PASS optgroup: innerHTML should instantiate a customized built-in element -PASS option: Define a customized built-in element -FAIL option: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyOption extends HTMLOptionElement { - constructor() { - super(); - } -}" but got function "function HTMLOptionElement() { [native code] }" -PASS option: document.createElement() should instantiate a customized built-in element -PASS option: innerHTML should instantiate a customized built-in element -PASS output: Define a customized built-in element -FAIL output: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyOutput extends HTMLOutputElement { - constructor() { - super(); - } -}" but got function "function HTMLOutputElement() { [native code] }" -PASS output: document.createElement() should instantiate a customized built-in element -PASS output: innerHTML should instantiate a customized built-in element -PASS p: Define a customized built-in element -FAIL p: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyP extends HTMLParagraphElement { - constructor() { - super(); - } -}" but got function "function HTMLParagraphElement() { [native code] }" -PASS p: document.createElement() should instantiate a customized built-in element -PASS p: innerHTML should instantiate a customized built-in element -PASS param: Define a customized built-in element -FAIL param: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyParam extends HTMLParamElement { - constructor() { - super(); - } -}" but got function "function HTMLParamElement() { [native code] }" -PASS param: document.createElement() should instantiate a customized built-in element -PASS param: innerHTML should instantiate a customized built-in element -PASS picture: Define a customized built-in element -FAIL picture: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyPicture extends HTMLPictureElement { - constructor() { - super(); - } -}" but got function "function HTMLPictureElement() { [native code] }" -PASS picture: document.createElement() should instantiate a customized built-in element -PASS picture: innerHTML should instantiate a customized built-in element -PASS pre: Define a customized built-in element -FAIL pre: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyPre extends HTMLPreElement { - constructor() { - super(); - } -}" but got function "function HTMLPreElement() { [native code] }" -PASS pre: document.createElement() should instantiate a customized built-in element -PASS pre: innerHTML should instantiate a customized built-in element -PASS progress: Define a customized built-in element -FAIL progress: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyProgress extends HTMLProgressElement { - constructor() { - super(); - } -}" but got function "function HTMLProgressElement() { [native code] }" -PASS progress: document.createElement() should instantiate a customized built-in element -PASS progress: innerHTML should instantiate a customized built-in element -PASS q: Define a customized built-in element -FAIL q: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyQ extends HTMLQuoteElement { - constructor() { - super(); - } -}" but got function "function HTMLQuoteElement() { [native code] }" -PASS q: document.createElement() should instantiate a customized built-in element -PASS q: innerHTML should instantiate a customized built-in element -PASS rp: Define a customized built-in element -FAIL rp: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyRp extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS rp: document.createElement() should instantiate a customized built-in element -PASS rp: innerHTML should instantiate a customized built-in element -PASS rt: Define a customized built-in element -FAIL rt: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyRt extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS rt: document.createElement() should instantiate a customized built-in element -PASS rt: innerHTML should instantiate a customized built-in element -PASS ruby: Define a customized built-in element -FAIL ruby: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyRuby extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS ruby: document.createElement() should instantiate a customized built-in element -PASS ruby: innerHTML should instantiate a customized built-in element -PASS s: Define a customized built-in element -FAIL s: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyS extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS s: document.createElement() should instantiate a customized built-in element -PASS s: innerHTML should instantiate a customized built-in element -PASS samp: Define a customized built-in element -FAIL samp: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySamp extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS samp: document.createElement() should instantiate a customized built-in element -PASS samp: innerHTML should instantiate a customized built-in element -PASS script: Define a customized built-in element -FAIL script: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyScript extends HTMLScriptElement { - constructor() { - super(); - } -}" but got function "function HTMLScriptElement() { [native code] }" -PASS script: document.createElement() should instantiate a customized built-in element -PASS script: innerHTML should instantiate a customized built-in element -PASS section: Define a customized built-in element -FAIL section: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySection extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS section: document.createElement() should instantiate a customized built-in element -PASS section: innerHTML should instantiate a customized built-in element -PASS select: Define a customized built-in element -FAIL select: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySelect extends HTMLSelectElement { - constructor() { - super(); - } -}" but got function "function HTMLSelectElement() { [native code] }" -PASS select: document.createElement() should instantiate a customized built-in element -PASS select: innerHTML should instantiate a customized built-in element -PASS small: Define a customized built-in element -FAIL small: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySmall extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS small: document.createElement() should instantiate a customized built-in element -PASS small: innerHTML should instantiate a customized built-in element -PASS source: Define a customized built-in element -FAIL source: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySource extends HTMLSourceElement { - constructor() { - super(); - } -}" but got function "function HTMLSourceElement() { [native code] }" -PASS source: document.createElement() should instantiate a customized built-in element -PASS source: innerHTML should instantiate a customized built-in element -PASS span: Define a customized built-in element -FAIL span: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySpan extends HTMLSpanElement { - constructor() { - super(); - } -}" but got function "function HTMLSpanElement() { [native code] }" -PASS span: document.createElement() should instantiate a customized built-in element -PASS span: innerHTML should instantiate a customized built-in element -PASS strong: Define a customized built-in element -FAIL strong: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyStrong extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS strong: document.createElement() should instantiate a customized built-in element -PASS strong: innerHTML should instantiate a customized built-in element -PASS style: Define a customized built-in element -FAIL style: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyStyle extends HTMLStyleElement { - constructor() { - super(); - } -}" but got function "function HTMLStyleElement() { [native code] }" -PASS style: document.createElement() should instantiate a customized built-in element -PASS style: innerHTML should instantiate a customized built-in element -PASS sub: Define a customized built-in element -FAIL sub: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySub extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS sub: document.createElement() should instantiate a customized built-in element -PASS sub: innerHTML should instantiate a customized built-in element -PASS summary: Define a customized built-in element -FAIL summary: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySummary extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS summary: document.createElement() should instantiate a customized built-in element -PASS summary: innerHTML should instantiate a customized built-in element -PASS sup: Define a customized built-in element -FAIL sup: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MySup extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS sup: document.createElement() should instantiate a customized built-in element -PASS sup: innerHTML should instantiate a customized built-in element -PASS table: Define a customized built-in element -FAIL table: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTable extends HTMLTableElement { - constructor() { - super(); - } -}" but got function "function HTMLTableElement() { [native code] }" -PASS table: document.createElement() should instantiate a customized built-in element -PASS table: innerHTML should instantiate a customized built-in element -PASS tbody: Define a customized built-in element -FAIL tbody: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTbody extends HTMLTableSectionElement { - constructor() { - super(); - } -}" but got function "function HTMLTableSectionElement() { [native code] }" -PASS tbody: document.createElement() should instantiate a customized built-in element -PASS tbody: innerHTML should instantiate a customized built-in element -PASS td: Define a customized built-in element -FAIL td: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTd extends HTMLTableCellElement { - constructor() { - super(); - } -}" but got function "function HTMLTableCellElement() { [native code] }" -PASS td: document.createElement() should instantiate a customized built-in element -PASS td: innerHTML should instantiate a customized built-in element -PASS template: Define a customized built-in element -FAIL template: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTemplate extends HTMLTemplateElement { - constructor() { - super(); - } -}" but got function "function HTMLTemplateElement() { [native code] }" -PASS template: document.createElement() should instantiate a customized built-in element -PASS template: innerHTML should instantiate a customized built-in element -PASS textarea: Define a customized built-in element -FAIL textarea: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTextarea extends HTMLTextAreaElement { - constructor() { - super(); - } -}" but got function "function HTMLTextAreaElement() { [native code] }" -PASS textarea: document.createElement() should instantiate a customized built-in element -PASS textarea: innerHTML should instantiate a customized built-in element -PASS tfoot: Define a customized built-in element -FAIL tfoot: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTfoot extends HTMLTableSectionElement { - constructor() { - super(); - } -}" but got function "function HTMLTableSectionElement() { [native code] }" -PASS tfoot: document.createElement() should instantiate a customized built-in element -PASS tfoot: innerHTML should instantiate a customized built-in element -PASS th: Define a customized built-in element -FAIL th: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTh extends HTMLTableCellElement { - constructor() { - super(); - } -}" but got function "function HTMLTableCellElement() { [native code] }" -PASS th: document.createElement() should instantiate a customized built-in element -PASS th: innerHTML should instantiate a customized built-in element -PASS thead: Define a customized built-in element -FAIL thead: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyThead extends HTMLTableSectionElement { - constructor() { - super(); - } -}" but got function "function HTMLTableSectionElement() { [native code] }" -PASS thead: document.createElement() should instantiate a customized built-in element -PASS thead: innerHTML should instantiate a customized built-in element -PASS time: Define a customized built-in element -FAIL time: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTime extends HTMLTimeElement { - constructor() { - super(); - } -}" but got function "function HTMLTimeElement() { [native code] }" -PASS time: document.createElement() should instantiate a customized built-in element -PASS time: innerHTML should instantiate a customized built-in element -PASS title: Define a customized built-in element -FAIL title: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTitle extends HTMLTitleElement { - constructor() { - super(); - } -}" but got function "function HTMLTitleElement() { [native code] }" -PASS title: document.createElement() should instantiate a customized built-in element -PASS title: innerHTML should instantiate a customized built-in element -PASS tr: Define a customized built-in element -FAIL tr: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTr extends HTMLTableRowElement { - constructor() { - super(); - } -}" but got function "function HTMLTableRowElement() { [native code] }" -PASS tr: document.createElement() should instantiate a customized built-in element -PASS tr: innerHTML should instantiate a customized built-in element -PASS track: Define a customized built-in element -FAIL track: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyTrack extends HTMLTrackElement { - constructor() { - super(); - } -}" but got function "function HTMLTrackElement() { [native code] }" -PASS track: document.createElement() should instantiate a customized built-in element -PASS track: innerHTML should instantiate a customized built-in element -PASS u: Define a customized built-in element -FAIL u: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyU extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS u: document.createElement() should instantiate a customized built-in element -PASS u: innerHTML should instantiate a customized built-in element -PASS ul: Define a customized built-in element -FAIL ul: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyUl extends HTMLUListElement { - constructor() { - super(); - } -}" but got function "function HTMLUListElement() { [native code] }" -PASS ul: document.createElement() should instantiate a customized built-in element -PASS ul: innerHTML should instantiate a customized built-in element -PASS var: Define a customized built-in element -FAIL var: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyVar extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS var: document.createElement() should instantiate a customized built-in element -PASS var: innerHTML should instantiate a customized built-in element -PASS video: Define a customized built-in element -FAIL video: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyVideo extends HTMLVideoElement { - constructor() { - super(); - } -}" but got function "function HTMLVideoElement() { [native code] }" -PASS video: document.createElement() should instantiate a customized built-in element -PASS video: innerHTML should instantiate a customized built-in element -PASS wbr: Define a customized built-in element -FAIL wbr: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyWbr extends HTMLElement { - constructor() { - super(); - } -}" but got function "function HTMLElement() { [native code] }" -PASS wbr: document.createElement() should instantiate a customized built-in element -PASS wbr: innerHTML should instantiate a customized built-in element -PASS datalist: Define a customized built-in element -FAIL datalist: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class extends HTMLDataListElement { - constructor() { - super(); - } - }" but got function "function HTMLDataListElement() { [native code] }" -PASS datalist: document.createElement() should instantiate a customized built-in element -PASS datalist: innerHTML should instantiate a customized built-in element -PASS dialog: Define a customized built-in element -FAIL dialog: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class MyDialog extends HTMLDialogElement { - constructor() { - super(); - } - }" but got function "function HTMLDialogElement() { [native code] }" -PASS dialog: document.createElement() should instantiate a customized built-in element -PASS dialog: innerHTML should instantiate a customized built-in element -PASS slot: Define a customized built-in element -FAIL slot: Operator 'new' should instantiate a customized built-in element assert_equals: Cloning a customized built-in element should succeed. expected function "class extends HTMLSlotElement { - constructor() { - super(); - } - }" but got function "function HTMLSlotElement() { [native code] }" -PASS slot: document.createElement() should instantiate a customized built-in element -PASS slot: innerHTML should instantiate a customized built-in element -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/parser/serializing-html-fragments-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/parser/serializing-html-fragments-expected.txt deleted file mode 100644 index b9df486..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/parser/serializing-html-fragments-expected.txt +++ /dev/null
@@ -1,6 +0,0 @@ -This is a testharness.js-based test. -FAIL "is" value should be serialized if the custom element has no "is" content attribute assert_equals: expected "<p is=\"my-p\" class=\"foo\"></p>" but got "<p class=\"foo\"></p>" -PASS "is" value should be serialized even for an undefined element -PASS "is" content attribute should be serialized even if the element is a customized built-in element -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/upgrading/Node-cloneNode-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/upgrading/Node-cloneNode-expected.txt deleted file mode 100644 index d452c554..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/upgrading/Node-cloneNode-expected.txt +++ /dev/null
@@ -1,13 +0,0 @@ -This is a testharness.js-based test. -PASS Node.prototype.cloneNode(false) must be able to clone a custom element -PASS Node.prototype.cloneNode(false) must be able to clone as a autonomous custom element when it contains is attribute -FAIL Node.prototype.cloneNode(false) must be able to clone as a customized built-in element when it has an inconsistent "is" attribute assert_true: A cloned custom element must be an instance of the custom element even with an inconsistent "is" attribute expected true got false -PASS Node.prototype.cloneNode(false) must be able to clone a custom element inside an iframe -PASS Node.prototype.cloneNode(true) must be able to clone a descendent custom element -PASS Node.prototype.cloneNode(true) must set parentNode, previousSibling, and nextSibling before upgrading custom elements -PASS HTMLElement constructor must throw an InvalidStateError when the top of the construction stack is marked AlreadyConstructed due to a custom element constructor constructing itself after super() call -PASS HTMLElement constructor must throw an InvalidStateError when the top of the construction stack is marked AlreadyConstructed due to a custom element constructor constructing itself before super() call -PASS Upgrading a custom element must throw InvalidStateError when the custom element's constructor returns another element -PASS Inserting an element must not try to upgrade a custom element when it had already failed to upgrade once -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/construct-byob-request-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/construct-byob-request-expected.txt new file mode 100644 index 0000000..1bb3c16 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/construct-byob-request-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL construct-byob-request.js browser context wrapper file Uncaught RangeError: bytes type is not yet implemented +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/construct-byob-request.dedicatedworker-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/construct-byob-request.dedicatedworker-expected.txt new file mode 100644 index 0000000..b4cca16 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/construct-byob-request.dedicatedworker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Untitled Uncaught RangeError: bytes type is not yet implemented +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/construct-byob-request.serviceworker.https-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/construct-byob-request.serviceworker.https-expected.txt new file mode 100644 index 0000000..a92ddfd --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/construct-byob-request.serviceworker.https-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Service worker test setup assert_unreached: unregister and register should not fail: Failed to register a ServiceWorker: ServiceWorker script evaluation failed Reached unreachable code +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/construct-byob-request.sharedworker-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/construct-byob-request.sharedworker-expected.txt new file mode 100644 index 0000000..b4cca16 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/construct-byob-request.sharedworker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Untitled Uncaught RangeError: bytes type is not yet implemented +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/general-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/general-expected.txt new file mode 100644 index 0000000..3d6778f6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/general-expected.txt
@@ -0,0 +1,83 @@ +This is a testharness.js-based test. +Found 76 tests; 2 PASS, 74 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS getReader({mode: "byob"}) throws on non-bytes streams +FAIL ReadableStream with byte source can be constructed with no errors bytes type is not yet implemented +FAIL getReader({mode}) must perform ToString() bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct and expect start and pull being called bytes type is not yet implemented +FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct with highWaterMark of 0 bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when closed bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when errored bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read() bytes type is not yet implemented +FAIL ReadableStream with byte source: autoAllocateChunkSize bytes type is not yet implemented +FAIL ReadableStream with byte source: Mix of auto allocate and BYOB bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Push source that doesn't understand pull signal bytes type is not yet implemented +FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ + pull: 'foo', + type: 'bytes' + })" threw object "RangeError: bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") +FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with too big value bytes type is not yet implemented +FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), read(view), then cancel() bytes type is not yet implemented +FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw if close()-ed more than once bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw on enqueue() after close() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls bytes type is not yet implemented +FAIL ReadableStream with byte source: read() twice, then enqueue() twice bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), close() and respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), big enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with zero-length view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read() on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL calling respond() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respondWithNewView() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respond(0) twice on the same byobRequest should throw even when closed bytes type is not yet implemented +FAIL pull() resolving should not make releaseLock() possible bytes type is not yet implemented +FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction bytes type is not yet implemented +FAIL ReadableStreamBYOBReader can be constructed directly bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" bytes type is not yet implemented +PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/general.dedicatedworker-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/general.dedicatedworker-expected.txt new file mode 100644 index 0000000..3d6778f6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/general.dedicatedworker-expected.txt
@@ -0,0 +1,83 @@ +This is a testharness.js-based test. +Found 76 tests; 2 PASS, 74 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS getReader({mode: "byob"}) throws on non-bytes streams +FAIL ReadableStream with byte source can be constructed with no errors bytes type is not yet implemented +FAIL getReader({mode}) must perform ToString() bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct and expect start and pull being called bytes type is not yet implemented +FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct with highWaterMark of 0 bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when closed bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when errored bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read() bytes type is not yet implemented +FAIL ReadableStream with byte source: autoAllocateChunkSize bytes type is not yet implemented +FAIL ReadableStream with byte source: Mix of auto allocate and BYOB bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Push source that doesn't understand pull signal bytes type is not yet implemented +FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ + pull: 'foo', + type: 'bytes' + })" threw object "RangeError: bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") +FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with too big value bytes type is not yet implemented +FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), read(view), then cancel() bytes type is not yet implemented +FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw if close()-ed more than once bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw on enqueue() after close() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls bytes type is not yet implemented +FAIL ReadableStream with byte source: read() twice, then enqueue() twice bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), close() and respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), big enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with zero-length view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read() on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL calling respond() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respondWithNewView() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respond(0) twice on the same byobRequest should throw even when closed bytes type is not yet implemented +FAIL pull() resolving should not make releaseLock() possible bytes type is not yet implemented +FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction bytes type is not yet implemented +FAIL ReadableStreamBYOBReader can be constructed directly bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" bytes type is not yet implemented +PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/general.serviceworker.https-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/general.serviceworker.https-expected.txt new file mode 100644 index 0000000..bce9964 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/general.serviceworker.https-expected.txt
@@ -0,0 +1,83 @@ +This is a testharness.js-based test. +PASS Service worker test setup +PASS getReader({mode: "byob"}) throws on non-bytes streams +FAIL ReadableStream with byte source can be constructed with no errors bytes type is not yet implemented +FAIL getReader({mode}) must perform ToString() bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct and expect start and pull being called bytes type is not yet implemented +FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct with highWaterMark of 0 bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when closed bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when errored bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read() bytes type is not yet implemented +FAIL ReadableStream with byte source: autoAllocateChunkSize bytes type is not yet implemented +FAIL ReadableStream with byte source: Mix of auto allocate and BYOB bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Push source that doesn't understand pull signal bytes type is not yet implemented +FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ + pull: 'foo', + type: 'bytes' + })" threw object "RangeError: bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") +FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with too big value bytes type is not yet implemented +FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), read(view), then cancel() bytes type is not yet implemented +FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw if close()-ed more than once bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw on enqueue() after close() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls bytes type is not yet implemented +FAIL ReadableStream with byte source: read() twice, then enqueue() twice bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), close() and respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), big enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with zero-length view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read() on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL calling respond() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respondWithNewView() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respond(0) twice on the same byobRequest should throw even when closed bytes type is not yet implemented +FAIL pull() resolving should not make releaseLock() possible bytes type is not yet implemented +FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction bytes type is not yet implemented +FAIL ReadableStreamBYOBReader can be constructed directly bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" bytes type is not yet implemented +PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/general.sharedworker-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/general.sharedworker-expected.txt new file mode 100644 index 0000000..3d6778f6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/external/wpt/streams/readable-byte-streams/general.sharedworker-expected.txt
@@ -0,0 +1,83 @@ +This is a testharness.js-based test. +Found 76 tests; 2 PASS, 74 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS getReader({mode: "byob"}) throws on non-bytes streams +FAIL ReadableStream with byte source can be constructed with no errors bytes type is not yet implemented +FAIL getReader({mode}) must perform ToString() bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct and expect start and pull being called bytes type is not yet implemented +FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct with highWaterMark of 0 bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when closed bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when errored bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically bytes type is not yet implemented +FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read() bytes type is not yet implemented +FAIL ReadableStream with byte source: autoAllocateChunkSize bytes type is not yet implemented +FAIL ReadableStream with byte source: Mix of auto allocate and BYOB bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Push source that doesn't understand pull signal bytes type is not yet implemented +FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ + pull: 'foo', + type: 'bytes' + })" threw object "RangeError: bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") +FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with too big value bytes type is not yet implemented +FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), read(view), then cancel() bytes type is not yet implemented +FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw if close()-ed more than once bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw on enqueue() after close() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls bytes type is not yet implemented +FAIL ReadableStream with byte source: read() twice, then enqueue() twice bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), close() and respond() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), big enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with zero-length view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail bytes type is not yet implemented +FAIL ReadableStream with byte source: read() on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) on an errored stream bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then error() bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it bytes type is not yet implemented +FAIL calling respond() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respondWithNewView() twice on the same byobRequest should throw bytes type is not yet implemented +FAIL calling respond(0) twice on the same byobRequest should throw even when closed bytes type is not yet implemented +FAIL pull() resolving should not make releaseLock() possible bytes type is not yet implemented +FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction bytes type is not yet implemented +FAIL ReadableStreamBYOBReader can be constructed directly bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" bytes type is not yet implemented +PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/menulist-appearance-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/menulist-appearance-rtl-expected.png index 4438df52..5f6c50f 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/menulist-appearance-rtl-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/menulist-appearance-rtl-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/menulist-appearance-rtl-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/menulist-appearance-rtl-expected.txt index 565babae..afca14e 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/menulist-appearance-rtl-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/menulist-appearance-rtl-expected.txt
@@ -58,8 +58,8 @@ LayoutText {#text} at (0,0) size 587x19 text run at (0,0) width 587: "The following line and the SELECT element should have same text, and no characters are lacking." LayoutBlockFlow {DIV} at (0,20) size 784x15 - LayoutText {#text} at (0,0) size 97x15 - text run at (0,0) width 97 RTL: "\x{627}\x{644}\x{627}\x{642}\x{62A}\x{631}\x{627}\x{62D}\x{627}\x{62A} / \x{627}\x{644}\x{634}\x{643}\x{627}\x{648}\x{64A}" + LayoutText {#text} at (0,0) size 100x15 + text run at (0,0) width 100 RTL: "\x{627}\x{644}\x{627}\x{642}\x{62A}\x{631}\x{627}\x{62D}\x{627}\x{62A} / \x{627}\x{644}\x{634}\x{643}\x{627}\x{648}\x{64A}" LayoutBlockFlow (anonymous) at (0,35) size 784x20 LayoutMenuList {SELECT} at (0,0) size 113x20 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)] LayoutBlockFlow (anonymous) at (1,1) size 111x18
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/forms/select/menulist-appearance-rtl-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/fast/forms/select/menulist-appearance-rtl-expected.txt new file mode 100644 index 0000000..565babae --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win7/fast/forms/select/menulist-appearance-rtl-expected.txt
@@ -0,0 +1,170 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x563 + LayoutBlockFlow {HTML} at (0,0) size 800x563 + LayoutBlockFlow {BODY} at (8,16) size 784x539 + LayoutBlockFlow {P} at (0,0) size 784x40 + LayoutText {#text} at (0,0) size 755x39 + text run at (0,0) width 755: "This tests that bidirectional text is correctly rendered in popup controls. The order of the text below each popup button should" + text run at (0,20) width 520: "match the order of the select's option text, and the order of the text in the popup menu." + LayoutBlockFlow {DL} at (0,56) size 784x180 + LayoutBlockFlow {DT} at (0,0) size 784x20 + LayoutText {#text} at (0,0) size 262x19 + text run at (0,0) width 262: "1) direction: rtl; -webkit-rtl-ordering: logical" + LayoutBlockFlow {DD} at (40,20) size 744x40 + LayoutBlockFlow (anonymous) at (0,0) size 744x20 + LayoutMenuList {SELECT} at (0,0) size 100x20 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)] + LayoutBlockFlow (anonymous) at (1,1) size 98x18 + LayoutText (anonymous) at (31,1) size 63x16 + text run at (31,1) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}" + text run at (73,1) width 21: "abc" + LayoutText {#text} at (0,0) size 0x0 + LayoutBlockFlow {DIV} at (0,20) size 100x20 + LayoutText {#text} at (31,0) size 69x19 + text run at (31,0) width 47 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}" + text run at (78,0) width 22: "abc" + LayoutBlockFlow {DT} at (0,60) size 784x20 + LayoutText {#text} at (0,0) size 105x19 + text run at (0,0) width 105: "2) text-align: right" + LayoutBlockFlow {DD} at (40,80) size 744x40 + LayoutBlockFlow (anonymous) at (0,0) size 744x20 + LayoutMenuList {SELECT} at (0,0) size 200x20 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)] + LayoutBlockFlow (anonymous) at (1,1) size 198x18 + LayoutText (anonymous) at (4,1) size 63x16 + text run at (4,1) width 21: "abc" + text run at (25,1) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}" + LayoutText {#text} at (0,0) size 0x0 + LayoutBlockFlow {DIV} at (0,20) size 200x20 + LayoutText {#text} at (0,0) size 69x19 + text run at (0,0) width 22: "abc" + text run at (22,0) width 47 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}" + LayoutBlockFlow {DT} at (0,120) size 784x20 + LayoutText {#text} at (0,0) size 68x19 + text run at (0,0) width 68: "3) No style" + LayoutBlockFlow {DD} at (40,140) size 744x40 + LayoutBlockFlow (anonymous) at (0,0) size 744x20 + LayoutMenuList {SELECT} at (0,0) size 100x20 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)] + LayoutBlockFlow (anonymous) at (1,1) size 98x18 + LayoutText (anonymous) at (4,1) size 63x16 + text run at (4,1) width 21: "abc" + text run at (25,1) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}" + LayoutText {#text} at (0,0) size 0x0 + LayoutBlockFlow {DIV} at (0,20) size 100x20 + LayoutText {#text} at (0,0) size 69x19 + text run at (0,0) width 22: "abc" + text run at (22,0) width 47 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}" + LayoutBlockFlow {DIV} at (0,262) size 784x55 + LayoutBlockFlow (anonymous) at (0,0) size 784x20 + LayoutText {#text} at (0,0) size 587x19 + text run at (0,0) width 587: "The following line and the SELECT element should have same text, and no characters are lacking." + LayoutBlockFlow {DIV} at (0,20) size 784x15 + LayoutText {#text} at (0,0) size 97x15 + text run at (0,0) width 97 RTL: "\x{627}\x{644}\x{627}\x{642}\x{62A}\x{631}\x{627}\x{62D}\x{627}\x{62A} / \x{627}\x{644}\x{634}\x{643}\x{627}\x{648}\x{64A}" + LayoutBlockFlow (anonymous) at (0,35) size 784x20 + LayoutMenuList {SELECT} at (0,0) size 113x20 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)] + LayoutBlockFlow (anonymous) at (1,1) size 111x18 + LayoutText (anonymous) at (4,1) size 91x16 + text run at (4,1) width 91 RTL: "\x{627}\x{644}\x{627}\x{642}\x{62A}\x{631}\x{627}\x{62D}\x{627}\x{62A} / \x{627}\x{644}\x{634}\x{643}\x{627}\x{648}\x{64A}" + LayoutText {#text} at (0,0) size 0x0 + LayoutBlockFlow {P} at (0,343) size 784x20 + LayoutText {#text} at (0,0) size 659x19 + text run at (0,0) width 659: "Verify that the alignment and writing direction of each selected item matches the one below the pop-up button." +layer at (8,268) size 784x2 clip at (0,0) size 0x0 + LayoutBlockFlow {HR} at (0,252) size 784x2 [border: (1px inset #EEEEEE)] +layer at (8,341) size 784x2 clip at (0,0) size 0x0 + LayoutBlockFlow {HR} at (0,325) size 784x2 [border: (1px inset #EEEEEE)] +layer at (8,395) size 784x160 + LayoutBlockFlow {DIV} at (0,379) size 784x160 + LayoutMultiColumnSet (anonymous) at (0,0) size 784x160 +layer at (8,395) size 384x320 backgroundClip at (0,0) size 400x555 clip at (0,0) size 400x555 + LayoutMultiColumnFlowThread (anonymous) at (0,0) size 384x320 + LayoutBlockFlow {DIV} at (0,0) size 384x160 + LayoutMenuList {SELECT} at (0,0) size 350x22 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)] + LayoutBlockFlow (anonymous) at (1,1) size 348x21 + LayoutText (anonymous) at (4,1) size 170x18 + text run at (4,1) width 35: "First " + text run at (39,1) width 50 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA}" + text run at (89,1) width 18: "03" + text run at (107,1) width 39 RTL: "\x{5E9}\x{5E0}\x{5D9}\x{5D4} (" + text run at (146,1) width 28: " fifth" + LayoutBlockFlow {DIV} at (0,22) size 352x18 + LayoutText {#text} at (1,1) size 130x15 + text run at (1,1) width 27: "First " + text run at (28,1) width 38 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA}" + text run at (66,1) width 12: "03" + text run at (78,1) width 28 RTL: "\x{5E9}\x{5E0}\x{5D9}\x{5D4} (" + text run at (106,1) width 25: " fifth" + LayoutMenuList {SELECT} at (0,40) size 350x22 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)] + LayoutBlockFlow (anonymous) at (1,1) size 348x21 + LayoutText (anonymous) at (4,1) size 170x18 + text run at (4,1) width 24: "fifth" + text run at (28,1) width 54 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} " + text run at (82,1) width 18: "03" + text run at (100,1) width 43 RTL: " \x{5E9}\x{5E0}\x{5D9}\x{5D4} (" + text run at (143,1) width 31: "First" + LayoutBlockFlow {DIV} at (0,62) size 352x18 + LayoutText {#text} at (1,1) size 130x15 + text run at (1,1) width 22: "fifth" + text run at (23,1) width 41 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} " + text run at (64,1) width 12: "03" + text run at (76,1) width 31 RTL: " \x{5E9}\x{5E0}\x{5D9}\x{5D4} (" + text run at (107,1) width 24: "First" + LayoutMenuList {SELECT} at (0,80) size 350x22 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)] + LayoutBlockFlow (anonymous) at (1,1) size 348x21 + LayoutText (anonymous) at (4,1) size 170x18 + text run at (4,1) width 170 LTR override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth" + LayoutBlockFlow {DIV} at (0,102) size 352x18 + LayoutText {#text} at (1,1) size 130x15 + text run at (1,1) width 130 LTR override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth" + LayoutMenuList {SELECT} at (0,120) size 350x22 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)] + LayoutBlockFlow (anonymous) at (1,1) size 348x21 + LayoutText (anonymous) at (4,1) size 170x18 + text run at (4,1) width 170 RTL override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth" + LayoutBlockFlow {DIV} at (0,142) size 352x18 + LayoutText {#text} at (1,1) size 130x15 + text run at (1,1) width 130 RTL override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth" + LayoutBlockFlow {DIV} at (0,160) size 384x160 + LayoutMenuList {SELECT} at (0,0) size 350x22 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)] + LayoutBlockFlow (anonymous) at (1,1) size 348x21 + LayoutText (anonymous) at (174,1) size 170x18 + text run at (174,1) width 35: "First " + text run at (209,1) width 50 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA}" + text run at (259,1) width 18: "03" + text run at (277,1) width 39 RTL: "\x{5E9}\x{5E0}\x{5D9}\x{5D4} (" + text run at (316,1) width 28: " fifth" + LayoutBlockFlow {DIV} at (0,22) size 352x18 + LayoutText {#text} at (221,1) size 130x15 + text run at (221,1) width 27: "First " + text run at (248,1) width 38 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA}" + text run at (286,1) width 12: "03" + text run at (298,1) width 28 RTL: "\x{5E9}\x{5E0}\x{5D9}\x{5D4} (" + text run at (326,1) width 25: " fifth" + LayoutMenuList {SELECT} at (0,40) size 350x22 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)] + LayoutBlockFlow (anonymous) at (1,1) size 348x21 + LayoutText (anonymous) at (174,1) size 170x18 + text run at (174,1) width 24: "fifth" + text run at (198,1) width 54 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} " + text run at (252,1) width 18: "03" + text run at (270,1) width 43 RTL: " \x{5E9}\x{5E0}\x{5D9}\x{5D4} (" + text run at (313,1) width 31: "First" + LayoutBlockFlow {DIV} at (0,62) size 352x18 + LayoutText {#text} at (221,1) size 130x15 + text run at (221,1) width 22: "fifth" + text run at (243,1) width 41 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} " + text run at (284,1) width 12: "03" + text run at (296,1) width 31 RTL: " \x{5E9}\x{5E0}\x{5D9}\x{5D4} (" + text run at (327,1) width 24: "First" + LayoutMenuList {SELECT} at (0,80) size 350x22 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)] + LayoutBlockFlow (anonymous) at (1,1) size 348x21 + LayoutText (anonymous) at (174,1) size 170x18 + text run at (174,1) width 170 LTR override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth" + LayoutBlockFlow {DIV} at (0,102) size 352x18 + LayoutText {#text} at (221,1) size 130x15 + text run at (221,1) width 130 LTR override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth" + LayoutMenuList {SELECT} at (0,120) size 350x22 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)] + LayoutBlockFlow (anonymous) at (1,1) size 348x21 + LayoutText (anonymous) at (174,1) size 170x18 + text run at (174,1) width 170 RTL override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth" + LayoutBlockFlow {DIV} at (0,142) size 352x18 + LayoutText {#text} at (221,1) size 130x15 + text run at (221,1) width 130 RTL override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
diff --git a/third_party/WebKit/LayoutTests/resize-observer/wrapper-tracing.html b/third_party/WebKit/LayoutTests/resize-observer/wrapper-tracing.html new file mode 100644 index 0000000..3d954a0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/resize-observer/wrapper-tracing.html
@@ -0,0 +1,64 @@ +<!DOCTYPE html> +<script src="../resources/testharness.js"></script> +<script src="../resources/testharnessreport.js"></script> +<body> +<script> +async_test(t => { + // Test that ResizeObserver and its callback function do not cause any crash. + // This test is considered as successful as long as the test doesn't crash. + // See also https://crbug.com/792604 and https://crbug.com/809784 . + + let target_element = document.createElement('div'); + document.body.appendChild(target_element); + + // Run a bunch of ResizeObservers to expect high probability to cause a crash. + const num_of_observers = 100; + resize_observers = new Array(num_of_observers); + for (let i = 0; i < num_of_observers; ++i) { + resize_observers[i] = new ResizeObserver(entries => { + for (let i = 0; i < num_of_observers; ++i) { + if (resize_observers[i] === null) continue; + // An Element retains the callback functions that are observing the + // change on size of the Element. Make the Element not retain the + // callback functions. + resize_observers[i].unobserve(target_element); + // Make the test itself not retain the callback functions. + resize_observers[i] = null; + } + + // Try to collect the callback functions. + gc(); + + on_observed(); + }); + + resize_observers[i].observe(target_element); + } + + let observation_count = 0; + // Wait for the test to finish resize observations for a while. + let test_done_timer = null; + const test_done_timer_delay = 100; + const on_observed = () => { + ++observation_count; + + if (test_done_timer !== null) + return; + + test_done_timer = setTimeout(() => { + // https://wicg.github.io/ResizeObserver/#broadcast-resize-notifications-h + // 3.3.4. Broadcast active observations is a bit ambiguous about whether + // |unobserve| in the callback functions takes effect immediately or + // delayed. Assuming that it must take effect immediately, the expected + // number of observations is 1. + assert_equals(observation_count, 1); + + target_element.remove(); + t.done(); + }, test_done_timer_delay); + }; + + target_element.style.width = "42px"; +}, "Tries to break wrapper-tracing and to make it crash."); +</script> +</body>
diff --git a/third_party/WebKit/LayoutTests/typedcssom/the-stylepropertymap/declared/delete-rule-crash.html b/third_party/WebKit/LayoutTests/typedcssom/the-stylepropertymap/declared/delete-rule-crash.html index 8f9ade7..bee2c49c 100644 --- a/third_party/WebKit/LayoutTests/typedcssom/the-stylepropertymap/declared/delete-rule-crash.html +++ b/third_party/WebKit/LayoutTests/typedcssom/the-stylepropertymap/declared/delete-rule-crash.html
@@ -24,6 +24,5 @@ styleMap.append('transition-duration', '1s'); styleMap.delete('color'); styleMap.set('width', '10px'); - styleMap.update('width', () => CSS.px(1)); }, "Deleting a style rule does not crash the corresponding declared style map"); </script>
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt index 9188def6..e9248c5 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -6879,10 +6879,10 @@ interface StylePropertyMap : StylePropertyMapReadOnly attribute @@toStringTag method append + method clear method constructor method delete method set - method update interface StylePropertyMapReadOnly attribute @@toStringTag method @@iterator
diff --git a/third_party/WebKit/PRESUBMIT.py b/third_party/WebKit/PRESUBMIT.py index 292b64a..95a0aba1 100644 --- a/third_party/WebKit/PRESUBMIT.py +++ b/third_party/WebKit/PRESUBMIT.py
@@ -101,10 +101,16 @@ style_checker_path = input_api.os_path.join(input_api.PresubmitLocalPath(), 'Tools', 'Scripts', 'check-webkit-style') args = [input_api.python_executable, style_checker_path, '--diff-files'] - files = [input_api.os_path.join('..', '..', f.LocalPath()) - for f in input_api.AffectedFiles() - # Filter out files that follow Chromium's coding style. - if not re_chromium_style_file.search(f.LocalPath())] + files = [] + for f in input_api.AffectedFiles(): + file_path = f.LocalPath() + # Filter out files that follow Chromium's coding style. + if re_chromium_style_file.search(file_path): + continue + # Filter out changes in LayoutTests. + if 'LayoutTests' + input_api.os_path.sep in file_path and 'TestExpectations' not in file_path: + continue + files.append(input_api.os_path.join('..', '..', file_path)) # Do not call check-webkit-style with empty affected file list if all # input_api.AffectedFiles got filtered. if not files:
diff --git a/third_party/WebKit/PRESUBMIT_test.py b/third_party/WebKit/PRESUBMIT_test.py index 448fb5f..c1ff0b0 100644 --- a/third_party/WebKit/PRESUBMIT_test.py +++ b/third_party/WebKit/PRESUBMIT_test.py
@@ -41,10 +41,12 @@ """ diff_file_webkit_h = ['some diff'] diff_file_chromium_h = ['another diff'] + diff_file_test_expectations = ['more diff'] mock_input_api = MockInputApi() mock_input_api.files = [ MockAffectedFile('FileWebkit.h', diff_file_webkit_h), - MockAffectedFile('file_chromium.h', diff_file_chromium_h) + MockAffectedFile('file_chromium.h', diff_file_chromium_h), + MockAffectedFile('LayoutTests/TestExpectations', diff_file_test_expectations) ] # Access to a protected member _CheckStyle # pylint: disable=W0212 @@ -52,8 +54,9 @@ capture = Capture() # pylint: disable=E1101 subprocess.Popen.assert_called_with(capture, stderr=-1) - self.assertEqual(4, len(capture.value)) + self.assertEqual(5, len(capture.value)) self.assertEqual('../../FileWebkit.h', capture.value[3]) + self.assertEqual('../../LayoutTests/TestExpectations', capture.value[4]) @mock.patch('subprocess.Popen') def testCheckChangeOnUploadWithEmptyAffectedFileList(self, _): @@ -62,10 +65,12 @@ """ diff_file_chromium1_h = ['some diff'] diff_file_chromium2_h = ['another diff'] + diff_file_layout_test_html = ['more diff'] mock_input_api = MockInputApi() mock_input_api.files = [ MockAffectedFile('first_file_chromium.h', diff_file_chromium1_h), - MockAffectedFile('second_file_chromium.h', diff_file_chromium2_h) + MockAffectedFile('second_file_chromium.h', diff_file_chromium2_h), + MockAffectedFile('LayoutTests/some_tests.html', diff_file_layout_test_html) ] # Access to a protected member _CheckStyle # pylint: disable=W0212
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp index 8cd981f..15f3c1f 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
@@ -597,16 +597,9 @@ // to arrive: the Content-Length HTTP header is not sent for chunked // downloads. - // Decide what kind of cached data we should produce while streaming. Only - // produce parser cache if the non-streaming compile takes advantage of it. - v8::ScriptCompiler::CompileOptions compile_option = - v8::ScriptCompiler::kNoCompileOptions; - if (settings->GetV8CacheOptions() == kV8CacheOptionsParse) - compile_option = v8::ScriptCompiler::kProduceParserCache; - - ScriptStreamer* streamer = - new ScriptStreamer(script, script_type, script_state, compile_option, - std::move(loading_task_runner)); + ScriptStreamer* streamer = new ScriptStreamer( + script, script_type, script_state, v8::ScriptCompiler::kNoCompileOptions, + std::move(loading_task_runner)); // If this script was ready when streaming began, no callbacks will be // received to populate the data for the ScriptStreamer, so send them now.
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8CacheOptions.h b/third_party/WebKit/Source/bindings/core/v8/V8CacheOptions.h index 6d0c877..2ce154eb 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8CacheOptions.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8CacheOptions.h
@@ -36,7 +36,6 @@ enum V8CacheOptions { kV8CacheOptionsDefault, // Use whatever the current default is. kV8CacheOptionsNone, // V8 caching turned off. - kV8CacheOptionsParse, // Use parser caching. kV8CacheOptionsCode, // Use code caching. // Generate the code cache in the first load. kV8CacheOptionsCodeWithoutHeatCheck,
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp index 7af2beb..657bb9e5 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp
@@ -134,8 +134,7 @@ v8::Local<v8::String> code, v8::ScriptOrigin origin, InspectorCompileScriptEvent::V8CacheResult* cache_result) { - DCHECK(consume_options == v8::ScriptCompiler::kConsumeParserCache || - consume_options == v8::ScriptCompiler::kConsumeCodeCache); + DCHECK(consume_options == v8::ScriptCompiler::kConsumeCodeCache); const char* data = cached_metadata->Data(); int length = cached_metadata->size(); v8::ScriptCompiler::CachedData* cached_data = @@ -155,55 +154,9 @@ return script; } -// Compile a script, and produce a V8 cache for future use. -v8::MaybeLocal<v8::Script> CompileAndProduceCache( - CachedMetadataHandler* cache_handler, - uint32_t tag, - v8::ScriptCompiler::CompileOptions produce_options, - CachedMetadataHandler::CacheType cache_type, - v8::Isolate* isolate, - v8::Local<v8::String> code, - v8::ScriptOrigin origin, - InspectorCompileScriptEvent::V8CacheResult* cache_result) { - // TODO(crbug.com/783124): We want to remove the support for producing - // parser cache soon. This function should be removed once the support - // for parser cache is removed. - DCHECK_EQ(produce_options, v8::ScriptCompiler::kProduceParserCache); - v8::ScriptCompiler::Source source(code, origin); - v8::MaybeLocal<v8::Script> script = v8::ScriptCompiler::Compile( - isolate->GetCurrentContext(), &source, produce_options); - const v8::ScriptCompiler::CachedData* cached_data = source.GetCachedData(); - if (cached_data) { - const char* data = reinterpret_cast<const char*>(cached_data->data); - int length = cached_data->length; - if (length > 1024) { - // Omit histogram samples for small cache data to avoid outliers. - int cache_size_ratio = static_cast<int>(100.0 * length / code->Length()); - DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, - code_cache_size_histogram, - ("V8.CodeCacheSizeRatio", 0, 10000, 50)); - code_cache_size_histogram.Count(cache_size_ratio); - } - cache_handler->ClearCachedMetadata(CachedMetadataHandler::kCacheLocally); - cache_handler->SetCachedMetadata(tag, data, length, cache_type); - } +enum CacheTagKind { kCacheTagCode = 0, kCacheTagTimeStamp = 1, kCacheTagLast }; - if (cache_result) { - cache_result->produce_result = WTF::make_optional( - InspectorCompileScriptEvent::V8CacheResult::ProduceResult( - produce_options, cached_data ? cached_data->length : 0)); - } - return script; -} - -enum CacheTagKind { - kCacheTagParser = 0, - kCacheTagCode = 1, - kCacheTagTimeStamp = 3, - kCacheTagLast -}; - -static const int kCacheTagKindSize = 2; +static const int kCacheTagKindSize = 1; uint32_t CacheTag(CacheTagKind kind, const String& encoding) { static_assert((1 << kCacheTagKindSize) >= kCacheTagLast, @@ -236,8 +189,7 @@ return (WTF::CurrentTime() - time_stamp) < cache_within_seconds; } -// Final compile call for a streamed compilation. Most decisions have already -// been made, but we need to write back data into the cache. +// Final compile call for a streamed compilation. v8::MaybeLocal<v8::Script> PostStreamCompile( v8::ScriptCompiler::CompileOptions compile_options, CachedMetadataHandler* cache_handler, @@ -248,45 +200,6 @@ InspectorCompileScriptEvent::V8CacheResult* cache_result) { v8::MaybeLocal<v8::Script> script = v8::ScriptCompiler::Compile( isolate->GetCurrentContext(), streamer->Source(), code, origin); - - if (!cache_handler) - return script; - - // If the non-streaming compiler uses the parser cache, retrieve and store - // the cache data. If the code cache uses time stamp as heuristic, set that - // time stamp. - switch (compile_options) { - case v8::ScriptCompiler::kProduceParserCache: { - const v8::ScriptCompiler::CachedData* new_cached_data = - streamer->Source()->GetCachedData(); - if (!new_cached_data) - break; - CachedMetadataHandler::CacheType cache_type = - CachedMetadataHandler::kSendToPlatform; - cache_handler->ClearCachedMetadata(cache_type); - cache_handler->SetCachedMetadata( - V8ScriptRunner::TagForParserCache(cache_handler), - reinterpret_cast<const char*>(new_cached_data->data), - new_cached_data->length, cache_type); - if (cache_result) { - cache_result->produce_result = WTF::make_optional( - InspectorCompileScriptEvent::V8CacheResult::ProduceResult( - v8::ScriptCompiler::kProduceParserCache, - new_cached_data->length)); - } - break; - } - - case v8::ScriptCompiler::kConsumeParserCache: - case v8::ScriptCompiler::kConsumeCodeCache: - case v8::ScriptCompiler::kNoCompileOptions: - case v8::ScriptCompiler::kEagerCompile: - break; - - case v8::ScriptCompiler::kProduceCodeCache: - case v8::ScriptCompiler::kProduceFullCodeCache: - NOTREACHED(); - } return script; } @@ -307,22 +220,6 @@ return WTF::Bind(CompileWithoutOptions, no_cache_reason); case v8::ScriptCompiler::kEagerCompile: return WTF::Bind(CompileEager, no_cache_reason); - case v8::ScriptCompiler::kProduceParserCache: { - uint32_t parser_tag = V8ScriptRunner::TagForParserCache(cache_handler); - return WTF::Bind(CompileAndProduceCache, WrapPersistent(cache_handler), - parser_tag, v8::ScriptCompiler::kProduceParserCache, - CachedMetadataHandler::kCacheLocally); - } - case v8::ScriptCompiler::kConsumeParserCache: { - // Use parser-cache; in-memory only. - uint32_t parser_tag = V8ScriptRunner::TagForParserCache(cache_handler); - scoped_refptr<CachedMetadata> parser_cache( - cache_handler->GetCachedMetadata(parser_tag)); - DCHECK(parser_cache); - return WTF::Bind(CompileAndConsumeCache, WrapPersistent(cache_handler), - std::move(parser_cache), - v8::ScriptCompiler::kConsumeParserCache); - } case v8::ScriptCompiler::kConsumeCodeCache: { uint32_t code_cache_tag = V8ScriptRunner::TagForCodeCache(cache_handler); scoped_refptr<CachedMetadata> code_cache = @@ -334,6 +231,8 @@ } case v8::ScriptCompiler::kProduceCodeCache: case v8::ScriptCompiler::kProduceFullCodeCache: + case v8::ScriptCompiler::kProduceParserCache: + case v8::ScriptCompiler::kConsumeParserCache: NOTREACHED(); } @@ -406,50 +305,37 @@ no_cache_reason); } + uint32_t code_cache_tag = V8ScriptRunner::TagForCodeCache(cache_handler); + scoped_refptr<CachedMetadata> code_cache = + cache_handler->GetCachedMetadata(code_cache_tag); + if (code_cache) { + return std::make_tuple(v8::ScriptCompiler::kConsumeCodeCache, + ProduceCacheOptions::kNoProduceCache, + no_cache_reason); + } + switch (cache_options) { - case kV8CacheOptionsParse: { - uint32_t parser_tag = V8ScriptRunner::TagForParserCache(cache_handler); - scoped_refptr<CachedMetadata> parser_cache( - cache_handler->GetCachedMetadata(parser_tag)); - if (parser_cache) { - return std::make_tuple(v8::ScriptCompiler::kConsumeParserCache, - ProduceCacheOptions::kNoProduceCache, - no_cache_reason); - } - return std::make_tuple(v8::ScriptCompiler::kProduceParserCache, - ProduceCacheOptions::kNoProduceCache, - no_cache_reason); - } case kV8CacheOptionsDefault: case kV8CacheOptionsCode: - case kV8CacheOptionsCodeWithoutHeatCheck: - case kV8CacheOptionsFullCodeWithoutHeatCheck: { - uint32_t code_cache_tag = V8ScriptRunner::TagForCodeCache(cache_handler); - scoped_refptr<CachedMetadata> code_cache = - cache_handler->GetCachedMetadata(code_cache_tag); - if (code_cache) { - return std::make_tuple(v8::ScriptCompiler::kConsumeCodeCache, - ProduceCacheOptions::kNoProduceCache, - no_cache_reason); - } - if (cache_options != kV8CacheOptionsCodeWithoutHeatCheck && - cache_options != kV8CacheOptionsFullCodeWithoutHeatCheck && - !IsResourceHotForCaching(cache_handler, kHotHours)) { + if (!IsResourceHotForCaching(cache_handler, kHotHours)) { return std::make_tuple(v8::ScriptCompiler::kNoCompileOptions, ProduceCacheOptions::kSetTimeStamp, v8::ScriptCompiler::kNoCacheBecauseCacheTooCold); } - if (cache_options == kV8CacheOptionsFullCodeWithoutHeatCheck) { - return std::make_tuple( - v8::ScriptCompiler::kEagerCompile, - ProduceCacheOptions::kProduceCodeCache, - v8::ScriptCompiler::kNoCacheBecauseDeferredProduceCodeCache); - } return std::make_tuple( v8::ScriptCompiler::kNoCompileOptions, ProduceCacheOptions::kProduceCodeCache, v8::ScriptCompiler::kNoCacheBecauseDeferredProduceCodeCache); - } + case kV8CacheOptionsCodeWithoutHeatCheck: + return std::make_tuple( + v8::ScriptCompiler::kNoCompileOptions, + ProduceCacheOptions::kProduceCodeCache, + v8::ScriptCompiler::kNoCacheBecauseDeferredProduceCodeCache); + case kV8CacheOptionsFullCodeWithoutHeatCheck: + return std::make_tuple( + v8::ScriptCompiler::kEagerCompile, + ProduceCacheOptions::kProduceCodeCache, + v8::ScriptCompiler::kNoCacheBecauseDeferredProduceCodeCache); case kV8CacheOptionsNone: // Shouldn't happen, as this is handled above. // Case is here so that compiler can check all cases are handled. @@ -606,10 +492,6 @@ v8::ScriptCompiler::CreateCodeCache( script->GetUnboundScript(), V8String(isolate, source.Source()))); if (cached_data) { - // TODO(crbug.com/783124): This code is mostly a duplicate of code in - // CompileAndProduceCache that is used to produce parser cache. - // We want to remove the support for producing parser cache soon and - // CompileAndProduceCache function should be removed then. const char* data = reinterpret_cast<const char*>(cached_data->data); int length = cached_data->length; if (length > 1024) { @@ -801,11 +683,6 @@ return module->Evaluate(context); } -uint32_t V8ScriptRunner::TagForParserCache( - CachedMetadataHandler* cache_handler) { - return CacheTag(kCacheTagParser, cache_handler->Encoding()); -} - uint32_t V8ScriptRunner::TagForCodeCache(CachedMetadataHandler* cache_handler) { return CacheTag(kCacheTagCode, cache_handler->Encoding()); } @@ -917,7 +794,6 @@ STATIC_ASSERT_ENUM(WebSettings::kV8CacheOptionsDefault, kV8CacheOptionsDefault); STATIC_ASSERT_ENUM(WebSettings::kV8CacheOptionsNone, kV8CacheOptionsNone); -STATIC_ASSERT_ENUM(WebSettings::kV8CacheOptionsParse, kV8CacheOptionsParse); STATIC_ASSERT_ENUM(WebSettings::kV8CacheOptionsCode, kV8CacheOptionsCode); } // namespace blink
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunnerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunnerTest.cpp index c224f4ad..c36ee37 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunnerTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunnerTest.cpp
@@ -42,9 +42,6 @@ KURL Url() const { return KURL(WTF::String::Format("http://bla.com/bla%d", counter_)); } - unsigned TagForParserCache(CachedMetadataHandler* cache_handler) const { - return V8ScriptRunner::TagForParserCache(cache_handler); - } unsigned TagForCodeCache(CachedMetadataHandler* cache_handler) const { return V8ScriptRunner::TagForCodeCache(cache_handler); } @@ -123,8 +120,6 @@ EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), source_code, kV8CacheOptionsNone)); EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), - source_code, kV8CacheOptionsParse)); - EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), source_code, kV8CacheOptionsCode)); } @@ -133,23 +128,6 @@ EXPECT_FALSE(resource->CacheHandler()); } -TEST_F(V8ScriptRunnerTest, parseOption) { - V8TestingScope scope; - ScriptSourceCode source_code(nullptr, CreateResource(UTF8Encoding())); - EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), - source_code, kV8CacheOptionsParse)); - CachedMetadataHandler* cache_handler = source_code.CacheHandler(); - EXPECT_TRUE( - cache_handler->GetCachedMetadata(TagForParserCache(cache_handler))); - EXPECT_FALSE( - cache_handler->GetCachedMetadata(TagForCodeCache(cache_handler))); - // The cached data is associated with the encoding. - ScriptResource* another_resource = - CreateResource(UTF16LittleEndianEncoding()); - EXPECT_FALSE(cache_handler->GetCachedMetadata( - TagForParserCache(another_resource->CacheHandler()))); -} - TEST_F(V8ScriptRunnerTest, codeOption) { V8TestingScope scope; ScriptSourceCode source_code(nullptr, CreateResource(UTF8Encoding())); @@ -159,8 +137,6 @@ EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), source_code, kV8CacheOptionsCode)); - EXPECT_FALSE( - cache_handler->GetCachedMetadata(TagForParserCache(cache_handler))); EXPECT_TRUE(cache_handler->GetCachedMetadata(TagForCodeCache(cache_handler))); // The cached data is associated with the encoding. ScriptResource* another_resource = @@ -180,9 +156,7 @@ EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), source_code, kV8CacheOptionsCode)); - // Check the produced cache is for code and not parser cache. - EXPECT_FALSE( - cache_handler->GetCachedMetadata(TagForParserCache(cache_handler))); + // Check the produced cache is for code cache. EXPECT_TRUE(cache_handler->GetCachedMetadata(TagForCodeCache(cache_handler))); // Hot run - should consume code cache.
diff --git a/third_party/WebKit/Source/core/css/SelectorQuery.cpp b/third_party/WebKit/Source/core/css/SelectorQuery.cpp index 52e0549..67cd6bf 100644 --- a/third_party/WebKit/Source/core/css/SelectorQuery.cpp +++ b/third_party/WebKit/Source/core/css/SelectorQuery.cpp
@@ -310,9 +310,13 @@ static ShadowRoot* AuthorShadowRootOf(const ContainerNode& node) { if (!node.IsElementNode()) return nullptr; - ShadowRoot* root = node.GetShadowRoot(); - if (root && root->IsOpenOrV0()) - return root; + ElementShadow* shadow = ToElement(node).Shadow(); + if (!shadow) + return nullptr; + + ShadowRoot& shadow_root = shadow->GetShadowRoot(); + if (shadow_root.IsOpenOrV0()) + return &shadow_root; return nullptr; }
diff --git a/third_party/WebKit/Source/core/css/StyleEngine.cpp b/third_party/WebKit/Source/core/css/StyleEngine.cpp index 27f469a4..23c2863 100644 --- a/third_party/WebKit/Source/core/css/StyleEngine.cpp +++ b/third_party/WebKit/Source/core/css/StyleEngine.cpp
@@ -1036,8 +1036,9 @@ InvalidateSlottedElements(ToHTMLSlotElement(*element)); if (invalidation_scope == kInvalidateAllScopes) { - if (ShadowRoot* shadow_root = element->GetShadowRoot()) { - ScheduleInvalidationsForRuleSets(*shadow_root, rule_sets, + if (ElementShadow* shadow = element->Shadow()) { + ShadowRoot& shadow_root = shadow->GetShadowRoot(); + ScheduleInvalidationsForRuleSets(shadow_root, rule_sets, kInvalidateAllScopes); } }
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSPerspective.cpp b/third_party/WebKit/Source/core/css/cssom/CSSPerspective.cpp index 01d510f3..7245d92f 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSPerspective.cpp +++ b/third_party/WebKit/Source/core/css/cssom/CSSPerspective.cpp
@@ -5,6 +5,7 @@ #include "core/css/cssom/CSSPerspective.h" #include "bindings/core/v8/ExceptionState.h" +#include "core/css/CSSCalculationValue.h" #include "core/css/cssom/CSSUnitValue.h" #include "core/geometry/DOMMatrix.h" @@ -63,15 +64,17 @@ } const CSSFunctionValue* CSSPerspective::ToCSSValue() const { + const CSSValue* length = nullptr; if (length_->IsUnitValue() && ToCSSUnitValue(length_)->value() < 0) { - // Negative values are invalid. - // https://github.com/w3c/css-houdini-drafts/issues/420 - return nullptr; + // Wrap out of range length with a calc. + CSSCalcExpressionNode* node = length_->ToCalcExpressionNode(); + node->SetIsNestedCalc(); + length = CSSPrimitiveValue::Create(CSSCalcValue::Create(node)); + } else { + length = length_->ToCSSValue(); } - const CSSValue* length = length_->ToCSSValue(); - if (!length) - return nullptr; + DCHECK(length); CSSFunctionValue* result = CSSFunctionValue::Create(CSSValuePerspective); result->Append(*length); return result;
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSStyleValue.h b/third_party/WebKit/Source/core/css/cssom/CSSStyleValue.h index ba4250b..943e5e9 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSStyleValue.h +++ b/third_party/WebKit/Source/core/css/cssom/CSSStyleValue.h
@@ -64,6 +64,7 @@ } virtual const CSSValue* ToCSSValue() const = 0; + // FIXME: We should make this a method on CSSProperty instead. virtual const CSSValue* ToCSSValueWithProperty(CSSPropertyID) const { return ToCSSValue(); }
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.cpp b/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.cpp index 82f2c8a8..b04d2928 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.cpp +++ b/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.cpp
@@ -74,4 +74,25 @@ return transform_css_value; } +bool CSSTransformValue::AnonymousIndexedSetter( + unsigned index, + const Member<CSSTransformComponent> component, + ExceptionState& exception_state) { + if (index < transform_components_.size()) { + transform_components_[index] = component; + return true; + } + + if (index == transform_components_.size()) { + transform_components_.push_back(component); + return true; + } + + exception_state.ThrowRangeError( + ExceptionMessages::IndexOutsideRange<unsigned>( + "index", index, 0, ExceptionMessages::kInclusiveBound, + transform_components_.size(), ExceptionMessages::kInclusiveBound)); + return false; +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.h b/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.h index 55cd81c..08b1af7 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.h +++ b/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.h
@@ -38,9 +38,12 @@ StyleValueType GetType() const override { return kTransformType; } - CSSTransformComponent* componentAtIndex(uint32_t index) { + CSSTransformComponent* AnonymousIndexedGetter(uint32_t index) { return transform_components_.at(index); } + bool AnonymousIndexedSetter(unsigned, + const Member<CSSTransformComponent>, + ExceptionState&); size_t length() const { return transform_components_.size(); }
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.idl b/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.idl index ba1c9d8..94e18a57 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.idl +++ b/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.idl
@@ -10,7 +10,8 @@ ] interface CSSTransformValue : CSSStyleValue { // https://github.com/w3c/css-houdini-drafts/issues/358 readonly attribute unsigned long length; - [ImplementedAs=componentAtIndex] getter CSSTransformComponent (unsigned long index); + getter CSSTransformComponent (unsigned long index); + [RaisesException] setter CSSTransformComponent (unsigned long index, CSSTransformComponent val); iterable<CSSTransformComponent>; readonly attribute boolean is2D;
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.cpp b/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.cpp index de773a76..bf2284a 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.cpp +++ b/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.cpp
@@ -5,6 +5,7 @@ #include "core/css/cssom/CSSUnitValue.h" #include "bindings/core/v8/ExceptionState.h" +#include "core/animation/LengthPropertyFunctions.h" #include "core/css/CSSCalculationValue.h" #include "core/css/CSSResolutionUnits.h" #include "core/css/cssom/CSSMathInvert.h" @@ -13,6 +14,7 @@ #include "core/css/cssom/CSSMathProduct.h" #include "core/css/cssom/CSSMathSum.h" #include "core/css/cssom/CSSNumericSumValue.h" +#include "core/css/properties/CSSProperty.h" #include "platform/wtf/MathExtras.h" namespace blink { @@ -117,6 +119,22 @@ return CSSPrimitiveValue::Create(value_, unit_); } +const CSSPrimitiveValue* CSSUnitValue::ToCSSValueWithProperty( + CSSPropertyID property_id) const { + // FIXME: Avoid this CSSProperty::Get call as it can be costly. + // The caller often has a CSSProperty already, so we can just pass it here. + if (LengthPropertyFunctions::GetValueRange(CSSProperty::Get(property_id)) == + kValueRangeNonNegative && + value_ < 0) { + // Wrap out of range values with a calc. + CSSCalcExpressionNode* node = ToCalcExpressionNode(); + node->SetIsNestedCalc(); + return CSSPrimitiveValue::Create(CSSCalcValue::Create(node)); + } + + return CSSPrimitiveValue::Create(value_, unit_); +} + CSSCalcExpressionNode* CSSUnitValue::ToCalcExpressionNode() const { return CSSCalcValue::CreateExpressionNode( CSSPrimitiveValue::Create(value_, unit_));
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.h b/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.h index 35584ec..d9041e2 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.h +++ b/third_party/WebKit/Source/core/css/cssom/CSSUnitValue.h
@@ -46,6 +46,7 @@ // From CSSStyleValue. StyleValueType GetType() const final; const CSSPrimitiveValue* ToCSSValue() const final; + const CSSPrimitiveValue* ToCSSValueWithProperty(CSSPropertyID) const final; CSSCalcExpressionNode* ToCalcExpressionNode() const final; private:
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSUnparsedValue.cpp b/third_party/WebKit/Source/core/css/cssom/CSSUnparsedValue.cpp index ee862cf..a94b85b 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSUnparsedValue.cpp +++ b/third_party/WebKit/Source/core/css/cssom/CSSUnparsedValue.cpp
@@ -73,6 +73,34 @@ return CSSUnparsedValue::Create(ParserTokenRangeToTokens(value.TokenRange())); } +CSSUnparsedSegment CSSUnparsedValue::AnonymousIndexedGetter( + unsigned index, + ExceptionState& exception_state) { + if (index < tokens_.size()) + return tokens_[index]; + return {}; +} + +bool CSSUnparsedValue::AnonymousIndexedSetter(unsigned index, + const CSSUnparsedSegment& segment, + ExceptionState& exception_state) { + if (index < tokens_.size()) { + tokens_[index] = segment; + return true; + } + + if (index == tokens_.size()) { + tokens_.push_back(segment); + return true; + } + + exception_state.ThrowRangeError( + ExceptionMessages::IndexOutsideRange<unsigned>( + "index", index, 0, ExceptionMessages::kInclusiveBound, tokens_.size(), + ExceptionMessages::kInclusiveBound)); + return false; +} + const CSSValue* CSSUnparsedValue::ToCSSValue() const { if (tokens_.IsEmpty()) { return CSSVariableReferenceValue::Create(CSSVariableData::Create());
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSUnparsedValue.h b/third_party/WebKit/Source/core/css/cssom/CSSUnparsedValue.h index de8c8b1..0f1d622c 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSUnparsedValue.h +++ b/third_party/WebKit/Source/core/css/cssom/CSSUnparsedValue.h
@@ -36,13 +36,10 @@ StyleValueType GetType() const override { return kUnparsedType; } - CSSUnparsedSegment AnonymousIndexedGetter( - unsigned index, - ExceptionState& exception_state) const { - if (index < tokens_.size()) - return tokens_[index]; - return {}; - } + CSSUnparsedSegment AnonymousIndexedGetter(unsigned, ExceptionState&); + bool AnonymousIndexedSetter(unsigned, + const CSSUnparsedSegment&, + ExceptionState&); size_t length() const { return tokens_.size(); }
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSUnparsedValue.idl b/third_party/WebKit/Source/core/css/cssom/CSSUnparsedValue.idl index 165e0523..8792a46d 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSUnparsedValue.idl +++ b/third_party/WebKit/Source/core/css/cssom/CSSUnparsedValue.idl
@@ -13,6 +13,7 @@ iterable<CSSUnparsedSegment>; readonly attribute unsigned long length; [RaisesException] getter CSSUnparsedSegment (unsigned long index); + [RaisesException] setter CSSUnparsedSegment (unsigned long index, CSSUnparsedSegment val); }; typedef (DOMString or CSSVariableReferenceValue) CSSUnparsedSegment;
diff --git a/third_party/WebKit/Source/core/css/cssom/DeclaredStylePropertyMap.cpp b/third_party/WebKit/Source/core/css/cssom/DeclaredStylePropertyMap.cpp index c43adc35..459abb06 100644 --- a/third_party/WebKit/Source/core/css/cssom/DeclaredStylePropertyMap.cpp +++ b/third_party/WebKit/Source/core/css/cssom/DeclaredStylePropertyMap.cpp
@@ -68,6 +68,13 @@ GetStyleRule()->MutableProperties().RemoveProperty(property_name); } +void DeclaredStylePropertyMap::RemoveAllProperties() { + if (!GetStyleRule()) + return; + CSSStyleSheet::RuleMutationScope mutation_scope(owner_rule_); + GetStyleRule()->MutableProperties().Clear(); +} + void DeclaredStylePropertyMap::ForEachProperty( const IterationCallback& callback) { if (!GetStyleRule())
diff --git a/third_party/WebKit/Source/core/css/cssom/DeclaredStylePropertyMap.h b/third_party/WebKit/Source/core/css/cssom/DeclaredStylePropertyMap.h index 22e120b..c55c59c 100644 --- a/third_party/WebKit/Source/core/css/cssom/DeclaredStylePropertyMap.h +++ b/third_party/WebKit/Source/core/css/cssom/DeclaredStylePropertyMap.h
@@ -39,6 +39,7 @@ void SetCustomProperty(const AtomicString&, const CSSValue&) override; void RemoveProperty(CSSPropertyID) override; void RemoveCustomProperty(const AtomicString&) override; + void RemoveAllProperties() final; private: StyleRule* GetStyleRule() const;
diff --git a/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp b/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp index 53e50810..eeef797 100644 --- a/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp +++ b/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp
@@ -48,6 +48,10 @@ owner_element_->RemoveInlineStyleProperty(property_name); } +void InlineStylePropertyMap::RemoveAllProperties() { + owner_element_->RemoveAllInlineStyleProperties(); +} + void InlineStylePropertyMap::ForEachProperty( const IterationCallback& callback) { CSSPropertyValueSet& inline_style_set =
diff --git a/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.h b/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.h index 505750d..fcbcb6d 100644 --- a/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.h +++ b/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.h
@@ -29,6 +29,7 @@ void SetCustomProperty(const AtomicString&, const CSSValue&) override; void RemoveProperty(CSSPropertyID) override; void RemoveCustomProperty(const AtomicString&); + void RemoveAllProperties() final; private: Member<Element> owner_element_;
diff --git a/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp b/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp index 362b6c6..19f01db 100644 --- a/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp +++ b/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp
@@ -207,34 +207,8 @@ } } -void StylePropertyMap::update(const String& property_name, - V8UpdateFunction* update_function, - ExceptionState& exception_state) { - CSSStyleValue* old_value = get(property_name, exception_state); - if (exception_state.HadException()) { - exception_state.ThrowTypeError("Invalid propertyName: " + property_name); - return; - } - - const CSSPropertyID property_id = cssPropertyID(property_name); - - const auto& new_value = update_function->Invoke(this, old_value); - if (new_value.IsNothing() || !new_value.ToChecked()) { - exception_state.ThrowTypeError("Invalid type for property"); - return; - } - - const CSSValue* result = StyleValueToCSSValue(CSSProperty::Get(property_id), - *new_value.ToChecked()); - if (!result) { - exception_state.ThrowTypeError("Invalid type for property"); - return; - } - - if (property_id == CSSPropertyVariable) - SetCustomProperty(AtomicString(property_name), *result); - else - SetProperty(property_id, *result); +void StylePropertyMap::clear() { + RemoveAllProperties(); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.h b/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.h index 770f7ae..0dbacc86 100644 --- a/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.h +++ b/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.h
@@ -28,13 +28,14 @@ const HeapVector<CSSStyleValueOrString>& values, ExceptionState&); void remove(const String& property_name, ExceptionState&); - void update(const String&, V8UpdateFunction*, ExceptionState&); + void clear(); protected: virtual void SetProperty(CSSPropertyID, const CSSValue&) = 0; virtual void SetCustomProperty(const AtomicString&, const CSSValue&) = 0; virtual void RemoveProperty(CSSPropertyID) = 0; virtual void RemoveCustomProperty(const AtomicString&) = 0; + virtual void RemoveAllProperties() = 0; StylePropertyMap() = default;
diff --git a/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.idl b/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.idl index 0ed6c076..c2340b29 100644 --- a/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.idl +++ b/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.idl
@@ -14,5 +14,5 @@ [RaisesException, ImplementedAs=remove] void delete(DOMString property); // Putting Exposed=Window in the next line makes |set| not exposed to PaintWorklet. [RaisesException, CallWith=ExecutionContext, Exposed=Window] void set(DOMString property, (CSSStyleValue or DOMString)... values); - [RaisesException] void update(DOMString property, UpdateFunction updateFunction); + void clear(); };
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp index ade931f86..3987ffd 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
@@ -132,12 +132,13 @@ static void CollectScopedResolversForHostedShadowTrees( const Element& element, HeapVector<Member<ScopedStyleResolver>, 8>& resolvers) { - ShadowRoot* root = element.GetShadowRoot(); - if (!root) + ElementShadow* shadow = element.Shadow(); + if (!shadow) return; // Adding scoped resolver for active shadow roots for shadow host styling. - if (ScopedStyleResolver* resolver = root->GetScopedStyleResolver()) + ShadowRoot& shadow_root = shadow->GetShadowRoot(); + if (ScopedStyleResolver* resolver = shadow_root.GetScopedStyleResolver()) resolvers.push_back(resolver); } @@ -189,11 +190,12 @@ static void MatchHostRules(const Element& element, ElementRuleCollector& collector) { - ShadowRoot* shadow_root = element.GetShadowRoot(); - if (!shadow_root) + ElementShadow* shadow = element.Shadow(); + if (!shadow) return; - if (ScopedStyleResolver* resolver = shadow_root->GetScopedStyleResolver()) { + ShadowRoot& shadow_root = shadow->GetShadowRoot(); + if (ScopedStyleResolver* resolver = shadow_root.GetScopedStyleResolver()) { collector.ClearMatchedRules(); resolver->CollectMatchingShadowHostRules(collector); collector.SortAndTransferMatchedRules();
diff --git a/third_party/WebKit/Source/core/dom/ChildFrameDisconnector.cpp b/third_party/WebKit/Source/core/dom/ChildFrameDisconnector.cpp index 3d6e16e..937298ec 100644 --- a/third_party/WebKit/Source/core/dom/ChildFrameDisconnector.cpp +++ b/third_party/WebKit/Source/core/dom/ChildFrameDisconnector.cpp
@@ -43,8 +43,10 @@ for (Node* child = root.firstChild(); child; child = child->nextSibling()) CollectFrameOwners(*child); - if (ShadowRoot* shadow_root = root.GetShadowRoot()) - CollectFrameOwners(*shadow_root); + ElementShadow* shadow = + root.IsElementNode() ? ToElement(root).Shadow() : nullptr; + if (shadow) + CollectFrameOwners(shadow->GetShadowRoot()); } void ChildFrameDisconnector::DisconnectCollectedFrameOwners() { @@ -70,8 +72,10 @@ ToHTMLFrameOwnerElement(node).ContentFrame()) count++; - if (ShadowRoot* root = ToElement(node).GetShadowRoot()) - count += CheckConnectedSubframeCountIsConsistent(*root); + if (ElementShadow* shadow = ToElement(node).Shadow()) { + ShadowRoot& root = shadow->GetShadowRoot(); + count += CheckConnectedSubframeCountIsConsistent(root); + } } for (Node* child = node.firstChild(); child; child = child->nextSibling())
diff --git a/third_party/WebKit/Source/core/dom/ComputedAccessibleNode.cpp b/third_party/WebKit/Source/core/dom/ComputedAccessibleNode.cpp index b642577..57598211 100644 --- a/third_party/WebKit/Source/core/dom/ComputedAccessibleNode.cpp +++ b/third_party/WebKit/Source/core/dom/ComputedAccessibleNode.cpp
@@ -7,49 +7,105 @@ #include <stdint.h> #include "core/dom/DOMException.h" +#include "core/dom/FrameRequestCallbackCollection.h" +#include "core/frame/LocalFrame.h" #include "platform/bindings/ScriptState.h" -#include "third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.h" -#include "third_party/WebKit/Source/core/frame/LocalFrame.h" +#include "platform/heap/Handle.h" +#include "platform/scheduler/child/web_scheduler.h" +#include "public/platform/Platform.h" +#include "public/web/WebFrameClient.h" #include "third_party/WebKit/Source/core/frame/WebLocalFrameImpl.h" -#include "third_party/WebKit/Source/platform/wtf/text/WTFString.h" -#include "third_party/WebKit/public/web/WebFrameClient.h" namespace blink { -ComputedAccessibleNode* ComputedAccessibleNode::Create(Element* element) { - return new ComputedAccessibleNode(element); -} +class ComputedAccessibleNodePromiseResolver::RequestAnimationFrameCallback final + : public FrameRequestCallbackCollection::FrameCallback { + public: + explicit RequestAnimationFrameCallback( + ComputedAccessibleNodePromiseResolver* resolver) + : resolver_(resolver) {} -ComputedAccessibleNode::ComputedAccessibleNode(Element* element) - : element_(element) { - DCHECK(RuntimeEnabledFeatures::AccessibilityObjectModelEnabled()); - AXObjectCache* cache = element->GetDocument().GetOrCreateAXObjectCache(); - DCHECK(cache); - cache_ = cache; - - LocalFrame* local_frame = element->ownerDocument()->GetFrame(); - WebFrameClient* client = WebLocalFrameImpl::FromFrame(local_frame)->Client(); - tree_ = client->GetOrCreateWebComputedAXTree(); -} - -ComputedAccessibleNode::~ComputedAccessibleNode() {} - -ScriptPromise ComputedAccessibleNode::ComputeAccessibleProperties( - ScriptState* script_state) { - ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); - ScriptPromise promise = resolver->Promise(); - // TODO(meredithl): Post this task asynchronously, with a callback into - // this->OnSnapshotResponse. - if (!tree_->ComputeAccessibilityTree()) { - // TODO(meredithl): Change this exception to something relevant to AOM. - resolver->Reject(DOMException::Create(kUnknownError)); - } else { - OnSnapshotResponse(resolver); + void Invoke(double) override { + resolver_->continue_callback_request_id_ = 0; + resolver_->UpdateTreeAndResolve(); } - return promise; + virtual void Trace(blink::Visitor* visitor) { + visitor->Trace(resolver_); + FrameRequestCallbackCollection::FrameCallback::Trace(visitor); + } + + private: + Member<ComputedAccessibleNodePromiseResolver> resolver_; + + DISALLOW_COPY_AND_ASSIGN(RequestAnimationFrameCallback); +}; + +ComputedAccessibleNodePromiseResolver* +ComputedAccessibleNodePromiseResolver::Create(ScriptState* script_state, + Element& element) { + return new ComputedAccessibleNodePromiseResolver(script_state, element); } +ComputedAccessibleNodePromiseResolver::ComputedAccessibleNodePromiseResolver( + ScriptState* script_state, + Element& element) + : element_(element), + resolver_(ScriptPromiseResolver::Create(script_state)) {} + +ScriptPromise ComputedAccessibleNodePromiseResolver::Promise() { + return resolver_->Promise(); +} + +void ComputedAccessibleNodePromiseResolver::Trace(blink::Visitor* visitor) { + visitor->Trace(element_); + visitor->Trace(resolver_); +} + +void ComputedAccessibleNodePromiseResolver::ComputeAccessibleNode() { + DCHECK(RuntimeEnabledFeatures::AccessibilityObjectModelEnabled()); + + if (continue_callback_request_id_) + return; + + // TODO(aboxhall): Trigger a call when lifecycle is next at kPrePaintClean. + RequestAnimationFrameCallback* callback = + new RequestAnimationFrameCallback(this); + continue_callback_request_id_ = + element_->GetDocument().RequestAnimationFrame(callback); +} + +void ComputedAccessibleNodePromiseResolver::UpdateTreeAndResolve() { + Document& document = element_->GetDocument(); + document.View()->UpdateLifecycleToCompositingCleanPlusScrolling(); + AXObjectCache* cache = element_->GetDocument().GetOrCreateAXObjectCache(); + DCHECK(cache); + AXID ax_id = cache->GetAXID(element_); + + LocalFrame* local_frame = element_->ownerDocument()->GetFrame(); + WebFrameClient* client = WebLocalFrameImpl::FromFrame(local_frame)->Client(); + WebComputedAXTree* tree = client->GetOrCreateWebComputedAXTree(); + tree->ComputeAccessibilityTree(); + + ComputedAccessibleNode* accessible_node = + ComputedAccessibleNode::Create(ax_id, tree); + resolver_->Resolve(accessible_node); +} + +ComputedAccessibleNode* ComputedAccessibleNode::Create( + AXID ax_id, + WebComputedAXTree* tree) { + // TODO(meredithl): Change to GetOrCreate and check cache for existing node + // with this ID. + return new ComputedAccessibleNode(ax_id, tree); +} + +ComputedAccessibleNode::ComputedAccessibleNode(AXID ax_id, + WebComputedAXTree* tree) + : ax_id_(ax_id), tree_(tree) {} + +ComputedAccessibleNode::~ComputedAccessibleNode() {} + ScriptPromise ComputedAccessibleNode::ensureUpToDate( ScriptState* script_state) { ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); @@ -69,7 +125,7 @@ bool& is_null) const { int32_t out = 0; is_null = true; - if (tree_->GetIntAttributeForAXNode(cache_->GetAXID(element_), attr, &out)) { + if (tree_->GetIntAttributeForAXNode(ax_id_, attr, &out)) { is_null = false; } return out; @@ -78,8 +134,7 @@ const String ComputedAccessibleNode::GetStringAttribute( WebAOMStringAttribute attr) const { WebString out; - if (tree_->GetStringAttributeForAXNode(cache_->GetAXID(element_), attr, - &out)) { + if (tree_->GetStringAttributeForAXNode(ax_id_, attr, &out)) { return out; } return String(); @@ -89,7 +144,7 @@ bool& is_null) const { bool out; is_null = true; - if (tree_->GetBoolAttributeForAXNode(cache_->GetAXID(element_), attr, &out)) { + if (tree_->GetBoolAttributeForAXNode(ax_id_, attr, &out)) { is_null = false; } return out; @@ -111,7 +166,7 @@ const String ComputedAccessibleNode::role() const { WebString out; - if (tree_->GetRoleForAXNode(cache_->GetAXID(element_), &out)) { + if (tree_->GetRoleForAXNode(ax_id_, &out)) { return out; } return String(); @@ -162,52 +217,44 @@ return GetIntAttribute(WebAOMIntAttribute::AOM_ATTR_SET_SIZE, is_null); } -ComputedAccessibleNode* ComputedAccessibleNode::GetRelationFromCache( - AXID axid) const { - Element* element = cache_->GetElementFromAXID(axid); - if (!element) - return nullptr; - return element->GetComputedAccessibleNode(); -} - ComputedAccessibleNode* ComputedAccessibleNode::parent() const { - int32_t axid; - if (!tree_->GetParentIdForAXNode(cache_->GetAXID(element_), &axid)) { + int32_t parent_ax_id; + if (!tree_->GetParentIdForAXNode(ax_id_, &parent_ax_id)) { return nullptr; } - return GetRelationFromCache(axid); + return ComputedAccessibleNode::Create(parent_ax_id, tree_); } ComputedAccessibleNode* ComputedAccessibleNode::firstChild() const { - int32_t axid; - if (!tree_->GetFirstChildIdForAXNode(cache_->GetAXID(element_), &axid)) { + int32_t child_ax_id; + if (!tree_->GetFirstChildIdForAXNode(ax_id_, &child_ax_id)) { return nullptr; } - return GetRelationFromCache(axid); + return ComputedAccessibleNode::Create(child_ax_id, tree_); } ComputedAccessibleNode* ComputedAccessibleNode::lastChild() const { - int32_t axid; - if (!tree_->GetLastChildIdForAXNode(cache_->GetAXID(element_), &axid)) { + int32_t child_ax_id; + if (!tree_->GetLastChildIdForAXNode(ax_id_, &child_ax_id)) { return nullptr; } - return GetRelationFromCache(axid); + return ComputedAccessibleNode::Create(child_ax_id, tree_); } ComputedAccessibleNode* ComputedAccessibleNode::previousSibling() const { - int32_t axid; - if (!tree_->GetPreviousSiblingIdForAXNode(cache_->GetAXID(element_), &axid)) { + int32_t sibling_ax_id; + if (!tree_->GetPreviousSiblingIdForAXNode(ax_id_, &sibling_ax_id)) { return nullptr; } - return GetRelationFromCache(axid); + return ComputedAccessibleNode::Create(sibling_ax_id, tree_); } ComputedAccessibleNode* ComputedAccessibleNode::nextSibling() const { - int32_t axid; - if (!tree_->GetNextSiblingIdForAXNode(cache_->GetAXID(element_), &axid)) { + int32_t sibling_ax_id; + if (!tree_->GetNextSiblingIdForAXNode(ax_id_, &sibling_ax_id)) { return nullptr; } - return GetRelationFromCache(axid); + return ComputedAccessibleNode::Create(sibling_ax_id, tree_); } bool ComputedAccessibleNode::atomic(bool& is_null) const { @@ -233,8 +280,6 @@ void ComputedAccessibleNode::Trace(Visitor* visitor) { ScriptWrappable::Trace(visitor); - visitor->Trace(element_); - visitor->Trace(cache_); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/ComputedAccessibleNode.h b/third_party/WebKit/Source/core/dom/ComputedAccessibleNode.h index 00a2dbdd..47515c19 100644 --- a/third_party/WebKit/Source/core/dom/ComputedAccessibleNode.h +++ b/third_party/WebKit/Source/core/dom/ComputedAccessibleNode.h
@@ -6,6 +6,7 @@ #define ComputedAccessibleNode_h #include "bindings/core/v8/ScriptPromise.h" +#include "bindings/core/v8/ScriptPromiseResolver.h" #include "core/dom/AXObjectCache.h" #include "core/dom/events/EventTarget.h" #include "platform/bindings/ScriptWrappable.h" @@ -18,11 +19,34 @@ class ScriptPromiseResolver; class ScriptState; +class ComputedAccessibleNodePromiseResolver final + : public GarbageCollectedFinalized<ComputedAccessibleNodePromiseResolver> { + public: + static ComputedAccessibleNodePromiseResolver* Create(ScriptState*, Element&); + ~ComputedAccessibleNodePromiseResolver() {} + + ScriptPromise Promise(); + + void ComputeAccessibleNode(); + + void Trace(blink::Visitor*); + + private: + ComputedAccessibleNodePromiseResolver(ScriptState*, Element&); + void UpdateTreeAndResolve(); + + class RequestAnimationFrameCallback; + + int continue_callback_request_id_ = 0; + Member<Element> element_; + Member<ScriptPromiseResolver> resolver_; +}; + class ComputedAccessibleNode : public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); public: - static ComputedAccessibleNode* Create(Element*); + static ComputedAccessibleNode* Create(AXID, WebComputedAXTree*); virtual ~ComputedAccessibleNode(); void Trace(Visitor*); @@ -61,18 +85,18 @@ bool modal(bool& is_null) const; private: - explicit ComputedAccessibleNode(Element*); + ComputedAccessibleNode(AXID, WebComputedAXTree*); // content::ComputedAXTree callback. void OnSnapshotResponse(ScriptPromiseResolver*); void OnUpdateResponse(ScriptPromiseResolver*); + int32_t GetIntAttribute(WebAOMIntAttribute, bool& is_null) const; const String GetStringAttribute(WebAOMStringAttribute) const; bool GetBoolAttribute(WebAOMBoolAttribute, bool& is_null) const; ComputedAccessibleNode* GetRelationFromCache(AXID) const; - Member<Element> element_; - Member<AXObjectCache> cache_; + AXID ax_id_; // This tree is owned by the RenderFrame. blink::WebComputedAXTree* tree_;
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index 14523c7..92b8dc7 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -989,7 +989,7 @@ should_create_builtin ? is : g_null_atom); // 8. If 'is' is non-null, set 'is' attribute - if (!is.IsEmpty()) + if (!is_v1 && !is.IsEmpty()) element->setAttribute(HTMLNames::isAttr, is); return element; @@ -1070,7 +1070,7 @@ should_create_builtin ? is : g_null_atom); // 4. If 'is' is non-null, set 'is' attribute - if (!is.IsEmpty()) + if (!is_v1 && !is.IsEmpty()) element->setAttribute(HTMLNames::isAttr, is); return element; @@ -1241,47 +1241,28 @@ bool deep, ExceptionState& exception_state) { // https://dom.spec.whatwg.org/#dom-document-importnode - // TODO(tkent): Share code with cloneNode(). crbug.com/812089 - CloneChildrenFlag clone_children = - deep ? CloneChildrenFlag::kClone : CloneChildrenFlag::kSkip; - switch (imported_node->getNodeType()) { - case kTextNode: - case kCdataSectionNode: - case kProcessingInstructionNode: - case kCommentNode: - case kDocumentTypeNode: - case kElementNode: - return imported_node->Clone(*this, clone_children); - case kAttributeNode: - // The following code doesn't create an Attr with namespace. See - // crbug.com/812105. - return Attr::Create( - *this, - QualifiedName(g_null_atom, - AtomicString(ToAttr(imported_node)->name()), - g_null_atom), - ToAttr(imported_node)->value()); - case kDocumentFragmentNode: - if (imported_node->IsShadowRoot()) { - // ShadowRoot nodes should not be explicitly importable. - // Either they are imported along with their host node, or created - // implicitly. - exception_state.ThrowDOMException( - kNotSupportedError, - "The node provided is a shadow root, which may not be imported."); - return nullptr; - } - return imported_node->Clone(*this, clone_children); - case kDocumentNode: - exception_state.ThrowDOMException( - kNotSupportedError, - "The node provided is a document, which may not be imported."); - return nullptr; + // 1. If node is a document or shadow root, then throw a "NotSupportedError" + // DOMException. + if (imported_node->IsDocumentNode()) { + exception_state.ThrowDOMException( + kNotSupportedError, + "The node provided is a document, which may not be imported."); + return nullptr; + } + if (imported_node->IsShadowRoot()) { + // ShadowRoot nodes should not be explicitly importable. Either they are + // imported along with their host node, or created implicitly. + exception_state.ThrowDOMException( + kNotSupportedError, + "The node provided is a shadow root, which may not be imported."); + return nullptr; } - NOTREACHED(); - return nullptr; + // 2. Return a clone of node, with context object and the clone children flag + // set if deep is true. + return imported_node->Clone( + *this, deep ? CloneChildrenFlag::kClone : CloneChildrenFlag::kSkip); } Node* Document::adoptNode(Node* source, ExceptionState& exception_state) { @@ -3254,8 +3235,7 @@ load_event_progress_ = kLoadEventCompleted; - if (GetFrame() && GetLayoutView() && - GetSettings()->GetAccessibilityEnabled()) { + if (GetFrame() && GetLayoutView()) { if (AXObjectCache* cache = GetOrCreateAXObjectCache()) { if (this == &AXObjectCacheOwner()) cache->HandleLoadComplete(this);
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp index e8e20b7..d0847ee 100644 --- a/third_party/WebKit/Source/core/dom/Element.cpp +++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -1326,16 +1326,6 @@ return rare_data.EnsureAccessibleNode(this); } -ComputedAccessibleNode* Element::GetComputedAccessibleNode() { - if (!RuntimeEnabledFeatures::AccessibilityObjectModelEnabled()) - return nullptr; - - // TODO(meredithl): Create finer grain method for enabling accessibility. - GetDocument().GetPage()->GetSettings().SetAccessibilityEnabled(true); - ElementRareData& rare_data = EnsureElementRareData(); - return rare_data.EnsureComputedAccessibleNode(this); -} - const AtomicString& Element::getAttribute( const AtomicString& local_name) const { if (!GetElementData()) @@ -2307,8 +2297,8 @@ void Element::RebuildShadowRootLayoutTree( WhitespaceAttacher& whitespace_attacher) { DCHECK(IsShadowHost(this)); - ShadowRoot* root = GetShadowRoot(); - root->RebuildLayoutTree(whitespace_attacher); + if (ShadowRoot* root = GetShadowRoot()) + root->RebuildLayoutTree(whitespace_attacher); RebuildNonDistributedChildren(); } @@ -2441,10 +2431,15 @@ return nullptr; } +void Element::SetIsValue(const AtomicString& is_value) { + DCHECK(IsValue().IsNull()) << "SetIsValue() should be called at most once."; + EnsureElementRareData().SetIsValue(is_value); +} + const AtomicString& Element::IsValue() const { - // TODO(tkent): "is value" should be a data member of - // Element. crbug.com/807871. - return FastGetAttribute(HTMLNames::isAttr); + if (HasRareData()) + return GetElementRareData()->IsValue(); + return g_null_atom; } ShadowRoot* Element::createShadowRoot(const ScriptState* script_state, @@ -2589,9 +2584,12 @@ } ShadowRoot* Element::UserAgentShadowRoot() const { - ShadowRoot* root = GetShadowRoot(); - DCHECK(!root || root->IsUserAgent()); - return root; + if (ElementShadow* element_shadow = Shadow()) { + ShadowRoot& root = element_shadow->GetShadowRoot(); + DCHECK(root.IsUserAgent()); + return &root; + } + return nullptr; } ShadowRoot& Element::EnsureUserAgentShadowRoot() {
diff --git a/third_party/WebKit/Source/core/dom/Element.h b/third_party/WebKit/Source/core/dom/Element.h index df824ec3..ae31b12 100644 --- a/third_party/WebKit/Source/core/dom/Element.h +++ b/third_party/WebKit/Source/core/dom/Element.h
@@ -47,7 +47,6 @@ class Attribute; class CSSPropertyValueSet; class CSSStyleDeclaration; -class ComputedAccessibleNode; class CustomElementDefinition; class DOMRect; class DOMRectList; @@ -297,8 +296,6 @@ AccessibleNode* ExistingAccessibleNode() const; AccessibleNode* accessibleNode(); - ComputedAccessibleNode* GetComputedAccessibleNode(); - void DidMoveToNewDocument(Document&) override; void removeAttribute(const AtomicString& name); @@ -776,6 +773,7 @@ void SetCustomElementDefinition(CustomElementDefinition*); CustomElementDefinition* GetCustomElementDefinition() const; // https://dom.spec.whatwg.org/#concept-element-is-value + void SetIsValue(const AtomicString&); const AtomicString& IsValue() const; bool ContainsFullScreenElement() const {
diff --git a/third_party/WebKit/Source/core/dom/ElementRareData.cpp b/third_party/WebKit/Source/core/dom/ElementRareData.cpp index ce97bf3..d64bbd30 100644 --- a/third_party/WebKit/Source/core/dom/ElementRareData.cpp +++ b/third_party/WebKit/Source/core/dom/ElementRareData.cpp
@@ -40,9 +40,8 @@ struct SameSizeAsElementRareData : NodeRareData { IntSize scroll_offset; - AtomicString nonce; - void* pointers[1]; - Member<void*> members[15]; + void* pointers_or_strings[3]; + Member<void*> members[14]; }; ElementRareData::ElementRareData(NodeRenderingData* node_layout_data) @@ -78,14 +77,6 @@ computed_style_ = nullptr; } -ComputedAccessibleNode* ElementRareData::EnsureComputedAccessibleNode( - Element* owner_element) { - if (!computed_accessible_node_) { - computed_accessible_node_ = ComputedAccessibleNode::Create(owner_element); - } - return computed_accessible_node_; -} - AttrNodeList& ElementRareData::EnsureAttrNodeList() { if (!attr_node_list_) attr_node_list_ = new AttrNodeList; @@ -129,7 +120,6 @@ visitor->TraceWrappers(shadow_); visitor->TraceWrappers(class_list_); visitor->TraceWrappers(attribute_map_); - visitor->TraceWrappers(computed_accessible_node_); visitor->TraceWrappers(accessible_node_); visitor->TraceWrappers(intersection_observer_data_); if (resize_observer_data_) {
diff --git a/third_party/WebKit/Source/core/dom/ElementRareData.h b/third_party/WebKit/Source/core/dom/ElementRareData.h index d5b83ccb..8ebabc7 100644 --- a/third_party/WebKit/Source/core/dom/ElementRareData.h +++ b/third_party/WebKit/Source/core/dom/ElementRareData.h
@@ -28,7 +28,6 @@ #include "core/css/cssom/InlineStylePropertyMap.h" #include "core/dom/AccessibleNode.h" #include "core/dom/Attr.h" -#include "core/dom/ComputedAccessibleNode.h" #include "core/dom/DOMTokenList.h" #include "core/dom/DatasetDOMStringMap.h" #include "core/dom/ElementShadow.h" @@ -133,6 +132,8 @@ CustomElementDefinition* GetCustomElementDefinition() const { return custom_element_definition_.Get(); } + void SetIsValue(const AtomicString& is_value) { is_value_ = is_value; } + const AtomicString& IsValue() const { return is_value_; } AccessibleNode* GetAccessibleNode() const { return accessible_node_.Get(); } AccessibleNode* EnsureAccessibleNode(Element* owner_element) { @@ -142,8 +143,6 @@ return accessible_node_; } - ComputedAccessibleNode* EnsureComputedAccessibleNode(Element* owner_element); - AttrNodeList& EnsureAttrNodeList(); AttrNodeList* GetAttrNodeList() { return attr_node_list_.Get(); } void RemoveAttrNodeList() { attr_node_list_.Clear(); } @@ -196,11 +195,11 @@ // TODO(davaajav):remove this field when v0 custom elements are deprecated Member<V0CustomElementDefinition> v0_custom_element_definition_; Member<CustomElementDefinition> custom_element_definition_; + AtomicString is_value_; Member<PseudoElementData> pseudo_element_data_; TraceWrapperMember<AccessibleNode> accessible_node_; - TraceWrapperMember<ComputedAccessibleNode> computed_accessible_node_; explicit ElementRareData(NodeRenderingData*); };
diff --git a/third_party/WebKit/Source/core/dom/FlatTreeTraversal.cpp b/third_party/WebKit/Source/core/dom/FlatTreeTraversal.cpp index 4e45ee4..62e5aed1 100644 --- a/third_party/WebKit/Source/core/dom/FlatTreeTraversal.cpp +++ b/third_party/WebKit/Source/core/dom/FlatTreeTraversal.cpp
@@ -28,6 +28,7 @@ #include "core/dom/Element.h" #include "core/dom/ElementShadow.h" +#include "core/dom/ng/flat_tree_traversal_ng.h" #include "core/html/HTMLShadowElement.h" #include "core/html/HTMLSlotElement.h" @@ -35,10 +36,12 @@ Node* FlatTreeTraversal::TraverseChild(const Node& node, TraversalDirection direction) { - if (ShadowRoot* shadow_root = node.GetShadowRoot()) { + ElementShadow* shadow = ShadowFor(node); + if (shadow) { + ShadowRoot& shadow_root = shadow->GetShadowRoot(); return ResolveDistributionStartingAt(direction == kTraversalDirectionForward - ? shadow_root->firstChild() - : shadow_root->lastChild(), + ? shadow_root.firstChild() + : shadow_root.lastChild(), direction); } return ResolveDistributionStartingAt(direction == kTraversalDirectionForward
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp index dff442e..c9dc924 100644 --- a/third_party/WebKit/Source/core/dom/Node.cpp +++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -727,6 +727,16 @@ return LayoutRect(); } +#ifndef NDEBUG +inline static ShadowRoot* GetShadowRootFor(const Node* node) { + if (!node->IsElementNode()) + return nullptr; + if (ElementShadow* shadow = ToElement(node)->Shadow()) + return &shadow->GetShadowRoot(); + return nullptr; +} +#endif + Node& Node::ShadowIncludingRoot() const { if (isConnected()) return GetDocument(); @@ -1700,9 +1710,8 @@ return; builder.Append(' '); builder.Append(name.ToString()); - builder.Append("=\""); - builder.Append(value); - builder.Append("\""); + builder.Append("="); + builder.Append(String(value).EncodeForDebugging()); } std::ostream& operator<<(std::ostream& ostream, const Node& node) { @@ -1732,9 +1741,8 @@ StringBuilder builder; builder.Append(nodeName()); if (IsTextNode()) { - builder.Append(" \""); - builder.Append(nodeValue()); - builder.Append("\""); + builder.Append(" "); + builder.Append(nodeValue().EncodeForDebugging()); return builder.ToString(); } DumpAttributeDesc(*this, HTMLNames::idAttr, builder); @@ -1846,7 +1854,7 @@ marked_node2, marked_label2, builder); } - if (ShadowRoot* shadow_root = node.GetShadowRoot()) { + if (ShadowRoot* shadow_root = GetShadowRootFor(&node)) { AppendMarkedTree(indent.ToString(), shadow_root, marked_node1, marked_label1, marked_node2, marked_label2, builder); } @@ -1931,7 +1939,7 @@ PrintSubTreeAcrossFrame(ToHTMLFrameOwnerElement(node)->contentDocument(), marked_node, indent + "\t", stream); } - if (ShadowRoot* shadow_root = node->GetShadowRoot()) + if (ShadowRoot* shadow_root = GetShadowRootFor(node)) PrintSubTreeAcrossFrame(shadow_root, marked_node, indent + "\t", stream); for (const Node* child = node->firstChild(); child; child = child->nextSibling())
diff --git a/third_party/WebKit/Source/core/dom/ng/flat_tree_traversal_ng.cc b/third_party/WebKit/Source/core/dom/ng/flat_tree_traversal_ng.cc index eafaf16..1a0c5a1f 100644 --- a/third_party/WebKit/Source/core/dom/ng/flat_tree_traversal_ng.cc +++ b/third_party/WebKit/Source/core/dom/ng/flat_tree_traversal_ng.cc
@@ -33,6 +33,10 @@ namespace blink { +ElementShadow* ShadowFor(const Node& node) { + return node.IsElementNode() ? ToElement(node).Shadow() : nullptr; +} + bool CanBeDistributedToV0InsertionPoint(const Node& node) { return node.IsInV0ShadowTree() || node.IsChildOfV0ShadowHost(); } @@ -49,9 +53,11 @@ } Node* child; - if (ShadowRoot* shadow_root = node.GetShadowRoot()) { - child = direction == kTraversalDirectionForward ? shadow_root->firstChild() - : shadow_root->lastChild(); + ElementShadow* shadow = ShadowFor(node); + if (shadow) { + ShadowRoot& shadow_root = shadow->GetShadowRoot(); + child = direction == kTraversalDirectionForward ? shadow_root.firstChild() + : shadow_root.lastChild(); } else { child = direction == kTraversalDirectionForward ? node.firstChild() : node.lastChild();
diff --git a/third_party/WebKit/Source/core/dom/ng/flat_tree_traversal_ng.h b/third_party/WebKit/Source/core/dom/ng/flat_tree_traversal_ng.h index da72ab0..81d0c079 100644 --- a/third_party/WebKit/Source/core/dom/ng/flat_tree_traversal_ng.h +++ b/third_party/WebKit/Source/core/dom/ng/flat_tree_traversal_ng.h
@@ -38,8 +38,10 @@ namespace blink { class ContainerNode; +class ElementShadow; class Node; +ElementShadow* ShadowFor(const Node& node); bool CanBeDistributedToV0InsertionPoint(const Node& node); // Flat tree version of |NodeTraversal|.
diff --git a/third_party/WebKit/Source/core/editing/BUILD.gn b/third_party/WebKit/Source/core/editing/BUILD.gn index f554756..a5aab51 100644 --- a/third_party/WebKit/Source/core/editing/BUILD.gn +++ b/third_party/WebKit/Source/core/editing/BUILD.gn
@@ -109,6 +109,8 @@ "commands/DeleteFromTextNodeCommand.h", "commands/DeleteSelectionCommand.cpp", "commands/DeleteSelectionCommand.h", + "commands/DeleteSelectionOptions.cpp", + "commands/DeleteSelectionOptions.h", "commands/DocumentExecCommand.cpp", "commands/DragAndDropCommand.cpp", "commands/DragAndDropCommand.h",
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp index 40127f8..96c353d 100644 --- a/third_party/WebKit/Source/core/editing/Editor.cpp +++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -388,13 +388,15 @@ .IsNone()) return; - const bool kMergeBlocksAfterDelete = true; - const bool kExpandForSpecialElements = false; - const bool kSanitizeMarkup = true; DCHECK(GetFrame().GetDocument()); DeleteSelectionCommand::Create( - *GetFrame().GetDocument(), delete_mode == DeleteMode::kSmart, - kMergeBlocksAfterDelete, kExpandForSpecialElements, kSanitizeMarkup, + *GetFrame().GetDocument(), + DeleteSelectionOptions::Builder() + .SetSmartDelete(delete_mode == DeleteMode::kSmart) + .SetMergeBlocksAfterDelete(true) + .SetExpandForSpecialElements(true) + .SetSanitizeMarkup(true) + .Build(), input_type, reference_move_position) ->Apply(); }
diff --git a/third_party/WebKit/Source/core/editing/Position.cpp b/third_party/WebKit/Source/core/editing/Position.cpp index 4c89e84..f1cd5ff 100644 --- a/third_party/WebKit/Source/core/editing/Position.cpp +++ b/third_party/WebKit/Source/core/editing/Position.cpp
@@ -27,6 +27,7 @@ #include <stdio.h> #include <ostream> // NOLINT +#include "core/dom/ElementShadow.h" #include "core/editing/EditingUtilities.h" #include "core/editing/TextAffinity.h" #include "platform/wtf/text/CString.h"
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnitsWordTest.cpp b/third_party/WebKit/Source/core/editing/VisibleUnitsWordTest.cpp index 7263612..abd67d6 100644 --- a/third_party/WebKit/Source/core/editing/VisibleUnitsWordTest.cpp +++ b/third_party/WebKit/Source/core/editing/VisibleUnitsWordTest.cpp
@@ -9,21 +9,6 @@ #include "core/editing/testing/EditingTestBase.h" namespace blink { -namespace visible_units_word_test { - -VisiblePosition CreateVisiblePositionInDOMTree( - Node& anchor, - int offset, - TextAffinity affinity = TextAffinity::kDownstream) { - return CreateVisiblePosition(Position(&anchor, offset), affinity); -} - -VisiblePositionInFlatTree CreateVisiblePositionInFlatTree( - Node& anchor, - int offset, - TextAffinity affinity = TextAffinity::kDownstream) { - return CreateVisiblePosition(PositionInFlatTree(&anchor, offset), affinity); -} class VisibleUnitsWordTest : public EditingTestBase { protected: @@ -67,6 +52,21 @@ return GetSelectionTextFromBody( SelectionInDOMTree::Builder().Collapse(result).Build()); } + + // To avoid name conflict in jumbo build, following functions should be here. + static VisiblePosition CreateVisiblePositionInDOMTree( + Node& anchor, + int offset, + TextAffinity affinity = TextAffinity::kDownstream) { + return CreateVisiblePosition(Position(&anchor, offset), affinity); + } + + static VisiblePositionInFlatTree CreateVisiblePositionInFlatTree( + Node& anchor, + int offset, + TextAffinity affinity = TextAffinity::kDownstream) { + return CreateVisiblePosition(PositionInFlatTree(&anchor, offset), affinity); + } }; TEST_F(VisibleUnitsWordTest, StartOfWordBasic) { @@ -461,5 +461,4 @@ EXPECT_EQ("<p> (1) abc |def</p>", DoPreviousWord("<p> (1) abc def</p>|")); } -} // namespace visible_units_word_test } // namespace blink
diff --git a/third_party/WebKit/Source/core/editing/commands/BreakBlockquoteCommand.cpp b/third_party/WebKit/Source/core/editing/commands/BreakBlockquoteCommand.cpp index 9f3d3e1..a3fc6548 100644 --- a/third_party/WebKit/Source/core/editing/commands/BreakBlockquoteCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/BreakBlockquoteCommand.cpp
@@ -32,6 +32,7 @@ #include "core/editing/VisiblePosition.h" #include "core/editing/VisibleSelection.h" #include "core/editing/VisibleUnits.h" +#include "core/editing/commands/DeleteSelectionOptions.h" #include "core/editing/commands/EditingCommandsUtilities.h" #include "core/html/HTMLBRElement.h" #include "core/html/HTMLElement.h" @@ -96,7 +97,10 @@ // Delete the current selection. if (EndingSelection().IsRange()) { - if (!DeleteSelection(editing_state, false, false)) + if (!DeleteSelection(editing_state, DeleteSelectionOptions::Builder() + .SetExpandForSpecialElements(true) + .SetSanitizeMarkup(true) + .Build())) return; }
diff --git a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp index 636e030f..14dbc0a7 100644 --- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
@@ -612,19 +612,14 @@ InsertNodeAt(node, PositionOutsideTabSpan(pos), editing_state); } -bool CompositeEditCommand::DeleteSelection(EditingState* editing_state, - bool smart_delete, - bool merge_blocks_after_delete, - bool expand_for_special_elements, - bool sanitize_markup) { +bool CompositeEditCommand::DeleteSelection( + EditingState* editing_state, + const DeleteSelectionOptions& options) { if (!EndingSelection().IsRange()) return true; ApplyCommandToComposite( - DeleteSelectionCommand::Create( - GetDocument(), smart_delete, merge_blocks_after_delete, - expand_for_special_elements, sanitize_markup), - editing_state); + DeleteSelectionCommand::Create(GetDocument(), options), editing_state); if (editing_state->IsAborted()) return false; @@ -1327,7 +1322,9 @@ SetEndingSelection(SelectionForUndoStep::From( SelectionInDOMTree::Builder().Collapse(start).Extend(end).Build())); - if (!DeleteSelection(editing_state, false, false, false)) + if (!DeleteSelection( + editing_state, + DeleteSelectionOptions::Builder().SetSanitizeMarkup(true).Build())) return; // There are bugs in deletion when it removes a fully selected table/list. @@ -1507,7 +1504,9 @@ SelectionInDOMTree::Builder().Collapse(start).Extend(end).Build()); SetEndingSelection( SelectionForUndoStep::From(selection_to_delete.AsSelection())); - if (!DeleteSelection(editing_state, false, false, false)) + if (!DeleteSelection( + editing_state, + DeleteSelectionOptions::Builder().SetSanitizeMarkup(true).Build())) return; DCHECK(destination.DeepEquivalent().IsConnected()) << destination;
diff --git a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h index e2caf54..7902480 100644 --- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h +++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h
@@ -36,6 +36,7 @@ namespace blink { +class DeleteSelectionOptions; class EditingStyle; class Element; class HTMLBRElement; @@ -98,11 +99,7 @@ void ApplyStyledElement(Element*, EditingState*); void RemoveStyledElement(Element*, EditingState*); // Returns |false| if the EditingState has been aborted. - bool DeleteSelection(EditingState*, - bool smart_delete = false, - bool merge_blocks_after_delete = true, - bool expand_for_special_elements = true, - bool sanitize_markup = true); + bool DeleteSelection(EditingState*, const DeleteSelectionOptions&); virtual void DeleteTextFromNode(Text*, unsigned offset, unsigned count); bool IsRemovableBlock(const Node*); void InsertNodeAfter(Node*, Node* ref_child, EditingState*);
diff --git a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp index 0193b8c6..13d3801 100644 --- a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
@@ -78,21 +78,16 @@ DeleteSelectionCommand::DeleteSelectionCommand( Document& document, - bool smart_delete, - bool merge_blocks_after_delete, - bool expand_for_special_elements, - bool sanitize_markup, + const DeleteSelectionOptions& options, InputEvent::InputType input_type, const Position& reference_move_position) : CompositeEditCommand(document), + options_(options), has_selection_to_delete_(false), - smart_delete_(smart_delete), - merge_blocks_after_delete_(merge_blocks_after_delete), + merge_blocks_after_delete_(options.IsMergeBlocksAfterDelete()), need_placeholder_(false), - expand_for_special_elements_(expand_for_special_elements), prune_start_block_if_necessary_(false), starts_at_empty_line_(false), - sanitize_markup_(sanitize_markup), input_type_(input_type), reference_move_position_(reference_move_position), start_block_(nullptr), @@ -102,20 +97,15 @@ DeleteSelectionCommand::DeleteSelectionCommand( const VisibleSelection& selection, - bool smart_delete, - bool merge_blocks_after_delete, - bool expand_for_special_elements, - bool sanitize_markup, + const DeleteSelectionOptions& options, InputEvent::InputType input_type) : CompositeEditCommand(*selection.Start().GetDocument()), + options_(options), has_selection_to_delete_(true), - smart_delete_(smart_delete), - merge_blocks_after_delete_(merge_blocks_after_delete), + merge_blocks_after_delete_(options.IsMergeBlocksAfterDelete()), need_placeholder_(false), - expand_for_special_elements_(expand_for_special_elements), prune_start_block_if_necessary_(false), starts_at_empty_line_(false), - sanitize_markup_(sanitize_markup), input_type_(input_type), selection_to_delete_(selection), start_block_(nullptr), @@ -145,7 +135,7 @@ // FIXME: This is only used so that moveParagraphs can avoid the bugs in // special element expansion. - if (!expand_for_special_elements_) + if (!options_.IsExpandForSpecialElements()) return; while (1) { @@ -328,7 +318,7 @@ trailing_whitespace_ = TrailingWhitespacePosition( downstream_end_, kNotConsiderNonCollapsibleWhitespace); - if (smart_delete_) { + if (options_.IsSmartDelete()) { // skip smart delete if the selection to delete already starts or ends with // whitespace Position pos = @@ -1205,7 +1195,7 @@ need_placeholder_ ? HTMLBRElement::Create(GetDocument()) : nullptr; if (placeholder) { - if (sanitize_markup_) { + if (options_.IsSanitizeMarkup()) { RemoveRedundantBlocks(editing_state); if (editing_state->IsAborted()) return;
diff --git a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.h b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.h index 6add891..a30bb93c 100644 --- a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.h +++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.h
@@ -28,6 +28,7 @@ #include "core/editing/VisibleSelection.h" #include "core/editing/commands/CompositeEditCommand.h" +#include "core/editing/commands/DeleteSelectionOptions.h" namespace blink { @@ -38,44 +39,28 @@ public: static DeleteSelectionCommand* Create( Document& document, - bool smart_delete = false, - bool merge_blocks_after_delete = true, - bool expand_for_special_elements = false, - bool sanitize_markup = true, + const DeleteSelectionOptions& options, InputEvent::InputType input_type = InputEvent::InputType::kNone, const Position& reference_move_position = Position()) { - return new DeleteSelectionCommand( - document, smart_delete, merge_blocks_after_delete, - expand_for_special_elements, sanitize_markup, input_type, - reference_move_position); + return new DeleteSelectionCommand(document, options, input_type, + reference_move_position); } static DeleteSelectionCommand* Create( const VisibleSelection& selection, - bool smart_delete = false, - bool merge_blocks_after_delete = true, - bool expand_for_special_elements = false, - bool sanitize_markup = true, + const DeleteSelectionOptions& options, InputEvent::InputType input_type = InputEvent::InputType::kNone) { - return new DeleteSelectionCommand( - selection, smart_delete, merge_blocks_after_delete, - expand_for_special_elements, sanitize_markup, input_type); + return new DeleteSelectionCommand(selection, options, input_type); } virtual void Trace(blink::Visitor*); private: DeleteSelectionCommand(Document&, - bool smart_delete, - bool merge_blocks_after_delete, - bool expand_for_special_elements, - bool santize_markup, + const DeleteSelectionOptions&, InputEvent::InputType, const Position& reference_move_position); DeleteSelectionCommand(const VisibleSelection&, - bool smart_delete, - bool merge_blocks_after_delete, - bool expand_for_special_elements, - bool sanitize_markup, + const DeleteSelectionOptions&, InputEvent::InputType); void DoApply(EditingState*) override; @@ -103,14 +88,12 @@ void DeleteTextFromNode(Text*, unsigned, unsigned) override; void RemoveRedundantBlocks(EditingState*); + const DeleteSelectionOptions options_; bool has_selection_to_delete_; - bool smart_delete_; bool merge_blocks_after_delete_; bool need_placeholder_; - bool expand_for_special_elements_; bool prune_start_block_if_necessary_; bool starts_at_empty_line_; - bool sanitize_markup_; InputEvent::InputType input_type_; // This data is transient and should be cleared at the end of the doApply
diff --git a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommandTest.cpp b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommandTest.cpp index d5b4e213..b2e3d9e 100644 --- a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommandTest.cpp +++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommandTest.cpp
@@ -43,14 +43,13 @@ .Extend(Position(table, PositionAnchorType::kAfterAnchor)) .Build()); - const bool kNoSmartDelete = false; - const bool kMergeBlocksAfterDelete = true; - const bool kNoExpandForSpecialElements = false; - const bool kSanitizeMarkup = true; - DeleteSelectionCommand* command = DeleteSelectionCommand::Create( - GetDocument(), kNoSmartDelete, kMergeBlocksAfterDelete, - kNoExpandForSpecialElements, kSanitizeMarkup, - InputEvent::InputType::kDeleteByCut); + DeleteSelectionCommand* command = + DeleteSelectionCommand::Create(GetDocument(), + DeleteSelectionOptions::Builder() + .SetMergeBlocksAfterDelete(true) + .SetSanitizeMarkup(true) + .Build(), + InputEvent::InputType::kDeleteByCut); EXPECT_TRUE(command->Apply()) << "the delete command should have succeeded"; EXPECT_EQ("<div contenteditable=\"true\"><br></div>", @@ -67,13 +66,11 @@ Selection().SetSelectionAndEndTyping( SetSelectionTextToBody("<p contenteditable>a^b|c</p>")); - const bool kNoSmartDelete = false; - const bool kMergeBlocksAfterDelete = true; - const bool kNoExpandForSpecialElements = false; - const bool kSanitizeMarkup = true; DeleteSelectionCommand& command = *DeleteSelectionCommand::Create( - GetDocument(), kNoSmartDelete, kMergeBlocksAfterDelete, - kNoExpandForSpecialElements, kSanitizeMarkup); + GetDocument(), DeleteSelectionOptions::Builder() + .SetMergeBlocksAfterDelete(true) + .SetSanitizeMarkup(true) + .Build()); EXPECT_TRUE(command.Apply()) << "the delete command should have succeeded"; EXPECT_EQ("<p contenteditable>a|c</p>", GetSelectionTextFromBody(Selection().GetSelectionInDOMTree()));
diff --git a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionOptions.cpp b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionOptions.cpp new file mode 100644 index 0000000..e4a523c --- /dev/null +++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionOptions.cpp
@@ -0,0 +1,75 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "core/editing/commands/DeleteSelectionOptions.h" + +namespace blink { + +DeleteSelectionOptions::DeleteSelectionOptions(const DeleteSelectionOptions&) = + default; +DeleteSelectionOptions::DeleteSelectionOptions() = default; + +bool DeleteSelectionOptions::IsExpandForSpecialElements() const { + return is_expand_for_special_elements_; +} +bool DeleteSelectionOptions::IsMergeBlocksAfterDelete() const { + return is_merge_blocks_after_delete_; +} +bool DeleteSelectionOptions::IsSanitizeMarkup() const { + return is_sanitize_markup_; +} +bool DeleteSelectionOptions::IsSmartDelete() const { + return is_smart_delete_; +} + +// static +DeleteSelectionOptions DeleteSelectionOptions::NormalDelete() { + return Builder() + .SetMergeBlocksAfterDelete(true) + .SetExpandForSpecialElements(true) + .SetSanitizeMarkup(true) + .Build(); +} + +DeleteSelectionOptions DeleteSelectionOptions::SmartDelete() { + return Builder() + .SetSmartDelete(true) + .SetMergeBlocksAfterDelete(true) + .SetExpandForSpecialElements(true) + .SetSanitizeMarkup(true) + .Build(); +} + +// ---- +DeleteSelectionOptions::Builder::Builder() = default; + +DeleteSelectionOptions DeleteSelectionOptions::Builder::Build() const { + return options_; +} + +DeleteSelectionOptions::Builder& +DeleteSelectionOptions::Builder::SetExpandForSpecialElements(bool value) { + options_.is_expand_for_special_elements_ = value; + return *this; +} + +DeleteSelectionOptions::Builder& +DeleteSelectionOptions::Builder::SetMergeBlocksAfterDelete(bool value) { + options_.is_merge_blocks_after_delete_ = value; + return *this; +} + +DeleteSelectionOptions::Builder& +DeleteSelectionOptions::Builder::SetSanitizeMarkup(bool value) { + options_.is_sanitize_markup_ = value; + return *this; +} + +DeleteSelectionOptions::Builder& +DeleteSelectionOptions::Builder::SetSmartDelete(bool value) { + options_.is_smart_delete_ = value; + return *this; +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionOptions.h b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionOptions.h new file mode 100644 index 0000000..4e1b295 --- /dev/null +++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionOptions.h
@@ -0,0 +1,62 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DeleteSelectionOptions_h +#define DeleteSelectionOptions_h + +#include "base/macros.h" +#include "core/CoreExport.h" +#include "platform/wtf/Allocator.h" + +namespace blink { + +// DeleteSelectionOptions of |DeleteSelectionCommand|. +class CORE_EXPORT DeleteSelectionOptions final { + DISALLOW_NEW(); + + public: + class Builder; + + DeleteSelectionOptions(const DeleteSelectionOptions&); + + bool IsExpandForSpecialElements() const; + bool IsMergeBlocksAfterDelete() const; + bool IsSanitizeMarkup() const; + bool IsSmartDelete() const; + + static DeleteSelectionOptions NormalDelete(); + static DeleteSelectionOptions SmartDelete(); + + private: + DeleteSelectionOptions(); + + bool is_expand_for_special_elements_ = false; + bool is_merge_blocks_after_delete_ = false; + bool is_sanitize_markup_ = false; + bool is_smart_delete_ = false; +}; + +// Build |DeleteSelectionCommand::Options|. +class CORE_EXPORT DeleteSelectionOptions::Builder final { + DISALLOW_NEW(); + + public: + Builder(); + + DeleteSelectionOptions Build() const; + + Builder& SetExpandForSpecialElements(bool); + Builder& SetMergeBlocksAfterDelete(bool); + Builder& SetSanitizeMarkup(bool); + Builder& SetSmartDelete(bool); + + private: + DeleteSelectionOptions options_; + + DISALLOW_COPY_AND_ASSIGN(Builder); +}; + +} // namespace blink + +#endif // DeleteSelectionOptions_h
diff --git a/third_party/WebKit/Source/core/editing/commands/EditingCommandsUtilities.cpp b/third_party/WebKit/Source/core/editing/commands/EditingCommandsUtilities.cpp index 2eaa071f..e48a837 100644 --- a/third_party/WebKit/Source/core/editing/commands/EditingCommandsUtilities.cpp +++ b/third_party/WebKit/Source/core/editing/commands/EditingCommandsUtilities.cpp
@@ -164,6 +164,7 @@ VisiblePosition first_in_element = CreateVisiblePosition(FirstPositionInOrBeforeNode(*special_element)); if (IsDisplayInsideTable(special_element) && + !IsListItem(v_pos.DeepEquivalent().ComputeContainerNode()) && v_pos.DeepEquivalent() == NextPositionOf(first_in_element).DeepEquivalent()) return special_element;
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp index 17ec4c8..64bbea9 100644 --- a/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp
@@ -33,6 +33,7 @@ #include "core/editing/SelectionTemplate.h" #include "core/editing/VisiblePosition.h" #include "core/editing/VisibleUnits.h" +#include "core/editing/commands/DeleteSelectionOptions.h" #include "core/editing/commands/EditingCommandsUtilities.h" #include "core/frame/LocalFrame.h" #include "core/html/HTMLBRElement.h" @@ -65,7 +66,7 @@ } void InsertLineBreakCommand::DoApply(EditingState* editing_state) { - if (!DeleteSelection(editing_state)) + if (!DeleteSelection(editing_state, DeleteSelectionOptions::NormalDelete())) return; GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp index 41d7e46..476ae10 100644 --- a/third_party/WebKit/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp
@@ -34,6 +34,7 @@ #include "core/editing/VisiblePosition.h" #include "core/editing/VisibleSelection.h" #include "core/editing/VisibleUnits.h" +#include "core/editing/commands/DeleteSelectionOptions.h" #include "core/editing/commands/EditingCommandsUtilities.h" #include "core/editing/commands/InsertLineBreakCommand.h" #include "core/html/HTMLBRElement.h" @@ -195,7 +196,7 @@ if (EndingSelection().IsRange()) { GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); CalculateStyleBeforeInsertion(insertion_position); - if (!DeleteSelection(editing_state, false, true)) + if (!DeleteSelection(editing_state, DeleteSelectionOptions::NormalDelete())) return; const VisibleSelection& visble_selection_after_delete = EndingVisibleSelection();
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp index a9e27d3..e3670ac 100644 --- a/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp
@@ -33,6 +33,7 @@ #include "core/editing/SelectionTemplate.h" #include "core/editing/VisiblePosition.h" #include "core/editing/VisibleUnits.h" +#include "core/editing/commands/DeleteSelectionOptions.h" #include "core/editing/commands/EditingCommandsUtilities.h" #include "core/frame/LocalFrame.h" #include "core/html/HTMLSpanElement.h" @@ -162,7 +163,9 @@ GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); bool end_of_selection_was_at_start_of_block = IsStartOfBlock(EndingVisibleSelection().VisibleEnd()); - if (!DeleteSelection(editing_state, false, true, false, false)) + if (!DeleteSelection(editing_state, DeleteSelectionOptions::Builder() + .SetMergeBlocksAfterDelete(true) + .Build())) return; // deleteSelection eventually makes a new endingSelection out of a Position. // If that Position doesn't have a layoutObject (e.g. it is on a <frameset>
diff --git a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp index 65cc191..85770788 100644 --- a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
@@ -44,6 +44,7 @@ #include "core/editing/VisibleUnits.h" #include "core/editing/commands/ApplyStyleCommand.h" #include "core/editing/commands/BreakBlockquoteCommand.h" +#include "core/editing/commands/DeleteSelectionOptions.h" #include "core/editing/commands/EditingCommandsUtilities.h" #include "core/editing/commands/SimplifyMarkupCommand.h" #include "core/editing/commands/SmartReplace.h" @@ -1070,8 +1071,11 @@ IsStartOfBlock(visible_start); // FIXME: We should only expand to include fully selected special elements // if we are copying a selection and pasting it on top of itself. - if (!DeleteSelection(editing_state, false, merge_blocks_after_delete, - false)) + if (!DeleteSelection(editing_state, DeleteSelectionOptions::Builder() + .SetMergeBlocksAfterDelete( + merge_blocks_after_delete) + .SetSanitizeMarkup(true) + .Build())) return; if (fragment.HasInterchangeNewlineAtStart()) { GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
diff --git a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.h b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.h index 2098f97..d7683a8 100644 --- a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.h +++ b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.h
@@ -145,14 +145,14 @@ Position start_of_inserted_content_; Position end_of_inserted_content_; Member<EditingStyle> insertion_style_; - bool select_replacement_; - bool smart_replace_; + const bool select_replacement_; + const bool smart_replace_; bool match_style_; Member<DocumentFragment> document_fragment_; bool prevent_nesting_; - bool moving_paragraph_; + const bool moving_paragraph_; InputEvent::InputType input_type_; - bool sanitize_fragment_; + const bool sanitize_fragment_; bool should_merge_end_; Position start_of_inserted_range_;
diff --git a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp index 9f90da1..97e8d443 100644 --- a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp +++ b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
@@ -41,6 +41,7 @@ #include "core/editing/VisibleUnits.h" #include "core/editing/commands/BreakBlockquoteCommand.h" #include "core/editing/commands/DeleteSelectionCommand.h" +#include "core/editing/commands/DeleteSelectionOptions.h" #include "core/editing/commands/EditingCommandsUtilities.h" #include "core/editing/commands/InsertIncrementalTextCommand.h" #include "core/editing/commands/InsertLineBreakCommand.h" @@ -204,18 +205,17 @@ } void TypingCommand::DeleteSelectionIfRange(const VisibleSelection& selection, - EditingState* editing_state, - bool smart_delete, - bool merge_blocks_after_delete, - bool expand_for_special_elements, - bool sanitize_markup) { + EditingState* editing_state) { if (!selection.IsRange()) return; - ApplyCommandToComposite( - DeleteSelectionCommand::Create( - selection, smart_delete, merge_blocks_after_delete, - expand_for_special_elements, sanitize_markup), - editing_state); + ApplyCommandToComposite(DeleteSelectionCommand::Create( + selection, DeleteSelectionOptions::Builder() + .SetSmartDelete(smart_delete_) + .SetMergeBlocksAfterDelete(true) + .SetExpandForSpecialElements(true) + .SetSanitizeMarkup(true) + .Build()), + editing_state); } void TypingCommand::DeleteKeyPressed(Document& document, @@ -925,7 +925,7 @@ if (frame->GetEditor().Behavior().ShouldUndoOfDeleteSelectText() && opened_by_backward_delete_) SetStartingSelection(selection_after_undo); - DeleteSelectionIfRange(selection_to_delete, editing_state, smart_delete_); + DeleteSelectionIfRange(selection_to_delete, editing_state); if (editing_state->IsAborted()) return; SetSmartDelete(false); @@ -1065,7 +1065,7 @@ // Make undo select what was deleted on Mac alone if (frame->GetEditor().Behavior().ShouldUndoOfDeleteSelectText()) SetStartingSelection(selection_after_undo); - DeleteSelectionIfRange(selection_to_delete, editing_state, smart_delete_); + DeleteSelectionIfRange(selection_to_delete, editing_state); if (editing_state->IsAborted()) return; SetSmartDelete(false); @@ -1074,7 +1074,9 @@ void TypingCommand::DeleteSelection(bool smart_delete, EditingState* editing_state) { - if (!CompositeEditCommand::DeleteSelection(editing_state, smart_delete)) + if (!CompositeEditCommand::DeleteSelection( + editing_state, smart_delete ? DeleteSelectionOptions::SmartDelete() + : DeleteSelectionOptions::NormalDelete())) return; TypingAddedToOpenCommand(kDeleteSelection); }
diff --git a/third_party/WebKit/Source/core/editing/commands/TypingCommand.h b/third_party/WebKit/Source/core/editing/commands/TypingCommand.h index b16708d8..ba59ae47 100644 --- a/third_party/WebKit/Source/core/editing/commands/TypingCommand.h +++ b/third_party/WebKit/Source/core/editing/commands/TypingCommand.h
@@ -164,12 +164,7 @@ bool kill_ring, EditingState*); - void DeleteSelectionIfRange(const VisibleSelection&, - EditingState*, - bool smart_delete = false, - bool merge_blocks_after_delete = true, - bool expand_for_special_elements = true, - bool sanitize_markup = true); + void DeleteSelectionIfRange(const VisibleSelection&, EditingState*); void ForwardDeleteKeyPressedInternal( const VisibleSelection& selection_to_delete, @@ -180,11 +175,11 @@ ETypingCommand command_type_; String text_to_insert_; bool open_for_more_typing_; - bool select_inserted_text_; + const bool select_inserted_text_; bool smart_delete_; - TextGranularity granularity_; + const TextGranularity granularity_; TextCompositionType composition_type_; - bool kill_ring_; + const bool kill_ring_; bool preserves_typing_style_; // Undoing a series of backward deletes will restore a selection around all of
diff --git a/third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializer.cpp b/third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializer.cpp index 036e8e7..48b0aaf2 100644 --- a/third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializer.cpp +++ b/third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializer.cpp
@@ -74,8 +74,12 @@ template <> bool HandleSelectionBoundary<EditingInFlatTreeStrategy>(const Node& node) { - ShadowRoot* root = node.GetShadowRoot(); - return root && root->IsUserAgent(); + if (!node.IsElementNode()) + return false; + ElementShadow* shadow = ToElement(node).Shadow(); + if (!shadow) + return false; + return shadow->GetShadowRoot().IsUserAgent(); } } // namespace
diff --git a/third_party/WebKit/Source/core/exported/WebFrameSerializer.cpp b/third_party/WebKit/Source/core/exported/WebFrameSerializer.cpp index 4fbd679..3847b10 100644 --- a/third_party/WebKit/Source/core/exported/WebFrameSerializer.cpp +++ b/third_party/WebKit/Source/core/exported/WebFrameSerializer.cpp
@@ -358,12 +358,13 @@ std::pair<Node*, Element*> MHTMLFrameSerializerDelegate::GetAuxiliaryDOMTree( const Element& element) const { - ShadowRoot* shadow_root = element.GetShadowRoot(); - if (!shadow_root) + const ElementShadow* shadow = element.Shadow(); + if (!shadow) return std::pair<Node*, Element*>(); + ShadowRoot& shadow_root = shadow->GetShadowRoot(); String shadow_mode; - switch (shadow_root->GetType()) { + switch (shadow_root.GetType()) { case ShadowRootType::kUserAgent: // No need to serialize. return std::pair<Node*, Element*>(); @@ -385,8 +386,8 @@ template_element->setAttribute( QualifiedName(g_null_atom, kShadowModeAttributeName, g_null_atom), AtomicString(shadow_mode)); - if (shadow_root->GetType() != ShadowRootType::V0 && - shadow_root->delegatesFocus()) { + if (shadow_root.GetType() != ShadowRootType::V0 && + shadow_root.delegatesFocus()) { template_element->setAttribute( QualifiedName(g_null_atom, kShadowDelegatesFocusAttributeName, g_null_atom), @@ -394,7 +395,7 @@ } shadow_template_elements_.insert(template_element); - return std::pair<Node*, Element*>(shadow_root, template_element); + return std::pair<Node*, Element*>(&shadow_root, template_element); } bool CacheControlNoStoreHeaderPresent(
diff --git a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp index 05278662..a0bc04c 100644 --- a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp
@@ -11968,6 +11968,20 @@ ASSERT_EQ(ScrollOffset(0, 0), area->GetScrollOffset()); } +TEST_P(WebFrameSimTest, NamedLookupIgnoresEmptyNames) { + SimRequest main_resource("https://example.com/main.html", "text/html"); + LoadURL("https://example.com/main.html"); + main_resource.Complete(R"HTML( + <body> + <iframe name="" src="data:text/html,"></iframe> + </body>)HTML"); + + EXPECT_EQ(nullptr, MainFrame().GetFrame()->Tree().ScopedChild("")); + EXPECT_EQ(nullptr, + MainFrame().GetFrame()->Tree().ScopedChild(AtomicString())); + EXPECT_EQ(nullptr, MainFrame().GetFrame()->Tree().ScopedChild(g_empty_atom)); +} + TEST_P(ParameterizedWebFrameTest, NoLoadingCompletionCallbacksInDetach) { class LoadingObserverFrameClient : public FrameTestHelpers::TestWebFrameClient {
diff --git a/third_party/WebKit/Source/core/frame/Deprecation.cpp b/third_party/WebKit/Source/core/frame/Deprecation.cpp index b5bd040..dc5f4c3 100644 --- a/third_party/WebKit/Source/core/frame/Deprecation.cpp +++ b/third_party/WebKit/Source/core/frame/Deprecation.cpp
@@ -19,7 +19,7 @@ #include "public/platform/Platform.h" #include "public/platform/reporting.mojom-blink.h" #include "services/service_manager/public/cpp/connector.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom-blink.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom-blink.h" using blink::WebFeature;
diff --git a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp index 949b737..0cf9283 100644 --- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp +++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
@@ -1102,9 +1102,13 @@ ScriptState* script_state, Element* element) { DCHECK(element); - ComputedAccessibleNode* computed_accessible_node = - element->GetComputedAccessibleNode(); - return computed_accessible_node->ComputeAccessibleProperties(script_state); + // TODO(meredithl): Create finer grain method for enabling accessibility. + element->GetDocument().GetPage()->GetSettings().SetAccessibilityEnabled(true); + ComputedAccessibleNodePromiseResolver* resolver = + ComputedAccessibleNodePromiseResolver::Create(script_state, *element); + ScriptPromise promise = resolver->Promise(); + resolver->ComputeAccessibleNode(); + return promise; } CSSRuleList* LocalDOMWindow::getMatchedCSSRules(
diff --git a/third_party/WebKit/Source/core/frame/MHTMLLoadingTest.cpp b/third_party/WebKit/Source/core/frame/MHTMLLoadingTest.cpp index 149a39c..cce0afa 100644 --- a/third_party/WebKit/Source/core/frame/MHTMLLoadingTest.cpp +++ b/third_party/WebKit/Source/core/frame/MHTMLLoadingTest.cpp
@@ -195,16 +195,19 @@ EXPECT_TRUE(IsShadowHost(document->getElementById("h2"))); // The nested shadow DOM tree is created. EXPECT_TRUE(IsShadowHost( - document->getElementById("h2")->GetShadowRoot()->getElementById("h3"))); + document->getElementById("h2")->Shadow()->GetShadowRoot().getElementById( + "h3"))); EXPECT_TRUE(IsShadowHost(document->getElementById("h4"))); // The static element in the shadow dom template is found. EXPECT_TRUE( - document->getElementById("h4")->GetShadowRoot()->getElementById("s1")); + document->getElementById("h4")->Shadow()->GetShadowRoot().getElementById( + "s1")); // The element to be created by the script in the shadow dom template is // not found because the script is blocked. EXPECT_FALSE( - document->getElementById("h4")->GetShadowRoot()->getElementById("s2")); + document->getElementById("h4")->Shadow()->GetShadowRoot().getElementById( + "s2")); } TEST_F(MHTMLLoadingTest, FormControlElements) {
diff --git a/third_party/WebKit/Source/core/html/custom/CustomElement.cpp b/third_party/WebKit/Source/core/html/custom/CustomElement.cpp index fd10aff..790cfaf6 100644 --- a/third_party/WebKit/Source/core/html/custom/CustomElement.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElement.cpp
@@ -133,8 +133,11 @@ // 7.1. Let interface be the element interface for localName and namespace. // 7.2. Set result to a new element that implements interface, with ... element = document.CreateRawElement(tag_name, flags); - if (level == kCheckAll && !is_value.IsEmpty() && flags.IsCustomElementsV0()) - V0CustomElementRegistrationContext::SetTypeExtension(element, is_value); + if (level == kCheckAll && !is_value.IsEmpty()) { + element->SetIsValue(is_value); + if (flags.IsCustomElementsV0()) + V0CustomElementRegistrationContext::SetTypeExtension(element, is_value); + } } // 7.3. If namespace is the HTML namespace, and either localName is a
diff --git a/third_party/WebKit/Source/core/html/custom/CustomElementDefinition.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementDefinition.cpp index 69134a00f..15bed208 100644 --- a/third_party/WebKit/Source/core/html/custom/CustomElementDefinition.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementDefinition.cpp
@@ -95,7 +95,9 @@ HTMLElement* element = HTMLElementFactory::Create(Descriptor().LocalName(), document, CreateElementFlags::ByCreateElement()); - if (!element) { + if (element) { + element->SetIsValue(Descriptor().GetName()); + } else { element = HTMLElement::Create(QualifiedName(g_null_atom, Descriptor().LocalName(), HTMLNames::xhtmlNamespaceURI), @@ -130,6 +132,7 @@ // is value set to is, and node document set to document. auto* result = document.CreateRawElement(tag_name, flags); result->SetCustomElementState(CustomElementState::kUndefined); + result->SetIsValue(Descriptor().GetName()); // 5.3. If the synchronous custom elements flag is set, upgrade // element using definition.
diff --git a/third_party/WebKit/Source/core/html/custom/CustomElementDescriptorTest.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementDescriptorTest.cpp index 85933b6..3b9e8454f 100644 --- a/third_party/WebKit/Source/core/html/custom/CustomElementDescriptorTest.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementDescriptorTest.cpp
@@ -48,13 +48,13 @@ TEST(CustomElementDescriptorTest, matches_autonomous_shouldNotMatchCustomizedBuiltInElement) { CustomElementDescriptor descriptor("a-b", "a-b"); - Element* element = CreateElement("futuretag").WithIsAttribute("a-b"); + Element* element = CreateElement("futuretag").WithIsValue("a-b"); EXPECT_FALSE(descriptor.Matches(*element)); } TEST(CustomElementDescriptorTest, matches_customizedBuiltIn) { CustomElementDescriptor descriptor("a-b", "button"); - Element* element = CreateElement("button").WithIsAttribute("a-b"); + Element* element = CreateElement("button").WithIsValue("a-b"); EXPECT_TRUE(descriptor.Matches(*element)); }
diff --git a/third_party/WebKit/Source/core/html/custom/CustomElementRegistryTest.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementRegistryTest.cpp index e7420166..aaec3c0 100644 --- a/third_party/WebKit/Source/core/html/custom/CustomElementRegistryTest.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementRegistryTest.cpp
@@ -101,7 +101,7 @@ // Does not match: local name is not hello-world Element* element_c = CreateElement("button") .InDocument(&GetDocument()) - .WithIsAttribute("hello-world"); + .WithIsValue("hello-world"); GetDocument().documentElement()->AppendChild(element_a); element_a->AppendChild(element_b); element_a->AppendChild(element_c);
diff --git a/third_party/WebKit/Source/core/html/custom/CustomElementTestHelpers.h b/third_party/WebKit/Source/core/html/custom/CustomElementTestHelpers.h index c232654..dff902d 100644 --- a/third_party/WebKit/Source/core/html/custom/CustomElementTestHelpers.h +++ b/third_party/WebKit/Source/core/html/custom/CustomElementTestHelpers.h
@@ -118,8 +118,8 @@ return *this; } - CreateElement& WithIsAttribute(const AtomicString& value) { - attributes_.push_back(std::make_pair(HTMLNames::isAttr, value)); + CreateElement& WithIsValue(const AtomicString& value) { + is_value_ = value; return *this; } @@ -128,8 +128,9 @@ if (!document) document = HTMLDocument::CreateForTest(); NonThrowableExceptionState no_exceptions; - Element* element = - document->createElementNS(namespace_uri_, local_name_, no_exceptions); + Element* element = document->CreateElement( + QualifiedName(g_null_atom, local_name_, namespace_uri_), + CreateElementFlags::ByCreateElement(), is_value_); for (const auto& attribute : attributes_) element->setAttribute(attribute.first, attribute.second); return element; @@ -139,6 +140,7 @@ Member<Document> document_; AtomicString namespace_uri_; AtomicString local_name_; + AtomicString is_value_; std::vector<std::pair<QualifiedName, AtomicString>> attributes_; };
diff --git a/third_party/WebKit/Source/core/html/forms/ColorChooserClient.h b/third_party/WebKit/Source/core/html/forms/ColorChooserClient.h index 23d4ef02..0454352 100644 --- a/third_party/WebKit/Source/core/html/forms/ColorChooserClient.h +++ b/third_party/WebKit/Source/core/html/forms/ColorChooserClient.h
@@ -36,7 +36,7 @@ #include "platform/graphics/Color.h" #include "platform/heap/Handle.h" #include "platform/wtf/Vector.h" -#include "third_party/WebKit/common/color_chooser/color_chooser.mojom-blink.h" +#include "third_party/WebKit/public/mojom/color_chooser/color_chooser.mojom-blink.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/ColorChooserUIController.h b/third_party/WebKit/Source/core/html/forms/ColorChooserUIController.h index 6d97b48d..ba3bb58 100644 --- a/third_party/WebKit/Source/core/html/forms/ColorChooserUIController.h +++ b/third_party/WebKit/Source/core/html/forms/ColorChooserUIController.h
@@ -32,7 +32,7 @@ #include "mojo/public/cpp/bindings/binding.h" #include "platform/heap/Handle.h" #include "platform/text/PlatformLocale.h" -#include "third_party/WebKit/common/color_chooser/color_chooser.mojom-blink.h" +#include "third_party/WebKit/public/mojom/color_chooser/color_chooser.mojom-blink.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp b/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp index 53cfd0e6..660253c 100644 --- a/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp +++ b/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp
@@ -17,7 +17,7 @@ #include "platform/wtf/Assertions.h" #include "public/platform/WebMediaPlayer.h" #include "public/web/WebSettings.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom-blink.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom-blink.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/media/PictureInPictureInterstitial.h b/third_party/WebKit/Source/core/html/media/PictureInPictureInterstitial.h index ec2f736..8d3e83c6 100644 --- a/third_party/WebKit/Source/core/html/media/PictureInPictureInterstitial.h +++ b/third_party/WebKit/Source/core/html/media/PictureInPictureInterstitial.h
@@ -12,7 +12,6 @@ class HTMLImageElement; class HTMLVideoElement; -// class PictureInPictureMessageElement; // Picture in Picture UI. DOM structure looks like: //
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp index b7ac913b..96867b08 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
@@ -928,10 +928,14 @@ const Node* stay_within, bool include_user_agent_shadow_dom) { // At first traverse the subtree. - - if (ShadowRoot* shadow_root = current.GetShadowRoot()) { - if (!shadow_root->IsUserAgent() || include_user_agent_shadow_dom) - return shadow_root; + if (current.IsElementNode()) { + const Element& element = ToElement(current); + ElementShadow* element_shadow = element.Shadow(); + if (element_shadow) { + ShadowRoot& shadow_root = element_shadow->GetShadowRoot(); + if (!shadow_root.IsUserAgent() || include_user_agent_shadow_dom) + return &shadow_root; + } } if (current.hasChildren()) return current.firstChild(); @@ -1462,11 +1466,13 @@ value->setFrameId(IdentifiersFactory::FrameId(frame)); } - if (ShadowRoot* root = element->GetShadowRoot()) { + ElementShadow* shadow = element->Shadow(); + if (shadow) { std::unique_ptr<protocol::Array<protocol::DOM::Node>> shadow_roots = protocol::Array<protocol::DOM::Node>::create(); - shadow_roots->addItem(BuildObjectForNode(root, pierce ? depth : 0, pierce, - nodes_map, flatten_result)); + ShadowRoot& root = shadow->GetShadowRoot(); + shadow_roots->addItem(BuildObjectForNode( + &root, pierce ? depth : 0, pierce, nodes_map, flatten_result)); value->setShadowRoots(std::move(shadow_roots)); force_push_children = true; } @@ -1750,9 +1756,10 @@ } } - ShadowRoot* root = element->GetShadowRoot(); - if (pierce && root) - CollectNodes(root, depth, pierce, filter, result); + ElementShadow* shadow = element->Shadow(); + if (pierce && shadow) { + CollectNodes(&shadow->GetShadowRoot(), depth, pierce, filter, result); + } if (auto* link_element = ToHTMLLinkElementOrNull(*element)) { if (link_element->IsImport() && link_element->import() &&
diff --git a/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.cpp index b7c10236..737e186 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.cpp
@@ -13,6 +13,7 @@ #include "core/page/Page.h" #include "platform/geometry/DoubleRect.h" #include "platform/graphics/Color.h" +#include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/scheduler/util/thread_cpu_throttler.h" #include "platform/wtf/Time.h" #include "public/platform/Platform.h" @@ -228,6 +229,8 @@ WTF::TimeTicks virtual_time_base_ticks( web_local_frame_->View()->Scheduler()->EnableVirtualTime()); if (new_policy.virtual_time_budget_ms) { + TRACE_EVENT_ASYNC_BEGIN1("renderer.scheduler", "VirtualTimeBudget", this, + "budget", *new_policy.virtual_time_budget_ms); WTF::TimeDelta budget_amount = WTF::TimeDelta::FromMillisecondsD(*new_policy.virtual_time_budget_ms); web_local_frame_->View()->Scheduler()->GrantVirtualTimeBudget( @@ -258,6 +261,7 @@ } void InspectorEmulationAgent::VirtualTimeBudgetExpired() { + TRACE_EVENT_ASYNC_END0("renderer.scheduler", "VirtualTimeBudget", this); web_local_frame_->View()->Scheduler()->SetVirtualTimePolicy( WebViewScheduler::VirtualTimePolicy::kPause); GetFrontend()->virtualTimeBudgetExpired();
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp index 5d704576..69e0470 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
@@ -336,14 +336,12 @@ switch (options) { case v8::ScriptCompiler::kNoCompileOptions: return "code"; - case v8::ScriptCompiler::kProduceParserCache: - return "parser"; - case v8::ScriptCompiler::kConsumeParserCache: - return "parser"; case v8::ScriptCompiler::kConsumeCodeCache: return "code"; case v8::ScriptCompiler::kEagerCompile: return "full code"; + case v8::ScriptCompiler::kProduceParserCache: + case v8::ScriptCompiler::kConsumeParserCache: case v8::ScriptCompiler::kProduceCodeCache: case v8::ScriptCompiler::kProduceFullCodeCache: NOTREACHED(); @@ -1055,8 +1053,7 @@ v8::ScriptCompiler::CompileOptions produce_options, int cache_size) : produce_options(produce_options), cache_size(cache_size) { - DCHECK(produce_options == v8::ScriptCompiler::kProduceParserCache || - produce_options == v8::ScriptCompiler::kNoCompileOptions || + DCHECK(produce_options == v8::ScriptCompiler::kNoCompileOptions || produce_options == v8::ScriptCompiler::kEagerCompile); } @@ -1067,8 +1064,7 @@ : consume_options(consume_options), cache_size(cache_size), rejected(rejected) { - DCHECK(consume_options == v8::ScriptCompiler::kConsumeParserCache || - consume_options == v8::ScriptCompiler::kConsumeCodeCache); + DCHECK_EQ(consume_options, v8::ScriptCompiler::kConsumeCodeCache); } InspectorCompileScriptEvent::V8CacheResult::V8CacheResult(
diff --git a/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp b/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp index c95d24b..41e9e9b4 100644 --- a/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp
@@ -675,4 +675,34 @@ EXPECT_EQ(cell->GetLayoutObject(), none->GetLayoutObject()->Parent()); } +TEST_F(LayoutObjectTest, DumpLayoutObject) { + // Test dumping for debugging, in particular that newlines and non-ASCII + // characters are escaped as expected. + SetBodyInnerHTML(String::FromUTF8(R"HTML( + <div id='block' style='background: +lime'> + testing Среќен роденден +</div> + )HTML")); + + LayoutObject* block = GetLayoutObjectByElementId("block"); + ASSERT_TRUE(block); + LayoutObject* text = block->SlowFirstChild(); + ASSERT_TRUE(text); + + StringBuilder result; + block->DumpLayoutObject(result, false, 0); + EXPECT_EQ( + result.ToString(), + String("LayoutBlockFlow\tDIV id=\"block\" style=\"background:\\nlime\"")); + + result.Clear(); + text->DumpLayoutObject(result, false, 0); + EXPECT_EQ( + result.ToString(), + String("LayoutText\t#text \"\\n testing " + "\\u0421\\u0440\\u0435\\u045C\\u0435\\u043D " + "\\u0440\\u043E\\u0434\\u0435\\u043D\\u0434\\u0435\\u043D\\n\"")); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/LayoutTheme.cpp b/third_party/WebKit/Source/core/layout/LayoutTheme.cpp index 4f277cea..8c12c62 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTheme.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTheme.cpp
@@ -23,6 +23,7 @@ #include "core/CSSValueKeywords.h" #include "core/dom/Document.h" +#include "core/dom/ElementShadow.h" #include "core/editing/FrameSelection.h" #include "core/fileapi/FileList.h" #include "core/frame/LocalFrame.h"
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc index 03ab5b19..3b913db5 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
@@ -632,7 +632,10 @@ DCHECK(box_->IsOutOfFlowPositioned()); // Only set static position if the current offset container // is one that Legacy layout expects static offset from. - if (box_->Parent() == offset_container) { + const LayoutObject* parent = box_->Parent(); + if (parent == offset_container || + (parent && parent->IsLayoutInline() && + parent->ContainingBlock() == offset_container)) { DCHECK(box_->Layer()); box_->Layer()->SetStaticBlockPosition(offset.block_offset); box_->Layer()->SetStaticInlinePosition(offset.inline_offset);
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_container_fragment_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_container_fragment_builder.cc index 6b8001b..d8b98a9 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_container_fragment_builder.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_container_fragment_builder.cc
@@ -57,8 +57,8 @@ // Collect the child's out of flow descendants. // child_offset is offset of inline_start/block_start vertex. // Candidates need offset of top/left vertex. - const auto& ouf_of_flow_descendants = child->OutOfFlowPositionedDescendants(); - if (!ouf_of_flow_descendants.IsEmpty()) { + const auto& out_of_flow_descendants = child->OutOfFlowPositionedDescendants(); + if (!out_of_flow_descendants.IsEmpty()) { NGLogicalOffset top_left_offset; NGPhysicalSize child_size = child->PhysicalFragment()->Size(); switch (GetWritingMode()) { @@ -89,7 +89,7 @@ break; } for (const NGOutOfFlowPositionedDescendant& descendant : - ouf_of_flow_descendants) { + out_of_flow_descendants) { oof_positioned_candidates_.push_back( NGOutOfFlowPositionedCandidate{descendant, top_left_offset}); }
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp index 5e08ab03..3e726a9 100644 --- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -866,24 +866,14 @@ } WebString access_control_error_description; - std::unique_ptr<WebCORSPreflightResultCacheItem> preflight_result = - WebCORSPreflightResultCacheItem::Create( - actual_request_.GetFetchCredentialsMode(), - response.HttpHeaderFields(), access_control_error_description); - - if (!preflight_result || - !preflight_result->AllowsCrossOriginMethod( - actual_request_.HttpMethod(), access_control_error_description) || - !preflight_result->AllowsCrossOriginHeaders( + if (!WebCORSPreflightResultCache::Shared().EnsureResultAndMayAppendEntry( + response.HttpHeaderFields(), GetSecurityOrigin()->ToString(), + actual_request_.Url(), actual_request_.HttpMethod(), actual_request_.HttpHeaderFields(), - access_control_error_description)) { + actual_request_.GetFetchCredentialsMode(), + &access_control_error_description)) { HandlePreflightFailure(response.Url(), access_control_error_description); - return; } - - WebCORSPreflightResultCache::Shared().AppendEntry( - GetSecurityOrigin()->ToString(), actual_request_.Url(), - std::move(preflight_result)); } void DocumentThreadableLoader::ReportResponseReceived(
diff --git a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp index ca6dee3..dfba01b6 100644 --- a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp +++ b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
@@ -88,241 +88,289 @@ mutable bool is_cross_origin_ = false; }; -struct PreloadTestParams { - const char* href; - const char* as; - const char* type; - const char* media; - const char* nonce; - const ReferrerPolicy referrer_policy; - const ResourceLoadPriority priority; - const WebURLRequest::RequestContext context; - const char* content_security_policy; - const bool link_loader_should_load_value; - const bool expecting_load; - const ReferrerPolicy expected_referrer_policy; -}; - -class LinkLoaderPreloadTest - : public ::testing::TestWithParam<PreloadTestParams> { +class LinkLoaderPreloadTestBase : public ::testing::Test { public: - ~LinkLoaderPreloadTest() { + struct Expectations { + ResourceLoadPriority priority; + WebURLRequest::RequestContext context; + bool link_loader_should_load_value; + bool expecting_load; + ReferrerPolicy referrer_policy; + }; + + ~LinkLoaderPreloadTestBase() { Platform::Current() ->GetURLLoaderMockFactory() ->UnregisterAllURLsAndClearMemoryCache(); } + + void TestPreload(const LinkLoadParameters& params, + const Expectations& expected, + const char* content_security_policy = nullptr) { + std::unique_ptr<DummyPageHolder> dummy_page_holder = + DummyPageHolder::Create(IntSize(500, 500)); + ResourceFetcher* fetcher = dummy_page_holder->GetDocument().Fetcher(); + if (content_security_policy) { + dummy_page_holder->GetDocument() + .GetContentSecurityPolicy() + ->DidReceiveHeader(content_security_policy, + kContentSecurityPolicyHeaderTypeEnforce, + kContentSecurityPolicyHeaderSourceHTTP); + } + ASSERT_TRUE(fetcher); + dummy_page_holder->GetFrame().GetSettings()->SetScriptEnabled(true); + Persistent<MockLinkLoaderClient> loader_client = + MockLinkLoaderClient::Create(expected.link_loader_should_load_value); + LinkLoader* loader = LinkLoader::Create(loader_client.Get()); + URLTestHelpers::RegisterMockedErrorURLLoad(params.href); + loader->LoadLink(params, dummy_page_holder->GetDocument(), + NetworkHintsMock()); + if (expected.expecting_load && + expected.priority != ResourceLoadPriority::kUnresolved) { + ASSERT_EQ(1, fetcher->CountPreloads()); + Resource* resource = loader->GetResourceForTesting(); + ASSERT_NE(resource, nullptr); + EXPECT_TRUE(fetcher->ContainsAsPreload(resource)); + EXPECT_EQ(expected.priority, resource->GetResourceRequest().Priority()); + EXPECT_EQ(expected.context, + resource->GetResourceRequest().GetRequestContext()); + if (expected.referrer_policy != kReferrerPolicyDefault) { + EXPECT_EQ(expected.referrer_policy, + resource->GetResourceRequest().GetReferrerPolicy()); + } + } else { + ASSERT_EQ(0, fetcher->CountPreloads()); + } + } }; +struct PreloadTestParams { + const char* href; + const char* as; + const ResourceLoadPriority priority; + const WebURLRequest::RequestContext context; + const bool expecting_load; +}; + +constexpr PreloadTestParams kPreloadTestParams[] = { + {"http://example.test/cat.jpg", "image", ResourceLoadPriority::kLow, + WebURLRequest::kRequestContextImage, true}, + {"http://example.test/cat.js", "script", ResourceLoadPriority::kHigh, + WebURLRequest::kRequestContextScript, true}, + {"http://example.test/cat.css", "style", ResourceLoadPriority::kVeryHigh, + WebURLRequest::kRequestContextStyle, true}, + // TODO(yoav): It doesn't seem like the audio context is ever used. That + // should probably be fixed (or we can consolidate audio and video). + {"http://example.test/cat.wav", "audio", ResourceLoadPriority::kLow, + WebURLRequest::kRequestContextAudio, true}, + {"http://example.test/cat.mp4", "video", ResourceLoadPriority::kLow, + WebURLRequest::kRequestContextVideo, true}, + {"http://example.test/cat.vtt", "track", ResourceLoadPriority::kLow, + WebURLRequest::kRequestContextTrack, true}, + {"http://example.test/cat.woff", "font", ResourceLoadPriority::kHigh, + WebURLRequest::kRequestContextFont, true}, + // TODO(yoav): subresource should be *very* low priority (rather than + // low). + {"http://example.test/cat.empty", "fetch", ResourceLoadPriority::kHigh, + WebURLRequest::kRequestContextSubresource, true}, + {"http://example.test/cat.blob", "blabla", ResourceLoadPriority::kLow, + WebURLRequest::kRequestContextSubresource, false}, + {"http://example.test/cat.blob", "", ResourceLoadPriority::kLow, + WebURLRequest::kRequestContextSubresource, false}, + {"bla://example.test/cat.gif", "image", ResourceLoadPriority::kUnresolved, + WebURLRequest::kRequestContextImage, false}}; + +class LinkLoaderPreloadTest + : public LinkLoaderPreloadTestBase, + public ::testing::WithParamInterface<PreloadTestParams> {}; + TEST_P(LinkLoaderPreloadTest, Preload) { const auto& test_case = GetParam(); - std::unique_ptr<DummyPageHolder> dummy_page_holder = - DummyPageHolder::Create(IntSize(500, 500)); - ResourceFetcher* fetcher = dummy_page_holder->GetDocument().Fetcher(); - if (test_case.content_security_policy) { - dummy_page_holder->GetDocument() - .GetContentSecurityPolicy() - ->DidReceiveHeader(test_case.content_security_policy, - kContentSecurityPolicyHeaderTypeEnforce, - kContentSecurityPolicyHeaderSourceHTTP); - } - ASSERT_TRUE(fetcher); - dummy_page_holder->GetFrame().GetSettings()->SetScriptEnabled(true); - Persistent<MockLinkLoaderClient> loader_client = - MockLinkLoaderClient::Create(test_case.link_loader_should_load_value); - LinkLoader* loader = LinkLoader::Create(loader_client.Get()); - KURL href_url = KURL(NullURL(), test_case.href); - URLTestHelpers::RegisterMockedErrorURLLoad(href_url); LinkLoadParameters params( - LinkRelAttribute("preload"), kCrossOriginAttributeNotSet, test_case.type, - test_case.as, test_case.media, test_case.nonce, String() /* integrity */, - test_case.referrer_policy, href_url); - loader->LoadLink(params, dummy_page_holder->GetDocument(), - NetworkHintsMock()); - if (test_case.expecting_load && - test_case.priority != ResourceLoadPriority::kUnresolved) { - ASSERT_EQ(1, fetcher->CountPreloads()); - Resource* resource = loader->GetResourceForTesting(); - ASSERT_NE(resource, nullptr); - EXPECT_TRUE(fetcher->ContainsAsPreload(resource)); - EXPECT_EQ(test_case.priority, resource->GetResourceRequest().Priority()); - EXPECT_EQ(test_case.context, - resource->GetResourceRequest().GetRequestContext()); - if (test_case.expected_referrer_policy != kReferrerPolicyDefault) { - EXPECT_EQ(test_case.expected_referrer_policy, - resource->GetResourceRequest().GetReferrerPolicy()); - } - } else { - ASSERT_EQ(0, fetcher->CountPreloads()); - } + LinkRelAttribute("preload"), kCrossOriginAttributeNotSet, String(), + test_case.as, String(), String(), String(), kReferrerPolicyDefault, + KURL(NullURL(), test_case.href)); + Expectations expectations = { + test_case.priority, test_case.context, test_case.expecting_load, + test_case.expecting_load, kReferrerPolicyDefault}; + TestPreload(params, expectations); } -constexpr PreloadTestParams kPreloadTestParams[] = { - {"http://example.test/cat.jpg", "image", "", "", "", kReferrerPolicyDefault, - ResourceLoadPriority::kLow, WebURLRequest::kRequestContextImage, nullptr, - true, true, kReferrerPolicyDefault}, - {"http://example.test/cat.js", "script", "", "", "", kReferrerPolicyDefault, - ResourceLoadPriority::kHigh, WebURLRequest::kRequestContextScript, nullptr, - true, true, kReferrerPolicyDefault}, - {"http://example.test/cat.css", "style", "", "", "", kReferrerPolicyDefault, - ResourceLoadPriority::kVeryHigh, WebURLRequest::kRequestContextStyle, - nullptr, true, true, kReferrerPolicyDefault}, - // TODO(yoav): It doesn't seem like the audio context is ever used. That - // should probably be fixed (or we can consolidate audio and video). - {"http://example.test/cat.wav", "audio", "", "", "", kReferrerPolicyDefault, - ResourceLoadPriority::kLow, WebURLRequest::kRequestContextAudio, nullptr, - true, true, kReferrerPolicyDefault}, - {"http://example.test/cat.mp4", "video", "", "", "", kReferrerPolicyDefault, - ResourceLoadPriority::kLow, WebURLRequest::kRequestContextVideo, nullptr, - true, true, kReferrerPolicyDefault}, - {"http://example.test/cat.vtt", "track", "", "", "", kReferrerPolicyDefault, - ResourceLoadPriority::kLow, WebURLRequest::kRequestContextTrack, nullptr, - true, true, kReferrerPolicyDefault}, - {"http://example.test/cat.woff", "font", "", "", "", kReferrerPolicyDefault, - ResourceLoadPriority::kHigh, WebURLRequest::kRequestContextFont, nullptr, - true, true, kReferrerPolicyDefault}, - // TODO(yoav): subresource should be *very* low priority (rather than - // low). - {"http://example.test/cat.empty", "fetch", "", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kHigh, - WebURLRequest::kRequestContextSubresource, nullptr, true, true, - kReferrerPolicyDefault}, - {"http://example.test/cat.blob", "blabla", "", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextSubresource, nullptr, false, false, - kReferrerPolicyDefault}, - {"http://example.test/cat.blob", "", "", "", "", kReferrerPolicyDefault, - ResourceLoadPriority::kLow, WebURLRequest::kRequestContextSubresource, - nullptr, false, false, kReferrerPolicyDefault}, - {"bla://example.test/cat.gif", "image", "", "", "", kReferrerPolicyDefault, - ResourceLoadPriority::kUnresolved, WebURLRequest::kRequestContextImage, - nullptr, false, false, kReferrerPolicyDefault}, - // MIME type tests - {"http://example.test/cat.webp", "image", "image/webp", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextImage, nullptr, true, true, - kReferrerPolicyDefault}, - {"http://example.test/cat.svg", "image", "image/svg+xml", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextImage, nullptr, true, true, - kReferrerPolicyDefault}, - {"http://example.test/cat.jxr", "image", "image/jxr", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kUnresolved, - WebURLRequest::kRequestContextImage, nullptr, false, false, - kReferrerPolicyDefault}, - {"http://example.test/cat.js", "script", "text/javascript", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kHigh, - WebURLRequest::kRequestContextScript, nullptr, true, true, - kReferrerPolicyDefault}, - {"http://example.test/cat.js", "script", "text/coffeescript", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kUnresolved, - WebURLRequest::kRequestContextScript, nullptr, false, false, - kReferrerPolicyDefault}, - {"http://example.test/cat.css", "style", "text/css", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kVeryHigh, - WebURLRequest::kRequestContextStyle, nullptr, true, true, - kReferrerPolicyDefault}, - {"http://example.test/cat.css", "style", "text/sass", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kUnresolved, - WebURLRequest::kRequestContextStyle, nullptr, false, false, - kReferrerPolicyDefault}, - {"http://example.test/cat.wav", "audio", "audio/wav", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextAudio, nullptr, true, true, - kReferrerPolicyDefault}, - {"http://example.test/cat.wav", "audio", "audio/mp57", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kUnresolved, - WebURLRequest::kRequestContextAudio, nullptr, false, false, - kReferrerPolicyDefault}, - {"http://example.test/cat.webm", "video", "video/webm", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextVideo, nullptr, true, true, - kReferrerPolicyDefault}, - {"http://example.test/cat.mp199", "video", "video/mp199", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kUnresolved, - WebURLRequest::kRequestContextVideo, nullptr, false, false, - kReferrerPolicyDefault}, - {"http://example.test/cat.vtt", "track", "text/vtt", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextTrack, nullptr, true, true, - kReferrerPolicyDefault}, - {"http://example.test/cat.vtt", "track", "text/subtitlething", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kUnresolved, - WebURLRequest::kRequestContextTrack, nullptr, false, false, - kReferrerPolicyDefault}, - {"http://example.test/cat.woff", "font", "font/woff2", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kHigh, - WebURLRequest::kRequestContextFont, nullptr, true, true, - kReferrerPolicyDefault}, - {"http://example.test/cat.woff", "font", "font/woff84", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kUnresolved, - WebURLRequest::kRequestContextFont, nullptr, false, false, - kReferrerPolicyDefault}, - {"http://example.test/cat.empty", "fetch", "foo/bar", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kHigh, - WebURLRequest::kRequestContextSubresource, nullptr, true, true, - kReferrerPolicyDefault}, - {"http://example.test/cat.blob", "blabla", "foo/bar", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextSubresource, nullptr, false, false, - kReferrerPolicyDefault}, - {"http://example.test/cat.blob", "", "foo/bar", "", "", - kReferrerPolicyDefault, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextSubresource, nullptr, false, false, - kReferrerPolicyDefault}, - // Media tests - {"http://example.test/cat.gif", "image", "image/gif", "(max-width: 600px)", - "", kReferrerPolicyDefault, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextImage, nullptr, true, true, - kReferrerPolicyDefault}, - {"http://example.test/cat.gif", "image", "image/gif", "(max-width: 400px)", - "", kReferrerPolicyDefault, ResourceLoadPriority::kUnresolved, - WebURLRequest::kRequestContextImage, nullptr, true, false, - kReferrerPolicyDefault}, - {"http://example.test/cat.gif", "image", "image/gif", "(max-width: 600px)", - "", kReferrerPolicyDefault, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextImage, nullptr, false, false, - kReferrerPolicyDefault}, - // Referrer Policy - {"http://example.test/cat.gif", "image", "image/gif", "", "", - kReferrerPolicyOrigin, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextImage, nullptr, true, true, - kReferrerPolicyOrigin}, - {"http://example.test/cat.gif", "image", "image/gif", "", "", - kReferrerPolicyOriginWhenCrossOrigin, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextImage, nullptr, true, true, - kReferrerPolicyOriginWhenCrossOrigin}, - {"http://example.test/cat.gif", "image", "image/gif", "", "", - kReferrerPolicySameOrigin, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextImage, nullptr, true, true, - kReferrerPolicySameOrigin}, - {"http://example.test/cat.gif", "image", "image/gif", "", "", - kReferrerPolicyStrictOrigin, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextImage, nullptr, true, true, - kReferrerPolicyStrictOrigin}, - {"http://example.test/cat.gif", "image", "image/gif", "", "", - kReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin, - ResourceLoadPriority::kLow, WebURLRequest::kRequestContextImage, nullptr, - true, true, kReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin}, - {"http://example.test/cat.gif", "image", "image/gif", "", "", - kReferrerPolicyNever, ResourceLoadPriority::kLow, - WebURLRequest::kRequestContextImage, nullptr, true, true, - kReferrerPolicyNever}, - {"http://example.test/cat.js", "script", "", "", "abc", - kReferrerPolicyDefault, ResourceLoadPriority::kHigh, - WebURLRequest::kRequestContextScript, "script-src 'nonce-abc'", true, true, - kReferrerPolicyDefault}, - {"http://example.test/cat.js", "script", "", "", "", kReferrerPolicyDefault, - ResourceLoadPriority::kHigh, WebURLRequest::kRequestContextScript, - "script-src 'nonce-abc'", false, false, kReferrerPolicyDefault}, - {"http://example.test/cat.js", "script", "", "", "def", - kReferrerPolicyDefault, ResourceLoadPriority::kHigh, - WebURLRequest::kRequestContextScript, "script-src 'nonce-abc'", false, - false, kReferrerPolicyDefault}}; - INSTANTIATE_TEST_CASE_P(LinkLoaderPreloadTest, LinkLoaderPreloadTest, ::testing::ValuesIn(kPreloadTestParams)); +struct PreloadMimeTypeTestParams { + const char* href; + const char* as; + const char* type; + const ResourceLoadPriority priority; + const WebURLRequest::RequestContext context; + const bool expecting_load; +}; + +constexpr PreloadMimeTypeTestParams kPreloadMimeTypeTestParams[] = { + {"http://example.test/cat.webp", "image", "image/webp", + ResourceLoadPriority::kLow, WebURLRequest::kRequestContextImage, true}, + {"http://example.test/cat.svg", "image", "image/svg+xml", + ResourceLoadPriority::kLow, WebURLRequest::kRequestContextImage, true}, + {"http://example.test/cat.jxr", "image", "image/jxr", + ResourceLoadPriority::kUnresolved, WebURLRequest::kRequestContextImage, + false}, + {"http://example.test/cat.js", "script", "text/javascript", + ResourceLoadPriority::kHigh, WebURLRequest::kRequestContextScript, true}, + {"http://example.test/cat.js", "script", "text/coffeescript", + ResourceLoadPriority::kUnresolved, WebURLRequest::kRequestContextScript, + false}, + {"http://example.test/cat.css", "style", "text/css", + ResourceLoadPriority::kVeryHigh, WebURLRequest::kRequestContextStyle, + true}, + {"http://example.test/cat.css", "style", "text/sass", + ResourceLoadPriority::kUnresolved, WebURLRequest::kRequestContextStyle, + false}, + {"http://example.test/cat.wav", "audio", "audio/wav", + ResourceLoadPriority::kLow, WebURLRequest::kRequestContextAudio, true}, + {"http://example.test/cat.wav", "audio", "audio/mp57", + ResourceLoadPriority::kUnresolved, WebURLRequest::kRequestContextAudio, + false}, + {"http://example.test/cat.webm", "video", "video/webm", + ResourceLoadPriority::kLow, WebURLRequest::kRequestContextVideo, true}, + {"http://example.test/cat.mp199", "video", "video/mp199", + ResourceLoadPriority::kUnresolved, WebURLRequest::kRequestContextVideo, + false}, + {"http://example.test/cat.vtt", "track", "text/vtt", + ResourceLoadPriority::kLow, WebURLRequest::kRequestContextTrack, true}, + {"http://example.test/cat.vtt", "track", "text/subtitlething", + ResourceLoadPriority::kUnresolved, WebURLRequest::kRequestContextTrack, + false}, + {"http://example.test/cat.woff", "font", "font/woff2", + ResourceLoadPriority::kHigh, WebURLRequest::kRequestContextFont, true}, + {"http://example.test/cat.woff", "font", "font/woff84", + ResourceLoadPriority::kUnresolved, WebURLRequest::kRequestContextFont, + false}, + {"http://example.test/cat.empty", "fetch", "foo/bar", + ResourceLoadPriority::kHigh, WebURLRequest::kRequestContextSubresource, + true}, + {"http://example.test/cat.blob", "blabla", "foo/bar", + ResourceLoadPriority::kLow, WebURLRequest::kRequestContextSubresource, + false}, + {"http://example.test/cat.blob", "", "foo/bar", ResourceLoadPriority::kLow, + WebURLRequest::kRequestContextSubresource, false}}; + +class LinkLoaderPreloadMimeTypeTest + : public LinkLoaderPreloadTestBase, + public ::testing::WithParamInterface<PreloadMimeTypeTestParams> {}; + +TEST_P(LinkLoaderPreloadMimeTypeTest, Preload) { + const auto& test_case = GetParam(); + LinkLoadParameters params( + LinkRelAttribute("preload"), kCrossOriginAttributeNotSet, test_case.type, + test_case.as, String(), String(), String(), kReferrerPolicyDefault, + KURL(NullURL(), test_case.href)); + Expectations expectations = { + test_case.priority, test_case.context, test_case.expecting_load, + test_case.expecting_load, kReferrerPolicyDefault}; + TestPreload(params, expectations); +} + +INSTANTIATE_TEST_CASE_P(LinkLoaderPreloadMimeTypeTest, + LinkLoaderPreloadMimeTypeTest, + ::testing::ValuesIn(kPreloadMimeTypeTestParams)); + +struct PreloadMediaTestParams { + const char* media; + const ResourceLoadPriority priority; + const bool link_loader_should_load_value; + const bool expecting_load; +}; + +constexpr PreloadMediaTestParams kPreloadMediaTestParams[] = { + {"(max-width: 600px)", ResourceLoadPriority::kLow, true, true}, + {"(max-width: 400px)", ResourceLoadPriority::kUnresolved, true, false}, + {"(max-width: 600px)", ResourceLoadPriority::kLow, false, false}}; + +class LinkLoaderPreloadMediaTest + : public LinkLoaderPreloadTestBase, + public ::testing::WithParamInterface<PreloadMediaTestParams> {}; + +TEST_P(LinkLoaderPreloadMediaTest, Preload) { + const auto& test_case = GetParam(); + LinkLoadParameters params( + LinkRelAttribute("preload"), kCrossOriginAttributeNotSet, "image/gif", + "image", test_case.media, String(), String(), kReferrerPolicyDefault, + KURL(NullURL(), "http://example.test/cat.gif")); + Expectations expectations = { + test_case.priority, WebURLRequest::kRequestContextImage, + test_case.link_loader_should_load_value, test_case.expecting_load, + kReferrerPolicyDefault}; + TestPreload(params, expectations); +} + +INSTANTIATE_TEST_CASE_P(LinkLoaderPreloadMediaTest, + LinkLoaderPreloadMediaTest, + ::testing::ValuesIn(kPreloadMediaTestParams)); + +constexpr ReferrerPolicy kPreloadReferrerPolicyTestParams[] = { + kReferrerPolicyOrigin, + kReferrerPolicyOriginWhenCrossOrigin, + kReferrerPolicySameOrigin, + kReferrerPolicyStrictOrigin, + kReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin, + kReferrerPolicyNever}; + +class LinkLoaderPreloadReferrerPolicyTest + : public LinkLoaderPreloadTestBase, + public ::testing::WithParamInterface<ReferrerPolicy> {}; + +TEST_P(LinkLoaderPreloadReferrerPolicyTest, Preload) { + const ReferrerPolicy referrer_policy = GetParam(); + LinkLoadParameters params(LinkRelAttribute("preload"), + kCrossOriginAttributeNotSet, "image/gif", "image", + String(), String(), String(), referrer_policy, + KURL(NullURL(), "http://example.test/cat.gif")); + Expectations expectations = {ResourceLoadPriority::kLow, + WebURLRequest::kRequestContextImage, true, true, + referrer_policy}; + TestPreload(params, expectations); +} + +INSTANTIATE_TEST_CASE_P(LinkLoaderPreloadReferrerPolicyTest, + LinkLoaderPreloadReferrerPolicyTest, + ::testing::ValuesIn(kPreloadReferrerPolicyTestParams)); + +struct PreloadNonceTestParams { + const char* nonce; + const char* content_security_policy; + const bool expecting_load; +}; + +constexpr PreloadNonceTestParams kPreloadNonceTestParams[] = { + {"abc", "script-src 'nonce-abc'", true}, + {"", "script-src 'nonce-abc'", false}, + {"def", "script-src 'nonce-abc'", false}, +}; + +class LinkLoaderPreloadNonceTest + : public LinkLoaderPreloadTestBase, + public ::testing::WithParamInterface<PreloadNonceTestParams> {}; + +TEST_P(LinkLoaderPreloadNonceTest, Preload) { + const auto& test_case = GetParam(); + LinkLoadParameters params( + LinkRelAttribute("preload"), kCrossOriginAttributeNotSet, String(), + "script", String(), test_case.nonce, String(), kReferrerPolicyDefault, + KURL(NullURL(), "http://example.test/cat.js")); + Expectations expectations = { + ResourceLoadPriority::kHigh, WebURLRequest::kRequestContextScript, + test_case.expecting_load, test_case.expecting_load, + kReferrerPolicyDefault}; + TestPreload(params, expectations, test_case.content_security_policy); +} + +INSTANTIATE_TEST_CASE_P(LinkLoaderPreloadNonceTest, + LinkLoaderPreloadNonceTest, + ::testing::ValuesIn(kPreloadNonceTestParams)); + struct ModulePreloadTestParams { const char* href; const char* nonce;
diff --git a/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp b/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp index b648e43d..8cbb0252 100644 --- a/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp +++ b/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp
@@ -374,6 +374,9 @@ if (!ErrorOccurred()) SetStatus(ResourceStatus::kDecodeError); + if (multipart_parser_) + multipart_parser_->Cancel(); + bool is_multipart = !!multipart_parser_; // Finishes loading if needed, and notifies observers. if (!all_data_received && Loader()) { @@ -405,7 +408,8 @@ void ImageResource::Finish(double load_finish_time, base::SingleThreadTaskRunner* task_runner) { if (multipart_parser_) { - multipart_parser_->Finish(); + if (!ErrorOccurred()) + multipart_parser_->Finish(); if (Data()) UpdateImageAndClearBuffer(); } else {
diff --git a/third_party/WebKit/Source/core/page/FocusController.cpp b/third_party/WebKit/Source/core/page/FocusController.cpp index 9df1ee1..5393cfe 100644 --- a/third_party/WebKit/Source/core/page/FocusController.cpp +++ b/third_party/WebKit/Source/core/page/FocusController.cpp
@@ -303,7 +303,8 @@ const Element& element, FocusController::OwnerMap& owner_map) { DCHECK(IsShadowHost(element)); - return ScopedFocusNavigation(*element.GetShadowRoot(), nullptr, owner_map); + return ScopedFocusNavigation(element.Shadow()->GetShadowRoot(), nullptr, + owner_map); } ScopedFocusNavigation ScopedFocusNavigation::OwnedByIFrame(
diff --git a/third_party/WebKit/Source/core/page/FrameTree.cpp b/third_party/WebKit/Source/core/page/FrameTree.cpp index 348ac7c..d95a45adb 100644 --- a/third_party/WebKit/Source/core/page/FrameTree.cpp +++ b/third_party/WebKit/Source/core/page/FrameTree.cpp
@@ -139,6 +139,9 @@ } Frame* FrameTree::ScopedChild(const AtomicString& name) const { + if (name.IsEmpty()) + return nullptr; + for (Frame* child = FirstChild(); child; child = child->Tree().NextSibling()) { if (child->Client()->InShadowTree())
diff --git a/third_party/WebKit/Source/core/page/FrameTree.h b/third_party/WebKit/Source/core/page/FrameTree.h index db84875b..26d9adf 100644 --- a/third_party/WebKit/Source/core/page/FrameTree.h +++ b/third_party/WebKit/Source/core/page/FrameTree.h
@@ -62,6 +62,11 @@ unsigned ChildCount() const; Frame* ScopedChild(unsigned index) const; + // https://whatwg.org/C/window-object.html#named-access-on-the-window-object + // This implements the steps needed for looking up a child browsing context + // that matches |name|. If |name.IsEmpty()| is true, this is guaranteed to + // return null: the spec specifically states that browsing contexts with a + // name are never considered. Frame* ScopedChild(const AtomicString& name) const; unsigned ScopedChildCount() const; void InvalidateScopedChildCount();
diff --git a/third_party/WebKit/Source/core/resize_observer/ResizeObserver.cpp b/third_party/WebKit/Source/core/resize_observer/ResizeObserver.cpp index 6192f70..21edad4 100644 --- a/third_party/WebKit/Source/core/resize_observer/ResizeObserver.cpp +++ b/third_party/WebKit/Source/core/resize_observer/ResizeObserver.cpp
@@ -63,6 +63,10 @@ auto observation = observer_map->find(this); if (observation != observer_map->end()) { observations_.erase((*observation).value); + auto index = active_observations_.Find((*observation).value); + if (index != kNotFound) { + active_observations_.EraseAt(index); + } observer_map->erase(observation); } } @@ -103,7 +107,7 @@ // We can only clear this flag after all observations have been // broadcast. element_size_changed_ = skipped_observations_; - if (active_observations_.size() == 0) + if (active_observations_.IsEmpty()) return; HeapVector<Member<ResizeObserverEntry>> entries;
diff --git a/third_party/WebKit/Source/core/resize_observer/ResizeObserver.h b/third_party/WebKit/Source/core/resize_observer/ResizeObserver.h index 5b81677..601eb022 100644 --- a/third_party/WebKit/Source/core/resize_observer/ResizeObserver.h +++ b/third_party/WebKit/Source/core/resize_observer/ResizeObserver.h
@@ -65,7 +65,9 @@ const TraceWrapperMember<V8ResizeObserverCallback> callback_; const Member<Delegate> delegate_; - // List of elements we are observing + // List of Elements we are observing. These Elements make the ResizeObserver + // and most-importantly |callback_| alive. If |observations_| is empty, no one + // is performing wrapper-tracing and |callback_| might already be gone. ObservationList observations_; // List of elements that have changes HeapVector<Member<ResizeObservation>> active_observations_;
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp index 5f3d1c59..d245ccb9 100644 --- a/third_party/WebKit/Source/core/testing/Internals.cpp +++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -764,7 +764,9 @@ ShadowRoot* Internals::shadowRoot(Element* host) { DCHECK(host); - return host->GetShadowRoot(); + if (ElementShadow* shadow = host->Shadow()) + return &shadow->GetShadowRoot(); + return nullptr; } String Internals::shadowRootType(const Node* root,
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp index 067241a..a9f4ad0 100644 --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp +++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -89,7 +89,7 @@ #include "platform/wtf/text/CString.h" #include "public/platform/WebCORS.h" #include "public/platform/WebURLRequest.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom-blink.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom-blink.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp index 8b042ff..1b6650a 100644 --- a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp +++ b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp
@@ -8,6 +8,7 @@ #include "core/dom/AXObjectCache.h" #include "core/dom/DOMNodeIds.h" #include "core/dom/Element.h" +#include "core/dom/ElementShadow.h" #include "core/dom/FlatTreeTraversal.h" #include "core/dom/Node.h" #include "core/dom/NodeList.h"
diff --git a/third_party/WebKit/Source/modules/clipboard/ClipboardPromise.h b/third_party/WebKit/Source/modules/clipboard/ClipboardPromise.h index cb82833..7392e4d6 100644 --- a/third_party/WebKit/Source/modules/clipboard/ClipboardPromise.h +++ b/third_party/WebKit/Source/modules/clipboard/ClipboardPromise.h
@@ -9,7 +9,7 @@ #include "core/CoreExport.h" #include "core/dom/ContextLifecycleObserver.h" #include "public/platform/modules/permissions/permission.mojom-blink.h" -#include "third_party/WebKit/common/clipboard/clipboard.mojom-blink.h" +#include "third_party/WebKit/public/mojom/clipboard/clipboard.mojom-blink.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp index f12992ab..5a53c88 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp
@@ -32,7 +32,7 @@ #include "public/platform/WebMediaKeySystemConfiguration.h" #include "public/platform/WebMediaKeySystemMediaCapability.h" #include "public/platform/WebVector.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom-blink.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom-blink.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/geolocation/Geolocation.cpp b/third_party/WebKit/Source/modules/geolocation/Geolocation.cpp index 9f29726a..44e1b92 100644 --- a/third_party/WebKit/Source/modules/geolocation/Geolocation.cpp +++ b/third_party/WebKit/Source/modules/geolocation/Geolocation.cpp
@@ -41,7 +41,7 @@ #include "platform/wtf/Time.h" #include "public/platform/Platform.h" #include "services/service_manager/public/cpp/interface_provider.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom-blink.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom-blink.h" namespace blink { namespace {
diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayPlayButtonElement.cpp b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayPlayButtonElement.cpp index ceda437..9093c1b9 100644 --- a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayPlayButtonElement.cpp +++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayPlayButtonElement.cpp
@@ -5,7 +5,6 @@ #include "modules/media_controls/elements/MediaControlOverlayPlayButtonElement.h" #include "core/dom/ElementShadow.h" -#include "core/dom/ShadowRoot.h" #include "core/dom/events/Event.h" #include "core/events/MouseEvent.h" #include "core/geometry/DOMRect.h" @@ -117,7 +116,7 @@ SetShadowPseudoId(AtomicString("-webkit-media-controls-overlay-play-button")); if (MediaControlsImpl::IsModern()) { - ShadowRoot* shadow_root = GetShadowRoot(); + ShadowRoot& shadow_root = Shadow()->GetShadowRoot(); // This stylesheet element and will contain rules that are specific to the // loading panel. The shadow DOM protects these rules from the parent DOM @@ -125,16 +124,16 @@ auto* style = HTMLStyleElement::Create(GetDocument(), CreateElementFlags()); style->setTextContent( MediaControlsResourceLoader::GetOverlayPlayStyleSheet()); - shadow_root->AppendChild(style); + shadow_root.AppendChild(style); left_jump_arrow_ = new MediaControlOverlayPlayButtonElement::AnimatedArrow( - "left-arrow", *shadow_root); + "left-arrow", shadow_root); internal_button_ = MediaControlElementsHelper::CreateDiv( - "-internal-media-controls-overlay-play-button-internal", shadow_root); + "-internal-media-controls-overlay-play-button-internal", &shadow_root); right_jump_arrow_ = new MediaControlOverlayPlayButtonElement::AnimatedArrow( - "right-arrow", *shadow_root); + "right-arrow", shadow_root); } }
diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlSliderElement.cpp b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlSliderElement.cpp index 77a2e28..0985994d 100644 --- a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlSliderElement.cpp +++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlSliderElement.cpp
@@ -86,7 +86,8 @@ // #shadow-root // - div // - div::-webkit-slider-runnable-track#track - Element* track = GetShadowRoot()->getElementById(AtomicString("track")); + ShadowRoot& shadow_root = Shadow()->GetShadowRoot(); + Element* track = shadow_root.getElementById(AtomicString("track")); DCHECK(track); return *track; }
diff --git a/third_party/WebKit/Source/modules/mediastream/UserMediaRequest.cpp b/third_party/WebKit/Source/modules/mediastream/UserMediaRequest.cpp index f30bd51e3..bbef9d7 100644 --- a/third_party/WebKit/Source/modules/mediastream/UserMediaRequest.cpp +++ b/third_party/WebKit/Source/modules/mediastream/UserMediaRequest.cpp
@@ -51,7 +51,7 @@ #include "modules/mediastream/UserMediaController.h" #include "platform/mediastream/MediaStreamCenter.h" #include "platform/mediastream/MediaStreamDescriptor.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom-blink.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom-blink.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.cpp b/third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.cpp index 189b5471..4f2e5a14 100644 --- a/third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.cpp +++ b/third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.cpp
@@ -42,7 +42,7 @@ #include "core/inspector/ConsoleMessage.h" #include "modules/webmidi/MIDIAccessInitializer.h" #include "modules/webmidi/MIDIOptions.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom-blink.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom-blink.h" namespace blink { namespace {
diff --git a/third_party/WebKit/Source/platform/Timer.h b/third_party/WebKit/Source/platform/Timer.h index ff0d9c3..438b7cb 100644 --- a/third_party/WebKit/Source/platform/Timer.h +++ b/third_party/WebKit/Source/platform/Timer.h
@@ -178,23 +178,6 @@ TimerFiredFunction function_; }; -// TODO(dcheng): Consider removing this overload once all timers are using the -// appropriate task runner. https://crbug.com/624694 -template <typename TimerFiredClass> -class Timer : public TaskRunnerTimer<TimerFiredClass> { - public: - using TimerFiredFunction = - typename TaskRunnerTimer<TimerFiredClass>::TimerFiredFunction; - - ~Timer() override = default; - - Timer(TimerFiredClass* timer_fired_class, - TimerFiredFunction timer_fired_function) - : TaskRunnerTimer<TimerFiredClass>(TimerBase::GetTimerTaskRunner(), - timer_fired_class, - timer_fired_function) {} -}; - NO_SANITIZE_ADDRESS inline bool TimerBase::IsActive() const { #if DCHECK_IS_ON()
diff --git a/third_party/WebKit/Source/platform/TimerTest.cpp b/third_party/WebKit/Source/platform/TimerTest.cpp index 7c237e3..ea160cc 100644 --- a/third_party/WebKit/Source/platform/TimerTest.cpp +++ b/third_party/WebKit/Source/platform/TimerTest.cpp
@@ -56,12 +56,12 @@ bool TimeTillNextDelayedTask(double* time) const { base::TimeTicks next_run_time; if (!platform_->GetRendererScheduler() - ->TimerTaskQueue() + ->DefaultTaskQueue() ->GetTimeDomain() ->NextScheduledRunTime(&next_run_time)) return false; *time = (next_run_time - platform_->GetRendererScheduler() - ->TimerTaskQueue() + ->DefaultTaskQueue() ->GetTimeDomain() ->Now()) .InSecondsF(); @@ -74,6 +74,8 @@ WTF::Vector<double> next_fire_times_; ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler> platform_; + + base::MessageLoop message_loop_; }; class OnHeapTimerOwner final @@ -98,8 +100,11 @@ bool owner_is_destructed_ = false; }; - explicit OnHeapTimerOwner(scoped_refptr<Record> record) - : timer_(this, &OnHeapTimerOwner::Fired), record_(std::move(record)) {} + explicit OnHeapTimerOwner( + scoped_refptr<Record> record, + scoped_refptr<base::SingleThreadTaskRunner> task_runner) + : timer_(std::move(task_runner), this, &OnHeapTimerOwner::Fired), + record_(std::move(record)) {} ~OnHeapTimerOwner() { record_->SetOwnerIsDestructed(); } void StartOneShot(TimeDelta interval, const base::Location& caller) { @@ -114,7 +119,7 @@ record_->SetTimerHasFired(); } - Timer<OnHeapTimerOwner> timer_; + TaskRunnerTimer<OnHeapTimerOwner> timer_; scoped_refptr<Record> record_; }; @@ -126,7 +131,9 @@ }; TEST_F(TimerTest, StartOneShot_Zero) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta(), FROM_HERE); double run_time; @@ -137,7 +144,9 @@ } TEST_F(TimerTest, StartOneShot_ZeroAndCancel) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta(), FROM_HERE); double run_time; @@ -150,7 +159,9 @@ } TEST_F(TimerTest, StartOneShot_ZeroAndCancelThenRepost) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta(), FROM_HERE); double run_time; @@ -170,7 +181,9 @@ } TEST_F(TimerTest, StartOneShot_Zero_RepostingAfterRunning) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta(), FROM_HERE); double run_time; @@ -188,7 +201,9 @@ } TEST_F(TimerTest, StartOneShot_NonZero) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); double run_time; @@ -200,7 +215,9 @@ } TEST_F(TimerTest, StartOneShot_NonZeroAndCancel) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); double run_time; @@ -215,7 +232,9 @@ } TEST_F(TimerTest, StartOneShot_NonZeroAndCancelThenRepost) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); double run_time; @@ -239,7 +258,9 @@ } TEST_F(TimerTest, StartOneShot_NonZero_RepostingAfterRunning) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); double run_time; @@ -259,7 +280,9 @@ } TEST_F(TimerTest, PostingTimerTwiceWithSameRunTimeDoesNothing) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); timer.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); @@ -272,7 +295,9 @@ } TEST_F(TimerTest, PostingTimerTwiceWithNewerRunTimeCancelsOriginalTask) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); timer.StartOneShot(TimeDelta(), FROM_HERE); @@ -281,7 +306,9 @@ } TEST_F(TimerTest, PostingTimerTwiceWithLaterRunTimeCancelsOriginalTask) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta(), FROM_HERE); timer.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); @@ -290,7 +317,9 @@ } TEST_F(TimerTest, StartRepeatingTask) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartRepeating(TimeDelta::FromSeconds(1), FROM_HERE); double run_time; @@ -304,7 +333,9 @@ } TEST_F(TimerTest, StartRepeatingTask_ThenCancel) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartRepeating(TimeDelta::FromSeconds(1), FROM_HERE); double run_time; @@ -321,7 +352,9 @@ } TEST_F(TimerTest, StartRepeatingTask_ThenPostOneShot) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartRepeating(TimeDelta::FromSeconds(1), FROM_HERE); double run_time; @@ -339,34 +372,44 @@ } TEST_F(TimerTest, IsActive_NeverPosted) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); EXPECT_FALSE(timer.IsActive()); } TEST_F(TimerTest, IsActive_AfterPosting_OneShotZero) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta(), FROM_HERE); EXPECT_TRUE(timer.IsActive()); } TEST_F(TimerTest, IsActive_AfterPosting_OneShotNonZero) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); EXPECT_TRUE(timer.IsActive()); } TEST_F(TimerTest, IsActive_AfterPosting_Repeating) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartRepeating(TimeDelta::FromSeconds(1), FROM_HERE); EXPECT_TRUE(timer.IsActive()); } TEST_F(TimerTest, IsActive_AfterRunning_OneShotZero) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta(), FROM_HERE); platform_->RunUntilIdle(); @@ -374,7 +417,9 @@ } TEST_F(TimerTest, IsActive_AfterRunning_OneShotNonZero) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); platform_->RunUntilIdle(); @@ -382,7 +427,9 @@ } TEST_F(TimerTest, IsActive_AfterRunning_Repeating) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartRepeating(TimeDelta::FromSeconds(1), FROM_HERE); RunUntilDeadline(start_time_ + 10); @@ -390,14 +437,18 @@ } TEST_F(TimerTest, NextFireInterval_OneShotZero) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta(), FROM_HERE); EXPECT_FLOAT_EQ(0.0, timer.NextFireInterval()); } TEST_F(TimerTest, NextFireInterval_OneShotNonZero) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); EXPECT_FLOAT_EQ(10.0, timer.NextFireInterval()); @@ -406,7 +457,9 @@ TEST_F(TimerTest, NextFireInterval_OneShotNonZero_AfterAFewSeconds) { platform_->SetAutoAdvanceNowToPendingTasks(false); - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); platform_->AdvanceClockSeconds(2.0); @@ -414,41 +467,53 @@ } TEST_F(TimerTest, NextFireInterval_Repeating) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartRepeating(TimeDelta::FromSeconds(20), FROM_HERE); EXPECT_FLOAT_EQ(20.0, timer.NextFireInterval()); } TEST_F(TimerTest, RepeatInterval_NeverStarted) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); EXPECT_FLOAT_EQ(0.0, timer.RepeatInterval()); } TEST_F(TimerTest, RepeatInterval_OneShotZero) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta(), FROM_HERE); EXPECT_FLOAT_EQ(0.0, timer.RepeatInterval()); } TEST_F(TimerTest, RepeatInterval_OneShotNonZero) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); EXPECT_FLOAT_EQ(0.0, timer.RepeatInterval()); } TEST_F(TimerTest, RepeatInterval_Repeating) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartRepeating(TimeDelta::FromSeconds(20), FROM_HERE); EXPECT_FLOAT_EQ(20.0, timer.RepeatInterval()); } TEST_F(TimerTest, AugmentRepeatInterval) { - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartRepeating(TimeDelta::FromSeconds(10), FROM_HERE); EXPECT_FLOAT_EQ(10.0, timer.RepeatInterval()); EXPECT_FLOAT_EQ(10.0, timer.NextFireInterval()); @@ -470,7 +535,9 @@ TEST_F(TimerTest, AugmentRepeatInterval_TimerFireDelayed) { platform_->SetAutoAdvanceNowToPendingTasks(false); - Timer<TimerTest> timer(this, &TimerTest::CountingTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::CountingTask); timer.StartRepeating(TimeDelta::FromSeconds(10), FROM_HERE); EXPECT_FLOAT_EQ(10.0, timer.RepeatInterval()); EXPECT_FLOAT_EQ(10.0, timer.NextFireInterval()); @@ -486,7 +553,9 @@ TEST_F(TimerTest, RepeatingTimerDoesNotDrift) { platform_->SetAutoAdvanceNowToPendingTasks(false); - Timer<TimerTest> timer(this, &TimerTest::RecordNextFireTimeTask); + TaskRunnerTimer<TimerTest> timer( + platform_->GetRendererScheduler()->DefaultTaskQueue(), this, + &TimerTest::RecordNextFireTimeTask); timer.StartRepeating(TimeDelta::FromSeconds(2), FROM_HERE); RecordNextFireTimeTask( @@ -553,7 +622,8 @@ TEST_F(TimerTest, RunOnHeapTimer) { scoped_refptr<OnHeapTimerOwner::Record> record = OnHeapTimerOwner::Record::Create(); - Persistent<OnHeapTimerOwner> owner = new OnHeapTimerOwner(record); + Persistent<OnHeapTimerOwner> owner = new OnHeapTimerOwner( + record, platform_->GetRendererScheduler()->DefaultTaskQueue()); owner->StartOneShot(TimeDelta(), FROM_HERE); @@ -565,7 +635,8 @@ TEST_F(TimerTest, DestructOnHeapTimer) { scoped_refptr<OnHeapTimerOwner::Record> record = OnHeapTimerOwner::Record::Create(); - Persistent<OnHeapTimerOwner> owner = new OnHeapTimerOwner(record); + Persistent<OnHeapTimerOwner> owner = new OnHeapTimerOwner( + record, platform_->GetRendererScheduler()->DefaultTaskQueue()); record->Dispose(); owner->StartOneShot(TimeDelta(), FROM_HERE); @@ -584,7 +655,8 @@ TEST_F(TimerTest, MarkOnHeapTimerAsUnreachable) { scoped_refptr<OnHeapTimerOwner::Record> record = OnHeapTimerOwner::Record::Create(); - Persistent<OnHeapTimerOwner> owner = new OnHeapTimerOwner(record); + Persistent<OnHeapTimerOwner> owner = new OnHeapTimerOwner( + record, platform_->GetRendererScheduler()->DefaultTaskQueue()); record->Dispose(); owner->StartOneShot(TimeDelta(), FROM_HERE);
diff --git a/third_party/WebKit/Source/platform/exported/WebCORSPreflightResultCache.cpp b/third_party/WebKit/Source/platform/exported/WebCORSPreflightResultCache.cpp index 07ab2118..37ef62e 100644 --- a/third_party/WebKit/Source/platform/exported/WebCORSPreflightResultCache.cpp +++ b/third_party/WebKit/Source/platform/exported/WebCORSPreflightResultCache.cpp
@@ -29,7 +29,9 @@ #include <memory> #include "base/time/default_tick_clock.h" #include "base/time/tick_clock.h" +#include "net/http/http_request_headers.h" #include "platform/loader/cors/CORS.h" +#include "platform/loader/cors/CORSErrorString.h" #include "platform/loader/fetch/FetchUtils.h" #include "platform/loader/fetch/ResourceResponse.h" #include "platform/network/http_names.h" @@ -42,189 +44,35 @@ namespace { -// These values are at the discretion of the user agent. +base::Optional<std::string> GetOptionalHeaderValue( + const WebHTTPHeaderMap& header_map, + const AtomicString& header_name) { + const AtomicString& result = header_map.Get(header_name); + if (result.IsNull()) + return base::nullopt; -constexpr TimeDelta kDefaultPreflightCacheTimeout = TimeDelta::FromSeconds(5); - -// Should be short enough to minimize the risk of using a poisoned cache after -// switching to a secure network. -constexpr TimeDelta kMaxPreflightCacheTimeout = TimeDelta::FromSeconds(600); - -bool ParseAccessControlMaxAge(const String& string, TimeDelta& expiry_delta) { - // FIXME: this will not do the correct thing for a number starting with a '+' - bool ok = false; - expiry_delta = TimeDelta::FromSeconds(string.ToUIntStrict(&ok)); - return ok; + return std::string(result.Ascii().data(), result.Ascii().length()); } -template <class SetType> -void AddToAccessControlAllowList(const std::string& string, - unsigned start, - unsigned end, - SetType& set) { - if (string.empty()) - return; - - // Skip white space from start. - while (start <= end && IsSpaceOrNewline(string.at(start))) - ++start; - - // only white space - if (start > end) - return; - - // Skip white space from end. - while (end && IsSpaceOrNewline(string.at(end))) - --end; - - set.insert(string.substr(start, end - start + 1)); -} - -template <class SetType> -bool ParseAccessControlAllowList(const std::string& string, SetType& set) { - unsigned start = 0; - size_t end; - while ((end = string.find(',', start)) != kNotFound) { - if (start != end) - AddToAccessControlAllowList(string, start, end - 1, set); - start = end + 1; +std::unique_ptr<net::HttpRequestHeaders> CreateNetHttpRequestHeaders( + const WebHTTPHeaderMap& header_map) { + std::unique_ptr<net::HttpRequestHeaders> request_headers = + std::make_unique<net::HttpRequestHeaders>(); + for (const auto& header : header_map.GetHTTPHeaderMap()) { + // TODO(toyoshim): Use CHECK() for a while to ensure that these assumptions + // are correct. Should be changed to DCHECK before the next branch cut. + CHECK(!header.key.IsNull()); + CHECK(!header.value.IsNull()); + request_headers->SetHeader( + std::string(header.key.Ascii().data(), header.key.Ascii().length()), + std::string(header.value.Ascii().data(), + header.value.Ascii().length())); } - if (start != string.length()) - AddToAccessControlAllowList(string, start, string.length() - 1, set); - - return true; + return request_headers; } } // namespace -WebCORSPreflightResultCacheItem::WebCORSPreflightResultCacheItem( - network::mojom::FetchCredentialsMode credentials_mode, - base::TickClock* clock) - : credentials_(credentials_mode == - network::mojom::FetchCredentialsMode::kInclude), - clock_(clock) {} - -// static -std::unique_ptr<WebCORSPreflightResultCacheItem> -WebCORSPreflightResultCacheItem::Create( - const network::mojom::FetchCredentialsMode credentials_mode, - const WebHTTPHeaderMap& response_header, - WebString& error_description, - base::TickClock* clock) { - std::unique_ptr<WebCORSPreflightResultCacheItem> item = - base::WrapUnique(new WebCORSPreflightResultCacheItem( - credentials_mode, - clock ? clock : base::DefaultTickClock::GetInstance())); - - if (!item->Parse(response_header, error_description)) - return nullptr; - - return item; -} - -bool WebCORSPreflightResultCacheItem::Parse( - const WebHTTPHeaderMap& response_header, - WebString& error_description) { - methods_.clear(); - - const HTTPHeaderMap& response_header_map = response_header.GetHTTPHeaderMap(); - - if (!ParseAccessControlAllowList( - response_header_map.Get(HTTPNames::Access_Control_Allow_Methods) - .Ascii() - .data(), - methods_)) { - error_description = - "Cannot parse Access-Control-Allow-Methods response header field in " - "preflight response."; - return false; - } - - headers_.clear(); - if (!ParseAccessControlAllowList( - response_header_map.Get(HTTPNames::Access_Control_Allow_Headers) - .Ascii() - .data(), - headers_)) { - error_description = - "Cannot parse Access-Control-Allow-Headers response header field in " - "preflight response."; - return false; - } - - TimeDelta expiry_delta; - if (ParseAccessControlMaxAge( - response_header_map.Get(HTTPNames::Access_Control_Max_Age), - expiry_delta)) { - if (expiry_delta > kMaxPreflightCacheTimeout) - expiry_delta = kMaxPreflightCacheTimeout; - } else { - expiry_delta = kDefaultPreflightCacheTimeout; - } - - absolute_expiry_time_ = clock_->NowTicks() + expiry_delta; - - return true; -} - -bool WebCORSPreflightResultCacheItem::AllowsCrossOriginMethod( - const WebString& method, - WebString& error_description) const { - if (methods_.find(method.Ascii().data()) != methods_.end() || - CORS::IsCORSSafelistedMethod(method)) { - return true; - } - - if (!credentials_ && methods_.find("*") != methods_.end()) - return true; - - error_description = WebString::FromASCII("Method " + method.Ascii() + - " is not allowed by " - "Access-Control-Allow-Methods " - "in preflight response."); - - return false; -} - -bool WebCORSPreflightResultCacheItem::AllowsCrossOriginHeaders( - const WebHTTPHeaderMap& request_headers, - WebString& error_description) const { - if (!credentials_ && headers_.find("*") != headers_.end()) - return true; - - for (const auto& header : request_headers.GetHTTPHeaderMap()) { - if (headers_.find(header.key.Ascii().data()) == headers_.end() && - !CORS::IsCORSSafelistedHeader(header.key, header.value) && - !FetchUtils::IsForbiddenHeaderName(header.key)) { - error_description = String::Format( - "Request header field %s is not allowed by " - "Access-Control-Allow-Headers in preflight response.", - header.key.GetString().Utf8().data()); - return false; - } - } - return true; -} - -bool WebCORSPreflightResultCacheItem::AllowsRequest( - network::mojom::FetchCredentialsMode credentials_mode, - const WebString& method, - const WebHTTPHeaderMap& request_headers) const { - WebString ignored_explanation; - - if (absolute_expiry_time_ < clock_->NowTicks()) - return false; - if (!credentials_ && - credentials_mode == network::mojom::FetchCredentialsMode::kInclude) { - return false; - } - if (!AllowsCrossOriginMethod(method, ignored_explanation)) - return false; - if (!AllowsCrossOriginHeaders(request_headers, ignored_explanation)) - return false; - return true; -} - WebCORSPreflightResultCache& WebCORSPreflightResultCache::Shared() { DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<WebCORSPreflightResultCache>, cache, ()); @@ -234,10 +82,65 @@ WebCORSPreflightResultCache::WebCORSPreflightResultCache() = default; WebCORSPreflightResultCache::~WebCORSPreflightResultCache() = default; +bool WebCORSPreflightResultCache::EnsureResultAndMayAppendEntry( + const WebHTTPHeaderMap& response_header_map, + const WebString& origin, + const WebURL& request_url, + const WebString& request_method, + const WebHTTPHeaderMap& request_header_map, + network::mojom::FetchCredentialsMode request_credentials_mode, + WebString* error_description) { + DCHECK(error_description); + + base::Optional<network::mojom::CORSError> error; + + std::unique_ptr<network::cors::PreflightResult> result = + network::cors::PreflightResult::Create( + request_credentials_mode, + GetOptionalHeaderValue(response_header_map, + HTTPNames::Access_Control_Allow_Methods), + GetOptionalHeaderValue(response_header_map, + HTTPNames::Access_Control_Allow_Headers), + GetOptionalHeaderValue(response_header_map, + HTTPNames::Access_Control_Max_Age), + &error); + if (error) { + *error_description = CORS::GetErrorString( + CORS::ErrorParameter::CreateForPreflightResponseCheck(*error, + String())); + return false; + } + + DCHECK(!request_method.IsNull()); + error = result->EnsureAllowedCrossOriginMethod(std::string( + request_method.Ascii().data(), request_method.Ascii().length())); + if (error) { + *error_description = CORS::GetErrorString( + CORS::ErrorParameter::CreateForPreflightResponseCheck(*error, + request_method)); + return false; + } + + std::string detected_error_header; + error = result->EnsureAllowedCrossOriginHeaders( + *CreateNetHttpRequestHeaders(request_header_map), &detected_error_header); + if (error) { + *error_description = CORS::GetErrorString( + CORS::ErrorParameter::CreateForPreflightResponseCheck( + *error, String(detected_error_header.data(), + detected_error_header.length()))); + return false; + } + + DCHECK(!error); + AppendEntry(origin, request_url, std::move(result)); + return true; +} + void WebCORSPreflightResultCache::AppendEntry( const WebString& web_origin, const WebURL& web_url, - std::unique_ptr<WebCORSPreflightResultCacheItem> preflight_result) { + std::unique_ptr<network::cors::PreflightResult> preflight_result) { std::string url(web_url.GetString().Ascii()); std::string origin(web_origin.Ascii()); @@ -262,8 +165,11 @@ // both origin and url in cache -> check if still valid and if sufficient to // skip redirect: - if (preflight_hash_map_[origin][url]->AllowsRequest(credentials_mode, method, - request_headers)) { + DCHECK(!method.IsNull()); + if (preflight_hash_map_[origin][url]->EnsureAllowedRequest( + credentials_mode, + std::string(method.Ascii().data(), method.Ascii().length()), + *CreateNetHttpRequestHeaders(request_headers))) { return true; }
diff --git a/third_party/WebKit/Source/platform/exported/WebCORSPreflightResultCacheTest.cpp b/third_party/WebKit/Source/platform/exported/WebCORSPreflightResultCacheTest.cpp index 2a108b2c..c224a88 100644 --- a/third_party/WebKit/Source/platform/exported/WebCORSPreflightResultCacheTest.cpp +++ b/third_party/WebKit/Source/platform/exported/WebCORSPreflightResultCacheTest.cpp
@@ -4,6 +4,7 @@ #include "public/platform/WebCORSPreflightResultCache.h" +#include "base/strings/stringprintf.h" #include "base/test/simple_test_tick_clock.h" #include "platform/network/HTTPHeaderMap.h" #include "platform/testing/URLTestHelpers.h" @@ -42,39 +43,11 @@ class WebCORSPreflightResultCacheTest : public ::testing::Test { protected: - std::unique_ptr<WebCORSPreflightResultCacheItem> CreateCacheItem( - const AtomicString allow_methods, - const AtomicString allow_headers, - network::mojom::FetchCredentialsMode credentials_mode, - const int max_age = -1) { - HTTPHeaderMap response_header; - - if (!allow_methods.IsEmpty()) - response_header.Set("Access-Control-Allow-Methods", allow_methods); - - if (!allow_headers.IsEmpty()) - response_header.Set("Access-Control-Allow-Headers", allow_headers); - - if (max_age > -1) { - response_header.Set("Access-Control-Max-Age", - AtomicString::Number(max_age)); - } - - WebString error_description; - std::unique_ptr<WebCORSPreflightResultCacheItem> item = - WebCORSPreflightResultCacheItem::Create( - credentials_mode, response_header, error_description, clock()); - - EXPECT_TRUE(item); - - return item; - } - base::SimpleTestTickClock* clock() { return &clock_; } // This is by no means a robust parser and works only for the headers strings // used in this tests. - HTTPHeaderMap ParseHeaderString(std::string headers) { + HTTPHeaderMap ParseHeaderString(const std::string& headers) { HTTPHeaderMap header_map; std::stringstream stream; stream.str(headers); @@ -100,18 +73,21 @@ WebURL other_url = URLTestHelpers::ToKURL("http://www.test.com/B"); test::TestWebCORSPreflightResultCache cache; + network::cors::PreflightResult::SetTickClockForTesting(clock()); // Cache should be empty: EXPECT_EQ(0, cache.CacheSize()); cache.AppendEntry( origin, url, - CreateCacheItem("POST", "", - network::mojom::FetchCredentialsMode::kInclude, 5)); + network::cors::PreflightResult::Create( + network::mojom::FetchCredentialsMode::kInclude, std::string("POST"), + base::nullopt, std::string("5"), nullptr)); cache.AppendEntry( origin, other_url, - CreateCacheItem("POST", "", - network::mojom::FetchCredentialsMode::kInclude, 5)); + network::cors::PreflightResult::Create( + network::mojom::FetchCredentialsMode::kInclude, std::string("POST"), + base::nullopt, std::string("5"), nullptr)); // Cache size should be 3 (counting origins and urls separately): EXPECT_EQ(3, cache.CacheSize()); @@ -141,6 +117,8 @@ // Cache size should be 0, with the expired entry removed by call to // CanSkipPreflight(): EXPECT_EQ(0, cache.CacheSize()); + + network::cors::PreflightResult::SetTickClockForTesting(nullptr); } TEST_F(WebCORSPreflightResultCacheTest, CacheSize) { @@ -156,35 +134,38 @@ cache.AppendEntry( origin, url, - CreateCacheItem("POST", "", - network::mojom::FetchCredentialsMode::kInclude)); + network::cors::PreflightResult::Create( + network::mojom::FetchCredentialsMode::kInclude, std::string("POST"), + base::nullopt, base::nullopt, nullptr)); // Cache size should be 2 (counting origins and urls separately): EXPECT_EQ(2, cache.CacheSize()); cache.AppendEntry( origin, other_url, - CreateCacheItem("POST", "", - network::mojom::FetchCredentialsMode::kInclude)); + network::cors::PreflightResult::Create( + network::mojom::FetchCredentialsMode::kInclude, std::string("POST"), + base::nullopt, base::nullopt, nullptr)); // Cache size should now be 3 (1 origin, 2 urls): EXPECT_EQ(3, cache.CacheSize()); cache.AppendEntry( other_origin, url, - CreateCacheItem("POST", "", - network::mojom::FetchCredentialsMode::kInclude)); + network::cors::PreflightResult::Create( + network::mojom::FetchCredentialsMode::kInclude, std::string("POST"), + base::nullopt, base::nullopt, nullptr)); // Cache size should now be 4 (4 origin, 3 urls): EXPECT_EQ(5, cache.CacheSize()); } TEST_F(WebCORSPreflightResultCacheTest, CanSkipPreflight) { const struct { - const AtomicString allow_methods; - const AtomicString allow_headers; + const std::string allow_methods; + const std::string allow_headers; const network::mojom::FetchCredentialsMode cache_credentials_mode; - const AtomicString request_method; + const std::string request_method; const std::string request_headers; const network::mojom::FetchCredentialsMode request_credentials_mode; @@ -248,7 +229,7 @@ // Credential mode mismatch: {"GET", "", network::mojom::FetchCredentialsMode::kOmit, "GET", "", - network::mojom::FetchCredentialsMode::kInclude, false}, + network::mojom::FetchCredentialsMode::kOmit, true}, {"GET", "", network::mojom::FetchCredentialsMode::kOmit, "GET", "", network::mojom::FetchCredentialsMode::kInclude, false}, }; @@ -264,9 +245,10 @@ WebString origin("null"); WebURL url = URLTestHelpers::ToKURL("http://www.test.com/"); - std::unique_ptr<WebCORSPreflightResultCacheItem> item = CreateCacheItem( - test.allow_methods, test.allow_headers, test.cache_credentials_mode); - + std::unique_ptr<network::cors::PreflightResult> item = + network::cors::PreflightResult::Create( + test.cache_credentials_mode, test.allow_methods, test.allow_headers, + base::nullopt, nullptr); EXPECT_TRUE(item); test::TestWebCORSPreflightResultCache cache; @@ -274,7 +256,8 @@ cache.AppendEntry(origin, url, std::move(item)); EXPECT_EQ(cache.CanSkipPreflight(origin, url, test.request_credentials_mode, - test.request_method, + String(test.request_method.data(), + test.request_method.length()), ParseHeaderString(test.request_headers)), test.can_skip_preflight); }
diff --git a/third_party/WebKit/Source/platform/exported/WebClipboardImpl.h b/third_party/WebKit/Source/platform/exported/WebClipboardImpl.h index 451ffe36..7b0599d 100644 --- a/third_party/WebKit/Source/platform/exported/WebClipboardImpl.h +++ b/third_party/WebKit/Source/platform/exported/WebClipboardImpl.h
@@ -9,7 +9,7 @@ #include <string> -#include "third_party/WebKit/common/clipboard/clipboard.mojom-blink.h" +#include "third_party/WebKit/public/mojom/clipboard/clipboard.mojom-blink.h" #include "third_party/WebKit/public/platform/WebClipboard.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp b/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp index c821c123..2199b82 100644 --- a/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp +++ b/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp
@@ -32,8 +32,10 @@ #include "platform/fonts/FontCache.h" #include <memory> + #include "SkFontMgr.h" #include "SkTypeface_win.h" +#include "base/debug/alias.h" #include "platform/Language.h" #include "platform/fonts/BitmapGlyphsBlacklist.h" #include "platform/fonts/FontDescription.h" @@ -169,6 +171,16 @@ } } + // In production, these 3 font managers must match. + // They don't match in unit tests or in single process mode. + // Capture them in minidump for crbug.com/409784 + SkFontMgr* font_mgr = font_manager_.get(); + SkFontMgr* static_font_mgr = static_font_manager_; + SkFontMgr* skia_default_font_mgr = SkFontMgr::RefDefault().get(); + base::debug::Alias(&font_mgr); + base::debug::Alias(&static_font_mgr); + base::debug::Alias(&skia_default_font_mgr); + // Last resort font list : PanUnicode. CJK fonts have a pretty // large repertoire. Eventually, we need to scan all the fonts // on the system to have a Firefox-like coverage.
diff --git a/third_party/WebKit/Source/platform/loader/cors/CORSErrorString.cpp b/third_party/WebKit/Source/platform/loader/cors/CORSErrorString.cpp index d848688..5c9a4e4 100644 --- a/third_party/WebKit/Source/platform/loader/cors/CORSErrorString.cpp +++ b/third_party/WebKit/Source/platform/loader/cors/CORSErrorString.cpp
@@ -6,6 +6,7 @@ #include "platform/network/HTTPHeaderMap.h" #include "platform/network/http_names.h" +#include "platform/weborigin/SecurityOrigin.h" #include "platform/wtf/StdLibExtras.h" namespace blink { @@ -26,10 +27,10 @@ } ErrorParameter CreateWrongParameter(network::mojom::CORSError error) { - return ErrorParameter(error, GetInvalidURL(), GetInvalidURL(), - 0 /* status_code */, HTTPHeaderMap(), - *SecurityOrigin::CreateUnique(), - WebURLRequest::kRequestContextUnspecified, true); + return ErrorParameter( + error, GetInvalidURL(), GetInvalidURL(), 0 /* status_code */, + HTTPHeaderMap(), *SecurityOrigin::CreateUnique(), + WebURLRequest::kRequestContextUnspecified, String(), true); } } // namespace @@ -44,7 +45,7 @@ const SecurityOrigin& origin, const WebURLRequest::RequestContext context) { return ErrorParameter(error, first_url, second_url, status_code, header_map, - origin, context, false); + origin, context, String(), false); } // static @@ -53,17 +54,18 @@ return ErrorParameter(network::mojom::CORSError::kDisallowedByMode, request_url, GetInvalidURL(), 0 /* status_code */, HTTPHeaderMap(), *SecurityOrigin::CreateUnique(), - WebURLRequest::kRequestContextUnspecified, false); + WebURLRequest::kRequestContextUnspecified, String(), + false); } // static ErrorParameter ErrorParameter::CreateForInvalidResponse( const KURL& request_url, const SecurityOrigin& origin) { - return ErrorParameter(network::mojom::CORSError::kInvalidResponse, - request_url, GetInvalidURL(), 0 /* status_code */, - HTTPHeaderMap(), origin, - WebURLRequest::kRequestContextUnspecified, false); + return ErrorParameter( + network::mojom::CORSError::kInvalidResponse, request_url, GetInvalidURL(), + 0 /* status_code */, HTTPHeaderMap(), origin, + WebURLRequest::kRequestContextUnspecified, String(), false); } // static @@ -85,7 +87,7 @@ case network::mojom::CORSError::kDisallowCredentialsNotSetToTrue: return ErrorParameter(error, request_url, redirect_url, response_status_code, response_header_map, origin, - context, false); + context, String(), false); default: NOTREACHED(); } @@ -98,7 +100,8 @@ return ErrorParameter(network::mojom::CORSError::kPreflightInvalidStatus, GetInvalidURL(), GetInvalidURL(), response_status_code, HTTPHeaderMap(), *SecurityOrigin::CreateUnique(), - WebURLRequest::kRequestContextUnspecified, false); + WebURLRequest::kRequestContextUnspecified, String(), + false); } // static @@ -108,16 +111,36 @@ switch (error) { case network::mojom::CORSError::kPreflightMissingAllowExternal: case network::mojom::CORSError::kPreflightInvalidAllowExternal: - return ErrorParameter(error, GetInvalidURL(), GetInvalidURL(), - 0 /* status_code */, response_header_map, - *SecurityOrigin::CreateUnique(), - WebURLRequest::kRequestContextUnspecified, false); + return ErrorParameter( + error, GetInvalidURL(), GetInvalidURL(), 0 /* status_code */, + response_header_map, *SecurityOrigin::CreateUnique(), + WebURLRequest::kRequestContextUnspecified, String(), false); default: NOTREACHED(); } return CreateWrongParameter(error); } +// static +ErrorParameter ErrorParameter::CreateForPreflightResponseCheck( + const network::mojom::CORSError error, + const String& hint) { + switch (error) { + case network::mojom::CORSError::kInvalidAllowMethodsPreflightResponse: + case network::mojom::CORSError::kInvalidAllowHeadersPreflightResponse: + case network::mojom::CORSError::kMethodDisallowedByPreflightResponse: + case network::mojom::CORSError::kHeaderDisallowedByPreflightResponse: + return ErrorParameter( + error, GetInvalidURL(), GetInvalidURL(), 0 /* status_code */, + HTTPHeaderMap(), *SecurityOrigin::CreateUnique(), + WebURLRequest::kRequestContextUnspecified, hint, false); + default: + NOTREACHED(); + } + return CreateWrongParameter(error); +} + +// static ErrorParameter ErrorParameter::CreateForRedirectCheck( network::mojom::CORSError error, const KURL& request_url, @@ -125,10 +148,10 @@ switch (error) { case network::mojom::CORSError::kRedirectDisallowedScheme: case network::mojom::CORSError::kRedirectContainsCredentials: - return ErrorParameter(error, request_url, redirect_url, - 0 /* status_code */, HTTPHeaderMap(), - *SecurityOrigin::CreateUnique(), - WebURLRequest::kRequestContextUnspecified, false); + return ErrorParameter( + error, request_url, redirect_url, 0 /* status_code */, + HTTPHeaderMap(), *SecurityOrigin::CreateUnique(), + WebURLRequest::kRequestContextUnspecified, String(), false); default: NOTREACHED(); } @@ -142,6 +165,7 @@ const HTTPHeaderMap& header_map, const SecurityOrigin& origin, const WebURLRequest::RequestContext context, + const String& hint, bool unknown) : error(error), first_url(first_url), @@ -150,6 +174,7 @@ header_map(header_map), origin(origin), context(context), + hint(hint), unknown(unknown) {} String GetErrorString(const ErrorParameter& param) { @@ -265,7 +290,7 @@ "Response for preflight has invalid HTTP status code %d.", param.status_code); case network::mojom::CORSError::kPreflightMissingAllowExternal: - return WebString( + return String( "No 'Access-Control-Allow-External' header was present in the " "preflight response for this external request (This is an " "experimental header which is defined in " @@ -279,6 +304,24 @@ param.header_map.Get(HTTPNames::Access_Control_Allow_External) .Utf8() .data()); + case network::mojom::CORSError::kInvalidAllowMethodsPreflightResponse: + return String( + "Cannot parse Access-Control-Allow-Methods response header field in " + "preflight response."); + case network::mojom::CORSError::kInvalidAllowHeadersPreflightResponse: + return String( + "Cannot parse Access-Control-Allow-Headers response header field in " + "preflight response."); + case network::mojom::CORSError::kMethodDisallowedByPreflightResponse: + return String::Format( + "Method %s is not allowed by Access-Control-Allow-Methods in " + "preflight response.", + param.hint.Utf8().data()); + case network::mojom::CORSError::kHeaderDisallowedByPreflightResponse: + return String::Format( + "Request header field %s is not allowed by " + "Access-Control-Allow-Headers in preflight response.", + param.hint.Utf8().data()); case network::mojom::CORSError::kRedirectDisallowedScheme: return String::Format( "%sRedirect location '%s' has a disallowed scheme for cross-origin " @@ -293,7 +336,7 @@ param.second_url.GetString().Utf8().data()); } NOTREACHED(); - return WebString(); + return String(); } } // namespace CORS
diff --git a/third_party/WebKit/Source/platform/loader/cors/CORSErrorString.h b/third_party/WebKit/Source/platform/loader/cors/CORSErrorString.h index a96b45d..15089c0c 100644 --- a/third_party/WebKit/Source/platform/loader/cors/CORSErrorString.h +++ b/third_party/WebKit/Source/platform/loader/cors/CORSErrorString.h
@@ -7,14 +7,15 @@ #include "base/macros.h" #include "platform/PlatformExport.h" -#include "platform/network/HTTPHeaderMap.h" #include "platform/weborigin/KURL.h" -#include "platform/weborigin/SecurityOrigin.h" #include "public/platform/WebURLRequest.h" #include "services/network/public/mojom/cors.mojom-shared.h" namespace blink { +class HTTPHeaderMap; +class SecurityOrigin; + // CORS error strings related utility functions. namespace CORS { @@ -59,6 +60,15 @@ const network::mojom::CORSError, const HTTPHeaderMap& response_header_map); + // Creates an ErrorParameter for an error that is related to CORS-preflight + // response checks. + // |hint| should contain a banned request method for + // kMethodDisallowedByPreflightResponse, a banned request header name for + // kHeaderDisallowedByPreflightResponse, or can be omitted for others. + static ErrorParameter CreateForPreflightResponseCheck( + const network::mojom::CORSError, + const String& hint); + // Creates an ErrorParameter for CORS::CheckRedirectLocation() returns. static ErrorParameter CreateForRedirectCheck(network::mojom::CORSError, const KURL& request_url, @@ -73,6 +83,7 @@ const HTTPHeaderMap&, const SecurityOrigin&, const WebURLRequest::RequestContext, + const String& hint, bool unknown); // Members that this struct carries. @@ -83,6 +94,7 @@ const HTTPHeaderMap& header_map; const SecurityOrigin& origin; const WebURLRequest::RequestContext context; + const String& hint; // Set to true when an ErrorParameter was created in a wrong way. Used in // GetErrorString() to be robust for coding errors.
diff --git a/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.h b/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.h index 0d59079..2fdd02f 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.h +++ b/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.h
@@ -70,11 +70,6 @@ kDisallowPlaceholder = 0, // The requested image must not be a placeholder. kAllowPlaceholder, // The image is allowed to be a placeholder. }; - // TODO(toyoshim): Consider to define an enum for preload options, and use it - // instead of bool in this class, FrameFetchContext, and so on. If it is - // reasonable, we try merging m_speculativePreload and m_linkPreload into one - // enum type. See https://crbug.com/675883. - struct ResourceWidth { DISALLOW_NEW(); float width;
diff --git a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm index b200bdf..bdddfd4a 100644 --- a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm +++ b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm
@@ -299,7 +299,12 @@ public: BlinkScrollbarPartAnimationTimer(BlinkScrollbarPartAnimation* animation, CFTimeInterval duration) - : timer_(this, &BlinkScrollbarPartAnimationTimer::TimerFired), + : timer_(Platform::Current() + ->MainThread() + ->Scheduler() + ->CompositorTaskRunner(), + this, + &BlinkScrollbarPartAnimationTimer::TimerFired), start_time_(0.0), duration_(duration), animation_(animation), @@ -333,7 +338,7 @@ [animation_ setCurrentProgress:progress]; } - Timer<BlinkScrollbarPartAnimationTimer> timer_; + TaskRunnerTimer<BlinkScrollbarPartAnimationTimer> timer_; double start_time_; // In seconds. double duration_; // In seconds. BlinkScrollbarPartAnimation* animation_; // Weak, owns this.
diff --git a/third_party/WebKit/Source/platform/scheduler/child/worker_global_scope_scheduler.cc b/third_party/WebKit/Source/platform/scheduler/child/worker_global_scope_scheduler.cc index 698ebb8..0680f8d 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/worker_global_scope_scheduler.cc +++ b/third_party/WebKit/Source/platform/scheduler/child/worker_global_scope_scheduler.cc
@@ -61,6 +61,7 @@ case TaskType::kInternalIndexedDB: case TaskType::kInternalMedia: case TaskType::kInternalMediaRealTime: + case TaskType::kInternalIPC: // UnthrottledTaskRunner is generally discouraged in future. // TODO(nhiroki): Identify which tasks can be throttled / suspendable and // move them into other task runners. See also comments in
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc index f5a4bad4..ba84bf1 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc
@@ -182,6 +182,8 @@ return "InternalMedia"; case TaskType::kInternalMediaRealTime: return "InternalMediaRealTime"; + case TaskType::kInternalIPC: + return "InternalIPC"; case TaskType::kCount: return "Count"; }
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc index 4d834171..ec01c02 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc
@@ -269,6 +269,7 @@ case TaskType::kUnthrottled: case TaskType::kInternalTest: case TaskType::kInternalWebCrypto: + case TaskType::kInternalIPC: return TaskRunnerImpl::Create(UnpausableTaskQueue(), type); case TaskType::kCount: NOTREACHED();
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp index 2ddabc5..5b5d5163 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
@@ -35,10 +35,12 @@ #include "platform/PlatformChromeClient.h" #include "platform/graphics/GraphicsLayer.h" #include "platform/instrumentation/tracing/TraceEvent.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/scroll/MainThreadScrollingReason.h" #include "platform/scroll/ProgrammaticScrollAnimator.h" #include "platform/scroll/ScrollbarTheme.h" #include "platform/scroll/SmoothScrollSequencer.h" +#include "public/platform/Platform.h" static const int kPixelsPerLineStep = 40; static const float kMinFractionToStepWhenPaging = 0.875f; @@ -620,7 +622,8 @@ return; if (!fade_overlay_scrollbars_timer_) { - fade_overlay_scrollbars_timer_.reset(new Timer<ScrollableArea>( + fade_overlay_scrollbars_timer_.reset(new TaskRunnerTimer<ScrollableArea>( + Platform::Current()->MainThread()->Scheduler()->CompositorTaskRunner(), this, &ScrollableArea::FadeOverlayScrollbarsTimerFired)); }
diff --git a/third_party/WebKit/Source/platform/wtf/text/WTFString.cpp b/third_party/WebKit/Source/platform/wtf/text/WTFString.cpp index e2d256d..a995f1c 100644 --- a/third_party/WebKit/Source/platform/wtf/text/WTFString.cpp +++ b/third_party/WebKit/Source/platform/wtf/text/WTFString.cpp
@@ -374,6 +374,52 @@ return String(reinterpret_cast<const LChar*>(buffer.data()), length); } +String String::EncodeForDebugging() const { + if (IsNull()) + return "<null>"; + + String str; + str.append('"'); + for (unsigned index = 0; index < length(); ++index) { + // Print shorthands for select cases. + UChar character = (*impl_)[index]; + switch (character) { + case '\t': + str.append("\\t"); + break; + case '\n': + str.append("\\n"); + break; + case '\r': + str.append("\\r"); + break; + case '"': + str.append("\\\""); + break; + case '\\': + str.append("\\\\"); + break; + default: + if (IsASCIIPrintable(character)) { + str.append(static_cast<char>(character)); + } else { + // Print "\uXXXX" for control or non-ASCII characters. + str.append("\\u"); + std::stringstream out; + out.width(4); + out.fill('0'); + out.setf(std::ios_base::hex, std::ios_base::basefield); + out.setf(std::ios::uppercase); + out << character; + str.append(out.str().c_str()); + } + break; + } + } + str.append('"'); + return str; +} + template <typename IntegerType> static String IntegerToString(IntegerType input) { IntegerToStringConverter<IntegerType> converter(input); @@ -774,45 +820,7 @@ } std::ostream& operator<<(std::ostream& out, const String& string) { - if (string.IsNull()) - return out << "<null>"; - - out << '"'; - for (unsigned index = 0; index < string.length(); ++index) { - // Print shorthands for select cases. - UChar character = string[index]; - switch (character) { - case '\t': - out << "\\t"; - break; - case '\n': - out << "\\n"; - break; - case '\r': - out << "\\r"; - break; - case '"': - out << "\\\""; - break; - case '\\': - out << "\\\\"; - break; - default: - if (IsASCIIPrintable(character)) { - out << static_cast<char>(character); - } else { - // Print "\uXXXX" for control or non-ASCII characters. - out << "\\u"; - out.width(4); - out.fill('0'); - out.setf(std::ios_base::hex, std::ios_base::basefield); - out.setf(std::ios::uppercase); - out << character; - } - break; - } - } - return out << '"'; + return out << string.EncodeForDebugging().Utf8().data(); } #ifndef NDEBUG
diff --git a/third_party/WebKit/Source/platform/wtf/text/WTFString.h b/third_party/WebKit/Source/platform/wtf/text/WTFString.h index 918171b..c22ed456 100644 --- a/third_party/WebKit/Source/platform/wtf/text/WTFString.h +++ b/third_party/WebKit/Source/platform/wtf/text/WTFString.h
@@ -335,6 +335,10 @@ // This function supports Latin-1 characters only. PRINTF_FORMAT(1, 2) static String Format(const char* format, ...); + // Returns a version suitable for gtest and base/logging.*. It prepends and + // appends double-quotes, and escapes chracters other than ASCII printables. + String EncodeForDebugging() const; + // Returns an uninitialized string. The characters needs to be written // into the buffer returned in data before the returned string is used. // Failure to do this will have unpredictable results.
diff --git a/third_party/WebKit/common/BUILD.gn b/third_party/WebKit/common/BUILD.gn index fdd7d32..22ad8d9 100644 --- a/third_party/WebKit/common/BUILD.gn +++ b/third_party/WebKit/common/BUILD.gn
@@ -50,7 +50,6 @@ "../public/common/client_hints/client_hints.h", "../public/common/device_memory/approximated_device_memory.h", "../public/common/feature_policy/feature_policy.h", - "../public/common/feature_policy/feature_policy.h", "../public/common/frame/frame_policy.h", "../public/common/frame/sandbox_flags.h", "../public/common/message_port/cloneable_message.h", @@ -120,10 +119,6 @@ sources = [ # NOTE: Consider adding new mojom files under public/mojom, this target # will be deprecated. - "array_buffer/array_buffer_contents.mojom", - "clipboard/clipboard.mojom", - "color_chooser/color_chooser.mojom", - "feature_policy/feature_policy.mojom", "loader/prefetch_url_loader_service.mojom", "net/ip_address_space.mojom", "page/page_visibility_state.mojom", @@ -143,10 +138,14 @@ # TODO(kinuko): Create a separate BUILD.gn in public/mojom (or have the # target in public/BUILD.gn). + "../public/mojom/array_buffer/array_buffer_contents.mojom", "../public/mojom/blob/blob.mojom", "../public/mojom/blob/blob_registry.mojom", "../public/mojom/blob/blob_url_store.mojom", "../public/mojom/blob/serialized_blob.mojom", + "../public/mojom/clipboard/clipboard.mojom", + "../public/mojom/color_chooser/color_chooser.mojom", + "../public/mojom/feature_policy/feature_policy.mojom", ] public_deps = [
diff --git a/third_party/WebKit/common/README.md b/third_party/WebKit/common/README.md index ed6d34d7..8284a19 100644 --- a/third_party/WebKit/common/README.md +++ b/third_party/WebKit/common/README.md
@@ -23,5 +23,4 @@ * Follow [Chromium's common coding style guide](https://chromium.googlesource.com/chromium/src/+/master/styleguide/c++/c++.md) * Use full-path from src/ for includes (e.g. `third_party/WebKit/common/foo.h` - rather than `common/foo.h`). Likewise, code outside this directory that - includes files in this directory should use the full-path. + rather than `common/foo.h`).
diff --git a/third_party/WebKit/common/feature_policy/OWNERS b/third_party/WebKit/common/feature_policy/OWNERS index 41960f51..2644755 100644 --- a/third_party/WebKit/common/feature_policy/OWNERS +++ b/third_party/WebKit/common/feature_policy/OWNERS
@@ -4,9 +4,7 @@ # COMPONENT: Blink>FeaturePolicy -per-file *.mojom=set noparent -per-file *.mojom=file://ipc/SECURITY_OWNERS -per-file *_struct_traits*.*=set noparent -per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS per-file *.typemap=set noparent per-file *.typemap=file://ipc/SECURITY_OWNERS
diff --git a/third_party/WebKit/common/feature_policy/README.md b/third_party/WebKit/common/feature_policy/README.md index 9193b795..684c9471 100644 --- a/third_party/WebKit/common/feature_policy/README.md +++ b/third_party/WebKit/common/feature_policy/README.md
@@ -4,7 +4,7 @@ Feature policy (see [spec](https://wicg.github.io/feature-policy/)) is a mechanism that allows developers to selectively enable and disable various [browser features and -APIs](https://cs.chromium.org/chromium/src/third_party/WebKit/common/feature_policy/feature_policy.mojom) +APIs](https://cs.chromium.org/chromium/src/third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom) (e.g, "vibrate", "fullscreen", "usb", etc.). A feature policy can be defined via a HTTP header and/or an iframe "allow" attribute. @@ -51,14 +51,14 @@ ##### Define new feature 1. Feature policy features are defined in -`third_party/WebKit/common/feature_policy/feature_policy_feature.h`. Add the new feature +`third_party/WebKit/public/common/feature_policy/feature_policy_feature.h`. Add the new feature enum with a brief decription about what the feature does in the comment, right above `LAST_FEATURE` 2. Append the new feature enum with a brief description as well in -`third_party/WebKit/common/feature_policy/feature_policy.mojom` +`third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom` -3. Update `third_party/WebKit/common/feature_policy/feature_policy_struct_traits.h` +3. Update `third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom_traits.h` to include the new feature 4. Update `third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp`:
diff --git a/third_party/WebKit/common/feature_policy/feature_policy.typemap b/third_party/WebKit/common/feature_policy/feature_policy.typemap index e69c2e9..5934ef3e 100644 --- a/third_party/WebKit/common/feature_policy/feature_policy.typemap +++ b/third_party/WebKit/common/feature_policy/feature_policy.typemap
@@ -2,16 +2,16 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//third_party/WebKit/common/feature_policy/feature_policy.mojom" +mojom = "//third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom" public_headers = [ "//third_party/WebKit/public/common/feature_policy/feature_policy.h", "//third_party/WebKit/public/common/frame/sandbox_flags.h", ] traits_headers = [ - "//third_party/WebKit/common/feature_policy/feature_policy_struct_traits.h", + "//third_party/WebKit/common/feature_policy/feature_policy_mojom_traits.h", ] sources = [ - "//third_party/WebKit/common/feature_policy/feature_policy_struct_traits.cc", + "//third_party/WebKit/common/feature_policy/feature_policy_mojom_traits.cc", ] type_mappings = [ "blink.mojom.ParsedFeaturePolicyDeclaration=blink::ParsedFeaturePolicyDeclaration",
diff --git a/third_party/WebKit/common/feature_policy/feature_policy_struct_traits.cc b/third_party/WebKit/common/feature_policy/feature_policy_mojom_traits.cc similarity index 97% rename from third_party/WebKit/common/feature_policy/feature_policy_struct_traits.cc rename to third_party/WebKit/common/feature_policy/feature_policy_mojom_traits.cc index 1ffc5f1..43c12e3 100644 --- a/third_party/WebKit/common/feature_policy/feature_policy_struct_traits.cc +++ b/third_party/WebKit/common/feature_policy/feature_policy_mojom_traits.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/WebKit/common/feature_policy/feature_policy_struct_traits.h" +#include "third_party/WebKit/common/feature_policy/feature_policy_mojom_traits.h" #include "url/mojom/origin_mojom_traits.h"
diff --git a/third_party/WebKit/common/feature_policy/feature_policy_struct_traits.h b/third_party/WebKit/common/feature_policy/feature_policy_mojom_traits.h similarity index 96% rename from third_party/WebKit/common/feature_policy/feature_policy_struct_traits.h rename to third_party/WebKit/common/feature_policy/feature_policy_mojom_traits.h index 5114a275..6a099dd 100644 --- a/third_party/WebKit/common/feature_policy/feature_policy_struct_traits.h +++ b/third_party/WebKit/common/feature_policy/feature_policy_mojom_traits.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef THIRD_PARTY_WEBKIT_COMMON_FEATURE_POLICY_FEATURE_POLICY_STRUCT_TRAITS_H_ -#define THIRD_PARTY_WEBKIT_COMMON_FEATURE_POLICY_FEATURE_POLICY_STRUCT_TRAITS_H_ +#ifndef THIRD_PARTY_WEBKIT_COMMON_FEATURE_POLICY_FEATURE_POLICY_MOJOM_TRAITS_H_ +#define THIRD_PARTY_WEBKIT_COMMON_FEATURE_POLICY_FEATURE_POLICY_MOJOM_TRAITS_H_ #include <vector> #include "mojo/public/cpp/bindings/enum_traits.h" #include "third_party/WebKit/common/common_export.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom-shared.h" #include "third_party/WebKit/public/common/feature_policy/feature_policy.h" #include "third_party/WebKit/public/common/frame/sandbox_flags.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom-shared.h" namespace mojo { @@ -94,4 +94,4 @@ } // namespace mojo -#endif // THIRD_PARTY_WEBKIT_COMMON_FEATURE_POLICY_FEATURE_POLICY_STRUCT_TRAITS_H_ +#endif // THIRD_PARTY_WEBKIT_COMMON_FEATURE_POLICY_FEATURE_POLICY_MOJOM_TRAITS_H_
diff --git a/third_party/WebKit/common/message_port/message_port.mojom b/third_party/WebKit/common/message_port/message_port.mojom index 9fdfe7a..52f9bef 100644 --- a/third_party/WebKit/common/message_port/message_port.mojom +++ b/third_party/WebKit/common/message_port/message_port.mojom
@@ -4,7 +4,7 @@ module blink.mojom; -import "third_party/WebKit/common/array_buffer/array_buffer_contents.mojom"; +import "third_party/WebKit/public/mojom/array_buffer/array_buffer_contents.mojom"; import "third_party/WebKit/public/mojom/blob/serialized_blob.mojom"; import "skia/public/interfaces/bitmap.mojom";
diff --git a/third_party/WebKit/public/common/README.md b/third_party/WebKit/public/common/README.md index 2c8885a..224c40b 100644 --- a/third_party/WebKit/public/common/README.md +++ b/third_party/WebKit/public/common/README.md
@@ -6,4 +6,7 @@ Anything in this directory should **NOT** depend on other WebKit headers. +Corresponding .cc code normally lives in `WebKit/common`, and public +`.mojom` files live in `WebKit/public/mojom`. + See `DEPS` and `WebKit/common/README.md` for more details.
diff --git a/third_party/WebKit/public/common/feature_policy/feature_policy.h b/third_party/WebKit/public/common/feature_policy/feature_policy.h index bc5602c..0f9b7cd 100644 --- a/third_party/WebKit/public/common/feature_policy/feature_policy.h +++ b/third_party/WebKit/public/common/feature_policy/feature_policy.h
@@ -12,7 +12,7 @@ #include "base/gtest_prod_util.h" #include "base/macros.h" #include "third_party/WebKit/common/common_export.h" -#include "third_party/WebKit/common/feature_policy/feature_policy.mojom.h" +#include "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom.h" #include "url/origin.h" namespace blink {
diff --git a/third_party/WebKit/public/common/message_port/transferable_message.h b/third_party/WebKit/public/common/message_port/transferable_message.h index 24234a0f..7ea86e35 100644 --- a/third_party/WebKit/public/common/message_port/transferable_message.h +++ b/third_party/WebKit/public/common/message_port/transferable_message.h
@@ -9,10 +9,10 @@ #include "base/containers/span.h" #include "base/macros.h" -#include "third_party/WebKit/common/array_buffer/array_buffer_contents.mojom.h" #include "third_party/WebKit/common/common_export.h" #include "third_party/WebKit/public/common/message_port/cloneable_message.h" #include "third_party/WebKit/public/common/message_port/message_port_channel.h" +#include "third_party/WebKit/public/mojom/array_buffer/array_buffer_contents.mojom.h" #include "third_party/skia/include/core/SkBitmap.h" namespace blink {
diff --git a/third_party/WebKit/common/clipboard/OWNERS b/third_party/WebKit/public/mojom/OWNERS similarity index 100% copy from third_party/WebKit/common/clipboard/OWNERS copy to third_party/WebKit/public/mojom/OWNERS
diff --git a/third_party/WebKit/public/mojom/README.md b/third_party/WebKit/public/mojom/README.md new file mode 100644 index 0000000..dc6ff39 --- /dev/null +++ b/third_party/WebKit/public/mojom/README.md
@@ -0,0 +1,4 @@ +# Blink public 'mojom' directory + +This directory contains the public `mojom` files that need to be shared +by renderer-side and browser-side code.
diff --git a/third_party/WebKit/common/array_buffer/OWNERS b/third_party/WebKit/public/mojom/array_buffer/OWNERS similarity index 100% rename from third_party/WebKit/common/array_buffer/OWNERS rename to third_party/WebKit/public/mojom/array_buffer/OWNERS
diff --git a/third_party/WebKit/common/array_buffer/array_buffer_contents.mojom b/third_party/WebKit/public/mojom/array_buffer/array_buffer_contents.mojom similarity index 100% rename from third_party/WebKit/common/array_buffer/array_buffer_contents.mojom rename to third_party/WebKit/public/mojom/array_buffer/array_buffer_contents.mojom
diff --git a/third_party/WebKit/common/clipboard/OWNERS b/third_party/WebKit/public/mojom/clipboard/OWNERS similarity index 100% rename from third_party/WebKit/common/clipboard/OWNERS rename to third_party/WebKit/public/mojom/clipboard/OWNERS
diff --git a/third_party/WebKit/common/clipboard/clipboard.mojom b/third_party/WebKit/public/mojom/clipboard/clipboard.mojom similarity index 100% rename from third_party/WebKit/common/clipboard/clipboard.mojom rename to third_party/WebKit/public/mojom/clipboard/clipboard.mojom
diff --git a/third_party/WebKit/common/color_chooser/OWNERS b/third_party/WebKit/public/mojom/color_chooser/OWNERS similarity index 100% rename from third_party/WebKit/common/color_chooser/OWNERS rename to third_party/WebKit/public/mojom/color_chooser/OWNERS
diff --git a/third_party/WebKit/common/color_chooser/color_chooser.mojom b/third_party/WebKit/public/mojom/color_chooser/color_chooser.mojom similarity index 100% rename from third_party/WebKit/common/color_chooser/color_chooser.mojom rename to third_party/WebKit/public/mojom/color_chooser/color_chooser.mojom
diff --git a/third_party/WebKit/public/mojom/feature_policy/OWNERS b/third_party/WebKit/public/mojom/feature_policy/OWNERS new file mode 100644 index 0000000..2997aa22 --- /dev/null +++ b/third_party/WebKit/public/mojom/feature_policy/OWNERS
@@ -0,0 +1,8 @@ +iclelland@chromium.org +raymes@chromium.org +loonybear@chromium.org + +# COMPONENT: Blink>FeaturePolicy + +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/third_party/WebKit/common/feature_policy/feature_policy.mojom b/third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom similarity index 100% rename from third_party/WebKit/common/feature_policy/feature_policy.mojom rename to third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom
diff --git a/third_party/WebKit/public/platform/DEPS b/third_party/WebKit/public/platform/DEPS index 682d3b4..3a6bdd7 100644 --- a/third_party/WebKit/public/platform/DEPS +++ b/third_party/WebKit/public/platform/DEPS
@@ -24,12 +24,15 @@ "+net/http", "+public/platform", "-public/web", + "+services/network/public/cpp/cors/cors_error_status.h", + "+services/network/public/cpp/cors/preflight_result.h", + # Enforce to use mojom-shared.h in WebKit/public so that it can compile # inside and outside Blink. - "+services/network/public/cpp/cors/cors_error_status.h", "+services/network/public/mojom/cors.mojom-shared.h", "+services/network/public/mojom/fetch_api.mojom-shared.h", "+services/network/public/mojom/request_context_frame_type.mojom-shared.h", + "+services/service_manager/public/mojom", "+third_party/skia", "+ui/gfx",
diff --git a/third_party/WebKit/public/platform/TaskType.h b/third_party/WebKit/public/platform/TaskType.h index 0964393..969b107 100644 --- a/third_party/WebKit/public/platform/TaskType.h +++ b/third_party/WebKit/public/platform/TaskType.h
@@ -158,7 +158,10 @@ // * //media kInternalMediaRealTime = 30, - kCount = 31, + // Tasks to execute IPC (legacy IPC and mojo). + kInternalIPC = 31, + + kCount = 32, }; } // namespace blink
diff --git a/third_party/WebKit/public/platform/WebCORSPreflightResultCache.h b/third_party/WebKit/public/platform/WebCORSPreflightResultCache.h index 76d40986..51b129d 100644 --- a/third_party/WebKit/public/platform/WebCORSPreflightResultCache.h +++ b/third_party/WebKit/public/platform/WebCORSPreflightResultCache.h
@@ -38,55 +38,10 @@ #include "public/platform/WebURL.h" #include "public/platform/WebURLRequest.h" #include "public/platform/WebURLResponse.h" - -namespace base { -class TickClock; -} +#include "services/network/public/cpp/cors/preflight_result.h" namespace blink { -// Represents an entry of the CORS-preflight cache. -// See https://fetch.spec.whatwg.org/#concept-cache. -class BLINK_PLATFORM_EXPORT WebCORSPreflightResultCacheItem { - public: - WebCORSPreflightResultCacheItem(const WebCORSPreflightResultCacheItem&) = - delete; - WebCORSPreflightResultCacheItem& operator=( - const WebCORSPreflightResultCacheItem&) = delete; - - static std::unique_ptr<WebCORSPreflightResultCacheItem> Create( - const network::mojom::FetchCredentialsMode, - const WebHTTPHeaderMap&, - WebString& error_description, - base::TickClock* = nullptr); - - bool AllowsCrossOriginMethod(const WebString& method, - WebString& error_description) const; - bool AllowsCrossOriginHeaders(const WebHTTPHeaderMap&, - WebString& error_description) const; - bool AllowsRequest(network::mojom::FetchCredentialsMode, - const WebString& method, - const WebHTTPHeaderMap& request_headers) const; - - private: - WebCORSPreflightResultCacheItem(network::mojom::FetchCredentialsMode, - base::TickClock*); - - bool Parse(const WebHTTPHeaderMap& response_header, - WebString& error_description); - - // FIXME: A better solution to holding onto the absolute expiration time might - // be to start a timer for the expiration delta that removes this from the - // cache when it fires. - base::TimeTicks absolute_expiry_time_; - - // Corresponds to the fields of the CORS-preflight cache with the same name. - bool credentials_; - base::flat_set<std::string> methods_; - WebHTTPHeaderSet headers_; - base::TickClock* clock_; -}; - class BLINK_PLATFORM_EXPORT WebCORSPreflightResultCache { public: WebCORSPreflightResultCache(const WebCORSPreflightResultCache&) = delete; @@ -96,9 +51,26 @@ // Returns a WebCORSPreflightResultCache which is shared in the same thread. static WebCORSPreflightResultCache& Shared(); + // TODO(toyoshim): Move to platform/loader/cors, as + // CORS::EnsurePreflightResultAndCacheOnSuccess when + // WebCORSPreflightResultCache is ported to network service. + bool EnsureResultAndMayAppendEntry( + const WebHTTPHeaderMap& response_header_map, + const WebString& origin, + const WebURL& request_url, + const WebString& request_method, + const WebHTTPHeaderMap& request_header_map, + network::mojom::FetchCredentialsMode request_credentials_mode, + WebString* error_description); + + // TODO(toyoshim): Remove the following method that is used only for testing + // outside this class implementation. void AppendEntry(const WebString& origin, const WebURL&, - std::unique_ptr<WebCORSPreflightResultCacheItem>); + std::unique_ptr<network::cors::PreflightResult>); + + // TODO(toyoshim): Move to platform/loader/cors, as CORS::CanSkipPreflight + // when WebCORSPreflightResultCache is ported to network service. bool CanSkipPreflight(const WebString& origin, const WebURL&, network::mojom::FetchCredentialsMode, @@ -113,10 +85,10 @@ typedef std::map< std::string, - std::map<std::string, std::unique_ptr<WebCORSPreflightResultCacheItem>>> - WebCORSPreflightResultHashMap; + std::map<std::string, std::unique_ptr<network::cors::PreflightResult>>> + PreflightResultHashMap; - WebCORSPreflightResultHashMap preflight_hash_map_; + PreflightResultHashMap preflight_hash_map_; }; } // namespace blink
diff --git a/third_party/WebKit/public/platform/WebClipboard.h b/third_party/WebKit/public/platform/WebClipboard.h index c1aec1f..ec8509c 100644 --- a/third_party/WebKit/public/platform/WebClipboard.h +++ b/third_party/WebKit/public/platform/WebClipboard.h
@@ -37,7 +37,7 @@ #include "public/platform/WebString.h" #include "public/platform/WebURL.h" #include "public/platform/WebVector.h" -#include "third_party/WebKit/common/clipboard/clipboard.mojom-shared.h" +#include "third_party/WebKit/public/mojom/clipboard/clipboard.mojom-shared.h" namespace blink {
diff --git a/third_party/WebKit/public/web/WebSettings.h b/third_party/WebKit/public/web/WebSettings.h index 80ec8e0..61ca81b 100644 --- a/third_party/WebKit/public/web/WebSettings.h +++ b/third_party/WebKit/public/web/WebSettings.h
@@ -65,7 +65,6 @@ enum V8CacheOptions { kV8CacheOptionsDefault, kV8CacheOptionsNone, - kV8CacheOptionsParse, kV8CacheOptionsCode, };
diff --git a/third_party/google_toolbox_for_mac/BUILD.gn b/third_party/google_toolbox_for_mac/BUILD.gn index 6fba023f..ce1669b 100644 --- a/third_party/google_toolbox_for_mac/BUILD.gn +++ b/third_party/google_toolbox_for_mac/BUILD.gn
@@ -69,6 +69,8 @@ # GTMLogger and GTMSQLite are used by Phenotype, a dependency of GrowthKit. "src/Foundation/GTMLogger.h", "src/Foundation/GTMLogger.m", + "src/Foundation/GTMNSData+zlib.h", + "src/Foundation/GTMNSData+zlib.m", "src/Foundation/GTMNSDictionary+URLArguments.h", "src/Foundation/GTMNSDictionary+URLArguments.m", "src/Foundation/GTMNSString+URLArguments.h", @@ -90,7 +92,10 @@ # This should be removed once all deprecation violations have been fixed. cflags = [ "-Wno-deprecated-declarations" ] - libs = [ "sqlite3" ] + libs = [ + "sqlite3", + "z", + ] } if (is_component_build) {
diff --git a/third_party/material_design_icons/BUILD.gn b/third_party/material_design_icons/BUILD.gn index 4baba45..eccd00c9 100644 --- a/third_party/material_design_icons/BUILD.gn +++ b/third_party/material_design_icons/BUILD.gn
@@ -14,6 +14,7 @@ "action/ic_account_circle", "action/ic_account_circle_48pt", "action/ic_delete", + "action/ic_done", "action/ic_feedback", "action/ic_help", "action/ic_info", @@ -28,10 +29,13 @@ "communication/ic_email", "communication/ic_message", "content/ic_link", + "content/ic_send", + "content/ic_undo", "editor/ic_mode_edit", "file/ic_file_download", "hardware/ic_desktop_windows", "hardware/ic_desktop_windows_white", + "hardware/ic_keyboard_arrow_down", "hardware/ic_keyboard_arrow_right", "hardware/ic_mouse", "image/ic_photo_camera",
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index fdd19e7..060e001 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -25839,6 +25839,7 @@ <int value="-1099142083" label="V8Ignition:disabled"/> <int value="-1099135056" label="AsyncDns:enabled"/> <int value="-1096595907" label="disable-new-virtual-keyboard-behavior"/> + <int value="-1095947169" label="ModalPermissionDialogView:disabled"/> <int value="-1085492638" label="FetchKeepaliveTimeoutSetting:enabled"/> <int value="-1084055006" label="disable-web-notification-custom-layouts"/> <int value="-1082302549" label="scan-cards-in-web-payments"/> @@ -26301,6 +26302,7 @@ <int value="61205887" label="enable-text-input-focus-manager"/> <int value="61466986" label="AsyncDns:disabled"/> <int value="64942701" label="OfflinePagesSvelteConcurrentLoading:disabled"/> + <int value="66897259" label="ModalPermissionDialogView:enabled"/> <int value="67639499" label="stop-loading-in-background:disabled"/> <int value="70878462" label="WebAssembly:disabled"/> <int value="73929836" label="VrBrowsingInCustomTab:enabled"/> @@ -37395,6 +37397,7 @@ <int value="28" label="InternalIndexedDB"/> <int value="29" label="InternalMedia"/> <int value="30" label="InternalMediaRealTime"/> + <int value="31" label="InternalIPC"/> </enum> <enum name="RendererSchedulerThreadType">
diff --git a/tools/traffic_annotation/summary/annotations.xml b/tools/traffic_annotation/summary/annotations.xml index 8d6dcc99..94c781f 100644 --- a/tools/traffic_annotation/summary/annotations.xml +++ b/tools/traffic_annotation/summary/annotations.xml
@@ -200,7 +200,7 @@ <item id="security_key_socket" hash_code="31074955" type="0" content_hash_code="11296409" os_list="linux,windows" file_path="remoting/host/security_key/security_key_socket.cc"/> <item id="service_worker_navigation_preload" hash_code="129872904" type="0" content_hash_code="79473248" os_list="linux,windows" file_path="content/browser/service_worker/service_worker_fetch_dispatcher.cc"/> <item id="service_worker_write_to_cache_job" hash_code="117963307" type="0" content_hash_code="18065724" os_list="linux,windows" file_path="content/browser/service_worker/service_worker_write_to_cache_job.cc"/> - <item id="sigined_exchange_cert_fetcher" hash_code="79442849" type="0" content_hash_code="8138156" os_list="linux,windows" file_path="content/browser/loader/signed_exchange_cert_fetcher.cc"/> + <item id="sigined_exchange_cert_fetcher" hash_code="79442849" type="0" content_hash_code="8138156" os_list="linux,windows" file_path="content/browser/web_package/signed_exchange_cert_fetcher.cc"/> <item id="signed_in_profile_avatar" hash_code="108903331" type="0" content_hash_code="72850619" os_list="linux,windows" file_path="chrome/browser/profiles/profile_downloader.cc"/> <item id="socket_bio_adapter" hash_code="516551" type="0" content_hash_code="21643352" os_list="linux,windows" file_path="net/socket/socket_bio_adapter.cc"/> <item id="speech_recognition_downstream" hash_code="26096088" type="0" content_hash_code="120733233" os_list="linux,windows" file_path="content/browser/speech/speech_recognition_engine.cc"/>
diff --git a/ui/accessibility/ax_role_properties.cc b/ui/accessibility/ax_role_properties.cc index 8c78792..02235b3 100644 --- a/ui/accessibility/ax_role_properties.cc +++ b/ui/accessibility/ax_role_properties.cc
@@ -157,4 +157,17 @@ } } +bool IsImage(ax::mojom::Role role) { + switch (role) { + case ax::mojom::Role::kCanvas: + case ax::mojom::Role::kImageMap: + case ax::mojom::Role::kImage: + case ax::mojom::Role::kSvgRoot: + case ax::mojom::Role::kVideo: + return true; + default: + return false; + } +} + } // namespace ui
diff --git a/ui/accessibility/ax_role_properties.h b/ui/accessibility/ax_role_properties.h index 4031132..9b1793ee 100644 --- a/ui/accessibility/ax_role_properties.h +++ b/ui/accessibility/ax_role_properties.h
@@ -35,6 +35,9 @@ // Returns true if this node is a menu or related role. AX_EXPORT bool IsMenuRelated(ax::mojom::Role role); +// Returns true if it's an image, graphic, canvas, etc. +AX_EXPORT bool IsImage(ax::mojom::Role role); + } // namespace ui #endif // UI_ACCESSIBILITY_AX_ROLE_PROPERTIES_H_
diff --git a/ui/base/mojo/DEPS b/ui/base/mojo/DEPS index 4c418e2..e0c12f73 100644 --- a/ui/base/mojo/DEPS +++ b/ui/base/mojo/DEPS
@@ -1,4 +1,4 @@ include_rules = [ "+mojo/public/cpp/bindings", - "+third_party/WebKit/common/clipboard/clipboard.mojom-shared.h" + "+third_party/WebKit/public/mojom/clipboard/clipboard.mojom-shared.h" ]
diff --git a/ui/base/mojo/clipboard.typemap b/ui/base/mojo/clipboard.typemap index 1063cb36..ebd328b5 100644 --- a/ui/base/mojo/clipboard.typemap +++ b/ui/base/mojo/clipboard.typemap
@@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//third_party/WebKit/common/clipboard/clipboard.mojom" +mojom = "//third_party/WebKit/public/mojom/clipboard/clipboard.mojom" public_headers = [ "//ui/base/clipboard/clipboard_types.h" ] traits_headers = [ "//ui/base/mojo/clipboard_struct_traits.h" ] deps = [
diff --git a/ui/base/mojo/clipboard_struct_traits.h b/ui/base/mojo/clipboard_struct_traits.h index 81c618e..280a1f2 100644 --- a/ui/base/mojo/clipboard_struct_traits.h +++ b/ui/base/mojo/clipboard_struct_traits.h
@@ -5,7 +5,7 @@ #ifndef UI_BASE_MOJO_CLIPBOARD_STRUCT_TRAITS_H_ #define UI_BASE_MOJO_CLIPBOARD_STRUCT_TRAITS_H_ -#include "third_party/WebKit/common/clipboard/clipboard.mojom-shared.h" +#include "third_party/WebKit/public/mojom/clipboard/clipboard.mojom-shared.h" #include "ui/base/clipboard/clipboard_types.h" namespace mojo {
diff --git a/ui/display/display.h b/ui/display/display.h index 4c09f78..49f76438 100644 --- a/ui/display/display.h +++ b/ui/display/display.h
@@ -48,29 +48,28 @@ // The display rotation can have multiple causes for change. A user can set a // preference. On devices with accelerometers, they can change the rotation. // RotationSource allows for the tracking of a Rotation per source of the - // change. ROTATION_SOURCE_ACTIVE is the current rotation of the display. - // Rotation changes not due to an accelerometer, nor the user, are to use this - // source directly. ROTATION_SOURCE_UNKNOWN is when no rotation source has - // been provided. - enum RotationSource { - ROTATION_SOURCE_ACCELEROMETER = 0, - ROTATION_SOURCE_ACTIVE, - ROTATION_SOURCE_USER, - ROTATION_SOURCE_UNKNOWN, + // change. ACTIVE is the current rotation of the display. Rotation changes not + // due to an accelerometer, nor the user, are to use this source directly. + // UNKNOWN is when no rotation source has been provided. + enum class RotationSource { + ACCELEROMETER = 0, + ACTIVE, + USER, + UNKNOWN, }; // Touch support for the display. - enum TouchSupport { - TOUCH_SUPPORT_UNKNOWN, - TOUCH_SUPPORT_AVAILABLE, - TOUCH_SUPPORT_UNAVAILABLE, + enum class TouchSupport { + UNKNOWN, + AVAILABLE, + UNAVAILABLE, }; // Accelerometer support for the display. - enum AccelerometerSupport { - ACCELEROMETER_SUPPORT_UNKNOWN, - ACCELEROMETER_SUPPORT_AVAILABLE, - ACCELEROMETER_SUPPORT_UNAVAILABLE, + enum class AccelerometerSupport { + UNKNOWN, + AVAILABLE, + UNAVAILABLE, }; // Creates a display with kInvalidDisplayId as default. @@ -143,8 +142,7 @@ accelerometer_support_ = support; } - // Utility functions that just return the size of display and - // work area. + // Utility functions that just return the size of display and work area. const gfx::Size& size() const { return bounds_.size(); } const gfx::Size& work_area_size() const { return work_area_.size(); } @@ -240,8 +238,8 @@ gfx::Rect work_area_; float device_scale_factor_; Rotation rotation_ = ROTATE_0; - TouchSupport touch_support_ = TOUCH_SUPPORT_UNKNOWN; - AccelerometerSupport accelerometer_support_ = ACCELEROMETER_SUPPORT_UNKNOWN; + TouchSupport touch_support_ = TouchSupport::UNKNOWN; + AccelerometerSupport accelerometer_support_ = AccelerometerSupport::UNKNOWN; gfx::Size maximum_cursor_size_; // NOTE: this is not currently written to the mojom as it is not used in // aura.
diff --git a/ui/display/manager/chromeos/touch_device_manager.cc b/ui/display/manager/chromeos/touch_device_manager.cc index 4289ec2..4ffd851 100644 --- a/ui/display/manager/chromeos/touch_device_manager.cc +++ b/ui/display/manager/chromeos/touch_device_manager.cc
@@ -263,7 +263,7 @@ ManagedDisplayInfoList displays; for (ManagedDisplayInfo& display : *all_displays) { // Reset touch support from the display. - display.set_touch_support(Display::TOUCH_SUPPORT_UNAVAILABLE); + display.set_touch_support(Display::TouchSupport::UNAVAILABLE); displays.push_back(&display); } @@ -496,7 +496,7 @@ void TouchDeviceManager::Associate(ManagedDisplayInfo* display, const ui::TouchscreenDevice& device) { - display->set_touch_support(Display::TOUCH_SUPPORT_AVAILABLE); + display->set_touch_support(Display::TouchSupport::AVAILABLE); active_touch_associations_[TouchDeviceIdentifier::FromDevice(device)] = display->id(); }
diff --git a/ui/display/manager/display_manager.cc b/ui/display/manager/display_manager.cc index 8bfd38d..e7fd443 100644 --- a/ui/display/manager/display_manager.cc +++ b/ui/display/manager/display_manager.cc
@@ -648,9 +648,9 @@ rotation = Display::ROTATE_0; display_info_[display_id].SetRotation(rotation, - Display::ROTATION_SOURCE_USER); + Display::RotationSource::USER); display_info_[display_id].SetRotation(rotation, - Display::ROTATION_SOURCE_ACTIVE); + Display::RotationSource::ACTIVE); // Just in case the preference file was corrupted. // TODO(mukai): register |display_modes_| here as well, so the lookup for the // default mode in GetActiveModeForDisplayId() gets much simpler. @@ -850,9 +850,9 @@ // active again. Display::Rotation user_rotation = display_info_[Display::InternalDisplayId()].GetRotation( - Display::ROTATION_SOURCE_USER); + Display::RotationSource::USER); display_info_[Display::InternalDisplayId()].SetRotation( - user_rotation, Display::ROTATION_SOURCE_USER); + user_rotation, Display::RotationSource::USER); } } @@ -1433,7 +1433,7 @@ for (const auto& display : active_display_list_) { ManagedDisplayInfo info = GetDisplayInfo(display.id()); if (info.id() == display_id) { - info.set_touch_support(Display::TOUCH_SUPPORT_AVAILABLE); + info.set_touch_support(Display::TouchSupport::AVAILABLE); update_add_support = true; } else if (info.id() == previous_display_id) { // Since we are reassociating the touch device to another display, we need @@ -1442,7 +1442,7 @@ if (!touch_device_manager_ ->GetAssociatedTouchDevicesForDisplay(previous_display_id) .empty()) { - info.set_touch_support(Display::TOUCH_SUPPORT_UNAVAILABLE); + info.set_touch_support(Display::TouchSupport::UNAVAILABLE); update_remove_support = true; } } @@ -1452,14 +1452,14 @@ // Update the non active displays. if (!update_add_support) { display_info_[display_id].set_touch_support( - Display::TOUCH_SUPPORT_AVAILABLE); + Display::TouchSupport::AVAILABLE); } if (!update_remove_support && !touch_device_manager_ ->GetAssociatedTouchDevicesForDisplay(previous_display_id) .empty()) { display_info_[previous_display_id].set_touch_support( - Display::TOUCH_SUPPORT_UNAVAILABLE); + Display::TouchSupport::UNAVAILABLE); } // Update the active displays. if (update_add_support || update_remove_support) @@ -1992,10 +1992,10 @@ if (internal_display_has_accelerometer_ && Display::IsInternalDisplayId(id)) { new_display.set_accelerometer_support( - Display::ACCELEROMETER_SUPPORT_AVAILABLE); + Display::AccelerometerSupport::AVAILABLE); } else { new_display.set_accelerometer_support( - Display::ACCELEROMETER_SUPPORT_UNAVAILABLE); + Display::AccelerometerSupport::UNAVAILABLE); } return new_display; }
diff --git a/ui/display/manager/managed_display_info.cc b/ui/display/manager/managed_display_info.cc index 7e02592..c490631 100644 --- a/ui/display/manager/managed_display_info.cc +++ b/ui/display/manager/managed_display_info.cc
@@ -240,7 +240,7 @@ ManagedDisplayInfo display_info( id, base::StringPrintf("Display-%d", static_cast<int>(id)), has_overscan); display_info.set_device_scale_factor(device_scale_factor); - display_info.SetRotation(rotation, Display::ROTATION_SOURCE_ACTIVE); + display_info.SetRotation(rotation, Display::RotationSource::ACTIVE); display_info.set_configured_ui_scale(ui_scale); display_info.SetBounds(bounds_in_native); display_info.SetManagedDisplayModes(display_modes); @@ -261,8 +261,8 @@ ManagedDisplayInfo::ManagedDisplayInfo() : id_(kInvalidDisplayId), has_overscan_(false), - active_rotation_source_(Display::ROTATION_SOURCE_UNKNOWN), - touch_support_(Display::TOUCH_SUPPORT_UNKNOWN), + active_rotation_source_(Display::RotationSource::UNKNOWN), + touch_support_(Display::TouchSupport::UNKNOWN), device_scale_factor_(1.0f), device_dpi_(kDpi96), overscan_insets_in_dip_(0, 0, 0, 0), @@ -277,8 +277,8 @@ : id_(id), name_(name), has_overscan_(has_overscan), - active_rotation_source_(Display::ROTATION_SOURCE_UNKNOWN), - touch_support_(Display::TOUCH_SUPPORT_UNKNOWN), + active_rotation_source_(Display::RotationSource::UNKNOWN), + touch_support_(Display::TouchSupport::UNKNOWN), device_scale_factor_(1.0f), device_dpi_(kDpi96), overscan_insets_in_dip_(0, 0, 0, 0), @@ -295,12 +295,12 @@ void ManagedDisplayInfo::SetRotation(Display::Rotation rotation, Display::RotationSource source) { rotations_[source] = rotation; - rotations_[Display::ROTATION_SOURCE_ACTIVE] = rotation; + rotations_[Display::RotationSource::ACTIVE] = rotation; active_rotation_source_ = source; } Display::Rotation ManagedDisplayInfo::GetActiveRotation() const { - return GetRotation(Display::ROTATION_SOURCE_ACTIVE); + return GetRotation(Display::RotationSource::ACTIVE); } Display::Rotation ManagedDisplayInfo::GetRotation( @@ -423,9 +423,9 @@ size_in_pixel_.ToString().c_str(), device_scale_factor_, overscan_insets_in_dip_.ToString().c_str(), rotation_degree, configured_ui_scale_, - touch_support_ == Display::TOUCH_SUPPORT_AVAILABLE + touch_support_ == Display::TouchSupport::AVAILABLE ? "yes" - : touch_support_ == Display::TOUCH_SUPPORT_UNAVAILABLE ? "no" + : touch_support_ == Display::TouchSupport::UNAVAILABLE ? "no" : "unknown"); return result;
diff --git a/ui/display/mojo/display_struct_traits.cc b/ui/display/mojo/display_struct_traits.cc index 4b61b0a..2603ede 100644 --- a/ui/display/mojo/display_struct_traits.cc +++ b/ui/display/mojo/display_struct_traits.cc
@@ -48,11 +48,11 @@ EnumTraits<display::mojom::TouchSupport, display::Display::TouchSupport>:: ToMojom(display::Display::TouchSupport touch_support) { switch (touch_support) { - case display::Display::TOUCH_SUPPORT_UNKNOWN: + case display::Display::TouchSupport::UNKNOWN: return display::mojom::TouchSupport::UNKNOWN; - case display::Display::TOUCH_SUPPORT_AVAILABLE: + case display::Display::TouchSupport::AVAILABLE: return display::mojom::TouchSupport::AVAILABLE; - case display::Display::TOUCH_SUPPORT_UNAVAILABLE: + case display::Display::TouchSupport::UNAVAILABLE: return display::mojom::TouchSupport::UNAVAILABLE; } NOTREACHED(); @@ -64,13 +64,13 @@ display::Display::TouchSupport* out) { switch (touch_support) { case display::mojom::TouchSupport::UNKNOWN: - *out = display::Display::TOUCH_SUPPORT_UNKNOWN; + *out = display::Display::TouchSupport::UNKNOWN; return true; case display::mojom::TouchSupport::AVAILABLE: - *out = display::Display::TOUCH_SUPPORT_AVAILABLE; + *out = display::Display::TouchSupport::AVAILABLE; return true; case display::mojom::TouchSupport::UNAVAILABLE: - *out = display::Display::TOUCH_SUPPORT_UNAVAILABLE; + *out = display::Display::TouchSupport::UNAVAILABLE; return true; } NOTREACHED(); @@ -82,11 +82,11 @@ display::Display::AccelerometerSupport>:: ToMojom(display::Display::AccelerometerSupport accelerometer_support) { switch (accelerometer_support) { - case display::Display::ACCELEROMETER_SUPPORT_UNKNOWN: + case display::Display::AccelerometerSupport::UNKNOWN: return display::mojom::AccelerometerSupport::UNKNOWN; - case display::Display::ACCELEROMETER_SUPPORT_AVAILABLE: + case display::Display::AccelerometerSupport::AVAILABLE: return display::mojom::AccelerometerSupport::AVAILABLE; - case display::Display::ACCELEROMETER_SUPPORT_UNAVAILABLE: + case display::Display::AccelerometerSupport::UNAVAILABLE: return display::mojom::AccelerometerSupport::UNAVAILABLE; } NOTREACHED(); @@ -99,13 +99,13 @@ display::Display::AccelerometerSupport* out) { switch (accelerometer_support) { case display::mojom::AccelerometerSupport::UNKNOWN: - *out = display::Display::ACCELEROMETER_SUPPORT_UNKNOWN; + *out = display::Display::AccelerometerSupport::UNKNOWN; return true; case display::mojom::AccelerometerSupport::AVAILABLE: - *out = display::Display::ACCELEROMETER_SUPPORT_AVAILABLE; + *out = display::Display::AccelerometerSupport::AVAILABLE; return true; case display::mojom::AccelerometerSupport::UNAVAILABLE: - *out = display::Display::ACCELEROMETER_SUPPORT_UNAVAILABLE; + *out = display::Display::AccelerometerSupport::UNAVAILABLE; return true; } NOTREACHED();
diff --git a/ui/display/mojo/display_struct_traits_unittest.cc b/ui/display/mojo/display_struct_traits_unittest.cc index 3dd7d2e38..1dd6cf7 100644 --- a/ui/display/mojo/display_struct_traits_unittest.cc +++ b/ui/display/mojo/display_struct_traits_unittest.cc
@@ -130,8 +130,8 @@ input.set_work_area(work_area); input.set_device_scale_factor(2.0f); input.set_rotation(Display::ROTATE_270); - input.set_touch_support(Display::TOUCH_SUPPORT_AVAILABLE); - input.set_accelerometer_support(Display::ACCELEROMETER_SUPPORT_UNAVAILABLE); + input.set_touch_support(Display::TouchSupport::AVAILABLE); + input.set_accelerometer_support(Display::AccelerometerSupport::UNAVAILABLE); input.set_maximum_cursor_size(maximum_cursor_size); input.set_color_depth(input.color_depth() + 1); input.set_depth_per_component(input.depth_per_component() + 1);
diff --git a/ui/events/event_utils.cc b/ui/events/event_utils.cc index 2ac65ff6..aa9b26e3 100644 --- a/ui/events/event_utils.cc +++ b/ui/events/event_utils.cc
@@ -86,21 +86,21 @@ bool ShouldDefaultToNaturalScroll() { return GetInternalDisplayTouchSupport() == - display::Display::TOUCH_SUPPORT_AVAILABLE; + display::Display::TouchSupport::AVAILABLE; } display::Display::TouchSupport GetInternalDisplayTouchSupport() { display::Screen* screen = display::Screen::GetScreen(); // No screen in some unit tests. if (!screen) - return display::Display::TOUCH_SUPPORT_UNKNOWN; + return display::Display::TouchSupport::UNKNOWN; const std::vector<display::Display>& displays = screen->GetAllDisplays(); for (std::vector<display::Display>::const_iterator it = displays.begin(); it != displays.end(); ++it) { if (it->IsInternal()) return it->touch_support(); } - return display::Display::TOUCH_SUPPORT_UNAVAILABLE; + return display::Display::TouchSupport::UNAVAILABLE; } void ComputeEventLatencyOS(const base::NativeEvent& native_event) {
diff --git a/ui/file_manager/file_manager/foreground/css/file_manager.css b/ui/file_manager/file_manager/foreground/css/file_manager.css index e5f53c2..4f63438 100644 --- a/ui/file_manager/file_manager/foreground/css/file_manager.css +++ b/ui/file_manager/file_manager/foreground/css/file_manager.css
@@ -165,7 +165,7 @@ flex: auto; font-weight: 500; margin: 0 6px; - overflow-x: hidden; + overflow: hidden; text-overflow: ellipsis; }
diff --git a/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js b/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js index 0b2838f..23c0dfb 100644 --- a/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js +++ b/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
@@ -994,12 +994,19 @@ return; } - // Check if a drag selection should be initiated or not. - if (list.shouldStartDragSelection(event)) { + // If this drag operation is initiated by mouse, check if we should start + // selecting area. + if (!this.touching_ && list.shouldStartDragSelection(event)) { event.preventDefault(); - // If this drag operation is initiated by mouse, start selecting area. - if (!this.touching_) - this.dragSelector_.startDragSelection(list, event); + this.dragSelector_.startDragSelection(list, event); + return; + } + + // If the drag starts outside the files list on a touch device, cancel the + // drag. + if (this.touching_ && !list.hasDragHitElement(event)) { + event.preventDefault(); + list.selectionModel_.unselectAll(); return; }
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_grid.js b/ui/file_manager/file_manager/foreground/js/ui/file_grid.js index 11e824bc..1ff5d50 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/file_grid.js +++ b/ui/file_manager/file_manager/foreground/js/ui/file_grid.js
@@ -555,12 +555,12 @@ var isDirectory = entry && entry.isDirectory; if (!isDirectory) { - var active_checkmark = li.ownerDocument.createElement('div'); - active_checkmark.className = 'checkmark active'; - frame.appendChild(active_checkmark); - var inactive_checkmark = li.ownerDocument.createElement('div'); - inactive_checkmark.className = 'checkmark inactive'; - frame.appendChild(inactive_checkmark); + var activeCheckmark = li.ownerDocument.createElement('div'); + activeCheckmark.className = 'checkmark active'; + frame.appendChild(activeCheckmark); + var inactiveCheckmark = li.ownerDocument.createElement('div'); + inactiveCheckmark.className = 'checkmark inactive'; + frame.appendChild(inactiveCheckmark); } var badge = li.ownerDocument.createElement('div'); @@ -814,14 +814,26 @@ }; /** + * Returns whether the drag event is inside a file entry in the list (and not + * the background padding area). + * @param {MouseEvent} event Drag start event. + * @return {boolean} True if the mouse is over an element in the list, False if + * it is in the background. + */ +FileGrid.prototype.hasDragHitElement = function(event) { + var pos = DragSelector.getScrolledPosition(this, event); + return this.getHitElements(pos.x, pos.y).length !== 0; +}; + +/** * Obtains if the drag selection should be start or not by referring the mouse * event. * @param {MouseEvent} event Drag start event. * @return {boolean} True if the mouse is hit to the background of the list. */ FileGrid.prototype.shouldStartDragSelection = function(event) { - var pos = DragSelector.getScrolledPosition(this, event); - return this.getHitElements(pos.x, pos.y).length === 0; + // Start dragging area if the drag starts outside of the contents of the grid. + return !this.hasDragHitElement(event); }; /**
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_table.js b/ui/file_manager/file_manager/foreground/js/ui/file_table.js index b30b02dc..3289ad8e 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/file_table.js +++ b/ui/file_manager/file_manager/foreground/js/ui/file_table.js
@@ -463,6 +463,7 @@ }.bind(self), true); self.list.shouldStartDragSelection = self.shouldStartDragSelection_.bind(self); + self.list.hasDragHitElement = self.hasDragHitElement_.bind(self); /** * Obtains the index list of elements that are hit by the point or the @@ -635,22 +636,36 @@ }; /** + * Returns whether the drag event is inside a file entry in the list (and not + * the background padding area). + * @param {MouseEvent} event Drag start event. + * @return {boolean} True if the mouse is over an element in the list, False if + * it is in the background. + */ +FileTable.prototype.hasDragHitElement_ = function(event) { + var pos = DragSelector.getScrolledPosition(this.list, event); + return this.list.getHitElements(pos.x, pos.y).length !== 0; +}; + +/** * Obtains if the drag selection should be start or not by referring the mouse * event. * @param {MouseEvent} event Drag start event. - * @return {boolean} True if the mouse is hit to the background of the list. + * @return {boolean} True if the mouse is hit to the background of the list, or + * certain areas of the inside of the list that would start a + * drag selection. * @private */ FileTable.prototype.shouldStartDragSelection_ = function(event) { // If the shift key is pressed, it should starts drag selection. if (event.shiftKey) return true; - // We don't support drag selection by touch. - if (event.sourceCapabilities && event.sourceCapabilities.firesTouchEvents) - return false; + + // If we're outside of the element list, start the drag selection. + if (!this.list.hasDragHitElement(event)) + return true; // If the position values are negative, it points the out of list. - // It should start the drag selection. var pos = DragSelector.getScrolledPosition(this.list, event); if (!pos) return false;
diff --git a/ui/message_center/views/notification_view_md.cc b/ui/message_center/views/notification_view_md.cc index 018d5e03..a8c663a 100644 --- a/ui/message_center/views/notification_view_md.cc +++ b/ui/message_center/views/notification_view_md.cc
@@ -1355,7 +1355,7 @@ views::View* target = static_cast<views::View*>(event.target()); const gfx::Point& location = event.location(); gfx::Point converted_location(location); - View::ConvertPointToWidget(target, &converted_location); + View::ConvertPointToTarget(target, this, &converted_location); std::unique_ptr<ui::Event> cloned_event = ui::Event::Clone(event); ui::LocatedEvent* cloned_located_event = cloned_event->AsLocatedEvent(); cloned_located_event->set_location(converted_location);