diff --git a/DEPS b/DEPS index 2f84dc9..faf734e 100644 --- a/DEPS +++ b/DEPS
@@ -145,11 +145,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': '9648b419f5cff80c62581ac90cd5ad4a68fd87b4', + 'skia_revision': '8566dda51b421a9c2c6a7e8659fe3948a1fab3c9', # 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': '7b861aca66ea8080a32eba6217f8833cdcc32a09', + 'v8_revision': '05137a762c9ecaad8c9fa555284b4f907e273e2d', # 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. @@ -161,11 +161,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': 'dadeb009a2977764ae927e5d942bee72ab5290ed', + 'swiftshader_revision': 'aad8cfca57fd78cfe8ad899d4718764f092f507a', # 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': '8133374cb7fee20ce5b765269fa11e4c35332251', + 'pdfium_revision': '4935770daa8e301c12f4e5d021b6124fc96dc28c', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. @@ -224,7 +224,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'feed_revision': 'f4372718f4cabd57efeab02f5726ed147f29768f', + 'feed_revision': '3c1942092f8caddf60396c2529d684b0374d94de', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_build-tools_version # and whatever else without interference from each other. @@ -284,7 +284,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'quiche_revision': '4abb566fbbc63df8fe7c1ac30b21632b9eb18d0c', + 'quiche_revision': 'fd3ee30e9b481016cf1a1b6d406e8cced75140be', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ios_webkit # and whatever else without interference from each other. @@ -484,7 +484,7 @@ }, 'src/ios/third_party/material_components_ios/src': { - 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '7c66ab5c14457a65db886d6450f23943e7d24711', + 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '795a3ae590022cd652dbd67260f0429110992d8a', 'condition': 'checkout_ios', }, @@ -825,7 +825,7 @@ # Build tools for Chrome OS. Note: This depends on third_party/pyelftools. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '13d55b39e183cdde6d2c088907c6b8b3405057e2', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '82c85d4f089f6c470fbc9a624d91f0302fceb6d0', 'condition': 'checkout_linux', }, @@ -840,7 +840,7 @@ # For Linux and Chromium OS. 'src/third_party/cros_system_api': { - 'url': Var('chromium_git') + '/chromiumos/platform2/system_api.git' + '@' + 'bcf5f02a0d0a077550a2ef30808965d4f065a0a4', + 'url': Var('chromium_git') + '/chromiumos/platform2/system_api.git' + '@' + 'd740747810e915c4795abde5b4d00eeae3308a52', 'condition': 'checkout_linux', }, @@ -850,7 +850,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '72fbaf4d465e86222c92a21283a0d7406ca05323', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '73b9263523ee68252313bd16a3a1396ada779f20', 'src/third_party/devtools-node-modules': Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'), @@ -1391,7 +1391,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + 'abaae129d9a0c6e1e092067e0b105475df43352e', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'f5e5d250bc85616e74487f8330ed8d99cc9cf84f', + Var('webrtc_git') + '/src.git' + '@' + 'fdf38802a684fcd90f3a2f8dd5597b12389e5394', 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d', @@ -1432,7 +1432,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@a65b81326a8afb6bacc83ae287df8a7e412eb65f', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@4dfd57b8be2c85bbac503adb7dbc94b9d866f98f', 'condition': 'checkout_src_internal', },
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 24f49ad..3ffb1e9 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py
@@ -714,7 +714,7 @@ 'base::ScopedMockTimeMessageLoopTaskRunner', ( 'ScopedMockTimeMessageLoopTaskRunner is deprecated. Prefer', - 'ScopedTaskEnvironment::TimeSource::MOCK_TIME. There are still a', + 'TaskEnvironment::TimeSource::MOCK_TIME. There are still a', 'few cases that may require a ScopedMockTimeMessageLoopTaskRunner', '(i.e. mocking the main MessageLoopForUI in browser_tests), but check', 'with gab@ first if you think you need it)',
diff --git a/android_webview/browser/aw_content_browser_client_unittest.cc b/android_webview/browser/aw_content_browser_client_unittest.cc index 925a6260..96e05630 100644 --- a/android_webview/browser/aw_content_browser_client_unittest.cc +++ b/android_webview/browser/aw_content_browser_client_unittest.cc
@@ -17,7 +17,7 @@ mojo::core::Init(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(AwContentBrowserClientTest, DisableCreatingThreadPool) {
diff --git a/android_webview/browser/aw_form_database_service_unittest.cc b/android_webview/browser/aw_form_database_service_unittest.cc index f31e02d..a6ba28d 100644 --- a/android_webview/browser/aw_form_database_service_unittest.cc +++ b/android_webview/browser/aw_form_database_service_unittest.cc
@@ -37,11 +37,11 @@ void TearDown() override { service_->Shutdown(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // The path to the temporary directory used for the test operations. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; JNIEnv* env_; std::unique_ptr<AwFormDatabaseService> service_;
diff --git a/android_webview/browser/aw_metrics_service_client_unittest.cc b/android_webview/browser/aw_metrics_service_client_unittest.cc index 0066f92..71c2c498 100644 --- a/android_webview/browser/aw_metrics_service_client_unittest.cc +++ b/android_webview/browser/aw_metrics_service_client_unittest.cc
@@ -65,7 +65,7 @@ ~AwMetricsServiceClientTest() override {} private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::TestSimpleTaskRunner> task_runner_; DISALLOW_COPY_AND_ASSIGN(AwMetricsServiceClientTest);
diff --git a/android_webview/browser/aw_print_manager.cc b/android_webview/browser/aw_print_manager.cc index 9cb41ca..43bc9a3 100644 --- a/android_webview/browser/aw_print_manager.cc +++ b/android_webview/browser/aw_print_manager.cc
@@ -102,7 +102,8 @@ void AwPrintManager::OnDidPrintDocument( content::RenderFrameHost* render_frame_host, - const PrintHostMsg_DidPrintDocument_Params& params) { + const PrintHostMsg_DidPrintDocument_Params& params, + std::unique_ptr<DelayedFrameDispatchHelper> helper) { if (params.document_cookie != cookie_) return; @@ -130,7 +131,18 @@ base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}) .get(), FROM_HERE, base::BindOnce(&SaveDataToFd, fd_, number_pages_, data), - std::move(pdf_writing_done_callback_)); + base::BindOnce(&AwPrintManager::OnDidPrintDocumentWritingDone, + std::move(pdf_writing_done_callback_), std::move(helper))); +} + +// static +void AwPrintManager::OnDidPrintDocumentWritingDone( + PdfWritingDoneCallback callback, + std::unique_ptr<DelayedFrameDispatchHelper> helper, + int page_count) { + if (callback) + std::move(callback).Run(page_count); + helper->SendCompleted(); } WEB_CONTENTS_USER_DATA_KEY_IMPL(AwPrintManager)
diff --git a/android_webview/browser/aw_print_manager.h b/android_webview/browser/aw_print_manager.h index 6609496..419ddd8 100644 --- a/android_webview/browser/aw_print_manager.h +++ b/android_webview/browser/aw_print_manager.h
@@ -45,13 +45,19 @@ // printing::PrintManager: void OnDidPrintDocument( content::RenderFrameHost* render_frame_host, - const PrintHostMsg_DidPrintDocument_Params& params) override; + const PrintHostMsg_DidPrintDocument_Params& params, + std::unique_ptr<DelayedFrameDispatchHelper> helper) override; void OnGetDefaultPrintSettings(content::RenderFrameHost* render_frame_host, IPC::Message* reply_msg) override; void OnScriptedPrint(content::RenderFrameHost* render_frame_host, const PrintHostMsg_ScriptedPrint_Params& params, IPC::Message* reply_msg) override; + static void OnDidPrintDocumentWritingDone( + PdfWritingDoneCallback callback, + std::unique_ptr<DelayedFrameDispatchHelper> helper, + int page_count); + const std::unique_ptr<printing::PrintSettings> settings_; // The file descriptor into which the PDF of the document will be written.
diff --git a/android_webview/browser/network_service/android_stream_reader_url_loader_unittest.cc b/android_webview/browser/network_service/android_stream_reader_url_loader_unittest.cc index f4e1245c..09ef99d 100644 --- a/android_webview/browser/network_service/android_stream_reader_url_loader_unittest.cc +++ b/android_webview/browser/network_service/android_stream_reader_url_loader_unittest.cc
@@ -233,7 +233,7 @@ return std::string(buffer.data(), buffer.size()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(AndroidStreamReaderURLLoaderTest); };
diff --git a/android_webview/browser/network_service/aw_proxying_restricted_cookie_manager.cc b/android_webview/browser/network_service/aw_proxying_restricted_cookie_manager.cc index 792b081c..09c76c5 100644 --- a/android_webview/browser/network_service/aw_proxying_restricted_cookie_manager.cc +++ b/android_webview/browser/network_service/aw_proxying_restricted_cookie_manager.cc
@@ -66,13 +66,15 @@ void AwProxyingRestrictedCookieManager::GetAllForUrl( const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, network::mojom::CookieManagerGetOptionsPtr options, GetAllForUrlCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (AllowCookies(url, site_for_cookies)) { underlying_restricted_cookie_manager_->GetAllForUrl( - url, site_for_cookies, std::move(options), std::move(callback)); + url, site_for_cookies, top_frame_origin, std::move(options), + std::move(callback)); } else { std::move(callback).Run(std::vector<net::CanonicalCookie>()); } @@ -82,12 +84,13 @@ const net::CanonicalCookie& cookie, const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, SetCanonicalCookieCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (AllowCookies(url, site_for_cookies)) { underlying_restricted_cookie_manager_->SetCanonicalCookie( - cookie, url, site_for_cookies, std::move(callback)); + cookie, url, site_for_cookies, top_frame_origin, std::move(callback)); } else { std::move(callback).Run(false); } @@ -96,6 +99,7 @@ void AwProxyingRestrictedCookieManager::AddChangeListener( const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, network::mojom::CookieChangeListenerPtr listener, AddChangeListenerCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); @@ -110,20 +114,21 @@ mojo::MakeRequest(&proxy_listener_ptr)); underlying_restricted_cookie_manager_->AddChangeListener( - url, site_for_cookies, std::move(proxy_listener_ptr), + url, site_for_cookies, top_frame_origin, std::move(proxy_listener_ptr), std::move(callback)); } void AwProxyingRestrictedCookieManager::SetCookieFromString( const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, const std::string& cookie, SetCookieFromStringCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (AllowCookies(url, site_for_cookies)) { underlying_restricted_cookie_manager_->SetCookieFromString( - url, site_for_cookies, cookie, std::move(callback)); + url, site_for_cookies, top_frame_origin, cookie, std::move(callback)); } else { std::move(callback).Run(); } @@ -132,12 +137,13 @@ void AwProxyingRestrictedCookieManager::GetCookiesString( const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, GetCookiesStringCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (AllowCookies(url, site_for_cookies)) { underlying_restricted_cookie_manager_->GetCookiesString( - url, site_for_cookies, std::move(callback)); + url, site_for_cookies, top_frame_origin, std::move(callback)); } else { std::move(callback).Run(""); } @@ -146,6 +152,7 @@ void AwProxyingRestrictedCookieManager::CookiesEnabledFor( const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, CookiesEnabledForCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); std::move(callback).Run(AllowCookies(url, site_for_cookies));
diff --git a/android_webview/browser/network_service/aw_proxying_restricted_cookie_manager.h b/android_webview/browser/network_service/aw_proxying_restricted_cookie_manager.h index 64788ab..86e20f6 100644 --- a/android_webview/browser/network_service/aw_proxying_restricted_cookie_manager.h +++ b/android_webview/browser/network_service/aw_proxying_restricted_cookie_manager.h
@@ -35,28 +35,34 @@ // network::mojom::RestrictedCookieManager interface: void GetAllForUrl(const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, network::mojom::CookieManagerGetOptionsPtr options, GetAllForUrlCallback callback) override; void SetCanonicalCookie(const net::CanonicalCookie& cookie, const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, SetCanonicalCookieCallback callback) override; void AddChangeListener(const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, network::mojom::CookieChangeListenerPtr listener, AddChangeListenerCallback callback) override; void SetCookieFromString(const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, const std::string& cookie, SetCookieFromStringCallback callback) override; void GetCookiesString(const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, GetCookiesStringCallback callback) override; void CookiesEnabledFor(const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, CookiesEnabledForCallback callback) override; // This one is internal.
diff --git a/android_webview/browser/safe_browsing/aw_safe_browsing_whitelist_manager_unittest.cc b/android_webview/browser/safe_browsing/aw_safe_browsing_whitelist_manager_unittest.cc index e391e9ba..0eda07a 100644 --- a/android_webview/browser/safe_browsing/aw_safe_browsing_whitelist_manager_unittest.cc +++ b/android_webview/browser/safe_browsing/aw_safe_browsing_whitelist_manager_unittest.cc
@@ -30,8 +30,8 @@ void SetWhitelist(std::vector<std::string>&& whitelist, bool expected); - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<AwSafeBrowsingWhitelistManager> wm_; };
diff --git a/android_webview/java/src/org/chromium/android_webview/AwGeolocationPermissions.java b/android_webview/java/src/org/chromium/android_webview/AwGeolocationPermissions.java index bc85228..3fec1c8 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwGeolocationPermissions.java +++ b/android_webview/java/src/org/chromium/android_webview/AwGeolocationPermissions.java
@@ -6,6 +6,7 @@ import android.content.SharedPreferences; +import org.chromium.base.StrictModeContext; import org.chromium.base.task.PostTask; import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.net.GURLUtils; @@ -132,14 +133,16 @@ /* package */ static void migrateGeolocationPreferences( SharedPreferences oldPrefs, SharedPreferences newPrefs) { - SharedPreferences.Editor oldPrefsEditor = oldPrefs.edit(); + try (StrictModeContext ignored = StrictModeContext.allowDiskWrites()) { + SharedPreferences.Editor oldPrefsEditor = oldPrefs.edit(); - SharedPreferences.Editor newPrefsEditor = newPrefs.edit(); + SharedPreferences.Editor newPrefsEditor = newPrefs.edit(); - for (String name : oldPrefs.getAll().keySet()) { - if (name.startsWith(AwGeolocationPermissions.PREF_PREFIX)) { - newPrefsEditor.putBoolean(name, oldPrefs.getBoolean(name, false)).apply(); - oldPrefsEditor.remove(name).apply(); + for (String name : oldPrefs.getAll().keySet()) { + if (name.startsWith(AwGeolocationPermissions.PREF_PREFIX)) { + newPrefsEditor.putBoolean(name, oldPrefs.getBoolean(name, false)).apply(); + oldPrefsEditor.remove(name).apply(); + } } } }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/memory_metrics_logger_test.cc b/android_webview/javatests/src/org/chromium/android_webview/test/memory_metrics_logger_test.cc index 2ccd315..16ab49b 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/memory_metrics_logger_test.cc +++ b/android_webview/javatests/src/org/chromium/android_webview/test/memory_metrics_logger_test.cc
@@ -19,8 +19,8 @@ return false; TestTimeouts::Initialize(); - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY); base::RunLoop run_loop; bool result = false; memory_metrics_logger->ScheduleRecordForTesting(
diff --git a/android_webview/lib/DEPS b/android_webview/lib/DEPS index b22ac7b..06f115c 100644 --- a/android_webview/lib/DEPS +++ b/android_webview/lib/DEPS
@@ -9,7 +9,6 @@ "+gin/public", "+gin/v8_initializer.h", "+media/base/media_switches.h", # For media command line switches. - "+mojo/core/embedder/embedder.h", "+ui/events/gesture_detection", "+ui/gl", ]
diff --git a/android_webview/lib/webview_tests.cc b/android_webview/lib/webview_tests.cc index 8c8dcd2..a424702 100644 --- a/android_webview/lib/webview_tests.cc +++ b/android_webview/lib/webview_tests.cc
@@ -6,7 +6,6 @@ #include "base/command_line.h" #include "base/test/test_suite.h" #include "content/public/common/content_switches.h" -#include "mojo/core/embedder/embedder.h" #include "ui/gl/gl_surface.h" #include "ui/gl/test/gl_surface_test_support.h" @@ -15,7 +14,5 @@ switches::kSingleProcess); gl::GLSurfaceTestSupport::InitializeNoExtensionsOneOff(); android_webview::GpuServiceWebView::GetInstance(); - base::TestSuite test_suite(argc, argv); - mojo::core::Init(); - return test_suite.Run(); + return base::TestSuite(argc, argv).Run(); }
diff --git a/android_webview/test/BUILD.gn b/android_webview/test/BUILD.gn index ef48a3421..6f706343 100644 --- a/android_webview/test/BUILD.gn +++ b/android_webview/test/BUILD.gn
@@ -353,7 +353,6 @@ "//components/prefs:test_support", "//content:content", "//content/test:test_support", - "//mojo/core/embedder", "//net:net", "//net:test_support", "//ui/base:ui_base_jni_headers",
diff --git a/android_webview/tools/system_webview_shell/BUILD.gn b/android_webview/tools/system_webview_shell/BUILD.gn index f02246bd..57b8139 100644 --- a/android_webview/tools/system_webview_shell/BUILD.gn +++ b/android_webview/tools/system_webview_shell/BUILD.gn
@@ -24,6 +24,7 @@ "apk/src/org/chromium/webview_shell/StartupTimeActivity.java", "apk/src/org/chromium/webview_shell/TelemetryActivity.java", "apk/src/org/chromium/webview_shell/TelemetryMemoryPressureActivity.java", + "apk/src/org/chromium/webview_shell/WebPlatformTestsActivity.java", "apk/src/org/chromium/webview_shell/WebViewAnimationTestActivity.java", "apk/src/org/chromium/webview_shell/WebViewBrowserActivity.java", "apk/src/org/chromium/webview_shell/WebViewCreateDestroyActivity.java",
diff --git a/android_webview/tools/system_webview_shell/apk/AndroidManifest.xml b/android_webview/tools/system_webview_shell/apk/AndroidManifest.xml index 8d885d98..e1df6d3 100644 --- a/android_webview/tools/system_webview_shell/apk/AndroidManifest.xml +++ b/android_webview/tools/system_webview_shell/apk/AndroidManifest.xml
@@ -129,6 +129,12 @@ android:exported="true"> </activity> + <activity + android:name="org.chromium.webview_shell.WebPlatformTestsActivity" + android:noHistory="true" + android:exported="true"> + </activity> + <uses-library android:name="android.test.runner" /> </application> </manifest>
diff --git a/android_webview/tools/system_webview_shell/apk/res/anim/slide_down.xml b/android_webview/tools/system_webview_shell/apk/res/anim/slide_down.xml new file mode 100644 index 0000000..3683f4c --- /dev/null +++ b/android_webview/tools/system_webview_shell/apk/res/anim/slide_down.xml
@@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false"> + <translate + android:fromXDelta="0%" android:toXDelta="0%" + android:fromYDelta="0%" android:toYDelta="100%" + android:duration="500"/> +</set> \ No newline at end of file
diff --git a/android_webview/tools/system_webview_shell/apk/res/anim/slide_up.xml b/android_webview/tools/system_webview_shell/apk/res/anim/slide_up.xml new file mode 100644 index 0000000..c27cf36 --- /dev/null +++ b/android_webview/tools/system_webview_shell/apk/res/anim/slide_up.xml
@@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false"> + <translate + android:fromXDelta="0%" android:toXDelta="0%" + android:fromYDelta="100%" android:toYDelta="0%" + android:duration="500"/> +</set> \ No newline at end of file
diff --git a/android_webview/tools/system_webview_shell/apk/res/layout/activity_web_platform_tests.xml b/android_webview/tools/system_webview_shell/apk/res/layout/activity_web_platform_tests.xml new file mode 100644 index 0000000..5104b35 --- /dev/null +++ b/android_webview/tools/system_webview_shell/apk/res/layout/activity_web_platform_tests.xml
@@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:weightSum="1"> + <WebView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/webview" + android:layout_gravity="center_horizontal" + android:layout_alignParentStart="true" + android:layout_marginStart="0dp" + /> + <RelativeLayout + android:visibility="invisible" + android:background="@android:color/black" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/childLayout" + android:weightSum="1"> + <LinearLayout + android:orientation="horizontal" + android:layout_width="match_parent" + android:padding="0dp" + android:layout_height="wrap_content" + android:layout_alignParentStart="true" + android:layout_marginStart="0dp" + android:layout_marginTop="0dp" + android:layout_alignParentTop="true" + android:id="@+id/childLinearLayout"> + <Button + android:text="@string/close_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="5dp" + android:padding="0dp" + android:paddingTop="0dp" + android:id="@+id/childCloseButton"/> + <TextView + android:id="@+id/childTitleText" + android:layout_marginTop="5dp" + android:layout_marginBottom="5dp" + android:layout_marginStart="0dp" + android:layout_marginEnd="65dp" + android:layout_width="match_parent" + android:layout_height="30dp" + android:gravity="center" + android:scrollHorizontally="true" + android:ellipsize="end" + android:maxLines="1" + android:textStyle="bold" + /> + </LinearLayout> + <RelativeLayout + android:layout_below="@id/childLinearLayout" + android:background="@android:color/holo_blue_dark" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/mainBrowserLayout" + android:weightSum="1"> + </RelativeLayout> + </RelativeLayout> +</RelativeLayout>
diff --git a/android_webview/tools/system_webview_shell/apk/res/values/strings.xml b/android_webview/tools/system_webview_shell/apk/res/values/strings.xml index c39328a..a13881b 100644 --- a/android_webview/tools/system_webview_shell/apk/res/values/strings.xml +++ b/android_webview/tools/system_webview_shell/apk/res/values/strings.xml
@@ -28,4 +28,7 @@ <string name="rotate_button">Rotate</string> <string name="scale_button">Scale</string> <string name="translate_button">Translate</string> + + <!-- activity_web_platform_tests strings --> + <string name="close_button">close</string> </resources>
diff --git a/android_webview/tools/system_webview_shell/apk/src/org/chromium/webview_shell/WebPlatformTestsActivity.java b/android_webview/tools/system_webview_shell/apk/src/org/chromium/webview_shell/WebPlatformTestsActivity.java new file mode 100644 index 0000000..afe067c --- /dev/null +++ b/android_webview/tools/system_webview_shell/apk/src/org/chromium/webview_shell/WebPlatformTestsActivity.java
@@ -0,0 +1,140 @@ +// Copyright 2019 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.webview_shell; + +import android.app.Activity; +import android.os.Bundle; +import android.os.Message; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.Button; +import android.widget.RelativeLayout; +import android.widget.TextView; + +/** + * A main activity to handle WPT requests. + * + * This is currently implemented to support minimum viable implementation such that + * Multi-window and JavaScript are enabled by default. + * + * TODO(crbug.com/994939): It is currently implemented to support only a single child. Although not + * explicitly stated, there may be some WPT tests that require more than one + * children, which is not supported for now. + */ +public class WebPlatformTestsActivity extends Activity { + private WebView mWebView; + private RelativeLayout mChildLayout; + private RelativeLayout mBrowserLayout; + private Button mChildCloseButton; + private TextView mChildTitleText; + + private class MultiWindowWebChromeClient extends WebChromeClient { + @Override + public boolean onCreateWindow( + WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) { + // Make the child webview's layout visible + mChildLayout.setVisibility(View.VISIBLE); + + // Now create a new WebView + WebView newView = new WebView(WebPlatformTestsActivity.this); + WebSettings settings = newView.getSettings(); + setUpWebSettings(settings); + settings.setUseWideViewPort(false); + newView.setWebViewClient(new WebViewClient() { + @Override + public void onPageFinished(WebView view, String url) { + // Once the view has loaded, display its title for debugging. + mChildTitleText.setText(view.getTitle()); + } + }); + // Add the new WebView to the layout + newView.setLayoutParams(new RelativeLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); + mBrowserLayout.addView(newView); + // Tell the transport about the new view + WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj; + transport.setWebView(newView); + resultMsg.sendToTarget(); + + // Slide the new WebView up into view + Animation slideUp = + AnimationUtils.loadAnimation(WebPlatformTestsActivity.this, R.anim.slide_up); + mChildLayout.startAnimation(slideUp); + return true; + } + + @Override + public void onCloseWindow(WebView webView) { + mBrowserLayout.removeView(webView); + webView.destroy(); + } + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_web_platform_tests); + setUpWidgets(); + // This is equivalent to Chrome's WPT setup. + setUpWebView("about:blank"); + } + + private void setUpWidgets() { + mBrowserLayout = findViewById(R.id.mainBrowserLayout); + mChildLayout = findViewById(R.id.childLayout); + mChildTitleText = findViewById(R.id.childTitleText); + mChildCloseButton = findViewById(R.id.childCloseButton); + mChildCloseButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + switch (view.getId()) { + case R.id.childCloseButton: + closeChild(); + break; + } + } + }); + } + + private void setUpWebSettings(WebSettings settings) { + settings.setJavaScriptEnabled(true); + // Enable multi-window. + settings.setJavaScriptCanOpenWindowsAutomatically(true); + settings.setSupportMultipleWindows(true); + } + + private void setUpWebView(String url) { + mWebView = findViewById(R.id.webview); + setUpWebSettings(mWebView.getSettings()); + + mWebView.setWebChromeClient(new MultiWindowWebChromeClient()); + + mWebView.loadUrl(url); + } + + private void closeChild() { + Animation slideDown = AnimationUtils.loadAnimation(this, R.anim.slide_down); + mChildLayout.startAnimation(slideDown); + slideDown.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) {} + + @Override + public void onAnimationEnd(Animation animation) { + mChildTitleText.setText(""); + mChildLayout.setVisibility(View.INVISIBLE); + } + + @Override + public void onAnimationRepeat(Animation animation) {} + }); + } +}
diff --git a/ash/app_list/app_list_presenter_delegate_impl.cc b/ash/app_list/app_list_presenter_delegate_impl.cc index 584f24b8..6bfb45b 100644 --- a/ash/app_list/app_list_presenter_delegate_impl.cc +++ b/ash/app_list/app_list_presenter_delegate_impl.cc
@@ -235,7 +235,6 @@ !app_list::switches::ShouldNotDismissOnBlur() && !IsTabletMode()) { const aura::Window* status_window = shelf->shelf_widget()->status_area_widget()->GetNativeWindow(); - const aura::Window* shelf_window = shelf->shelf_widget()->GetNativeWindow(); // Don't dismiss the auto-hide shelf if event happened in status area. Then // the event can still be propagated to the status area tray to open the // corresponding tray bubble. @@ -243,8 +242,10 @@ if (status_window && status_window->Contains(target)) auto_hide_lock.emplace(shelf); - // Keep app list opened if event happened in the shelf area. - if (!shelf_window || !shelf_window->Contains(target)) + // Keep the app list open if the event happened in the shelf area. + const aura::Window* hotseat_window = + shelf->shelf_widget()->hotseat_widget()->GetNativeWindow(); + if (!hotseat_window || !hotseat_window->Contains(target)) presenter_->Dismiss(event->time_stamp()); }
diff --git a/ash/assistant/assistant_notification_controller_unittest.cc b/ash/assistant/assistant_notification_controller_unittest.cc index be53670..8e3e0d6 100644 --- a/ash/assistant/assistant_notification_controller_unittest.cc +++ b/ash/assistant/assistant_notification_controller_unittest.cc
@@ -61,7 +61,7 @@ class AssistantNotificationControllerTest : public AshTestBase { protected: AssistantNotificationControllerTest() - : AshTestBase(base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : AshTestBase(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~AssistantNotificationControllerTest() override = default; void SetUp() override { @@ -119,7 +119,7 @@ } void ForwardTimeInMs(int time_in_ms) { - scoped_task_environment_->FastForwardBy( + task_environment_->FastForwardBy( base::TimeDelta::FromMilliseconds(time_in_ms)); }
diff --git a/ash/autoclick/autoclick_unittest.cc b/ash/autoclick/autoclick_unittest.cc index 1c8b0e6..dc0d480 100644 --- a/ash/autoclick/autoclick_unittest.cc +++ b/ash/autoclick/autoclick_unittest.cc
@@ -103,7 +103,7 @@ class AutoclickTest : public AshTestBase { public: AutoclickTest() - : AshTestBase(base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : AshTestBase(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~AutoclickTest() override = default; void SetUp() override { @@ -139,7 +139,7 @@ } void FastForwardBy(int milliseconds) { - scoped_task_environment_->FastForwardBy( + task_environment_->FastForwardBy( base::TimeDelta::FromMilliseconds(milliseconds)); }
diff --git a/ash/detachable_base/detachable_base_handler_unittest.cc b/ash/detachable_base/detachable_base_handler_unittest.cc index 03a2f00..c8a3dd4e 100644 --- a/ash/detachable_base/detachable_base_handler_unittest.cc +++ b/ash/detachable_base/detachable_base_handler_unittest.cc
@@ -134,7 +134,7 @@ UserInfo default_user_; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestingPrefServiceSimple local_state_;
diff --git a/ash/display/display_color_manager_unittest.cc b/ash/display/display_color_manager_unittest.cc index b9e17a21..1ebcba8 100644 --- a/ash/display/display_color_manager_unittest.cc +++ b/ash/display/display_color_manager_unittest.cc
@@ -144,7 +144,7 @@ ~DisplayColorManagerTest() override = default; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::ScopedPathOverride> path_override_; base::FilePath color_path_; std::unique_ptr<display::test::ActionLogger> log_;
diff --git a/ash/focus_cycler_unittest.cc b/ash/focus_cycler_unittest.cc index ab4c2e2..6958964 100644 --- a/ash/focus_cycler_unittest.cc +++ b/ash/focus_cycler_unittest.cc
@@ -70,7 +70,7 @@ GetStatusAreaWidgetDelegate(GetPrimaryStatusAreaWidget()) ->SetFocusCyclerForTesting(nullptr); - shelf_widget()->SetFocusCycler(nullptr); + shelf_widget()->hotseat_widget()->SetFocusCycler(nullptr); focus_cycler_.reset(); @@ -97,7 +97,7 @@ void InstallFocusCycleOnShelf() { // Add the shelf. - shelf_widget()->SetFocusCycler(focus_cycler()); + shelf_widget()->hotseat_widget()->SetFocusCycler(focus_cycler()); } private: @@ -133,7 +133,7 @@ // Cycle focus to the shelf. focus_cycler()->RotateFocus(FocusCycler::FORWARD); - EXPECT_TRUE(shelf_widget()->IsActive()); + EXPECT_TRUE(shelf_widget()->hotseat_widget()->IsActive()); // Cycle focus to the browser. focus_cycler()->RotateFocus(FocusCycler::FORWARD); @@ -152,7 +152,7 @@ // Cycle focus to the shelf. focus_cycler()->RotateFocus(FocusCycler::BACKWARD); - EXPECT_TRUE(shelf_widget()->IsActive()); + EXPECT_TRUE(shelf_widget()->hotseat_widget()->IsActive()); // Cycle focus to the status area. focus_cycler()->RotateFocus(FocusCycler::BACKWARD); @@ -175,7 +175,7 @@ // Cycle focus to the shelf. focus_cycler()->RotateFocus(FocusCycler::BACKWARD); - EXPECT_TRUE(shelf_widget()->IsActive()); + EXPECT_TRUE(shelf_widget()->hotseat_widget()->IsActive()); // Cycle focus to the status area. focus_cycler()->RotateFocus(FocusCycler::BACKWARD); @@ -191,7 +191,7 @@ // Cycle focus to the shelf. focus_cycler()->RotateFocus(FocusCycler::FORWARD); - EXPECT_TRUE(shelf_widget()->IsActive()); + EXPECT_TRUE(shelf_widget()->hotseat_widget()->IsActive()); // Cycle focus to the browser. focus_cycler()->RotateFocus(FocusCycler::FORWARD); @@ -204,7 +204,7 @@ InstallFocusCycleOnShelf(); // Add the shelf and focus it. - focus_cycler()->FocusWidget(shelf_widget()); + focus_cycler()->FocusWidget(shelf_widget()->hotseat_widget()); // Cycle focus to the status area. focus_cycler()->RotateFocus(FocusCycler::FORWARD); @@ -212,7 +212,7 @@ // Cycle focus to the shelf. focus_cycler()->RotateFocus(FocusCycler::FORWARD); - EXPECT_TRUE(shelf_widget()->IsActive()); + EXPECT_TRUE(shelf_widget()->hotseat_widget()->IsActive()); // Cycle focus to the status area. focus_cycler()->RotateFocus(FocusCycler::FORWARD); @@ -220,7 +220,7 @@ // Cycle focus to the shelf. focus_cycler()->RotateFocus(FocusCycler::BACKWARD); - EXPECT_TRUE(shelf_widget()->IsActive()); + EXPECT_TRUE(shelf_widget()->hotseat_widget()->IsActive()); // Cycle focus to the status area. focus_cycler()->RotateFocus(FocusCycler::BACKWARD); @@ -231,7 +231,7 @@ TEST_F(FocusCyclerTest, Shelf_CycleFocusForward) { SetUpTrayFocusCycle(); InstallFocusCycleOnShelf(); - shelf_widget()->Hide(); + shelf_widget()->hotseat_widget()->Hide(); // Create two test windows. std::unique_ptr<Window> window0(CreateTestWindowInShellWithId(0)); @@ -256,7 +256,7 @@ TEST_F(FocusCyclerTest, Shelf_CycleFocusBackwardInvisible) { SetUpTrayFocusCycle(); InstallFocusCycleOnShelf(); - shelf_widget()->Hide(); + shelf_widget()->hotseat_widget()->Hide(); // Create a single test window. std::unique_ptr<Window> window0(CreateTestWindowInShellWithId(0)); @@ -330,7 +330,7 @@ // Cycle focus to the shelf. focus_cycler()->RotateFocus(FocusCycler::FORWARD); - EXPECT_TRUE(shelf_widget()->IsActive()); + EXPECT_TRUE(shelf_widget()->hotseat_widget()->IsActive()); // Cycle focus to the first pane in the browser. focus_cycler()->RotateFocus(FocusCycler::FORWARD); @@ -358,7 +358,7 @@ // Back to the shelf. focus_cycler()->RotateFocus(FocusCycler::BACKWARD); - EXPECT_TRUE(shelf_widget()->IsActive()); + EXPECT_TRUE(shelf_widget()->hotseat_widget()->IsActive()); // Back to the status area. focus_cycler()->RotateFocus(FocusCycler::BACKWARD); @@ -395,15 +395,17 @@ wm::ActivateWindow(window.get()); EXPECT_TRUE(wm::IsActiveWindow(window.get())); - // Cycle focus to the status area. - Shell::Get()->focus_cycler()->RotateFocus(FocusCycler::FORWARD); - EXPECT_FALSE(wm::IsActiveWindow(window.get())); - // Cycle focus to the navigation widget. Shell::Get()->focus_cycler()->RotateFocus(FocusCycler::FORWARD); + EXPECT_TRUE(shelf_widget()->navigation_widget()->IsActive()); - // Cycle focus to the shelf. + // Cycle focus to the status area. Shell::Get()->focus_cycler()->RotateFocus(FocusCycler::FORWARD); + EXPECT_TRUE(GetPrimaryStatusAreaWidget()->IsActive()); + + // Cycle focus to the hotseat widget. + Shell::Get()->focus_cycler()->RotateFocus(FocusCycler::FORWARD); + EXPECT_TRUE(shelf_widget()->hotseat_widget()->IsActive()); // Cycle focus should go back to the browser. Shell::Get()->focus_cycler()->RotateFocus(FocusCycler::FORWARD);
diff --git a/ash/keyboard/ui/keyboard_ukm_recorder_unittest.cc b/ash/keyboard/ui/keyboard_ukm_recorder_unittest.cc index 558b1a01..a66af4f 100644 --- a/ash/keyboard/ui/keyboard_ukm_recorder_unittest.cc +++ b/ash/keyboard/ui/keyboard_ukm_recorder_unittest.cc
@@ -12,7 +12,7 @@ namespace keyboard { TEST(KeyboardUkmRecorderTest, RecordUkmWithEmptySource) { - base::test::ScopedTaskEnvironment env; + base::test::TaskEnvironment env; ukm::TestAutoSetUkmRecorder test_recorder; test_recorder.EnableRecording(false /* extensions */); @@ -25,7 +25,7 @@ } TEST(KeyboardUkmRecorderTest, RecordUkmWithNavigationId) { - base::test::ScopedTaskEnvironment env; + base::test::TaskEnvironment env; ukm::TestAutoSetUkmRecorder test_recorder; test_recorder.EnableRecording(false /* extensions */);
diff --git a/ash/public/cpp/default_scale_factor_retriever_unittest.cc b/ash/public/cpp/default_scale_factor_retriever_unittest.cc index 2a9a82a..0eb3eea 100644 --- a/ash/public/cpp/default_scale_factor_retriever_unittest.cc +++ b/ash/public/cpp/default_scale_factor_retriever_unittest.cc
@@ -73,7 +73,7 @@ ~DefaultScaleFactorRetrieverTest() override = default; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(DefaultScaleFactorRetrieverTest); };
diff --git a/ash/public/cpp/voice_interaction_controller_unittest.cc b/ash/public/cpp/voice_interaction_controller_unittest.cc index 281c108..fe4d0a3 100644 --- a/ash/public/cpp/voice_interaction_controller_unittest.cc +++ b/ash/public/cpp/voice_interaction_controller_unittest.cc
@@ -72,8 +72,7 @@ class VoiceInteractionControllerTest : public testing::Test { public: VoiceInteractionControllerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~VoiceInteractionControllerTest() override = default; void SetUp() override { @@ -90,7 +89,7 @@ TestVoiceInteractionObserver* observer() { return observer_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<VoiceInteractionController> controller_; std::unique_ptr<TestVoiceInteractionObserver> observer_;
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index e249a272..560ca4a 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc
@@ -878,6 +878,11 @@ aura::Window* shelf_container = GetContainer(kShellWindowId_ShelfContainer); shelf_container->SetEventTargeter( std::make_unique<ShelfWindowTargeter>(shelf_container, shelf_.get())); + aura::Window* shelf_control_container = + GetContainer(kShellWindowId_ShelfControlContainer); + shelf_control_container->SetEventTargeter( + std::make_unique<ShelfWindowTargeter>(shelf_control_container, + shelf_.get())); aura::Window* status_container = GetContainer(kShellWindowId_StatusContainer); status_container->SetEventTargeter( std::make_unique<ShelfWindowTargeter>(status_container, shelf_.get()));
diff --git a/ash/shelf/hotseat_widget.cc b/ash/shelf/hotseat_widget.cc index f6a9c28..933d8da 100644 --- a/ash/shelf/hotseat_widget.cc +++ b/ash/shelf/hotseat_widget.cc
@@ -4,28 +4,141 @@ #include "ash/shelf/hotseat_widget.h" +#include "ash/focus_cycler.h" +#include "ash/keyboard/ui/keyboard_ui_controller.h" #include "ash/public/cpp/shelf_model.h" +#include "ash/shelf/scrollable_shelf_view.h" #include "ash/shelf/shelf_constants.h" +#include "ash/shelf/shelf_navigation_widget.h" #include "ash/shelf/shelf_view.h" +#include "ash/shelf/shelf_widget.h" +#include "ash/system/status_area_widget.h" +#include "chromeos/constants/chromeos_switches.h" +#include "ui/views/layout/fill_layout.h" +#include "ui/views/widget/widget_delegate.h" namespace ash { +namespace { -HotseatWidget::HotseatWidget(Shelf* shelf, ShelfView* shelf_view) - : shelf_view_(shelf_view) { - DCHECK(shelf_view_); +bool IsScrollableShelfEnabled() { + return chromeos::switches::ShouldShowScrollableShelf(); } -void HotseatWidget::Initialize(aura::Window* container) { +} // namespace + +class HotseatWidget::DelegateView : public views::WidgetDelegateView { + public: + explicit DelegateView() {} + ~DelegateView() override {} + + // views::WidgetDelegateView: + bool CanActivate() const override; + + void set_focus_cycler(FocusCycler* focus_cycler) { + focus_cycler_ = focus_cycler; + } + + private: + FocusCycler* focus_cycler_ = nullptr; + + DISALLOW_COPY_AND_ASSIGN(DelegateView); +}; + +bool HotseatWidget::DelegateView::CanActivate() const { + // We don't want mouse clicks to activate us, but we need to allow + // activation when the user is using the keyboard (FocusCycler). + return focus_cycler_ && focus_cycler_->widget_activating() == GetWidget(); +} + +HotseatWidget::HotseatWidget() : delegate_view_(new DelegateView()) {} + +void HotseatWidget::Initialize(aura::Window* container, Shelf* shelf) { DCHECK(container); + DCHECK(shelf); views::Widget::InitParams params( views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); params.name = "HotseatWidget"; + params.delegate = delegate_view_; params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; params.parent = container; Init(std::move(params)); set_focus_on_creation(false); GetFocusManager()->set_arrow_key_traversal_enabled_for_widget(true); + + if (IsScrollableShelfEnabled()) { + scrollable_shelf_view_ = GetContentsView()->AddChildView( + std::make_unique<ScrollableShelfView>(ShelfModel::Get(), shelf)); + scrollable_shelf_view_->Init(); + } else { + // The shelf view observes the shelf model and creates icons as items are + // added to the model. + shelf_view_ = GetContentsView()->AddChildView( + std::make_unique<ShelfView>(ShelfModel::Get(), shelf)); + shelf_view_->Init(); + } + + delegate_view_->SetLayoutManager(std::make_unique<views::FillLayout>()); +} + +void HotseatWidget::OnMouseEvent(ui::MouseEvent* event) { + if (event->type() == ui::ET_MOUSE_PRESSED) + keyboard::KeyboardUIController::Get()->HideKeyboardImplicitlyByUser(); + views::Widget::OnMouseEvent(event); +} + +void HotseatWidget::OnGestureEvent(ui::GestureEvent* event) { + if (event->type() == ui::ET_GESTURE_TAP_DOWN) + keyboard::KeyboardUIController::Get()->HideKeyboardImplicitlyByUser(); + views::Widget::OnGestureEvent(event); +} + +bool HotseatWidget::OnNativeWidgetActivationChanged(bool active) { + if (!Widget::OnNativeWidgetActivationChanged(active)) + return false; + if (active) + GetShelfView()->SetPaneFocusAndFocusDefault(); + return true; +} + +ShelfView* HotseatWidget::GetShelfView() { + if (IsScrollableShelfEnabled()) { + DCHECK(scrollable_shelf_view_); + return scrollable_shelf_view_->shelf_view(); + } + + DCHECK(shelf_view_); + return shelf_view_; +} + +const ShelfView* HotseatWidget::GetShelfView() const { + return const_cast<const ShelfView*>( + const_cast<HotseatWidget*>(this)->GetShelfView()); +} + +bool HotseatWidget::IsShowingOverflowBubble() const { + return GetShelfView()->IsShowingOverflowBubble(); +} + +void HotseatWidget::FocusOverflowShelf(bool last_element) { + if (!IsShowingOverflowBubble()) + return; + Shell::Get()->focus_cycler()->FocusWidget( + GetShelfView()->overflow_bubble()->bubble_view()->GetWidget()); + views::View* to_focus = + GetShelfView()->overflow_shelf()->FindFirstOrLastFocusableChild( + last_element); + to_focus->RequestFocus(); +} + +void HotseatWidget::FocusFirstOrLastFocusableChild(bool last) { + GetShelfView()->FindFirstOrLastFocusableChild(last)->RequestFocus(); +} + +void HotseatWidget::SetFocusCycler(FocusCycler* focus_cycler) { + delegate_view_->set_focus_cycler(focus_cycler); + if (focus_cycler) + focus_cycler->AddWidget(this); } } // namespace ash
diff --git a/ash/shelf/hotseat_widget.h b/ash/shelf/hotseat_widget.h index b646a888..2008b2b73 100644 --- a/ash/shelf/hotseat_widget.h +++ b/ash/shelf/hotseat_widget.h
@@ -9,22 +9,50 @@ #include "ui/views/widget/widget.h" namespace ash { +class FocusCycler; +class ScrollableShelfView; class Shelf; class ShelfView; // The hotseat widget is part of the shelf and hosts app shortcuts. -// TODO(crbug.com/973446): Move |ShelfView| from |ShelfWidget| to this widget. class ASH_EXPORT HotseatWidget : public views::Widget { public: - HotseatWidget(Shelf* shelf, ShelfView* shelf_view); + HotseatWidget(); - // Initializes the widget and sets its basic properties. - void Initialize(aura::Window* container); + // Initializes the widget, sets its contents view and basic properties. + void Initialize(aura::Window* container, Shelf* shelf); + + // views::Widget: + void OnMouseEvent(ui::MouseEvent* event) override; + void OnGestureEvent(ui::GestureEvent* event) override; + bool OnNativeWidgetActivationChanged(bool active) override; + + // Returns whether the overflow menu/bubble is currently being shown. + bool IsShowingOverflowBubble() const; + + // Focuses the first or the last app shortcut inside the overflow shelf. + // Does nothing if the overflow shelf is not currently shown. + void FocusOverflowShelf(bool last_element); + + // Finds the first or last focusable app shortcut and focuses it. + void FocusFirstOrLastFocusableChild(bool last); + + // Sets the focus cycler and adds the hotseat to the cycle. + void SetFocusCycler(FocusCycler* focus_cycler); + + ShelfView* GetShelfView(); + const ShelfView* GetShelfView() const; private: + class DelegateView; + // View containing the shelf items within an active user session. Owned by // the views hierarchy. - ShelfView* shelf_view_; + ShelfView* shelf_view_ = nullptr; + ScrollableShelfView* scrollable_shelf_view_ = nullptr; + + // The contents view of this widget. Contains |shelf_view_|. + DelegateView* delegate_view_ = nullptr; DISALLOW_COPY_AND_ASSIGN(HotseatWidget); };
diff --git a/ash/shelf/overflow_bubble_view.cc b/ash/shelf/overflow_bubble_view.cc index ca615de..4a38a8e 100644 --- a/ash/shelf/overflow_bubble_view.cc +++ b/ash/shelf/overflow_bubble_view.cc
@@ -21,6 +21,7 @@ #include "ui/display/screen.h" #include "ui/events/event.h" #include "ui/gfx/geometry/insets.h" +#include "ui/gfx/scoped_canvas.h" #include "ui/views/view_model.h" #include "ui/views/widget/widget.h" @@ -54,6 +55,41 @@ } // namespace //////////////////////////////////////////////////////////////////////////////// +// OverflowScrollArrowView impl + +class OverflowBubbleView::OverflowScrollArrowView : public ScrollArrowView { + public: + OverflowScrollArrowView(ArrowType arrow_type, + bool is_horizontal_alignment, + views::ButtonListener* button_lister) + : ScrollArrowView(arrow_type, is_horizontal_alignment, button_lister) {} + ~OverflowScrollArrowView() override = default; + + // views::View: + void PaintButtonContents(gfx::Canvas* canvas) override { + ScrollArrowView::PaintButtonContents(canvas); + + float ring_radius_dp = width() / 2; + gfx::PointF circle_center(width() / 2.f, height() / 2.f); + + { + gfx::ScopedCanvas scoped_canvas(canvas); + const float dsf = canvas->UndoDeviceScaleFactor(); + cc::PaintFlags fg_flags; + fg_flags.setAntiAlias(true); + fg_flags.setColor(kShelfControlPermanentHighlightBackground); + + const float radius = std::ceil(ring_radius_dp * dsf); + canvas->DrawCircle(gfx::ScalePoint(circle_center, dsf), radius, fg_flags); + } + } + + const char* GetClassName() const override { + return "OverflowScrollArrowView"; + } +}; + +//////////////////////////////////////////////////////////////////////////////// // OverflowShelfContainerView impl class OverflowBubbleView::OverflowShelfContainerView @@ -204,11 +240,11 @@ gfx::RoundedCornersF(GetBubbleCornerRadius())); // Initialize the left arrow button. - left_arrow_ = AddChildView(std::make_unique<ScrollArrowView>( + left_arrow_ = AddChildView(std::make_unique<OverflowScrollArrowView>( ScrollArrowView::kLeft, shelf_->IsHorizontalAlignment(), this)); // Initialize the right arrow button. - right_arrow_ = AddChildView(std::make_unique<ScrollArrowView>( + right_arrow_ = AddChildView(std::make_unique<OverflowScrollArrowView>( ScrollArrowView::kRight, shelf_->IsHorizontalAlignment(), this)); // Initialize the shelf container view. @@ -590,14 +626,15 @@ if (!GetWidget()) return false; - // Do not activate the bubble unless the current active window is the shelf + // Do not activate the bubble unless the current active window is the hotseat // window or the status widget window. aura::Window* active_window = window_util::GetActiveWindow(); aura::Window* bubble_window = GetWidget()->GetNativeWindow(); - aura::Window* shelf_window = shelf_->shelf_widget()->GetNativeWindow(); + aura::Window* hotseat_window = + shelf_->shelf_widget()->hotseat_widget()->GetNativeWindow(); aura::Window* status_area_window = shelf_->shelf_widget()->status_area_widget()->GetNativeWindow(); - return active_window == bubble_window || active_window == shelf_window || + return active_window == bubble_window || active_window == hotseat_window || active_window == status_area_window; }
diff --git a/ash/shelf/overflow_bubble_view.h b/ash/shelf/overflow_bubble_view.h index 412c96f5..85650fb 100644 --- a/ash/shelf/overflow_bubble_view.h +++ b/ash/shelf/overflow_bubble_view.h
@@ -82,6 +82,7 @@ private: friend class OverflowBubbleViewTestAPI; + class OverflowScrollArrowView; class OverflowShelfContainerView; // Returns the maximum scroll distance.
diff --git a/ash/shelf/scroll_arrow_view.cc b/ash/shelf/scroll_arrow_view.cc index f9488b5..8a18816 100644 --- a/ash/shelf/scroll_arrow_view.cc +++ b/ash/shelf/scroll_arrow_view.cc
@@ -7,9 +7,9 @@ #include "ash/resources/vector_icons/vector_icons.h" #include "ash/shelf/shelf_constants.h" #include "ui/compositor/scoped_layer_animation_settings.h" +#include "ui/gfx/canvas.h" #include "ui/gfx/image/image_skia_operations.h" #include "ui/gfx/paint_vector_icon.h" -#include "ui/gfx/scoped_canvas.h" #include "ui/views/animation/flood_fill_ink_drop_ripple.h" #include "ui/views/animation/ink_drop_impl.h" #include "ui/views/animation/ink_drop_mask.h" @@ -46,20 +46,6 @@ gfx::PointF center_point(width() / 2.f, height() / 2.f); canvas->DrawImageInt(img, center_point.x() - img.width() / 2, center_point.y() - img.height() / 2); - - float ring_radius_dp = width() / 2; - { - gfx::PointF circle_center(center_point); - gfx::ScopedCanvas scoped_canvas(canvas); - const float dsf = canvas->UndoDeviceScaleFactor(); - circle_center.Scale(dsf); - cc::PaintFlags fg_flags; - fg_flags.setAntiAlias(true); - fg_flags.setColor(kShelfControlPermanentHighlightBackground); - - const float radius = std::ceil(ring_radius_dp * dsf); - canvas->DrawCircle(circle_center, radius, fg_flags); - } } const char* ScrollArrowView::GetClassName() const { @@ -74,14 +60,13 @@ std::unique_ptr<views::InkDropMask> ScrollArrowView::CreateInkDropMask() const { gfx::Point center_point = gfx::Rect(size()).CenterPoint(); - return std::make_unique<views::CircleInkDropMask>(size(), center_point, 20); + return std::make_unique<views::CircleInkDropMask>(size(), center_point, + width() / 2); } std::unique_ptr<views::InkDropRipple> ScrollArrowView::CreateInkDropRipple() const { - const int button_radius = 20; gfx::Rect bounds = gfx::Rect(size()); - bounds.ClampToCenteredSize(gfx::Size(2 * button_radius, 2 * button_radius)); return std::make_unique<views::FloodFillInkDropRipple>( size(), GetLocalBounds().InsetsFrom(bounds), GetInkDropCenterBasedOnLastEvent(), kShelfInkDropBaseColor,
diff --git a/ash/shelf/scrollable_shelf_view.cc b/ash/shelf/scrollable_shelf_view.cc index 1fbaa75..b69846ba 100644 --- a/ash/shelf/scrollable_shelf_view.cc +++ b/ash/shelf/scrollable_shelf_view.cc
@@ -8,15 +8,30 @@ #include "ash/shelf/shelf_widget.h" #include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/gfx/geometry/insets.h" +#include "ui/gfx/geometry/vector2d_conversions.h" namespace ash { namespace { +// Padding between the arrow button and the end of ScrollableShelf. It is +// applied when the arrow button shows. +constexpr int kArrowButtonEndPadding = 6; + // Padding between the the shelf container view and the arrow button (if any). -int GetDistanceToArrowButton() { - return ShelfConstants::button_spacing(); -} +constexpr int kDistanceToArrowButton = 2; + +// Padding between the app icon and the end of the ScrollableShelf. It is +// applied when the arrow button not shows. +constexpr int kAppIconEndPadding = 4; + +// Size of the arrow button. +constexpr int kArrowButtonSize = 20; + +// The distance between ShelfContainerView and the end of ScrollableShelf when +// the arrow button shows. +constexpr int kArrowButtonGroupWidth = + kArrowButtonSize + kArrowButtonEndPadding + kDistanceToArrowButton; // Sum of the shelf button size and the gap between shelf buttons. int GetUnit() { @@ -29,6 +44,13 @@ return ShelfConstants::button_size() / 2; } +// Calculates the padding for overflow. +int CalculateOverflowPadding(int available_size) { + return (available_size - kArrowButtonGroupWidth - + ShelfConstants::button_size() - kAppIconEndPadding) % + GetUnit(); +} + } // namespace //////////////////////////////////////////////////////////////////////////////// @@ -76,7 +98,7 @@ return 0; // Calculate the length of the available space. - int available_length = space_for_icons_ - 2 * kEndPadding; + int available_length = space_for_icons_ - 2 * kAppIconEndPadding; // Calculate the length of the preferred size. const gfx::Size shelf_preferred_size( @@ -120,7 +142,7 @@ int preferred_length = GetShelf()->IsHorizontalAlignment() ? preferred_size.width() : preferred_size.height(); - preferred_length += 2 * kEndPadding; + preferred_length += 2 * kAppIconEndPadding; int scroll_length = GetShelf()->IsHorizontalAlignment() ? scroll_offset_.x() : scroll_offset_.y(); @@ -171,15 +193,16 @@ space_for_icons_ = (is_horizontal ? width() : height()) - left_padding - right_padding; - gfx::Size shelf_button_size(ShelfConstants::button_size(), - ShelfConstants::button_size()); - gfx::Size arrow_button_size(GetArrowButtonSize(), GetArrowButtonSize()); + gfx::Size arrow_button_size(kArrowButtonSize, kArrowButtonSize); gfx::Rect shelf_container_bounds = gfx::Rect(size()); // Transpose and layout as if it is horizontal. if (!is_horizontal) shelf_container_bounds.Transpose(); + gfx::Size arrow_button_group_size(kArrowButtonGroupWidth, + shelf_container_bounds.height()); + // The bounds of |left_arrow_| and |right_arrow_| in the parent coordinates. gfx::Rect left_arrow_bounds; gfx::Rect right_arrow_bounds; @@ -188,27 +211,31 @@ // should not show, |left_arrow_bounds| should be empty. if (layout_strategy_ == kShowLeftArrowButton || layout_strategy_ == kShowButtons) { - left_arrow_bounds = gfx::Rect(shelf_button_size); + left_arrow_bounds = gfx::Rect(arrow_button_group_size); left_arrow_bounds.Offset(left_padding, 0); + left_arrow_bounds.Inset(kArrowButtonEndPadding, 0, kDistanceToArrowButton, + 0); left_arrow_bounds.ClampToCenteredSize(arrow_button_size); - shelf_container_bounds.Inset( - ShelfConstants::button_size() + GetDistanceToArrowButton(), 0, 0, 0); + shelf_container_bounds.Inset(kArrowButtonGroupWidth, 0, 0, 0); } if (layout_strategy_ == kShowRightArrowButton || layout_strategy_ == kShowButtons) { - gfx::Point right_arrow_start_point(shelf_container_bounds.right() - - ShelfConstants::button_size() - - right_padding, - 0); - right_arrow_bounds = gfx::Rect(right_arrow_start_point, shelf_button_size); + gfx::Point right_arrow_start_point( + shelf_container_bounds.right() - right_padding - kArrowButtonGroupWidth, + 0); + right_arrow_bounds = + gfx::Rect(right_arrow_start_point, arrow_button_group_size); + right_arrow_bounds.Inset(kDistanceToArrowButton, 0, kArrowButtonEndPadding, + 0); right_arrow_bounds.ClampToCenteredSize(arrow_button_size); - shelf_container_bounds.Inset( - 0, 0, ShelfConstants::button_size() + GetDistanceToArrowButton(), 0); + shelf_container_bounds.Inset(0, 0, kArrowButtonGroupWidth, 0); } - shelf_container_bounds.Inset(left_padding + kEndPadding, 0, - right_padding + kEndPadding, 0); + shelf_container_bounds.Inset( + left_padding + (left_arrow_bounds.IsEmpty() ? kAppIconEndPadding : 0), 0, + right_padding + (right_arrow_bounds.IsEmpty() ? kAppIconEndPadding : 0), + 0); // Adjust the bounds when not showing in the horizontal // alignment.tShelf()->IsHorizontalAlignment()) { @@ -237,12 +264,12 @@ if (!left_arrow_bounds.IsEmpty()) { translate_vector = GetShelf()->IsHorizontalAlignment() - ? gfx::Vector2d( - shelf_container_bounds.x() - kEndPadding - left_padding, 0) - : gfx::Vector2d( - 0, shelf_container_bounds.y() - kEndPadding - left_padding); + ? gfx::Vector2d(shelf_container_bounds.x() - kAppIconEndPadding - + left_padding, + 0) + : gfx::Vector2d(0, shelf_container_bounds.y() - kAppIconEndPadding - + left_padding); } - gfx::Vector2dF total_offset = scroll_offset_ + translate_vector; if (ShouldAdaptToRTL()) total_offset = -total_offset; @@ -279,11 +306,6 @@ return "ScrollableShelfView"; } -int ScrollableShelfView::GetArrowButtonSize() { - static int kArrowButtonSize = ShelfConstants::control_size(); - return kArrowButtonSize; -} - void ScrollableShelfView::ButtonPressed(views::Button* sender, const ui::Event& event) { // Verfies that |sender| is either |left_arrow_| or |right_arrow_|. @@ -292,7 +314,10 @@ // Implement the arrow button handler in the same way with the gesture // scrolling. The key is to calculate the suitable scroll distance. - int offset = space_for_icons_ - 2 * GetUnit(); + int offset = space_for_icons_ - kArrowButtonGroupWidth - + ShelfConstants::button_size() - kAppIconEndPadding; + if (layout_strategy_ == kShowRightArrowButton) + offset -= (kArrowButtonGroupWidth - kAppIconEndPadding); DCHECK_GT(offset, 0); // If |forward| is true, scroll the scrollable shelf view rightward. @@ -325,7 +350,7 @@ /*horizontal= */ kAppIconGroupMargin); int gap = layout_strategy_ == kNotShowArrowButtons ? available_size_for_app_icons - icons_size - : available_size_for_app_icons % GetUnit(); + : CalculateOverflowPadding(available_size_for_app_icons); padding_insets.set_left(padding_insets.left() + gap / 2); padding_insets.set_right(padding_insets.right() + (gap % 2 ? gap / 2 + 1 : gap / 2)); @@ -369,25 +394,39 @@ // Handle scroll-related events, but don't do anything special for begin and // end. - if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { + if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN || + event.type() == ui::ET_GESTURE_SCROLL_END) { return true; } // Make sure that no visible shelf button is partially shown after gestures. - if (event.type() == ui::ET_GESTURE_END || - event.type() == ui::ET_GESTURE_SCROLL_END) { + if (event.type() == ui::ET_GESTURE_END) { + // The type of scrolling offset is float to ensure that ScrollableShelfView + // is responsive to slow gesture scrolling. However, when the gesture ends, + // the scrolling offset should be floored. + scroll_offset_ = gfx::ToFlooredVector2d(scroll_offset_); + int current_scroll_distance = GetShelf()->IsHorizontalAlignment() ? scroll_offset_.x() : scroll_offset_.y(); - const int residue = current_scroll_distance % GetUnit(); - // if it does not need to adjust the location of the shelf view, - // return early. - if (current_scroll_distance == CalculateScrollUpperBound() || residue == 0) + // Returns early when it does not need to adjust the shelf view's location. + if (current_scroll_distance == CalculateScrollUpperBound()) return true; + const int residue = current_scroll_distance % GetUnit(); int offset = residue > GetGestureDragThreshold() ? GetUnit() - residue : -residue; + + // In order to fully show the leftmost app icon when the left arrow button + // shows. + if (residue) + offset -= (kArrowButtonGroupWidth - kAppIconEndPadding); + + // Returns early when it does not need to adjust the shelf view's location. + if (!offset) + return true; + if (GetShelf()->IsHorizontalAlignment()) ScrollByXOffset(offset, /*animate=*/true); else
diff --git a/ash/shelf/shelf.cc b/ash/shelf/shelf.cc index fc753de..ff3556a 100644 --- a/ash/shelf/shelf.cc +++ b/ash/shelf/shelf.cc
@@ -53,10 +53,13 @@ if (shelf_->auto_hide_behavior() != SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) return; - // The event target should be the shelf widget. + // The event target should be the shelf widget or the hotseat widget. aura::Window* target = static_cast<aura::Window*>(event->target()); - if (target != Shelf::ForWindow(target)->shelf_widget()->GetNativeView()) + const ShelfWidget* shelf_widget = Shelf::ForWindow(target)->shelf_widget(); + if (target != shelf_widget->GetNativeView() && + target != shelf_widget->hotseat_widget()->GetNativeView()) { return; + } // The touch-pressing event may hide the shelf. Lock the shelf's auto hide // state to give the shelf a chance to handle the touch event before it @@ -125,7 +128,6 @@ aura::Window* shelf_container = root->GetChildById(kShellWindowId_ShelfContainer); shelf_widget_.reset(new ShelfWidget(this)); - shelf_widget_->Initialize(shelf_container); DCHECK(!shelf_layout_manager_); shelf_layout_manager_ = shelf_widget_->shelf_layout_manager(); @@ -145,6 +147,7 @@ aura::Window* status_container = root->GetChildById(kShellWindowId_StatusContainer); shelf_widget_->CreateStatusAreaWidget(status_container); + shelf_widget_->Initialize(shelf_container); } void Shelf::ShutdownShelfWidget() {
diff --git a/ash/shelf/shelf_focus_cycler.cc b/ash/shelf/shelf_focus_cycler.cc index 0f3c9922..32e5c6f 100644 --- a/ash/shelf/shelf_focus_cycler.cc +++ b/ash/shelf/shelf_focus_cycler.cc
@@ -8,6 +8,7 @@ #include "ash/shelf/login_shelf_view.h" #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_navigation_widget.h" +#include "ash/shelf/shelf_view.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/system/status_area_widget.h" @@ -32,7 +33,7 @@ if (reverse) { FocusNavigation(reverse); } else { - if (shelf_->shelf_widget()->IsShowingOverflowBubble()) + if (shelf_->shelf_widget()->hotseat_widget()->IsShowingOverflowBubble()) FocusOverflowShelf(reverse); else FocusStatusArea(reverse); @@ -56,7 +57,7 @@ // Login/lock screen or OOBE. Shell::Get()->system_tray_notifier()->NotifyFocusOut(reverse); } else if (reverse) { - if (shelf_->shelf_widget()->IsShowingOverflowBubble()) + if (shelf_->shelf_widget()->hotseat_widget()->IsShowingOverflowBubble()) FocusOverflowShelf(reverse); else FocusShelf(reverse); @@ -76,14 +77,20 @@ } void ShelfFocusCycler::FocusShelf(bool last_element) { - ShelfWidget* shelf_widget = shelf_->shelf_widget(); - shelf_widget->set_default_last_focusable_child(last_element); - Shell::Get()->focus_cycler()->FocusWidget(shelf_widget); - shelf_widget->FocusFirstOrLastFocusableChild(last_element); + if (shelf_->shelf_widget()->login_shelf_view()->GetVisible()) { + ShelfWidget* shelf_widget = shelf_->shelf_widget(); + shelf_widget->set_default_last_focusable_child(last_element); + Shell::Get()->focus_cycler()->FocusWidget(shelf_widget); + } else { + HotseatWidget* hotseat_widget = shelf_->shelf_widget()->hotseat_widget(); + hotseat_widget->GetShelfView()->set_default_last_focusable_child( + last_element); + Shell::Get()->focus_cycler()->FocusWidget(hotseat_widget); + } } void ShelfFocusCycler::FocusOverflowShelf(bool last_element) { - shelf_->shelf_widget()->FocusOverflowShelf(last_element); + shelf_->shelf_widget()->hotseat_widget()->FocusOverflowShelf(last_element); } void ShelfFocusCycler::FocusStatusArea(bool last_element) {
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc index 22229ba..449a240 100644 --- a/ash/shelf/shelf_layout_manager.cc +++ b/ash/shelf/shelf_layout_manager.cc
@@ -1053,8 +1053,10 @@ // Setting visibility during an animation causes the visibility property to // animate. Set the visibility property without an animation. if (target_bounds.opacity) { - if (state_.IsActiveSessionState()) + if (state_.IsActiveSessionState()) { nav_widget->ShowInactive(); + hotseat_widget->ShowInactive(); + } status_widget->Show(); } } @@ -1346,11 +1348,12 @@ if (shelf_widget_->IsShowingMenu()) return SHELF_AUTO_HIDE_SHOWN; - if (shelf_widget_->IsShowingOverflowBubble()) + if (shelf_widget_->hotseat_widget()->IsShowingOverflowBubble()) return SHELF_AUTO_HIDE_SHOWN; if (shelf_widget_->IsActive() || shelf_widget_->navigation_widget()->IsActive() || + shelf_widget_->hotseat_widget()->IsActive() || (shelf_widget_->status_area_widget() && shelf_widget_->status_area_widget()->IsActive())) { return SHELF_AUTO_HIDE_SHOWN; @@ -1435,7 +1438,10 @@ if (!window) return false; const aura::Window* shelf_window = shelf_widget_->GetNativeWindow(); - return shelf_window && shelf_window->Contains(window); + const aura::Window* hotseat_window = + shelf_widget_->hotseat_widget()->GetNativeWindow(); + return (shelf_window && shelf_window->Contains(window)) || + (hotseat_window && hotseat_window->Contains(window)); } bool ShelfLayoutManager::IsStatusAreaWindow(aura::Window* window) { @@ -1647,7 +1653,7 @@ // Do not show the fullscreen app list until the overflow bubble has been // closed. - if (shelf_widget_->IsShowingOverflowBubble()) + if (shelf_widget_->hotseat_widget()->IsShowingOverflowBubble()) return false; // If app list is already opened, swiping up on the shelf should keep the app @@ -1682,7 +1688,7 @@ return false; // Also disable shelf drags until the overflow shelf is closed. - if (shelf_widget_->IsShowingOverflowBubble()) + if (shelf_widget_->hotseat_widget()->IsShowingOverflowBubble()) return false; drag_status_ = kDragInProgress;
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index 4e5bb71..63532834 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -35,6 +35,7 @@ #include "ash/shelf/shelf_constants.h" #include "ash/shelf/shelf_controller.h" #include "ash/shelf/shelf_layout_manager_observer.h" +#include "ash/shelf/shelf_navigation_widget.h" #include "ash/shelf/shelf_view.h" #include "ash/shelf/shelf_view_test_api.h" #include "ash/shelf/shelf_widget.h" @@ -1060,8 +1061,16 @@ ASSERT_TRUE(shelf_widget); ASSERT_TRUE(shelf_widget->status_area_widget()); shelf_widget->status_area_widget()->SetBounds(gfx::Rect(0, 0, 200, 200)); - EXPECT_EQ(200, shelf_widget->GetContentsView()->width() - - shelf->GetShelfViewForTesting()->width()); + const int total_width = + screen_util::GetDisplayBoundsWithShelf(shelf_widget->GetNativeWindow()) + .width(); + const int nav_width = + shelf_widget->navigation_widget()->GetWindowBoundsInScreen().width(); + const int hotseat_width = + GetPrimaryShelf()->GetShelfViewForTesting()->width(); + const int margins = + ShelfConstants::home_button_edge_spacing() + kAppIconGroupMargin; + EXPECT_EQ(200, total_width - nav_width - hotseat_width - margins); } // Various assertions around auto-hide. @@ -2662,14 +2671,12 @@ // Press the AppList button to hide the AppList and Shelf. Check the following // things: // (1) Shelf is hidden - // (2) Shelf has correct bounds in screen coordinate. + // (2) Shelf has correct bounds in screen coordinates. PressHomeButton(); - EXPECT_EQ(GetScreenAvailableBounds().bottom_left() + - gfx::Point(0, -kHiddenShelfInScreenPortion).OffsetFromOrigin(), - GetPrimaryShelf() - ->GetShelfViewForTesting() - ->GetBoundsInScreen() - .origin()); + EXPECT_EQ( + GetScreenAvailableBounds().bottom_left() + + gfx::Point(0, -kHiddenShelfInScreenPortion).OffsetFromOrigin(), + GetPrimaryShelf()->shelf_widget()->GetWindowBoundsInScreen().origin()); EXPECT_FALSE(GetPrimaryShelf()->IsVisible()); } @@ -2712,12 +2719,10 @@ GetPrimaryShelf()->shelf_widget()->OnGestureEvent(&scroll_end_event); // Verify that the shelf has expected bounds. - EXPECT_EQ(GetScreenAvailableBounds().bottom_left() + - gfx::Point(0, -ShelfConstants::shelf_size()).OffsetFromOrigin(), - GetPrimaryShelf() - ->GetShelfViewForTesting() - ->GetBoundsInScreen() - .origin()); + EXPECT_EQ( + GetScreenAvailableBounds().bottom_left() + + gfx::Point(0, -ShelfConstants::shelf_size()).OffsetFromOrigin(), + GetPrimaryShelf()->shelf_widget()->GetWindowBoundsInScreen().origin()); } // Tests that tap outside of the AUTO_HIDE_SHOWN shelf should hide it. @@ -2883,7 +2888,7 @@ ShelfItem item; item.type = TYPE_APP; item.id = ShelfID(app_id); - const int index = controller->model()->Add(item); + controller->model()->Add(item); // Turn on the auto-hide mode for shelf. Check the initial states. shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); @@ -2902,10 +2907,10 @@ // events. base::UserActionTester user_action_tester; user_action_tester.ResetCounts(); - auto shelf_test_api = std::make_unique<ShelfViewTestAPI>( - GetPrimaryShelf()->GetShelfViewForTesting()); - views::View* shelf_view = shelf_test_api->GetViewAt(index); - gfx::Point shelf_btn_center = shelf_view->GetBoundsInScreen().CenterPoint(); + views::View* button = GetPrimaryShelf() + ->GetShelfViewForTesting() + ->first_visible_button_for_testing(); + gfx::Point shelf_btn_center = button->GetBoundsInScreen().CenterPoint(); generator->GestureTapAt(shelf_btn_center); EXPECT_EQ(1, user_action_tester.GetActionCount("Launcher_ClickOnApp")); }
diff --git a/ash/shelf/shelf_navigation_widget.cc b/ash/shelf/shelf_navigation_widget.cc index f0a8aff..e1b88f0 100644 --- a/ash/shelf/shelf_navigation_widget.cc +++ b/ash/shelf/shelf_navigation_widget.cc
@@ -94,7 +94,8 @@ home_button_->set_context_menu_controller(shelf_view); home_button_->SetSize(gfx::Size(control_size, control_size)); - GetViewAccessibility().OverrideNextFocus(shelf->shelf_widget()); + GetViewAccessibility().OverrideNextFocus( + shelf->shelf_widget()->hotseat_widget()); GetViewAccessibility().OverridePreviousFocus(shelf->GetStatusAreaWidget()); SetBackground(views::CreateRoundedRectBackground(
diff --git a/ash/shelf/shelf_unittest.cc b/ash/shelf/shelf_unittest.cc index 15f5ee96d..0f5342e 100644 --- a/ash/shelf/shelf_unittest.cc +++ b/ash/shelf/shelf_unittest.cc
@@ -117,7 +117,7 @@ // Shows overflow bubble. test_api()->ShowOverflowBubble(); - EXPECT_TRUE(shelf_widget->IsShowingOverflowBubble()); + EXPECT_TRUE(shelf_widget->hotseat_widget()->IsShowingOverflowBubble()); // Remove one of the first items in the main shelf view. ASSERT_GT(shelf_model()->item_count(), 2); @@ -125,7 +125,7 @@ // Waits for all transitions to finish and there should be no crash. test_api()->RunMessageLoopUntilAnimationsDone(); - EXPECT_FALSE(shelf_widget->IsShowingOverflowBubble()); + EXPECT_FALSE(shelf_widget->hotseat_widget()->IsShowingOverflowBubble()); } // Tests if shelf is hidden on secondary display after the primary display is
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc index bfe14bbd..cab37168 100644 --- a/ash/shelf/shelf_view.cc +++ b/ash/shelf/shelf_view.cc
@@ -9,7 +9,6 @@ #include "ash/app_list/app_list_controller_impl.h" #include "ash/drag_drop/drag_image_view.h" -#include "ash/focus_cycler.h" #include "ash/keyboard/keyboard_util.h" #include "ash/keyboard/ui/keyboard_ui_controller.h" #include "ash/metrics/user_metrics_recorder.h" @@ -156,8 +155,7 @@ FocusSearch::AnchoredDialogPolicy can_go_into_anchored_dialog, views::FocusTraversable** focus_traversable, View** focus_traversable_view) override { - // Build a list of all views that we are able to focus: 1) items from the - // main shelf, 2) overflow button, 3) items from overflow if applicable. + // Build a list of all the views that we are able to focus. std::vector<views::View*> focusable_views; for (int i = shelf_view_->first_visible_index(); @@ -313,6 +311,7 @@ Shell::Get()->AddShellObserver(this); bounds_animator_->AddObserver(this); set_context_menu_controller(this); + set_allow_deactivate_on_esc(true); announcement_view_ = new views::View(); AddChildView(announcement_view_); @@ -726,6 +725,14 @@ return focus_search_.get(); } +//////////////////////////////////////////////////////////////////////////////// +// ShelfView, AccessiblePaneView implementation: + +views::View* ShelfView::GetDefaultFocusableChild() { + return default_last_focusable_child_ ? FindLastFocusableChild() + : FindFirstFocusableChild(); +} + void ShelfView::CreateDragIconProxy( const gfx::Point& location_in_screen_coordinates, const gfx::ImageSkia& icon, @@ -934,20 +941,12 @@ // When scrollable shelf is enabled, the padding is handled in // ScrollableShelfView. if (!is_overflow_mode() && !chromeos::switches::ShouldShowScrollableShelf()) { - const int available_size = shelf()->PrimaryAxisValue(width(), height()); - - // Add the minimum padding required after the home button. - x += shelf()->PrimaryAxisValue(kAppIconGroupMargin, 0); - y += shelf()->PrimaryAxisValue(0, kAppIconGroupMargin); - // Now add the necessary padding to center app icons. - StatusAreaWidget* status_widget = shelf_widget()->status_area_widget(); - const int status_widget_size = - status_widget ? shelf()->PrimaryAxisValue( - status_widget->GetWindowBoundsInScreen().width(), - status_widget->GetWindowBoundsInScreen().height()) - : 0; - const int screen_size = available_size + status_widget_size; + const gfx::Size screen_size = + screen_util::GetDisplayBoundsWithShelf(GetWidget()->GetNativeWindow()) + .size(); + const int screen_size_primary = + shelf()->PrimaryAxisValue(screen_size.width(), screen_size.height()); const int available_size_for_app_icons = GetAvailableSpaceForAppIcons(); const int icons_size = GetSizeOfAppIcons(number_of_visible_apps(), @@ -955,17 +954,21 @@ int padding_for_centering = 0; if (app_centering_strategy.center_on_screen) { - padding_for_centering = (screen_size - icons_size) / 2; + // This is how far the first icon needs to be from the screen edge. + padding_for_centering = (screen_size_primary - icons_size) / 2; + + // Let's see how far this view is from the edge of the screen to + // compute how much extra padding is needed. + gfx::Point origin = gfx::Point(0, 0); + views::View::ConvertPointToScreen(this, &origin); + + padding_for_centering -= origin.x(); } else { padding_for_centering = - ShelfConstants::home_button_edge_spacing() + - (IsTabletModeEnabled() ? 2 : 1) * ShelfConstants::control_size() + - (IsTabletModeEnabled() ? button_spacing : 0) + kAppIconGroupMargin + (available_size_for_app_icons - icons_size) / 2; } - if (padding_for_centering > kAppIconGroupMargin) { - // Only shift buttons to the right. + if (padding_for_centering > 0) { x = shelf()->PrimaryAxisValue(padding_for_centering, 0); y = shelf()->PrimaryAxisValue(0, padding_for_centering); } @@ -1067,13 +1070,7 @@ } int ShelfView::GetAvailableSpaceForAppIcons() const { - // Subtract space already allocated to the home button, and the back - // button if applicable. - return shelf()->PrimaryAxisValue(width(), height()) - - ShelfConstants::home_button_edge_spacing() - - (IsTabletModeEnabled() ? 2 : 1) * ShelfConstants::control_size() - - (IsTabletModeEnabled() ? ShelfConstants::button_spacing() : 0) - - 2 * kAppIconGroupMargin; + return shelf()->PrimaryAxisValue(width(), height()); } int ShelfView::GetSeparatorIndex() const {
diff --git a/ash/shelf/shelf_view.h b/ash/shelf/shelf_view.h index 7837120..91e43a47 100644 --- a/ash/shelf/shelf_view.h +++ b/ash/shelf/shelf_view.h
@@ -195,21 +195,24 @@ const ui::Event& event, views::InkDrop* ink_drop) override; - // Overridden from FocusTraversable: + // FocusTraversable: views::FocusSearch* GetFocusSearch() override; - // Overridden from app_list::ApplicationDragAndDropHost: + // AccessiblePaneView: + views::View* GetDefaultFocusableChild() override; + + // app_list::ApplicationDragAndDropHost: void CreateDragIconProxy(const gfx::Point& location_in_screen_coordinates, const gfx::ImageSkia& icon, views::View* replaced_view, const gfx::Vector2d& cursor_offset_from_center, float scale_factor) override; - // Overridden from ash::TabletModeObserver: + // ash::TabletModeObserver: void OnTabletModeStarted() override; void OnTabletModeEnded() override; - // Overridden from VirtualKeyboardModel::Observer: + // VirtualKeyboardModel::Observer: void OnVirtualKeyboardVisibilityChanged() override; // Returns true if |event| on the shelf item is going to activate the @@ -302,6 +305,10 @@ : nullptr; } + void set_default_last_focusable_child(bool default_last_focusable_child) { + default_last_focusable_child_ = default_last_focusable_child; + } + const ShelfAppButton* drag_view() const { return drag_view_; } // Returns true when this ShelfView is used for Overflow Bubble. @@ -693,6 +700,10 @@ // before the metric is recorded. bool recorded_home_launcher_shown_ = false; + // Whether this view should focus its last focusable child (instead of its + // first) when focused. + bool default_last_focusable_child_ = false; + base::WeakPtrFactory<ShelfView> weak_factory_; DISALLOW_COPY_AND_ASSIGN(ShelfView);
diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc index 7e9674c..6bc96d5 100644 --- a/ash/shelf/shelf_view_unittest.cc +++ b/ash/shelf/shelf_view_unittest.cc
@@ -4022,9 +4022,12 @@ // shelf are ignored because it is not visible. TEST_F(ShelfViewOverflowFocusTest, ForwardCycling) { // Focus the last visible item on the shelf. - Shell::Get()->focus_cycler()->FocusWidget(shelf_view_->shelf_widget()); - shelf_view_->shelf_widget()->GetFocusManager()->SetFocusedView( - test_api_->GetViewAt(last_item_on_main_shelf_index_)); + Shell::Get()->focus_cycler()->FocusWidget( + shelf_view_->shelf_widget()->hotseat_widget()); + shelf_view_->shelf_widget() + ->hotseat_widget() + ->GetFocusManager() + ->SetFocusedView(test_api_->GetViewAt(last_item_on_main_shelf_index_)); EXPECT_TRUE(test_api_->GetViewAt(last_item_on_main_shelf_index_)->HasFocus()); // Focus the overflow button. @@ -4048,9 +4051,12 @@ OpenOverflow(); // Focus the last item on the main shelf. - Shell::Get()->focus_cycler()->FocusWidget(shelf_view_->shelf_widget()); - shelf_view_->shelf_widget()->GetFocusManager()->SetFocusedView( - test_api_->GetViewAt(last_item_on_main_shelf_index_)); + Shell::Get()->focus_cycler()->FocusWidget( + shelf_view_->shelf_widget()->hotseat_widget()); + shelf_view_->shelf_widget() + ->hotseat_widget() + ->GetFocusManager() + ->SetFocusedView(test_api_->GetViewAt(last_item_on_main_shelf_index_)); // Focus the overflow button. DoTab(); @@ -4074,13 +4080,13 @@ // Focus the first item on the overflow shelf. while (!test_api_->overflow_bubble()->bubble_view()->GetWidget()->IsActive()) DoTab(); - EXPECT_FALSE(shelf_view_->shelf_widget()->IsActive()); + EXPECT_FALSE(shelf_view_->shelf_widget()->hotseat_widget()->IsActive()); EXPECT_FALSE(shelf_view_->GetOverflowButton()->HasFocus()); // Tests that after pressing shift tab once, the main shelf is active and // the overflow button has focus. DoShiftTab(); - EXPECT_TRUE(shelf_view_->shelf_widget()->IsActive()); + EXPECT_TRUE(shelf_view_->shelf_widget()->hotseat_widget()->IsActive()); EXPECT_TRUE(shelf_view_->GetOverflowButton()->HasFocus()); // One more shift tab and the last item on the main shelf has focus. @@ -4095,8 +4101,10 @@ GetPrimaryShelf()->shelf_focus_cycler()->FocusShelf(false /* last_element */); EXPECT_FALSE(shelf_view_->GetOverflowButton()->HasFocus()); // Focus the last item on the main shelf. - shelf_view_->shelf_widget()->GetFocusManager()->SetFocusedView( - test_api_->GetViewAt(last_item_on_main_shelf_index_)); + shelf_view_->shelf_widget() + ->hotseat_widget() + ->GetFocusManager() + ->SetFocusedView(test_api_->GetViewAt(last_item_on_main_shelf_index_)); // Focus the overflow button. DoTab(); EXPECT_TRUE(shelf_view_->GetOverflowButton()->HasFocus());
diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc index 4bb19bd6..a5883f6 100644 --- a/ash/shelf/shelf_widget.cc +++ b/ash/shelf/shelf_widget.cc
@@ -29,7 +29,6 @@ #include "ash/shell.h" #include "ash/system/status_area_layout_manager.h" #include "ash/system/status_area_widget.h" -#include "ash/wm/window_util.h" #include "base/command_line.h" #include "chromeos/constants/chromeos_switches.h" #include "ui/compositor/layer.h" @@ -51,10 +50,6 @@ constexpr int kShelfMaxOvershootHeight = 32; constexpr float kShelfBlurQuality = 0.33f; -bool IsScrollableShelfEnabled() { - return chromeos::switches::ShouldShowScrollableShelf(); -} - // Return the first or last focusable child of |root|. views::View* FindFirstOrLastFocusableChild(views::View* root, bool find_last_child) { @@ -74,8 +69,9 @@ } // namespace -// The contents view of the Shelf. This view contains ShelfView and -// sizes it to the width of the shelf minus the size of the status area. +// The contents view of the Shelf. In an active session, this is used to +// display a semi-opaque background behind the shelf. Outside of an active +// session, this also contains the login shelf view. class ShelfWidget::DelegateView : public views::WidgetDelegate, public views::AccessiblePaneView, public ShelfBackgroundAnimatorObserver { @@ -171,25 +167,11 @@ } bool ShelfWidget::DelegateView::CanActivate() const { - // Allow activations coming from the overflow bubble if it is currently shown - // and active. - aura::Window* active_window = window_util::GetActiveWindow(); - aura::Window* bubble_window = nullptr; - aura::Window* shelf_window = shelf_widget_->GetNativeWindow(); - if (shelf_widget_->IsShowingOverflowBubble()) { - bubble_window = shelf_widget_->GetShelfView() - ->overflow_bubble() - ->bubble_view() - ->GetWidget() - ->GetNativeWindow(); - } - if (active_window && - (active_window == bubble_window || active_window == shelf_window)) { - return true; - } - - // Only allow activation from the focus cycler, not from mouse events, etc. - return focus_cycler_ && focus_cycler_->widget_activating() == GetWidget(); + // This widget only contains anything interesting to activate in login/lock + // screen mode. Only allow activation from the focus cycler, not from mouse + // events, etc. + return shelf_widget_->login_shelf_view_->GetVisible() && focus_cycler_ && + focus_cycler_->widget_activating() == GetWidget(); } void ShelfWidget::DelegateView::ReorderChildLayers(ui::Layer* parent_layer) { @@ -268,10 +250,10 @@ if (shelf_widget_->login_shelf_view_->GetVisible()) { return FindFirstOrLastFocusableChild(shelf_widget_->login_shelf_view_, default_last_focusable_child_); - } else { - return shelf_widget_->GetShelfView()->FindFirstOrLastFocusableChild( - default_last_focusable_child_); } + // If the login shelf view is not visible, there is nothing else to focus + // in this view. + return nullptr; } void ShelfWidget::DelegateView::UpdateShelfBackground(SkColor color) { @@ -341,18 +323,6 @@ SetContentsView(delegate_view_); delegate_view_->SetParentLayer(GetLayer()); - // The shelf view observes the shelf model and creates icons as items are - // added to the model. - if (IsScrollableShelfEnabled()) { - scrollable_shelf_view_ = new ScrollableShelfView(ShelfModel::Get(), shelf_); - scrollable_shelf_view_->Init(); - GetContentsView()->AddChildView(scrollable_shelf_view_); - } else { - shelf_view_ = new ShelfView(ShelfModel::Get(), shelf_); - shelf_view_->Init(); - GetContentsView()->AddChildView(shelf_view_); - } - GetContentsView()->AddChildView(login_shelf_view_); shelf_layout_manager_->AddObserver(this); @@ -395,8 +365,8 @@ void ShelfWidget::CreateNavigationWidget(aura::Window* container) { DCHECK(container); DCHECK(!navigation_widget_); - navigation_widget_ = - std::make_unique<ShelfNavigationWidget>(shelf_, GetShelfView()); + navigation_widget_ = std::make_unique<ShelfNavigationWidget>( + shelf_, hotseat_widget()->GetShelfView()); navigation_widget_->Initialize(container); Shell::Get()->focus_cycler()->AddWidget(navigation_widget_.get()); } @@ -404,9 +374,8 @@ void ShelfWidget::CreateHotseatWidget(aura::Window* container) { DCHECK(container); DCHECK(!hotseat_widget_); - hotseat_widget_ = std::make_unique<HotseatWidget>(shelf_, GetShelfView()); - hotseat_widget_->Initialize(container); - Shell::Get()->focus_cycler()->AddWidget(hotseat_widget_.get()); + hotseat_widget_ = std::make_unique<HotseatWidget>(); + hotseat_widget_->Initialize(container, shelf_); } void ShelfWidget::CreateStatusAreaWidget(aura::Window* status_container) { @@ -437,11 +406,12 @@ } void ShelfWidget::OnTabletModeChanged() { - GetShelfView()->OnTabletModeChanged(); + hotseat_widget()->GetShelfView()->OnTabletModeChanged(); } void ShelfWidget::PostCreateShelf() { SetFocusCycler(Shell::Get()->focus_cycler()); + hotseat_widget()->SetFocusCycler(Shell::Get()->focus_cycler()); shelf_layout_manager_->LayoutShelf(); shelf_layout_manager_->UpdateAutoHideState(); @@ -453,22 +423,7 @@ } bool ShelfWidget::IsShowingMenu() const { - return GetShelfView()->IsShowingMenu(); -} - -bool ShelfWidget::IsShowingOverflowBubble() const { - return GetShelfView()->IsShowingOverflowBubble(); -} - -void ShelfWidget::FocusOverflowShelf(bool last_element) { - if (!IsShowingOverflowBubble()) - return; - Shell::Get()->focus_cycler()->FocusWidget( - shelf_view_->overflow_bubble()->bubble_view()->GetWidget()); - views::View* to_focus = - shelf_view_->overflow_shelf()->FindFirstOrLastFocusableChild( - last_element); - to_focus->RequestFocus(); + return hotseat_widget()->GetShelfView()->IsShowingMenu(); } void ShelfWidget::SetFocusCycler(FocusCycler* focus_cycler) { @@ -487,9 +442,11 @@ if (id.IsNull()) return gfx::Rect(); - gfx::Rect bounds(GetShelfView()->GetIdealBoundsOfItemIcon(id)); + gfx::Rect bounds( + hotseat_widget()->GetShelfView()->GetIdealBoundsOfItemIcon(id)); gfx::Point screen_origin; - views::View::ConvertPointToScreen(GetShelfView(), &screen_origin); + views::View::ConvertPointToScreen(hotseat_widget()->GetShelfView(), + &screen_origin); return gfx::Rect(screen_origin.x() + bounds.x(), screen_origin.y() + bounds.y(), bounds.width(), bounds.height()); @@ -505,7 +462,7 @@ app_list::ApplicationDragAndDropHost* ShelfWidget::GetDragAndDropHostForAppList() { - return GetShelfView(); + return hotseat_widget()->GetShelfView(); } void ShelfWidget::set_default_last_focusable_child( @@ -514,21 +471,14 @@ default_last_focusable_child); } -void ShelfWidget::FocusFirstOrLastFocusableChild(bool last) { - // This is only ever called during an active session. - if (!GetShelfView()->GetVisible()) - return; - views::View* to_focus = GetShelfView()->FindFirstOrLastFocusableChild(last); - - Shell::Get()->focus_cycler()->FocusWidget(to_focus->GetWidget()); - to_focus->GetFocusManager()->SetFocusedView(to_focus); -} - bool ShelfWidget::OnNativeWidgetActivationChanged(bool active) { if (!Widget::OnNativeWidgetActivationChanged(active)) return false; - if (active) + if (active) { + // This widget should not get activated in an active session. + DCHECK(login_shelf_view_->GetVisible()); delegate_view_->SetPaneFocusAndFocusDefault(); + } return true; } @@ -570,21 +520,21 @@ switch (state) { case session_manager::SessionState::ACTIVE: login_shelf_view_->SetVisible(false); - GetShelfView()->SetVisible(true); + hotseat_widget()->GetShelfView()->SetVisible(true); break; case session_manager::SessionState::LOCKED: case session_manager::SessionState::LOGIN_SECONDARY: - GetShelfView()->SetVisible(false); + hotseat_widget()->GetShelfView()->SetVisible(false); login_shelf_view_->SetVisible(true); break; case session_manager::SessionState::OOBE: login_shelf_view_->SetVisible(true); - GetShelfView()->SetVisible(false); + hotseat_widget()->GetShelfView()->SetVisible(false); break; case session_manager::SessionState::LOGIN_PRIMARY: case session_manager::SessionState::LOGGED_IN_NOT_ACTIVE: login_shelf_view_->SetVisible(true); - GetShelfView()->SetVisible(false); + hotseat_widget()->GetShelfView()->SetVisible(false); break; default: // session_manager::SessionState::UNKNOWN handled in if statement above. @@ -613,21 +563,6 @@ Show(); } -ShelfView* ShelfWidget::GetShelfView() { - if (IsScrollableShelfEnabled()) { - DCHECK(scrollable_shelf_view_); - return scrollable_shelf_view_->shelf_view(); - } - - DCHECK(shelf_view_); - return shelf_view_; -} - -const ShelfView* ShelfWidget::GetShelfView() const { - return const_cast<const ShelfView*>( - const_cast<ShelfWidget*>(this)->GetShelfView()); -} - void ShelfWidget::OnMouseEvent(ui::MouseEvent* event) { if (event->type() == ui::ET_MOUSE_PRESSED) { keyboard::KeyboardUIController::Get()->HideKeyboardImplicitlyByUser();
diff --git a/ash/shelf/shelf_widget.h b/ash/shelf/shelf_widget.h index 763a1201..3c0e1caa4 100644 --- a/ash/shelf/shelf_widget.h +++ b/ash/shelf/shelf_widget.h
@@ -10,12 +10,11 @@ #include "ash/ash_export.h" #include "ash/public/cpp/shelf_types.h" #include "ash/session/session_observer.h" -#include "ash/shelf/scrollable_shelf_view.h" +#include "ash/shelf/hotseat_widget.h" #include "ash/shelf/shelf_background_animator.h" #include "ash/shelf/shelf_layout_manager_observer.h" #include "ash/shelf/shelf_observer.h" #include "base/macros.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/views/widget/widget.h" namespace app_list { @@ -24,10 +23,10 @@ namespace ash { enum class AnimationChangeType; -class HomeButton; -class HotseatWidget; class BackButton; class FocusCycler; +class HomeButton; +class HotseatWidget; class LoginShelfView; class Shelf; class ShelfLayoutManager; @@ -73,6 +72,9 @@ const Shelf* shelf() const { return shelf_; } ShelfLayoutManager* shelf_layout_manager() { return shelf_layout_manager_; } + + // TODO(manucornet): Move these three getters directly to |Shelf| to make it + // clear that they are on the same level as the shelf widget. ShelfNavigationWidget* navigation_widget() const { return navigation_widget_.get(); } @@ -85,13 +87,8 @@ bool IsShowingAppList() const; bool IsShowingMenu() const; - bool IsShowingOverflowBubble() const; - // Focuses the first or the last app shortcut inside the overflow shelf. - // Does nothing if the overflow shelf is not currently shown. - void FocusOverflowShelf(bool last_element); - - // Sets the focus cycler. Also adds the shelf to the cycle. + // Sets the focus cycler. Also adds the shelf to the cycle. void SetFocusCycler(FocusCycler* focus_cycler); FocusCycler* GetFocusCycler(); @@ -112,10 +109,6 @@ void set_default_last_focusable_child(bool default_last_focusable_child); - // Finds the first or last focusable child of the set (main shelf + overflow) - // and focuses it. - void FocusFirstOrLastFocusableChild(bool last); - // views::Widget: void OnMouseEvent(ui::MouseEvent* event) override; void OnGestureEvent(ui::GestureEvent* event) override; @@ -139,9 +132,7 @@ // Internal implementation detail. Do not expose outside of tests. ShelfView* shelf_view_for_testing() const { - if (chromeos::switches::ShouldShowScrollableShelf()) - return scrollable_shelf_view_->shelf_view(); - return shelf_view_; + return hotseat_widget()->GetShelfView(); } ShelfBackgroundAnimator* background_animator_for_testing() { @@ -177,11 +168,6 @@ // during CloseChildWindows of the associated RootWindowController. DelegateView* delegate_view_; - // View containing the shelf items within an active user session. Owned by - // the views hierarchy. - ShelfView* shelf_view_ = nullptr; - ScrollableShelfView* scrollable_shelf_view_ = nullptr; - // View containing the shelf items for Login/Lock/OOBE/Add User screens. // Owned by the views hierarchy. LoginShelfView* login_shelf_view_;
diff --git a/ash/shelf/shelf_widget_unittest.cc b/ash/shelf/shelf_widget_unittest.cc index 62c63818f..d2efe1b 100644 --- a/ash/shelf/shelf_widget_unittest.cc +++ b/ash/shelf/shelf_widget_unittest.cc
@@ -11,10 +11,12 @@ #include "ash/public/cpp/ash_switches.h" #include "ash/public/cpp/keyboard/keyboard_switches.h" #include "ash/root_window_controller.h" +#include "ash/screen_util.h" #include "ash/shelf/login_shelf_view.h" #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_constants.h" #include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_navigation_widget.h" #include "ash/shelf/shelf_view.h" #include "ash/shelf/shelf_view_test_api.h" #include "ash/shell.h" @@ -143,9 +145,17 @@ shelf_widget->status_area_widget()->GetWindowBoundsInScreen().width(); // Test only makes sense if the status is > 0, which it better be. EXPECT_GT(status_width, 0); - EXPECT_EQ(status_width, - shelf_widget->GetContentsView()->width() - - GetPrimaryShelf()->GetShelfViewForTesting()->width()); + + const int total_width = + screen_util::GetDisplayBoundsWithShelf(shelf_widget->GetNativeWindow()) + .width(); + const int nav_width = + shelf_widget->navigation_widget()->GetWindowBoundsInScreen().width(); + const int hotseat_width = + GetPrimaryShelf()->GetShelfViewForTesting()->width(); + const int margins = + ShelfConstants::home_button_edge_spacing() + kAppIconGroupMargin; + EXPECT_EQ(status_width, total_width - nav_width - hotseat_width - margins); } // Verifies when the shell is deleted with a full screen window we don't crash. @@ -182,18 +192,36 @@ // Simulate login. CreateUserSessions(1); + const int total_width1 = + screen_util::GetDisplayBoundsWithShelf(shelf_widget1->GetNativeWindow()) + .width(); + const int nav_width1 = + shelf_widget1->navigation_widget()->GetWindowBoundsInScreen().width(); + const int hotseat_width1 = + shelf_widget1->hotseat_widget()->GetWindowBoundsInScreen().width(); + const int margins = + ShelfConstants::home_button_edge_spacing() + kAppIconGroupMargin; + + const int total_width2 = + screen_util::GetDisplayBoundsWithShelf(shelf_widget2->GetNativeWindow()) + .width(); + const int nav_width2 = + shelf_widget2->navigation_widget()->GetWindowBoundsInScreen().width(); + const int hotseat_width2 = + shelf_widget2->hotseat_widget()->GetWindowBoundsInScreen().width(); + // The shelf view and status area horizontally fill the shelf widget. const int status_width1 = shelf_widget1->status_area_widget()->GetWindowBoundsInScreen().width(); EXPECT_GT(status_width1, 0); - EXPECT_EQ(shelf_widget1->GetContentsView()->width(), - shelf1->GetShelfViewForTesting()->width() + status_width1); + EXPECT_EQ(total_width1, + nav_width1 + hotseat_width1 + margins + status_width1); const int status_width2 = shelf_widget2->status_area_widget()->GetWindowBoundsInScreen().width(); EXPECT_GT(status_width2, 0); - EXPECT_EQ(shelf_widget2->GetContentsView()->width(), - shelf2->GetShelfViewForTesting()->width() + status_width2); + EXPECT_EQ(total_width2, + nav_width2 + hotseat_width2 + margins + status_width2); } // Tests that the shelf lets mouse-events close to the edge fall through to the
diff --git a/ash/system/message_center/arc/arc_notification_manager_unittest.cc b/ash/system/message_center/arc/arc_notification_manager_unittest.cc index ada0edf1..d7886667 100644 --- a/ash/system/message_center/arc/arc_notification_manager_unittest.cc +++ b/ash/system/message_center/arc/arc_notification_manager_unittest.cc
@@ -167,7 +167,7 @@ base::RunLoop().RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestArcAppIdProvider app_id_provider_; std::unique_ptr<arc::FakeNotificationsInstance> arc_notifications_instance_; std::unique_ptr<mojo::Binding<arc::mojom::NotificationsInstance>> binding_;
diff --git a/ash/system/power/power_status_unittest.cc b/ash/system/power/power_status_unittest.cc index 02a67a9..1128b85 100644 --- a/ash/system/power/power_status_unittest.cc +++ b/ash/system/power/power_status_unittest.cc
@@ -41,8 +41,7 @@ class PowerStatusTest : public testing::Test { public: PowerStatusTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), power_status_(NULL) {} ~PowerStatusTest() override = default; @@ -62,7 +61,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; PowerStatus* power_status_; // Not owned. std::unique_ptr<TestObserver> test_observer_;
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index bd421c0..db5e249 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc
@@ -116,7 +116,7 @@ ///////////////////////////////////////////////////////////////////////////// AshTestBase::AshTestBase(AshTestBase::SubclassManagesTaskEnvironment /* tag */) - : scoped_task_environment_(base::nullopt) {} + : task_environment_(base::nullopt) {} AshTestBase::~AshTestBase() { CHECK(setup_called_) @@ -127,7 +127,7 @@ void AshTestBase::SetUp() { // At this point, the task APIs should already be provided either by - // |scoped_task_environment_| or by the subclass in the + // |task_environment_| or by the subclass in the // SubclassManagesTaskEnvironment mode. CHECK(base::ThreadTaskRunnerHandle::IsSet()); CHECK(base::ThreadPoolInstance::Get());
diff --git a/ash/test/ash_test_base.h b/ash/test/ash_test_base.h index f613c8e..ab234fb 100644 --- a/ash/test/ash_test_base.h +++ b/ash/test/ash_test_base.h
@@ -36,7 +36,7 @@ namespace base { namespace test { -class ScopedTaskEnvironment; +class TaskEnvironment; } } // namespace base @@ -74,17 +74,16 @@ class AshTestBase : public testing::Test { public: // Constructs an AshTestBase with |traits| being forwarded to its - // ScopedTaskEnvironment. MainThreadType always defaults to UI and must not be + // TaskEnvironment. MainThreadType always defaults to UI and must not be // specified. template <typename... TaskEnvironmentTraits> NOINLINE explicit AshTestBase(TaskEnvironmentTraits... traits) - : scoped_task_environment_( - base::in_place, - base::test::ScopedTaskEnvironment::MainThreadType::UI, - traits...) {} + : task_environment_(base::in_place, + base::test::TaskEnvironment::MainThreadType::UI, + traits...) {} // Alternatively a subclass may pass this tag to ask this AshTestBase not to - // instantiate a ScopedTaskEnvironment. The subclass is then responsible to + // instantiate a TaskEnvironment. The subclass is then responsible to // instantiate one before AshTestBase::SetUp(). struct SubclassManagesTaskEnvironment {}; explicit AshTestBase(SubclassManagesTaskEnvironment tag); @@ -282,14 +281,14 @@ // protected so it can be accesssed by test subclasses to drive the task // environment. protected: - // |scoped_task_environment_| is initialized-once at construction time but + // |task_environment_| is initialized-once at construction time but // subclasses may elect to provide their own. Declare it last to ensure its // initialization/destruction semantics are identical in the // SubclassManagesTaskEnvironment mode. - base::Optional<base::test::ScopedTaskEnvironment> scoped_task_environment_; + base::Optional<base::test::TaskEnvironment> task_environment_; // Private again for DISALLOW_COPY_AND_ASSIGN; additional members should be - // added in the first private section to be before |scoped_task_environment_|. + // added in the first private section to be before |task_environment_|. private: DISALLOW_COPY_AND_ASSIGN(AshTestBase); };
diff --git a/ash/test/ash_test_helper_unittest.cc b/ash/test/ash_test_helper_unittest.cc index ceeb3d0..d399d2bc 100644 --- a/ash/test/ash_test_helper_unittest.cc +++ b/ash/test/ash_test_helper_unittest.cc
@@ -33,8 +33,8 @@ AshTestHelper* ash_test_helper() { return ash_test_helper_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; std::unique_ptr<AshTestHelper> ash_test_helper_;
diff --git a/ash/wm/overview/delayed_animation_observer_impl_unittest.cc b/ash/wm/overview/delayed_animation_observer_impl_unittest.cc index 348d4bd..714f261 100644 --- a/ash/wm/overview/delayed_animation_observer_impl_unittest.cc +++ b/ash/wm/overview/delayed_animation_observer_impl_unittest.cc
@@ -61,7 +61,7 @@ class ForceDelayObserverTest : public AshTestBase { public: ForceDelayObserverTest() - : AshTestBase(base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : AshTestBase(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~ForceDelayObserverTest() override = default; private: @@ -76,12 +76,10 @@ delegate.AddEnterAnimationObserver(std::move(observer)); EXPECT_EQ(1u, delegate.num_enter_observers()); - scoped_task_environment_->FastForwardBy( - base::TimeDelta::FromMilliseconds(50)); + task_environment_->FastForwardBy(base::TimeDelta::FromMilliseconds(50)); base::RunLoop().RunUntilIdle(); EXPECT_EQ(1u, delegate.num_enter_observers()); - scoped_task_environment_->FastForwardBy( - base::TimeDelta::FromMilliseconds(55)); + task_environment_->FastForwardBy(base::TimeDelta::FromMilliseconds(55)); base::RunLoop().RunUntilIdle(); EXPECT_EQ(0u, delegate.num_enter_observers()); }
diff --git a/ash/wm/pip/pip_unittest.cc b/ash/wm/pip/pip_unittest.cc index 8eed660d..f733dff 100644 --- a/ash/wm/pip/pip_unittest.cc +++ b/ash/wm/pip/pip_unittest.cc
@@ -103,15 +103,16 @@ EXPECT_TRUE(pip_widget->IsActive()); EXPECT_FALSE(widget->IsActive()); - auto* shelf = AshTestBase::GetPrimaryShelf()->shelf_widget(); auto* navigation_widget = AshTestBase::GetPrimaryShelf()->shelf_widget()->navigation_widget(); + auto* hotseat_widget = + AshTestBase::GetPrimaryShelf()->shelf_widget()->hotseat_widget(); auto* status_area = Shell::GetPrimaryRootWindowController()->GetStatusAreaWidget(); // Cycle Backward. generator->PressKey(ui::VKEY_BROWSER_BACK, ui::EF_CONTROL_DOWN); - EXPECT_TRUE(shelf->IsActive()); + EXPECT_TRUE(hotseat_widget->IsActive()); generator->PressKey(ui::VKEY_BROWSER_BACK, ui::EF_CONTROL_DOWN); EXPECT_TRUE(status_area->IsActive()); @@ -136,10 +137,13 @@ EXPECT_TRUE(status_area->IsActive()); generator->PressKey(ui::VKEY_BROWSER_FORWARD, ui::EF_CONTROL_DOWN); - EXPECT_TRUE(shelf->IsActive()); + EXPECT_TRUE(hotseat_widget->IsActive()); generator->PressKey(ui::VKEY_BROWSER_FORWARD, ui::EF_CONTROL_DOWN); EXPECT_TRUE(pip_widget->IsActive()); + + generator->PressKey(ui::VKEY_BROWSER_FORWARD, ui::EF_CONTROL_DOWN); + EXPECT_TRUE(widget->IsActive()); } TEST_F(PipTest, PipInitialPositionAvoidsObstacles) {
diff --git a/base/BUILD.gn b/base/BUILD.gn index b236f41..3ab36cb 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -1747,6 +1747,8 @@ "allocator/partition_allocator/partition_page.h", "allocator/partition_allocator/partition_root_base.cc", "allocator/partition_allocator/partition_root_base.h", + "allocator/partition_allocator/random.cc", + "allocator/partition_allocator/random.h", "allocator/partition_allocator/spin_lock.cc", "allocator/partition_allocator/spin_lock.h", ]
diff --git a/base/allocator/partition_allocator/address_space_randomization.cc b/base/allocator/partition_allocator/address_space_randomization.cc index 6a47e6c..66d338b1 100644 --- a/base/allocator/partition_allocator/address_space_randomization.cc +++ b/base/allocator/partition_allocator/address_space_randomization.cc
@@ -5,10 +5,9 @@ #include "base/allocator/partition_allocator/address_space_randomization.h" #include "base/allocator/partition_allocator/page_allocator.h" +#include "base/allocator/partition_allocator/random.h" #include "base/allocator/partition_allocator/spin_lock.h" #include "base/logging.h" -#include "base/no_destructor.h" -#include "base/rand_util.h" #include "build/build_config.h" #if defined(OS_WIN) @@ -19,65 +18,6 @@ namespace base { -namespace { - -// This is the same PRNG as used by tcmalloc for mapping address randomness; -// see http://burtleburtle.net/bob/rand/smallprng.html -struct RandomContext { - subtle::SpinLock lock; - bool initialized; - uint32_t a; - uint32_t b; - uint32_t c; - uint32_t d; -}; - -RandomContext* GetRandomContext() { - static NoDestructor<RandomContext> s_RandomContext; - return s_RandomContext.get(); -} - -#define rot(x, k) (((x) << (k)) | ((x) >> (32 - (k)))) - -uint32_t RandomValueInternal(RandomContext* x) { - uint32_t e = x->a - rot(x->b, 27); - x->a = x->b ^ rot(x->c, 17); - x->b = x->c + x->d; - x->c = x->d + e; - x->d = e + x->a; - return x->d; -} - -#undef rot - -uint32_t RandomValue(RandomContext* x) { - subtle::SpinLock::Guard guard(x->lock); - if (UNLIKELY(!x->initialized)) { - const uint64_t r1 = RandUint64(); - const uint64_t r2 = RandUint64(); - - x->a = static_cast<uint32_t>(r1); - x->b = static_cast<uint32_t>(r1 >> 32); - x->c = static_cast<uint32_t>(r2); - x->d = static_cast<uint32_t>(r2 >> 32); - - x->initialized = true; - } - - return RandomValueInternal(x); -} - -} // namespace - -void SetRandomPageBaseSeed(int64_t seed) { - RandomContext* x = GetRandomContext(); - subtle::SpinLock::Guard guard(x->lock); - // Set RNG to initial state. - x->initialized = true; - x->a = x->b = static_cast<uint32_t>(seed); - x->c = x->d = static_cast<uint32_t>(seed >> 32); -} - void* GetRandomPageBase() { uintptr_t random = static_cast<uintptr_t>(RandomValue(GetRandomContext())); @@ -110,7 +50,7 @@ // On win32 host systems the randomization plus huge alignment causes // excessive fragmentation. Plus most of these systems lack ASLR, so the // randomization isn't buying anything. In that case we just skip it. - // TODO(jschuh): Just dump the randomization when HE-ASLR is present. + // TODO(palmer): Just dump the randomization when HE-ASLR is present. static BOOL is_wow64 = -1; if (is_wow64 == -1 && !IsWow64Process(GetCurrentProcess(), &is_wow64)) is_wow64 = FALSE;
diff --git a/base/allocator/partition_allocator/address_space_randomization.h b/base/allocator/partition_allocator/address_space_randomization.h index fbb5558..e76c265a 100644 --- a/base/allocator/partition_allocator/address_space_randomization.h +++ b/base/allocator/partition_allocator/address_space_randomization.h
@@ -11,11 +11,6 @@ namespace base { -// Sets the seed for the random number generator used by GetRandomPageBase in -// order to generate a predictable sequence of addresses. May be called multiple -// times. -BASE_EXPORT void SetRandomPageBaseSeed(int64_t seed); - // Calculates a random preferred mapping address. In calculating an address, we // balance good ASLR against not fragmenting the address space too badly. BASE_EXPORT void* GetRandomPageBase();
diff --git a/base/allocator/partition_allocator/address_space_randomization_unittest.cc b/base/allocator/partition_allocator/address_space_randomization_unittest.cc index 395567a..437e47d 100644 --- a/base/allocator/partition_allocator/address_space_randomization_unittest.cc +++ b/base/allocator/partition_allocator/address_space_randomization_unittest.cc
@@ -7,6 +7,7 @@ #include <vector> #include "base/allocator/partition_allocator/page_allocator.h" +#include "base/allocator/partition_allocator/random.h" #include "base/logging.h" #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/allocator/partition_allocator/memory_reclaimer_unittest.cc b/base/allocator/partition_allocator/memory_reclaimer_unittest.cc index a897ed6..cb647ea 100644 --- a/base/allocator/partition_allocator/memory_reclaimer_unittest.cc +++ b/base/allocator/partition_allocator/memory_reclaimer_unittest.cc
@@ -24,7 +24,7 @@ public: PartitionAllocMemoryReclaimerTest() : ::testing::Test(), - task_environment_(test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + task_environment_(test::TaskEnvironment::TimeSource::MOCK_TIME), allocator_() {} protected: @@ -57,7 +57,7 @@ return 1; } - test::ScopedTaskEnvironment task_environment_; + test::TaskEnvironment task_environment_; std::unique_ptr<PartitionAllocatorGeneric> allocator_; };
diff --git a/base/allocator/partition_allocator/random.cc b/base/allocator/partition_allocator/random.cc new file mode 100644 index 0000000..e57b4489 --- /dev/null +++ b/base/allocator/partition_allocator/random.cc
@@ -0,0 +1,59 @@ +// Copyright 2019 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 "base/allocator/partition_allocator/random.h" + +#include "base/allocator/partition_allocator/spin_lock.h" +#include "base/no_destructor.h" +#include "base/rand_util.h" + +namespace base { + +// This is the same PRNG as used by tcmalloc for mapping address randomness; +// see http://burtleburtle.net/bob/rand/smallprng.html +struct RandomContext { + subtle::SpinLock lock; + bool initialized; + uint32_t a; + uint32_t b; + uint32_t c; + uint32_t d; +}; + +RandomContext* GetRandomContext() { + static NoDestructor<RandomContext> s_RandomContext; + return s_RandomContext.get(); +} + +uint32_t RandomValue(RandomContext* x) { + subtle::SpinLock::Guard guard(x->lock); + if (UNLIKELY(!x->initialized)) { + const uint64_t r1 = RandUint64(); + const uint64_t r2 = RandUint64(); + x->a = static_cast<uint32_t>(r1); + x->b = static_cast<uint32_t>(r1 >> 32); + x->c = static_cast<uint32_t>(r2); + x->d = static_cast<uint32_t>(r2 >> 32); + x->initialized = true; + } + +#define rot(x, k) (((x) << (k)) | ((x) >> (32 - (k)))) + uint32_t e = x->a - rot(x->b, 27); + x->a = x->b ^ rot(x->c, 17); + x->b = x->c + x->d; + x->c = x->d + e; + x->d = e + x->a; + return x->d; +#undef rot +} + +void SetRandomPageBaseSeed(int64_t seed) { + RandomContext* x = GetRandomContext(); + subtle::SpinLock::Guard guard(x->lock); + x->a = x->b = static_cast<uint32_t>(seed); + x->c = x->d = static_cast<uint32_t>(seed >> 32); + x->initialized = true; +} + +} // namespace base
diff --git a/base/allocator/partition_allocator/random.h b/base/allocator/partition_allocator/random.h new file mode 100644 index 0000000..de0e1534 --- /dev/null +++ b/base/allocator/partition_allocator/random.h
@@ -0,0 +1,34 @@ +// Copyright 2019 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 BASE_ALLOCATOR_PARTITION_ALLOCATOR_RANDOM_H_ +#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_RANDOM_H_ + +#include <stdint.h> + +#include "base/base_export.h" + +namespace base { + +struct RandomContext; + +// TODO(crbug.com/984742): This doesn't need to be part of the interface, and +// can be an implementation detail of `RandomValue`. +// +// Returns a pointer to the global `RandomContext`. If the context has not been +// initialized yet, initializes it with a random starting state. +RandomContext* GetRandomContext(); + +uint32_t RandomValue(RandomContext* x); + +// TODO(crbug.com/984742): Rename this to `SetRandomSeedForTesting`. +// +// Sets the seed for the random number generator to a known value, to cause the +// RNG to generate a predictable sequence of outputs. May be called multiple +// times. +BASE_EXPORT void SetRandomPageBaseSeed(int64_t seed); + +} // namespace base + +#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_RANDOM_H_
diff --git a/base/android/OWNERS b/base/android/OWNERS index 5c4095832..98d1b45 100644 --- a/base/android/OWNERS +++ b/base/android/OWNERS
@@ -1,5 +1,7 @@ agrieve@chromium.org +lizeb@chromium.org nyquist@chromium.org +pasko@chromium.org rmcilroy@chromium.org torne@chromium.org yfriedman@chromium.org
diff --git a/base/android/application_status_listener_unittest.cc b/base/android/application_status_listener_unittest.cc index 3d580d8..dc09dba 100644 --- a/base/android/application_status_listener_unittest.cc +++ b/base/android/application_status_listener_unittest.cc
@@ -92,14 +92,14 @@ ApplicationState state_; base::WaitableEvent event_; base::Thread thread_; - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; std::unique_ptr<ApplicationStatusListener> listener_; }; } // namespace TEST(ApplicationStatusListenerTest, SingleThread) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; ApplicationState result = kInvalidApplicationState;
diff --git a/base/cancelable_callback_unittest.cc b/base/cancelable_callback_unittest.cc index da6c7bb..8a4087c 100644 --- a/base/cancelable_callback_unittest.cc +++ b/base/cancelable_callback_unittest.cc
@@ -168,7 +168,7 @@ // CancelableCallback posted to a task environment with PostTask. // - Posted callbacks can be cancelled. TEST(CancelableCallbackTest, PostTask) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; int count = 0; CancelableRepeatingClosure cancelable(
diff --git a/base/debug/task_trace_unittest.cc b/base/debug/task_trace_unittest.cc index d7c5933..5b4a396 100644 --- a/base/debug/task_trace_unittest.cc +++ b/base/debug/task_trace_unittest.cc
@@ -61,7 +61,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; base::SingleThreadTaskRunner& task_runner = *task_environment.GetMainThreadTaskRunner();
diff --git a/base/deferred_sequenced_task_runner_unittest.cc b/base/deferred_sequenced_task_runner_unittest.cc index 4eabf969..df930d15 100644 --- a/base/deferred_sequenced_task_runner_unittest.cc +++ b/base/deferred_sequenced_task_runner_unittest.cc
@@ -60,7 +60,7 @@ : runner_( new DeferredSequencedTaskRunner(ThreadTaskRunnerHandle::Get())) {} - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; scoped_refptr<DeferredSequencedTaskRunner> runner_; mutable Lock lock_; std::vector<int> executed_task_ids_;
diff --git a/base/files/file_descriptor_watcher_posix.h b/base/files/file_descriptor_watcher_posix.h index 6eff314..3230350 100644 --- a/base/files/file_descriptor_watcher_posix.h +++ b/base/files/file_descriptor_watcher_posix.h
@@ -24,7 +24,7 @@ // The FileDescriptorWatcher API allows callbacks to be invoked when file // descriptors are readable or writable without blocking. // -// To enable this API in unit tests, use a ScopedTaskEnvironment with +// To enable this API in unit tests, use a TaskEnvironment with // MainThreadType::IO. // // Note: Prefer FileDescriptorWatcher to MessageLoopForIO::WatchFileDescriptor()
diff --git a/base/files/file_descriptor_watcher_posix_unittest.cc b/base/files/file_descriptor_watcher_posix_unittest.cc index b9f8a95..709a1e1 100644 --- a/base/files/file_descriptor_watcher_posix_unittest.cc +++ b/base/files/file_descriptor_watcher_posix_unittest.cc
@@ -49,11 +49,11 @@ : public testing::TestWithParam<FileDescriptorWatcherTestType> { public: FileDescriptorWatcherTest() - : scoped_task_environment_(std::make_unique<test::ScopedTaskEnvironment>( + : task_environment_(std::make_unique<test::TaskEnvironment>( GetParam() == FileDescriptorWatcherTestType:: MESSAGE_PUMP_FOR_IO_ON_MAIN_THREAD - ? test::ScopedTaskEnvironment::MainThreadType::IO - : test::ScopedTaskEnvironment::MainThreadType::DEFAULT)), + ? test::TaskEnvironment::MainThreadType::IO + : test::TaskEnvironment::MainThreadType::DEFAULT)), other_thread_("FileDescriptorWatcherTest_OtherThread") {} ~FileDescriptorWatcherTest() override = default; @@ -74,7 +74,7 @@ void TearDown() override { if (GetParam() == FileDescriptorWatcherTestType::MESSAGE_PUMP_FOR_IO_ON_MAIN_THREAD && - scoped_task_environment_) { + task_environment_) { // Allow the delete task posted by the Controller's destructor to run. base::RunLoop().RunUntilIdle(); } @@ -142,7 +142,7 @@ testing::StrictMock<Mock> mock_; // Task environment bound to the main thread. - std::unique_ptr<test::ScopedTaskEnvironment> scoped_task_environment_; + std::unique_ptr<test::TaskEnvironment> task_environment_; // Thread running an IO message pump. Used when the test type is // MESSAGE_PUMP_FOR_IO_ON_OTHER_THREAD. @@ -292,7 +292,7 @@ // Delete the task environment. if (GetParam() == FileDescriptorWatcherTestType::MESSAGE_PUMP_FOR_IO_ON_MAIN_THREAD) { - scoped_task_environment_.reset(); + task_environment_.reset(); } else { other_thread_.Stop(); }
diff --git a/base/files/file_path_watcher_unittest.cc b/base/files/file_path_watcher_unittest.cc index eb1c1b36..b0e8f977 100644 --- a/base/files/file_path_watcher_unittest.cc +++ b/base/files/file_path_watcher_unittest.cc
@@ -143,8 +143,7 @@ public: FilePathWatcherTest() #if defined(OS_POSIX) - : scoped_task_environment_( - test::ScopedTaskEnvironment::MainThreadType::IO) + : task_environment_(test::TaskEnvironment::MainThreadType::IO) #endif { } @@ -205,7 +204,7 @@ NotificationCollector* collector() { return collector_.get(); } - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; ScopedTempDir temp_dir_; scoped_refptr<NotificationCollector> collector_;
diff --git a/base/files/file_proxy_unittest.cc b/base/files/file_proxy_unittest.cc index 0ebaa0e..e1799464 100644 --- a/base/files/file_proxy_unittest.cc +++ b/base/files/file_proxy_unittest.cc
@@ -27,8 +27,7 @@ class FileProxyTest : public testing::Test { public: FileProxyTest() - : scoped_task_environment_( - test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(test::TaskEnvironment::MainThreadType::IO), file_thread_("FileProxyTestFileThread"), error_(File::FILE_OK), bytes_written_(-1) {} @@ -94,7 +93,7 @@ const FilePath TestPath() const { return dir_.GetPath().AppendASCII("test"); } ScopedTempDir dir_; - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; Thread file_thread_; File::Error error_;
diff --git a/base/files/important_file_writer_unittest.cc b/base/files/important_file_writer_unittest.cc index d752287..63e7ce9 100644 --- a/base/files/important_file_writer_unittest.cc +++ b/base/files/important_file_writer_unittest.cc
@@ -124,7 +124,7 @@ protected: WriteCallbacksObserver write_callback_observer_; FilePath file_; - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; private: ScopedTempDir temp_dir_;
diff --git a/base/fuchsia/service_directory_test_base.h b/base/fuchsia/service_directory_test_base.h index 6f36abaa2..93f6965e 100644 --- a/base/fuchsia/service_directory_test_base.h +++ b/base/fuchsia/service_directory_test_base.h
@@ -31,9 +31,9 @@ protected: const RunLoop::ScopedRunTimeoutForTest run_timeout_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<sys::OutgoingDirectory> outgoing_directory_; TestInterfaceImpl test_service_;
diff --git a/base/fuchsia/service_provider_impl_unittest.cc b/base/fuchsia/service_provider_impl_unittest.cc index 95c1fd6..c212e01b 100644 --- a/base/fuchsia/service_provider_impl_unittest.cc +++ b/base/fuchsia/service_provider_impl_unittest.cc
@@ -55,9 +55,9 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, + base::test::TaskEnvironment::MainThreadType::IO}; TestInterfaceImpl test_service_; sys::OutgoingDirectory service_directory_;
diff --git a/base/ios/weak_nsobject_unittest.mm b/base/ios/weak_nsobject_unittest.mm index 8a7ffcd..6ee78e5 100644 --- a/base/ios/weak_nsobject_unittest.mm +++ b/base/ios/weak_nsobject_unittest.mm
@@ -120,7 +120,7 @@ // Tests that the weak object can be copied on a different thread. TEST(WeakNSObjectTest, WeakNSObjectCopyOnOtherThread) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; Thread other_thread("WeakNSObjectCopyOnOtherThread"); other_thread.Start();
diff --git a/base/logging_unittest.cc b/base/logging_unittest.cc index 53787b1..6290c47 100644 --- a/base/logging_unittest.cc +++ b/base/logging_unittest.cc
@@ -93,8 +93,8 @@ class LoggingTest : public testing::Test { private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; LogStateSaver log_state_saver_; };
diff --git a/base/memory/memory_pressure_listener_unittest.cc b/base/memory/memory_pressure_listener_unittest.cc index b536b568..65d339b 100644 --- a/base/memory/memory_pressure_listener_unittest.cc +++ b/base/memory/memory_pressure_listener_unittest.cc
@@ -16,8 +16,7 @@ class MemoryPressureListenerTest : public testing::Test { public: MemoryPressureListenerTest() - : scoped_task_environment_( - test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { listener_ = std::make_unique<MemoryPressureListener>(BindRepeating( @@ -49,7 +48,7 @@ MOCK_METHOD1(OnMemoryPressure, void(MemoryPressureListener::MemoryPressureLevel)); - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; std::unique_ptr<MemoryPressureListener> listener_; };
diff --git a/base/memory/memory_pressure_monitor_chromeos_unittest.cc b/base/memory/memory_pressure_monitor_chromeos_unittest.cc index 9cacedd..494598f 100644 --- a/base/memory/memory_pressure_monitor_chromeos_unittest.cc +++ b/base/memory/memory_pressure_monitor_chromeos_unittest.cc
@@ -146,8 +146,8 @@ const std::string kInitialAvailableContents = "1500"; ASSERT_TRUE(SetFileContents(available_file, kInitialAvailableContents)); - test::ScopedTaskEnvironment scoped_task_environment( - test::ScopedTaskEnvironment::MainThreadType::UI); + test::TaskEnvironment task_environment( + test::TaskEnvironment::MainThreadType::UI); // We will use a mock listener to keep track of our kernel notifications which // cause event to be fired. We can just examine the sequence of pressure
diff --git a/base/memory/memory_pressure_monitor_win_unittest.cc b/base/memory/memory_pressure_monitor_win_unittest.cc index 175f6f1c..03832e2 100644 --- a/base/memory/memory_pressure_monitor_win_unittest.cc +++ b/base/memory/memory_pressure_monitor_win_unittest.cc
@@ -152,8 +152,8 @@ monitor->CalculateCurrentPressureLevel()); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; }; // Tests the fundamental direct calculation of memory pressure with automatic
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h index b8b3142..c2ccdad1 100644 --- a/base/message_loop/message_loop.h +++ b/base/message_loop/message_loop.h
@@ -81,7 +81,7 @@ // Please be SURE your task is reentrant (nestable) and all global variables // are stable and accessible before calling SetNestableTasksAllowed(true). // -// DEPRECATED: Use a SingleThreadTaskExecutor instead or ScopedTaskEnvironment +// DEPRECATED: Use a SingleThreadTaskExecutor instead or TaskEnvironment // for tests. TODO(https://crbug.com/891670/) remove this class. class BASE_EXPORT MessageLoop { public:
diff --git a/base/metrics/field_trial_unittest.cc b/base/metrics/field_trial_unittest.cc index f925fbc..eb41c81 100644 --- a/base/metrics/field_trial_unittest.cc +++ b/base/metrics/field_trial_unittest.cc
@@ -104,7 +104,7 @@ FieldTrialTest() : trial_list_(nullptr) {} private: - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; FieldTrialList trial_list_; DISALLOW_COPY_AND_ASSIGN(FieldTrialTest);
diff --git a/base/observer_list_threadsafe_unittest.cc b/base/observer_list_threadsafe_unittest.cc index d2eaf9f..63d26e4 100644 --- a/base/observer_list_threadsafe_unittest.cc +++ b/base/observer_list_threadsafe_unittest.cc
@@ -137,7 +137,7 @@ } // namespace TEST(ObserverListThreadSafeTest, BasicTest) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; scoped_refptr<ObserverListThreadSafe<Foo>> observer_list( new ObserverListThreadSafe<Foo>); @@ -166,7 +166,7 @@ } TEST(ObserverListThreadSafeTest, RemoveObserver) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; scoped_refptr<ObserverListThreadSafe<Foo>> observer_list( new ObserverListThreadSafe<Foo>); @@ -209,7 +209,7 @@ { // Add c when there's a sequence. - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; observer_list->AddObserver(&c); observer_list->Notify(FROM_HERE, &Foo::Observe, 10); @@ -238,7 +238,7 @@ observer_list->RemoveObserver(&a); // Notifying should not fail but should also be a no-op. - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; observer_list->AddObserver(&b); observer_list->Notify(FROM_HERE, &Foo::Observe, 30); RunLoop().RunUntilIdle(); @@ -269,7 +269,7 @@ }; TEST(ObserverListThreadSafeTest, RemoveMultipleObservers) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; scoped_refptr<ObserverListThreadSafe<Foo>> observer_list( new ObserverListThreadSafe<Foo>); @@ -292,7 +292,7 @@ // observer threads will also trigger notifications to all observers. static void ThreadSafeObserverHarness(int num_threads, bool cross_thread_notifies) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; scoped_refptr<ObserverListThreadSafe<Foo>> observer_list( new ObserverListThreadSafe<Foo>); @@ -320,7 +320,7 @@ RunLoop().RunUntilIdle(); } - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } TEST(ObserverListThreadSafeTest, CrossThreadObserver) { @@ -335,13 +335,13 @@ } TEST(ObserverListThreadSafeTest, OutlivesTaskEnvironment) { - Optional<test::ScopedTaskEnvironment> scoped_task_environment(in_place); + Optional<test::TaskEnvironment> task_environment(in_place); scoped_refptr<ObserverListThreadSafe<Foo>> observer_list( new ObserverListThreadSafe<Foo>); Adder a(1); observer_list->AddObserver(&a); - scoped_task_environment.reset(); + task_environment.reset(); // Test passes if we don't crash here. observer_list->Notify(FROM_HERE, &Foo::Observe, 1); } @@ -372,7 +372,7 @@ // Verify that observers are notified on the correct sequence. TEST(ObserverListThreadSafeTest, NotificationOnValidSequence) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; auto task_runner_1 = CreateSequencedTaskRunner(TaskTraits(ThreadPool())); auto task_runner_2 = CreateSequencedTaskRunner(TaskTraits(ThreadPool())); @@ -402,7 +402,7 @@ // Verify that when an observer is added to a NOTIFY_ALL ObserverListThreadSafe // from a notification, it is itself notified. TEST(ObserverListThreadSafeTest, AddObserverFromNotificationNotifyAll) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; auto observer_list = MakeRefCounted<ObserverListThreadSafe<Foo>>(); Adder observer_added_from_notification(1); @@ -460,7 +460,7 @@ // This must be after the declaration of |barrier| so that tasks posted to // ThreadPool can safely use |barrier|. - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; CreateSequencedTaskRunner({ThreadPool(), MayBlock()}) ->PostTask(FROM_HERE, @@ -477,7 +477,7 @@ // Same as ObserverListTest.Existing, but for ObserverListThreadSafe TEST(ObserverListThreadSafeTest, Existing) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; scoped_refptr<ObserverListThreadSafe<Foo>> observer_list( new ObserverListThreadSafe<Foo>(ObserverListPolicy::EXISTING_ONLY)); Adder a(1);
diff --git a/base/one_shot_event_unittest.cc b/base/one_shot_event_unittest.cc index cf5a58ab..7ed53b55 100644 --- a/base/one_shot_event_unittest.cc +++ b/base/one_shot_event_unittest.cc
@@ -98,7 +98,7 @@ OneShotEvent event; scoped_refptr<base::TestSimpleTaskRunner> runner( new base::TestSimpleTaskRunner); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; int runner_i = 0; int loop_i = 0;
diff --git a/base/power_monitor/power_monitor_unittest.cc b/base/power_monitor/power_monitor_unittest.cc index 3d81d4f..8dce635 100644 --- a/base/power_monitor/power_monitor_unittest.cc +++ b/base/power_monitor/power_monitor_unittest.cc
@@ -22,7 +22,7 @@ PowerMonitorTestSource* source() { return power_monitor_source_; } private: - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; PowerMonitorTestSource* power_monitor_source_; DISALLOW_COPY_AND_ASSIGN(PowerMonitorTest);
diff --git a/base/process/process_util_unittest.cc b/base/process/process_util_unittest.cc index 1afbb26..eff6ad1 100644 --- a/base/process/process_util_unittest.cc +++ b/base/process/process_util_unittest.cc
@@ -751,7 +751,7 @@ #endif // defined(OS_POSIX) TEST_F(ProcessUtilTest, EnsureTerminationUndying) { - test::ScopedTaskEnvironment task_environment; + test::TaskEnvironment task_environment; Process child_process = SpawnChild("process_util_test_never_die"); ASSERT_TRUE(child_process.IsValid()); @@ -784,7 +784,7 @@ } TEST_F(ProcessUtilTest, EnsureTerminationGracefulExit) { - test::ScopedTaskEnvironment task_environment; + test::TaskEnvironment task_environment; Process child_process = SpawnChild("process_util_test_die_immediately"); ASSERT_TRUE(child_process.IsValid());
diff --git a/base/run_loop.cc b/base/run_loop.cc index 7fbf7a8..e96eb7c 100644 --- a/base/run_loop.cc +++ b/base/run_loop.cc
@@ -109,7 +109,7 @@ DCHECK(!GetTlsDelegate().Get()) << "Error: Multiple RunLoop::Delegates registered on the same thread.\n\n" "Hint: You perhaps instantiated a second " - "MessageLoop/ScopedTaskEnvironment on a thread that already had one?"; + "MessageLoop/TaskEnvironment on a thread that already had one?"; GetTlsDelegate().Set(delegate); delegate->bound_ = true; }
diff --git a/base/run_loop.h b/base/run_loop.h index 95c5c00..f55d1fd 100644 --- a/base/run_loop.h +++ b/base/run_loop.h
@@ -271,7 +271,7 @@ // The currently-active timeout can also be temporarily disabled: // ScopedDisableRunTimeoutForTest disable_timeout; // - // ScopedTaskEnvironment applies a default Run() timeout after which a + // TaskEnvironment applies a default Run() timeout after which a // LOG(FATAL) is performed, to dump a crash stack for diagnosis. Tests adding // their own Run() timeouts can use e.g. MakeExpectedNotRunClosure().
diff --git a/base/run_loop_unittest.cc b/base/run_loop_unittest.cc index 1a343634..039d8148 100644 --- a/base/run_loop_unittest.cc +++ b/base/run_loop_unittest.cc
@@ -195,7 +195,7 @@ }; enum class RunLoopTestType { - // Runs all RunLoopTests under a ScopedTaskEnvironment to make sure real world + // Runs all RunLoopTests under a TaskEnvironment to make sure real world // scenarios work. kRealEnvironment, @@ -211,7 +211,7 @@ RunLoopTestEnvironment(RunLoopTestType type) { switch (type) { case RunLoopTestType::kRealEnvironment: { - task_environment_ = std::make_unique<test::ScopedTaskEnvironment>(); + task_environment_ = std::make_unique<test::TaskEnvironment>(); break; } case RunLoopTestType::kTestDelegate: { @@ -225,7 +225,7 @@ private: // Instantiates one or the other based on the RunLoopTestType. - std::unique_ptr<test::ScopedTaskEnvironment> task_environment_; + std::unique_ptr<test::TaskEnvironment> task_environment_; std::unique_ptr<InjectableTestDelegate> test_delegate_; }; @@ -549,7 +549,7 @@ testing::Values(RunLoopTestType::kTestDelegate)); TEST(ScopedRunTimeoutForTestTest, TimesOut) { - test::ScopedTaskEnvironment task_environment; + test::TaskEnvironment task_environment; RunLoop run_loop; static constexpr auto kArbitraryTimeout = @@ -574,7 +574,7 @@ } TEST(ScopedRunTimeoutForTestTest, RunTasksUntilTimeout) { - test::ScopedTaskEnvironment task_environment; + test::TaskEnvironment task_environment; RunLoop run_loop; static constexpr auto kArbitraryTimeout =
diff --git a/base/sequence_checker_unittest.cc b/base/sequence_checker_unittest.cc index b3a55ff4..3caa0095 100644 --- a/base/sequence_checker_unittest.cc +++ b/base/sequence_checker_unittest.cc
@@ -271,7 +271,7 @@ TEST(SequenceCheckerTest, CalledOnValidSequenceFromThreadDestruction) { ThreadLocalOwnedPointer<SequenceCheckerOwner> thread_local_owner; { - test::ScopedTaskEnvironment task_environment; + test::TaskEnvironment task_environment; auto task_runner = CreateSequencedTaskRunner({ThreadPool()}); task_runner->PostTask( FROM_HERE, BindLambdaForTesting([&]() {
diff --git a/base/sequenced_task_runner_unittest.cc b/base/sequenced_task_runner_unittest.cc index 1a6c6e9..2482042 100644 --- a/base/sequenced_task_runner_unittest.cc +++ b/base/sequenced_task_runner_unittest.cc
@@ -56,7 +56,7 @@ Thread foreign_thread_; private: - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(SequencedTaskRunnerTest); };
diff --git a/base/synchronization/waitable_event_watcher_unittest.cc b/base/synchronization/waitable_event_watcher_unittest.cc index 5acb5e16..524febf5 100644 --- a/base/synchronization/waitable_event_watcher_unittest.cc +++ b/base/synchronization/waitable_event_watcher_unittest.cc
@@ -22,11 +22,11 @@ namespace { // The main thread types on which each waitable event should be tested. -const test::ScopedTaskEnvironment::MainThreadType testing_main_threads[] = { - test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - test::ScopedTaskEnvironment::MainThreadType::IO, +const test::TaskEnvironment::MainThreadType testing_main_threads[] = { + test::TaskEnvironment::MainThreadType::DEFAULT, + test::TaskEnvironment::MainThreadType::IO, #if !defined(OS_IOS) // iOS does not allow direct running of the UI loop. - test::ScopedTaskEnvironment::MainThreadType::UI, + test::TaskEnvironment::MainThreadType::UI, #endif }; @@ -49,11 +49,10 @@ } // namespace class WaitableEventWatcherTest - : public testing::TestWithParam< - test::ScopedTaskEnvironment::MainThreadType> {}; + : public testing::TestWithParam<test::TaskEnvironment::MainThreadType> {}; TEST_P(WaitableEventWatcherTest, BasicSignalManual) { - test::ScopedTaskEnvironment scoped_task_environment(GetParam()); + test::TaskEnvironment task_environment(GetParam()); // A manual-reset event that is not yet signaled. WaitableEvent event(WaitableEvent::ResetPolicy::MANUAL, @@ -71,7 +70,7 @@ } TEST_P(WaitableEventWatcherTest, BasicSignalAutomatic) { - test::ScopedTaskEnvironment scoped_task_environment(GetParam()); + test::TaskEnvironment task_environment(GetParam()); WaitableEvent event(WaitableEvent::ResetPolicy::AUTOMATIC, WaitableEvent::InitialState::NOT_SIGNALED); @@ -89,7 +88,7 @@ } TEST_P(WaitableEventWatcherTest, BasicCancel) { - test::ScopedTaskEnvironment scoped_task_environment(GetParam()); + test::TaskEnvironment task_environment(GetParam()); // A manual-reset event that is not yet signaled. WaitableEvent event(WaitableEvent::ResetPolicy::MANUAL, @@ -104,7 +103,7 @@ } TEST_P(WaitableEventWatcherTest, CancelAfterSet) { - test::ScopedTaskEnvironment scoped_task_environment(GetParam()); + test::TaskEnvironment task_environment(GetParam()); // A manual-reset event that is not yet signaled. WaitableEvent event(WaitableEvent::ResetPolicy::MANUAL, @@ -141,7 +140,7 @@ { std::unique_ptr<WaitableEventWatcher> watcher; { - test::ScopedTaskEnvironment scoped_task_environment(GetParam()); + test::TaskEnvironment task_environment(GetParam()); watcher = std::make_unique<WaitableEventWatcher>(); watcher->StartWatching(&event, BindOnce(&QuitWhenSignaled), @@ -151,7 +150,7 @@ } TEST_P(WaitableEventWatcherTest, SignaledAtStartManual) { - test::ScopedTaskEnvironment scoped_task_environment(GetParam()); + test::TaskEnvironment task_environment(GetParam()); WaitableEvent event(WaitableEvent::ResetPolicy::MANUAL, WaitableEvent::InitialState::SIGNALED); @@ -166,7 +165,7 @@ } TEST_P(WaitableEventWatcherTest, SignaledAtStartAutomatic) { - test::ScopedTaskEnvironment scoped_task_environment(GetParam()); + test::TaskEnvironment task_environment(GetParam()); WaitableEvent event(WaitableEvent::ResetPolicy::AUTOMATIC, WaitableEvent::InitialState::SIGNALED); @@ -182,7 +181,7 @@ } TEST_P(WaitableEventWatcherTest, StartWatchingInCallback) { - test::ScopedTaskEnvironment scoped_task_environment(GetParam()); + test::TaskEnvironment task_environment(GetParam()); WaitableEvent event(WaitableEvent::ResetPolicy::MANUAL, WaitableEvent::InitialState::NOT_SIGNALED); @@ -206,7 +205,7 @@ } TEST_P(WaitableEventWatcherTest, MultipleWatchersManual) { - test::ScopedTaskEnvironment scoped_task_environment(GetParam()); + test::TaskEnvironment task_environment(GetParam()); WaitableEvent event(WaitableEvent::ResetPolicy::MANUAL, WaitableEvent::InitialState::NOT_SIGNALED); @@ -241,7 +240,7 @@ // Tests that only one async waiter gets called back for an auto-reset event. TEST_P(WaitableEventWatcherTest, MultipleWatchersAutomatic) { - test::ScopedTaskEnvironment scoped_task_environment(GetParam()); + test::TaskEnvironment task_environment(GetParam()); WaitableEvent event(WaitableEvent::ResetPolicy::AUTOMATIC, WaitableEvent::InitialState::NOT_SIGNALED); @@ -302,17 +301,17 @@ // bool parameter is used to test sleeping between watching and deletion. class WaitableEventWatcherDeletionTest : public testing::TestWithParam< - std::tuple<test::ScopedTaskEnvironment::MainThreadType, bool>> {}; + std::tuple<test::TaskEnvironment::MainThreadType, bool>> {}; TEST_P(WaitableEventWatcherDeletionTest, DeleteUnder) { - test::ScopedTaskEnvironment::MainThreadType main_thread_type; + test::TaskEnvironment::MainThreadType main_thread_type; bool delay_after_delete; std::tie(main_thread_type, delay_after_delete) = GetParam(); // Delete the WaitableEvent out from under the Watcher. This is explictly // allowed by the interface. - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment task_environment(main_thread_type); { WaitableEventWatcher watcher; @@ -337,13 +336,13 @@ } TEST_P(WaitableEventWatcherDeletionTest, SignalAndDelete) { - test::ScopedTaskEnvironment::MainThreadType main_thread_type; + test::TaskEnvironment::MainThreadType main_thread_type; bool delay_after_delete; std::tie(main_thread_type, delay_after_delete) = GetParam(); // Signal and immediately delete the WaitableEvent out from under the Watcher. - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment task_environment(main_thread_type); { WaitableEventWatcher watcher; @@ -374,11 +373,11 @@ // Tests deleting the WaitableEventWatcher between signaling the event and // when the callback should be run. TEST_P(WaitableEventWatcherDeletionTest, DeleteWatcherBeforeCallback) { - test::ScopedTaskEnvironment::MainThreadType main_thread_type; + test::TaskEnvironment::MainThreadType main_thread_type; bool delay_after_delete; std::tie(main_thread_type, delay_after_delete) = GetParam(); - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment task_environment(main_thread_type); scoped_refptr<SingleThreadTaskRunner> task_runner = ThreadTaskRunnerHandle::Get();
diff --git a/base/system/sys_info_unittest.cc b/base/system/sys_info_unittest.cc index 80efb99..5292df5 100644 --- a/base/system/sys_info_unittest.cc +++ b/base/system/sys_info_unittest.cc
@@ -161,7 +161,7 @@ #endif TEST_F(SysInfoTest, GetHardwareInfo) { - test::ScopedTaskEnvironment task_environment; + test::TaskEnvironment task_environment; base::Optional<SysInfo::HardwareInfo> hardware_info; auto callback = base::BindOnce(
diff --git a/base/system/system_monitor_unittest.cc b/base/system/system_monitor_unittest.cc index 912a5d4..4c151ac 100644 --- a/base/system/system_monitor_unittest.cc +++ b/base/system/system_monitor_unittest.cc
@@ -19,7 +19,7 @@ protected: SystemMonitorTest() { system_monitor_.reset(new SystemMonitor); } - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; std::unique_ptr<SystemMonitor> system_monitor_; private:
diff --git a/base/task/cancelable_task_tracker_unittest.cc b/base/task/cancelable_task_tracker_unittest.cc index 52e0a903..8166ffb 100644 --- a/base/task/cancelable_task_tracker_unittest.cc +++ b/base/task/cancelable_task_tracker_unittest.cc
@@ -33,7 +33,7 @@ private: // Needed by CancelableTaskTracker methods. - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; }; } // namespace
diff --git a/base/task/common/task_annotator_unittest.cc b/base/task/common/task_annotator_unittest.cc index de8aa17..2dc88e8 100644 --- a/base/task/common/task_annotator_unittest.cc +++ b/base/task/common/task_annotator_unittest.cc
@@ -153,7 +153,7 @@ // Ensure the task backtrace populates correctly. TEST_F(TaskAnnotatorBacktraceIntegrationTest, SingleThreadedSimple) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; const uint32_t dummy_ipc_hash = 0xDEADBEEF; const Location location0 = FROM_HERE; const Location location1 = FROM_HERE; @@ -211,7 +211,7 @@ // Ensure it works when posting tasks across multiple threads managed by //base. TEST_F(TaskAnnotatorBacktraceIntegrationTest, MultipleThreads) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; // Use diverse task runners (a task environment main thread, a ThreadPool // based SequencedTaskRunner, and a ThreadPool based @@ -312,7 +312,7 @@ // Ensure nesting doesn't break the chain. TEST_F(TaskAnnotatorBacktraceIntegrationTest, SingleThreadedNested) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; uint32_t dummy_ipc_hash = 0xDEADBEEF; uint32_t dummy_ipc_hash1 = 0xBAADF00D; uint32_t dummy_ipc_hash2 = 0x900DD099;
diff --git a/base/task/lazy_task_runner.h b/base/task/lazy_task_runner.h index fb1c430..b507118 100644 --- a/base/task/lazy_task_runner.h +++ b/base/task/lazy_task_runner.h
@@ -25,7 +25,7 @@ // tasks to the same sequence/thread from pieces of code that don't have a // better way of sharing a TaskRunner. It is important to use this class // instead of a self-managed global variable or LazyInstance so that the -// TaskRunners do not outlive the scope of the ScopedTaskEnvironment in unit +// TaskRunners do not outlive the scope of the TaskEnvironment in unit // tests (otherwise the next test in the same process will die in use-after- // frees). //
diff --git a/base/task/lazy_task_runner_unittest.cc b/base/task/lazy_task_runner_unittest.cc index dae11ea4..7c33d02a 100644 --- a/base/task/lazy_task_runner_unittest.cc +++ b/base/task/lazy_task_runner_unittest.cc
@@ -99,7 +99,7 @@ task_runner->PostTask(FROM_HERE, BindOnce(&InitCheckers, Unretained(&sequence_checker), Unretained(&thread_checker))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); OnceClosure task = expect_single_thread @@ -115,10 +115,10 @@ Unretained(&sequence_checker), Unretained(&thread_checker), expected_priority); task_runner->PostTask(FROM_HERE, std::move(task)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; private: DISALLOW_COPY_AND_ASSIGN(LazyTaskRunnerEnvironmentTest); @@ -160,8 +160,8 @@ TEST(LazyTaskRunnerTest, LazySequencedTaskRunnerReset) { for (int i = 0; i < 2; ++i) { - test::ScopedTaskEnvironment scoped_task_environment; - // If the TaskRunner isn't released when the test::ScopedTaskEnvironment + test::TaskEnvironment task_environment; + // If the TaskRunner isn't released when the test::TaskEnvironment // goes out of scope, the second invocation of the line below will access a // deleted ThreadPoolInstance and crash. g_sequenced_task_runner_user_visible.Get()->PostTask(FROM_HERE, @@ -171,8 +171,8 @@ TEST(LazyTaskRunnerTest, LazySingleThreadTaskRunnerReset) { for (int i = 0; i < 2; ++i) { - test::ScopedTaskEnvironment scoped_task_environment; - // If the TaskRunner isn't released when the test::ScopedTaskEnvironment + test::TaskEnvironment task_environment; + // If the TaskRunner isn't released when the test::TaskEnvironment // goes out of scope, the second invocation of the line below will access a // deleted ThreadPoolInstance and crash. g_single_thread_task_runner_user_visible.Get()->PostTask(FROM_HERE, @@ -183,8 +183,8 @@ #if defined(OS_WIN) TEST(LazyTaskRunnerTest, LazyCOMSTATaskRunnerReset) { for (int i = 0; i < 2; ++i) { - test::ScopedTaskEnvironment scoped_task_environment; - // If the TaskRunner isn't released when the test::ScopedTaskEnvironment + test::TaskEnvironment task_environment; + // If the TaskRunner isn't released when the test::TaskEnvironment // goes out of scope, the second invocation of the line below will access a // deleted ThreadPoolInstance and crash. g_com_sta_task_runner_user_visible.Get()->PostTask(FROM_HERE, DoNothing());
diff --git a/base/task/post_task.cc b/base/task/post_task.cc index c7b4b6c..dee5fed 100644 --- a/base/task/post_task.cc +++ b/base/task/post_task.cc
@@ -110,7 +110,7 @@ DCHECK(ThreadPoolInstance::Get()) << "Ref. Prerequisite section of post_task.h.\n\n" "Hint: if this is in a unit test, you're likely merely missing a " - "base::test::ScopedTaskEnvironment member in your fixture.\n"; + "base::test::TaskEnvironment member in your fixture.\n"; DCHECK(traits.use_thread_pool()) << "The base::UseThreadPool() trait is mandatory with " "CreateUpdateableSequencedTaskRunner().";
diff --git a/base/task/post_task.h b/base/task/post_task.h index 09bd82c..b02fd65a 100644 --- a/base/task/post_task.h +++ b/base/task/post_task.h
@@ -76,7 +76,7 @@ // valid. This is typically done during the initialization phase in each // process. If your code is not running in that phase, you most likely don't // have to worry about this. You will encounter DCHECKs or nullptr dereferences -// if this is violated. For tests, prefer base::test::ScopedTaskEnvironment. +// if this is violated. For tests, prefer base::test::TaskEnvironment. // Equivalent to calling PostTask with default TaskTraits. BASE_EXPORT bool PostTask(const Location& from_here, OnceClosure task);
diff --git a/base/task/post_task_unittest.cc b/base/task/post_task_unittest.cc index 052041cf..ddbbfec 100644 --- a/base/task/post_task_unittest.cc +++ b/base/task/post_task_unittest.cc
@@ -92,7 +92,7 @@ protected: testing::StrictMock<MockTaskExecutor> executor_; - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; }; TEST_F(PostTaskTestWithExecutor, PostTaskToThreadPool) {
diff --git a/base/task/promise/abstract_promise_unittest.cc b/base/task/promise/abstract_promise_unittest.cc index b558041..bfdb320 100644 --- a/base/task/promise/abstract_promise_unittest.cc +++ b/base/task/promise/abstract_promise_unittest.cc
@@ -306,7 +306,7 @@ return builder; } - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; }; TEST_F(AbstractPromiseTest, UnfulfilledPromise) { @@ -2443,7 +2443,7 @@ run_loop.Run(); EXPECT_TRUE(all_promise->IsRejected()); EXPECT_TRUE(p5->IsResolved()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } }
diff --git a/base/task/promise/promise_unittest.cc b/base/task/promise/promise_unittest.cc index a8a6454..4fc4c2a 100644 --- a/base/task/promise/promise_unittest.cc +++ b/base/task/promise/promise_unittest.cc
@@ -76,7 +76,7 @@ class PromiseTest : public testing::Test { public: - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; }; TEST(PromiseMemoryLeakTest, TargetTaskRunnerClearsTasks) { @@ -1141,7 +1141,7 @@ promise_resolver.reset(); })); run_loop.Run(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } }
diff --git a/base/task/single_thread_task_executor.h b/base/task/single_thread_task_executor.h index 497d810..a23b785 100644 --- a/base/task/single_thread_task_executor.h +++ b/base/task/single_thread_task_executor.h
@@ -20,7 +20,7 @@ } // namespace sequence_manager // A simple single thread TaskExecutor intended for non-test usage. Tests should -// generally use ScopedTaskEnvironment or TestBrowserThreadBundle instead. +// generally use TaskEnvironment or TestBrowserThreadBundle instead. // TODO(alexclarke): Inherit from TaskExecutor to support base::Here(). class BASE_EXPORT SingleThreadTaskExecutor { public:
diff --git a/base/task/thread_pool/thread_group_impl.cc b/base/task/thread_pool/thread_group_impl.cc index 511fa19..85bf0988 100644 --- a/base/task/thread_pool/thread_group_impl.cc +++ b/base/task/thread_pool/thread_group_impl.cc
@@ -41,6 +41,25 @@ #include "base/win/windows_version.h" #endif // defined(OS_WIN) +// Data from deprecated UMA histograms: +// +// ThreadPool.NumTasksBetweenWaits.(Browser/Renderer).Foreground, August 2019 +// Number of tasks between two waits by a foreground worker thread in a +// browser/renderer process. +// +// Windows (browser/renderer) +// 1 at 87th percentile / 92th percentile +// 2 at 95th percentile / 98th percentile +// 5 at 99th percentile / 100th percentile +// Mac (browser/renderer) +// 1 at 81th percentile / 90th percentile +// 2 at 92th percentile / 97th percentile +// 5 at 98th percentile / 100th percentile +// Android (browser/renderer) +// 1 at 92th percentile / 96th percentile +// 2 at 97th percentile / 98th percentile +// 5 at 99th percentile / 100th percentile + namespace base { namespace internal { @@ -49,8 +68,6 @@ constexpr char kDetachDurationHistogramPrefix[] = "ThreadPool.DetachDuration."; constexpr char kNumTasksBeforeDetachHistogramPrefix[] = "ThreadPool.NumTasksBeforeDetach."; -constexpr char kNumTasksBetweenWaitsHistogramPrefix[] = - "ThreadPool.NumTasksBetweenWaits."; constexpr char kNumWorkersHistogramPrefix[] = "ThreadPool.NumWorkers."; constexpr char kNumActiveWorkersHistogramPrefix[] = "ThreadPool.NumActiveWorkers."; @@ -259,10 +276,6 @@ // Accessed only from the worker thread. struct WorkerOnly { // Number of tasks executed since the last time the - // ThreadPool.NumTasksBetweenWaits histogram was recorded. - size_t num_tasks_since_last_wait = 0; - - // Number of tasks executed since the last time the // ThreadPool.NumTasksBeforeDetach histogram was recorded. size_t num_tasks_since_last_detach = 0; @@ -345,17 +358,6 @@ 1000, 50, HistogramBase::kUmaTargetedHistogramFlag)), - // Mimics the UMA_HISTOGRAM_COUNTS_100 macro. A WorkerThread is - // expected to run between zero and a few tens of tasks between waits. - // When it runs more than 100 tasks, there is no need to know the exact - // number of tasks that ran. - num_tasks_between_waits_histogram_(Histogram::FactoryGet( - JoinString({kNumTasksBetweenWaitsHistogramPrefix, histogram_label}, - ""), - 1, - 100, - 50, - HistogramBase::kUmaTargetedHistogramFlag)), // Mimics the UMA_HISTOGRAM_COUNTS_100 macro. A ThreadGroup is // expected to run between zero and a few tens of workers. // When it runs more than 100 worker, there is no need to know the exact @@ -569,8 +571,6 @@ outer_->after_start().worker_environment); #endif // defined(OS_WIN) - DCHECK_EQ(worker_only().num_tasks_since_last_wait, 0U); - PlatformThread::SetName( StringPrintf("ThreadPool%sWorker", outer_->thread_group_label_.c_str())); @@ -632,7 +632,6 @@ DCHECK(worker_only().is_running_task); DCHECK(read_worker().may_block_start_time.is_null()); - ++worker_only().num_tasks_since_last_wait; ++worker_only().num_tasks_since_last_detach; // A transaction to the TaskSource to reenqueue, if any. Instantiated here as @@ -738,14 +737,6 @@ WorkerThread* worker) { DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_); - // Record the ThreadPool.NumTasksBetweenWaits histogram. After GetWork() - // returns nullptr, the WorkerThread will perform a wait on its - // WaitableEvent, so we record how many tasks were ran since the last wait - // here. - outer_->num_tasks_between_waits_histogram_->Add( - worker_only().num_tasks_since_last_wait); - worker_only().num_tasks_since_last_wait = 0; - // Add the worker to the idle stack. DCHECK(!outer_->idle_workers_stack_.Contains(worker)); outer_->idle_workers_stack_.Push(worker);
diff --git a/base/task/thread_pool/thread_group_impl.h b/base/task/thread_pool/thread_group_impl.h index 2205dca1..5a3f108 100644 --- a/base/task/thread_pool/thread_group_impl.h +++ b/base/task/thread_pool/thread_group_impl.h
@@ -98,10 +98,6 @@ return num_tasks_before_detach_histogram_; } - const HistogramBase* num_tasks_between_waits_histogram() const { - return num_tasks_between_waits_histogram_; - } - const HistogramBase* num_workers_histogram() const { return num_workers_histogram_; } @@ -347,10 +343,6 @@ // Intentionally leaked. HistogramBase* const num_tasks_before_detach_histogram_; - // ThreadPool.NumTasksBetweenWaits.[thread group name] histogram. - // Intentionally leaked. - HistogramBase* const num_tasks_between_waits_histogram_; - // ThreadPool.NumWorkers.[thread group name] histogram. // Intentionally leaked. HistogramBase* const num_workers_histogram_;
diff --git a/base/task/thread_pool/thread_group_impl_unittest.cc b/base/task/thread_pool/thread_group_impl_unittest.cc index 1b1c3b1..9dfbad0 100644 --- a/base/task/thread_pool/thread_group_impl_unittest.cc +++ b/base/task/thread_pool/thread_group_impl_unittest.cc
@@ -620,92 +620,6 @@ } // namespace -TEST_F(ThreadGroupImplHistogramTest, NumTasksBetweenWaits) { - WaitableEvent event; - CreateAndStartThreadGroup(TimeDelta::Max(), kMaxTasks); - auto task_runner = - test::CreateSequencedTaskRunner({ThreadPool(), WithBaseSyncPrimitives()}, - &mock_pooled_task_runner_delegate_); - - // Post a task. - task_runner->PostTask(FROM_HERE, BindOnce(&test::WaitWithoutBlockingObserver, - Unretained(&event))); - - // Post 2 more tasks while the first task hasn't completed its execution. It - // is guaranteed that these tasks will run immediately after the first task, - // without allowing the worker to sleep. - task_runner->PostTask(FROM_HERE, DoNothing()); - task_runner->PostTask(FROM_HERE, DoNothing()); - - // Allow tasks to run and wait until the WorkerThread is idle. - event.Signal(); - thread_group_->WaitForAllWorkersIdleForTesting(); - - // Wake up the WorkerThread that just became idle by posting a task and - // wait until it becomes idle again. The WorkerThread should record the - // ThreadPool.NumTasksBetweenWaits.* histogram on wake up. - task_runner->PostTask(FROM_HERE, DoNothing()); - thread_group_->WaitForAllWorkersIdleForTesting(); - - // Verify that counts were recorded to the histogram as expected. - const auto* histogram = thread_group_->num_tasks_between_waits_histogram(); - EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(0)); - EXPECT_EQ(1, histogram->SnapshotSamples()->GetCount(3)); - EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(10)); -} - -// Verifies that NumTasksBetweenWaits histogram is logged as expected across -// idle and cleanup periods. -TEST_F(ThreadGroupImplHistogramTest, - NumTasksBetweenWaitsWithIdlePeriodAndCleanup) { - WaitableEvent tasks_can_exit_event; - CreateAndStartThreadGroup(kReclaimTimeForCleanupTests, kMaxTasks); - - WaitableEvent workers_continue; - - FloodPool(&workers_continue); - - const auto* histogram = thread_group_->num_tasks_between_waits_histogram(); - - // NumTasksBetweenWaits shouldn't be logged until idle. - EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(0)); - EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(1)); - EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(10)); - - // Make all workers go idle. - workers_continue.Signal(); - thread_group_->WaitForAllWorkersIdleForTesting(); - - // All workers should have reported a single hit in the "1" bucket per the the - // histogram being reported when going idle and each worker having processed - // precisely 1 task per the controlled flooding logic above. - EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(0)); - EXPECT_EQ(static_cast<int>(kMaxTasks), - histogram->SnapshotSamples()->GetCount(1)); - EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(10)); - - thread_group_->WaitForWorkersCleanedUpForTesting(kMaxTasks - 1); - - EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(0)); - EXPECT_EQ(static_cast<int>(kMaxTasks), - histogram->SnapshotSamples()->GetCount(1)); - EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(10)); - - // Flooding the thread group once again (without letting any workers go idle) - // shouldn't affect the counts either. - - workers_continue.Reset(); - FloodPool(&workers_continue); - - EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(0)); - EXPECT_EQ(static_cast<int>(kMaxTasks), - histogram->SnapshotSamples()->GetCount(1)); - EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(10)); - - workers_continue.Signal(); - thread_group_->WaitForAllWorkersIdleForTesting(); -} - TEST_F(ThreadGroupImplHistogramTest, NumTasksBeforeCleanup) { CreateThreadGroup(); auto histogrammed_thread_task_runner =
diff --git a/base/task/thread_pool/thread_pool.h b/base/task/thread_pool/thread_pool.h index e42e33a..0a27e81c 100644 --- a/base/task/thread_pool/thread_pool.h +++ b/base/task/thread_pool/thread_pool.h
@@ -174,7 +174,7 @@ // label histograms, it must not be empty. It should identify the component // that calls this. Start() is called by this method; it is invalid to call it // again afterwards. CHECKs on failure. For tests, prefer - // base::test::ScopedTaskEnvironment (ensures isolation). + // base::test::TaskEnvironment (ensures isolation). static void CreateAndStartWithDefaultParams(StringPiece name); // Same as CreateAndStartWithDefaultParams() but allows callers to split the @@ -186,12 +186,12 @@ // it must not be empty. It should identify the component that creates the // ThreadPoolInstance. The thread pool doesn't create threads until Start() is // called. Tasks can be posted at any time but will not run until after - // Start() is called. For tests, prefer base::test::ScopedTaskEnvironment + // Start() is called. For tests, prefer base::test::TaskEnvironment // (ensures isolation). static void Create(StringPiece name); // Registers |thread_pool| to handle tasks posted through the post_task.h - // API for this process. For tests, prefer base::test::ScopedTaskEnvironment + // API for this process. For tests, prefer base::test::TaskEnvironment // (ensures isolation). static void Set(std::unique_ptr<ThreadPoolInstance> thread_pool);
diff --git a/base/task/thread_pool/worker_thread_unittest.cc b/base/task/thread_pool/worker_thread_unittest.cc index 9058bec7..e0f9afd 100644 --- a/base/task/thread_pool/worker_thread_unittest.cc +++ b/base/task/thread_pool/worker_thread_unittest.cc
@@ -800,29 +800,20 @@ } // namespace -// Flaky: crbug.com/846121 -#if defined(OS_LINUX) && defined(ADDRESS_SANITIZER) -#define MAYBE_WorkerThreadObserver DISABLED_WorkerThreadObserver -#else -#define MAYBE_WorkerThreadObserver WorkerThreadObserver -#endif - // Verify that the WorkerThreadObserver is notified when the worker enters // and exits its main function. -TEST(ThreadPoolWorkerTest, MAYBE_WorkerThreadObserver) { +TEST(ThreadPoolWorkerTest, WorkerThreadObserver) { StrictMock<test::MockWorkerThreadObserver> observer; - { - TaskTracker task_tracker("Test"); - auto delegate = std::make_unique<VerifyCallsToObserverDelegate>(&observer); - auto worker = MakeRefCounted<WorkerThread>(ThreadPriority::NORMAL, - std::move(delegate), - task_tracker.GetTrackedRef()); - - EXPECT_CALL(observer, OnWorkerThreadMainEntry()); - worker->Start(&observer); - worker->Cleanup(); - worker = nullptr; - } + TaskTracker task_tracker("Test"); + auto delegate = std::make_unique<VerifyCallsToObserverDelegate>(&observer); + auto worker = + MakeRefCounted<WorkerThread>(ThreadPriority::NORMAL, std::move(delegate), + task_tracker.GetTrackedRef()); + EXPECT_CALL(observer, OnWorkerThreadMainEntry()); + worker->Start(&observer); + worker->Cleanup(); + // Join the worker to avoid leaks. + worker->JoinForTesting(); Mock::VerifyAndClear(&observer); }
diff --git a/base/task_runner_util_unittest.cc b/base/task_runner_util_unittest.cc index 3ffc479e..3fd7560 100644 --- a/base/task_runner_util_unittest.cc +++ b/base/task_runner_util_unittest.cc
@@ -86,7 +86,7 @@ TEST(TaskRunnerHelpersTest, PostTaskAndReplyWithResult) { int result = 0; - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; PostTaskAndReplyWithResult(ThreadTaskRunnerHandle::Get().get(), FROM_HERE, BindOnce(&ReturnFourtyTwo), BindOnce(&StoreValue, &result)); @@ -99,7 +99,7 @@ TEST(TaskRunnerHelpersTest, PostTaskAndReplyWithResultImplicitConvert) { double result = 0; - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; PostTaskAndReplyWithResult(ThreadTaskRunnerHandle::Get().get(), FROM_HERE, BindOnce(&ReturnFourtyTwo), BindOnce(&StoreDoubleValue, &result)); @@ -113,7 +113,7 @@ g_foo_destruct_count = 0; g_foo_free_count = 0; - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; PostTaskAndReplyWithResult(ThreadTaskRunnerHandle::Get().get(), FROM_HERE, BindOnce(&CreateFoo), BindOnce(&ExpectFoo)); @@ -127,7 +127,7 @@ g_foo_destruct_count = 0; g_foo_free_count = 0; - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; PostTaskAndReplyWithResult(ThreadTaskRunnerHandle::Get().get(), FROM_HERE, BindOnce(&CreateScopedFoo), BindOnce(&ExpectScopedFoo)); @@ -142,7 +142,7 @@ PostTaskAndReplyWithResultWithoutDefaultConstructor) { const int kSomeVal = 17; - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; int actual = 0; PostTaskAndReplyWithResult( ThreadTaskRunnerHandle::Get().get(), FROM_HERE,
diff --git a/base/test/launcher/test_launcher_unittest.cc b/base/test/launcher/test_launcher_unittest.cc index e4a9f904..870144c 100644 --- a/base/test/launcher/test_launcher_unittest.cc +++ b/base/test/launcher/test_launcher_unittest.cc
@@ -57,7 +57,7 @@ } // Mock TestLauncher to mock CreateAndStartThreadPool, -// unit test will provide a ScopedTaskEnvironment. +// unit test will provide a TaskEnvironment. class MockTestLauncher : public TestLauncher { public: MockTestLauncher(TestLauncherDelegate* launcher_delegate, @@ -105,8 +105,7 @@ TestLauncherTest() : command_line(new CommandLine(CommandLine::NO_PROGRAM)), test_launcher(&delegate, 10), - scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + task_environment(base::test::TaskEnvironment::MainThreadType::IO) {} // Adds tests to be returned by the delegate. void AddMockedTests(std::string test_case_name, @@ -146,7 +145,7 @@ std::unique_ptr<CommandLine> command_line; MockTestLauncher test_launcher; MockTestLauncherDelegate delegate; - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; ScopedTempDir dir; private: @@ -624,7 +623,7 @@ ScopedTempDir dir; private: - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; }; // Validate delegate produces correct command line. @@ -711,9 +710,9 @@ // If path or test location changes, the following expectation // will need to change accordingly. std::string file_name = "../../base/test/launcher/test_launcher_unittest.cc"; - ValidateTestLocation(val, "MockUnitTests.DISABLED_PassTest", file_name, 670); - ValidateTestLocation(val, "MockUnitTests.DISABLED_FailTest", file_name, 674); - ValidateTestLocation(val, "MockUnitTests.DISABLED_CrashTest", file_name, 678); + ValidateTestLocation(val, "MockUnitTests.DISABLED_PassTest", file_name, 669); + ValidateTestLocation(val, "MockUnitTests.DISABLED_FailTest", file_name, 673); + ValidateTestLocation(val, "MockUnitTests.DISABLED_CrashTest", file_name, 677); val = root->FindListKey("per_iteration_data"); ASSERT_TRUE(val);
diff --git a/base/test/null_task_runner.h b/base/test/null_task_runner.h index 80b2f941..5c120c5 100644 --- a/base/test/null_task_runner.h +++ b/base/test/null_task_runner.h
@@ -12,7 +12,7 @@ namespace base { -// ATTENTION: Prefer ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED and +// ATTENTION: Prefer TaskEnvironment::ThreadPoolExecutionMode::QUEUED and // a task runner obtained from base/task/post_task.h over this class. A // NullTaskRunner might seem appealing, but not running tasks is under-testing // the side-effects of the code under tests. ThreadPoolExecutionMode::QUEUED
diff --git a/base/test/test_mock_time_task_runner.h b/base/test/test_mock_time_task_runner.h index f0ce6c2..521acbf 100644 --- a/base/test/test_mock_time_task_runner.h +++ b/base/test/test_mock_time_task_runner.h
@@ -29,8 +29,8 @@ class ThreadTaskRunnerHandle; -// ATTENTION: Prefer using base::test::ScopedTaskEnvironment with a -// base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME trait instead. The +// ATTENTION: Prefer using base::test::TaskEnvironment with a +// base::test::TaskEnvironment::TimeSource::MOCK_TIME trait instead. The // only case where TestMockTimeTaskRunner is necessary is when instantiating // multiple TestMockTimeTaskRunners in the same test to deterministically // exercise the result of a race between two simulated threads.
diff --git a/base/test/test_simple_task_runner.h b/base/test/test_simple_task_runner.h index 9bab3b2..1d071f4 100644 --- a/base/test/test_simple_task_runner.h +++ b/base/test/test_simple_task_runner.h
@@ -18,13 +18,13 @@ class TimeDelta; -// ATTENTION: Prefer using base::test::ScopedTaskEnvironment and a task runner +// ATTENTION: Prefer using base::test::TaskEnvironment and a task runner // obtained from base/task/post_task.h over this class. This class isn't as // "simple" as it seems specifically because its attempt at being simple makes // it run tasks in a surprising order (delays aren't respected and nesting // doesn't behave as usual). Should you prefer to flush all tasks regardless of -// delays, ScopedTaskEnvironment::TimeSource::MOCK_TIME and -// ScopedTaskEnvironment::FastForwardUntilNoTasksRemain() have you covered. +// delays, TaskEnvironment::TimeSource::MOCK_TIME and +// TaskEnvironment::FastForwardUntilNoTasksRemain() have you covered. // // TestSimpleTaskRunner is a simple TaskRunner implementation that can // be used for testing. It implements SingleThreadTaskRunner as that
diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc index 7807d031..93a54d2 100644 --- a/base/test/test_suite.cc +++ b/base/test/test_suite.cc
@@ -27,6 +27,8 @@ #include "base/path_service.h" #include "base/process/launch.h" #include "base/process/memory.h" +#include "base/process/process.h" +#include "base/process/process_handle.h" #include "base/task/thread_pool/thread_pool.h" #include "base/test/gtest_xml_unittest_result_printer.h" #include "base/test/gtest_xml_util.h" @@ -43,6 +45,7 @@ #if defined(OS_MACOSX) #include "base/mac/scoped_nsautorelease_pool.h" +#include "base/process/port_provider_mac.h" #if defined(OS_IOS) #include "base/test/test_listener_ios.h" #endif // OS_IOS @@ -144,6 +147,47 @@ DISALLOW_COPY_AND_ASSIGN(CheckForLeakedGlobals); }; +// base::Process is not available on iOS +#if !defined(OS_IOS) +class CheckProcessPriority : public testing::EmptyTestEventListener { + public: + CheckProcessPriority() { CHECK(!IsProcessBackgrounded()); } + + void OnTestStart(const testing::TestInfo& test) override { + EXPECT_FALSE(IsProcessBackgrounded()); + } + void OnTestEnd(const testing::TestInfo& test) override { +#if !defined(OS_MACOSX) + // Flakes are found on Mac OS 10.11. See https://crbug.com/931721#c7. + EXPECT_FALSE(IsProcessBackgrounded()); +#endif + } + + private: +#if defined(OS_MACOSX) + // Returns the calling process's task port, ignoring its argument. + class CurrentProcessPortProvider : public PortProvider { + mach_port_t TaskForPid(ProcessHandle process) const override { + // This PortProvider implementation only works for the current process. + CHECK_EQ(process, base::GetCurrentProcessHandle()); + return mach_task_self(); + } + }; +#endif + + bool IsProcessBackgrounded() const { +#if defined(OS_MACOSX) + CurrentProcessPortProvider port_provider; + return Process::Current().IsProcessBackgrounded(&port_provider); +#else + return Process::Current().IsProcessBackgrounded(); +#endif + } + + DISALLOW_COPY_AND_ASSIGN(CheckProcessPriority); +}; +#endif // !defined(OS_IOS) + const std::string& GetProfileName() { static const NoDestructor<std::string> profile_name([]() { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); @@ -188,7 +232,7 @@ } // namespace -int RunUnitTestsUsingBaseTestSuite(int argc, char **argv) { +int RunUnitTestsUsingBaseTestSuite(int argc, char** argv) { TestSuite test_suite(argc, argv); return LaunchUnitTests(argc, argv, BindOnce(&TestSuite::Run, Unretained(&test_suite))); @@ -401,9 +445,8 @@ void TestSuite::SuppressErrorDialogs() { #if defined(OS_WIN) - UINT new_flags = SEM_FAILCRITICALERRORS | - SEM_NOGPFAULTERRORBOX | - SEM_NOOPENFILEERRORBOX; + UINT new_flags = + SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX; // Preserve existing error mode, as discussed at // http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx @@ -519,6 +562,9 @@ listeners.Append(new ResetCommandLineBetweenTests); if (check_for_leaked_globals_) listeners.Append(new CheckForLeakedGlobals); +#if !defined(OS_IOS) + listeners.Append(new CheckProcessPriority); +#endif AddTestLauncherResultPrinter();
diff --git a/base/threading/platform_thread.h b/base/threading/platform_thread.h index c85f232..aa5b952 100644 --- a/base/threading/platform_thread.h +++ b/base/threading/platform_thread.h
@@ -149,7 +149,7 @@ // Note: The sleep duration may be in base::Time or base::TimeTicks, depending // on platform. If you're looking to use this in unit tests testing delayed // tasks, this will be unreliable - instead, use - // base::test::ScopedTaskEnvironment with MOCK_TIME mode. + // base::test::TaskEnvironment with MOCK_TIME mode. static void Sleep(base::TimeDelta duration); // Sets the thread name visible to debuggers/tools. This will try to
diff --git a/base/threading/sequence_bound_unittest.cc b/base/threading/sequence_bound_unittest.cc index b571c8d..8ea826b9 100644 --- a/base/threading/sequence_bound_unittest.cc +++ b/base/threading/sequence_bound_unittest.cc
@@ -30,7 +30,7 @@ void SetUp() override { task_runner_ = base::ThreadTaskRunnerHandle::Get(); } - void TearDown() override { scoped_task_environment_.RunUntilIdle(); } + void TearDown() override { task_environment_.RunUntilIdle(); } // Do-nothing base class, just so we can test assignment of derived classes. // It introduces a virtual destructor, so that casting derived classes to @@ -66,7 +66,7 @@ struct VirtuallyDerived : public virtual Base {}; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::SequencedTaskRunner> task_runner_; Value value = kInitialValue; };
diff --git a/base/threading/sequenced_task_runner_handle_unittest.cc b/base/threading/sequenced_task_runner_handle_unittest.cc index f88e6e4..a41086b 100644 --- a/base/threading/sequenced_task_runner_handle_unittest.cc +++ b/base/threading/sequenced_task_runner_handle_unittest.cc
@@ -49,7 +49,7 @@ EXPECT_TRUE(sequence_checker->CalledOnValidSequence()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(SequencedTaskRunnerHandleTest, FromTaskEnvironment) { @@ -62,13 +62,13 @@ ->PostTask(FROM_HERE, base::BindOnce(&SequencedTaskRunnerHandleTest:: VerifyCurrentSequencedTaskRunner)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(SequencedTaskRunnerHandleTest, NoHandleFromUnsequencedTask) { base::PostTask(base::BindOnce( []() { EXPECT_FALSE(SequencedTaskRunnerHandle::IsSet()); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST(SequencedTaskRunnerHandleTestWithoutTaskEnvironment, FromHandleInScope) {
diff --git a/base/threading/thread_checker.h b/base/threading/thread_checker.h index 05c5703..5e3cb85 100644 --- a/base/threading/thread_checker.h +++ b/base/threading/thread_checker.h
@@ -38,7 +38,7 @@ // // It's sometimes useful to detach on construction for objects that are // // constructed in one place and forever after used from another // // thread. -// DETACH_FROM_THREAD(my_thread_checker_); +// DETACH_FROM_THREAD(thread_checker_); // } // // ~MyClass() { @@ -48,16 +48,16 @@ // // knows usage on the associated thread is done. If you're not // // detaching in the constructor, you probably want to explicitly check // // in the destructor. -// DCHECK_CALLED_ON_VALID_THREAD(my_thread_checker_); +// DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // } // // void MyMethod() { -// DCHECK_CALLED_ON_VALID_THREAD(my_thread_checker_); +// DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // ... (do stuff) ... // } // // private: -// THREAD_CHECKER(my_thread_checker_); +// THREAD_CHECKER(thread_checker_); // } #if DCHECK_IS_ON()
diff --git a/base/threading/thread_checker_unittest.cc b/base/threading/thread_checker_unittest.cc index e3ffeb2..5041bafd 100644 --- a/base/threading/thread_checker_unittest.cc +++ b/base/threading/thread_checker_unittest.cc
@@ -312,21 +312,21 @@ void ExpectDeathOnOtherThread() { #if DCHECK_IS_ON() - EXPECT_DCHECK_DEATH({ DCHECK_CALLED_ON_VALID_THREAD(my_thread_checker_); }); + EXPECT_DCHECK_DEATH({ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); }); #else // Happily no-ops on non-dcheck builds. - DCHECK_CALLED_ON_VALID_THREAD(my_thread_checker_); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); #endif } void ExpectNoDeathOnOtherThreadAfterDetach() { - DCHECK_CALLED_ON_VALID_THREAD(my_thread_checker_); - DCHECK_CALLED_ON_VALID_THREAD(my_thread_checker_) + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_) << "Make sure it compiles when DCHECK is off"; } protected: - THREAD_CHECKER(my_thread_checker_); + THREAD_CHECKER(thread_checker_); private: DISALLOW_COPY_AND_ASSIGN(ThreadCheckerMacroTest); @@ -342,7 +342,7 @@ RunCallbackOnNewThreadSynchronously(BindOnce( &ThreadCheckerMacroTest::ExpectDeathOnOtherThread, Unretained(this))); - DETACH_FROM_THREAD(my_thread_checker_); + DETACH_FROM_THREAD(thread_checker_); RunCallbackOnNewThreadSynchronously( BindOnce(&ThreadCheckerMacroTest::ExpectNoDeathOnOtherThreadAfterDetach,
diff --git a/base/time/default_tick_clock.h b/base/time/default_tick_clock.h index 3703882e..d92e485f 100644 --- a/base/time/default_tick_clock.h +++ b/base/time/default_tick_clock.h
@@ -13,7 +13,7 @@ // DefaultTickClock is a TickClock implementation that uses TimeTicks::Now(). // This is typically used by components that expose a SetTickClockForTesting(). // Note: Overriding Time/TimeTicks altogether via -// ScopedTaskEnvironment::TimeSource::MOCK_TIME is now the preferred of +// TaskEnvironment::TimeSource::MOCK_TIME is now the preferred of // overriding time in unit tests. As such, there shouldn't be many new use cases // for TickClock/DefaultTickClock anymore. class BASE_EXPORT DefaultTickClock : public TickClock {
diff --git a/base/timer/hi_res_timer_manager_unittest.cc b/base/timer/hi_res_timer_manager_unittest.cc index 94c02115..029e46e 100644 --- a/base/timer/hi_res_timer_manager_unittest.cc +++ b/base/timer/hi_res_timer_manager_unittest.cc
@@ -23,8 +23,8 @@ // The power monitor creates Window to receive power notifications from // Windows, which makes this test flaky if you run while the machine // goes in or out of AC power. - test::ScopedTaskEnvironment scoped_task_environment( - test::ScopedTaskEnvironment::MainThreadType::UI); + test::TaskEnvironment task_environment( + test::TaskEnvironment::MainThreadType::UI); base::PowerMonitor::Initialize( std::make_unique<base::PowerMonitorDeviceSource>());
diff --git a/base/timer/lap_timer_unittest.cc b/base/timer/lap_timer_unittest.cc index 8ce637d..a2c732a 100644 --- a/base/timer/lap_timer_unittest.cc +++ b/base/timer/lap_timer_unittest.cc
@@ -26,8 +26,7 @@ } // namespace TEST(LapTimer, UsageExample) { - ScopedTaskEnvironment scoped_task_environment( - ScopedTaskEnvironment::TimeSource::MOCK_TIME); + TaskEnvironment task_environment(TaskEnvironment::TimeSource::MOCK_TIME); LapTimer timer(kWarmupRuns, kTimeLimit, kTimeCheckInterval); @@ -35,7 +34,7 @@ EXPECT_FALSE(timer.IsWarmedUp()); do { - scoped_task_environment.FastForwardBy(kTimeAdvance); + task_environment.FastForwardBy(kTimeAdvance); timer.NextLap(); } while (!timer.HasTimeLimitExpired()); @@ -52,8 +51,7 @@ #if !defined(OS_IOS) // iOS simulator does not support using ThreadTicks. TEST(LapTimer, ThreadTicksUsageExample) { - ScopedTaskEnvironment scoped_task_environment( - ScopedTaskEnvironment::TimeSource::MOCK_TIME); + TaskEnvironment task_environment(TaskEnvironment::TimeSource::MOCK_TIME); LapTimer timer(kWarmupRuns, kTimeLimit, kTimeCheckInterval, LapTimer::TimerMethod::kUseThreadTicks); @@ -61,11 +59,11 @@ EXPECT_FALSE(timer.IsWarmedUp()); do { - scoped_task_environment.FastForwardBy(kTimeAdvance); + task_environment.FastForwardBy(kTimeAdvance); timer.NextLap(); } while (!timer.HasTimeLimitExpired()); - // Because advancing the ScopedTaskEnvironment time won't affect the + // Because advancing the TaskEnvironment time won't affect the // ThreadTicks, laps will be much faster than the regular UsageExample. EXPECT_GT(timer.LapsPerSecond(), 1000); EXPECT_LT(timer.TimePerLap().InMillisecondsF(), 1.0f);
diff --git a/base/timer/mock_timer.h b/base/timer/mock_timer.h index 30a605e9..f530c88 100644 --- a/base/timer/mock_timer.h +++ b/base/timer/mock_timer.h
@@ -14,7 +14,7 @@ // A mock implementation of base::OneShotTimer which requires being explicitly // Fire()'d. -// Prefer using ScopedTaskEnvironment::MOCK_TIME + FastForward*() to this when +// Prefer using TaskEnvironment::MOCK_TIME + FastForward*() to this when // possible. class MockOneShotTimer : public OneShotTimer { public: @@ -34,7 +34,7 @@ }; // See MockOneShotTimer's comment. Prefer using -// ScopedTaskEnvironment::MOCK_TIME. +// TaskEnvironment::MOCK_TIME. class MockRepeatingTimer : public RepeatingTimer { public: MockRepeatingTimer(); @@ -53,7 +53,7 @@ }; // See MockOneShotTimer's comment. Prefer using -// ScopedTaskEnvironment::MOCK_TIME. +// TaskEnvironment::MOCK_TIME. class MockRetainingOneShotTimer : public RetainingOneShotTimer { public: MockRetainingOneShotTimer();
diff --git a/base/timer/timer.h b/base/timer/timer.h index 02cfc48f..f9d4ece 100644 --- a/base/timer/timer.h +++ b/base/timer/timer.h
@@ -49,7 +49,7 @@ // By default, the scheduled tasks will be run on the same sequence that the // Timer was *started on*. To mock time in unit tests, some old tests used // SetTaskRunner() to schedule the delay on a test-controlled TaskRunner. The -// modern and preferred approach to mock time is to use ScopedTaskEnvironment's +// modern and preferred approach to mock time is to use TaskEnvironment's // MOCK_TIME mode. #ifndef BASE_TIMER_TIMER_H_ @@ -114,10 +114,10 @@ // this Timer is running. This method can only be called while this Timer // isn't running. This is an alternative (old) approach to mock time in tests. // The modern and preferred approach is to use - // ScopedTaskEnvironment::TimeSource::MOCK_TIME. To avoid racy usage of Timer, + // TaskEnvironment::TimeSource::MOCK_TIME. To avoid racy usage of Timer, // |task_runner| must run tasks on the same sequence which this Timer is bound // to (started from). TODO(gab): Migrate all callers to - // ScopedTaskEnvironment::TimeSource::MOCK_TIME. + // TaskEnvironment::TimeSource::MOCK_TIME. virtual void SetTaskRunner(scoped_refptr<SequencedTaskRunner> task_runner); // Call this method to stop and cancel the timer. It is a no-op if the timer
diff --git a/base/timer/timer_unittest.cc b/base/timer/timer_unittest.cc index ff6cbbe..6dcf93c 100644 --- a/base/timer/timer_unittest.cc +++ b/base/timer/timer_unittest.cc
@@ -37,11 +37,11 @@ namespace { // The main thread types on which each timer should be tested. -const test::ScopedTaskEnvironment::MainThreadType testing_main_threads[] = { - test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - test::ScopedTaskEnvironment::MainThreadType::IO, +const test::TaskEnvironment::MainThreadType testing_main_threads[] = { + test::TaskEnvironment::MainThreadType::DEFAULT, + test::TaskEnvironment::MainThreadType::IO, #if !defined(OS_IOS) // iOS does not allow direct running of the UI loop. - test::ScopedTaskEnvironment::MainThreadType::UI, + test::TaskEnvironment::MainThreadType::UI, #endif }; @@ -202,8 +202,8 @@ // that |did_run_a| would be signaled in that test if it wasn't for the // deletion. void RunTest_OneShotTimers( - test::ScopedTaskEnvironment::MainThreadType main_thread_type) { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment::MainThreadType main_thread_type) { + test::TaskEnvironment task_environment(main_thread_type); WaitableEvent did_run_a(WaitableEvent::ResetPolicy::MANUAL, WaitableEvent::InitialState::NOT_SIGNALED); @@ -219,8 +219,8 @@ } void RunTest_OneShotTimers_Cancel( - test::ScopedTaskEnvironment::MainThreadType main_thread_type) { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment::MainThreadType main_thread_type) { + test::TaskEnvironment task_environment(main_thread_type); WaitableEvent did_run_a(WaitableEvent::ResetPolicy::MANUAL, WaitableEvent::InitialState::NOT_SIGNALED); @@ -241,8 +241,8 @@ } void RunTest_OneShotSelfDeletingTimer( - test::ScopedTaskEnvironment::MainThreadType main_thread_type) { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment::MainThreadType main_thread_type) { + test::TaskEnvironment task_environment(main_thread_type); OneShotSelfDeletingTimerTester f; f.Start(); @@ -250,9 +250,9 @@ } void RunTest_RepeatingTimer( - test::ScopedTaskEnvironment::MainThreadType main_thread_type, + test::TaskEnvironment::MainThreadType main_thread_type, const TimeDelta& delay) { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment task_environment(main_thread_type); RepeatingTimerTester f(nullptr, delay); f.Start(); @@ -260,9 +260,9 @@ } void RunTest_RepeatingTimer_Cancel( - test::ScopedTaskEnvironment::MainThreadType main_thread_type, + test::TaskEnvironment::MainThreadType main_thread_type, const TimeDelta& delay) { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment task_environment(main_thread_type); WaitableEvent did_run_a(WaitableEvent::ResetPolicy::MANUAL, WaitableEvent::InitialState::NOT_SIGNALED); @@ -298,8 +298,8 @@ }; void RunTest_DelayTimer_NoCall( - test::ScopedTaskEnvironment::MainThreadType main_thread_type) { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment::MainThreadType main_thread_type) { + test::TaskEnvironment task_environment(main_thread_type); // If Delay is never called, the timer shouldn't go off. DelayTimerTarget target; @@ -314,8 +314,8 @@ } void RunTest_DelayTimer_OneCall( - test::ScopedTaskEnvironment::MainThreadType main_thread_type) { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment::MainThreadType main_thread_type) { + test::TaskEnvironment task_environment(main_thread_type); DelayTimerTarget target; DelayTimer timer(FROM_HERE, TimeDelta::FromMilliseconds(1), &target, @@ -344,8 +344,8 @@ }; void RunTest_DelayTimer_Reset( - test::ScopedTaskEnvironment::MainThreadType main_thread_type) { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment::MainThreadType main_thread_type) { + test::TaskEnvironment task_environment(main_thread_type); // If Delay is never called, the timer shouldn't go off. DelayTimerTarget target; @@ -376,8 +376,8 @@ }; void RunTest_DelayTimer_Deleted( - test::ScopedTaskEnvironment::MainThreadType main_thread_type) { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment::MainThreadType main_thread_type) { + test::TaskEnvironment task_environment(main_thread_type); DelayTimerFatalTarget target; @@ -399,8 +399,7 @@ // that timers work properly in all configurations. class TimerTestWithThreadType - : public testing::TestWithParam< - test::ScopedTaskEnvironment::MainThreadType> {}; + : public testing::TestWithParam<test::TaskEnvironment::MainThreadType> {}; TEST_P(TimerTestWithThreadType, OneShotTimers) { RunTest_OneShotTimers(GetParam()); @@ -437,13 +436,13 @@ } TEST(TimerTest, OneShotTimerWithTickClock) { - test::ScopedTaskEnvironment scoped_task_environment( - test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + test::TaskEnvironment task_environment( + test::TaskEnvironment::TimeSource::MOCK_TIME); Receiver receiver; - OneShotTimer timer(scoped_task_environment.GetMockTickClock()); + OneShotTimer timer(task_environment.GetMockTickClock()); timer.Start(FROM_HERE, TimeDelta::FromSeconds(1), BindOnce(&Receiver::OnCalled, Unretained(&receiver))); - scoped_task_environment.FastForwardBy(TimeDelta::FromSeconds(1)); + task_environment.FastForwardBy(TimeDelta::FromSeconds(1)); EXPECT_TRUE(receiver.WasCalled()); } @@ -464,15 +463,14 @@ } TEST(TimerTest, RepeatingTimerWithTickClock) { - test::ScopedTaskEnvironment scoped_task_environment( - test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + test::TaskEnvironment task_environment( + test::TaskEnvironment::TimeSource::MOCK_TIME); Receiver receiver; const int expected_times_called = 10; - RepeatingTimer timer(scoped_task_environment.GetMockTickClock()); + RepeatingTimer timer(task_environment.GetMockTickClock()); timer.Start(FROM_HERE, TimeDelta::FromSeconds(1), BindRepeating(&Receiver::OnCalled, Unretained(&receiver))); - scoped_task_environment.FastForwardBy( - TimeDelta::FromSeconds(expected_times_called)); + task_environment.FastForwardBy(TimeDelta::FromSeconds(expected_times_called)); timer.Stop(); EXPECT_EQ(expected_times_called, receiver.TimesCalled()); } @@ -495,19 +493,18 @@ } TEST(TimerTest, DelayTimerWithTickClock) { - test::ScopedTaskEnvironment scoped_task_environment( - test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + test::TaskEnvironment task_environment( + test::TaskEnvironment::TimeSource::MOCK_TIME); Receiver receiver; DelayTimer timer(FROM_HERE, TimeDelta::FromSeconds(1), &receiver, - &Receiver::OnCalled, - scoped_task_environment.GetMockTickClock()); - scoped_task_environment.FastForwardBy(TimeDelta::FromMilliseconds(999)); + &Receiver::OnCalled, task_environment.GetMockTickClock()); + task_environment.FastForwardBy(TimeDelta::FromMilliseconds(999)); EXPECT_FALSE(receiver.WasCalled()); timer.Reset(); - scoped_task_environment.FastForwardBy(TimeDelta::FromMilliseconds(999)); + task_environment.FastForwardBy(TimeDelta::FromMilliseconds(999)); EXPECT_FALSE(receiver.WasCalled()); timer.Reset(); - scoped_task_environment.FastForwardBy(TimeDelta::FromSeconds(1)); + task_environment.FastForwardBy(TimeDelta::FromSeconds(1)); EXPECT_TRUE(receiver.WasCalled()); } @@ -524,7 +521,7 @@ OneShotTimerTesterBase c(&did_run); OneShotTimerTesterBase d(&did_run); { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; a.Start(); b.Start(); } // Task environment destructs by falling out of scope. @@ -567,7 +564,7 @@ // owns the timer. The test may only trigger exceptions if debug heap checking // is enabled. - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; scoped_refptr<OneShotSelfOwningTimerTester> tester = new OneShotSelfOwningTimerTester(); @@ -582,7 +579,7 @@ TEST(TimerTest, NonRepeatIsRunning) { { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; OneShotTimer timer; EXPECT_FALSE(timer.IsRunning()); timer.Start(FROM_HERE, TimeDelta::FromDays(1), @@ -594,7 +591,7 @@ { RetainingOneShotTimer timer; - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; EXPECT_FALSE(timer.IsRunning()); timer.Start(FROM_HERE, TimeDelta::FromDays(1), BindRepeating(&TimerTestCallback)); @@ -610,7 +607,7 @@ TEST(TimerTest, NonRepeatTaskEnvironmentDeath) { OneShotTimer timer; { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; EXPECT_FALSE(timer.IsRunning()); timer.Start(FROM_HERE, TimeDelta::FromDays(1), BindOnce(&TimerTestCallback)); @@ -620,7 +617,7 @@ } TEST(TimerTest, RetainRepeatIsRunning) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; RepeatingTimer timer(FROM_HERE, TimeDelta::FromDays(1), BindRepeating(&TimerTestCallback)); EXPECT_FALSE(timer.IsRunning()); @@ -633,7 +630,7 @@ } TEST(TimerTest, RetainNonRepeatIsRunning) { - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; RetainingOneShotTimer timer(FROM_HERE, TimeDelta::FromDays(1), BindRepeating(&TimerTestCallback)); EXPECT_FALSE(timer.IsRunning()); @@ -672,7 +669,7 @@ TEST(TimerTest, ContinuationStopStart) { { ClearAllCallbackHappened(); - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; OneShotTimer timer; timer.Start(FROM_HERE, TimeDelta::FromMilliseconds(10), BindOnce(&SetCallbackHappened1)); @@ -688,7 +685,7 @@ TEST(TimerTest, ContinuationReset) { { ClearAllCallbackHappened(); - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; OneShotTimer timer; timer.Start(FROM_HERE, TimeDelta::FromMilliseconds(10), BindOnce(&SetCallbackHappened1));
diff --git a/base/trace_event/blame_context_unittest.cc b/base/trace_event/blame_context_unittest.cc index ad7bad5..fd4b809f 100644 --- a/base/trace_event/blame_context_unittest.cc +++ b/base/trace_event/blame_context_unittest.cc
@@ -58,7 +58,7 @@ class BlameContextTest : public testing::Test { protected: - test::ScopedTaskEnvironment scoped_task_environment_; + test::TaskEnvironment task_environment_; }; TEST_F(BlameContextTest, EnterAndLeave) {
diff --git a/base/trace_event/cpufreq_monitor_android.h b/base/trace_event/cpufreq_monitor_android.h index 3217c02d..100ff80f 100644 --- a/base/trace_event/cpufreq_monitor_android.h +++ b/base/trace_event/cpufreq_monitor_android.h
@@ -44,7 +44,7 @@ virtual std::string GetRelatedCPUsPathString(unsigned int cpu_id) const; // Allows us to delay creating a task runner, necessary because many tests - // don't like us creating one outside of a ScopedTaskEnvironment. + // don't like us creating one outside of a TaskEnvironment. virtual scoped_refptr<SingleThreadTaskRunner> CreateTaskRunner(); private:
diff --git a/base/trace_event/memory_dump_manager_unittest.cc b/base/trace_event/memory_dump_manager_unittest.cc index 2ca37b0..58609836 100644 --- a/base/trace_event/memory_dump_manager_unittest.cc +++ b/base/trace_event/memory_dump_manager_unittest.cc
@@ -169,18 +169,18 @@ void SetUp() override { // Bring up and initialize MemoryDumpManager while single-threaded (before - // instantiating ScopedTaskEnvironment) to avoid data races if worker + // instantiating TaskEnvironment) to avoid data races if worker // threads use tracing globals early. mdm_ = MemoryDumpManager::CreateInstanceForTesting(); ASSERT_EQ(mdm_.get(), MemoryDumpManager::GetInstance()); InitializeMemoryDumpManagerForInProcessTesting(is_coordinator_); - scoped_task_environment_ = std::make_unique<test::ScopedTaskEnvironment>(); + task_environment_ = std::make_unique<test::TaskEnvironment>(); } void TearDown() override { - scoped_task_environment_.reset(); + task_environment_.reset(); // Tear down the MemoryDumpManager while single-threaded to mirror logic in // SetUp(). @@ -247,7 +247,7 @@ // To tear down the singleton instance after each test. ShadowingAtExitManager at_exit_manager_; - std::unique_ptr<test::ScopedTaskEnvironment> scoped_task_environment_; + std::unique_ptr<test::TaskEnvironment> task_environment_; // Whether the test MemoryDumpManager should be initialized as the // coordinator.
diff --git a/base/util/memory_pressure/multi_source_memory_pressure_monitor_unittest.cc b/base/util/memory_pressure/multi_source_memory_pressure_monitor_unittest.cc index 8d36730..d0b48d7 100644 --- a/base/util/memory_pressure/multi_source_memory_pressure_monitor_unittest.cc +++ b/base/util/memory_pressure/multi_source_memory_pressure_monitor_unittest.cc
@@ -12,7 +12,7 @@ namespace util { TEST(MultiSourceMemoryPressureMonitorTest, RunDispatchCallback) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; MultiSourceMemoryPressureMonitor monitor; auto* aggregator = monitor.aggregator_for_testing();
diff --git a/base/win/object_watcher_unittest.cc b/base/win/object_watcher_unittest.cc index bbec192..e54043e 100644 --- a/base/win/object_watcher_unittest.cc +++ b/base/win/object_watcher_unittest.cc
@@ -34,8 +34,8 @@ }; void RunTest_BasicSignal( - test::ScopedTaskEnvironment::MainThreadType main_thread_type) { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment::MainThreadType main_thread_type) { + test::TaskEnvironment task_environment(main_thread_type); ObjectWatcher watcher; EXPECT_FALSE(watcher.IsWatching()); @@ -58,8 +58,8 @@ } void RunTest_BasicCancel( - test::ScopedTaskEnvironment::MainThreadType main_thread_type) { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment::MainThreadType main_thread_type) { + test::TaskEnvironment task_environment(main_thread_type); ObjectWatcher watcher; @@ -76,8 +76,8 @@ } void RunTest_CancelAfterSet( - test::ScopedTaskEnvironment::MainThreadType main_thread_type) { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment::MainThreadType main_thread_type) { + test::TaskEnvironment task_environment(main_thread_type); ObjectWatcher watcher; @@ -106,8 +106,8 @@ } void RunTest_SignalBeforeWatch( - test::ScopedTaskEnvironment::MainThreadType main_thread_type) { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment::MainThreadType main_thread_type) { + test::TaskEnvironment task_environment(main_thread_type); ObjectWatcher watcher; @@ -125,7 +125,7 @@ } void RunTest_OutlivesTaskEnvironment( - test::ScopedTaskEnvironment::MainThreadType main_thread_type) { + test::TaskEnvironment::MainThreadType main_thread_type) { // Simulate a task environment that dies before an ObjectWatcher. This // ordinarily doesn't happen when people use the Thread class, but it can // happen when people use the Singleton pattern or atexit. @@ -133,7 +133,7 @@ { ObjectWatcher watcher; { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment task_environment(main_thread_type); QuitDelegate delegate; watcher.StartWatchingOnce(event, &delegate); @@ -160,8 +160,8 @@ }; void RunTest_ExecuteMultipleTimes( - test::ScopedTaskEnvironment::MainThreadType main_thread_type) { - test::ScopedTaskEnvironment scoped_task_environment(main_thread_type); + test::TaskEnvironment::MainThreadType main_thread_type) { + test::TaskEnvironment task_environment(main_thread_type); ObjectWatcher watcher; EXPECT_FALSE(watcher.IsWatching()); @@ -189,44 +189,40 @@ //----------------------------------------------------------------------------- TEST(ObjectWatcherTest, BasicSignal) { - RunTest_BasicSignal(test::ScopedTaskEnvironment::MainThreadType::DEFAULT); - RunTest_BasicSignal(test::ScopedTaskEnvironment::MainThreadType::IO); - RunTest_BasicSignal(test::ScopedTaskEnvironment::MainThreadType::UI); + RunTest_BasicSignal(test::TaskEnvironment::MainThreadType::DEFAULT); + RunTest_BasicSignal(test::TaskEnvironment::MainThreadType::IO); + RunTest_BasicSignal(test::TaskEnvironment::MainThreadType::UI); } TEST(ObjectWatcherTest, BasicCancel) { - RunTest_BasicCancel(test::ScopedTaskEnvironment::MainThreadType::DEFAULT); - RunTest_BasicCancel(test::ScopedTaskEnvironment::MainThreadType::IO); - RunTest_BasicCancel(test::ScopedTaskEnvironment::MainThreadType::UI); + RunTest_BasicCancel(test::TaskEnvironment::MainThreadType::DEFAULT); + RunTest_BasicCancel(test::TaskEnvironment::MainThreadType::IO); + RunTest_BasicCancel(test::TaskEnvironment::MainThreadType::UI); } TEST(ObjectWatcherTest, CancelAfterSet) { - RunTest_CancelAfterSet(test::ScopedTaskEnvironment::MainThreadType::DEFAULT); - RunTest_CancelAfterSet(test::ScopedTaskEnvironment::MainThreadType::IO); - RunTest_CancelAfterSet(test::ScopedTaskEnvironment::MainThreadType::UI); + RunTest_CancelAfterSet(test::TaskEnvironment::MainThreadType::DEFAULT); + RunTest_CancelAfterSet(test::TaskEnvironment::MainThreadType::IO); + RunTest_CancelAfterSet(test::TaskEnvironment::MainThreadType::UI); } TEST(ObjectWatcherTest, SignalBeforeWatch) { - RunTest_SignalBeforeWatch( - test::ScopedTaskEnvironment::MainThreadType::DEFAULT); - RunTest_SignalBeforeWatch(test::ScopedTaskEnvironment::MainThreadType::IO); - RunTest_SignalBeforeWatch(test::ScopedTaskEnvironment::MainThreadType::UI); + RunTest_SignalBeforeWatch(test::TaskEnvironment::MainThreadType::DEFAULT); + RunTest_SignalBeforeWatch(test::TaskEnvironment::MainThreadType::IO); + RunTest_SignalBeforeWatch(test::TaskEnvironment::MainThreadType::UI); } TEST(ObjectWatcherTest, OutlivesTaskEnvironment) { RunTest_OutlivesTaskEnvironment( - test::ScopedTaskEnvironment::MainThreadType::DEFAULT); - RunTest_OutlivesTaskEnvironment( - test::ScopedTaskEnvironment::MainThreadType::IO); - RunTest_OutlivesTaskEnvironment( - test::ScopedTaskEnvironment::MainThreadType::UI); + test::TaskEnvironment::MainThreadType::DEFAULT); + RunTest_OutlivesTaskEnvironment(test::TaskEnvironment::MainThreadType::IO); + RunTest_OutlivesTaskEnvironment(test::TaskEnvironment::MainThreadType::UI); } TEST(ObjectWatcherTest, ExecuteMultipleTimes) { - RunTest_ExecuteMultipleTimes( - test::ScopedTaskEnvironment::MainThreadType::DEFAULT); - RunTest_ExecuteMultipleTimes(test::ScopedTaskEnvironment::MainThreadType::IO); - RunTest_ExecuteMultipleTimes(test::ScopedTaskEnvironment::MainThreadType::UI); + RunTest_ExecuteMultipleTimes(test::TaskEnvironment::MainThreadType::DEFAULT); + RunTest_ExecuteMultipleTimes(test::TaskEnvironment::MainThreadType::IO); + RunTest_ExecuteMultipleTimes(test::TaskEnvironment::MainThreadType::UI); } } // namespace win
diff --git a/base/win/registry_unittest.cc b/base/win/registry_unittest.cc index a8d10b4..4d902b1 100644 --- a/base/win/registry_unittest.cc +++ b/base/win/registry_unittest.cc
@@ -378,7 +378,7 @@ TEST_F(RegistryTest, ChangeCallback) { RegKey key; TestChangeDelegate delegate; - test::ScopedTaskEnvironment scoped_task_environment; + test::TaskEnvironment task_environment; string16 foo_key(kRootKey); foo_key += STRING16_LITERAL("\\Foo");
diff --git a/build/android/OWNERS b/build/android/OWNERS index 2feaebcf..2330e8d 100644 --- a/build/android/OWNERS +++ b/build/android/OWNERS
@@ -2,6 +2,7 @@ jbudorick@chromium.org pasko@chromium.org perezju@chromium.org +tiborg@chromium.org wnwen@chromium.org # COMPONENT: Build
diff --git a/build/android/gyp/assert_static_initializers.py b/build/android/gyp/assert_static_initializers.py index a03ca1c..392ee07 100755 --- a/build/android/gyp/assert_static_initializers.py +++ b/build/android/gyp/assert_static_initializers.py
@@ -60,17 +60,23 @@ # Mostly copied from //infra/scripts/legacy/scripts/slave/chromium/sizes.py. -def _ReadInitArray(so_path, tool_prefix): +def _ReadInitArray(so_path, tool_prefix, expect_no_initializers): stdout = _RunReadelf(so_path, ['-SW'], tool_prefix) - # Matches: .ctors PROGBITS 000000000516add0 5169dd0 000010 00 WA 0 0 8 + # Matches: .init_array INIT_ARRAY 000000000516add0 5169dd0 000010 00 WA 0 0 8 match = re.search(r'\.init_array.*$', stdout, re.MULTILINE) - if not match: + if expect_no_initializers: + if match: + raise Exception( + 'Expected no initializers for %s, yet some were found' % so_path) + else: + return 0 + elif not match: raise Exception('Did not find section: .init_array in:\n' + stdout) size_str = re.split(r'\W+', match.group(0))[5] return int(size_str, 16) -def _CountStaticInitializers(so_path, tool_prefix): +def _CountStaticInitializers(so_path, tool_prefix, expect_no_initializers): # Find the number of files with at least one static initializer. # First determine if we're 32 or 64 bit stdout = _RunReadelf(so_path, ['-h'], tool_prefix) @@ -84,12 +90,12 @@ # Then find the number of files with global static initializers. # NOTE: this is very implementation-specific and makes assumptions # about how compiler and linker implement global static initializers. - init_array_size = _ReadInitArray(so_path, tool_prefix) + init_array_size = _ReadInitArray(so_path, tool_prefix, expect_no_initializers) return init_array_size / word_size def _AnalyzeStaticInitializers(apk_filename, tool_prefix, dump_sis, out_dir, - ignored_libs): + ignored_libs, no_initializers_libs): # Static initializer counting mostly copies logic in # infra/scripts/legacy/scripts/slave/chromium/sizes.py. with zipfile.ZipFile(apk_filename) as z: @@ -105,10 +111,13 @@ si_count = 0 for f in files_to_check: + expect_no_initializers = (os.path.basename( + f.filename) in no_initializers_libs) with tempfile.NamedTemporaryFile() as temp: temp.write(z.read(f)) temp.flush() - si_count += _CountStaticInitializers(temp.name, tool_prefix) + si_count += _CountStaticInitializers(temp.name, tool_prefix, + expect_no_initializers) if dump_sis: # Print count and list of SIs reported by dump-static-initializers.py. # Doesn't work well on all archs (particularly arm), which is why @@ -128,11 +137,14 @@ parser.add_argument('apk', help='APK file path.') args = parser.parse_args() - #TODO(crbug.com/838414): add support for files included via loadable_modules. + # TODO(crbug.com/838414): add support for files included via loadable_modules. ignored_libs = ['libarcore_sdk_c.so'] + # The chromium linker doesn't have static initializers, which makes the + # regular check throw. It should not have any. + no_initializers_libs = ['libchromium_android_linker.so'] si_count = _AnalyzeStaticInitializers(args.apk, args.tool_prefix, False, '.', - ignored_libs) + ignored_libs, no_initializers_libs) if si_count != args.expected_count: print('Expected {} static initializers, but found {}.'.format( args.expected_count, si_count)) @@ -144,7 +156,7 @@ print('Dumping static initializers via dump-static-initializers.py:') sys.stdout.flush() _AnalyzeStaticInitializers(args.apk, args.tool_prefix, True, '.', - ignored_libs) + ignored_libs, no_initializers_libs) print() print('If the above list is not useful, consider listing them with:') print(' //tools/binary_size/diagnose_bloat.py')
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index e957b5c..5437548 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -186,8 +186,7 @@ } else if (is_win && is_clang && is_official_build) { chrome_orderfile_path = "//chrome/build/chrome.$target_cpu.orderfile" } else if (is_chromeos) { - # FIXME(tcwang): update this with autoroller. - chrome_orderfile_path = "" + chrome_orderfile_path = "//chromeos/profiles/chromeos.orderfile.txt" } } }
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 97e031c..4c21f959 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -8904707320705416480 \ No newline at end of file +8904682280694125104 \ No newline at end of file
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 1edf1ec..5ec85509 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -8904709939461330576 \ No newline at end of file +8904681509557710336 \ No newline at end of file
diff --git a/cc/paint/display_item_list.h b/cc/paint/display_item_list.h index af922d37..51894a6 100644 --- a/cc/paint/display_item_list.h +++ b/cc/paint/display_item_list.h
@@ -106,8 +106,9 @@ if (usage_hint_ == kToBeReleasedAsPaintOpBuffer) return; - visual_rects_.resize(paint_op_buffer_.size(), visual_rect); - GrowCurrentBeginItemVisualRect(visual_rect); + gfx::Rect clipped_rect = ClipRectToPaintableArea(visual_rect); + visual_rects_.resize(paint_op_buffer_.size(), clipped_rect); + GrowCurrentBeginItemVisualRect(clipped_rect); } void EndPaintOfPairedBegin() { @@ -199,11 +200,20 @@ FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, TraceEmptyVisualRect); FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, AsValueWithNoOps); FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, AsValueWithOps); + FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, ClippedToPaintableArea); friend gpu::raster::RasterImplementation; friend gpu::raster::RasterImplementationGLES; ~DisplayItemList(); + static inline gfx::Rect ClipRectToPaintableArea( + const gfx::Rect& visual_rect) { + gfx::Rect clipped(visual_rect); + clipped.Intersect(gfx::Rect(0, 0, std::numeric_limits<int>::max(), + std::numeric_limits<int>::max())); + return clipped; + } + void Reset(); std::unique_ptr<base::trace_event::TracedValue> CreateTracedValue( @@ -213,8 +223,11 @@ // given visual rect with the begin display item's visual rect. void GrowCurrentBeginItemVisualRect(const gfx::Rect& visual_rect) { DCHECK_EQ(usage_hint_, kTopLevelDisplayItemList); - if (!begin_paired_indices_.empty()) - visual_rects_[begin_paired_indices_.back().first].Union(visual_rect); + + if (!begin_paired_indices_.empty()) { + gfx::Rect clipped_rect = ClipRectToPaintableArea(visual_rect); + visual_rects_[begin_paired_indices_.back().first].Union(clipped_rect); + } } // RTree stores indices into the paint op buffer.
diff --git a/cc/paint/display_item_list_unittest.cc b/cc/paint/display_item_list_unittest.cc index 8124f772..2c6fa12 100644 --- a/cc/paint/display_item_list_unittest.cc +++ b/cc/paint/display_item_list_unittest.cc
@@ -1125,4 +1125,47 @@ EXPECT_EQ(8u, list->TotalOpCount()); } +TEST(DisplayItemListTest, ClippedToPaintableArea) { + auto list = base::MakeRefCounted<DisplayItemList>(); + + { + list->StartPaint(); + list->push<SaveOp>(); + list->EndPaintOfPairedBegin(); + } + + // Construct a rect that slightly hangs into + gfx::Vector2d offset(30, 40); + gfx::Size size(std::numeric_limits<int>::max(), + std::numeric_limits<int>::max()); + gfx::Rect visual_rect(std::numeric_limits<int>::min() + offset.x(), + std::numeric_limits<int>::min() + offset.y(), + size.width(), size.height()); + gfx::Rect clipped_rect(0, 0, visual_rect.width() + visual_rect.x(), + visual_rect.height() + visual_rect.y()); + + { + list->StartPaint(); + + PaintFlags paint; + list->push<SaveLayerOp>(nullptr, &paint); + list->push<TranslateOp>(static_cast<float>(visual_rect.x()), + static_cast<float>(visual_rect.y())); + list->push<DrawRectOp>( + SkRect::MakeWH(visual_rect.width(), visual_rect.height()), paint); + list->push<RestoreOp>(); + + list->EndPaintOfUnpaired(visual_rect); + } + + { + list->StartPaint(); + list->push<RestoreOp>(); + list->EndPaintOfPairedEnd(); + } + list->Finalize(); + + EXPECT_EQ(list->rtree_.GetBounds(), clipped_rect); +} + } // namespace cc
diff --git a/cc/test/fake_layer_tree_host.cc b/cc/test/fake_layer_tree_host.cc index bb74fc6..aaa23ea 100644 --- a/cc/test/fake_layer_tree_host.cc +++ b/cc/test/fake_layer_tree_host.cc
@@ -79,19 +79,19 @@ active_tree()->property_trees()->scroll_tree.PushScrollUpdatesFromMainThread( property_trees(), active_tree()); - if (page_scale_layer() && inner_viewport_scroll_layer()) { - LayerTreeImpl::ViewportLayerIds ids; - ids.overscroll_elasticity_element_id = overscroll_elasticity_element_id(); + LayerTreeImpl::ViewportLayerIds ids; + ids.overscroll_elasticity_element_id = overscroll_elasticity_element_id(); + if (page_scale_layer()) ids.page_scale = page_scale_layer()->id(); - if (inner_viewport_container_layer()) - ids.inner_viewport_container = inner_viewport_container_layer()->id(); - if (outer_viewport_container_layer()) - ids.outer_viewport_container = outer_viewport_container_layer()->id(); + if (inner_viewport_container_layer()) + ids.inner_viewport_container = inner_viewport_container_layer()->id(); + if (outer_viewport_container_layer()) + ids.outer_viewport_container = outer_viewport_container_layer()->id(); + if (inner_viewport_scroll_layer()) ids.inner_viewport_scroll = inner_viewport_scroll_layer()->id(); - if (outer_viewport_scroll_layer()) - ids.outer_viewport_scroll = outer_viewport_scroll_layer()->id(); - active_tree()->SetViewportLayersFromIds(ids); - } + if (outer_viewport_scroll_layer()) + ids.outer_viewport_scroll = outer_viewport_scroll_layer()->id(); + active_tree()->SetViewportLayersFromIds(ids); return active_tree()->root_layer_for_testing(); }
diff --git a/cc/test/test_layer_tree_host_base.cc b/cc/test/test_layer_tree_host_base.cc index 8210330..adbd7c2 100644 --- a/cc/test/test_layer_tree_host_base.cc +++ b/cc/test/test_layer_tree_host_base.cc
@@ -18,7 +18,8 @@ active_layer_(nullptr), old_pending_layer_(nullptr), root_id_(6), - id_(7) {} + page_scale_id_(7), + id_(8) {} TestLayerTreeHostBase::~TestLayerTreeHostBase() = default; @@ -109,11 +110,13 @@ // Steal from the recycled tree if possible. LayerImpl* pending_root = pending_tree->root_layer_for_testing(); + std::unique_ptr<LayerImpl> page_scale_layer; std::unique_ptr<FakePictureLayerImpl> pending_layer; DCHECK(!pending_root || pending_root->id() == root_id_); if (!pending_root) { std::unique_ptr<LayerImpl> new_pending_root = LayerImpl::Create(pending_tree, root_id_); + page_scale_layer = LayerImpl::Create(pending_tree, page_scale_id_); switch (mask_type) { case Layer::LayerMaskType::NOT_MASK: pending_layer = FakePictureLayerImpl::Create(pending_tree, id_); @@ -131,9 +134,13 @@ pending_root = new_pending_root.get(); pending_tree->SetRootLayerForTesting(std::move(new_pending_root)); } else { - pending_layer.reset(static_cast<FakePictureLayerImpl*>( + page_scale_layer.reset( pending_root->test_properties() ->RemoveChild(pending_root->test_properties()->children[0]) + .release()); + pending_layer.reset(static_cast<FakePictureLayerImpl*>( + page_scale_layer->test_properties() + ->RemoveChild(page_scale_layer->test_properties()->children[0]) .release())); if (!tile_size.IsEmpty()) pending_layer->set_fixed_tile_size(tile_size); @@ -143,9 +150,11 @@ pending_layer->SetBounds(raster_source->GetSize()); pending_layer->SetRasterSourceOnPending(raster_source, invalidation); - pending_root->test_properties()->AddChild(std::move(pending_layer)); + page_scale_layer->test_properties()->AddChild(std::move(pending_layer)); + pending_root->test_properties()->AddChild(std::move(page_scale_layer)); + LayerTreeImpl::ViewportLayerIds viewport_ids; - viewport_ids.page_scale = pending_tree->root_layer_for_testing()->id(); + viewport_ids.page_scale = page_scale_id_; pending_tree->SetViewportLayersFromIds(viewport_ids); pending_layer_ = static_cast<FakePictureLayerImpl*>(
diff --git a/cc/test/test_layer_tree_host_base.h b/cc/test/test_layer_tree_host_base.h index 831b844..802ee0f 100644 --- a/cc/test/test_layer_tree_host_base.h +++ b/cc/test/test_layer_tree_host_base.h
@@ -75,6 +75,7 @@ FakePictureLayerImpl* active_layer_; FakePictureLayerImpl* old_pending_layer_; const int root_id_; + const int page_scale_id_; const int id_; };
diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc index cf566cb..5aa11ef 100644 --- a/cc/trees/draw_property_utils.cc +++ b/cc/trees/draw_property_utils.cc
@@ -1040,9 +1040,7 @@ void UpdatePageScaleFactor(PropertyTrees* property_trees, TransformNode* page_scale_node, - float page_scale_factor, - float device_scale_factor, - const gfx::Transform device_transform) { + float page_scale_factor) { // TODO(wjmaclean): Once Issue #845097 is resolved, we can change the nullptr // check below to a DCHECK. if (property_trees->transform_tree.page_scale_factor() == page_scale_factor || @@ -1052,11 +1050,8 @@ property_trees->transform_tree.set_page_scale_factor(page_scale_factor); - float post_local_scale_factor = page_scale_factor * device_scale_factor; - page_scale_node->post_local_scale_factor = post_local_scale_factor; - page_scale_node->post_local = device_transform; - page_scale_node->post_local.Scale(post_local_scale_factor, - post_local_scale_factor); + page_scale_node->local.MakeIdentity(); + page_scale_node->local.Scale(page_scale_factor, page_scale_factor); page_scale_node->needs_local_transform_update = true; property_trees->transform_tree.set_needs_update(true);
diff --git a/cc/trees/draw_property_utils.h b/cc/trees/draw_property_utils.h index 6ca98498..54c7a458 100644 --- a/cc/trees/draw_property_utils.h +++ b/cc/trees/draw_property_utils.h
@@ -90,9 +90,7 @@ void CC_EXPORT UpdatePageScaleFactor(PropertyTrees* property_trees, TransformNode* page_scale_node, - float page_scale_factor, - float device_scale_factor, - const gfx::Transform device_transform); + float page_scale_factor); void CC_EXPORT UpdateElasticOverscroll(PropertyTrees* property_trees,
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index a980ad2..420364df 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc
@@ -793,11 +793,7 @@ // need to be built here. if (!IsUsingLayerLists()) { TRACE_EVENT0("cc", "LayerTreeHost::UpdateLayers::BuildPropertyTrees"); - Layer* root_scroll = - PropertyTreeBuilder::FindFirstScrollableLayer(root_layer_.get()); Layer* page_scale_layer = viewport_layers_.page_scale.get(); - if (!page_scale_layer && root_scroll) - page_scale_layer = root_scroll->parent(); gfx::Transform identity_transform; PropertyTreeBuilder::BuildPropertyTrees( root_layer_.get(), page_scale_layer, inner_viewport_scroll_layer(), @@ -1558,13 +1554,17 @@ ids.overscroll_elasticity_element_id = viewport_layers_.overscroll_elasticity_element_id; } - ids.page_scale = viewport_layers_.page_scale->id(); - if (viewport_layers_.inner_viewport_container) + if (viewport_layers_.page_scale) { + ids.page_scale = viewport_layers_.page_scale->id(); + } + if (viewport_layers_.inner_viewport_container) { ids.inner_viewport_container = viewport_layers_.inner_viewport_container->id(); - if (viewport_layers_.outer_viewport_container) + } + if (viewport_layers_.outer_viewport_container) { ids.outer_viewport_container = viewport_layers_.outer_viewport_container->id(); + } ids.inner_viewport_scroll = viewport_layers_.inner_viewport_scroll->id(); if (viewport_layers_.outer_viewport_scroll) ids.outer_viewport_scroll = viewport_layers_.outer_viewport_scroll->id();
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc index 7ea7995ee..52cfd10 100644 --- a/cc/trees/layer_tree_host_common.cc +++ b/cc/trees/layer_tree_host_common.cc
@@ -554,21 +554,6 @@ // trying to update property trees whenever these values change, we // update property trees before using them. - // When the page scale layer is also the root layer, the node should also - // store the combined scale factor and not just the page scale factor. - // TODO(bokan): Need to implement this behavior for - // BlinkGeneratedPropertyTrees. i.e. (no page scale layer). Ideally by - // not baking these into the page scale layer. - bool combine_dsf_and_psf = inputs->page_scale_layer == inputs->root_layer; - float device_scale_factor_for_page_scale_node = 1.f; - gfx::Transform device_transform_for_page_scale_node; - if (combine_dsf_and_psf) { - DCHECK( - !inputs->root_layer->layer_tree_impl()->settings().use_layer_lists); - device_transform_for_page_scale_node = inputs->device_transform; - device_scale_factor_for_page_scale_node = inputs->device_scale_factor; - } - // We should never be setting a non-unit page scale factor on an oopif // subframe ... if we attempt this log it and fail. // TODO(wjmaclean): Remove as part of conditions for closing the bug. @@ -586,10 +571,10 @@ NOTREACHED(); } + DCHECK_NE(inputs->page_scale_layer, inputs->root_layer); draw_property_utils::UpdatePageScaleFactor( inputs->property_trees, inputs->page_scale_transform_node, - inputs->page_scale_factor, device_scale_factor_for_page_scale_node, - device_transform_for_page_scale_node); + inputs->page_scale_factor); draw_property_utils::UpdateElasticOverscroll( inputs->property_trees, inputs->elastic_overscroll_element_id, inputs->elastic_overscroll); @@ -598,11 +583,8 @@ PropertyTrees* property_trees = inputs->property_trees; property_trees->clip_tree.SetViewportClip( gfx::RectF(gfx::SizeF(inputs->device_viewport_size))); - float page_scale_factor_for_root = - combine_dsf_and_psf ? inputs->page_scale_factor : 1.f; - property_trees->transform_tree.SetRootTransformsAndScales( - inputs->device_scale_factor, page_scale_factor_for_root, - inputs->device_transform); + property_trees->transform_tree.SetRootScaleAndTransform( + inputs->device_scale_factor, inputs->device_transform); draw_property_utils::UpdatePropertyTreesAndRenderSurfaces( inputs->root_layer, inputs->property_trees); break;
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index 12652e57..e093373 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -534,10 +534,17 @@ scroll_layer->test_properties()->AddChild(std::move(sublayer_scoped_ptr)); - std::unique_ptr<LayerImpl> root( + std::unique_ptr<LayerImpl> page_scale_layer_scoped_ptr( LayerImpl::Create(host_impl.active_tree(), 3)); + LayerImpl* page_scale_layer = page_scale_layer_scoped_ptr.get(); + page_scale_layer->SetBounds(gfx::Size(3, 4)); + page_scale_layer->test_properties()->AddChild( + std::move(scroll_layer_scoped_ptr)); + + std::unique_ptr<LayerImpl> root( + LayerImpl::Create(host_impl.active_tree(), 4)); root->SetBounds(gfx::Size(3, 4)); - root->test_properties()->AddChild(std::move(scroll_layer_scoped_ptr)); + root->test_properties()->AddChild(std::move(page_scale_layer_scoped_ptr)); LayerImpl* root_layer = root.get(); host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); host_impl.active_tree()->BuildPropertyTreesForTesting(); @@ -547,8 +554,7 @@ SetScrollOffsetDelta(scroll_layer, kScrollDelta); ExecuteCalculateDrawProperties(root_layer, kDeviceScale, page_scale, - scroll_layer->test_properties()->parent, - nullptr, nullptr); + page_scale_layer, nullptr, nullptr); gfx::Transform expected_transform; gfx::PointF sub_layer_screen_position = kScrollLayerPosition - kScrollDelta; expected_transform.Translate( @@ -568,8 +574,7 @@ scroll_layer->test_properties()->transform = arbitrary_translate; root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; ExecuteCalculateDrawProperties(root_layer, kDeviceScale, page_scale, - scroll_layer->test_properties()->parent, - nullptr, nullptr); + page_scale_layer, nullptr, nullptr); expected_transform.MakeIdentity(); expected_transform.Translate( std::round(kTranslateX * page_scale * kDeviceScale + @@ -585,13 +590,12 @@ page_scale = 1.888f; LayerTreeImpl::ViewportLayerIds viewport_ids; - viewport_ids.page_scale = scroll_layer->test_properties()->parent->id(); + viewport_ids.page_scale = page_scale_layer->id(); root_layer->layer_tree_impl()->SetViewportLayersFromIds(viewport_ids); root_layer->layer_tree_impl()->SetPageScaleOnActiveTree(page_scale); EXPECT_FALSE(root_layer->layer_tree_impl()->property_trees()->needs_rebuild); ExecuteCalculateDrawProperties(root_layer, kDeviceScale, page_scale, - scroll_layer->test_properties()->parent, - nullptr, nullptr); + page_scale_layer, nullptr, nullptr); expected_transform.MakeIdentity(); expected_transform.Translate( @@ -1247,55 +1251,6 @@ child->ScreenSpaceTransform()); EXPECT_EQ(gfx::Rect(50, 50, 150, 150), child->clip_rect()); } - - // Verify it composes correctly with page scale. - float page_scale_factor = 2.f; - - { - RenderSurfaceList render_surface_list_impl; - LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root, root->bounds(), translate, &render_surface_list_impl); - inputs.page_scale_factor = page_scale_factor; - inputs.page_scale_layer = root; - inputs.page_scale_transform_node = - inputs.property_trees->transform_tree.Node( - inputs.page_scale_layer->transform_tree_index()); - inputs.property_trees->needs_rebuild = true; - LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); - gfx::Transform page_scaled_translate = translate; - page_scaled_translate.Scale(page_scale_factor, page_scale_factor); - EXPECT_TRANSFORMATION_MATRIX_EQ( - page_scaled_translate, root->draw_properties().target_space_transform); - EXPECT_TRANSFORMATION_MATRIX_EQ( - page_scaled_translate, child->draw_properties().target_space_transform); - EXPECT_TRANSFORMATION_MATRIX_EQ(gfx::Transform(), - GetRenderSurface(root)->draw_transform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(page_scaled_translate, - child->ScreenSpaceTransform()); - EXPECT_EQ(gfx::Rect(50, 50, 200, 200), child->clip_rect()); - } - - // Verify that it composes correctly with transforms directly on root layer. - root->test_properties()->transform = composite; - - { - RenderSurfaceList render_surface_list_impl; - LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root, root->bounds(), composite, &render_surface_list_impl); - inputs.property_trees->needs_rebuild = true; - LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); - gfx::Transform compositeSquared = composite; - compositeSquared.ConcatTransform(composite); - EXPECT_TRANSFORMATION_MATRIX_EQ( - compositeSquared, root->draw_properties().target_space_transform); - EXPECT_TRANSFORMATION_MATRIX_EQ( - compositeSquared, child->draw_properties().target_space_transform); - EXPECT_TRANSFORMATION_MATRIX_EQ(gfx::Transform(), - GetRenderSurface(root)->draw_transform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(compositeSquared, - child->ScreenSpaceTransform()); - EXPECT_EQ(gfx::Rect(254, 316, 428, 428), child->clip_rect()); - } } TEST_F(LayerTreeHostCommonTest, RenderSurfaceForNonAxisAlignedClipping) { @@ -1989,31 +1944,32 @@ TEST_F(LayerTreeHostCommonTest, AnimationsForRenderSurfaceHierarchy) { LayerImpl* root = root_layer_for_testing(); - LayerImpl* render_surface1 = AddChildToRoot<LayerImpl>(); + LayerImpl* top = AddChildToRoot<LayerImpl>(); + LayerImpl* render_surface1 = AddChild<LayerImpl>(top); LayerImpl* child_of_rs1 = AddChild<LayerImpl>(render_surface1); LayerImpl* grand_child_of_rs1 = AddChild<LayerImpl>(child_of_rs1); LayerImpl* render_surface2 = AddChild<LayerImpl>(render_surface1); LayerImpl* child_of_rs2 = AddChild<LayerImpl>(render_surface2); LayerImpl* grand_child_of_rs2 = AddChild<LayerImpl>(child_of_rs2); - LayerImpl* child_of_root = AddChildToRoot<LayerImpl>(); - LayerImpl* grand_child_of_root = AddChild<LayerImpl>(child_of_root); + LayerImpl* child_of_top = AddChild<LayerImpl>(top); + LayerImpl* grand_child_of_top = AddChild<LayerImpl>(child_of_top); - root->SetDrawsContent(true); + top->SetDrawsContent(true); render_surface1->SetDrawsContent(true); child_of_rs1->SetDrawsContent(true); grand_child_of_rs1->SetDrawsContent(true); render_surface2->SetDrawsContent(true); child_of_rs2->SetDrawsContent(true); grand_child_of_rs2->SetDrawsContent(true); - child_of_root->SetDrawsContent(true); - grand_child_of_root->SetDrawsContent(true); + child_of_top->SetDrawsContent(true); + grand_child_of_top->SetDrawsContent(true); gfx::Transform layer_transform; layer_transform.Translate(1.0, 1.0); - root->test_properties()->transform = layer_transform; root->SetBounds(gfx::Size(10, 10)); - root->test_properties()->transform_origin = gfx::Point3F(0.25f, 0.f, 0.f); + top->test_properties()->transform = layer_transform; + top->SetBounds(gfx::Size(10, 10)); render_surface1->test_properties()->transform = layer_transform; render_surface1->test_properties()->position = gfx::PointF(2.5f, 0.f); render_surface1->SetBounds(gfx::Size(10, 10)); @@ -2026,10 +1982,10 @@ render_surface2->test_properties()->transform_origin = gfx::Point3F(0.25f, 0.f, 0.f); render_surface2->test_properties()->force_render_surface = true; - child_of_root->test_properties()->transform = layer_transform; - child_of_root->test_properties()->position = gfx::PointF(2.5f, 0.f); - child_of_root->SetBounds(gfx::Size(10, 10)); - child_of_root->test_properties()->transform_origin = + child_of_top->test_properties()->transform = layer_transform; + child_of_top->test_properties()->position = gfx::PointF(2.5f, 0.f); + child_of_top->SetBounds(gfx::Size(10, 10)); + child_of_top->test_properties()->transform_origin = gfx::Point3F(0.25f, 0.f, 0.f); child_of_rs1->test_properties()->transform = layer_transform; child_of_rs1->test_properties()->position = gfx::PointF(2.5f, 0.f); @@ -2041,10 +1997,10 @@ child_of_rs2->SetBounds(gfx::Size(10, 10)); child_of_rs2->test_properties()->transform_origin = gfx::Point3F(0.25f, 0.f, 0.f); - grand_child_of_root->test_properties()->transform = layer_transform; - grand_child_of_root->test_properties()->position = gfx::PointF(2.5f, 0.f); - grand_child_of_root->SetBounds(gfx::Size(10, 10)); - grand_child_of_root->test_properties()->transform_origin = + grand_child_of_top->test_properties()->transform = layer_transform; + grand_child_of_top->test_properties()->position = gfx::PointF(2.5f, 0.f); + grand_child_of_top->SetBounds(gfx::Size(10, 10)); + grand_child_of_top->test_properties()->transform_origin = gfx::Point3F(0.25f, 0.f, 0.f); grand_child_of_rs1->test_properties()->transform = layer_transform; grand_child_of_rs1->test_properties()->position = gfx::PointF(2.5f, 0.f); @@ -2064,17 +2020,16 @@ render_surface1->element_id(), timeline_impl(), 10.0, 1.f, 0.f, false); // Also put an animated opacity on a layer without descendants. - AddOpacityTransitionToElementWithAnimation(grand_child_of_root->element_id(), - timeline_impl(), 10.0, 1.f, 0.f, - false); + AddOpacityTransitionToElementWithAnimation( + grand_child_of_top->element_id(), timeline_impl(), 10.0, 1.f, 0.f, false); // Put a transform animation on the render surface. AddAnimatedTransformToElementWithAnimation(render_surface2->element_id(), timeline_impl(), 10.0, 30, 0); - // Also put transform animations on grand_child_of_root, and + // Also put transform animations on grand_child_of_top, and // grand_child_of_rs2 - AddAnimatedTransformToElementWithAnimation(grand_child_of_root->element_id(), + AddAnimatedTransformToElementWithAnimation(grand_child_of_top->element_id(), timeline_impl(), 10.0, 30, 0); AddAnimatedTransformToElementWithAnimation(grand_child_of_rs2->element_id(), timeline_impl(), 10.0, 30, 0); @@ -2085,8 +2040,9 @@ // Only layers that are associated with render surfaces should have an actual // RenderSurface() value. ASSERT_TRUE(GetRenderSurface(root)); - ASSERT_EQ(GetRenderSurface(child_of_root), GetRenderSurface(root)); - ASSERT_EQ(GetRenderSurface(grand_child_of_root), GetRenderSurface(root)); + ASSERT_EQ(GetRenderSurface(top), GetRenderSurface(root)); + ASSERT_EQ(GetRenderSurface(child_of_top), GetRenderSurface(root)); + ASSERT_EQ(GetRenderSurface(grand_child_of_top), GetRenderSurface(root)); ASSERT_NE(GetRenderSurface(render_surface1), GetRenderSurface(root)); ASSERT_EQ(GetRenderSurface(child_of_rs1), GetRenderSurface(render_surface1)); @@ -2102,8 +2058,9 @@ // Verify all render target accessors EXPECT_EQ(GetRenderSurface(root), root->render_target()); - EXPECT_EQ(GetRenderSurface(root), child_of_root->render_target()); - EXPECT_EQ(GetRenderSurface(root), grand_child_of_root->render_target()); + EXPECT_EQ(GetRenderSurface(root), top->render_target()); + EXPECT_EQ(GetRenderSurface(root), child_of_top->render_target()); + EXPECT_EQ(GetRenderSurface(root), grand_child_of_top->render_target()); EXPECT_EQ(GetRenderSurface(render_surface1), render_surface1->render_target()); @@ -2119,8 +2076,8 @@ // Verify screen_space_transform_is_animating values EXPECT_FALSE(root->screen_space_transform_is_animating()); - EXPECT_FALSE(child_of_root->screen_space_transform_is_animating()); - EXPECT_TRUE(grand_child_of_root->screen_space_transform_is_animating()); + EXPECT_FALSE(child_of_top->screen_space_transform_is_animating()); + EXPECT_TRUE(grand_child_of_top->screen_space_transform_is_animating()); EXPECT_FALSE(render_surface1->screen_space_transform_is_animating()); EXPECT_FALSE(child_of_rs1->screen_space_transform_is_animating()); EXPECT_FALSE(grand_child_of_rs1->screen_space_transform_is_animating()); @@ -2131,11 +2088,10 @@ // Sanity check. If these fail there is probably a bug in the test itself. // It is expected that we correctly set up transforms so that the y-component // of the screen-space transform encodes the "depth" of the layer in the tree. - EXPECT_FLOAT_EQ(1.0, root->ScreenSpaceTransform().matrix().get(1, 3)); - EXPECT_FLOAT_EQ(2.0, - child_of_root->ScreenSpaceTransform().matrix().get(1, 3)); + EXPECT_FLOAT_EQ(1.0, top->ScreenSpaceTransform().matrix().get(1, 3)); + EXPECT_FLOAT_EQ(2.0, child_of_top->ScreenSpaceTransform().matrix().get(1, 3)); EXPECT_FLOAT_EQ( - 3.0, grand_child_of_root->ScreenSpaceTransform().matrix().get(1, 3)); + 3.0, grand_child_of_top->ScreenSpaceTransform().matrix().get(1, 3)); EXPECT_FLOAT_EQ(2.0, render_surface1->ScreenSpaceTransform().matrix().get(1, 3)); @@ -4112,7 +4068,7 @@ root->layer_tree_impl()->BuildLayerListAndPropertyTreesForTesting(); root->layer_tree_impl()->SetPageScaleOnActiveTree(page_scale_factor); ExecuteCalculateDrawProperties(root, device_scale_factor, page_scale_factor, - root, nullptr, nullptr); + page_scale, nullptr, nullptr); EXPECT_FLOAT_EQ(device_scale_factor * page_scale_factor, parent->GetIdealContentsScale()); @@ -4182,7 +4138,10 @@ LayerImpl* root = root_layer_for_testing(); root->SetBounds(gfx::Size(100, 100)); - LayerImpl* parent = AddChildToRoot<LayerImpl>(); + LayerImpl* page_scale = AddChildToRoot<LayerImpl>(); + page_scale->SetBounds(gfx::Size(100, 100)); + + LayerImpl* parent = AddChild<LayerImpl>(page_scale); parent->SetBounds(gfx::Size(100, 100)); parent->test_properties()->transform = parent_scale_matrix; parent->SetDrawsContent(true); @@ -4198,7 +4157,7 @@ { ExecuteCalculateDrawProperties(root, device_scale_factor, page_scale_factor, - root, nullptr, nullptr); + page_scale, nullptr, nullptr); // The ideal scale is able to go below 1. float expected_ideal_scale = @@ -6565,8 +6524,8 @@ sticky_pos->SetBounds(gfx::Size(10, 10)); sticky_pos->SetPosition(gfx::PointF(0, 70)); - ExecuteCalculateDrawProperties(root.get(), 1.f, 1.f, root.get(), - scroller.get(), outer_viewport.get()); + ExecuteCalculateDrawProperties(root.get(), 1.f, 1.f, nullptr, scroller.get(), + outer_viewport.get()); host()->CommitAndCreateLayerImplTree(); LayerTreeImpl* layer_tree_impl = host()->host_impl()->active_tree(); LayerImpl* root_impl = layer_tree_impl->LayerById(root->id()); @@ -6586,7 +6545,7 @@ // We start to hide the toolbar, but not far enough that the sticky element // should be moved up yet. outer_clip_impl->SetViewportBoundsDelta(gfx::Vector2dF(0.f, -10.f)); - ExecuteCalculateDrawProperties(root_impl, 1.f, 1.f, root_impl, inner_scroll, + ExecuteCalculateDrawProperties(root_impl, 1.f, 1.f, nullptr, inner_scroll, outer_scroll); EXPECT_VECTOR2DF_EQ( gfx::Vector2dF(0.f, 70.f), @@ -6594,7 +6553,7 @@ // On hiding more of the toolbar the sticky element starts to stick. outer_clip_impl->SetViewportBoundsDelta(gfx::Vector2dF(0.f, -20.f)); - ExecuteCalculateDrawProperties(root_impl, 1.f, 1.f, root_impl, inner_scroll, + ExecuteCalculateDrawProperties(root_impl, 1.f, 1.f, nullptr, inner_scroll, outer_scroll); // On hiding more the sticky element stops moving as it has reached its @@ -6604,7 +6563,7 @@ sticky_pos_impl->ScreenSpaceTransform().To2dTranslation()); outer_clip_impl->SetViewportBoundsDelta(gfx::Vector2dF(0.f, -30.f)); - ExecuteCalculateDrawProperties(root_impl, 1.f, 1.f, root_impl, inner_scroll, + ExecuteCalculateDrawProperties(root_impl, 1.f, 1.f, nullptr, inner_scroll, outer_scroll); EXPECT_VECTOR2DF_EQ( @@ -7284,20 +7243,24 @@ LayerTreeSettings settings = host()->GetSettings(); FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, &task_graph_runner); + std::unique_ptr<LayerImpl> root = + LayerImpl::Create(host_impl.active_tree(), 1); std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent = - AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1); - std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> parent = AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); - std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> child = + std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> parent = AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); - std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = + std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> child = AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4); + std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = + AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 5); + LayerImpl* root_raw = root.get(); AnimationScaleFactorTrackingLayerImpl* parent_raw = parent.get(); AnimationScaleFactorTrackingLayerImpl* child_raw = child.get(); AnimationScaleFactorTrackingLayerImpl* grand_child_raw = grand_child.get(); AnimationScaleFactorTrackingLayerImpl* grand_parent_raw = grand_parent.get(); + root->SetBounds(gfx::Size(1, 2)); grand_parent->SetBounds(gfx::Size(1, 2)); parent->SetBounds(gfx::Size(1, 2)); child->SetBounds(gfx::Size(1, 2)); @@ -7306,9 +7269,10 @@ child->test_properties()->AddChild(std::move(grand_child)); parent->test_properties()->AddChild(std::move(child)); grand_parent->test_properties()->AddChild(std::move(parent)); - host_impl.active_tree()->SetRootLayerForTesting(std::move(grand_parent)); + root->test_properties()->AddChild(std::move(grand_parent)); + host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); // No layers have animations. EXPECT_EQ(kNotScaled, GetMaximumAnimationScale(grand_parent_raw)); @@ -7374,7 +7338,7 @@ AddAnimatedTransformToAnimation(child_animation.get(), 1.0, TransformOperations(), scale); child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); // Only |child| has a scale-affecting animation. EXPECT_EQ(kNotScaled, GetMaximumAnimationScale(grand_parent_raw)); @@ -7390,7 +7354,7 @@ AddAnimatedTransformToAnimation(grand_parent_animation.get(), 1.0, TransformOperations(), scale); grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); // |grand_parent| and |child| have scale-affecting animations. EXPECT_EQ(5.f, GetMaximumAnimationScale(grand_parent_raw)); @@ -7408,7 +7372,7 @@ AddAnimatedTransformToAnimation(parent_animation.get(), 1.0, TransformOperations(), scale); parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); // |grand_parent|, |parent|, and |child| have scale-affecting animations. EXPECT_EQ(5.f, GetMaximumAnimationScale(grand_parent_raw)); @@ -7434,7 +7398,7 @@ AddAnimatedTransformToAnimation(child_animation.get(), 1.0, TransformOperations(), perspective); child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); // |child| has a scale-affecting animation but computing the maximum of this // animation is not supported. @@ -7459,7 +7423,7 @@ AddAnimatedTransformToAnimation(parent_animation.get(), 1.0, TransformOperations(), scale); - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); // |grand_parent| and |parent| each have scale 2.f. |parent| has a scale // animation with maximum scale 5.f. @@ -7477,7 +7441,7 @@ perspective_matrix.ApplyPerspectiveDepth(2.f); child_raw->test_properties()->transform = perspective_matrix; grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); // |child| has a transform that's neither a translation nor a scale. EXPECT_EQ(kNotScaled, GetMaximumAnimationScale(grand_parent_raw)); @@ -7492,7 +7456,7 @@ parent_raw->test_properties()->transform = perspective_matrix; grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); // |parent| and |child| have transforms that are neither translations nor // scales. @@ -7511,7 +7475,7 @@ grand_parent_raw->test_properties()->transform = perspective_matrix; grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); // |grand_parent| has a transform that's neither a translation nor a scale. EXPECT_EQ(kNotScaled, GetMaximumAnimationScale(grand_parent_raw)); @@ -7545,23 +7509,27 @@ TestTaskGraphRunner task_graph_runner; FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); - std::unique_ptr<LayerImpl> grand_parent = + std::unique_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); + std::unique_ptr<LayerImpl> grand_parent = + LayerImpl::Create(host_impl.active_tree(), 2); std::unique_ptr<LayerImpl> parent = - LayerImpl::Create(host_impl.active_tree(), 3); + LayerImpl::Create(host_impl.active_tree(), 4); std::unique_ptr<LayerImpl> child = - LayerImpl::Create(host_impl.active_tree(), 5); + LayerImpl::Create(host_impl.active_tree(), 6); std::unique_ptr<LayerImpl> grand_child1 = - LayerImpl::Create(host_impl.active_tree(), 7); + LayerImpl::Create(host_impl.active_tree(), 8); std::unique_ptr<LayerImpl> grand_child2 = - LayerImpl::Create(host_impl.active_tree(), 9); + LayerImpl::Create(host_impl.active_tree(), 10); + LayerImpl* root_raw = root.get(); LayerImpl* grand_parent_raw = grand_parent.get(); LayerImpl* parent_raw = parent.get(); LayerImpl* child_raw = child.get(); LayerImpl* grand_child1_raw = grand_child1.get(); LayerImpl* grand_child2_raw = grand_child2.get(); + root->SetBounds(gfx::Size(1, 2)); grand_parent->SetBounds(gfx::Size(1, 2)); parent->SetBounds(gfx::Size(1, 2)); child->SetBounds(gfx::Size(1, 2)); @@ -7572,10 +7540,11 @@ child->test_properties()->AddChild(std::move(grand_child2)); parent->test_properties()->AddChild(std::move(child)); grand_parent->test_properties()->AddChild(std::move(parent)); - host_impl.active_tree()->SetRootLayerForTesting(std::move(grand_parent)); + root->test_properties()->AddChild(std::move(grand_parent)); + host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); // Start with nothing being drawn. - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); EXPECT_FALSE(grand_parent_raw->contributes_to_drawn_render_surface()); EXPECT_FALSE(parent_raw->contributes_to_drawn_render_surface()); @@ -7593,7 +7562,7 @@ grand_child1_raw->test_properties()->force_render_surface = true; grand_child1_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); EXPECT_FALSE(grand_parent_raw->contributes_to_drawn_render_surface()); EXPECT_FALSE(parent_raw->contributes_to_drawn_render_surface()); @@ -7610,7 +7579,7 @@ // RSLL. grand_child1_raw->SetDrawsContent(true); - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); EXPECT_FALSE(grand_parent_raw->contributes_to_drawn_render_surface()); EXPECT_FALSE(parent_raw->contributes_to_drawn_render_surface()); @@ -7633,7 +7602,7 @@ child_raw->test_properties()->force_render_surface = true; grand_child2_raw->SetDrawsContent(true); - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); EXPECT_FALSE(grand_parent_raw->contributes_to_drawn_render_surface()); EXPECT_FALSE(parent_raw->contributes_to_drawn_render_surface()); @@ -7650,10 +7619,10 @@ // Add a mask layer to child. child_raw->test_properties()->SetMaskLayer( - LayerImpl::Create(host_impl.active_tree(), 6)); + LayerImpl::Create(host_impl.active_tree(), 7)); child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); EXPECT_FALSE(grand_parent_raw->contributes_to_drawn_render_surface()); EXPECT_FALSE(parent_raw->contributes_to_drawn_render_surface()); @@ -7675,7 +7644,7 @@ GatherDrawnLayers(host_impl.active_tree(), &actual); EXPECT_EQ(expected, actual); - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); EXPECT_FALSE(grand_parent_raw->contributes_to_drawn_render_surface()); EXPECT_FALSE(parent_raw->contributes_to_drawn_render_surface()); @@ -7698,7 +7667,7 @@ // With nothing drawing, we should have no layers. grand_child2_raw->SetDrawsContent(false); - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); EXPECT_FALSE(grand_parent_raw->contributes_to_drawn_render_surface()); EXPECT_FALSE(parent_raw->contributes_to_drawn_render_surface()); @@ -7717,7 +7686,7 @@ // list. child_raw->SetDrawsContent(true); - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); EXPECT_FALSE(grand_parent_raw->contributes_to_drawn_render_surface()); EXPECT_FALSE(parent_raw->contributes_to_drawn_render_surface()); @@ -7744,7 +7713,7 @@ grand_child1_raw->SetDrawsContent(true); grand_child2_raw->SetDrawsContent(true); - ExecuteCalculateDrawProperties(grand_parent_raw); + ExecuteCalculateDrawProperties(root_raw); EXPECT_TRUE(grand_parent_raw->contributes_to_drawn_render_surface()); EXPECT_TRUE(parent_raw->contributes_to_drawn_render_surface()); @@ -7774,11 +7743,14 @@ std::unique_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); LayerImpl* root_layer = root.get(); - std::unique_ptr<LayerImpl> child1 = + std::unique_ptr<LayerImpl> page_scale = LayerImpl::Create(host_impl.active_tree(), 2); + LayerImpl* page_scale_layer = page_scale.get(); + std::unique_ptr<LayerImpl> child1 = + LayerImpl::Create(host_impl.active_tree(), 3); LayerImpl* child1_layer = child1.get(); std::unique_ptr<LayerImpl> child2 = - LayerImpl::Create(host_impl.active_tree(), 3); + LayerImpl::Create(host_impl.active_tree(), 4); LayerImpl* child2_layer = child2.get(); gfx::Transform scale_transform_child1, scale_transform_child2; @@ -7792,14 +7764,16 @@ child1_layer->SetDrawsContent(true); child1_layer->test_properties()->SetMaskLayer( - LayerImpl::Create(host_impl.active_tree(), 4)); + LayerImpl::Create(host_impl.active_tree(), 5)); - root->test_properties()->AddChild(std::move(child1)); - root->test_properties()->AddChild(std::move(child2)); + page_scale->test_properties()->AddChild(std::move(child1)); + page_scale->test_properties()->AddChild(std::move(child2)); + root->test_properties()->AddChild(std::move(page_scale)); host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); host_impl.active_tree()->SetElementIdsForTesting(); - ExecuteCalculateDrawProperties(root_layer); + ExecuteCalculateDrawProperties(root_layer, 1.f, 1.f, page_scale_layer, + nullptr, nullptr); TransformOperations scale; scale.AppendScale(5.f, 8.f, 3.f); @@ -7815,9 +7789,11 @@ child2_layer->element_id(), timeline, 1.0, TransformOperations(), scale); root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; - ExecuteCalculateDrawProperties(root_layer); + ExecuteCalculateDrawProperties(root_layer, 1.f, 1.f, page_scale_layer, + nullptr, nullptr); EXPECT_FLOAT_EQ(1.f, root_layer->GetIdealContentsScale()); + EXPECT_FLOAT_EQ(1.f, page_scale_layer->GetIdealContentsScale()); EXPECT_FLOAT_EQ(3.f, child1_layer->GetIdealContentsScale()); EXPECT_FLOAT_EQ( 3.f, @@ -7825,6 +7801,7 @@ EXPECT_FLOAT_EQ(5.f, child2_layer->GetIdealContentsScale()); EXPECT_FLOAT_EQ(kNotScaled, GetMaximumAnimationScale(root_layer)); + EXPECT_FLOAT_EQ(kNotScaled, GetMaximumAnimationScale(page_scale_layer)); EXPECT_FLOAT_EQ(kNotScaled, GetMaximumAnimationScale(child1_layer)); EXPECT_FLOAT_EQ(8.f, GetMaximumAnimationScale(child2_layer)); @@ -7841,12 +7818,13 @@ root_layer, device_viewport_size, &render_surface_list); inputs.page_scale_factor = page_scale_factor; - inputs.page_scale_layer = root_layer; + inputs.page_scale_layer = page_scale_layer; inputs.page_scale_transform_node = inputs.property_trees->transform_tree.Node( inputs.page_scale_layer->transform_tree_index()); LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); - EXPECT_FLOAT_EQ(3.f, root_layer->GetIdealContentsScale()); + EXPECT_FLOAT_EQ(1.f, root_layer->GetIdealContentsScale()); + EXPECT_FLOAT_EQ(3.f, page_scale_layer->GetIdealContentsScale()); EXPECT_FLOAT_EQ(9.f, child1_layer->GetIdealContentsScale()); EXPECT_FLOAT_EQ( 9.f, @@ -7854,6 +7832,7 @@ EXPECT_FLOAT_EQ(15.f, child2_layer->GetIdealContentsScale()); EXPECT_FLOAT_EQ(kNotScaled, GetMaximumAnimationScale(root_layer)); + EXPECT_FLOAT_EQ(kNotScaled, GetMaximumAnimationScale(page_scale_layer)); EXPECT_FLOAT_EQ(kNotScaled, GetMaximumAnimationScale(child1_layer)); EXPECT_FLOAT_EQ(24.f, GetMaximumAnimationScale(child2_layer)); @@ -7865,7 +7844,8 @@ root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); - EXPECT_FLOAT_EQ(12.f, root_layer->GetIdealContentsScale()); + EXPECT_FLOAT_EQ(4.f, root_layer->GetIdealContentsScale()); + EXPECT_FLOAT_EQ(12.f, page_scale_layer->GetIdealContentsScale()); EXPECT_FLOAT_EQ(36.f, child1_layer->GetIdealContentsScale()); EXPECT_FLOAT_EQ( 36.f, @@ -7873,6 +7853,7 @@ EXPECT_FLOAT_EQ(60.f, child2_layer->GetIdealContentsScale()); EXPECT_FLOAT_EQ(kNotScaled, GetMaximumAnimationScale(root_layer)); + EXPECT_FLOAT_EQ(kNotScaled, GetMaximumAnimationScale(page_scale_layer)); EXPECT_FLOAT_EQ(kNotScaled, GetMaximumAnimationScale(child1_layer)); EXPECT_FLOAT_EQ(96.f, GetMaximumAnimationScale(child2_layer)); } @@ -8659,15 +8640,18 @@ std::unique_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); - std::unique_ptr<LayerImpl> child = + std::unique_ptr<LayerImpl> parent = LayerImpl::Create(host_impl.active_tree(), 2); - std::unique_ptr<LayerImpl> grandchild = + std::unique_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 3); + std::unique_ptr<LayerImpl> grandchild = + LayerImpl::Create(host_impl.active_tree(), 4); std::unique_ptr<FakePictureLayerImpl> greatgrandchild( - FakePictureLayerImpl::Create(host_impl.active_tree(), 4)); + FakePictureLayerImpl::Create(host_impl.active_tree(), 5)); root->SetBounds(gfx::Size(100, 100)); + parent->SetBounds(gfx::Size(100, 100)); child->SetBounds(gfx::Size(10, 10)); child->SetDrawsContent(true); grandchild->SetBounds(gfx::Size(10, 10)); @@ -8675,11 +8659,13 @@ greatgrandchild->SetDrawsContent(true); LayerImpl* root_ptr = root.get(); + LayerImpl* parent_ptr = parent.get(); LayerImpl* child_ptr = child.get(); LayerImpl* grandchild_ptr = grandchild.get(); child->test_properties()->AddChild(std::move(grandchild)); - root->test_properties()->AddChild(std::move(child)); + parent->test_properties()->AddChild(std::move(child)); + root->test_properties()->AddChild(std::move(parent)); host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); host_impl.active_tree()->SetElementIdsForTesting(); @@ -8724,22 +8710,22 @@ EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); child_ptr->test_properties()->opacity = 1.f; - root_ptr->test_properties()->transform = singular; + parent_ptr->test_properties()->transform = singular; // Force transform tree to have a node for child, so that ancestor's // invertible transform can be tested. child_ptr->test_properties()->transform = rotate; host_impl.active_tree()->property_trees()->needs_rebuild = true; ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); - root_ptr->test_properties()->transform = gfx::Transform(); + parent_ptr->test_properties()->transform = gfx::Transform(); child_ptr->test_properties()->transform = gfx::Transform(); - root_ptr->test_properties()->opacity = 0.f; + parent_ptr->test_properties()->opacity = 0.f; child_ptr->test_properties()->opacity = 0.7f; host_impl.active_tree()->property_trees()->needs_rebuild = true; ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); - root_ptr->test_properties()->opacity = 1.f; + parent_ptr->test_properties()->opacity = 1.f; child_ptr->test_properties()->opacity = 0.f; // Now, even though child has zero opacity, we will configure |grandchild| and @@ -8784,11 +8770,11 @@ AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); host_impl.animation_host()->AddAnimationTimeline(timeline); timeline->AttachAnimation(animation); - animation->AttachElementForKeyframeEffect(root_ptr->element_id(), + animation->AttachElementForKeyframeEffect(parent_ptr->element_id(), animation->keyframe_effect()->id()); animation->AddKeyframeModel(std::move(transform_animation)); grandchild_ptr->set_visible_layer_rect(gfx::Rect()); - root_ptr->test_properties()->transform = singular; + parent_ptr->test_properties()->transform = singular; child_ptr->test_properties()->transform = singular; root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr);
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 4cecb1e..548220a19 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -7008,10 +7008,13 @@ // the scroll doesn't bubble up to the parent layer. gfx::Size surface_size(20, 20); gfx::Size viewport_size(10, 10); - const int kPageScaleLayerId = 1; - const int kViewportClipLayerId = 2; - const int kViewportScrollLayerId = 3; + const int kRootLayerId = 1; + const int kPageScaleLayerId = 2; + const int kViewportClipLayerId = 3; + const int kViewportScrollLayerId = 4; std::unique_ptr<LayerImpl> root_ptr = + LayerImpl::Create(host_impl_->active_tree(), kRootLayerId); + std::unique_ptr<LayerImpl> page_scale = LayerImpl::Create(host_impl_->active_tree(), kPageScaleLayerId); std::unique_ptr<LayerImpl> root_clip = LayerImpl::Create(host_impl_->active_tree(), kViewportClipLayerId); @@ -7024,21 +7027,22 @@ std::unique_ptr<LayerImpl> grand_child = CreateScrollableLayer(5, surface_size); - std::unique_ptr<LayerImpl> child = CreateScrollableLayer(4, surface_size); + std::unique_ptr<LayerImpl> child = CreateScrollableLayer(6, surface_size); LayerImpl* grand_child_layer = grand_child.get(); child->test_properties()->AddChild(std::move(grand_child)); LayerImpl* child_layer = child.get(); root_scrolling->test_properties()->AddChild(std::move(child)); root_clip->test_properties()->AddChild(std::move(root_scrolling)); - root_ptr->test_properties()->AddChild(std::move(root_clip)); + page_scale->test_properties()->AddChild(std::move(root_clip)); + root_ptr->test_properties()->AddChild(std::move(page_scale)); host_impl_->active_tree()->SetRootLayerForTesting(std::move(root_ptr)); - host_impl_->active_tree()->BuildPropertyTreesForTesting(); LayerTreeImpl::ViewportLayerIds viewport_ids; viewport_ids.page_scale = kPageScaleLayerId; viewport_ids.inner_viewport_container = kViewportClipLayerId; viewport_ids.inner_viewport_scroll = kViewportScrollLayerId; host_impl_->active_tree()->SetViewportLayersFromIds(viewport_ids); + host_impl_->active_tree()->BuildPropertyTreesForTesting(); host_impl_->active_tree()->DidBecomeActive(); host_impl_->active_tree()->SetDeviceViewportSize(viewport_size); @@ -7066,21 +7070,12 @@ host_impl_->ProcessScrollDeltas(); // The grand child should have scrolled up to its limit. - LayerImpl* child = host_impl_->active_tree() - ->root_layer_for_testing() - ->test_properties() - ->children[0] - ->test_properties() - ->children[0] - ->test_properties() - ->children[0]; - LayerImpl* grand_child = child->test_properties()->children[0]; EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), - grand_child->element_id(), + grand_child_layer->element_id(), gfx::ScrollOffset(0, -2))); // The child should not have scrolled. - ExpectNone(*scroll_info.get(), child->element_id()); + ExpectNone(*scroll_info.get(), child_layer->element_id()); // The next time we scroll we should only scroll the parent. scroll_delta = gfx::Vector2d(0, -3); @@ -7090,21 +7085,22 @@ InputHandler::TOUCHSCREEN) .thread); EXPECT_EQ(host_impl_->CurrentlyScrollingNode()->id, - grand_child->scroll_tree_index()); + grand_child_layer->scroll_tree_index()); host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); EXPECT_EQ(host_impl_->CurrentlyScrollingNode()->id, - child->scroll_tree_index()); + child_layer->scroll_tree_index()); host_impl_->ScrollEnd(EndState().get()); scroll_info = host_impl_->ProcessScrollDeltas(); // The child should have scrolled up to its limit. - EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), child->element_id(), + EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), + child_layer->element_id(), gfx::ScrollOffset(0, -3))); // The grand child should not have scrolled. EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), - grand_child->element_id(), + grand_child_layer->element_id(), gfx::ScrollOffset(0, -2))); // After scrolling the parent, another scroll on the opposite direction @@ -7116,21 +7112,22 @@ InputHandler::TOUCHSCREEN) .thread); EXPECT_EQ(host_impl_->CurrentlyScrollingNode()->id, - grand_child->scroll_tree_index()); + grand_child_layer->scroll_tree_index()); host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); EXPECT_EQ(host_impl_->CurrentlyScrollingNode()->id, - grand_child->scroll_tree_index()); + grand_child_layer->scroll_tree_index()); host_impl_->ScrollEnd(EndState().get()); scroll_info = host_impl_->ProcessScrollDeltas(); // The grand child should have scrolled. EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), - grand_child->element_id(), + grand_child_layer->element_id(), gfx::ScrollOffset(0, 5))); // The child should not have scrolled. - EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), child->element_id(), + EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), + child_layer->element_id(), gfx::ScrollOffset(0, -3))); // Scrolling should be adjusted from viewport space. @@ -7143,7 +7140,7 @@ ->ScrollBegin(BeginState(gfx::Point(1, 1)).get(), InputHandler::TOUCHSCREEN) .thread); - EXPECT_EQ(grand_child->scroll_tree_index(), + EXPECT_EQ(grand_child_layer->scroll_tree_index(), host_impl_->CurrentlyScrollingNode()->id); host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); host_impl_->ScrollEnd(EndState().get()); @@ -7152,7 +7149,7 @@ // Should have scrolled by half the amount in layer space (5 - 2/2) EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), - grand_child->element_id(), + grand_child_layer->element_id(), gfx::ScrollOffset(0, 4))); } } @@ -7263,14 +7260,14 @@ } TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) { - const int kPageScaleLayerId = 1; + const int kRootLayerId = 1; const int kInnerViewportClipLayerId = 2; const int kOuterViewportClipLayerId = 7; const int kInnerViewportScrollLayerId = 3; const int kOuterViewportScrollLayerId = 8; gfx::Size surface_size(10, 10); std::unique_ptr<LayerImpl> root_ptr = - LayerImpl::Create(host_impl_->active_tree(), kPageScaleLayerId); + LayerImpl::Create(host_impl_->active_tree(), kRootLayerId); std::unique_ptr<LayerImpl> inner_clip = LayerImpl::Create(host_impl_->active_tree(), kInnerViewportClipLayerId); std::unique_ptr<LayerImpl> inner_scroll = @@ -7290,7 +7287,6 @@ root_ptr->test_properties()->AddChild(std::move(inner_clip)); host_impl_->active_tree()->SetRootLayerForTesting(std::move(root_ptr)); LayerTreeImpl::ViewportLayerIds viewport_ids; - viewport_ids.page_scale = kPageScaleLayerId; viewport_ids.inner_viewport_container = kInnerViewportClipLayerId; viewport_ids.outer_viewport_container = kOuterViewportClipLayerId; viewport_ids.inner_viewport_scroll = kInnerViewportScrollLayerId; @@ -7305,7 +7301,6 @@ // synchronization. DrawFrame(); - const int kPageScaleLayerId2 = 4; const int kInnerViewportClipLayerId2 = 5; const int kOuterViewportClipLayerId2 = 9; const int kInnerViewportScrollLayerId2 = 6; @@ -7333,7 +7328,6 @@ host_impl_->active_tree()->SetRootLayerForTesting(std::move(root_ptr2)); host_impl_->active_tree()->BuildPropertyTreesForTesting(); LayerTreeImpl::ViewportLayerIds viewport_ids2; - viewport_ids2.page_scale = kPageScaleLayerId2; viewport_ids2.inner_viewport_container = kInnerViewportClipLayerId2; viewport_ids2.outer_viewport_container = kOuterViewportClipLayerId2; viewport_ids2.inner_viewport_scroll = kInnerViewportScrollLayerId2; @@ -7356,10 +7350,8 @@ // Rotate the root layer 90 degrees counter-clockwise about its center. gfx::Transform rotate_transform; rotate_transform.Rotate(-90.0); - host_impl_->active_tree() - ->root_layer_for_testing() - ->test_properties() - ->transform = rotate_transform; + // Set external transform. + host_impl_->OnDraw(rotate_transform, gfx::Rect(0, 0, 50, 50), false, false); host_impl_->active_tree()->BuildPropertyTreesForTesting(); gfx::Size surface_size(50, 50); @@ -7584,8 +7576,8 @@ int scale = 2; gfx::Transform scale_transform; scale_transform.Scale(scale, scale); - scroll_layer->test_properties()->parent->test_properties()->transform = - scale_transform; + // Set external transform above root. + host_impl_->OnDraw(scale_transform, gfx::Rect(0, 0, 50, 50), false, false); host_impl_->active_tree()->BuildPropertyTreesForTesting(); gfx::Size surface_size(50, 50); @@ -13411,27 +13403,38 @@ host_impl_->active_tree()->property_trees()->transform_tree.Node( page_scale_layer->transform_tree_index()); // SetPageScaleOnActiveTree also updates the factors in property trees. - EXPECT_EQ(active_tree_node->post_local_scale_factor, 2.f); + EXPECT_TRUE(active_tree_node->local.IsScale2d()); + EXPECT_EQ(gfx::Vector2dF(2.f, 2.f), active_tree_node->local.Scale2d()); + EXPECT_TRUE(active_tree_node->pre_local.IsIdentity()); + EXPECT_TRUE(active_tree_node->post_local.IsIdentity()); EXPECT_EQ(host_impl_->active_tree()->current_page_scale_factor(), 2.f); TransformNode* pending_tree_node = host_impl_->pending_tree()->property_trees()->transform_tree.Node( page_scale_layer->transform_tree_index()); - EXPECT_EQ(pending_tree_node->post_local_scale_factor, 1.f); + EXPECT_TRUE(pending_tree_node->local.IsIdentity()); + EXPECT_TRUE(pending_tree_node->pre_local.IsIdentity()); + EXPECT_TRUE(pending_tree_node->post_local.IsIdentity()); EXPECT_EQ(host_impl_->pending_tree()->current_page_scale_factor(), 2.f); host_impl_->pending_tree()->UpdateDrawProperties(); pending_tree_node = host_impl_->pending_tree()->property_trees()->transform_tree.Node( page_scale_layer->transform_tree_index()); - EXPECT_EQ(pending_tree_node->post_local_scale_factor, 2.f); + EXPECT_TRUE(pending_tree_node->local.IsScale2d()); + EXPECT_EQ(gfx::Vector2dF(2.f, 2.f), pending_tree_node->local.Scale2d()); + EXPECT_TRUE(pending_tree_node->pre_local.IsIdentity()); + EXPECT_TRUE(pending_tree_node->post_local.IsIdentity()); host_impl_->ActivateSyncTree(); host_impl_->active_tree()->UpdateDrawProperties(); active_tree_node = host_impl_->active_tree()->property_trees()->transform_tree.Node( page_scale_layer->transform_tree_index()); - EXPECT_EQ(active_tree_node->post_local_scale_factor, 2.f); + EXPECT_TRUE(active_tree_node->local.IsScale2d()); + EXPECT_EQ(gfx::Vector2dF(2.f, 2.f), active_tree_node->local.Scale2d()); + EXPECT_TRUE(active_tree_node->pre_local.IsIdentity()); + EXPECT_TRUE(active_tree_node->post_local.IsIdentity()); } TEST_F(LayerTreeHostImplTest, SubLayerScaleForNodeInSubtreeOfPageScaleLayer) {
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 45cf70a..abef68e 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc
@@ -1319,19 +1319,21 @@ protected: void SetupTree() override { - root_ = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(); + layer_ = Layer::Create(); + root->AddChild(layer_); layer_tree_host()->SetViewportSizeAndScale(gfx::Size(10, 10), 1.f, viz::LocalSurfaceIdAllocation()); - - layer_tree_host()->SetRootLayer(root_); + layer_tree_host()->SetRootLayer(root); // Translate the root layer past the viewport. gfx::Transform translation; translation.Translate(100, 100); - root_->SetTransform(translation); + layer_->SetTransform(translation); - root_->SetBounds(gfx::Size(50, 50)); + root->SetBounds(gfx::Size(50, 50)); + layer_->SetBounds(gfx::Size(50, 50)); LayerTreeHostTest::SetupTree(); } @@ -1342,7 +1344,7 @@ // This does not damage the frame because the root layer is outside the // viewport. if (layer_tree_host()->SourceFrameNumber() == 2) - root_->SetOpacity(0.9f); + layer_->SetOpacity(0.9f); } DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* impl, @@ -1385,7 +1387,7 @@ void AfterTest() override {} private: - scoped_refptr<Layer> root_; + scoped_refptr<Layer> layer_; bool first_frame_invalidate_before_commit_ = false; }; @@ -2056,8 +2058,14 @@ class LayerTreeHostTestTransformTreeSync : public LayerTreeHostTest { protected: void SetupTree() override { - root_ = Layer::Create(); - layer_tree_host()->SetRootLayer(root_); + scoped_refptr<Layer> root = Layer::Create(); + layer_ = Layer::Create(); + // Force a transform node for the layer. + gfx::Transform rotate5; + rotate5.Rotate(5.f); + layer_->SetTransform(rotate5); + root->AddChild(layer_); + layer_tree_host()->SetRootLayer(root); LayerTreeHostTest::SetupTree(); } @@ -2066,7 +2074,7 @@ void DidCommit() override { TransformTree& transform_tree = layer_tree_host()->property_trees()->transform_tree; - TransformNode* node = transform_tree.Node(root_->transform_tree_index()); + TransformNode* node = transform_tree.Node(layer_->transform_tree_index()); gfx::Transform rotate10; rotate10.Rotate(10.f); switch (layer_tree_host()->SourceFrameNumber()) { @@ -2090,17 +2098,16 @@ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { TransformTree& transform_tree = impl->sync_tree()->property_trees()->transform_tree; - const LayerImpl* root_layer = impl->sync_tree()->root_layer_for_testing(); + const LayerImpl* layer = impl->sync_tree()->LayerById(layer_->id()); const TransformNode* node = - transform_tree.Node(root_layer->transform_tree_index()); + transform_tree.Node(layer->transform_tree_index()); gfx::Transform rotate10; rotate10.Rotate(10.f); gfx::Transform rotate20; rotate20.Rotate(20.f); switch (impl->sync_tree()->source_frame_number()) { case 0: - impl->sync_tree()->SetTransformMutated(root_layer->element_id(), - rotate20); + impl->sync_tree()->SetTransformMutated(layer->element_id(), rotate20); PostSetNeedsCommitToMainThread(); break; case 1: @@ -2109,8 +2116,7 @@ break; case 2: EXPECT_EQ(node->local, rotate20); - impl->sync_tree()->SetTransformMutated(root_layer->element_id(), - rotate20); + impl->sync_tree()->SetTransformMutated(layer->element_id(), rotate20); PostSetNeedsCommitToMainThread(); break; case 3: @@ -2126,7 +2132,7 @@ void AfterTest() override {} private: - scoped_refptr<Layer> root_; + scoped_refptr<Layer> layer_; }; SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestTransformTreeSync); @@ -2395,20 +2401,23 @@ void BeginTest() override { client_.set_fill_with_nonsolid_color(true); - root_layer_ = FakePictureLayer::Create(&client_); - root_layer_->SetIsDrawable(true); + scoped_refptr<Layer> root = Layer::Create(); + layer_ = FakePictureLayer::Create(&client_); + root->AddChild(layer_); + layer_->SetIsDrawable(true); gfx::Transform transform; // Translate the layer out of the viewport to force it to not update its // tile size via PushProperties. transform.Translate(10000.0, 10000.0); - root_layer_->SetTransform(transform); - root_layer_->SetBounds(bounds_); - layer_tree_host()->SetRootLayer(root_layer_); + layer_->SetTransform(transform); + root->SetBounds(bounds_); + layer_->SetBounds(bounds_); + layer_tree_host()->SetRootLayer(root); layer_tree_host()->SetViewportSizeAndScale(bounds_, 1.f, viz::LocalSurfaceIdAllocation()); PostSetNeedsCommitToMainThread(); - client_.set_bounds(root_layer_->bounds()); + client_.set_bounds(layer_->bounds()); } void InitializeSettings(LayerTreeSettings* settings) override { @@ -2419,12 +2428,12 @@ if (num_draws_ == 2) { auto* pending_tree = host_impl->pending_tree(); auto* pending_layer_impl = static_cast<FakePictureLayerImpl*>( - pending_tree->root_layer_for_testing()); + pending_tree->LayerById(layer_->id())); EXPECT_NE(pending_layer_impl, nullptr); auto* active_tree = host_impl->pending_tree(); auto* active_layer_impl = static_cast<FakePictureLayerImpl*>( - active_tree->root_layer_for_testing()); + active_tree->LayerById(layer_->id())); EXPECT_NE(pending_layer_impl, nullptr); auto* active_tiling_set = active_layer_impl->picture_layer_tiling_set(); @@ -2459,7 +2468,7 @@ const gfx::Size bounds_; const gfx::Rect invalid_rect_; FakeContentLayerClient client_; - scoped_refptr<FakePictureLayer> root_layer_; + scoped_refptr<FakePictureLayer> layer_; }; // As there's no pending tree in single-threaded case, this test should run
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc index d5a0aa9..78b6e74 100644 --- a/cc/trees/layer_tree_host_unittest_animation.cc +++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -1323,6 +1323,14 @@ LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers() : frame_count_with_pending_tree_(0) {} + void SetupTree() override { + LayerTreeHostAnimationTest::SetupTree(); + layer_ = Layer::Create(); + layer_->SetBounds(gfx::Size(4, 4)); + layer_tree_host()->root_layer()->AddChild(layer_); + layer_tree_host()->SetElementIdsForTesting(); + } + void BeginTest() override { AttachAnimationsToTimeline(); PostSetNeedsCommitToMainThread(); @@ -1330,18 +1338,18 @@ void DidCommit() override { if (layer_tree_host()->SourceFrameNumber() == 1) { - animation_->AttachElement(layer_tree_host()->root_layer()->element_id()); + animation_->AttachElement(layer_->element_id()); AddAnimatedTransformToAnimation(animation_.get(), 4, 1, 1); } else if (layer_tree_host()->SourceFrameNumber() == 2) { AddOpacityTransitionToAnimation(animation_.get(), 1, 0.f, 0.5f, true); - scoped_refptr<Layer> layer = Layer::Create(); - layer_tree_host()->root_layer()->AddChild(layer); + scoped_refptr<Layer> child_layer = Layer::Create(); + layer_->AddChild(child_layer); layer_tree_host()->SetElementIdsForTesting(); - layer->SetBounds(gfx::Size(4, 4)); + child_layer->SetBounds(gfx::Size(4, 4)); - animation_child_->AttachElement(layer->element_id()); + animation_child_->AttachElement(child_layer->element_id()); animation_child_->set_animation_delegate(this); AddOpacityTransitionToAnimation(animation_child_.get(), 1, 0.f, 0.5f, true); @@ -1412,6 +1420,7 @@ void AfterTest() override {} private: + scoped_refptr<Layer> layer_; int frame_count_with_pending_tree_; }; @@ -1606,11 +1615,14 @@ layer_ = Layer::Create(); layer_->SetBounds(gfx::Size(4, 4)); layer_tree_host()->root_layer()->AddChild(layer_); + child_layer_ = Layer::Create(); + child_layer_->SetBounds(gfx::Size(4, 4)); + layer_->AddChild(child_layer_); AttachAnimationsToTimeline(); - animation_->AttachElement(layer_tree_host()->root_layer()->element_id()); - animation_child_->AttachElement(layer_->element_id()); + animation_->AttachElement(layer_->element_id()); + animation_child_->AttachElement(child_layer_->element_id()); } void BeginTest() override { PostSetNeedsCommitToMainThread(); } @@ -1669,6 +1681,7 @@ private: scoped_refptr<Layer> layer_; + scoped_refptr<Layer> child_layer_; }; SINGLE_AND_MULTI_THREAD_TEST_F( @@ -2295,9 +2308,14 @@ public: void SetupTree() override { LayerTreeHostAnimationTest::SetupTree(); + layer_ = Layer::Create(); + layer_->SetBounds(gfx::Size(4, 4)); + layer_tree_host()->root_layer()->AddChild(layer_); + AttachAnimationsToTimeline(); + timeline_->DetachAnimation(animation_child_.get()); - animation_->AttachElement(layer_tree_host()->root_layer()->element_id()); + animation_->AttachElement(layer_->element_id()); TransformOperations start; start.AppendTranslate(5.f, 5.f, 0.f); @@ -2312,7 +2330,7 @@ PropertyTrees* property_trees = host_impl->sync_tree()->property_trees(); TransformNode* node = property_trees->transform_tree.Node(host_impl->sync_tree() - ->root_layer_for_testing() + ->LayerById(layer_->id()) ->transform_tree_index()); gfx::Transform translate; translate.Translate(5, 5); @@ -2334,8 +2352,7 @@ timeline_->DetachAnimation(animation_.get()); animation_ = nullptr; timeline_->AttachAnimation(animation_child_.get()); - animation_child_->AttachElement( - layer_tree_host()->root_layer()->element_id()); + animation_child_->AttachElement(layer_->element_id()); AddAnimatedTransformToAnimation(animation_child_.get(), 1.0, 10, 10); KeyframeModel* keyframe_model = animation_child_->GetKeyframeModel(TargetProperty::TRANSFORM); @@ -2346,6 +2363,9 @@ } void AfterTest() override {} + + private: + scoped_refptr<Layer> layer_; }; SINGLE_AND_MULTI_THREAD_TEST_F(
diff --git a/cc/trees/layer_tree_host_unittest_picture.cc b/cc/trees/layer_tree_host_unittest_picture.cc index 8c103dfc..b200949 100644 --- a/cc/trees/layer_tree_host_unittest_picture.cc +++ b/cc/trees/layer_tree_host_unittest_picture.cc
@@ -585,15 +585,18 @@ gfx::Size size(100, 100); scoped_refptr<Layer> root = Layer::Create(); root->SetBounds(size); + top_layer_ = Layer::Create(); + top_layer_->SetBounds(size); + root->AddChild(top_layer_); will_change_layer_ = FakePictureLayer::Create(&client_); will_change_layer_->SetHasWillChangeTransformHint(true); will_change_layer_->SetBounds(size); - root->AddChild(will_change_layer_); + top_layer_->AddChild(will_change_layer_); normal_layer_ = FakePictureLayer::Create(&client_); normal_layer_->SetBounds(size); - root->AddChild(normal_layer_); + top_layer_->AddChild(normal_layer_); layer_tree_host()->SetRootLayer(root); layer_tree_host()->SetViewportSizeAndScale(size, 1.f, @@ -626,7 +629,7 @@ MainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce( - &LayerTreeHostPictureTestForceRecalculateScales::ScaleRootUp, + &LayerTreeHostPictureTestForceRecalculateScales::ScaleUp, base::Unretained(this))); break; case 1: @@ -643,7 +646,7 @@ MainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&LayerTreeHostPictureTestForceRecalculateScales:: - ScaleRootUpAndRecalculateScales, + ScaleUpAndRecalculateScales, base::Unretained(this))); break; case 2: @@ -661,21 +664,22 @@ } } - void ScaleRootUp() { + void ScaleUp() { gfx::Transform transform; transform.Scale(2, 2); - layer_tree_host()->root_layer()->SetTransform(transform); + top_layer_->SetTransform(transform); } - void ScaleRootUpAndRecalculateScales() { + void ScaleUpAndRecalculateScales() { gfx::Transform transform; transform.Scale(4, 4); - layer_tree_host()->root_layer()->SetTransform(transform); + top_layer_->SetTransform(transform); layer_tree_host()->SetNeedsRecalculateRasterScales(); } void AfterTest() override {} + scoped_refptr<Layer> top_layer_; scoped_refptr<FakePictureLayer> will_change_layer_; scoped_refptr<FakePictureLayer> normal_layer_; };
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index b29cd8f..bb5c47fa 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc
@@ -1026,23 +1026,9 @@ return; } - // When the page scale layer is also the root layer (this happens in the UI - // compositor), the node should also store the combined scale factor and not - // just the page scale factor. - // TODO(crbug.com/909750): Implement this behavior without PageScaleLayer, - // e.g. when we switch the UI compositor to create property trees. - float device_scale_factor_for_page_scale_layer = 1.f; - gfx::Transform device_transform_for_page_scale_layer; - if (IsRootLayer(PageScaleLayer())) { - DCHECK(!settings().use_layer_lists); - device_transform_for_page_scale_layer = host_impl_->DrawTransform(); - device_scale_factor_for_page_scale_layer = device_scale_factor(); - } - + DCHECK(!IsRootLayer(PageScaleLayer())); draw_property_utils::UpdatePageScaleFactor( - property_trees(), PageScaleTransformNode(), current_page_scale_factor(), - device_scale_factor_for_page_scale_layer, - device_transform_for_page_scale_layer); + property_trees(), PageScaleTransformNode(), current_page_scale_factor()); } void LayerTreeImpl::SetPageScaleOnActiveTree(float active_page_scale) {
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc index 11d6bbc..974cbec6 100644 --- a/cc/trees/layer_tree_impl_unittest.cc +++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -44,33 +44,28 @@ LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); } - int HitTestSimpleTree(int root_id, - int left_child_id, - int right_child_id, - int root_sorting_context, + int HitTestSimpleTree(int top_sorting_context, int left_child_sorting_context, int right_child_sorting_context, - float root_depth, + float top_depth, float left_child_depth, float right_child_depth) { - host_impl().active_tree()->SetRootLayerForTesting(nullptr); - - std::unique_ptr<LayerImpl> root = - LayerImpl::Create(host_impl().active_tree(), root_id); + std::unique_ptr<LayerImpl> top = + LayerImpl::Create(host_impl().active_tree(), kTopId); std::unique_ptr<LayerImpl> left_child = - LayerImpl::Create(host_impl().active_tree(), left_child_id); + LayerImpl::Create(host_impl().active_tree(), kLeftChildId); std::unique_ptr<LayerImpl> right_child = - LayerImpl::Create(host_impl().active_tree(), right_child_id); + LayerImpl::Create(host_impl().active_tree(), kRightChildId); gfx::Size bounds(100, 100); { gfx::Transform translate_z; - translate_z.Translate3d(0, 0, root_depth); - root->test_properties()->transform = translate_z; - root->test_properties()->sorting_context_id = root_sorting_context; - root->SetBounds(bounds); - root->SetDrawsContent(true); - root->SetHitTestable(true); + translate_z.Translate3d(0, 0, top_depth); + top->test_properties()->transform = translate_z; + top->test_properties()->sorting_context_id = top_sorting_context; + top->SetBounds(bounds); + top->SetDrawsContent(true); + top->SetHitTestable(true); } { gfx::Transform translate_z; @@ -94,11 +89,12 @@ right_child->SetHitTestable(true); } - root->test_properties()->AddChild(std::move(left_child)); - root->test_properties()->AddChild(std::move(right_child)); + top->test_properties()->AddChild(std::move(left_child)); + top->test_properties()->AddChild(std::move(right_child)); + root_layer()->SetBounds(top->bounds()); + host_impl().active_tree()->SetDeviceViewportSize(top->bounds()); + root_layer()->test_properties()->AddChild(std::move(top)); - host_impl().active_tree()->SetDeviceViewportSize(root->bounds()); - host_impl().active_tree()->SetRootLayerForTesting(std::move(root)); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); CHECK_EQ(1u, GetRenderSurfaceList().size()); @@ -110,6 +106,10 @@ return result_layer->id(); } + const int kTopId = 2; + const int kLeftChildId = 3; + const int kRightChildId = 4; + private: LayerTestCommon::LayerImplTest impl_test_; RenderSurfaceList render_surface_list_impl_; @@ -236,17 +236,21 @@ ASSERT_FALSE(uninvertible_transform.IsInvertible()); LayerImpl* root = root_layer(); - root->test_properties()->transform = uninvertible_transform; - root->SetBounds(gfx::Size(100, 100)); - root->SetDrawsContent(true); - root->SetHitTestable(true); + std::unique_ptr<LayerImpl> layer = + LayerImpl::Create(host_impl().active_tree(), 2); + LayerImpl* layer_raw = layer.get(); + layer->test_properties()->transform = uninvertible_transform; + layer->SetBounds(gfx::Size(100, 100)); + layer->SetDrawsContent(true); + layer->SetHitTestable(true); + root->SetBounds(layer->bounds()); + root->test_properties()->AddChild(std::move(layer)); host_impl().active_tree()->SetDeviceViewportSize(root->bounds()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); // Sanity check the scenario we just created. ASSERT_EQ(1u, GetRenderSurfaceList().size()); - ASSERT_EQ(1, GetRenderSurface(root_layer())->num_contributors()); - ASSERT_FALSE(root_layer()->ScreenSpaceTransform().IsInvertible()); + ASSERT_FALSE(layer_raw->ScreenSpaceTransform().IsInvertible()); // Hit testing any point should not hit the layer. If the invertible matrix is // accidentally ignored and treated like an identity, then the hit testing @@ -336,16 +340,23 @@ } TEST_F(LayerTreeImplTest, HitTestingForSingleRotatedLayer) { - gfx::Transform rotation45_degrees_about_center; - rotation45_degrees_about_center.Translate(50.0, 50.0); - rotation45_degrees_about_center.RotateAboutZAxis(45.0); - rotation45_degrees_about_center.Translate(-50.0, -50.0); - + const int kLayerId = 2; LayerImpl* root = root_layer(); - root->test_properties()->transform = rotation45_degrees_about_center; - root->SetBounds(gfx::Size(100, 100)); - root->SetDrawsContent(true); - root->SetHitTestable(true); + { + gfx::Transform rotation45_degrees_about_center; + rotation45_degrees_about_center.Translate(50.0, 50.0); + rotation45_degrees_about_center.RotateAboutZAxis(45.0); + rotation45_degrees_about_center.Translate(-50.0, -50.0); + + std::unique_ptr<LayerImpl> layer = + LayerImpl::Create(host_impl().active_tree(), kLayerId); + layer->test_properties()->transform = rotation45_degrees_about_center; + layer->SetBounds(gfx::Size(100, 100)); + layer->SetDrawsContent(true); + layer->SetHitTestable(true); + root->SetBounds(layer->bounds()); + root->test_properties()->AddChild(std::move(layer)); + } host_impl().active_tree()->SetDeviceViewportSize(root->bounds()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -372,7 +383,7 @@ result_layer = host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); ASSERT_TRUE(result_layer); - EXPECT_EQ(root->id(), result_layer->id()); + EXPECT_EQ(kLayerId, result_layer->id()); // Hit testing the corners that would overlap the unclipped layer, but are // outside the clipped region. @@ -472,21 +483,29 @@ } TEST_F(LayerTreeImplTest, HitTestingForSinglePerspectiveLayer) { - // perspective_projection_about_center * translation_by_z is designed so that - // the 100 x 100 layer becomes 50 x 50, and remains centered at (50, 50). - gfx::Transform perspective_projection_about_center; - perspective_projection_about_center.Translate(50.0, 50.0); - perspective_projection_about_center.ApplyPerspectiveDepth(1.0); - perspective_projection_about_center.Translate(-50.0, -50.0); - gfx::Transform translation_by_z; - translation_by_z.Translate3d(0.0, 0.0, -1.0); - + const int kLayerId = 2; LayerImpl* root = root_layer(); - root->test_properties()->transform = - (perspective_projection_about_center * translation_by_z); - root->SetBounds(gfx::Size(100, 100)); - root->SetDrawsContent(true); - root->SetHitTestable(true); + { + // perspective_projection_about_center * translation_by_z is designed so + // that the 100 x 100 layer becomes 50 x 50, and remains centered at (50, + // 50). + gfx::Transform perspective_projection_about_center; + perspective_projection_about_center.Translate(50.0, 50.0); + perspective_projection_about_center.ApplyPerspectiveDepth(1.0); + perspective_projection_about_center.Translate(-50.0, -50.0); + gfx::Transform translation_by_z; + translation_by_z.Translate3d(0.0, 0.0, -1.0); + + std::unique_ptr<LayerImpl> layer = + LayerImpl::Create(host_impl().active_tree(), kLayerId); + layer->test_properties()->transform = + (perspective_projection_about_center * translation_by_z); + layer->SetBounds(gfx::Size(100, 100)); + layer->SetDrawsContent(true); + layer->SetHitTestable(true); + root->SetBounds(layer->bounds()); + root->test_properties()->AddChild(std::move(layer)); + } host_impl().active_tree()->SetDeviceViewportSize(root->bounds()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -513,13 +532,13 @@ result_layer = host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); ASSERT_TRUE(result_layer); - EXPECT_EQ(root->id(), result_layer->id()); + EXPECT_EQ(kLayerId, result_layer->id()); test_point = gfx::PointF(74.f, 74.f); result_layer = host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); ASSERT_TRUE(result_layer); - EXPECT_EQ(root->id(), result_layer->id()); + EXPECT_EQ(kLayerId, result_layer->id()); } TEST_F(LayerTreeImplTest, HitTestingForSimpleClippedLayer) { @@ -873,39 +892,34 @@ } TEST_F(LayerTreeImplTest, HitTestingSameSortingContextTied) { - int hit_layer_id = HitTestSimpleTree(/* ids */ 1, 2, 3, - /* sorting_contexts */ 10, 10, 10, + int hit_layer_id = HitTestSimpleTree(/* sorting_contexts */ 10, 10, 10, /* depths */ 0, 0, 0); // 3 is the last in tree order, and so should be on top. - EXPECT_EQ(3, hit_layer_id); + EXPECT_EQ(kRightChildId, hit_layer_id); } TEST_F(LayerTreeImplTest, HitTestingSameSortingContextChildWins) { - int hit_layer_id = HitTestSimpleTree(/* ids */ 1, 2, 3, - /* sorting_contexts */ 10, 10, 10, + int hit_layer_id = HitTestSimpleTree(/* sorting_contexts */ 10, 10, 10, /* depths */ 0, 1, 0); - EXPECT_EQ(2, hit_layer_id); + EXPECT_EQ(kLeftChildId, hit_layer_id); } TEST_F(LayerTreeImplTest, HitTestingWithoutSortingContext) { - int hit_layer_id = HitTestSimpleTree(/* ids */ 1, 2, 3, - /* sorting_contexts */ 0, 0, 0, + int hit_layer_id = HitTestSimpleTree(/* sorting_contexts */ 0, 0, 0, /* depths */ 0, 1, 0); - EXPECT_EQ(3, hit_layer_id); + EXPECT_EQ(kRightChildId, hit_layer_id); } TEST_F(LayerTreeImplTest, HitTestingDistinctSortingContext) { - int hit_layer_id = HitTestSimpleTree(/* ids */ 1, 2, 3, - /* sorting_contexts */ 10, 11, 12, + int hit_layer_id = HitTestSimpleTree(/* sorting_contexts */ 10, 11, 12, /* depths */ 0, 1, 0); - EXPECT_EQ(3, hit_layer_id); + EXPECT_EQ(kRightChildId, hit_layer_id); } TEST_F(LayerTreeImplTest, HitTestingSameSortingContextParentWins) { - int hit_layer_id = HitTestSimpleTree(/* ids */ 1, 2, 3, - /* sorting_contexts */ 10, 10, 10, + int hit_layer_id = HitTestSimpleTree(/* sorting_contexts */ 10, 10, 10, /* depths */ 0, -1, -1); - EXPECT_EQ(1, hit_layer_id); + EXPECT_EQ(kTopId, hit_layer_id); } TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) { @@ -1311,6 +1325,8 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForUninvertibleTransform) { + const int kLayerId = 2; + LayerImpl* root = root_layer(); gfx::Transform uninvertible_transform; uninvertible_transform.matrix().set(0, 0, 0.0); uninvertible_transform.matrix().set(1, 1, 0.0); @@ -1321,20 +1337,23 @@ TouchActionRegion touch_action_region; touch_action_region.Union(kTouchActionNone, gfx::Rect(10, 10, 50, 50)); - LayerImpl* root = root_layer(); - root->test_properties()->transform = uninvertible_transform; - root->SetBounds(gfx::Size(100, 100)); - root->SetDrawsContent(true); - root->SetHitTestable(true); - root->SetTouchActionRegion(touch_action_region); + std::unique_ptr<LayerImpl> layer = + LayerImpl::Create(host_impl().active_tree(), kLayerId); + LayerImpl* layer_raw = layer.get(); + layer->test_properties()->transform = uninvertible_transform; + layer->SetBounds(gfx::Size(100, 100)); + layer->SetDrawsContent(true); + layer->SetHitTestable(true); + layer->SetTouchActionRegion(touch_action_region); + root->SetBounds(layer->bounds()); + root->test_properties()->AddChild(std::move(layer)); host_impl().active_tree()->SetDeviceViewportSize(root->bounds()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); // Sanity check the scenario we just created. ASSERT_EQ(1u, GetRenderSurfaceList().size()); - ASSERT_EQ(1, GetRenderSurface(root)->num_contributors()); - ASSERT_FALSE(root->ScreenSpaceTransform().IsInvertible()); + ASSERT_FALSE(layer_raw->ScreenSpaceTransform().IsInvertible()); // Hit checking any point should not hit the touch handler region on the // layer. If the invertible matrix is accidentally ignored and treated like an @@ -1458,6 +1477,9 @@ // Set the bounds of the root layer big enough to fit the child when scaled. LayerImpl* root = root_layer(); root->SetBounds(gfx::Size(100, 100)); + std::unique_ptr<LayerImpl> page_scale_layer_ptr = + LayerImpl::Create(host_impl().active_tree(), 2); + LayerImpl* page_scale_layer = page_scale_layer_ptr.get(); { TouchActionRegion touch_action_region; touch_action_region.Union(kTouchActionNone, gfx::Rect(10, 10, 30, 30)); @@ -1468,8 +1490,9 @@ test_layer->SetDrawsContent(true); test_layer->SetHitTestable(true); test_layer->SetTouchActionRegion(touch_action_region); - root->test_properties()->AddChild(std::move(test_layer)); + page_scale_layer->test_properties()->AddChild(std::move(test_layer)); } + root->test_properties()->AddChild(std::move(page_scale_layer_ptr)); float device_scale_factor = 3.f; float page_scale_factor = 5.f; @@ -1480,8 +1503,7 @@ host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); LayerTreeImpl::ViewportLayerIds viewport_ids; - viewport_ids.page_scale = 1; - viewport_ids.inner_viewport_scroll = 1; + viewport_ids.page_scale = 2; host_impl().active_tree()->SetViewportLayersFromIds(viewport_ids); host_impl().active_tree()->BuildLayerListAndPropertyTreesForTesting(); host_impl().active_tree()->PushPageScaleFromMainThread( @@ -1568,7 +1590,7 @@ // is also the root layer. page_scale_factor *= 1.5f; host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); - EXPECT_EQ(root, host_impl().active_tree()->PageScaleLayer()); + EXPECT_EQ(page_scale_layer, host_impl().active_tree()->PageScaleLayer()); test_point = gfx::PointF(35.f, 35.f); test_point = @@ -1712,10 +1734,6 @@ host_impl().active_tree()->SetDeviceViewportSize(scaled_bounds_for_root); host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); - LayerTreeImpl::ViewportLayerIds viewport_ids; - viewport_ids.page_scale = 1; - viewport_ids.inner_viewport_scroll = 1; - host_impl().active_tree()->SetViewportLayersFromIds(viewport_ids); host_impl().active_tree()->BuildLayerListAndPropertyTreesForTesting(); host_impl().active_tree()->PushPageScaleFromMainThread( page_scale_factor, page_scale_factor, max_page_scale_factor); @@ -2044,9 +2062,12 @@ root->SetDrawsContent(true); root->SetBounds(gfx::Size(100, 100)); - int root_layer_id = root->id(); - int sub_layer_id = 2; + int page_scale_layer_id = 2; + int sub_layer_id = 3; + std::unique_ptr<LayerImpl> page_scale_layer = + LayerImpl::Create(host_impl().active_tree(), page_scale_layer_id); + page_scale_layer->SetBounds(gfx::Size(50, 50)); gfx::Vector2dF sub_layer_offset(10, 0); { std::unique_ptr<LayerImpl> sub_layer = @@ -2054,8 +2075,9 @@ sub_layer->test_properties()->position = gfx::PointF() + sub_layer_offset; sub_layer->SetBounds(gfx::Size(50, 50)); sub_layer->SetDrawsContent(true); - root->test_properties()->AddChild(std::move(sub_layer)); + page_scale_layer->test_properties()->AddChild(std::move(sub_layer)); } + root->test_properties()->AddChild(std::move(page_scale_layer)); host_impl().active_tree()->BuildPropertyTreesForTesting(); @@ -2063,11 +2085,11 @@ float page_scale_factor = 5.f; gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( root->bounds(), device_scale_factor * page_scale_factor); - host_impl().active_tree()->SetDeviceViewportSize(scaled_bounds_for_root); LayerTreeImpl::ViewportLayerIds viewport_ids; - viewport_ids.page_scale = root->id(); + viewport_ids.page_scale = page_scale_layer_id; host_impl().active_tree()->SetViewportLayersFromIds(viewport_ids); + host_impl().active_tree()->SetDeviceViewportSize(scaled_bounds_for_root); host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); @@ -2083,7 +2105,7 @@ input.start.type = gfx::SelectionBound::LEFT; input.start.edge_top = gfx::Point(10, 10); input.start.edge_bottom = gfx::Point(10, 30); - input.start.layer_id = root_layer_id; + input.start.layer_id = page_scale_layer_id; input.end.type = gfx::SelectionBound::RIGHT; input.end.edge_top = gfx::Point(0, 0); @@ -2097,11 +2119,11 @@ host_impl().active_tree()->GetViewportSelection(&output); EXPECT_EQ(input.start.type, output.start.type()); auto expected_output_start_top = gfx::PointF(input.start.edge_top); - auto expected_output_edge_bottom = gfx::PointF(input.start.edge_bottom); + auto expected_output_start_bottom = gfx::PointF(input.start.edge_bottom); expected_output_start_top.Scale(page_scale_factor); - expected_output_edge_bottom.Scale(page_scale_factor); + expected_output_start_bottom.Scale(page_scale_factor); EXPECT_EQ(expected_output_start_top, output.start.edge_top()); - EXPECT_EQ(expected_output_edge_bottom, output.start.edge_bottom()); + EXPECT_EQ(expected_output_start_bottom, output.start.edge_bottom()); EXPECT_TRUE(output.start.visible()); EXPECT_EQ(input.end.type, output.end.type()); @@ -2139,10 +2161,6 @@ float device_scale_factor = 3.f; float painted_device_scale_factor = 5.f; - - LayerTreeImpl::ViewportLayerIds viewport_ids; - viewport_ids.page_scale = root->id(); - host_impl().active_tree()->SetViewportLayersFromIds(viewport_ids); host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); host_impl().active_tree()->set_painted_device_scale_factor( painted_device_scale_factor); @@ -2287,18 +2305,20 @@ EventListenerClass::kMouseWheel, EventListenerProperties::kBlocking); LayerImpl* root = root_layer(); + std::unique_ptr<LayerImpl> top = + LayerImpl::Create(host_impl().active_tree(), kTopId); std::unique_ptr<LayerImpl> left_child = - LayerImpl::Create(host_impl().active_tree(), 2); + LayerImpl::Create(host_impl().active_tree(), kLeftChildId); std::unique_ptr<LayerImpl> right_child = - LayerImpl::Create(host_impl().active_tree(), 3); + LayerImpl::Create(host_impl().active_tree(), kRightChildId); { gfx::Transform translate_z; translate_z.Translate3d(0, 0, 10); - root->test_properties()->transform = translate_z; - root->SetBounds(gfx::Size(100, 100)); - root->SetDrawsContent(true); - root->SetHitTestable(true); + top->test_properties()->transform = translate_z; + top->SetBounds(gfx::Size(100, 100)); + top->SetDrawsContent(true); + top->SetHitTestable(true); } { gfx::Transform translate_z; @@ -2315,8 +2335,10 @@ right_child->SetBounds(gfx::Size(100, 100)); } - root->test_properties()->AddChild(std::move(left_child)); - root->test_properties()->AddChild(std::move(right_child)); + top->test_properties()->AddChild(std::move(left_child)); + top->test_properties()->AddChild(std::move(right_child)); + root->SetBounds(top->bounds()); + root->test_properties()->AddChild(std::move(top)); host_impl().active_tree()->SetDeviceViewportSize(root->bounds()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -2327,7 +2349,7 @@ host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); CHECK(result_layer); - EXPECT_EQ(2, result_layer->id()); + EXPECT_EQ(kLeftChildId, result_layer->id()); } // When using layer lists, we may not have layers for the outer viewport. This
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc index f91deac..489debd 100644 --- a/cc/trees/property_tree.cc +++ b/cc/trees/property_tree.cc
@@ -633,9 +633,8 @@ node->has_potential_animation || is_invertible; } -void TransformTree::SetRootTransformsAndScales( +void TransformTree::SetRootScaleAndTransform( float device_scale_factor, - float page_scale_factor_for_root, const gfx::Transform& device_transform) { gfx::Vector2dF device_transform_scale_components = MathUtil::ComputeTransform2dScaleComponents(device_transform, 1.f); @@ -651,11 +650,10 @@ // transform node is set to SSS and the post local transform of the contents // root node is set to SSS^-1*DT*DSF. gfx::Transform transform = device_transform; - transform.Scale(device_scale_factor * page_scale_factor_for_root, - device_scale_factor * page_scale_factor_for_root); - float fallback_value = device_scale_factor * page_scale_factor_for_root; + transform.Scale(device_scale_factor, device_scale_factor); gfx::Vector2dF screen_space_scale = - MathUtil::ComputeTransform2dScaleComponents(transform, fallback_value); + MathUtil::ComputeTransform2dScaleComponents(transform, + device_scale_factor); DCHECK_NE(screen_space_scale.x(), 0.f); DCHECK_NE(screen_space_scale.y(), 0.f); @@ -672,8 +670,8 @@ transform.ConcatTransform(root_from_screen); TransformNode* contents_root_node = Node(kContentsRootNodeId); - if (contents_root_node->post_local != transform) { - contents_root_node->post_local = transform; + if (contents_root_node->local != transform) { + contents_root_node->local = transform; contents_root_node->needs_local_transform_update = true; set_needs_update(true); }
diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h index 75b972d..f550442 100644 --- a/cc/trees/property_tree.h +++ b/cc/trees/property_tree.h
@@ -186,9 +186,8 @@ } float device_scale_factor() const { return device_scale_factor_; } - void SetRootTransformsAndScales(float device_scale_factor, - float page_scale_factor_for_root, - const gfx::Transform& device_transform); + void SetRootScaleAndTransform(float device_scale_factor, + const gfx::Transform& device_transform); float device_transform_scale_factor() const { return device_transform_scale_factor_; }
diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc index 44a2033d..c60bf86e 100644 --- a/cc/trees/property_tree_builder.cc +++ b/cc/trees/property_tree_builder.cc
@@ -574,11 +574,32 @@ node->scrolls = is_scrollable; node->should_be_snapped = is_snapped; node->flattens_inherited_transform = data_for_children->should_flatten; - + node->source_node_id = source_index; node->sorting_context_id = SortingContextId(layer); - if (layer == page_scale_layer_) - data_for_children->in_subtree_of_page_scale_layer = true; + if (is_root || is_page_scale_layer) { + // Root layer and page scale layer should not have transform or offset. + DCHECK(Position(layer).IsOrigin()); + DCHECK(source_offset.IsZero()); + DCHECK(Transform(layer).IsIdentity()); + + if (is_root) { + DCHECK(!is_page_scale_layer); + transform_tree_.SetRootScaleAndTransform( + transform_tree_.device_scale_factor(), device_transform_); + } else { + DCHECK(is_page_scale_layer); + transform_tree_.set_page_scale_factor(page_scale_factor_); + node->local.Scale(page_scale_factor_, page_scale_factor_); + data_for_children->in_subtree_of_page_scale_layer = true; + } + } else { + node->source_offset = source_offset; + node->local = Transform(layer); + node->update_pre_local_transform(TransformOrigin(layer)); + node->update_post_local_transform(Position(layer), TransformOrigin(layer)); + } + node->in_subtree_of_page_scale_layer = data_for_children->in_subtree_of_page_scale_layer; @@ -591,30 +612,6 @@ GetAnimationScales(mutator_host_, layer, &node->maximum_animation_scale, &node->starting_animation_scale); - float post_local_scale_factor = 1.0f; - - if (is_page_scale_layer) { - if (!is_root) - post_local_scale_factor *= page_scale_factor_; - transform_tree_.set_page_scale_factor(page_scale_factor_); - } - - node->source_node_id = source_index; - node->post_local_scale_factor = post_local_scale_factor; - if (is_root) { - float page_scale_factor_for_root = - is_page_scale_layer ? page_scale_factor_ : 1.f; - // SetRootTransformsAndScales will be incorrect if the root layer has - // non-zero position, so ensure it is zero. - DCHECK(Position(layer).IsOrigin()); - transform_tree_.SetRootTransformsAndScales( - transform_tree_.device_scale_factor(), page_scale_factor_for_root, - device_transform_); - } else { - node->source_offset = source_offset; - node->update_post_local_transform(Position(layer), TransformOrigin(layer)); - } - if (is_overscroll_elasticity_layer) { DCHECK(!is_scrollable); node->scroll_offset = gfx::ScrollOffset(elastic_overscroll_); @@ -635,9 +632,6 @@ } } - node->local = Transform(layer); - node->update_pre_local_transform(TransformOrigin(layer)); - if (StickyPositionConstraint(layer).is_sticky) { StickyPositionNodeData* sticky_data = transform_tree_.StickyPositionData(node->id); @@ -1484,38 +1478,24 @@ const gfx::Rect& viewport, SkColor root_background_color) const { if (!property_trees_.needs_rebuild) { - bool page_scale_is_root_layer = page_scale_layer_ == root_layer_; + DCHECK_NE(page_scale_layer_, root_layer_); if (page_scale_layer_) { DCHECK_GE(page_scale_layer_->transform_tree_index(), TransformTree::kRootNodeId); TransformNode* node = property_trees_.transform_tree.Node( page_scale_layer_->transform_tree_index()); - - // When the page scale layer is also the root layer, the node should also - // store the combined scale factor and not just the page scale factor. - float device_scale_factor_for_page_scale_node = 1.f; - gfx::Transform device_transform_for_page_scale_node; - if (page_scale_is_root_layer) { - device_transform_for_page_scale_node = device_transform_; - device_scale_factor_for_page_scale_node = device_scale_factor; - } - - draw_property_utils::UpdatePageScaleFactor( - &property_trees_, node, page_scale_factor_, - device_scale_factor_for_page_scale_node, - device_transform_for_page_scale_node); + draw_property_utils::UpdatePageScaleFactor(&property_trees_, node, + page_scale_factor_); } draw_property_utils::UpdateElasticOverscroll( &property_trees_, overscroll_elasticity_element_id_, elastic_overscroll_); clip_tree_.SetViewportClip(gfx::RectF(viewport)); - float page_scale_factor_for_root = - page_scale_is_root_layer ? page_scale_factor_ : 1.f; - // SetRootTransformsAndScales will be incorrect if the root layer has + // SetRootScaleAndTransform will be incorrect if the root layer has // non-zero position, so ensure it is zero. DCHECK(Position(root_layer_).IsOrigin()); - transform_tree_.SetRootTransformsAndScales( - device_scale_factor, page_scale_factor_for_root, device_transform_); + transform_tree_.SetRootScaleAndTransform(device_scale_factor, + device_transform_); return; }
diff --git a/cc/trees/property_tree_unittest.cc b/cc/trees/property_tree_unittest.cc index 848d6e0..bd36d6b 100644 --- a/cc/trees/property_tree_unittest.cc +++ b/cc/trees/property_tree_unittest.cc
@@ -48,10 +48,10 @@ contents_root.id = tree.Insert(contents_root, 0); EXPECT_FALSE(tree.needs_update()); - tree.SetRootTransformsAndScales(0.6f, 1.f, gfx::Transform()); + tree.SetRootScaleAndTransform(0.6f, gfx::Transform()); EXPECT_TRUE(tree.needs_update()); tree.set_needs_update(false); - tree.SetRootTransformsAndScales(0.6f, 1.f, gfx::Transform()); + tree.SetRootScaleAndTransform(0.6f, gfx::Transform()); EXPECT_FALSE(tree.needs_update()); }
diff --git a/cc/trees/transform_node.cc b/cc/trees/transform_node.cc index d91bf1d6..6b4bdf2 100644 --- a/cc/trees/transform_node.cc +++ b/cc/trees/transform_node.cc
@@ -34,7 +34,6 @@ moved_by_outer_viewport_bounds_delta_y(false), in_subtree_of_page_scale_layer(false), transform_changed(false), - post_local_scale_factor(1.0f), maximum_animation_scale(kNotScaled), starting_animation_scale(kNotScaled) {} @@ -69,7 +68,6 @@ in_subtree_of_page_scale_layer == other.in_subtree_of_page_scale_layer && transform_changed == other.transform_changed && - post_local_scale_factor == other.post_local_scale_factor && scroll_offset == other.scroll_offset && snap_amount == other.snap_amount && source_offset == other.source_offset && @@ -89,7 +87,6 @@ const gfx::PointF& position, const gfx::Point3F& transform_origin) { post_local.MakeIdentity(); - post_local.Scale(post_local_scale_factor, post_local_scale_factor); post_local.Translate3d( position.x() + source_offset.x() + transform_origin.x(), position.y() + source_offset.y() + transform_origin.y(),
diff --git a/cc/trees/transform_node.h b/cc/trees/transform_node.h index 4f123a6..3b6cf17 100644 --- a/cc/trees/transform_node.h +++ b/cc/trees/transform_node.h
@@ -125,9 +125,6 @@ bool transform_changed : 1; // TODO(vollick): will be moved when accelerated effects are implemented. - float post_local_scale_factor; - - // TODO(vollick): will be moved when accelerated effects are implemented. gfx::ScrollOffset scroll_offset; // This value stores the snapped amount whenever we snap. If the snap is due
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index 9f012aa..40b569c 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -1173,13 +1173,8 @@ ":chrome_jni_registration($default_toolchain)", ] - # Include appropriate factories for native feature modules if necessary. if (enable_vr) { - if (use_native_modules && modularize_vr_native) { - deps += [ "//chrome/browser/android/vr:ui_module_factory" ] - } else { - deps += [ "//chrome/browser/android/vr:ui_module_dummy_factory" ] - } + deps += [ "//chrome/browser/android/vr:module_factory" ] } allow_partitions = true @@ -1441,13 +1436,8 @@ "//components/crash/android:crashpad_main", ] - # Include appropriate factories for native feature modules if necessary. if (enable_vr) { - if (use_native_modules && modularize_vr_native) { - deps += [ "//chrome/browser/android/vr:ui_module_factory" ] - } else { - deps += [ "//chrome/browser/android/vr:ui_module_dummy_factory" ] - } + deps += [ "//chrome/browser/android/vr:module_factory" ] } is_monochrome = true @@ -2419,7 +2409,6 @@ "java/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskScheduler.java", "java/src/org/chromium/chrome/browser/background_sync/BackgroundSyncPwaDetector.java", "java/src/org/chromium/chrome/browser/background_sync/PeriodicBackgroundSyncChromeWakeUpTask.java", - "java/src/org/chromium/chrome/browser/background_task_scheduler/ChromeBackgroundTaskFactory.java", "java/src/org/chromium/chrome/browser/banners/AppBannerManager.java", "java/src/org/chromium/chrome/browser/banners/AppBannerUiDelegateAndroid.java", "java/src/org/chromium/chrome/browser/bookmarks/BookmarkBridge.java",
diff --git a/chrome/android/OWNERS b/chrome/android/OWNERS index 1df4384..cbe82a2 100644 --- a/chrome/android/OWNERS +++ b/chrome/android/OWNERS
@@ -12,6 +12,9 @@ per-file chrome_java_sources.gni=* per-file chrome_test_java_sources.gni=* per-file chrome_junit_test_java_sources.gni=* + +per-file BUILD.gn=estevenson@chromium.org +per-file BUILD.gn=tiborg@chromium.org # For VR Javatest changes per-file BUILD.gn=bsheedy@chromium.org
diff --git a/chrome/android/features/autofill_assistant/BUILD.gn b/chrome/android/features/autofill_assistant/BUILD.gn index cb32eb8..652e4d05 100644 --- a/chrome/android/features/autofill_assistant/BUILD.gn +++ b/chrome/android/features/autofill_assistant/BUILD.gn
@@ -30,7 +30,6 @@ deps = [ ":java_resources", "//base:base_java", - "//base:jni_java", "//chrome/android:chrome_java", "//chrome/android:chrome_public_java", "//chrome/android/public/profiles:java", @@ -131,7 +130,6 @@ "java/src/org/chromium/chrome/browser/autofill_assistant/payment/AssistantVerticalExpander.java", "java/src/org/chromium/chrome/browser/autofill_assistant/payment/AssistantVerticalExpanderAccordion.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") { @@ -173,11 +171,9 @@ deps = [ ":java", ":test_support_jni_headers", - "//base:jni_java", "//components/autofill_assistant/browser:proto_java", "//third_party/android_deps:com_google_protobuf_protobuf_lite_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } android_library("test_java") {
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantClient.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantClient.java index 08f8be67..7e631ac75 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantClient.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantClient.java
@@ -14,7 +14,6 @@ import org.chromium.base.ContextUtils; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; import org.chromium.components.signin.AccountManagerFacade; import org.chromium.components.signin.OAuth2TokenService; import org.chromium.content_public.browser.WebContents; @@ -69,7 +68,7 @@ /** Returns the client for the given web contents, creating it if necessary. */ public static AutofillAssistantClient fromWebContents(WebContents webContents) { - return AutofillAssistantClientJni.get().fromWebContents(webContents); + return nativeFromWebContents(webContents); } private AutofillAssistantClient(long nativeClientAndroid) { @@ -106,8 +105,7 @@ checkNativeClientIsAliveOrThrow(); chooseAccountAsyncIfNecessary(parameters.get(PARAMETER_USER_EMAIL), intentExtras); - return AutofillAssistantClientJni.get().start(mNativeClientAndroid, - AutofillAssistantClient.this, initialUrl, experimentIds, + return nativeStart(mNativeClientAndroid, initialUrl, experimentIds, parameters.keySet().toArray(new String[parameters.size()]), parameters.values().toArray(new String[parameters.size()]), onboardingCoordinator, AutofillAssistantServiceInjector.getServiceToInject()); @@ -119,8 +117,7 @@ public void destroyUi() { if (mNativeClientAndroid == 0) return; - AutofillAssistantClientJni.get().destroyUI( - mNativeClientAndroid, AutofillAssistantClient.this); + nativeDestroyUI(mNativeClientAndroid); } /** @@ -133,8 +130,7 @@ public void transferUiTo(WebContents otherWebContents) { if (mNativeClientAndroid == 0) return; - AutofillAssistantClientJni.get().transferUITo( - mNativeClientAndroid, AutofillAssistantClient.this, otherWebContents); + nativeTransferUITo(mNativeClientAndroid, otherWebContents); } /** Lists available direct actions. */ @@ -149,8 +145,7 @@ // The native side calls sendDirectActionList() on the callback once the controller has // results. - AutofillAssistantClientJni.get().listDirectActions(mNativeClientAndroid, - AutofillAssistantClient.this, experimentIds, + nativeListDirectActions(mNativeClientAndroid, experimentIds, arguments.keySet().toArray(new String[arguments.size()]), arguments.values().toArray(new String[arguments.size()]), callback); } @@ -173,8 +168,7 @@ // Note that only listDirectActions can start AA, so only it needs // chooseAccountAsyncIfNecessary. - return AutofillAssistantClientJni.get().performDirectAction(mNativeClientAndroid, - AutofillAssistantClient.this, actionId, experimentIds, + return nativePerformDirectAction(mNativeClientAndroid, actionId, experimentIds, arguments.keySet().toArray(new String[arguments.size()]), arguments.values().toArray(new String[arguments.size()]), onboardingCoordinator); } @@ -196,9 +190,8 @@ onAccountChosen(accounts.get(0)); return; } - Account signedIn = findAccountByName(accounts, - AutofillAssistantClientJni.get().getPrimaryAccountName( - mNativeClientAndroid, AutofillAssistantClient.this)); + Account signedIn = + findAccountByName(accounts, nativeGetPrimaryAccountName(mNativeClientAndroid)); if (signedIn != null) { // TODO(crbug.com/806868): Compare against account name from extras and complain if // they don't match. @@ -260,9 +253,7 @@ return; } if (mAccount == null) { - if (mNativeClientAndroid != 0) - AutofillAssistantClientJni.get().onAccessToken( - mNativeClientAndroid, AutofillAssistantClient.this, true, ""); + if (mNativeClientAndroid != 0) nativeOnAccessToken(mNativeClientAndroid, true, ""); return; } @@ -271,16 +262,14 @@ @Override public void onGetTokenSuccess(String token) { if (mNativeClientAndroid != 0) { - AutofillAssistantClientJni.get().onAccessToken(mNativeClientAndroid, - AutofillAssistantClient.this, true, token); + nativeOnAccessToken(mNativeClientAndroid, true, token); } } @Override public void onGetTokenFailure(boolean isTransientError) { if (!isTransientError && mNativeClientAndroid != 0) { - AutofillAssistantClientJni.get().onAccessToken( - mNativeClientAndroid, AutofillAssistantClient.this, false, ""); + nativeOnAccessToken(mNativeClientAndroid, false, ""); } } }); @@ -335,24 +324,18 @@ mNativeClientAndroid = 0; } - @NativeMethods - interface Natives { - AutofillAssistantClient fromWebContents(WebContents webContents); - boolean start(long nativeClientAndroid, AutofillAssistantClient caller, String initialUrl, - String experimentIds, String[] parameterNames, String[] parameterValues, - @Nullable AssistantOnboardingCoordinator onboardingCoordinator, long nativeService); - void onAccessToken(long nativeClientAndroid, AutofillAssistantClient caller, - boolean success, String accessToken); - String getPrimaryAccountName(long nativeClientAndroid, AutofillAssistantClient caller); - void destroyUI(long nativeClientAndroid, AutofillAssistantClient caller); - void transferUITo( - long nativeClientAndroid, AutofillAssistantClient caller, Object otherWebContents); - void listDirectActions(long nativeClientAndroid, AutofillAssistantClient caller, - String experimentIds, String[] argumentNames, String[] argumentValues, - Object callback); - boolean performDirectAction(long nativeClientAndroid, AutofillAssistantClient caller, - String actionId, String experimentId, String[] argumentNames, - String[] argumentValues, - @Nullable AssistantOnboardingCoordinator onboardingCoordinator); - } + private static native AutofillAssistantClient nativeFromWebContents(WebContents webContents); + private native boolean nativeStart(long nativeClientAndroid, String initialUrl, + String experimentIds, String[] parameterNames, String[] parameterValues, + @Nullable AssistantOnboardingCoordinator onboardingCoordinator, long nativeService); + private native void nativeOnAccessToken( + long nativeClientAndroid, boolean success, String accessToken); + private native String nativeGetPrimaryAccountName(long nativeClientAndroid); + private native void nativeDestroyUI(long nativeClientAndroid); + private native void nativeTransferUITo(long nativeClientAndroid, Object otherWebContents); + private native void nativeListDirectActions(long nativeClientAndroid, String experimentIds, + String[] argumentNames, String[] argumentValues, Object callback); + private native boolean nativePerformDirectAction(long nativeClientAndroid, String actionId, + String experimentId, String[] argumentNames, String[] argumentValues, + @Nullable AssistantOnboardingCoordinator onboardingCoordinator); }
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java index 8b837be4..79012311 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java
@@ -8,7 +8,6 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; import org.chromium.base.task.PostTask; import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.browser.ActivityTabProvider; @@ -315,62 +314,38 @@ // Native methods. private void safeSnackbarResult(boolean undo) { - if (mNativeUiController != 0) - AutofillAssistantUiControllerJni.get().snackbarResult( - mNativeUiController, AutofillAssistantUiController.this, undo); + if (mNativeUiController != 0) nativeSnackbarResult(mNativeUiController, undo); } + private native void nativeSnackbarResult(long nativeUiControllerAndroid, boolean undo); private void safeNativeStop(@DropOutReason int reason) { - if (mNativeUiController != 0) - AutofillAssistantUiControllerJni.get().stop( - mNativeUiController, AutofillAssistantUiController.this, reason); + if (mNativeUiController != 0) nativeStop(mNativeUiController, reason); } + private native void nativeStop(long nativeUiControllerAndroid, @DropOutReason int reason); private void safeNativeOnFatalError(String message, @DropOutReason int reason) { - if (mNativeUiController != 0) - AutofillAssistantUiControllerJni.get().onFatalError( - mNativeUiController, AutofillAssistantUiController.this, message, reason); + if (mNativeUiController != 0) nativeOnFatalError(mNativeUiController, message, reason); } + private native void nativeOnFatalError( + long nativeUiControllerAndroid, String message, @DropOutReason int reason); private void safeNativeOnUserActionSelected(int index) { - if (mNativeUiController != 0) - AutofillAssistantUiControllerJni.get().onUserActionSelected( - mNativeUiController, AutofillAssistantUiController.this, index); + if (mNativeUiController != 0) nativeOnUserActionSelected(mNativeUiController, index); } + private native void nativeOnUserActionSelected(long nativeUiControllerAndroid, int index); private void safeNativeOnCancelButtonClicked(int index) { - if (mNativeUiController != 0) - AutofillAssistantUiControllerJni.get().onCancelButtonClicked( - mNativeUiController, AutofillAssistantUiController.this, index); + if (mNativeUiController != 0) nativeOnCancelButtonClicked(mNativeUiController, index); } + private native void nativeOnCancelButtonClicked(long nativeUiControllerAndroid, int index); private void safeNativeOnCloseButtonClicked() { - if (mNativeUiController != 0) - AutofillAssistantUiControllerJni.get().onCloseButtonClicked( - mNativeUiController, AutofillAssistantUiController.this); + if (mNativeUiController != 0) nativeOnCloseButtonClicked(mNativeUiController); } + private native void nativeOnCloseButtonClicked(long nativeUiControllerAndroid); private void safeNativeSetVisible(boolean visible) { - if (mNativeUiController != 0) - AutofillAssistantUiControllerJni.get().setVisible( - mNativeUiController, AutofillAssistantUiController.this, visible); + if (mNativeUiController != 0) nativeSetVisible(mNativeUiController, visible); } - - @NativeMethods - interface Natives { - void snackbarResult( - long nativeUiControllerAndroid, AutofillAssistantUiController caller, boolean undo); - void stop(long nativeUiControllerAndroid, AutofillAssistantUiController caller, - @DropOutReason int reason); - void onFatalError(long nativeUiControllerAndroid, AutofillAssistantUiController caller, - String message, @DropOutReason int reason); - void onUserActionSelected( - long nativeUiControllerAndroid, AutofillAssistantUiController caller, int index); - void onCancelButtonClicked( - long nativeUiControllerAndroid, AutofillAssistantUiController caller, int index); - void onCloseButtonClicked( - long nativeUiControllerAndroid, AutofillAssistantUiController caller); - void setVisible(long nativeUiControllerAndroid, AutofillAssistantUiController caller, - boolean visible); - } + private native void nativeSetVisible(long nativeUiControllerAndroid, boolean visible); }
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormDelegate.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormDelegate.java index 798325d1..3f77fbe 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormDelegate.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormDelegate.java
@@ -6,7 +6,6 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; /** Delegate for the form UI. */ @JNINamespace("autofill_assistant") @@ -24,14 +23,13 @@ void onCounterChanged(int inputIndex, int counterIndex, int value) { if (mNativeAssistantFormDelegate != 0) { - AssistantFormDelegateJni.get().onCounterChanged(mNativeAssistantFormDelegate, - AssistantFormDelegate.this, inputIndex, counterIndex, value); + nativeOnCounterChanged(mNativeAssistantFormDelegate, inputIndex, counterIndex, value); } } void onChoiceSelectionChanged(int inputIndex, int choiceIndex, boolean selected) { if (mNativeAssistantFormDelegate != 0) { - AssistantFormDelegateJni.get().onChoiceSelectionChanged(mNativeAssistantFormDelegate, - AssistantFormDelegate.this, inputIndex, choiceIndex, selected); + nativeOnChoiceSelectionChanged( + mNativeAssistantFormDelegate, inputIndex, choiceIndex, selected); } } @@ -40,11 +38,8 @@ mNativeAssistantFormDelegate = 0; } - @NativeMethods - interface Natives { - void onCounterChanged(long nativeAssistantFormDelegate, AssistantFormDelegate caller, - int inputIndex, int counterIndex, long nativeAssistantOverlayDelegate); - void onChoiceSelectionChanged(long nativeAssistantFormDelegate, - AssistantFormDelegate caller, int inputIndex, int choiceIndex, boolean selected); - } + private native void nativeOnCounterChanged(long nativeAssistantFormDelegate, int inputIndex, + int counterIndex, long nativeAssistantOverlayDelegate); + private native void nativeOnChoiceSelectionChanged( + long nativeAssistantFormDelegate, int inputIndex, int choiceIndex, boolean selected); }
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/header/AssistantHeaderDelegate.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/header/AssistantHeaderDelegate.java index 70bede5..2a51ac4b 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/header/AssistantHeaderDelegate.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/header/AssistantHeaderDelegate.java
@@ -6,7 +6,6 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; @JNINamespace("autofill_assistant") class AssistantHeaderDelegate { @@ -23,8 +22,7 @@ void onFeedbackButtonClicked() { if (mNativeAssistantHeaderDelegate != 0) { - AssistantHeaderDelegateJni.get().onFeedbackButtonClicked( - mNativeAssistantHeaderDelegate, AssistantHeaderDelegate.this); + nativeOnFeedbackButtonClicked(mNativeAssistantHeaderDelegate); } } @@ -33,9 +31,5 @@ mNativeAssistantHeaderDelegate = 0; } - @NativeMethods - interface Natives { - void onFeedbackButtonClicked( - long nativeAssistantHeaderDelegate, AssistantHeaderDelegate caller); - } + private native void nativeOnFeedbackButtonClicked(long nativeAssistantHeaderDelegate); }
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayDelegate.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayDelegate.java index b2d1808..24f613f 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayDelegate.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/overlay/AssistantOverlayDelegate.java
@@ -6,7 +6,6 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; /** Delegate for the overlay. */ @JNINamespace("autofill_assistant") @@ -25,16 +24,14 @@ /** Called after a certain number of unexpected taps. */ void onUnexpectedTaps() { if (mNativeAssistantOverlayDelegate != 0) { - AssistantOverlayDelegateJni.get().onUnexpectedTaps( - mNativeAssistantOverlayDelegate, AssistantOverlayDelegate.this); + nativeOnUnexpectedTaps(mNativeAssistantOverlayDelegate); } } /** Asks for an update of the touchable area. */ void updateTouchableArea() { if (mNativeAssistantOverlayDelegate != 0) { - AssistantOverlayDelegateJni.get().updateTouchableArea( - mNativeAssistantOverlayDelegate, AssistantOverlayDelegate.this); + nativeUpdateTouchableArea(mNativeAssistantOverlayDelegate); } } @@ -44,8 +41,7 @@ */ void onUserInteractionInsideTouchableArea() { if (mNativeAssistantOverlayDelegate != 0) { - AssistantOverlayDelegateJni.get().onUserInteractionInsideTouchableArea( - mNativeAssistantOverlayDelegate, AssistantOverlayDelegate.this); + nativeOnUserInteractionInsideTouchableArea(mNativeAssistantOverlayDelegate); } } @@ -54,12 +50,8 @@ mNativeAssistantOverlayDelegate = 0; } - @NativeMethods - interface Natives { - void onUnexpectedTaps(long nativeAssistantOverlayDelegate, AssistantOverlayDelegate caller); - void updateTouchableArea( - long nativeAssistantOverlayDelegate, AssistantOverlayDelegate caller); - void onUserInteractionInsideTouchableArea( - long nativeAssistantOverlayDelegate, AssistantOverlayDelegate caller); - } + private native void nativeOnUnexpectedTaps(long nativeAssistantOverlayDelegate); + private native void nativeUpdateTouchableArea(long nativeAssistantOverlayDelegate); + private native void nativeOnUserInteractionInsideTouchableArea( + long nativeAssistantOverlayDelegate); }
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/payment/AssistantPaymentRequestNativeDelegate.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/payment/AssistantPaymentRequestNativeDelegate.java index 4b63c34..a583578 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/payment/AssistantPaymentRequestNativeDelegate.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/payment/AssistantPaymentRequestNativeDelegate.java
@@ -8,7 +8,6 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; import org.chromium.chrome.browser.autofill.PersonalDataManager; import org.chromium.chrome.browser.payments.AutofillAddress; import org.chromium.chrome.browser.payments.AutofillContact; @@ -42,18 +41,14 @@ email = contact.getPayerEmail(); } - AssistantPaymentRequestNativeDelegateJni.get().onContactInfoChanged( - mNativeAssistantPaymentRequestDelegate, - AssistantPaymentRequestNativeDelegate.this, name, phone, email); + nativeOnContactInfoChanged(mNativeAssistantPaymentRequestDelegate, name, phone, email); } } @Override public void onShippingAddressChanged(@Nullable AutofillAddress address) { if (mNativeAssistantPaymentRequestDelegate != 0) { - AssistantPaymentRequestNativeDelegateJni.get().onShippingAddressChanged( - mNativeAssistantPaymentRequestDelegate, - AssistantPaymentRequestNativeDelegate.this, + nativeOnShippingAddressChanged(mNativeAssistantPaymentRequestDelegate, address != null ? address.getProfile() : null); } } @@ -61,9 +56,7 @@ @Override public void onPaymentMethodChanged(@Nullable AutofillPaymentInstrument paymentInstrument) { if (mNativeAssistantPaymentRequestDelegate != 0) { - AssistantPaymentRequestNativeDelegateJni.get().onCreditCardChanged( - mNativeAssistantPaymentRequestDelegate, - AssistantPaymentRequestNativeDelegate.this, + nativeOnCreditCardChanged(mNativeAssistantPaymentRequestDelegate, paymentInstrument != null ? paymentInstrument.getCard() : null); } } @@ -71,18 +64,14 @@ @Override public void onTermsAndConditionsChanged(@AssistantTermsAndConditionsState int state) { if (mNativeAssistantPaymentRequestDelegate != 0) { - AssistantPaymentRequestNativeDelegateJni.get().onTermsAndConditionsChanged( - mNativeAssistantPaymentRequestDelegate, - AssistantPaymentRequestNativeDelegate.this, state); + nativeOnTermsAndConditionsChanged(mNativeAssistantPaymentRequestDelegate, state); } } @Override public void onTermsAndConditionsLinkClicked(int link) { if (mNativeAssistantPaymentRequestDelegate != 0) { - AssistantPaymentRequestNativeDelegateJni.get().onTermsAndConditionsLinkClicked( - mNativeAssistantPaymentRequestDelegate, - AssistantPaymentRequestNativeDelegate.this, link); + nativeOnTermsAndConditionsLinkClicked(mNativeAssistantPaymentRequestDelegate, link); } } @@ -91,20 +80,14 @@ mNativeAssistantPaymentRequestDelegate = 0; } - @NativeMethods - interface Natives { - void onContactInfoChanged(long nativeAssistantPaymentRequestDelegate, - AssistantPaymentRequestNativeDelegate caller, @Nullable String payerName, - @Nullable String payerPhone, @Nullable String payerEmail); - void onShippingAddressChanged(long nativeAssistantPaymentRequestDelegate, - AssistantPaymentRequestNativeDelegate caller, - @Nullable PersonalDataManager.AutofillProfile address); - void onCreditCardChanged(long nativeAssistantPaymentRequestDelegate, - AssistantPaymentRequestNativeDelegate caller, - @Nullable PersonalDataManager.CreditCard card); - void onTermsAndConditionsChanged(long nativeAssistantPaymentRequestDelegate, - AssistantPaymentRequestNativeDelegate caller, int state); - void onTermsAndConditionsLinkClicked(long nativeAssistantPaymentRequestDelegate, - AssistantPaymentRequestNativeDelegate caller, int link); - } + private native void nativeOnContactInfoChanged(long nativeAssistantPaymentRequestDelegate, + @Nullable String payerName, @Nullable String payerPhone, @Nullable String payerEmail); + private native void nativeOnShippingAddressChanged(long nativeAssistantPaymentRequestDelegate, + @Nullable PersonalDataManager.AutofillProfile address); + private native void nativeOnCreditCardChanged(long nativeAssistantPaymentRequestDelegate, + @Nullable PersonalDataManager.CreditCard card); + private native void nativeOnTermsAndConditionsChanged( + long nativeAssistantPaymentRequestDelegate, int state); + private native void nativeOnTermsAndConditionsLinkClicked( + long nativeAssistantPaymentRequestDelegate, int link); }
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTestService.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTestService.java index 95a382cc..46ff6b9 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTestService.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTestService.java
@@ -8,7 +8,6 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; import org.chromium.chrome.browser.autofill_assistant.proto.ActionsResponseProto; import org.chromium.chrome.browser.autofill_assistant.proto.SupportsScriptResponseProto; @@ -39,7 +38,7 @@ public long createNativeService() { // Ask native to create and return a wrapper around |this|. The wrapper will be injected // upon startup, at which point the native controller will take ownership of the wrapper. - return AutofillAssistantTestServiceJni.get().javaServiceCreate(this); + return nativeJavaServiceCreate(this); } /** @see AutofillAssistantService#getScriptsForUrl(String) */ @@ -94,8 +93,5 @@ return getNextActions(globalPayload, scriptPayload).toByteArray(); } - @NativeMethods - interface Natives { - long javaServiceCreate(AutofillAssistantTestService service); - } + private static native long nativeJavaServiceCreate(AutofillAssistantTestService service); }
diff --git a/chrome/android/features/keyboard_accessory/internal/BUILD.gn b/chrome/android/features/keyboard_accessory/internal/BUILD.gn index ed912a9..ee860f2a 100644 --- a/chrome/android/features/keyboard_accessory/internal/BUILD.gn +++ b/chrome/android/features/keyboard_accessory/internal/BUILD.gn
@@ -9,7 +9,6 @@ deps = [ ":java_resources", "//base:base_java", - "//base:jni_java", # TODO(crbug/951695): Cyclic dependency. Depend on public only when ready. "//chrome/android:chrome_java", @@ -77,7 +76,6 @@ "java/src/org/chromium/chrome/browser/keyboard_accessory/tab_layout_component/KeyboardAccessoryTabLayoutView.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/tab_layout_component/KeyboardAccessoryTabLayoutViewBinder.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } android_resources("java_resources") {
diff --git a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/AutofillKeyboardAccessoryViewBridge.java b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/AutofillKeyboardAccessoryViewBridge.java index 8fe1052a..7fe8ae59 100644 --- a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/AutofillKeyboardAccessoryViewBridge.java +++ b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/AutofillKeyboardAccessoryViewBridge.java
@@ -9,7 +9,6 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ResourceId; import org.chromium.chrome.browser.keyboard_accessory.data.PropertyProvider; @@ -42,25 +41,20 @@ @Override public void dismissed() { if (mNativeAutofillKeyboardAccessory == 0) return; - AutofillKeyboardAccessoryViewBridgeJni.get().viewDismissed( - mNativeAutofillKeyboardAccessory, AutofillKeyboardAccessoryViewBridge.this); + nativeViewDismissed(mNativeAutofillKeyboardAccessory); } @Override public void suggestionSelected(int listIndex) { mManualFillingComponent.dismiss(); if (mNativeAutofillKeyboardAccessory == 0) return; - AutofillKeyboardAccessoryViewBridgeJni.get().suggestionSelected( - mNativeAutofillKeyboardAccessory, AutofillKeyboardAccessoryViewBridge.this, - listIndex); + nativeSuggestionSelected(mNativeAutofillKeyboardAccessory, listIndex); } @Override public void deleteSuggestion(int listIndex) { if (mNativeAutofillKeyboardAccessory == 0) return; - AutofillKeyboardAccessoryViewBridgeJni.get().deletionRequested( - mNativeAutofillKeyboardAccessory, AutofillKeyboardAccessoryViewBridge.this, - listIndex); + nativeDeletionRequested(mNativeAutofillKeyboardAccessory, listIndex); } @Override @@ -70,8 +64,7 @@ public void onClick(DialogInterface dialog, int which) { assert which == DialogInterface.BUTTON_POSITIVE; if (mNativeAutofillKeyboardAccessory == 0) return; - AutofillKeyboardAccessoryViewBridgeJni.get().deletionConfirmed( - mNativeAutofillKeyboardAccessory, AutofillKeyboardAccessoryViewBridge.this); + nativeDeletionConfirmed(mNativeAutofillKeyboardAccessory); } /** @@ -166,15 +159,10 @@ false /* isBoldLabel */); } - @NativeMethods - interface Natives { - void viewDismissed(long nativeAutofillKeyboardAccessoryView, - AutofillKeyboardAccessoryViewBridge caller); - void suggestionSelected(long nativeAutofillKeyboardAccessoryView, - AutofillKeyboardAccessoryViewBridge caller, int listIndex); - void deletionRequested(long nativeAutofillKeyboardAccessoryView, - AutofillKeyboardAccessoryViewBridge caller, int listIndex); - void deletionConfirmed(long nativeAutofillKeyboardAccessoryView, - AutofillKeyboardAccessoryViewBridge caller); - } + private native void nativeViewDismissed(long nativeAutofillKeyboardAccessoryView); + private native void nativeSuggestionSelected( + long nativeAutofillKeyboardAccessoryView, int listIndex); + private native void nativeDeletionRequested( + long nativeAutofillKeyboardAccessoryView, int listIndex); + private native void nativeDeletionConfirmed(long nativeAutofillKeyboardAccessoryView); }
diff --git a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingComponentBridge.java b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingComponentBridge.java index 56766597..dd595a6 100644 --- a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingComponentBridge.java +++ b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingComponentBridge.java
@@ -11,7 +11,6 @@ import org.chromium.base.Callback; import org.chromium.base.VisibleForTesting; import org.chromium.base.annotations.CalledByNative; -import org.chromium.base.annotations.NativeMethods; import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.keyboard_accessory.data.KeyboardAccessoryData.AccessorySheetData; import org.chromium.chrome.browser.keyboard_accessory.data.KeyboardAccessoryData.Action; @@ -77,9 +76,8 @@ : "Controller has been destroyed but the bridge wasn't cleaned up!"; ManualFillingMetricsRecorder.recordActionSelected( AccessoryAction.GENERATE_PASSWORD_AUTOMATIC); - ManualFillingComponentBridgeJni.get().onOptionSelected(mNativeView, - ManualFillingComponentBridge.this, - AccessoryAction.GENERATE_PASSWORD_AUTOMATIC); + nativeOnOptionSelected( + mNativeView, AccessoryAction.GENERATE_PASSWORD_AUTOMATIC); })}; } else { generationAction = new Action[0]; @@ -143,8 +141,7 @@ assert mNativeView != 0 : "Controller was destroyed but the bridge wasn't!"; ManualFillingMetricsRecorder.recordSuggestionSelected( sheetType, field.isObfuscated()); - ManualFillingComponentBridgeJni.get().onFillingTriggered( - mNativeView, ManualFillingComponentBridge.this, sheetType, field); + nativeOnFillingTriggered(mNativeView, sheetType, field); }; } ((UserInfo) objUserInfo) @@ -159,48 +156,42 @@ .getFooterCommands() .add(new FooterCommand(displayText, (footerCommand) -> { assert mNativeView != 0 : "Controller was destroyed but the bridge wasn't!"; - ManualFillingComponentBridgeJni.get().onOptionSelected( - mNativeView, ManualFillingComponentBridge.this, accessoryAction); + nativeOnOptionSelected(mNativeView, accessoryAction); })); } public void fetchFavicon(@Px int desiredSize, Callback<Bitmap> faviconCallback) { assert mNativeView != 0 : "Favicon was requested after the bridge was destroyed!"; - ManualFillingComponentBridgeJni.get().onFaviconRequested( - mNativeView, ManualFillingComponentBridge.this, desiredSize, faviconCallback); + nativeOnFaviconRequested(mNativeView, desiredSize, faviconCallback); } @VisibleForTesting public static void cachePasswordSheetData( WebContents webContents, String[] userNames, String[] passwords) { - ManualFillingComponentBridgeJni.get().cachePasswordSheetDataForTesting( - webContents, userNames, passwords); + nativeCachePasswordSheetDataForTesting(webContents, userNames, passwords); } @VisibleForTesting public static void notifyFocusedFieldType(WebContents webContents, int focusedFieldType) { - ManualFillingComponentBridgeJni.get().notifyFocusedFieldTypeForTesting( - webContents, focusedFieldType); + nativeNotifyFocusedFieldTypeForTesting(webContents, focusedFieldType); } @VisibleForTesting public static void signalAutoGenerationStatus(WebContents webContents, boolean available) { - ManualFillingComponentBridgeJni.get().signalAutoGenerationStatusForTesting( - webContents, available); + nativeSignalAutoGenerationStatusForTesting(webContents, available); } - @NativeMethods - interface Natives { - void onFaviconRequested(long nativeManualFillingViewAndroid, - ManualFillingComponentBridge caller, int desiredSizeInPx, - Callback<Bitmap> faviconCallback); - void onFillingTriggered(long nativeManualFillingViewAndroid, - ManualFillingComponentBridge caller, int tabType, UserInfoField userInfoField); - void onOptionSelected(long nativeManualFillingViewAndroid, - ManualFillingComponentBridge caller, int accessoryAction); - void cachePasswordSheetDataForTesting( - WebContents webContents, String[] userNames, String[] passwords); - void notifyFocusedFieldTypeForTesting(WebContents webContents, int focusedFieldType); - void signalAutoGenerationStatusForTesting(WebContents webContents, boolean available); - } + private native void nativeOnFaviconRequested(long nativeManualFillingViewAndroid, + int desiredSizeInPx, Callback<Bitmap> faviconCallback); + private native void nativeOnFillingTriggered( + long nativeManualFillingViewAndroid, int tabType, UserInfoField userInfoField); + private native void nativeOnOptionSelected( + long nativeManualFillingViewAndroid, int accessoryAction); + + private static native void nativeCachePasswordSheetDataForTesting( + WebContents webContents, String[] userNames, String[] passwords); + private static native void nativeNotifyFocusedFieldTypeForTesting( + WebContents webContents, int focusedFieldType); + private static native void nativeSignalAutoGenerationStatusForTesting( + WebContents webContents, boolean available); }
diff --git a/chrome/android/features/media_router/BUILD.gn b/chrome/android/features/media_router/BUILD.gn index a135f63..bb7f129 100644 --- a/chrome/android/features/media_router/BUILD.gn +++ b/chrome/android/features/media_router/BUILD.gn
@@ -14,7 +14,6 @@ "$google_play_services_package:google_play_services_cast_framework_java", "$google_play_services_package:google_play_services_cast_java", "//base:base_java", - "//base:jni_java", "//chrome/android:chrome_java", "//services/media_session/public/cpp/android:media_session_java", "//third_party/android_deps:android_support_v7_appcompat_java", @@ -65,7 +64,6 @@ "java/src/org/chromium/chrome/browser/media/router/caf/remoting/RemotingSessionController.java", "java/src/org/chromium/chrome/browser/media/router/caf/remoting/StreamPositionExtrapolator.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java b/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java index 9c0bb75..65cf967 100644 --- a/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java +++ b/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java
@@ -17,7 +17,6 @@ import org.chromium.base.VisibleForTesting; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; import org.chromium.chrome.browser.AppHooks; import org.chromium.chrome.browser.media.router.caf.CafMediaRouteProvider; import org.chromium.chrome.browser.media.router.caf.remoting.CafRemotingMediaRouteProvider; @@ -146,8 +145,8 @@ mSinksPerSource.put(sourceId, allSinksPerSource); if (mNativeMediaRouterAndroidBridge != 0) { - ChromeMediaRouterJni.get().onSinksReceived(mNativeMediaRouterAndroidBridge, - ChromeMediaRouter.this, sourceId, allSinksPerSource.size()); + nativeOnSinksReceived( + mNativeMediaRouterAndroidBridge, sourceId, allSinksPerSource.size()); } } @@ -156,24 +155,22 @@ MediaRouteProvider provider, boolean wasLaunched) { mRouteIdsToProviders.put(mediaRouteId, provider); if (mNativeMediaRouterAndroidBridge != 0) { - ChromeMediaRouterJni.get().onRouteCreated(mNativeMediaRouterAndroidBridge, - ChromeMediaRouter.this, mediaRouteId, mediaSinkId, requestId, wasLaunched); + nativeOnRouteCreated(mNativeMediaRouterAndroidBridge, mediaRouteId, mediaSinkId, + requestId, wasLaunched); } } @Override public void onRouteRequestError(String errorText, int requestId) { if (mNativeMediaRouterAndroidBridge != 0) { - ChromeMediaRouterJni.get().onRouteRequestError( - mNativeMediaRouterAndroidBridge, ChromeMediaRouter.this, errorText, requestId); + nativeOnRouteRequestError(mNativeMediaRouterAndroidBridge, errorText, requestId); } } @Override public void onRouteTerminated(String mediaRouteId) { if (mNativeMediaRouterAndroidBridge != 0) { - ChromeMediaRouterJni.get().onRouteTerminated( - mNativeMediaRouterAndroidBridge, ChromeMediaRouter.this, mediaRouteId); + nativeOnRouteTerminated(mNativeMediaRouterAndroidBridge, mediaRouteId); } mRouteIdsToProviders.remove(mediaRouteId); } @@ -181,8 +178,7 @@ @Override public void onRouteClosed(String mediaRouteId, String error) { if (mNativeMediaRouterAndroidBridge != 0) { - ChromeMediaRouterJni.get().onRouteClosed( - mNativeMediaRouterAndroidBridge, ChromeMediaRouter.this, mediaRouteId, error); + nativeOnRouteClosed(mNativeMediaRouterAndroidBridge, mediaRouteId, error); } mRouteIdsToProviders.remove(mediaRouteId); } @@ -190,8 +186,7 @@ @Override public void onMessage(String mediaRouteId, String message) { if (mNativeMediaRouterAndroidBridge != 0) { - ChromeMediaRouterJni.get().onMessage( - mNativeMediaRouterAndroidBridge, ChromeMediaRouter.this, mediaRouteId, message); + nativeOnMessage(mNativeMediaRouterAndroidBridge, mediaRouteId, message); } } @@ -397,20 +392,15 @@ return null; } - @NativeMethods - interface Natives { - void onSinksReceived(long nativeMediaRouterAndroidBridge, ChromeMediaRouter caller, - String sourceUrn, int count); - void onRouteCreated(long nativeMediaRouterAndroidBridge, ChromeMediaRouter caller, - String mediaRouteId, String mediaSinkId, int createRouteRequestId, - boolean wasLaunched); - void onRouteRequestError(long nativeMediaRouterAndroidBridge, ChromeMediaRouter caller, - String errorText, int createRouteRequestId); - void onRouteTerminated( - long nativeMediaRouterAndroidBridge, ChromeMediaRouter caller, String mediaRouteId); - void onRouteClosed(long nativeMediaRouterAndroidBridge, ChromeMediaRouter caller, - String mediaRouteId, String message); - void onMessage(long nativeMediaRouterAndroidBridge, ChromeMediaRouter caller, - String mediaRouteId, String message); - } + native void nativeOnSinksReceived( + long nativeMediaRouterAndroidBridge, String sourceUrn, int count); + native void nativeOnRouteCreated(long nativeMediaRouterAndroidBridge, String mediaRouteId, + String mediaSinkId, int createRouteRequestId, boolean wasLaunched); + native void nativeOnRouteRequestError( + long nativeMediaRouterAndroidBridge, String errorText, int createRouteRequestId); + native void nativeOnRouteTerminated(long nativeMediaRouterAndroidBridge, String mediaRouteId); + native void nativeOnRouteClosed( + long nativeMediaRouterAndroidBridge, String mediaRouteId, String message); + native void nativeOnMessage( + long nativeMediaRouterAndroidBridge, String mediaRouteId, String message); }
diff --git a/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouterDialogController.java b/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouterDialogController.java index 146b25a..d172445 100644 --- a/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouterDialogController.java +++ b/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouterDialogController.java
@@ -10,7 +10,6 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; import org.chromium.chrome.browser.media.router.caf.CastMediaSource; import org.chromium.chrome.browser.media.router.caf.remoting.RemotingMediaSource; @@ -55,8 +54,7 @@ MediaRouteSelector routeSelector = source == null ? null : source.buildRouteSelector(); if (routeSelector == null) { - ChromeMediaRouterDialogControllerJni.get().onMediaSourceNotSupported( - mNativeDialogController, ChromeMediaRouterDialogController.this); + nativeOnMediaSourceNotSupported(mNativeDialogController); return; } @@ -80,8 +78,7 @@ MediaRouteSelector routeSelector = source == null ? null : source.buildRouteSelector(); if (routeSelector == null) { - ChromeMediaRouterDialogControllerJni.get().onMediaSourceNotSupported( - mNativeDialogController, ChromeMediaRouterDialogController.this); + nativeOnMediaSourceNotSupported(mNativeDialogController); return; } @@ -112,15 +109,13 @@ @Override public void onSinkSelected(String sourceUrn, MediaSink sink) { mDialogManager = null; - ChromeMediaRouterDialogControllerJni.get().onSinkSelected(mNativeDialogController, - ChromeMediaRouterDialogController.this, sourceUrn, sink.getId()); + nativeOnSinkSelected(mNativeDialogController, sourceUrn, sink.getId()); } @Override public void onRouteClosed(String mediaRouteId) { mDialogManager = null; - ChromeMediaRouterDialogControllerJni.get().onRouteClosed( - mNativeDialogController, ChromeMediaRouterDialogController.this, mediaRouteId); + nativeOnRouteClosed(mNativeDialogController, mediaRouteId); } @Override @@ -132,23 +127,16 @@ if (mDialogManager == null) return; mDialogManager = null; - ChromeMediaRouterDialogControllerJni.get().onDialogCancelled( - mNativeDialogController, ChromeMediaRouterDialogController.this); + nativeOnDialogCancelled(mNativeDialogController); } private ChromeMediaRouterDialogController(long nativeDialogController) { mNativeDialogController = nativeDialogController; } - @NativeMethods - interface Natives { - void onDialogCancelled(long nativeMediaRouterDialogControllerAndroid, - ChromeMediaRouterDialogController caller); - void onSinkSelected(long nativeMediaRouterDialogControllerAndroid, - ChromeMediaRouterDialogController caller, String sourceUrn, String sinkId); - void onRouteClosed(long nativeMediaRouterDialogControllerAndroid, - ChromeMediaRouterDialogController caller, String routeId); - void onMediaSourceNotSupported(long nativeMediaRouterDialogControllerAndroid, - ChromeMediaRouterDialogController caller); - } + native void nativeOnDialogCancelled(long nativeMediaRouterDialogControllerAndroid); + native void nativeOnSinkSelected( + long nativeMediaRouterDialogControllerAndroid, String sourceUrn, String sinkId); + native void nativeOnRouteClosed(long nativeMediaRouterDialogControllerAndroid, String routeId); + native void nativeOnMediaSourceNotSupported(long nativeMediaRouterDialogControllerAndroid); }
diff --git a/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/FlingingControllerBridge.java b/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/FlingingControllerBridge.java index 31f05b4..0807210 100644 --- a/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/FlingingControllerBridge.java +++ b/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/FlingingControllerBridge.java
@@ -6,7 +6,6 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; /** * A wrapper around a FlingingController that allows the native code to use it @@ -56,8 +55,7 @@ @Override public void onMediaStatusUpdate(MediaStatusBridge status) { if (mNativeFlingingControllerBridge != 0) { - FlingingControllerBridgeJni.get().onMediaStatusUpdated( - mNativeFlingingControllerBridge, FlingingControllerBridge.this, status); + nativeOnMediaStatusUpdated(mNativeFlingingControllerBridge, status); } } @@ -73,9 +71,6 @@ mNativeFlingingControllerBridge = 0; } - @NativeMethods - interface Natives { - void onMediaStatusUpdated(long nativeFlingingControllerBridge, - FlingingControllerBridge caller, MediaStatusBridge status); - } + private native void nativeOnMediaStatusUpdated( + long nativeFlingingControllerBridge, MediaStatusBridge status); }
diff --git a/chrome/android/features/vr/BUILD.gn b/chrome/android/features/vr/BUILD.gn index 2eb9621c..a0409bf6 100644 --- a/chrome/android/features/vr/BUILD.gn +++ b/chrome/android/features/vr/BUILD.gn
@@ -117,7 +117,6 @@ deps = [ ":java_resources", "//base:base_java", - "//base:jni_java", "//chrome/android:chrome_java", "//components/policy/android:policy_java", "//content/public/android:content_java", @@ -136,7 +135,6 @@ if (async_vr) { proguard_configs = [ "//base/android/proguard/chromium_code.flags" ] } - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/AndroidUiGestureTarget.java b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/AndroidUiGestureTarget.java index 7252bb62..2792967 100644 --- a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/AndroidUiGestureTarget.java +++ b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/AndroidUiGestureTarget.java
@@ -10,7 +10,6 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; import org.chromium.content_public.browser.MotionEventSynthesizer; /** @@ -25,8 +24,7 @@ public AndroidUiGestureTarget( View target, float scaleFactor, float scrollRatio, int touchSlop) { mMotionEventSynthesizer = MotionEventSynthesizer.create(target); - mNativePointer = AndroidUiGestureTargetJni.get().init( - AndroidUiGestureTarget.this, scaleFactor, scrollRatio, touchSlop); + mNativePointer = nativeInit(scaleFactor, scrollRatio, touchSlop); } @CalledByNative @@ -63,9 +61,5 @@ return mNativePointer; } - @NativeMethods - interface Natives { - long init( - AndroidUiGestureTarget caller, float scaleFactor, float scrollRatio, int touchSlop); - } + private native long nativeInit(float scaleFactor, float scrollRatio, int touchSlop); }
diff --git a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/AndroidVSyncHelper.java b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/AndroidVSyncHelper.java index 35da919f..7e5a6d72 100644 --- a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/AndroidVSyncHelper.java +++ b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/AndroidVSyncHelper.java
@@ -11,7 +11,6 @@ import org.chromium.base.ContextUtils; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; /** * Helper class for interfacing with the Android Choreographer from native code. @@ -24,8 +23,7 @@ @Override public void doFrame(long frameTimeNanos) { if (mNativeAndroidVSyncHelper == 0) return; - AndroidVSyncHelperJni.get().onVSync( - mNativeAndroidVSyncHelper, AndroidVSyncHelper.this, frameTimeNanos); + nativeOnVSync(mNativeAndroidVSyncHelper, frameTimeNanos); } }; @@ -56,8 +54,5 @@ return windowManager.getDefaultDisplay().getRefreshRate(); } - @NativeMethods - interface Natives { - void onVSync(long nativeAndroidVSyncHelper, AndroidVSyncHelper caller, long frameTimeNanos); - } + private native void nativeOnVSync(long nativeAndroidVSyncHelper, long frameTimeNanos); }
diff --git a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrCoreInfo.java b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrCoreInfo.java index b065071..437af23 100644 --- a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrCoreInfo.java +++ b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrCoreInfo.java
@@ -5,7 +5,6 @@ package org.chromium.chrome.browser.vr; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; /** * Container class to provide the version and the compatibility with Chrome of the installed VrCore. @@ -35,15 +34,11 @@ } public long makeNativeVrCoreInfo() { - return (gvrVersion == null) - ? VrCoreInfoJni.get().init(VrCoreInfo.this, 0, 0, 0, compatibility) - : VrCoreInfoJni.get().init(VrCoreInfo.this, gvrVersion.majorVersion, - gvrVersion.minorVersion, gvrVersion.patchVersion, compatibility); + return (gvrVersion == null) ? nativeInit(0, 0, 0, compatibility) + : nativeInit(gvrVersion.majorVersion, gvrVersion.minorVersion, + gvrVersion.patchVersion, compatibility); } - @NativeMethods - interface Natives { - long init(VrCoreInfo caller, int majorVersion, int minorVersion, int patchVersion, - int compatibility); - } + private native long nativeInit( + int majorVersion, int minorVersion, int patchVersion, int compatibility); }
diff --git a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrInputConnection.java b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrInputConnection.java index 2bb45c9f..bd1dd4f8 100644 --- a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrInputConnection.java +++ b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrInputConnection.java
@@ -12,7 +12,6 @@ import org.chromium.base.Log; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; import org.chromium.chrome.browser.vr.keyboard.TextEditAction; import org.chromium.content_public.browser.ImeAdapter; import org.chromium.content_public.browser.WebContents; @@ -66,8 +65,7 @@ mImeThreadResponseHandler.post(new Runnable() { @Override public void run() { - VrInputConnectionJni.get().updateTextState( - mNativeVrInputConnection, VrInputConnection.this, textState); + nativeUpdateTextState(mNativeVrInputConnection, textState); } }); } @@ -129,8 +127,5 @@ }); } - @NativeMethods - interface Natives { - void updateTextState(long nativeVrInputConnection, VrInputConnection caller, String text); - } + private native void nativeUpdateTextState(long nativeVrInputConnection, String text); }
diff --git a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrModuleProvider.java b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrModuleProvider.java index c2b3d4b..39580529 100644 --- a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrModuleProvider.java +++ b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrModuleProvider.java
@@ -7,7 +7,6 @@ import org.chromium.base.BundleUtils; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; import org.chromium.chrome.R; import org.chromium.chrome.browser.modules.ModuleInstallUi; import org.chromium.chrome.browser.tab.Tab; @@ -35,7 +34,7 @@ */ public static void maybeInit() { if (!VrBuildConfig.IS_VR_ENABLED) return; - VrModuleProviderJni.get().init(); + nativeInit(); // Always install the VR module on Daydream-ready devices. maybeRequestModuleIfDaydreamReady(); } @@ -104,7 +103,7 @@ // TODO(crbug.com/870055): JNI should be registered in the shared VR library's JNI_OnLoad // function. Do this once we have a shared VR library. /* package */ static void registerJni() { - VrModuleProviderJni.get().registerJni(); + nativeRegisterJni(); } private static VrDelegateProvider getDelegateProvider() { @@ -138,8 +137,7 @@ @Override public void onCancel() { if (mNativeVrModuleProvider != 0) { - VrModuleProviderJni.get().onInstalledModule( - mNativeVrModuleProvider, VrModuleProvider.this, false); + nativeOnInstalledModule(mNativeVrModuleProvider, false); } } @@ -164,17 +162,12 @@ return; } ui.showInstallSuccessUi(); - VrModuleProviderJni.get().onInstalledModule( - mNativeVrModuleProvider, VrModuleProvider.this, success); + nativeOnInstalledModule(mNativeVrModuleProvider, success); } }); } - @NativeMethods - interface Natives { - void init(); - void registerJni(); - void onInstalledModule( - long nativeVrModuleProvider, VrModuleProvider caller, boolean success); - } + private static native void nativeInit(); + private static native void nativeRegisterJni(); + private native void nativeOnInstalledModule(long nativeVrModuleProvider, boolean success); }
diff --git a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrShell.java b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrShell.java index 980432c..66e1fd0 100644 --- a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrShell.java +++ b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrShell.java
@@ -32,7 +32,6 @@ import org.chromium.base.VisibleForTesting; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; import org.chromium.base.task.PostTask; import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeActivity; @@ -251,7 +250,7 @@ mViewEventSink = ViewEventSink.from(tab.getWebContents()); if (mViewEventSink != null) mViewEventSink.onWindowFocusChanged(true); } - VrShellJni.get().swapContents(mNativeVrShell, VrShell.this, tab); + nativeSwapContents(mNativeVrShell, tab); updateHistoryButtonsVisibility(); } @@ -266,8 +265,7 @@ @Override public void onLoadProgressChanged(Tab tab, int progress) { if (mNativeVrShell == 0) return; - VrShellJni.get().onLoadProgressChanged( - mNativeVrShell, VrShell.this, progress / 100.0); + nativeOnLoadProgressChanged(mNativeVrShell, progress / 100.0); } @Override @@ -302,8 +300,7 @@ @Override public void onNewTabCreated(Tab tab) { if (mNativeVrShell == 0) return; - VrShellJni.get().onTabUpdated(mNativeVrShell, VrShell.this, tab.isIncognito(), - tab.getId(), tab.getTitle()); + nativeOnTabUpdated(mNativeVrShell, tab.isIncognito(), tab.getId(), tab.getTitle()); } }; @@ -312,11 +309,11 @@ @SuppressLint("ClickableViewAccessibility") public boolean onTouch(View v, MotionEvent event) { if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { - VrShellJni.get().onTriggerEvent(mNativeVrShell, VrShell.this, true); + nativeOnTriggerEvent(mNativeVrShell, true); return true; } else if (event.getActionMasked() == MotionEvent.ACTION_UP || event.getActionMasked() == MotionEvent.ACTION_CANCEL) { - VrShellJni.get().onTriggerEvent(mNativeVrShell, VrShell.this, false); + nativeOnTriggerEvent(mNativeVrShell, false); return true; } return false; @@ -421,8 +418,8 @@ boolean hasOrCanRequestRecordAudioPermission = hasRecordAudioPermission() || canRequestRecordAudioPermission(); boolean supportsRecognition = FeatureUtilities.isRecognitionIntentPresent(mActivity, false); - mNativeVrShell = VrShellJni.get().init(VrShell.this, mDelegate, forWebVr, - !mVrBrowsingEnabled, hasOrCanRequestRecordAudioPermission && supportsRecognition, + mNativeVrShell = nativeInit(mDelegate, forWebVr, !mVrBrowsingEnabled, + hasOrCanRequestRecordAudioPermission && supportsRecognition, getGvrApi().getNativeGvrContext(), mReprojectedRendering, displayWidthMeters, displayHeightMeters, dm.widthPixels, dm.heightPixels, pauseContent, lowDensity, isStandaloneVrDevice); @@ -439,8 +436,7 @@ mAndroidUiGestureTarget = new AndroidUiGestureTarget(mNonVrViews.getInputTarget(), mContentVrWindowAndroid.getDisplay().getDipScale(), getNativePageScrollRatio(), getTouchSlop()); - VrShellJni.get().setAndroidGestureTarget( - mNativeVrShell, VrShell.this, mAndroidUiGestureTarget); + nativeSetAndroidGestureTarget(mNativeVrShell, mAndroidUiGestureTarget); } } @@ -458,7 +454,7 @@ for (int i = 0; i < count; ++i) { incognitoTabs[i] = incognito.getTabAt(i); } - VrShellJni.get().onTabListCreated(mNativeVrShell, VrShell.this, mainTabs, incognitoTabs); + nativeOnTabListCreated(mNativeVrShell, mainTabs, incognitoTabs); } private void swapToForegroundTab() { @@ -587,8 +583,7 @@ // doesn't happen, so we need to notify native // UI of the permission change immediately. if (mNativeVrShell != 0) { - VrShellJni.get().requestRecordAudioPermissionResult( - mNativeVrShell, VrShell.this, + nativeRequestRecordAudioPermissionResult(mNativeVrShell, grantResults[0] == PackageManager.PERMISSION_GRANTED); } } @@ -678,8 +673,8 @@ int overlayWidth = (int) Math.ceil(width * dip); int overlayHeight = (int) Math.ceil(height * dip); - VrShellJni.get().bufferBoundsChanged(mNativeVrShell, VrShell.this, contentWidth, - contentHeight, overlayWidth, overlayHeight); + nativeBufferBoundsChanged( + mNativeVrShell, contentWidth, contentHeight, overlayWidth, overlayHeight); if (mContentSurface != null) { if (surfaceUninitialized) { mVrCompositorSurfaceManager.setSurface( @@ -753,7 +748,7 @@ // Refreshing the viewer profile may accesses disk under some circumstances outside of // our control. try (StrictModeContext ignored = StrictModeContext.allowDiskWrites()) { - VrShellJni.get().onResume(mNativeVrShell, VrShell.this); + nativeOnResume(mNativeVrShell); } } } @@ -763,7 +758,7 @@ if (mPaused != null && mPaused) return; mPaused = true; super.onPause(); - if (mNativeVrShell != 0) VrShellJni.get().onPause(mNativeVrShell, VrShell.this); + if (mNativeVrShell != 0) nativeOnPause(mNativeVrShell); } @Override @@ -784,7 +779,7 @@ } reparentAllTabs(mActivity.getWindowAndroid()); if (mNativeVrShell != 0) { - VrShellJni.get().destroy(mNativeVrShell, VrShell.this); + nativeDestroy(mNativeVrShell); mNativeVrShell = 0; } mTabModelSelector.removeObserver(mTabModelSelectorObserver); @@ -828,7 +823,7 @@ } public boolean hasUiFinishedLoading() { - return VrShellJni.get().hasUiFinishedLoading(mNativeVrShell, VrShell.this); + return nativeHasUiFinishedLoading(mNativeVrShell); } /** @@ -846,7 +841,7 @@ */ @Override public void closeVrDialog() { - VrShellJni.get().closeAlertDialog(mNativeVrShell, VrShell.this); + nativeCloseAlertDialog(mNativeVrShell); mVrUiViewContainer.removeAllViews(); mVrDialogDismissHandler = null; } @@ -856,8 +851,8 @@ */ @Override public void setDialogSize(int width, int height) { - VrShellJni.get().setDialogBufferSize(mNativeVrShell, VrShell.this, width, height); - VrShellJni.get().setAlertDialogSize(mNativeVrShell, VrShell.this, width, height); + nativeSetDialogBufferSize(mNativeVrShell, width, height); + nativeSetAlertDialogSize(mNativeVrShell, width, height); } /** @@ -870,13 +865,12 @@ float w = mLastContentWidth * dipScale; float h = mLastContentHeight * dipScale; float scale = mContentVrWindowAndroid.getDisplay().getAndroidUIScaling(); - VrShellJni.get().setDialogLocation( - mNativeVrShell, VrShell.this, x * scale / w, y * scale / h); + nativeSetDialogLocation(mNativeVrShell, x * scale / w, y * scale / h); } @Override public void setDialogFloating(boolean floating) { - VrShellJni.get().setDialogFloating(mNativeVrShell, VrShell.this, floating); + nativeSetDialogFloating(mNativeVrShell, floating); } /** @@ -884,12 +878,11 @@ */ @Override public void initVrDialog(int width, int height) { - VrShellJni.get().setAlertDialog(mNativeVrShell, VrShell.this, width, height); + nativeSetAlertDialog(mNativeVrShell, width, height); mAndroidDialogGestureTarget = new AndroidUiGestureTarget(mVrUiViewContainer.getInputTarget(), 1.0f, getNativePageScrollRatio(), getTouchSlop()); - VrShellJni.get().setDialogGestureTarget( - mNativeVrShell, VrShell.this, mAndroidDialogGestureTarget); + nativeSetDialogGestureTarget(mNativeVrShell, mAndroidDialogGestureTarget); } /** @@ -897,7 +890,7 @@ */ @Override public void showToast(CharSequence text) { - VrShellJni.get().showToast(mNativeVrShell, VrShell.this, text.toString()); + nativeShowToast(mNativeVrShell, text.toString()); } /** @@ -905,12 +898,11 @@ */ @Override public void cancelToast() { - VrShellJni.get().cancelToast(mNativeVrShell, VrShell.this); + nativeCancelToast(mNativeVrShell); } public void setWebVrModeEnabled(boolean enabled) { - if (mNativeVrShell != 0) - VrShellJni.get().setWebVrMode(mNativeVrShell, VrShell.this, enabled); + if (mNativeVrShell != 0) nativeSetWebVrMode(mNativeVrShell, enabled); if (!enabled) { mContentVrWindowAndroid.setVSyncPaused(false); mPendingVSyncPause = false; @@ -933,20 +925,19 @@ public boolean getWebVrModeEnabled() { if (mNativeVrShell == 0) return false; - return VrShellJni.get().getWebVrMode(mNativeVrShell, VrShell.this); + return nativeGetWebVrMode(mNativeVrShell); } public boolean isDisplayingUrlForTesting() { assert mNativeVrShell != 0; - return PostTask.runSynchronously(UiThreadTaskTraits.DEFAULT, () -> { - return VrShellJni.get().isDisplayingUrlForTesting(mNativeVrShell, VrShell.this); - }); + return PostTask.runSynchronously(UiThreadTaskTraits.DEFAULT, + () -> { return nativeIsDisplayingUrlForTesting(mNativeVrShell); }); } @VisibleForTesting public VrInputConnection getVrInputConnectionForTesting() { assert mNativeVrShell != 0; - return VrShellJni.get().getVrInputConnectionForTesting(mNativeVrShell, VrShell.this); + return nativeGetVrInputConnectionForTesting(mNativeVrShell); } public FrameLayout getContainer() { @@ -957,15 +948,14 @@ if (topContentOffset != 0) return; // Wait until a new frame is definitely available. mActivity.getCompositorViewHolder().getCompositorView().surfaceRedrawNeededAsync(() -> { - if (mNativeVrShell != 0) - VrShellJni.get().resumeContentRendering(mNativeVrShell, VrShell.this); + if (mNativeVrShell != 0) nativeResumeContentRendering(mNativeVrShell); }); } @Override public void surfaceCreated(SurfaceHolder holder) { if (mNativeVrShell == 0) return; - VrShellJni.get().setSurface(mNativeVrShell, VrShell.this, holder.getSurface()); + nativeSetSurface(mNativeVrShell, holder.getSurface()); } @Override @@ -986,27 +976,24 @@ @Override public void onTitleUpdated(Tab tab) { if (mNativeVrShell == 0) return; - VrShellJni.get().onTabUpdated(mNativeVrShell, VrShell.this, tab.isIncognito(), - tab.getId(), tab.getTitle()); + nativeOnTabUpdated(mNativeVrShell, tab.isIncognito(), tab.getId(), tab.getTitle()); } @Override public void onClosingStateChanged(Tab tab, boolean closing) { if (mNativeVrShell == 0) return; if (closing) { - VrShellJni.get().onTabRemoved( - mNativeVrShell, VrShell.this, tab.isIncognito(), tab.getId()); + nativeOnTabRemoved(mNativeVrShell, tab.isIncognito(), tab.getId()); } else { - VrShellJni.get().onTabUpdated(mNativeVrShell, VrShell.this, tab.isIncognito(), - tab.getId(), tab.getTitle()); + nativeOnTabUpdated( + mNativeVrShell, tab.isIncognito(), tab.getId(), tab.getTitle()); } } @Override public void onDestroyed(Tab tab) { if (mNativeVrShell == 0) return; - VrShellJni.get().onTabRemoved( - mNativeVrShell, VrShell.this, tab.isIncognito(), tab.getId()); + nativeOnTabRemoved(mNativeVrShell, tab.isIncognito(), tab.getId()); } }; } @@ -1019,9 +1006,9 @@ public void requestToExitVr(@UiUnsupportedMode int reason, boolean showExitPromptBeforeDoff) { if (mNativeVrShell == 0) return; if (showExitPromptBeforeDoff) { - VrShellJni.get().requestToExitVr(mNativeVrShell, VrShell.this, reason); + nativeRequestToExitVr(mNativeVrShell, reason); } else { - VrShellJni.get().logUnsupportedModeUserMetric(mNativeVrShell, VrShell.this, reason); + nativeLogUnsupportedModeUserMetric(mNativeVrShell, reason); mDelegate.onExitVrRequestResult(true); } } @@ -1029,8 +1016,7 @@ @CalledByNative private void onExitVrRequestResult(@UiUnsupportedMode int reason, boolean shouldExit) { if (shouldExit) { - if (mNativeVrShell != 0) - VrShellJni.get().logUnsupportedModeUserMetric(mNativeVrShell, VrShell.this, reason); + if (mNativeVrShell != 0) nativeLogUnsupportedModeUserMetric(mNativeVrShell, reason); } mDelegate.onExitVrRequestResult(shouldExit); } @@ -1123,8 +1109,7 @@ if (mTab == null) { mCanGoBack = false; mCanGoForward = false; - VrShellJni.get().setHistoryButtonsEnabled( - mNativeVrShell, VrShell.this, mCanGoBack, mCanGoForward); + nativeSetHistoryButtonsEnabled(mNativeVrShell, mCanGoBack, mCanGoForward); return; } boolean willCloseTab = false; @@ -1142,8 +1127,7 @@ } mCanGoBack = canGoBack; mCanGoForward = canGoForward; - VrShellJni.get().setHistoryButtonsEnabled( - mNativeVrShell, VrShell.this, mCanGoBack, mCanGoForward); + nativeSetHistoryButtonsEnabled(mNativeVrShell, mCanGoBack, mCanGoForward); } private float getNativePageScrollRatio() { @@ -1163,14 +1147,12 @@ @Override public void onVrViewEmpty() { - if (mNativeVrShell != 0) - VrShellJni.get().onOverlayTextureEmptyChanged(mNativeVrShell, VrShell.this, true); + if (mNativeVrShell != 0) nativeOnOverlayTextureEmptyChanged(mNativeVrShell, true); } @Override public void onVrViewNonEmpty() { - if (mNativeVrShell != 0) - VrShellJni.get().onOverlayTextureEmptyChanged(mNativeVrShell, VrShell.this, false); + if (mNativeVrShell != 0) nativeOnOverlayTextureEmptyChanged(mNativeVrShell, false); } @Override @@ -1238,15 +1220,15 @@ @Override public void showSoftInput(boolean show) { assert mNativeVrShell != 0; - VrShellJni.get().showSoftInput(mNativeVrShell, VrShell.this, show); + nativeShowSoftInput(mNativeVrShell, show); } @Override public void updateIndices( int selectionStart, int selectionEnd, int compositionStart, int compositionEnd) { assert mNativeVrShell != 0; - VrShellJni.get().updateWebInputIndices(mNativeVrShell, VrShell.this, selectionStart, - selectionEnd, compositionStart, compositionEnd); + nativeUpdateWebInputIndices( + mNativeVrShell, selectionStart, selectionEnd, compositionStart, compositionEnd); } @VisibleForTesting @@ -1255,19 +1237,18 @@ } public void acceptDoffPromptForTesting() { - VrShellJni.get().acceptDoffPromptForTesting(mNativeVrShell, VrShell.this); + nativeAcceptDoffPromptForTesting(mNativeVrShell); } public void performControllerActionForTesting( int elementName, int actionType, PointF position) { - VrShellJni.get().performControllerActionForTesting( - mNativeVrShell, VrShell.this, elementName, actionType, position.x, position.y); + nativePerformControllerActionForTesting( + mNativeVrShell, elementName, actionType, position.x, position.y); } public void performKeyboardInputForTesting(int inputType, String inputString) { PostTask.runSynchronously(UiThreadTaskTraits.DEFAULT, () -> { - VrShellJni.get().performKeyboardInputForTesting( - mNativeVrShell, VrShell.this, inputType, inputString); + nativePerformKeyboardInputForTesting(mNativeVrShell, inputType, inputString); }); } @@ -1291,17 +1272,15 @@ // In the case of the UI activity quiescence callback type, we need to let the native UI // know how long to wait before timing out. if (actionType == UiTestOperationType.UI_ACTIVITY_RESULT) { - VrShellJni.get().setUiExpectingActivityForTesting( - mNativeVrShell, VrShell.this, operationData.timeoutMs); + nativeSetUiExpectingActivityForTesting(mNativeVrShell, operationData.timeoutMs); } else if (actionType == UiTestOperationType.ELEMENT_VISIBILITY_STATUS) { - VrShellJni.get().watchElementForVisibilityStatusForTesting(mNativeVrShell, VrShell.this, + nativeWatchElementForVisibilityStatusForTesting(mNativeVrShell, operationData.elementName, operationData.timeoutMs, operationData.visibility); } } public void saveNextFrameBufferToDiskForTesting(String filepathBase) { - VrShellJni.get().saveNextFrameBufferToDiskForTesting( - mNativeVrShell, VrShell.this, filepathBase); + nativeSaveNextFrameBufferToDiskForTesting(mNativeVrShell, filepathBase); } public int getLastUiOperationResultForTesting(int actionType) { @@ -1315,66 +1294,63 @@ mUiOperationResultCallbacks.set(actionType, null); } - @NativeMethods - interface Natives { - long init(VrShell caller, VrShellDelegate delegate, boolean forWebVR, - boolean browsingDisabled, boolean hasOrCanRequestRecordAudioPermission, long gvrApi, - boolean reprojectedRendering, float displayWidthMeters, float displayHeightMeters, - int displayWidthPixels, int displayHeightPixels, boolean pauseContent, - boolean lowDensity, boolean isStandaloneVrDevice); - boolean hasUiFinishedLoading(long nativeVrShell, VrShell caller); - void setSurface(long nativeVrShell, VrShell caller, Surface surface); - void swapContents(long nativeVrShell, VrShell caller, Tab tab); - void setAndroidGestureTarget( - long nativeVrShell, VrShell caller, AndroidUiGestureTarget androidUiGestureTarget); - void setDialogGestureTarget( - long nativeVrShell, VrShell caller, AndroidUiGestureTarget dialogGestureTarget); - void destroy(long nativeVrShell, VrShell caller); - void onTriggerEvent(long nativeVrShell, VrShell caller, boolean touched); - void onPause(long nativeVrShell, VrShell caller); - void onResume(long nativeVrShell, VrShell caller); - void onLoadProgressChanged(long nativeVrShell, VrShell caller, double progress); - void bufferBoundsChanged(long nativeVrShell, VrShell caller, int contentWidth, - int contentHeight, int overlayWidth, int overlayHeight); - void setWebVrMode(long nativeVrShell, VrShell caller, boolean enabled); - boolean getWebVrMode(long nativeVrShell, VrShell caller); - boolean isDisplayingUrlForTesting(long nativeVrShell, VrShell caller); - void onTabListCreated( - long nativeVrShell, VrShell caller, Tab[] mainTabs, Tab[] incognitoTabs); - void onTabUpdated( - long nativeVrShell, VrShell caller, boolean incognito, int id, String title); - void onTabRemoved(long nativeVrShell, VrShell caller, boolean incognito, int id); - void closeAlertDialog(long nativeVrShell, VrShell caller); - void setAlertDialog(long nativeVrShell, VrShell caller, float width, float height); - void setDialogBufferSize(long nativeVrShell, VrShell caller, int width, int height); - void setAlertDialogSize(long nativeVrShell, VrShell caller, float width, float height); - void setDialogLocation(long nativeVrShell, VrShell caller, float x, float y); - void setDialogFloating(long nativeVrShell, VrShell caller, boolean floating); - void showToast(long nativeVrShell, VrShell caller, String text); - void cancelToast(long nativeVrShell, VrShell caller); - void setHistoryButtonsEnabled( - long nativeVrShell, VrShell caller, boolean canGoBack, boolean canGoForward); - void requestToExitVr(long nativeVrShell, VrShell caller, @UiUnsupportedMode int reason); - void logUnsupportedModeUserMetric( - long nativeVrShell, VrShell caller, @UiUnsupportedMode int mode); - void showSoftInput(long nativeVrShell, VrShell caller, boolean show); - void updateWebInputIndices(long nativeVrShell, VrShell caller, int selectionStart, - int selectionEnd, int compositionStart, int compositionEnd); - VrInputConnection getVrInputConnectionForTesting(long nativeVrShell, VrShell caller); - void acceptDoffPromptForTesting(long nativeVrShell, VrShell caller); - void performControllerActionForTesting(long nativeVrShell, VrShell caller, int elementName, - int actionType, float x, float y); - void performKeyboardInputForTesting( - long nativeVrShell, VrShell caller, int inputType, String inputString); - void setUiExpectingActivityForTesting( - long nativeVrShell, VrShell caller, int quiescenceTimeoutMs); - void saveNextFrameBufferToDiskForTesting( - long nativeVrShell, VrShell caller, String filepathBase); - void watchElementForVisibilityStatusForTesting(long nativeVrShell, VrShell caller, - int elementName, int timeoutMs, boolean visibility); - void resumeContentRendering(long nativeVrShell, VrShell caller); - void onOverlayTextureEmptyChanged(long nativeVrShell, VrShell caller, boolean empty); - void requestRecordAudioPermissionResult( - long nativeVrShell, VrShell caller, boolean canRecordAudio); - } + private native long nativeInit(VrShellDelegate delegate, boolean forWebVR, + boolean browsingDisabled, boolean hasOrCanRequestRecordAudioPermission, long gvrApi, + boolean reprojectedRendering, float displayWidthMeters, float displayHeightMeters, + int displayWidthPixels, int displayHeightPixels, boolean pauseContent, + boolean lowDensity, boolean isStandaloneVrDevice); + private native boolean nativeHasUiFinishedLoading(long nativeVrShell); + private native void nativeSetSurface(long nativeVrShell, Surface surface); + private native void nativeSwapContents(long nativeVrShell, Tab tab); + private native void nativeSetAndroidGestureTarget( + long nativeVrShell, AndroidUiGestureTarget androidUiGestureTarget); + private native void nativeSetDialogGestureTarget( + long nativeVrShell, AndroidUiGestureTarget dialogGestureTarget); + private native void nativeDestroy(long nativeVrShell); + private native void nativeOnTriggerEvent(long nativeVrShell, boolean touched); + private native void nativeOnPause(long nativeVrShell); + private native void nativeOnResume(long nativeVrShell); + private native void nativeOnLoadProgressChanged(long nativeVrShell, double progress); + private native void nativeBufferBoundsChanged(long nativeVrShell, int contentWidth, + int contentHeight, int overlayWidth, int overlayHeight); + private native void nativeSetWebVrMode(long nativeVrShell, boolean enabled); + private native boolean nativeGetWebVrMode(long nativeVrShell); + private native boolean nativeIsDisplayingUrlForTesting(long nativeVrShell); + private native void nativeOnTabListCreated( + long nativeVrShell, Tab[] mainTabs, Tab[] incognitoTabs); + private native void nativeOnTabUpdated( + long nativeVrShell, boolean incognito, int id, String title); + private native void nativeOnTabRemoved(long nativeVrShell, boolean incognito, int id); + private native void nativeCloseAlertDialog(long nativeVrShell); + private native void nativeSetAlertDialog(long nativeVrShell, float width, float height); + private native void nativeSetDialogBufferSize(long nativeVrShell, int width, int height); + private native void nativeSetAlertDialogSize(long nativeVrShell, float width, float height); + private native void nativeSetDialogLocation(long nativeVrShell, float x, float y); + private native void nativeSetDialogFloating(long nativeVrShell, boolean floating); + private native void nativeShowToast(long nativeVrShell, String text); + private native void nativeCancelToast(long nativeVrShell); + private native void nativeSetHistoryButtonsEnabled( + long nativeVrShell, boolean canGoBack, boolean canGoForward); + private native void nativeRequestToExitVr(long nativeVrShell, @UiUnsupportedMode int reason); + private native void nativeLogUnsupportedModeUserMetric( + long nativeVrShell, @UiUnsupportedMode int mode); + private native void nativeShowSoftInput(long nativeVrShell, boolean show); + private native void nativeUpdateWebInputIndices(long nativeVrShell, int selectionStart, + int selectionEnd, int compositionStart, int compositionEnd); + private native VrInputConnection nativeGetVrInputConnectionForTesting(long nativeVrShell); + private native void nativeAcceptDoffPromptForTesting(long nativeVrShell); + private native void nativePerformControllerActionForTesting( + long nativeVrShell, int elementName, int actionType, float x, float y); + private native void nativePerformKeyboardInputForTesting( + long nativeVrShell, int inputType, String inputString); + private native void nativeSetUiExpectingActivityForTesting( + long nativeVrShell, int quiescenceTimeoutMs); + private native void nativeSaveNextFrameBufferToDiskForTesting( + long nativeVrShell, String filepathBase); + private native void nativeWatchElementForVisibilityStatusForTesting( + long nativeVrShell, int elementName, int timeoutMs, boolean visibility); + private native void nativeResumeContentRendering(long nativeVrShell); + private native void nativeOnOverlayTextureEmptyChanged(long nativeVrShell, boolean empty); + private native void nativeRequestRecordAudioPermissionResult( + long nativeVrShell, boolean canRecordAudio); }
diff --git a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrShellDelegate.java b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrShellDelegate.java index 7b2ed5dc..a4ae5ae 100644 --- a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrShellDelegate.java +++ b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrShellDelegate.java
@@ -41,7 +41,6 @@ import org.chromium.base.VisibleForTesting; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import org.chromium.base.annotations.NativeMethods; import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.metrics.RecordUserAction; import org.chromium.base.task.AsyncTask; @@ -241,7 +240,7 @@ // If we didn't request WebVR then we're not coming from a request present call. // If we didn't set mStartedFromVrIntent this isn't an intent from another app. // Therefore we can assume this was triggered by NFC. - VrShellDelegateJni.get().recordVrStartAction( + sInstance.nativeRecordVrStartAction( sInstance.mNativeVrShellDelegate, VrStartAction.HEADSET_ACTIVATION); } @@ -342,7 +341,7 @@ */ public static void onNativeLibraryAvailable() { VrModuleProvider.registerJni(); - VrShellDelegateJni.get().onLibraryAvailable(); + nativeOnLibraryAvailable(); } /** @@ -713,7 +712,7 @@ private static void registerVrAssetsComponentIfDaydreamUser(boolean isDaydreamCurrentViewer) { assert !sRegisteredVrAssetsComponent; if (isDaydreamCurrentViewer) { - VrShellDelegateJni.get().registerVrAssetsComponent(); + nativeRegisterVrAssetsComponent(); sRegisteredVrAssetsComponent = true; } ChromePreferenceManager.getInstance().writeBoolean( @@ -898,7 +897,7 @@ // If an activity isn't resumed at the point, it must have been paused. mPaused = ApplicationStatus.getStateForActivity(activity) != ActivityState.RESUMED; mVisible = activity.hasWindowFocus(); - mNativeVrShellDelegate = VrShellDelegateJni.get().init(VrShellDelegate.this); + mNativeVrShellDelegate = nativeInit(); updateVrSupportLevel(null); mFeedbackFrequency = VrFeedbackStatus.getFeedbackFrequency(); ensureLifecycleObserverInitialized(); @@ -1050,8 +1049,7 @@ private void maybeSetPresentResult(boolean result) { if (mNativeVrShellDelegate == 0 || !mRequestedWebVr) return; - VrShellDelegateJni.get().setPresentResult( - mNativeVrShellDelegate, VrShellDelegate.this, result); + nativeSetPresentResult(mNativeVrShellDelegate, result); mRequestedWebVr = false; } @@ -1073,7 +1071,7 @@ } enterVr(mActivateFromHeadsetInsertion); if (mActivateFromHeadsetInsertion && mListeningForWebVrActivate) { - VrShellDelegateJni.get().displayActivate(mNativeVrShellDelegate, VrShellDelegate.this); + nativeDisplayActivate(mNativeVrShellDelegate); mActivateFromHeadsetInsertion = false; } @@ -1172,9 +1170,7 @@ return; } - if (!mInVr) - VrShellDelegateJni.get().recordVrStartAction( - mNativeVrShellDelegate, VrStartAction.INTENT_LAUNCH); + if (!mInVr) nativeRecordVrStartAction(mNativeVrShellDelegate, VrStartAction.INTENT_LAUNCH); mStartedFromVrIntent = true; // Setting DON succeeded will cause us to enter VR when resuming. @@ -1468,8 +1464,7 @@ StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites(); try { - if (mNativeVrShellDelegate != 0) - VrShellDelegateJni.get().onResume(mNativeVrShellDelegate, VrShellDelegate.this); + if (mNativeVrShellDelegate != 0) nativeOnResume(mNativeVrShellDelegate); } finally { StrictMode.setThreadPolicy(oldPolicy); } @@ -1556,8 +1551,7 @@ } if (mInVr) mVrShell.pause(); - if (mNativeVrShellDelegate != 0) - VrShellDelegateJni.get().onPause(mNativeVrShellDelegate, VrShellDelegate.this); + if (mNativeVrShellDelegate != 0) nativeOnPause(mNativeVrShellDelegate); mIsDaydreamCurrentViewer = null; } @@ -1666,8 +1660,7 @@ if (mActivateFromHeadsetInsertion) { // Dispatch vrdisplayactivate so that the WebVr page can call requestPresent // to start presentation. - VrShellDelegateJni.get().displayActivate( - mNativeVrShellDelegate, VrShellDelegate.this); + nativeDisplayActivate(mNativeVrShellDelegate); mActivateFromHeadsetInsertion = false; } } else { @@ -1953,22 +1946,18 @@ private void destroy() { if (sInstance == null) return; shutdownVr(false /* disableVrMode */, false /* stayingInChrome */); - if (mNativeVrShellDelegate != 0) - VrShellDelegateJni.get().destroy(mNativeVrShellDelegate, VrShellDelegate.this); + if (mNativeVrShellDelegate != 0) nativeDestroy(mNativeVrShellDelegate); mNativeVrShellDelegate = 0; sInstance = null; } - @NativeMethods - interface Natives { - long init(VrShellDelegate caller); - void onLibraryAvailable(); - void setPresentResult(long nativeVrShellDelegate, VrShellDelegate caller, boolean result); - void recordVrStartAction(long nativeVrShellDelegate, int startAction); - void displayActivate(long nativeVrShellDelegate, VrShellDelegate caller); - void onPause(long nativeVrShellDelegate, VrShellDelegate caller); - void onResume(long nativeVrShellDelegate, VrShellDelegate caller); - void destroy(long nativeVrShellDelegate, VrShellDelegate caller); - void registerVrAssetsComponent(); - } + private native long nativeInit(); + private static native void nativeOnLibraryAvailable(); + private native void nativeSetPresentResult(long nativeVrShellDelegate, boolean result); + private native void nativeRecordVrStartAction(long nativeVrShellDelegate, int startAction); + private native void nativeDisplayActivate(long nativeVrShellDelegate); + private native void nativeOnPause(long nativeVrShellDelegate); + private native void nativeOnResume(long nativeVrShellDelegate); + private native void nativeDestroy(long nativeVrShellDelegate); + private static native void nativeRegisterVrAssetsComponent(); }
diff --git a/chrome/android/features/vr/vr_module.gni b/chrome/android/features/vr/vr_module.gni index 429f1d7..76533bd1 100644 --- a/chrome/android/features/vr/vr_module.gni +++ b/chrome/android/features/vr/vr_module.gni
@@ -15,9 +15,5 @@ if (use_native_modules && modularize_vr_native) { native_deps = [ "//chrome/browser/vr:vr_ui" ] native_entrypoints = "//chrome/browser/vr/module_exports.lst" - } else { - # TODO(tiborg): Remove dummy lib and those attributes. - loadable_module_dep = "//chrome/browser/android/vr:vr_ui_dummy_lib" - loadable_module = "libvr_ui_dummy_lib.so" } }
diff --git a/chrome/android/java/res/layout/password_entry_editor.xml b/chrome/android/java/res/layout/password_entry_editor.xml index 06c000a3..5bc781d 100644 --- a/chrome/android/java/res/layout/password_entry_editor.xml +++ b/chrome/android/java/res/layout/password_entry_editor.xml
@@ -3,9 +3,9 @@ Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" @@ -53,13 +53,20 @@ </org.chromium.chrome.browser.widget.ChromeTextInputLayout> <!-- Password --> - <org.chromium.chrome.browser.widget.ChromeTextInputLayout - android:id="@+id/password_label" - android:labelFor="@+id/password_edit" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/password_entry_editor_field_top_margin" - android:layout_marginBottom="@dimen/password_entry_editor_field_bottom_margin"> + android:orientation="horizontal" + android:gravity="center"> + + <org.chromium.chrome.browser.widget.ChromeTextInputLayout + android:id="@+id/password_label" + android:labelFor="@+id/password_edit" + android:layout_height="wrap_content" + android:layout_width="0dp" + android:layout_weight="1" + android:layout_marginTop="@dimen/password_entry_editor_field_top_margin" + android:layout_marginBottom="@dimen/password_entry_editor_field_bottom_margin"> <EditText tools:ignore="LabelFor" @@ -69,5 +76,18 @@ android:imeOptions="flagNoExtractUi" android:inputType="textPassword" android:hint="@string/password_entry_viewer_password"/> - </org.chromium.chrome.browser.widget.ChromeTextInputLayout> + </org.chromium.chrome.browser.widget.ChromeTextInputLayout> + + + <org.chromium.ui.widget.ChromeImageButton + android:id="@+id/password_entry_editor_view_password" + android:background="?attr/selectableItemBackground" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:srcCompat="@drawable/ic_visibility_black" + app:tint="@color/standard_mode_tint" + style="?android:attr/buttonStyleSmall"/> + + </LinearLayout> + </LinearLayout> \ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java index b149d92..733bfc0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
@@ -48,6 +48,7 @@ import org.chromium.chrome.browser.preferences.ChromePreferenceManager; import org.chromium.chrome.browser.vr.OnExitVrRequestListener; import org.chromium.chrome.browser.vr.VrModuleProvider; +import org.chromium.components.background_task_scheduler.BackgroundTaskSchedulerFactory; import org.chromium.components.embedder_support.application.FontPreloadingWorkaround; import org.chromium.components.module_installer.ModuleInstaller; import org.chromium.ui.base.ResourceBundle; @@ -125,7 +126,8 @@ ModuleInstaller.getInstance().recordModuleAvailability(); // Set Chrome factory for mapping BackgroundTask classes to TaskIds. - ChromeBackgroundTaskFactory.setAsDefault(); + BackgroundTaskSchedulerFactory.setBackgroundTaskFactory( + new ChromeBackgroundTaskFactory()); } // Write installed modules to crash keys. This needs to be done as early as possible so that
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskScheduler.java b/chrome/android/java/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskScheduler.java index 46f59e5..93bd283 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskScheduler.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskScheduler.java
@@ -120,16 +120,14 @@ Bundle taskExtras = new Bundle(); taskExtras.putLong(SOONEST_EXPECTED_WAKETIME, System.currentTimeMillis() + minDelayMs); - TaskInfo.TimingInfo timingInfo = TaskInfo.OneOffInfo.create() - .setWindowStartTimeMs(minDelayMs) - .setWindowEndTimeMs(Integer.MAX_VALUE) - .build(); - TaskInfo taskInfo = TaskInfo.createTask(getAppropriateTaskId(taskType), timingInfo) - .setRequiredNetworkType(TaskInfo.NetworkType.ANY) - .setUpdateCurrent(true) - .setIsPersisted(true) - .setExtras(taskExtras) - .build(); + TaskInfo taskInfo = + TaskInfo.createOneOffTask(getAppropriateTaskId(taskType), + getAppropriateTaskClass(taskType), minDelayMs, Integer.MAX_VALUE) + .setRequiredNetworkType(TaskInfo.NetworkType.ANY) + .setUpdateCurrent(true) + .setIsPersisted(true) + .setExtras(taskExtras) + .build(); // This will overwrite any existing task with this ID. return BackgroundTaskSchedulerFactory.getScheduler().schedule( ContextUtils.getApplicationContext(), taskInfo);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/background_task_scheduler/ChromeBackgroundTaskFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/background_task_scheduler/ChromeBackgroundTaskFactory.java index 2c59975..e1b1000 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/background_task_scheduler/ChromeBackgroundTaskFactory.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/background_task_scheduler/ChromeBackgroundTaskFactory.java
@@ -5,7 +5,6 @@ package org.chromium.chrome.browser.background_task_scheduler; import org.chromium.base.Log; -import org.chromium.base.annotations.CalledByNative; import org.chromium.chrome.browser.background_sync.BackgroundSyncBackgroundTask; import org.chromium.chrome.browser.background_sync.PeriodicBackgroundSyncChromeWakeUpTask; import org.chromium.chrome.browser.component_updater.UpdateTask; @@ -23,7 +22,6 @@ import org.chromium.chrome.browser.webapps.WebApkUpdateTask; import org.chromium.components.background_task_scheduler.BackgroundTask; import org.chromium.components.background_task_scheduler.BackgroundTaskFactory; -import org.chromium.components.background_task_scheduler.BackgroundTaskSchedulerFactory; import org.chromium.components.background_task_scheduler.TaskIds; /** @@ -32,16 +30,7 @@ */ public class ChromeBackgroundTaskFactory implements BackgroundTaskFactory { private static final String TAG = "ChromeBkgrdTaskF"; - private ChromeBackgroundTaskFactory() {} - - private static class LazyHolder { - static final ChromeBackgroundTaskFactory INSTANCE = new ChromeBackgroundTaskFactory(); - } - - @CalledByNative - public static void setAsDefault() { - BackgroundTaskSchedulerFactory.setBackgroundTaskFactory(LazyHolder.INSTANCE); - } + public ChromeBackgroundTaskFactory() {} @Override public BackgroundTask getBackgroundTaskFromTaskId(int taskId) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkBridge.java index decfabc..3af8580 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkBridge.java
@@ -269,6 +269,15 @@ } /** + * Load a fake partner bookmark shim for testing. To see (or edit) the titles and URLs of the + * partner bookmarks, go to bookmark_bridge.cc. + */ + @VisibleForTesting + public void loadFakePartnerBookmarkShimForTesting() { + nativeLoadFakePartnerBookmarkShimForTesting(mNativeBookmarkBridge); + } + + /** * Add an observer to bookmark model changes. * @param observer The observer to be added. */ @@ -939,6 +948,7 @@ private native void nativeStartGroupingUndos(long nativeBookmarkBridge); private native void nativeEndGroupingUndos(long nativeBookmarkBridge); private native void nativeLoadEmptyPartnerBookmarkShimForTesting(long nativeBookmarkBridge); + private native void nativeLoadFakePartnerBookmarkShimForTesting(long nativeBookmarkBridge); private native void nativeSearchBookmarks(long nativeBookmarkBridge, List<BookmarkId> bookmarkMatches, String query, int maxNumber); private native long nativeInit(Profile profile);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java index 62e580b..7a293d68 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
@@ -37,12 +37,13 @@ import org.chromium.chrome.browser.crash.LogcatExtractionRunnable; import org.chromium.chrome.browser.download.DownloadManagerService; import org.chromium.chrome.browser.services.GoogleServicesManager; +import org.chromium.chrome.browser.util.FeatureUtilities; import org.chromium.chrome.browser.webapps.ActivityAssigner; import org.chromium.chrome.browser.webapps.ChromeWebApkHost; import org.chromium.components.background_task_scheduler.BackgroundTaskSchedulerExternalUma; import org.chromium.components.crash.browser.ChildProcessCrashObserver; import org.chromium.components.minidump_uploader.CrashFileManager; -import org.chromium.components.module_installer.ModuleActivityObserver; +import org.chromium.components.module_installer.observers.ModuleActivityObserver; import org.chromium.content_public.browser.BrowserStartupController; import org.chromium.content_public.browser.DeviceUtils; import org.chromium.content_public.browser.SpeechRecognition; @@ -438,6 +439,9 @@ // TODO(crbug.com/960767): Remove this in M77. ServiceManagerStartupUtils.cleanupSharedPreferences(); + // Needed for field trial metrics to be properly collected in ServiceManager only mode. + FeatureUtilities.cacheNativeFlagsForServiceManagerOnlyMode(); + PostTask.postTask( TaskTraits.BEST_EFFORT_MAY_BLOCK, LibraryPrefetcher::maybePinOrderedCodeInMemory); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java index 7e2aeae9..7602e8a8 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
@@ -260,7 +260,7 @@ if (VrModuleProvider.getDelegate().isInVr()) onEnterVr(); mOverviewModeBehavior = overviewModeBehavior; - if (overviewModeBehavior.overviewVisible()) { + if (overviewModeBehavior != null && overviewModeBehavior.overviewVisible()) { mOverviewObserver = new EmptyOverviewModeObserver() { @Override public void onOverviewModeFinishedHiding() {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java index a3ee20c30..ae8d9694 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java
@@ -90,23 +90,12 @@ sAlwaysSupportServiceManagerOnlyForTesting = true; } - @VisibleForTesting - static void skipCachingFlagForTesting() { - sSkipCachingFlagForTesting = true; - } - @Override protected void onStartTaskWithNative( Context context, TaskParameters taskParameters, TaskFinishedCallback callback) { assert taskParameters.getTaskId() == TaskIds.OFFLINE_PAGES_PREFETCH_JOB_ID; if (mNativeTask != 0) return; - // Caches the flag. If a field trial isn't explicitly checked in the code, it won't be - // tagged as active. This might cause many UMA data of "Servicification.Startup2" are shown - // in the "not in study" bucket. - if (!sSkipCachingFlagForTesting) - FeatureUtilities.cacheServiceManagerForBackgroundPrefetch(); - // Only Feed is supported in reduced mode. // If we launched chrome in reduced mode but it turns out that Feed is not enabled (because // the cached value of the flag was stale), we should cache the new value and reschedule
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/basic/BasicSuggestionProcessor.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/basic/BasicSuggestionProcessor.java index cc6e303..7a71053 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/basic/BasicSuggestionProcessor.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/basic/BasicSuggestionProcessor.java
@@ -130,8 +130,6 @@ if (suggestion.isUrlSuggestion()) { if (suggestion.isStarred()) { return SuggestionIcon.BOOKMARK; - } else if (suggestion.getType() == OmniboxSuggestionType.HISTORY_URL) { - return SuggestionIcon.HISTORY; } else { return SuggestionIcon.GLOBE; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java index e8bb649..9a04190 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
@@ -379,6 +379,17 @@ private OverviewModeBehavior mOverviewModeBehavior; private PaymentHandlerHost mPaymentHandlerHost; + /** + * A mapping of the payment method names to the corresponding payment method specific data. If + * STRICT_HAS_ENROLLED_AUTOFILL_INSTRUMENT is enabled, then the key "basic-card-payment-options" + * also maps to the following payment options: + * - requestPayerEmail + * - requestPayerName + * - requestPayerPhone + * - requestShipping + */ + private Map<String, PaymentMethodData> mQueryForQuota; + /** Aborts should only be recorded if the Payment Request was shown to the user. */ private boolean mShouldRecordAbortReason; @@ -503,6 +514,7 @@ Log.d(TAG, ErrorStrings.PROHIBITED_ORIGIN_OR_INVALID_SSL_EXPLANATION); // Don't show any UI. Resolve .canMakePayment() with "false". Reject .show() with // "NotSupportedError". + mQueryForQuota = new HashMap<>(); onAllPaymentAppsCreated(); return; } @@ -518,6 +530,7 @@ Log.d(TAG, ErrorStrings.PROHIBITED_ORIGIN_OR_INVALID_SSL_EXPLANATION); // Don't show any UI. Resolve .canMakePayment() with "false". Reject .show() with // "NotSupportedError". + mQueryForQuota = new HashMap<>(); onAllPaymentAppsCreated(); return; } @@ -529,6 +542,17 @@ return; } + mQueryForQuota = new HashMap<>(mMethodData); + if (mQueryForQuota.containsKey("basic-card") + && PaymentsExperimentalFeatures.isEnabled( + ChromeFeatureList.STRICT_HAS_ENROLLED_AUTOFILL_INSTRUMENT)) { + PaymentMethodData paymentMethodData = new PaymentMethodData(); + paymentMethodData.stringifiedData = String.format( + "{payerEmail:%s,payerName:%s,payerPhone:%s,shipping:%s}", mRequestPayerEmail, + mRequestPayerName, mRequestPayerPhone, mRequestShipping); + mQueryForQuota.put("basic-card-payment-options", paymentMethodData); + } + if (!parseAndValidateDetailsOrDisconnectFromClient(details)) return; if (mRawTotal == null) { @@ -1995,7 +2019,7 @@ mIsHasEnrolledInstrumentResponsePending = false; if (CanMakePaymentQuery.canQuery(mWebContents, mTopLevelOrigin, mPaymentRequestOrigin, - mMethodData, mHasEnrolledInstrumentUsesPerMethodQuota)) { + mQueryForQuota, mHasEnrolledInstrumentUsesPerMethodQuota)) { mClient.onHasEnrolledInstrument(response ? HasEnrolledInstrumentQueryResult.HAS_ENROLLED_INSTRUMENT : HasEnrolledInstrumentQueryResult.HAS_NO_ENROLLED_INSTRUMENT);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/TextMessagePreference.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/TextMessagePreference.java index e90c0ac8..2ed158c2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/TextMessagePreference.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/TextMessagePreference.java
@@ -6,14 +6,12 @@ import android.content.Context; import android.support.v7.preference.PreferenceViewHolder; -import android.text.TextUtils; import android.text.method.LinkMovementMethod; import android.util.AttributeSet; -import android.view.View; import android.widget.TextView; /** - * A preference that displays informational text. + * A preference that displays informational text, and a summary which can contain a link. */ public class TextMessagePreference extends ChromeBasePreference { /** @@ -22,24 +20,14 @@ public TextMessagePreference(Context context, AttributeSet attrs) { super(context, attrs); setSelectable(false); + setSingleLineTitle(false); } @Override public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); - TextView titleView = (TextView) holder.findViewById(android.R.id.title); - if (!TextUtils.isEmpty(getTitle())) { - titleView.setVisibility(View.VISIBLE); - titleView.setSingleLine(false); - titleView.setMaxLines(Integer.MAX_VALUE); - titleView.setMovementMethod(LinkMovementMethod.getInstance()); - } else { - titleView.setVisibility(View.GONE); - } - TextView summaryView = (TextView) holder.findViewById(android.R.id.summary); - // No need to manually toggle visibility for summary - it is done in super.onBindView. summaryView.setMovementMethod(LinkMovementMethod.getInstance()); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/SingleTabModelSelector.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/SingleTabModelSelector.java index c570b94c..a995381 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/SingleTabModelSelector.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/SingleTabModelSelector.java
@@ -9,65 +9,17 @@ import org.chromium.chrome.browser.tab.Tab; /** - * Simple TabModelSelector that assumes that only the regular TabModel type exists. + * Simple TabModelSelector that assumes that only a single TabModel exists at a time. */ public class SingleTabModelSelector extends TabModelSelectorBase { - private final SingleTabModel mTabModel; - public SingleTabModelSelector(Activity activity, TabCreatorManager tabCreatorManager, boolean incognito, boolean blockNewWindows) { super(tabCreatorManager); - mTabModel = new SingleTabModel(activity, incognito, blockNewWindows); - initialize(false, mTabModel); + initialize(incognito, new SingleTabModel(activity, incognito, blockNewWindows)); } public void setTab(Tab tab) { - mTabModel.setTab(tab); + ((SingleTabModel) getCurrentModel()).setTab(tab); markTabStateInitialized(); } - - @Override - public void selectModel(boolean incognito) { - assert incognito == mTabModel.isIncognito(); - } - - @Override - public TabModel getModel(boolean incognito) { - return super.getModel(incognito); - } - - @Override - public TabModel getCurrentModel() { - assert super.getCurrentModel() == mTabModel; - return mTabModel; - } - - @Override - public boolean isIncognitoSelected() { - return mTabModel.isIncognito(); - } - - @Override - public void closeAllTabs() { - mTabModel.closeAllTabs(); - } - - @Override - public int getTotalTabCount() { - assert mTabModel != null; - return mTabModel.getCount(); - } - - @Override - public Tab getTabById(int id) { - Tab currentTab = getCurrentTab(); - if (currentTab != null && currentTab.getId() == id) return currentTab; - return null; - } - - @Override - public TabModel getModelAt(int index) { - assert index == INCOGNITO_TAB_MODEL_INDEX || index == NORMAL_TAB_MODEL_INDEX; - return mTabModel; - } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelector.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelector.java index fdd7590de..9894ad1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelector.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelector.java
@@ -6,7 +6,6 @@ import android.support.annotation.Nullable; -import org.chromium.base.VisibleForTesting; import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior; import org.chromium.chrome.browser.tab.Tab; import org.chromium.content_public.browser.LoadUrlParams; @@ -65,12 +64,6 @@ List<TabModel> getModels(); /** - * @return the model at {@code index} or null if no model exist for that index. - */ - @VisibleForTesting - TabModel getModelAt(int index); - - /** * Get the current tab model. * @return Never returns null. Returns a stub when real model is uninitialized. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorBase.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorBase.java index b56f09e..74e6cb6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorBase.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorBase.java
@@ -17,12 +17,11 @@ * Implement methods shared across the different model implementations. */ public abstract class TabModelSelectorBase implements TabModelSelector { - public static final int NORMAL_TAB_MODEL_INDEX = 0; - public static final int INCOGNITO_TAB_MODEL_INDEX = 1; + private static final int MODEL_NOT_FOUND = -1; private static TabModelSelectorObserver sObserver; - private List<TabModel> mTabModels = Collections.emptyList(); + private List<TabModel> mTabModels = new ArrayList<>(); /** * This is a dummy implementation intended to stub out TabModelFilterProvider before native is @@ -30,7 +29,7 @@ */ private TabModelFilterProvider mTabModelFilterProvider = new TabModelFilterProvider(); - private int mActiveModelIndex = NORMAL_TAB_MODEL_INDEX; + private int mActiveModelIndex; private final ObserverList<TabModelSelectorObserver> mObservers = new ObserverList<TabModelSelectorObserver>(); private boolean mTabStateInitialized; @@ -45,16 +44,10 @@ // Only normal and incognito supported for now. assert mTabModels.isEmpty(); assert models.length > 0; - if (startIncognito) { - assert models.length > INCOGNITO_TAB_MODEL_INDEX; - } - List<TabModel> tabModels = new ArrayList<TabModel>(); - for (int i = 0; i < models.length; i++) { - tabModels.add(models[i]); - } - mActiveModelIndex = startIncognito ? INCOGNITO_TAB_MODEL_INDEX : NORMAL_TAB_MODEL_INDEX; - mTabModels = Collections.unmodifiableList(tabModels); + Collections.addAll(mTabModels, models); + mActiveModelIndex = getModelIndex(startIncognito); + assert mActiveModelIndex != MODEL_NOT_FOUND; mTabModelFilterProvider = new TabModelFilterProvider(mTabModels); TabModelObserver tabModelObserver = new EmptyTabModelObserver() { @@ -91,27 +84,21 @@ @Override public void selectModel(boolean incognito) { - TabModel previousModel = getCurrentModel(); - mActiveModelIndex = incognito ? INCOGNITO_TAB_MODEL_INDEX : NORMAL_TAB_MODEL_INDEX; - TabModel newModel = getCurrentModel(); + int newIndex = getModelIndex(incognito); + assert newIndex != MODEL_NOT_FOUND; + if (newIndex == mActiveModelIndex) return; - if (previousModel != newModel) { - for (TabModelSelectorObserver listener : mObservers) { - listener.onTabModelSelected(newModel, previousModel); - } + TabModel newModel = mTabModels.get(newIndex); + TabModel previousModel = mTabModels.get(mActiveModelIndex); + mActiveModelIndex = newIndex; + for (TabModelSelectorObserver listener : mObservers) { + listener.onTabModelSelected(newModel, previousModel); } } @Override - public TabModel getModelAt(int index) { - assert (index < mTabModels.size() && index >= 0) : - "requested index " + index + " size " + mTabModels.size(); - return mTabModels.get(index); - } - - @Override public Tab getCurrentTab() { - return getCurrentModel() == null ? null : TabModelUtils.getCurrentTab(getCurrentModel()); + return TabModelUtils.getCurrentTab(getCurrentModel()); } @Override @@ -133,7 +120,8 @@ @Override public TabModel getCurrentModel() { - return getModelAt(mActiveModelIndex); + if (mTabModels.size() == 0) return EmptyTabModel.getInstance(); + return mTabModels.get(mActiveModelIndex); } @Override @@ -143,8 +131,16 @@ @Override public TabModel getModel(boolean incognito) { - int index = incognito ? INCOGNITO_TAB_MODEL_INDEX : NORMAL_TAB_MODEL_INDEX; - return getModelAt(index); + int index = getModelIndex(incognito); + if (index == MODEL_NOT_FOUND) return EmptyTabModel.getInstance(); + return mTabModels.get(index); + } + + private int getModelIndex(boolean incognito) { + for (int i = 0; i < mTabModels.size(); i++) { + if (incognito == mTabModels.get(i).isIncognito()) return i; + } + return MODEL_NOT_FOUND; } @Override @@ -154,7 +150,7 @@ @Override public boolean isIncognitoSelected() { - return mActiveModelIndex == INCOGNITO_TAB_MODEL_INDEX; + return getCurrentModel().isIncognito(); } @Override @@ -172,7 +168,7 @@ @Override public boolean closeTab(Tab tab) { for (int i = 0; i < getModels().size(); i++) { - TabModel model = getModelAt(i); + TabModel model = mTabModels.get(i); if (model.indexOf(tab) >= 0) { return model.closeTab(tab); } @@ -191,7 +187,7 @@ @Override public Tab getTabById(int id) { for (int i = 0; i < getModels().size(); i++) { - Tab tab = TabModelUtils.getTabById(getModelAt(i), id); + Tab tab = TabModelUtils.getTabById(mTabModels.get(i), id); if (tab != null) return tab; } return null; @@ -205,7 +201,7 @@ @Override public void closeAllTabs(boolean uponExit) { for (int i = 0; i < getModels().size(); i++) { - getModelAt(i).closeAllTabs(!uponExit, uponExit); + mTabModels.get(i).closeAllTabs(!uponExit, uponExit); } } @@ -213,7 +209,7 @@ public int getTotalTabCount() { int count = 0; for (int i = 0; i < getModels().size(); i++) { - count += getModelAt(i).getCount(); + count += mTabModels.get(i).getCount(); } return count; } @@ -235,6 +231,7 @@ * Marks the task state being initialized and notifies observers. */ public void markTabStateInitialized() { + if (mTabStateInitialized) return; mTabStateInitialized = true; for (TabModelSelectorObserver listener : mObservers) listener.onTabStateInitialized(); } @@ -253,7 +250,8 @@ @Override public void destroy() { mTabModelFilterProvider.destroy(); - for (int i = 0; i < getModels().size(); i++) getModelAt(i).destroy(); + for (int i = 0; i < getModels().size(); i++) mTabModels.get(i).destroy(); + mTabModels.clear(); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java index 63e82bc..af317f6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java
@@ -30,10 +30,6 @@ new AtomicBoolean(true); private final TabPersistentStore mTabSaver; - // This flag signifies the object has gotten an onNativeReady callback and - // has not been destroyed. - private boolean mActiveState; - private boolean mIsUndoSupported; // Whether the Activity that owns that TabModelSelector is tabbed or not. @@ -117,7 +113,7 @@ * @param tabContentProvider A {@link TabContentManager} instance. */ public void onNativeLibraryReady(TabContentManager tabContentProvider) { - assert !mActiveState : "onNativeLibraryReady called twice!"; + assert mTabContentManager == null : "onNativeLibraryReady called twice!"; mTabContentManager = tabContentProvider; ChromeTabCreator regularTabCreator = @@ -147,8 +143,6 @@ } }); - mActiveState = true; - new TabModelSelectorTabObserver(this) { @Override public void onUrlUpdated(Tab tab) { @@ -215,7 +209,6 @@ @VisibleForTesting public void initializeForTesting(TabModel normalModel, TabModel incognitoModel) { initialize(isIncognitoSelected(), normalModel, incognitoModel); - mActiveState = true; } @Override @@ -224,11 +217,6 @@ } @Override - public TabModel getModelAt(int index) { - return mActiveState ? super.getModelAt(index) : EmptyTabModel.getInstance(); - } - - @Override public void selectModel(boolean incognito) { TabModel oldModel = getCurrentModel(); super.selectModel(incognito); @@ -254,7 +242,7 @@ @Override public void commitAllTabClosures() { for (int i = 0; i < getModels().size(); i++) { - getModelAt(i).commitAllTabClosures(); + getModels().get(i).commitAllTabClosures(); } } @@ -324,7 +312,6 @@ mTabSaver.destroy(); mUma.destroy(); super.destroy(); - mActiveState = false; } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java b/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java index 175ac15..957d7f7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java
@@ -186,8 +186,6 @@ cacheDownloadAutoResumptionEnabledInNative(); cachePrioritizeBootstrapTasks(); cacheFeedEnabled(); - cacheServiceManagerForDownloadResumption(); - cacheServiceManagerForBackgroundPrefetch(); cacheNetworkServiceWarmUpEnabled(); cacheImmersiveUiModeEnabled(); cacheSwapPixelFormatToFixConvertFromTranslucentEnabled(); @@ -203,6 +201,18 @@ } /** + * Caches flags that are enabled in ServiceManager only mode and must take effect on startup but + * are set via native code. This function needs to be called in ServiceManager only mode to mark + * these field trials as active, otherwise histogram data recorded in ServiceManager only mode + * won't be tagged with their corresponding field trial experiments. + */ + public static void cacheNativeFlagsForServiceManagerOnlyMode() { + // TODO(crbug.com/995355): Move other related flags from {@link cacheNativeFlags} to here. + cacheServiceManagerForDownloadResumption(); + cacheServiceManagerForBackgroundPrefetch(); + } + + /** * @return True if tab model merging for Android N+ is enabled. */ public static boolean isTabModelMergingEnabled() {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkSplashNetworkErrorObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkSplashNetworkErrorObserver.java index 26456796..47f3f7d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkSplashNetworkErrorObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkSplashNetworkErrorObserver.java
@@ -8,7 +8,6 @@ import android.content.Context; import org.chromium.base.ContextUtils; -import org.chromium.base.Log; import org.chromium.chrome.R; import org.chromium.chrome.browser.metrics.WebApkUma; import org.chromium.chrome.browser.tab.EmptyTabObserver; @@ -22,7 +21,6 @@ * start URL. */ public class WebApkSplashNetworkErrorObserver extends EmptyTabObserver { - private static final String TAG = "WebApkSplashNetObs"; private Activity mActivity; private WebApkOfflineDialog mOfflineDialog; private String mWebApkName; @@ -56,11 +54,6 @@ onNetworkChanged(tab); break; default: - // TODO(mthiesse): These logs are for debugging https://crbug.com/983769 and should - // be removed once that's resolved. - Log.d(TAG, - "Network error loading WebApk at URL: " + navigation.getUrl() - + ", with error: " + navigation.errorCode()); onNetworkError(tab, navigation.errorCode()); break; }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabsOpenedFromExternalAppTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabsOpenedFromExternalAppTest.java index 6f07013..841a1735 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabsOpenedFromExternalAppTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabsOpenedFromExternalAppTest.java
@@ -479,10 +479,9 @@ Assert.assertEquals("Selected tab is not on the right URL.", url1, mActivityTestRule.getActivity().getActivityTab().getUrl()); - int originalTabCount = ChromeTabUtils.getNumOpenTabs(mActivityTestRule.getActivity()); // Launch the same URL without app ID. It should open a new tab. - originalTabCount = ChromeTabUtils.getNumOpenTabs(mActivityTestRule.getActivity()); + int originalTabCount = ChromeTabUtils.getNumOpenTabs(mActivityTestRule.getActivity()); launchUrlFromExternalApp(url1, null, false); int newTabCount = ChromeTabUtils.getNumOpenTabs(mActivityTestRule.getActivity()); Assert.assertEquals("Incorrect number of tabs open", originalTabCount + 1, newTabCount);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkBridgeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkBridgeTest.java index 93f6b52e6..4407a272f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkBridgeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkBridgeTest.java
@@ -52,7 +52,7 @@ TestThreadUtils.runOnUiThreadBlocking(() -> { Profile profile = Profile.getLastUsedProfile(); mBookmarkBridge = new BookmarkBridge(profile); - mBookmarkBridge.loadEmptyPartnerBookmarkShimForTesting(); + mBookmarkBridge.loadFakePartnerBookmarkShimForTesting(); }); BookmarkTestUtil.waitForBookmarkModelLoaded(); @@ -266,4 +266,52 @@ } return newOrder; } + + @Test + @SmallTest + @UiThreadTest + @Feature({"Bookmark"}) + public void testSearchPartner() { + List<BookmarkId> expectedSearchResults = new ArrayList<>(); + expectedSearchResults.add(new BookmarkId( + 1, 1)); // Partner bookmark with ID 1: "Partner Bookmark A", http://a.com + expectedSearchResults.add(new BookmarkId( + 2, 1)); // Partner bookmark with ID 2: "Partner Bookmark B", http://b.com + List<BookmarkId> searchResults = mBookmarkBridge.searchBookmarks("pArTnER BookMARK", 100); + Assert.assertEquals("Expected search results would yield partner bookmark with " + + "case-insensitive title match", + expectedSearchResults, searchResults); + } + + @Test + @SmallTest + @UiThreadTest + @Feature({"Bookmark"}) + public void testSearchFolder() { + List<BookmarkId> expectedSearchResults = new ArrayList<>(); + expectedSearchResults.add(mBookmarkBridge.addFolder(mMobileNode, 0, "FooBar")); + List<BookmarkId> searchResults = mBookmarkBridge.searchBookmarks("oba", 100); + Assert.assertEquals("Expected search results would yield case-insensitive match of " + + "part of title", + expectedSearchResults, searchResults); + } + + @Test + @SmallTest + @UiThreadTest + @Feature({"Bookmark"}) + public void testSearch_MaxResults() { + List<BookmarkId> expectedSearchResults = new ArrayList<>(); + expectedSearchResults.add(mBookmarkBridge.addFolder(mMobileNode, 0, "FooBar")); + expectedSearchResults.add(mBookmarkBridge.addFolder(mMobileNode, 1, "BazQuux")); + expectedSearchResults.add(new BookmarkId( + 1, 1)); // Partner bookmark with ID 1: "Partner Bookmark A", http://a.com + + List<BookmarkId> searchResults = mBookmarkBridge.searchBookmarks("a", 3); + Assert.assertEquals( + "Expected search results size to be 3 (maximum size)", 3, searchResults.size()); + Assert.assertEquals("Expected that user (non-partner) bookmarks would get priority " + + "over partner bookmarks", + expectedSearchResults, searchResults); + } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java index 9affd43..18e0b0ae 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java
@@ -27,7 +27,6 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.RetryOnFailure; import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ChromeSwitches; @@ -414,7 +413,6 @@ @Test @SmallTest @RetryOnFailure - @DisabledTest(message = "crbug.com/993149") public void testOpenWindowFromLinkUserGesture() throws InterruptedException { boolean opensNewTab = !(mActivityTestRule.getActivity().getCurrentTabModel() instanceof SingleTabModel); @@ -425,7 +423,6 @@ @Test @SmallTest @RetryOnFailure - @DisabledTest(message = "crbug.com/993149") public void testOpenWindowFromSvgUserGesture() throws InterruptedException { boolean opensNewTab = !(mActivityTestRule.getActivity().getCurrentTabModel() instanceof SingleTabModel);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/UndoTabModelTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/UndoTabModelTest.java index bddc99b03..63b9157 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/UndoTabModelTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/UndoTabModelTest.java
@@ -283,7 +283,7 @@ () -> { ((TabModelSelectorImpl) selector).saveState(); }); for (int i = 0; i < selector.getModels().size(); i++) { - TabList tabs = selector.getModelAt(i).getComprehensiveModel(); + TabList tabs = selector.getModels().get(i).getComprehensiveModel(); for (int j = 0; j < tabs.getCount(); j++) { Assert.assertFalse(tabs.isClosurePending(tabs.getTabAt(j).getId())); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskSchedulerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskSchedulerTest.java index ae09311..1adf616 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskSchedulerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/background_sync/BackgroundSyncBackgroundTaskSchedulerTest.java
@@ -28,7 +28,6 @@ import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.background_sync.BackgroundSyncBackgroundTaskScheduler.BackgroundSyncTask; -import org.chromium.chrome.browser.background_task_scheduler.ChromeBackgroundTaskFactory; import org.chromium.chrome.browser.background_task_scheduler.NativeBackgroundTask; import org.chromium.chrome.test.support.DisableHistogramsRule; import org.chromium.components.background_task_scheduler.BackgroundTaskScheduler; @@ -58,7 +57,6 @@ public void setUp() throws Exception { MockitoAnnotations.initMocks(this); BackgroundTaskSchedulerFactory.setSchedulerForTesting(mTaskScheduler); - ChromeBackgroundTaskFactory.setAsDefault(); HashMap<String, Boolean> features = new HashMap<String, Boolean>(); features.put(ChromeFeatureList.BACKGROUND_TASK_SCHEDULER_FOR_BACKGROUND_SYNC, true); ChromeFeatureList.setTestFeatures(features);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTaskUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTaskUnitTest.java index 753f542..d61ec381 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTaskUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTaskUnitTest.java
@@ -133,8 +133,6 @@ mFakeTaskScheduler = new FakeBackgroundTaskScheduler(); BackgroundTaskSchedulerFactory.setSchedulerForTesting(mFakeTaskScheduler); - - PrefetchBackgroundTask.skipCachingFlagForTesting(); } @Test
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/suggestions/basic/BasicSuggestionProcessorTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/suggestions/basic/BasicSuggestionProcessorTest.java index 205da3b..2ec63673 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/suggestions/basic/BasicSuggestionProcessorTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/suggestions/basic/BasicSuggestionProcessorTest.java
@@ -152,7 +152,7 @@ public void getSuggestionIconTypeForUrl_Default() { int[][] testSuites = { {OmniboxSuggestionType.URL_WHAT_YOU_TYPED, SuggestionIcon.GLOBE}, - {OmniboxSuggestionType.HISTORY_URL, SuggestionIcon.HISTORY}, + {OmniboxSuggestionType.HISTORY_URL, SuggestionIcon.GLOBE}, {OmniboxSuggestionType.HISTORY_TITLE, SuggestionIcon.GLOBE}, {OmniboxSuggestionType.HISTORY_BODY, SuggestionIcon.GLOBE}, {OmniboxSuggestionType.HISTORY_KEYWORD, SuggestionIcon.GLOBE},
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java index 6552a83..4438bc56 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java
@@ -40,7 +40,6 @@ import org.chromium.base.test.util.JniMocker; import org.chromium.blink_public.platform.WebDisplayMode; import org.chromium.chrome.browser.ShortcutHelper; -import org.chromium.chrome.browser.background_task_scheduler.ChromeBackgroundTaskFactory; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.util.test.ShadowUrlUtilities; import org.chromium.chrome.test.support.DisableHistogramsRule; @@ -500,8 +499,6 @@ storage.updateTimeOfLastCheckForUpdatedWebManifest(); storage.updateTimeOfLastWebApkUpdateRequestCompletion(); storage.updateDidLastWebApkUpdateRequestSucceed(true); - - ChromeBackgroundTaskFactory.setAsDefault(); } @After
diff --git a/chrome/android/modules/chrome_feature_module_tmpl.gni b/chrome/android/modules/chrome_feature_module_tmpl.gni index 5121556..d41be23 100644 --- a/chrome/android/modules/chrome_feature_module_tmpl.gni +++ b/chrome/android/modules/chrome_feature_module_tmpl.gni
@@ -101,25 +101,6 @@ not_needed([ "_is_monochrome_or_trichrome" ]) } - if (defined(_module_desc.loadable_module_dep)) { - assert(defined(_module_desc.loadable_module)) - deps += [ _module_desc.loadable_module_dep ] - if (android_64bit_target_cpu) { - _32_bit_toolchain_root_dir = - get_label_info(":foo($android_secondary_abi_toolchain)", - "root_out_dir") - _loadable_modules_64_bit = - [ "$root_out_dir/${_module_desc.loadable_module}" ] - _loadable_modules_32_bit = - [ "$_32_bit_toolchain_root_dir/${_module_desc.loadable_module}" ] - deps += [ _module_desc.loadable_module_dep + - "($android_secondary_abi_toolchain)" ] - } else { - _loadable_modules_32_bit = - [ "$root_out_dir/${_module_desc.loadable_module}" ] - } - } - # Specify native libraries and placeholders. if (_loadable_modules_32_bit != [] || _loadable_modules_64_bit != []) { # Decision logic: Assign decision variables:
diff --git a/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/NoTouchActivity.java b/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/NoTouchActivity.java index 09a75c7..22b026f 100644 --- a/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/NoTouchActivity.java +++ b/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/NoTouchActivity.java
@@ -147,8 +147,6 @@ ((TouchlessTabCreator) getTabCreator(false)) .setTabModel(getTabModelSelector().getModel(false)); - ((TouchlessTabCreator) getTabCreator(true)) - .setTabModel(getTabModelSelector().getModel(true)); super.initializeState();
diff --git a/chrome/app/chrome_crash_reporter_client.cc b/chrome/app/chrome_crash_reporter_client.cc index 72da91f..ce1bd30b9 100644 --- a/chrome/app/chrome_crash_reporter_client.cc +++ b/chrome/app/chrome_crash_reporter_client.cc
@@ -46,6 +46,23 @@ crash_reporter::SetCrashReporterClient(crash_client.get()); } +#if defined(OS_CHROMEOS) +// static +bool ChromeCrashReporterClient::ShouldPassCrashLoopBefore( + const std::string& process_type) { + if (process_type == ::switches::kRendererProcess || + process_type == ::switches::kUtilityProcess || + process_type == ::switches::kPpapiPluginProcess || + process_type == service_manager::switches::kZygoteProcess) { + // These process types never cause a log-out, even if they crash. So the + // normal crash handling process should work fine; we shouldn't need to + // invoke the special crash-loop mode. + return false; + } + return true; +} +#endif + ChromeCrashReporterClient::ChromeCrashReporterClient() {} ChromeCrashReporterClient::~ChromeCrashReporterClient() {}
diff --git a/chrome/app/chrome_crash_reporter_client.h b/chrome/app/chrome_crash_reporter_client.h index fa5f6d7..076f3310 100644 --- a/chrome/app/chrome_crash_reporter_client.h +++ b/chrome/app/chrome_crash_reporter_client.h
@@ -19,6 +19,13 @@ public: static void Create(); +#if defined(OS_CHROMEOS) + // If true, processes of this type should pass crash-loop-before down to the + // crash reporter and to their children (if the children's type is a process + // type that wants crash-loop-before). + static bool ShouldPassCrashLoopBefore(const std::string& process_type); +#endif + // crash_reporter::CrashReporterClient implementation. #if !defined(OS_MACOSX) && !defined(OS_ANDROID) void SetCrashReporterClientIdFromGUID(
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index ed81e084..c02a4dbf 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -3378,7 +3378,10 @@ <message name="IDS_CROSTINI_INSTALLER_ERROR_TITLE" desc="Title of the Crostini installer when an error occurs."> Error installing Linux... </message> - <message name="IDS_CROSTINI_INSTALLER_LOAD_TERMINA_MESSAGE" desc="Text shown in the Crostini installer dialog when the VM component is loading"> + <message name="IDS_CROSTINI_INSTALLER_COMPLETE" desc="Text shown in the Crostini installer dialog when installation is complete."> + Linux installation is complete. + </message> + <message name="IDS_CROSTINI_INSTALLER_LOAD_TERMINA_MESSAGE" desc="Text shown in the Crostini installer dialog when the VM component is loading"> This process may take a few minutes. Downloading the virtual machine. </message> <message name="IDS_CROSTINI_INSTALLER_START_CONCIERGE_MESSAGE" desc="Text shown in the Crostini installer dialog when the VM service is starting">
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index 1d3a57ac..46ff9ee 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -1476,7 +1476,7 @@ Add Printer </message> <message name="IDS_SETTINGS_PRINTING_CUPS_PRINTERS_ADD_DETECTED_OR_NEW_PRINTER" desc="In CUPS printing settings subpage, explanatory text for the nearby printers list."> - Saved detected printers to your profile, or add a new printer. + Save detected printers to your profile, or add a new printer. </message> <message name="IDS_SETTINGS_PRINTING_CUPS_PRINTERS_AVAILABLE_PRINTERS" desc="In CUPS printing settings subpage, title for the nearby printers list."> Available printers to save
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 122e93c..4c8b6c7 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -2234,8 +2234,6 @@ "android/background_sync_launcher_android.h", "android/background_tab_manager.cc", "android/background_tab_manager.h", - "android/background_task_scheduler/chrome_background_task_factory.cc", - "android/background_task_scheduler/chrome_background_task_factory.h", "android/bookmarks/bookmark_bridge.cc", "android/bookmarks/bookmark_bridge.h", "android/bookmarks/partner_bookmarks_reader.cc",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 7d7f851..0a23728 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -4333,6 +4333,13 @@ flag_descriptions::kBundledHTTPExchangesDescription, kOsAll, FEATURE_VALUE_TYPE(features::kBundledHTTPExchanges)}, +#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) + {"profile-menu-revamp", flag_descriptions::kProfileMenuRevampName, + flag_descriptions::kProfileMenuRevampDescription, + kOsWin | kOsMac | kOsLinux, + FEATURE_VALUE_TYPE(features::kProfileMenuRevamp)}, +#endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) + // NOTE: Adding a new flag requires adding a corresponding entry to enum // "LoginCustomFlags" in tools/metrics/histograms/enums.xml. See "Flag // Histograms" in tools/metrics/histograms/README.md (run the
diff --git a/chrome/browser/android/background_task_scheduler/chrome_background_task_factory.cc b/chrome/browser/android/background_task_scheduler/chrome_background_task_factory.cc deleted file mode 100644 index 672c059..0000000 --- a/chrome/browser/android/background_task_scheduler/chrome_background_task_factory.cc +++ /dev/null
@@ -1,15 +0,0 @@ -// Copyright 2019 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/android/background_task_scheduler/chrome_background_task_factory.h" - -#include "chrome/android/chrome_jni_headers/ChromeBackgroundTaskFactory_jni.h" - -ChromeBackgroundTaskFactory::~ChromeBackgroundTaskFactory() = default; - -// static -void ChromeBackgroundTaskFactory::SetAsDefault() { - JNIEnv* env = base::android::AttachCurrentThread(); - Java_ChromeBackgroundTaskFactory_setAsDefault(env); -}
diff --git a/chrome/browser/android/background_task_scheduler/chrome_background_task_factory.h b/chrome/browser/android/background_task_scheduler/chrome_background_task_factory.h deleted file mode 100644 index 1a76d261..0000000 --- a/chrome/browser/android/background_task_scheduler/chrome_background_task_factory.h +++ /dev/null
@@ -1,31 +0,0 @@ -// Copyright 2019 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_ANDROID_BACKGROUND_TASK_SCHEDULER_CHROME_BACKGROUND_TASK_FACTORY_H_ -#define CHROME_BROWSER_ANDROID_BACKGROUND_TASK_SCHEDULER_CHROME_BACKGROUND_TASK_FACTORY_H_ - -// Intermediate that sets the ChromeBackgroundTaskFactory from C++. The C++ code -// does not call ChromeApplication (java initializations), so this setting was -// necessary for associating task ids with corresponding BackgroundTask classes -// for BackgroundTaskScheduler. This class can be used to set the default -// factory class to ChromeBackgroundTaskFactory by calling -// ChromeBackgroundTaskFactory::SetAsDefault(). -class ChromeBackgroundTaskFactory { - public: - // Disable default constructor. - ChromeBackgroundTaskFactory() = delete; - - // Disable copy (and move) semantics. - ChromeBackgroundTaskFactory(const ChromeBackgroundTaskFactory&) = delete; - ChromeBackgroundTaskFactory& operator=(const ChromeBackgroundTaskFactory&) = - delete; - - ~ChromeBackgroundTaskFactory(); - - // Sets the default factory implementation in //chrome for associating task - // ids with corresponding BackgroundTask classes. - static void SetAsDefault(); -}; - -#endif // CHROME_BROWSER_ANDROID_BACKGROUND_TASK_SCHEDULER_CHROME_BACKGROUND_TASK_FACTORY_H_
diff --git a/chrome/browser/android/bookmarks/bookmark_bridge.cc b/chrome/browser/android/bookmarks/bookmark_bridge.cc index 8968534..4d9048b 100644 --- a/chrome/browser/android/bookmarks/bookmark_bridge.cc +++ b/chrome/browser/android/bookmarks/bookmark_bridge.cc
@@ -15,7 +15,10 @@ #include "base/containers/adapters.h" #include "base/containers/stack.h" #include "base/containers/stack_container.h" +#include "base/guid.h" #include "base/i18n/string_compare.h" +#include "base/strings/string16.h" +#include "base/strings/utf_string_conversions.h" #include "chrome/android/chrome_jni_headers/BookmarkBridge_jni.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" @@ -159,6 +162,29 @@ DCHECK(partner_bookmarks_shim_->IsLoaded()); } +// Loads a fake partner bookmarks shim for testing. +// This is used in BookmarkBridgeTest.java. +void BookmarkBridge::LoadFakePartnerBookmarkShimForTesting( + JNIEnv* env, + const JavaParamRef<jobject>& obj) { + if (partner_bookmarks_shim_->IsLoaded()) + return; + std::unique_ptr<BookmarkPermanentNode> root_partner_node = + std::make_unique<BookmarkPermanentNode>(0, BookmarkNode::FOLDER); + BookmarkNode* partner_bookmark_a = + root_partner_node->Add(std::make_unique<BookmarkNode>( + 1, base::GenerateGUID(), GURL("http://www.a.com"))); + partner_bookmark_a->SetTitle(base::ASCIIToUTF16("Partner Bookmark A")); + BookmarkNode* partner_bookmark_b = + root_partner_node->Add(std::make_unique<BookmarkNode>( + 2, base::GenerateGUID(), GURL("http://www.b.com"))); + partner_bookmark_b->SetTitle(base::ASCIIToUTF16("Partner Bookmark B")); + partner_bookmarks_shim_->SetPartnerBookmarksRoot( + std::move(root_partner_node)); + PartnerBookmarksShim::DisablePartnerBookmarksEditing(); + DCHECK(partner_bookmarks_shim_->IsLoaded()); +} + ScopedJavaLocalRef<jobject> BookmarkBridge::GetBookmarkByID( JNIEnv* env, const JavaParamRef<jobject>& obj, @@ -594,6 +620,12 @@ GetBookmarksMatchingProperties(bookmark_model_, query, max_results, &results); + if (partner_bookmarks_shim_->HasPartnerBookmarks() && + IsReachable(partner_bookmarks_shim_->GetPartnerBookmarksRoot())) { + partner_bookmarks_shim_->GetPartnerBookmarksMatchingProperties( + query, max_results, &results); + } + DCHECK((int)results.size() <= max_results); for (const bookmarks::BookmarkNode* match : results) { // If this bookmark is a partner bookmark if (partner_bookmarks_shim_->IsPartnerBookmark(match) &&
diff --git a/chrome/browser/android/bookmarks/bookmark_bridge.h b/chrome/browser/android/bookmarks/bookmark_bridge.h index c50c876..73795607 100644 --- a/chrome/browser/android/bookmarks/bookmark_bridge.h +++ b/chrome/browser/android/bookmarks/bookmark_bridge.h
@@ -8,7 +8,10 @@ #include "base/android/jni_android.h" #include "base/android/jni_weak_ref.h" #include "base/compiler_specific.h" +#include "base/guid.h" #include "base/macros.h" +#include "base/strings/string16.h" +#include "base/strings/utf_string_conversions.h" #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" #include "components/bookmarks/browser/base_bookmark_model_observer.h" #include "components/bookmarks/common/android/bookmark_id.h" @@ -42,6 +45,12 @@ JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); + // Loads a fake partner bookmarks shim for testing. + // This is used in BookmarkBridgeTest.java. + void LoadFakePartnerBookmarkShimForTesting( + JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj); + base::android::ScopedJavaLocalRef<jobject> GetBookmarkByID( JNIEnv* env, const base::android::JavaParamRef<jobject>& obj,
diff --git a/chrome/browser/android/bookmarks/partner_bookmarks_shim.cc b/chrome/browser/android/bookmarks/partner_bookmarks_shim.cc index 87a37053..7bedaa02 100644 --- a/chrome/browser/android/bookmarks/partner_bookmarks_shim.cc +++ b/chrome/browser/android/bookmarks/partner_bookmarks_shim.cc
@@ -7,16 +7,23 @@ #include <tuple> #include <utility> +#include "base/i18n/case_conversion.h" +#include "base/i18n/string_search.h" #include "base/lazy_instance.h" #include "base/memory/ptr_util.h" +#include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" #include "components/bookmarks/browser/bookmark_model.h" +#include "components/bookmarks/browser/bookmark_utils.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h" +#include "components/url_formatter/url_formatter.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" +#include "net/base/escape.h" +#include "ui/base/models/tree_node_iterator.h" using bookmarks::BookmarkNode; using content::BrowserThread; @@ -290,3 +297,30 @@ } prefs_->Set(prefs::kPartnerBookmarkMappings, list); } + +void PartnerBookmarksShim::GetPartnerBookmarksMatchingProperties( + const bookmarks::QueryFields& query, + size_t max_count, + std::vector<const BookmarkNode*>* nodes) { + DCHECK(nodes->size() <= max_count); + + std::vector<base::string16> query_words = + bookmarks::ParseBookmarkQuery(query); + if (query_words.empty()) + return; + ui::TreeNodeIterator<const BookmarkNode> iterator(GetPartnerBookmarksRoot()); + // The check that size < max_count is necessary because we will search for + // user (non-partner) bookmarks before calling this function + while (iterator.has_next() && nodes->size() < max_count) { + const BookmarkNode* node = iterator.Next(); + // Make sure we don't include the "Partner Bookmarks" folder + if (node == GetPartnerBookmarksRoot()) + continue; + if (!query_words.empty() && !bookmarks::DoesBookmarkContainWords( + GetTitle(node), node->url(), query_words)) + continue; + if (query.title && GetTitle(node) != *query.title) + continue; + nodes->push_back(node); + } +}
diff --git a/chrome/browser/android/bookmarks/partner_bookmarks_shim.h b/chrome/browser/android/bookmarks/partner_bookmarks_shim.h index 7e402db..d962a2e 100644 --- a/chrome/browser/android/bookmarks/partner_bookmarks_shim.h +++ b/chrome/browser/android/bookmarks/partner_bookmarks_shim.h
@@ -10,10 +10,17 @@ #include <memory> #include "base/android/jni_weak_ref.h" +#include "base/i18n/case_conversion.h" +#include "base/i18n/string_search.h" #include "base/macros.h" #include "base/strings/string16.h" +#include "base/strings/utf_string_conversions.h" #include "base/supports_user_data.h" #include "components/bookmarks/browser/bookmark_model.h" +#include "components/bookmarks/browser/bookmark_utils.h" +#include "components/url_formatter/url_formatter.h" +#include "net/base/escape.h" +#include "ui/base/models/tree_node_iterator.h" #include "url/gurl.h" class PrefService; @@ -116,6 +123,12 @@ }; typedef std::map<NodeRenamingMapKey, base::string16> NodeRenamingMap; + // PartnerBookmarksShim version of BookmarkUtils methods + void GetPartnerBookmarksMatchingProperties( + const bookmarks::QueryFields& query, + size_t max_count, + std::vector<const bookmarks::BookmarkNode*>* nodes); + // For testing: clears an instance of the shim in a given |browser_context|. static void ClearInBrowserContextForTesting( content::BrowserContext* browser_context);
diff --git a/chrome/browser/android/bookmarks/partner_bookmarks_shim_unittest.cc b/chrome/browser/android/bookmarks/partner_bookmarks_shim_unittest.cc index 109efd35..3ff522fb 100644 --- a/chrome/browser/android/bookmarks/partner_bookmarks_shim_unittest.cc +++ b/chrome/browser/android/bookmarks/partner_bookmarks_shim_unittest.cc
@@ -409,3 +409,78 @@ EXPECT_EQ(base::ASCIIToUTF16("a"), shim->GetTitle(partner_bookmark1)); EXPECT_TRUE(shim->IsReachable(partner_bookmark2)); } + +TEST_F(PartnerBookmarksShimTest, GetPartnerBookmarksMatchingProperties) { + std::unique_ptr<BookmarkPermanentNode> root_partner_node = + std::make_unique<BookmarkPermanentNode>(0, BookmarkNode::FOLDER); + BookmarkNode* partner_folder1 = root_partner_node->Add( + std::make_unique<BookmarkNode>(1, base::GenerateGUID(), GURL())); + partner_folder1->SetTitle(base::ASCIIToUTF16("Folder1")); + + BookmarkNode* partner_folder2 = partner_folder1->Add( + std::make_unique<BookmarkNode>(2, base::GenerateGUID(), GURL())); + partner_folder2->SetTitle(base::ASCIIToUTF16("Folder2")); + + BookmarkNode* partner_bookmark1 = + partner_folder1->Add(std::make_unique<BookmarkNode>( + 3, base::GenerateGUID(), GURL("http://www.ugtdat.com"))); + partner_bookmark1->SetTitle(base::ASCIIToUTF16("wx")); + + BookmarkNode* partner_bookmark2 = + partner_folder2->Add(std::make_unique<BookmarkNode>( + 4, base::GenerateGUID(), GURL("http://argbhl.com"))); + partner_bookmark2->SetTitle(base::ASCIIToUTF16("wx yz")); + + PartnerBookmarksShim* shim = partner_bookmarks_shim(); + ASSERT_FALSE(shim->IsLoaded()); + shim->SetPartnerBookmarksRoot(std::move(root_partner_node)); + ASSERT_TRUE(shim->IsLoaded()); + + // Ensure that search returns case-insensitive matches for title only. + std::vector<const BookmarkNode*> nodes; + bookmarks::QueryFields query; + query.word_phrase_query.reset(new base::string16(base::ASCIIToUTF16("WX"))); + shim->GetPartnerBookmarksMatchingProperties(query, 100, &nodes); + ASSERT_EQ(2u, nodes.size()); + ASSERT_EQ(partner_bookmark1, nodes[1]); + ASSERT_EQ(partner_bookmark2, nodes[0]); + + // Ensure that every word in the search must have a match. + nodes.clear(); + query.word_phrase_query.reset(new base::string16(base::ASCIIToUTF16("WX Y"))); + shim->GetPartnerBookmarksMatchingProperties(query, 100, &nodes); + ASSERT_EQ(1u, nodes.size()); + ASSERT_EQ(partner_bookmark2, nodes[0]); + + // Ensure that search returns matches for URL only. + nodes.clear(); + query.word_phrase_query.reset( + new base::string16(base::ASCIIToUTF16("dat.com"))); + shim->GetPartnerBookmarksMatchingProperties(query, 100, &nodes); + ASSERT_EQ(1u, nodes.size()); + ASSERT_EQ(partner_bookmark1, nodes[0]); + + // Ensure that folders appear in search results, and that max_count is + // effective. + nodes.clear(); + query.word_phrase_query.reset( + new base::string16(base::ASCIIToUTF16("folder"))); + + shim->GetPartnerBookmarksMatchingProperties(query, 100, &nodes); + ASSERT_EQ(2u, nodes.size()); + + nodes.clear(); + shim->GetPartnerBookmarksMatchingProperties(query, 1, &nodes); + ASSERT_EQ(1u, nodes.size()); + + nodes.clear(); + shim->GetPartnerBookmarksMatchingProperties(query, 0, &nodes); + ASSERT_EQ(0u, nodes.size()); + + // Test a scenario with no search results. + nodes.clear(); + query.word_phrase_query.reset( + new base::string16(base::ASCIIToUTF16("foo.com"))); + shim->GetPartnerBookmarksMatchingProperties(query, 100, &nodes); + ASSERT_EQ(0u, nodes.size()); +}
diff --git a/chrome/browser/android/contextualsearch/contextual_search_delegate_unittest.cc b/chrome/browser/android/contextualsearch/contextual_search_delegate_unittest.cc index 134daaa..06465fb 100644 --- a/chrome/browser/android/contextualsearch/contextual_search_delegate_unittest.cc +++ b/chrome/browser/android/contextualsearch/contextual_search_delegate_unittest.cc
@@ -288,8 +288,8 @@ std::string search_url_preload_; int coca_card_tag_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<TemplateURLService> template_url_service_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_url_loader_factory_;
diff --git a/chrome/browser/android/crash/OWNERS b/chrome/browser/android/crash/OWNERS deleted file mode 100644 index 283f687a..0000000 --- a/chrome/browser/android/crash/OWNERS +++ /dev/null
@@ -1,2 +0,0 @@ -wnwen@chromium.org -yfriedman@chromium.org
diff --git a/chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc b/chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc index b71f0a0..0c25b66e 100644 --- a/chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc +++ b/chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc
@@ -111,7 +111,7 @@ GURL request_url_; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; data_decoder::TestingJsonParser::ScopedFactoryOverride factory_override_; content::TestBrowserThread io_thread_; network::TestURLLoaderFactory test_url_loader_factory_;
diff --git a/chrome/browser/android/download/download_manager_service_unittest.cc b/chrome/browser/android/download/download_manager_service_unittest.cc index 65a476d..bd2d1e1 100644 --- a/chrome/browser/android/download/download_manager_service_unittest.cc +++ b/chrome/browser/android/download/download_manager_service_unittest.cc
@@ -69,7 +69,7 @@ return download_.get(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DownloadManagerService* service_; download::SimpleDownloadManagerCoordinator coordinator_; std::unique_ptr<download::MockDownloadItem> download_;
diff --git a/chrome/browser/android/explore_sites/image_helper_unittest.cc b/chrome/browser/android/explore_sites/image_helper_unittest.cc index 013aa9b..17e4fff8 100644 --- a/chrome/browser/android/explore_sites/image_helper_unittest.cc +++ b/chrome/browser/android/explore_sites/image_helper_unittest.cc
@@ -69,7 +69,7 @@ std::vector<std::unique_ptr<SkBitmap>> last_bitmap_list; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<service_manager::Connector> GetConnector() { return connector_factory_.CreateConnector(); @@ -97,7 +97,7 @@ image_helper.ComposeSiteImage(StoreBitmap(), GetEncodedImageList(1), GetConnector()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_NE(nullptr, last_bitmap_list[0]); EXPECT_FALSE(last_bitmap_list[0]->isNull()); @@ -111,14 +111,14 @@ ImageHelper image_helper; image_helper.ComposeSiteImage(StoreBitmap(), GetEncodedImageList(1), GetConnector()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_NE(nullptr, last_bitmap_list[0]); EXPECT_FALSE(last_bitmap_list[0]->isNull()); image_helper.ComposeSiteImage(StoreBitmap(), GetEncodedImageList(1), GetConnector()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_NE(nullptr, last_bitmap_list[1]); EXPECT_FALSE(last_bitmap_list[1]->isNull()); @@ -131,7 +131,7 @@ GetConnector()); image_helper.ComposeSiteImage(StoreBitmap(), GetEncodedImageList(1), GetConnector()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_NE(nullptr, last_bitmap_list[0]); EXPECT_FALSE(last_bitmap_list[0]->isNull()); @@ -144,7 +144,7 @@ ImageHelper image_helper; image_helper.ComposeCategoryImage(StoreBitmap(), kIconSize, GetEncodedImageList(1), GetConnector()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_NE(nullptr, last_bitmap_list[0]); EXPECT_FALSE(last_bitmap_list[0]->isNull()); @@ -171,7 +171,7 @@ ImageHelper image_helper; image_helper.ComposeCategoryImage(StoreBitmap(), kIconSize, GetEncodedImageList(2), GetConnector()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_NE(nullptr, last_bitmap_list[0]); EXPECT_FALSE(last_bitmap_list[0]->isNull()); @@ -197,7 +197,7 @@ ImageHelper image_helper; image_helper.ComposeCategoryImage(StoreBitmap(), kIconSize, GetEncodedImageList(3), GetConnector()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_NE(nullptr, last_bitmap_list[0]); EXPECT_FALSE(last_bitmap_list[0]->isNull()); @@ -226,7 +226,7 @@ ImageHelper image_helper; image_helper.ComposeCategoryImage(StoreBitmap(), kIconSize, GetEncodedImageList(4), GetConnector()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_NE(nullptr, last_bitmap_list[0]); EXPECT_FALSE(last_bitmap_list[0]->isNull()); @@ -267,7 +267,7 @@ image_helper.ComposeCategoryImage(StoreBitmap(), kIconSize, std::move(image_list), GetConnector()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); if (i == 0) { ASSERT_EQ(nullptr, last_bitmap_list[i]); @@ -285,7 +285,7 @@ // Record one success UMA from CompseSiteImage. image_helper.ComposeSiteImage(StoreBitmap(), GetEncodedImageList(1), GetConnector()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); histograms().ExpectTotalCount("ExploreSites.ImageDecoded", 1); histograms().ExpectBucketCount("ExploreSites.ImageDecoded", true, 1); @@ -295,7 +295,7 @@ image_list.push_back(std::make_unique<EncodedImageBytes>(kInvalidWebpBytes)); image_helper.ComposeSiteImage(StoreBitmap(), std::move(image_list), GetConnector()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); histograms().ExpectTotalCount("ExploreSites.ImageDecoded", 2); histograms().ExpectBucketCount("ExploreSites.ImageDecoded", false, 1); @@ -303,7 +303,7 @@ // Record 2 samples from ComposeCategoryImage. image_helper.ComposeCategoryImage(StoreBitmap(), kIconSize, GetEncodedImageList(2), GetConnector()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); histograms().ExpectTotalCount("ExploreSites.ImageDecoded", 4); histograms().ExpectBucketCount("ExploreSites.ImageDecoded", true, 3);
diff --git a/chrome/browser/android/oom_intervention/near_oom_monitor_unittest.cc b/chrome/browser/android/oom_intervention/near_oom_monitor_unittest.cc index 73f7fdf..adae8fc 100644 --- a/chrome/browser/android/oom_intervention/near_oom_monitor_unittest.cc +++ b/chrome/browser/android/oom_intervention/near_oom_monitor_unittest.cc
@@ -82,7 +82,7 @@ protected: scoped_refptr<base::TestMockTimeTaskRunner> task_runner_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockNearOomMonitor> monitor_; };
diff --git a/chrome/browser/android/vr/BUILD.gn b/chrome/browser/android/vr/BUILD.gn index 3deba2912..03fba1b 100644 --- a/chrome/browser/android/vr/BUILD.gn +++ b/chrome/browser/android/vr/BUILD.gn
@@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/config/android/rules.gni") +import("//chrome/android/modules/buildflags.gni") import("//chrome/common/features.gni") import("//device/vr/buildflags/buildflags.gni") import("//testing/test.gni") @@ -179,27 +180,23 @@ ] } -# Similar to the ui_default_factory but also tries to open a dummy lib for the -# purpose of exercising the library loading mechanism. -source_set("ui_module_dummy_factory") { - sources = [ - "ui_module_dummy_factory.cc", - "ui_module_dummy_factory.h", - ] - deps = [ - ":ui_factory", - "//chrome/browser/vr:vr_base", - "//chrome/browser/vr:vr_ui", - ] -} - -# A dummy lib used to test the library loading mechanism. -loadable_module("vr_ui_dummy_lib") { - sources = [ - "ui_dummy.cc", - "ui_dummy.h", - ] - no_default_deps = true +# A top-level module factory target to be included by Chrome's main library +# target. Ideally, this would be pulled in by vr_android. However, vr_android +# is a dep of both Chrome and VR unit tests, and unit tests always require the +# non-module version of the factory. As such, vr_android doesn't know which +# factory it needs to use. The fact that vr_android has an implicity circular +# dependency on chrome/browser precludes the use of an intermediate target (eg. +# vr_android_with_factory). +group("module_factory") { + if (use_native_modules && modularize_vr_native) { + deps = [ + ":ui_module_factory", + ] + } else { + deps = [ + ":ui_default_factory", + ] + } } android_library("ar_java") {
diff --git a/chrome/browser/android/vr/test/ar_test_suite.cc b/chrome/browser/android/vr/test/ar_test_suite.cc index d236a08d3..3a58898 100644 --- a/chrome/browser/android/vr/test/ar_test_suite.cc +++ b/chrome/browser/android/vr/test/ar_test_suite.cc
@@ -24,9 +24,8 @@ void ArTestSuite::Initialize() { base::TestSuite::Initialize(); - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + task_environment_ = std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::MainThreadType::UI); mojo::core::Init();
diff --git a/chrome/browser/android/vr/test/ar_test_suite.h b/chrome/browser/android/vr/test/ar_test_suite.h index 39d9a541..2154b66b 100644 --- a/chrome/browser/android/vr/test/ar_test_suite.h +++ b/chrome/browser/android/vr/test/ar_test_suite.h
@@ -9,7 +9,7 @@ namespace base { namespace test { -class ScopedTaskEnvironment; +class TaskEnvironment; } // namespace test } // namespace base @@ -25,7 +25,7 @@ void Shutdown() override; private: - std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_; + std::unique_ptr<base::test::TaskEnvironment> task_environment_; DISALLOW_COPY_AND_ASSIGN(ArTestSuite); };
diff --git a/chrome/browser/android/vr/ui_dummy.cc b/chrome/browser/android/vr/ui_dummy.cc deleted file mode 100644 index e4f399d..0000000 --- a/chrome/browser/android/vr/ui_dummy.cc +++ /dev/null
@@ -1,15 +0,0 @@ -// Copyright 2019 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/android/vr/ui_dummy.h" - -namespace vr { - -extern "C" { -int CreateUi() { - return 42; -} -} - -} // namespace vr
diff --git a/chrome/browser/android/vr/ui_dummy.h b/chrome/browser/android/vr/ui_dummy.h deleted file mode 100644 index 4ff6c82..0000000 --- a/chrome/browser/android/vr/ui_dummy.h +++ /dev/null
@@ -1,17 +0,0 @@ -// Copyright 2019 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_ANDROID_VR_UI_DUMMY_H_ -#define CHROME_BROWSER_ANDROID_VR_UI_DUMMY_H_ - -namespace vr { - -extern "C" { -// Dummy function that returns 42. -__attribute__((visibility("default"))) int CreateUi(); -} - -} // namespace vr - -#endif // CHROME_BROWSER_ANDROID_VR_UI_DUMMY_H_
diff --git a/chrome/browser/android/vr/ui_module_dummy_factory.cc b/chrome/browser/android/vr/ui_module_dummy_factory.cc deleted file mode 100644 index 3f05ce5..0000000 --- a/chrome/browser/android/vr/ui_module_dummy_factory.cc +++ /dev/null
@@ -1,83 +0,0 @@ -// Copyright 2019 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/android/vr/ui_module_dummy_factory.h" - -#include <dlfcn.h> - -#include <utility> - -#include "base/android/bundle_utils.h" -#include "base/debug/dump_without_crashing.h" -#include "base/memory/ptr_util.h" -#include "chrome/browser/vr/audio_delegate.h" -#include "chrome/browser/vr/content_input_delegate.h" -#include "chrome/browser/vr/keyboard_delegate.h" -#include "chrome/browser/vr/text_input_delegate.h" -#include "chrome/browser/vr/ui.h" -#include "chrome/browser/vr/ui_interface.h" - -namespace vr { - -namespace { - -typedef int CreateUiDummyFunction(); - -void HandleError(const std::string& error_message) { - DEBUG_ALIAS_FOR_CSTR(minidump, error_message.c_str(), 1024); - base::debug::DumpWithoutCrashing(); - // Crash if we are in a debug build to catch problems early. - DLOG(FATAL) << error_message; -} - -} // namespace - -UiModuleFactory::~UiModuleFactory() { - if (ui_library_handle_ != nullptr) { - dlclose(ui_library_handle_); - } -} - -std::unique_ptr<UiInterface> UiModuleFactory::Create( - UiBrowserInterface* browser, - PlatformInputHandler* content_input_forwarder, - std::unique_ptr<KeyboardDelegate> keyboard_delegate, - std::unique_ptr<TextInputDelegate> text_input_delegate, - std::unique_ptr<AudioDelegate> audio_delegate, - const UiInitialState& ui_initial_state) { - auto ui = std::make_unique<Ui>(browser, content_input_forwarder, - std::move(keyboard_delegate), - std::move(text_input_delegate), - std::move(audio_delegate), ui_initial_state); - if (ui_library_handle_ == nullptr) { - ui_library_handle_ = - base::android::BundleUtils::DlOpenModuleLibrary("vr_ui_dummy_lib"); - } - if (ui_library_handle_ == nullptr) { - HandleError(std::string("Could not open VR UI library: ") + dlerror()); - return ui; - } - - CreateUiDummyFunction* create_ui = reinterpret_cast<CreateUiDummyFunction*>( - dlsym(ui_library_handle_, "CreateUi")); - if (create_ui == nullptr) { - HandleError(std::string("Could not find UI creation function: ") + - dlerror()); - return ui; - } - - int result = create_ui(); - if (result != 42) { - HandleError("Did not get correct result"); - return ui; - } - - return ui; -} - -std::unique_ptr<UiFactory> CreateUiFactory() { - return std::make_unique<UiModuleFactory>(); -} - -} // namespace vr
diff --git a/chrome/browser/android/vr/ui_module_dummy_factory.h b/chrome/browser/android/vr/ui_module_dummy_factory.h deleted file mode 100644 index a3d45be..0000000 --- a/chrome/browser/android/vr/ui_module_dummy_factory.h +++ /dev/null
@@ -1,34 +0,0 @@ -// Copyright 2019 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_ANDROID_VR_UI_MODULE_DUMMY_FACTORY_H_ -#define CHROME_BROWSER_ANDROID_VR_UI_MODULE_DUMMY_FACTORY_H_ - -#include <memory> - -#include "chrome/browser/android/vr/ui_factory.h" - -namespace vr { - -// Like the default UI factory. But it also tries to load a dummy lib. Used to -// exercise the library loading mechanism. -class UiModuleFactory : public UiFactory { - public: - ~UiModuleFactory() override; - - std::unique_ptr<UiInterface> Create( - UiBrowserInterface* browser, - PlatformInputHandler* content_input_forwarder, - std::unique_ptr<KeyboardDelegate> keyboard_delegate, - std::unique_ptr<TextInputDelegate> text_input_delegate, - std::unique_ptr<AudioDelegate> audio_delegate, - const UiInitialState& ui_initial_state) override; - - private: - void* ui_library_handle_ = nullptr; -}; - -} // namespace vr - -#endif // CHROME_BROWSER_ANDROID_VR_UI_MODULE_DUMMY_FACTORY_H_
diff --git a/chrome/browser/android/vr/vr_shell_delegate.cc b/chrome/browser/android/vr/vr_shell_delegate.cc index 6f7824a..3cfca14 100644 --- a/chrome/browser/android/vr/vr_shell_delegate.cc +++ b/chrome/browser/android/vr/vr_shell_delegate.cc
@@ -150,6 +150,7 @@ void VrShellDelegate::RecordVrStartAction( JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj, jint start_action) { VrStartAction action = static_cast<VrStartAction>(start_action);
diff --git a/chrome/browser/android/vr/vr_shell_delegate.h b/chrome/browser/android/vr/vr_shell_delegate.h index 55b2e9a5f..86ffd9b 100644 --- a/chrome/browser/android/vr/vr_shell_delegate.h +++ b/chrome/browser/android/vr/vr_shell_delegate.h
@@ -58,6 +58,7 @@ const base::android::JavaParamRef<jobject>& obj, jboolean success); void RecordVrStartAction(JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj, jint start_action); void DisplayActivate(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
diff --git a/chrome/browser/apps/app_shim/app_shim_host_mac_unittest.cc b/chrome/browser/apps/app_shim/app_shim_host_mac_unittest.cc index 9d44d19..bbdfdd91 100644 --- a/chrome/browser/apps/app_shim/app_shim_host_mac_unittest.cc +++ b/chrome/browser/apps/app_shim/app_shim_host_mac_unittest.cc
@@ -117,7 +117,7 @@ DCHECK(!host_); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } scoped_refptr<base::SingleThreadTaskRunner> task_runner() { return task_runner_; } @@ -188,7 +188,7 @@ } scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestingAppShim> shim_;
diff --git a/chrome/browser/apps/app_shim/mach_bootstrap_acceptor_unittest.mm b/chrome/browser/apps/app_shim/mach_bootstrap_acceptor_unittest.mm index f60d052..48d18c7 100644 --- a/chrome/browser/apps/app_shim/mach_bootstrap_acceptor_unittest.mm +++ b/chrome/browser/apps/app_shim/mach_bootstrap_acceptor_unittest.mm
@@ -30,7 +30,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; class TestMachBootstrapAcceptorDelegate
diff --git a/chrome/browser/availability/availability_prober_unittest.cc b/chrome/browser/availability/availability_prober_unittest.cc index 05c5aad2..4ce3d34 100644 --- a/chrome/browser/availability/availability_prober_unittest.cc +++ b/chrome/browser/availability/availability_prober_unittest.cc
@@ -88,8 +88,7 @@ class AvailabilityProberTest : public testing::Test { public: AvailabilityProberTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), test_shared_loader_factory_( base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( &test_url_loader_factory_)),
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc index ad1a474..25c9f8a 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
@@ -45,6 +45,8 @@ #include "chrome/browser/media/media_engagement_service.h" #include "chrome/browser/media/webrtc/webrtc_event_log_manager.h" #include "chrome/browser/ntp_snippets/content_suggestions_service_factory.h" +#include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h" +#include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h" #include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/permissions/permission_decision_auto_blocker.h" #include "chrome/browser/prerender/prerender_manager.h" @@ -566,6 +568,10 @@ if (previews_service) previews_service->ClearBlackList(delete_begin_, delete_end_); + OptimizationGuideKeyedService* optimization_guide_keyed_service = + OptimizationGuideKeyedServiceFactory::GetForProfile(profile_); + if (optimization_guide_keyed_service) + optimization_guide_keyed_service->ClearData(); #if defined(OS_ANDROID) OomInterventionDecider* oom_intervention_decider =
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index dbf82b8..52820c8 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -371,6 +371,7 @@ #elif defined(OS_CHROMEOS) #include "ash/public/cpp/tablet_mode.h" #include "ash/public/mojom/constants.mojom.h" +#include "chrome/app/chrome_crash_reporter_client.h" #include "chrome/browser/ash_service_registry.h" #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_backend_delegate.h" #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_backend_delegate.h" @@ -2233,7 +2234,7 @@ } #if defined(OS_CHROMEOS) - if (breakpad::ShouldPassCrashLoopBefore(process_type)) { + if (ChromeCrashReporterClient::ShouldPassCrashLoopBefore(process_type)) { static const char* const kSwitchNames[] = { switches::kCrashLoopBefore, };
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 6bc79c8..f01fd2e 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -735,9 +735,6 @@ "crostini/crostini_export_import.h", "crostini/crostini_export_import_notification.cc", "crostini/crostini_export_import_notification.h", - "crostini/crostini_installer.cc", - "crostini/crostini_installer.h", - "crostini/crostini_installer_ui_delegate.h", "crostini/crostini_manager.cc", "crostini/crostini_manager.h", "crostini/crostini_manager_factory.cc", @@ -772,8 +769,6 @@ "crostini/crosvm_metrics.h", "crostini/crosvm_process_list.cc", "crostini/crosvm_process_list.h", - "crostini/fake_crostini_installer_ui_delegate.cc", - "crostini/fake_crostini_installer_ui_delegate.h", "cryptauth/client_app_metadata_provider_service.cc", "cryptauth/client_app_metadata_provider_service.h", "cryptauth/client_app_metadata_provider_service_factory.cc", @@ -2440,7 +2435,6 @@ "chrome_content_browser_client_chromeos_part_unittest.cc", "crostini/crostini_ansible_management_service_unittest.cc", "crostini/crostini_export_import_unittest.cc", - "crostini/crostini_installer_unittest.cc", "crostini/crostini_manager_unittest.cc", "crostini/crostini_mime_types_service_unittest.cc", "crostini/crostini_package_notification_unittest.cc",
diff --git a/chrome/browser/chromeos/account_manager/account_migration_runner_unittest.cc b/chrome/browser/chromeos/account_manager/account_migration_runner_unittest.cc index d3d611c..ecd5f58 100644 --- a/chrome/browser/chromeos/account_manager/account_migration_runner_unittest.cc +++ b/chrome/browser/chromeos/account_manager/account_migration_runner_unittest.cc
@@ -96,7 +96,7 @@ // Check base/test/scoped_task_environment.h. This must be the first member / // declared before any member that cares about tasks. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; AccountMigrationRunner migration_runner_;
diff --git a/chrome/browser/chromeos/arc/bluetooth/arc_bluetooth_bridge_unittest.cc b/chrome/browser/chromeos/arc/bluetooth/arc_bluetooth_bridge_unittest.cc index 077ce30..7489c5f 100644 --- a/chrome/browser/chromeos/arc/bluetooth/arc_bluetooth_bridge_unittest.cc +++ b/chrome/browser/chromeos/arc/bluetooth/arc_bluetooth_bridge_unittest.cc
@@ -209,7 +209,7 @@ std::unique_ptr<FakeBluetoothInstance> fake_bluetooth_instance_; std::unique_ptr<ArcBluetoothBridge> arc_bluetooth_bridge_; scoped_refptr<device::BluetoothAdapter> adapter_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop get_adapter_run_loop_; };
diff --git a/chrome/browser/chromeos/arc/input_method_manager/input_connection_impl_unittest.cc b/chrome/browser/chromeos/arc/input_method_manager/input_connection_impl_unittest.cc index c77fe5b..643934f 100644 --- a/chrome/browser/chromeos/arc/input_method_manager/input_connection_impl_unittest.cc +++ b/chrome/browser/chromeos/arc/input_method_manager/input_connection_impl_unittest.cc
@@ -209,7 +209,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestInputMethodManagerBridge> bridge_; std::unique_ptr<chromeos::InputMethodEngine> engine_; MockTextInputClient text_input_client_;
diff --git a/chrome/browser/chromeos/crostini/crostini_installer.cc b/chrome/browser/chromeos/crostini/crostini_installer.cc deleted file mode 100644 index e977f43..0000000 --- a/chrome/browser/chromeos/crostini/crostini_installer.cc +++ /dev/null
@@ -1,618 +0,0 @@ -// Copyright 2019 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/crostini/crostini_installer.h" - -#include "base/bind.h" -#include "base/bind_helpers.h" -#include "base/metrics/histogram_functions.h" -#include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" -#include "base/numerics/ranges.h" -#include "base/strings/string16.h" -#include "base/system/sys_info.h" -#include "base/task/post_task.h" -#include "base/time/time.h" -#include "chrome/browser/chromeos/crostini/crostini_manager_factory.h" -#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" -#include "chrome/browser/chromeos/crostini/crostini_terminal.h" -#include "chrome/browser/chromeos/crostini/crostini_util.h" -#include "chrome/browser/chromeos/login/startup_utils.h" -#include "chrome/browser/chromeos/profiles/profile_helper.h" -#include "components/keyed_service/content/browser_context_dependency_manager.h" -#include "components/keyed_service/content/browser_context_keyed_service_factory.h" -#include "components/keyed_service/core/keyed_service.h" -#include "components/prefs/pref_service.h" -#include "content/public/browser/browser_context.h" -#include "content/public/browser/browser_task_traits.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/network_service_instance.h" - -namespace crostini { - -namespace { - -using Error = CrostiniInstallerUIDelegate::Error; -using SetupResult = CrostiniInstaller::SetupResult; -using InstallationState = CrostiniInstallerUIDelegate::InstallationState; - -class CrostiniInstallerFactory : public BrowserContextKeyedServiceFactory { - public: - static crostini::CrostiniInstaller* GetForProfile(Profile* profile) { - return static_cast<crostini::CrostiniInstaller*>( - GetInstance()->GetServiceForBrowserContext(profile, true)); - } - - static CrostiniInstallerFactory* GetInstance() { - static base::NoDestructor<CrostiniInstallerFactory> factory; - return factory.get(); - } - - private: - friend class base::NoDestructor<CrostiniInstallerFactory>; - - CrostiniInstallerFactory() - : BrowserContextKeyedServiceFactory( - "CrostiniInstallerService", - BrowserContextDependencyManager::GetInstance()) { - DependsOn(crostini::CrostiniManagerFactory::GetInstance()); - } - - // BrowserContextKeyedServiceFactory: - KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const override { - Profile* profile = Profile::FromBrowserContext(context); - return new crostini::CrostiniInstaller(profile); - } -}; - -constexpr int kUninitializedDiskSpace = -1; - -constexpr char kCrostiniSetupResultHistogram[] = "Crostini.SetupResult"; -constexpr char kCrostiniTimeFromDeviceSetupToInstall[] = - "Crostini.TimeFromDeviceSetupToInstall"; -constexpr char kCrostiniDiskImageSizeHistogram[] = "Crostini.DiskImageSize"; -constexpr char kCrostiniTimeToInstallSuccess[] = - "Crostini.TimeToInstallSuccess"; -constexpr char kCrostiniTimeToInstallCancel[] = "Crostini.TimeToInstallCancel"; -constexpr char kCrostiniTimeToInstallError[] = "Crostini.TimeToInstallError"; -constexpr char kCrostiniAvailableDiskSuccess[] = - "Crostini.AvailableDiskSuccess"; -constexpr char kCrostiniAvailableDiskCancel[] = "Crostini.AvailableDiskCancel"; -constexpr char kCrostiniAvailableDiskError[] = "Crostini.AvailableDiskError"; - -void RecordTimeFromDeviceSetupToInstallMetric() { - base::PostTaskAndReplyWithResult( - FROM_HERE, {base::ThreadPool(), base::MayBlock()}, - base::BindOnce(&chromeos::StartupUtils::GetTimeSinceOobeFlagFileCreation), - base::BindOnce([](base::TimeDelta time_from_device_setup) { - if (time_from_device_setup.is_zero()) - return; - - base::UmaHistogramCustomTimes(kCrostiniTimeFromDeviceSetupToInstall, - time_from_device_setup, - base::TimeDelta::FromMinutes(1), - base::TimeDelta::FromDays(365), 50); - })); -} - -SetupResult ErrorToSetupResult(Error error) { - switch (error) { - case Error::NONE: - return SetupResult::kSuccess; - case Error::ERROR_LOADING_TERMINA: - return SetupResult::kErrorLoadingTermina; - case Error::ERROR_STARTING_CONCIERGE: - return SetupResult::kErrorStartingConcierge; - case Error::ERROR_CREATING_DISK_IMAGE: - return SetupResult::kErrorCreatingDiskImage; - case Error::ERROR_STARTING_TERMINA: - return SetupResult::kErrorStartingTermina; - case Error::ERROR_STARTING_CONTAINER: - return SetupResult::kErrorStartingContainer; - case Error::ERROR_OFFLINE: - return SetupResult::kErrorOffline; - case Error::ERROR_FETCHING_SSH_KEYS: - return SetupResult::kErrorFetchingSshKeys; - case Error::ERROR_MOUNTING_CONTAINER: - return SetupResult::kErrorMountingContainer; - case Error::ERROR_SETTING_UP_CONTAINER: - return SetupResult::kErrorSettingUpContainer; - case Error::ERROR_INSUFFICIENT_DISK_SPACE: - return SetupResult::kErrorInsufficientDiskSpace; - } - - NOTREACHED(); -} - -SetupResult InstallationStateToCancelledSetupResult( - InstallationState installing_state) { - switch (installing_state) { - case InstallationState::START: - return SetupResult::kUserCancelledStart; - case InstallationState::INSTALL_IMAGE_LOADER: - return SetupResult::kUserCancelledInstallImageLoader; - case InstallationState::START_CONCIERGE: - return SetupResult::kUserCancelledStartConcierge; - case InstallationState::CREATE_DISK_IMAGE: - return SetupResult::kUserCancelledCreateDiskImage; - case InstallationState::START_TERMINA_VM: - return SetupResult::kUserCancelledStartTerminaVm; - case InstallationState::CREATE_CONTAINER: - return SetupResult::kUserCancelledCreateContainer; - case InstallationState::SETUP_CONTAINER: - return SetupResult::kUserCancelledSetupContainer; - case InstallationState::START_CONTAINER: - return SetupResult::kUserCancelledStartContainer; - case InstallationState::FETCH_SSH_KEYS: - return SetupResult::kUserCancelledFetchSshKeys; - case InstallationState::MOUNT_CONTAINER: - return SetupResult::kUserCancelledMountContainer; - } - - NOTREACHED(); -} - -} // namespace - -CrostiniInstaller* CrostiniInstaller::GetForProfile(Profile* profile) { - return CrostiniInstallerFactory::GetForProfile(profile); -} - -CrostiniInstaller::CrostiniInstaller(Profile* profile) - : profile_(profile), weak_ptr_factory_(this) {} - -CrostiniInstaller::~CrostiniInstaller() { - // Guaranteed by |Shutdown()|. - DCHECK_EQ(restart_id_, CrostiniManager::kUninitializedRestartId); -} - -void CrostiniInstaller::Shutdown() { - if (restart_id_ != CrostiniManager::kUninitializedRestartId) { - CrostiniManager::GetForProfile(profile_)->AbortRestartCrostini( - restart_id_, base::DoNothing()); - restart_id_ = CrostiniManager::kUninitializedRestartId; - } -} - -void CrostiniInstaller::Install(ProgressCallback progress_callback, - ResultCallback result_callback) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - if (!CanInstall()) { - LOG(ERROR) - << "Tried to start crostini installation in invalid state. state_=" - << static_cast<int>(state_); - return; - } - - progress_callback_ = std::move(progress_callback); - result_callback_ = std::move(result_callback); - - install_start_time_ = base::TimeTicks::Now(); - require_cleanup_ = true; - free_disk_space_ = kUninitializedDiskSpace; - container_download_percent_ = 0; - UpdateState(State::INSTALLING); - - base::PostTaskAndReplyWithResult( - FROM_HERE, {base::ThreadPool(), base::MayBlock()}, - base::BindOnce(&base::SysInfo::AmountOfFreeDiskSpace, - base::FilePath(crostini::kHomeDirectory)), - base::BindOnce(&CrostiniInstaller::OnAvailableDiskSpace, - weak_ptr_factory_.GetWeakPtr())); - - // The default value of kCrostiniContainers is set to migrate existing - // crostini users who don't have the pref set. If crostini is being installed, - // then we know the user must not actually have any containers yet, so we set - // this pref to the empty list. - profile_->GetPrefs()->Set(crostini::prefs::kCrostiniContainers, - base::Value(base::Value::Type::LIST)); -} - -void CrostiniInstaller::Cancel(base::OnceClosure callback) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - if (state_ != State::INSTALLING) { - LOG(ERROR) << "Tried to cancel in non-cancelable state. state_=" - << static_cast<int>(state_); - return; - } - - UMA_HISTOGRAM_LONG_TIMES(kCrostiniTimeToInstallCancel, - base::TimeTicks::Now() - install_start_time_); - - result_callback_.Reset(); - progress_callback_.Reset(); - cancel_callback_ = std::move(callback); - - if (installing_state_ == InstallationState::START) { - // We have not called |RestartCrostini()| yet. - DCHECK_EQ(restart_id_, CrostiniManager::kUninitializedRestartId); - // OnAvailableDiskSpace() will take care of |cancel_callback_|. - UpdateState(State::CANCEL_ABORT_CHECK_DISK); - return; - } - - DCHECK_NE(restart_id_, CrostiniManager::kUninitializedRestartId); - - if (free_disk_space_ != kUninitializedDiskSpace) { - base::UmaHistogramCounts1M(kCrostiniAvailableDiskCancel, - free_disk_space_ >> 20); - } - - // Abort the long-running flow, and RestartObserver methods will not be called - // again until next installation. - crostini::CrostiniManager::GetForProfile(profile_)->AbortRestartCrostini( - restart_id_, base::DoNothing()); - restart_id_ = CrostiniManager::kUninitializedRestartId; - RecordSetupResult(InstallationStateToCancelledSetupResult(installing_state_)); - - if (require_cleanup_) { - // Remove anything that got installed - base::PostTask( - FROM_HERE, {content::BrowserThread::UI}, - base::BindOnce(&crostini::CrostiniManager::RemoveCrostini, - base::Unretained( - crostini::CrostiniManager::GetForProfile(profile_)), - crostini::kCrostiniDefaultVmName, - base::BindOnce(&CrostiniInstaller::FinishCleanup, - weak_ptr_factory_.GetWeakPtr()))); - UpdateState(State::CANCEL_CLEANUP); - } else { - base::PostTask(FROM_HERE, {content::BrowserThread::UI}, - std::move(cancel_callback_)); - UpdateState(State::IDLE); - } -} - -void CrostiniInstaller::CancelBeforeStart() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - if (!CanInstall()) { - LOG(ERROR) << "Not in pre-install state. state_=" - << static_cast<int>(state_); - return; - } - RecordSetupResult(SetupResult::kNotStarted); -} - -void CrostiniInstaller::OnComponentLoaded(CrostiniResult result) { - DCHECK_EQ(installing_state_, InstallationState::INSTALL_IMAGE_LOADER); - - if (result != CrostiniResult::SUCCESS) { - if (content::GetNetworkConnectionTracker()->IsOffline()) { - LOG(ERROR) << "Network connection dropped while downloading cros-termina"; - HandleError(Error::ERROR_OFFLINE); - } else { - LOG(ERROR) << "Failed to install the cros-termina component"; - HandleError(Error::ERROR_LOADING_TERMINA); - } - return; - } - UpdateInstallingState(InstallationState::START_CONCIERGE); -} - -void CrostiniInstaller::OnConciergeStarted(bool success) { - DCHECK_EQ(installing_state_, InstallationState::START_CONCIERGE); - if (!success) { - HandleError(Error::ERROR_STARTING_CONCIERGE); - return; - } - UpdateInstallingState(InstallationState::CREATE_DISK_IMAGE); -} - -void CrostiniInstaller::OnDiskImageCreated( - bool success, - vm_tools::concierge::DiskImageStatus status, - int64_t disk_size_available) { - DCHECK_EQ(installing_state_, InstallationState::CREATE_DISK_IMAGE); - if (!success) { - HandleError(Error::ERROR_CREATING_DISK_IMAGE); - return; - } - if (status == vm_tools::concierge::DiskImageStatus::DISK_STATUS_EXISTS) { - require_cleanup_ = false; - } else { - // Record the max space for the disk image at creation time, measured in GiB - base::UmaHistogramCustomCounts(kCrostiniDiskImageSizeHistogram, - disk_size_available >> 30, 1, 1024, 64); - } - UpdateInstallingState(InstallationState::START_TERMINA_VM); -} - -void CrostiniInstaller::OnVmStarted(bool success) { - DCHECK_EQ(installing_state_, InstallationState::START_TERMINA_VM); - if (!success) { - HandleError(Error::ERROR_STARTING_TERMINA); - return; - } - UpdateInstallingState(InstallationState::CREATE_CONTAINER); -} - -void CrostiniInstaller::OnContainerDownloading(int32_t download_percent) { - DCHECK_EQ(installing_state_, InstallationState::CREATE_CONTAINER); - container_download_percent_ = base::ClampToRange(download_percent, 0, 100); - RunProgressCallback(); -} - -void CrostiniInstaller::OnContainerCreated(CrostiniResult result) { - DCHECK_EQ(installing_state_, InstallationState::CREATE_CONTAINER); - UpdateInstallingState(InstallationState::SETUP_CONTAINER); -} - -void CrostiniInstaller::OnContainerSetup(bool success) { - DCHECK_EQ(installing_state_, InstallationState::SETUP_CONTAINER); - - if (!success) { - if (content::GetNetworkConnectionTracker()->IsOffline()) { - LOG(ERROR) << "Network connection dropped while downloading container"; - HandleError(Error::ERROR_OFFLINE); - } else { - HandleError(Error::ERROR_SETTING_UP_CONTAINER); - } - return; - } - UpdateInstallingState(InstallationState::START_CONTAINER); -} - -void CrostiniInstaller::OnContainerStarted(CrostiniResult result) { - DCHECK_EQ(installing_state_, InstallationState::START_CONTAINER); - - if (result != CrostiniResult::SUCCESS) { - LOG(ERROR) << "Failed to start container with error code: " - << static_cast<int>(result); - HandleError(Error::ERROR_STARTING_CONTAINER); - return; - } - UpdateInstallingState(InstallationState::FETCH_SSH_KEYS); -} - -void CrostiniInstaller::OnSshKeysFetched(bool success) { - DCHECK_EQ(installing_state_, InstallationState::FETCH_SSH_KEYS); - - if (!success) { - HandleError(Error::ERROR_FETCHING_SSH_KEYS); - return; - } - UpdateInstallingState(InstallationState::MOUNT_CONTAINER); -} - -bool CrostiniInstaller::CanInstall() { - // Allow to start from State::ERROR. In that case, we're doing a Retry. - return state_ == State::IDLE || state_ == State::ERROR; -} - -void CrostiniInstaller::RunProgressCallback() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DCHECK_EQ(state_, State::INSTALLING); - - base::TimeDelta time_in_state = - base::Time::Now() - installing_state_start_time_; - - double state_start_mark = 0; - double state_end_mark = 0; - int state_max_seconds = 1; - - switch (installing_state_) { - case InstallationState::START: - state_start_mark = 0; - state_end_mark = 0; - break; - case InstallationState::INSTALL_IMAGE_LOADER: - state_start_mark = 0.0; - state_end_mark = 0.25; - state_max_seconds = 30; - break; - case InstallationState::START_CONCIERGE: - state_start_mark = 0.25; - state_end_mark = 0.26; - break; - case InstallationState::CREATE_DISK_IMAGE: - state_start_mark = 0.26; - state_end_mark = 0.27; - break; - case InstallationState::START_TERMINA_VM: - state_start_mark = 0.27; - state_end_mark = 0.35; - state_max_seconds = 8; - break; - case InstallationState::CREATE_CONTAINER: - state_start_mark = 0.35; - state_end_mark = 0.90; - state_max_seconds = 180; - break; - case InstallationState::SETUP_CONTAINER: - state_start_mark = 0.90; - state_end_mark = 0.95; - state_max_seconds = 8; - break; - case InstallationState::START_CONTAINER: - state_start_mark = 0.95; - state_end_mark = 0.99; - state_max_seconds = 8; - break; - case InstallationState::FETCH_SSH_KEYS: - state_start_mark = 0.99; - state_end_mark = 1; - break; - case InstallationState::MOUNT_CONTAINER: - state_start_mark = 1; - state_end_mark = 1; - break; - default: - NOTREACHED(); - } - - double state_fraction = time_in_state.InSecondsF() / state_max_seconds; - - if (installing_state_ == InstallationState::CREATE_CONTAINER) { - // In CREATE_CONTAINER, consume half the progress bar with downloading, - // the rest with time. - state_fraction = - 0.5 * (state_fraction + 0.01 * container_download_percent_); - } - - double progress = - state_start_mark + base::ClampToRange(state_fraction, 0.0, 1.0) * - (state_end_mark - state_start_mark); - progress_callback_.Run(installing_state_, progress); -} - -void CrostiniInstaller::UpdateState(State new_state) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DCHECK_NE(state_, new_state); - - state_ = new_state; - if (state_ == State::INSTALLING) { - // We are not calling the progress callback here because 1) there is nothing - // interesting to report; 2) We reach here from |Install()|, so calling the - // callback risk reentering |Install()|'s caller. - UpdateInstallingState(InstallationState::START, /*run_callback=*/false); - - state_progress_timer_.Start( - FROM_HERE, base::TimeDelta::FromMilliseconds(500), - base::BindRepeating(&CrostiniInstaller::RunProgressCallback, - weak_ptr_factory_.GetWeakPtr())); - } else { - state_progress_timer_.AbandonAndStop(); - } -} - -void CrostiniInstaller::UpdateInstallingState( - InstallationState new_installing_state, - bool run_callback) { - DCHECK_EQ(state_, State::INSTALLING); - installing_state_start_time_ = base::Time::Now(); - installing_state_ = new_installing_state; - - if (run_callback) { - RunProgressCallback(); - } -} - -void CrostiniInstaller::HandleError(Error error) { - DCHECK_EQ(state_, State::INSTALLING); - DCHECK_NE(error, Error::NONE); - - UMA_HISTOGRAM_LONG_TIMES(kCrostiniTimeToInstallError, - base::TimeTicks::Now() - install_start_time_); - if (free_disk_space_ != kUninitializedDiskSpace) { - base::UmaHistogramCounts1M(kCrostiniAvailableDiskError, - free_disk_space_ >> 20); - } - - RecordSetupResult(ErrorToSetupResult(error)); - - // |restart_id_| is reset in |OnCrostiniRestartFinished()|. - UpdateState(State::ERROR); - - std::move(result_callback_).Run(error); - progress_callback_.Reset(); -} - -void CrostiniInstaller::FinishCleanup(crostini::CrostiniResult result) { - if (result != CrostiniResult::SUCCESS) { - LOG(ERROR) << "Failed to cleanup aborted crostini install"; - } - UpdateState(State::IDLE); - std::move(cancel_callback_).Run(); -} - -void CrostiniInstaller::RecordSetupResult(SetupResult result) { - base::UmaHistogramEnumeration(kCrostiniSetupResultHistogram, result); -} - -void CrostiniInstaller::OnCrostiniRestartFinished(CrostiniResult result) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - restart_id_ = CrostiniManager::kUninitializedRestartId; - - if (result != CrostiniResult::SUCCESS) { - if (state_ != State::ERROR) { - DCHECK_EQ(state_, State::INSTALLING); - LOG(ERROR) << "Failed to restart Crostini with error code: " - << static_cast<int>(result); - // TODO(lxj): The error code here is probably incorrect. If - // |CrostiniManager::CrostiniRestarter| failed to mount the container, it - // still calls this function with |SUCCESS| (see - // |CrostiniRestarter::OnMountEvent()|), so if we reach here (i.e. - // |state_| has not been set to |ERROR| but this function receives a - // failure result), something else is probably wrong. - HandleError(Error::ERROR_MOUNTING_CONTAINER); - } - return; - } - - DCHECK_EQ(installing_state_, InstallationState::MOUNT_CONTAINER); - // Reset state to allow |Install()| again in case the user remove and - // re-install crostini. - UpdateState(State::IDLE); - - RecordSetupResult(SetupResult::kSuccess); - crostini::CrostiniManager::GetForProfile(profile_) - ->UpdateLaunchMetricsForEnterpriseReporting(); - RecordTimeFromDeviceSetupToInstallMetric(); - UMA_HISTOGRAM_LONG_TIMES(kCrostiniTimeToInstallSuccess, - base::TimeTicks::Now() - install_start_time_); - if (free_disk_space_ != kUninitializedDiskSpace) { - base::UmaHistogramCounts1M(kCrostiniAvailableDiskSuccess, - free_disk_space_ >> 20); - } - - std::move(result_callback_).Run(Error::NONE); - progress_callback_.Reset(); - - if (!skip_launching_terminal_for_testing_) { - crostini::LaunchContainerTerminal( - profile_, crostini::kCrostiniDefaultVmName, - crostini::kCrostiniDefaultContainerName, std::vector<std::string>()); - } -} - -void CrostiniInstaller::OnAvailableDiskSpace(int64_t bytes) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - // |Cancel()| might be called immediately after |Install()|. - if (state_ == State::CANCEL_ABORT_CHECK_DISK) { - UpdateState(State::IDLE); - RecordSetupResult(SetupResult::kNotStarted); - std::move(cancel_callback_).Run(); - return; - } - - DCHECK_EQ(installing_state_, InstallationState::START); - - free_disk_space_ = bytes; - // Don't enforce minimum disk size on dev box or trybots because - // base::SysInfo::AmountOfFreeDiskSpace returns zero in testing. - if (free_disk_space_ < kMinimumFreeDiskSpace && - base::SysInfo::IsRunningOnChromeOS()) { - HandleError(Error::ERROR_INSUFFICIENT_DISK_SPACE); - return; - } - - if (content::GetNetworkConnectionTracker()->IsOffline()) { - HandleError(Error::ERROR_OFFLINE); - return; - } - - UpdateInstallingState(InstallationState::INSTALL_IMAGE_LOADER); - - // Kick off the Crostini Restart sequence. We will be added as an observer. - restart_id_ = - crostini::CrostiniManager::GetForProfile(profile_)->RestartCrostini( - crostini::kCrostiniDefaultVmName, - crostini::kCrostiniDefaultContainerName, - base::BindOnce(&CrostiniInstaller::OnCrostiniRestartFinished, - weak_ptr_factory_.GetWeakPtr()), - this); - - // |restart_id| will be invalid when |CrostiniManager::RestartCrostini()| - // decides to fail immediately and calls |OnCrostiniRestartFinished()|, which - // subsequently set |state_| to |ERROR|. - DCHECK_EQ(restart_id_ == CrostiniManager::kUninitializedRestartId, - state_ == State::ERROR); -} - -} // namespace crostini
diff --git a/chrome/browser/chromeos/crostini/crostini_installer.h b/chrome/browser/chromeos/crostini/crostini_installer.h deleted file mode 100644 index c6e05b59..0000000 --- a/chrome/browser/chromeos/crostini/crostini_installer.h +++ /dev/null
@@ -1,139 +0,0 @@ -// Copyright 2019 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_CROSTINI_CROSTINI_INSTALLER_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_INSTALLER_H_ - -#include "base/callback_forward.h" -#include "base/macros.h" -#include "chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" -#include "components/keyed_service/core/keyed_service.h" - -class Profile; - -namespace base { -class RepeatingTimer; -} // namespace base - -namespace crostini { - -class CrostiniInstaller : public KeyedService, - public CrostiniManager::RestartObserver, - public CrostiniInstallerUIDelegate { - public: - // These values are persisted to logs. Entries should not be renumbered and - // numeric values should never be reused. - enum class SetupResult { - kNotStarted = 0, - // kUserCancelled = 1, - kSuccess = 2, - kErrorLoadingTermina = 3, - kErrorStartingConcierge = 4, - kErrorCreatingDiskImage = 5, - kErrorStartingTermina = 6, - kErrorStartingContainer = 7, - kErrorOffline = 8, - kErrorFetchingSshKeys = 9, - kErrorMountingContainer = 10, - kErrorSettingUpContainer = 11, - - kUserCancelledStart = 12, - kUserCancelledInstallImageLoader = 13, - kUserCancelledStartConcierge = 14, - kUserCancelledCreateDiskImage = 15, - kUserCancelledStartTerminaVm = 16, - kUserCancelledCreateContainer = 17, - kUserCancelledStartContainer = 18, - kUserCancelledSetupContainer = 19, - kUserCancelledFetchSshKeys = 20, - kUserCancelledMountContainer = 21, - - kErrorInsufficientDiskSpace = 22, - - kMaxValue = kErrorInsufficientDiskSpace, - }; - - static CrostiniInstaller* GetForProfile(Profile* profile); - - explicit CrostiniInstaller(Profile* profile); - ~CrostiniInstaller() override; - void Shutdown() override; - - // CrostiniInstallerUIDelegate: - void Install(ProgressCallback progress_callback, - ResultCallback result_callback) override; - void Cancel(base::OnceClosure callback) override; - void CancelBeforeStart() override; - - // CrostiniManager::RestartObserver: - void OnComponentLoaded(crostini::CrostiniResult result) override; - void OnConciergeStarted(bool success) override; - void OnDiskImageCreated(bool success, - vm_tools::concierge::DiskImageStatus status, - int64_t disk_size_available) override; - void OnVmStarted(bool success) override; - void OnContainerDownloading(int32_t download_percent) override; - void OnContainerCreated(crostini::CrostiniResult result) override; - void OnContainerSetup(bool success) override; - void OnContainerStarted(crostini::CrostiniResult result) override; - void OnSshKeysFetched(bool success) override; - - // Return true if internal state allows starting installation. - bool CanInstall(); - - void set_require_cleanup_for_testing(bool require_cleanup) { - require_cleanup_ = require_cleanup; - } - void set_skip_launching_terminal_for_testing() { - skip_launching_terminal_for_testing_ = true; - } - - private: - enum class State { - IDLE, - INSTALLING, - ERROR, // Something unexpected happened. - CANCEL_CLEANUP, // Deleting a partial installation. - CANCEL_ABORT_CHECK_DISK, // Don't proceed after checking disk. - }; - - void RunProgressCallback(); - void UpdateState(State new_state); - void UpdateInstallingState(InstallationState new_installing_state, - bool run_callback = true); - void HandleError(Error error); - void FinishCleanup(crostini::CrostiniResult result); - void RecordSetupResult(SetupResult result); - - void OnCrostiniRestartFinished(crostini::CrostiniResult result); - void OnAvailableDiskSpace(int64_t bytes); - - Profile* profile_; - - State state_ = State::IDLE; - InstallationState installing_state_; - base::TimeTicks install_start_time_; - base::Time installing_state_start_time_; - base::RepeatingTimer state_progress_timer_; - bool require_cleanup_; - int64_t free_disk_space_; - int32_t container_download_percent_; - crostini::CrostiniManager::RestartId restart_id_ = - crostini::CrostiniManager::kUninitializedRestartId; - - bool skip_launching_terminal_for_testing_ = false; - - ProgressCallback progress_callback_; - ResultCallback result_callback_; - base::OnceClosure cancel_callback_; - - base::WeakPtrFactory<CrostiniInstaller> weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(CrostiniInstaller); -}; - -} // namespace crostini - -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_INSTALLER_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h b/chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h deleted file mode 100644 index 47e4150..0000000 --- a/chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h +++ /dev/null
@@ -1,77 +0,0 @@ -// Copyright 2019 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_CROSTINI_CROSTINI_INSTALLER_UI_DELEGATE_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_INSTALLER_UI_DELEGATE_H_ - -#include "base/callback_forward.h" -#include "base/strings/string16.h" - -namespace crostini { - -class CrostiniInstallerUIDelegate { - public: - // The size of the download for the VM image. - // TODO(timloh): This is just a placeholder. - static constexpr int64_t kDownloadSizeInBytes = 300 * 1024 * 1024; - // The minimum feasible size for a VM disk image. - static constexpr int64_t kMinimumDiskSize = - 1ll * 1024 * 1024 * 1024; // 1 GiB - // Minimum amount of free disk space to install crostini successfully. - static constexpr int64_t kMinimumFreeDiskSpace = - crostini::CrostiniInstallerUIDelegate::kDownloadSizeInBytes + - kMinimumDiskSize; - - enum class InstallationState { - START, // Just started installation - INSTALL_IMAGE_LOADER, // Loading the Termina VM component. - START_CONCIERGE, // Starting the Concierge D-Bus client. - CREATE_DISK_IMAGE, // Creating the image for the Termina VM. - START_TERMINA_VM, // Starting the Termina VM. - CREATE_CONTAINER, // Creating the container inside the Termina VM. - SETUP_CONTAINER, // Setting up the container inside the Termina VM. - START_CONTAINER, // Starting the container inside the Termina VM. - FETCH_SSH_KEYS, // Fetch ssh keys from concierge. - MOUNT_CONTAINER, // Do sshfs mount of container. - }; - - enum class Error { - NONE, - ERROR_LOADING_TERMINA, - ERROR_STARTING_CONCIERGE, - ERROR_CREATING_DISK_IMAGE, - ERROR_STARTING_TERMINA, - ERROR_STARTING_CONTAINER, - ERROR_OFFLINE, - ERROR_FETCHING_SSH_KEYS, - ERROR_MOUNTING_CONTAINER, - ERROR_SETTING_UP_CONTAINER, - ERROR_INSUFFICIENT_DISK_SPACE, - }; - - // |progress_fraction| ranges from 0.0 to 1.0. - using ProgressCallback = - base::RepeatingCallback<void(InstallationState state, - double progress_fraction)>; - using ResultCallback = base::OnceCallback<void(Error error)>; - - // Start the installation. |progress_callback| will be called multiple times - // until |result_callback| is called. The crostini terminal will be launched - // when the installation succeeds. - virtual void Install(ProgressCallback progress_callback, - ResultCallback result_callback) = 0; - - // Cancel the ongoing installation. |callback| will be called when it - // finishes. The callbacks passed to |Install()| will not be called anymore. - // A closing UI should call this if installation has started but hasn't - // finished. - virtual void Cancel(base::OnceClosure callback) = 0; - // UI should call this if the user cancels without starting installation so - // metrics can be recorded. - virtual void CancelBeforeStart() = 0; -}; - -} // namespace crostini - -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_INSTALLER_UI_DELEGATE_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_installer_unittest.cc b/chrome/browser/chromeos/crostini/crostini_installer_unittest.cc deleted file mode 100644 index 9b5a0ba..0000000 --- a/chrome/browser/chromeos/crostini/crostini_installer_unittest.cc +++ /dev/null
@@ -1,296 +0,0 @@ -// Copyright 2019 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/crostini/crostini_installer.h" - -#include "base/bind.h" -#include "base/bind_helpers.h" -#include "base/macros.h" -#include "base/run_loop.h" -#include "base/test/bind_test_util.h" -#include "base/test/metrics/histogram_tester.h" -#include "chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h" -#include "chrome/browser/chromeos/crostini/crostini_test_helper.h" -#include "chrome/test/base/testing_profile.h" -#include "chromeos/dbus/concierge/service.pb.h" -#include "chromeos/dbus/dbus_thread_manager.h" -#include "chromeos/dbus/fake_concierge_client.h" -#include "chromeos/disks/disk_mount_manager.h" -#include "chromeos/disks/mock_disk_mount_manager.h" -#include "content/public/test/test_browser_thread_bundle.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -using testing::_; -using testing::AnyNumber; -using testing::Expectation; -using testing::ExpectationSet; -using testing::Invoke; -using testing::Le; -using testing::MockFunction; -using testing::SaveArg; -using testing::Truly; - -namespace crostini { - -class CrostiniInstallerTest : public testing::Test { - public: - using ResultCallback = CrostiniInstallerUIDelegate::ResultCallback; - using ProgressCallback = CrostiniInstallerUIDelegate::ProgressCallback; - using Error = CrostiniInstallerUIDelegate::Error; - using InstallationState = CrostiniInstallerUIDelegate::InstallationState; - - class MockCallbacks { - public: - MOCK_METHOD2(OnProgress, - void(InstallationState state, double progress_fraction)); - MOCK_METHOD1(OnFinished, void(Error error)); - MOCK_METHOD0(OnCanceled, void()); - }; - - class MountPathWaiter { - public: - using MountPointInfo = chromeos::disks::DiskMountManager::MountPointInfo; - - void MountPath(const std::string& source_path, - const std::string& source_format, - const std::string& mount_label, - const std::vector<std::string>& mount_options, - chromeos::MountType type, - chromeos::MountAccessMode access_mode) { - mount_point_info_ = std::make_unique<MountPointInfo>( - source_path, "/media/fuse/" + mount_label, - chromeos::MountType::MOUNT_TYPE_NETWORK_STORAGE, - chromeos::disks::MountCondition::MOUNT_CONDITION_NONE); - if (quit_closure_) { - std::move(quit_closure_).Run(); - } - } - - MountPointInfo* get_mount_point_info() { return mount_point_info_.get(); } - - void WaitForMountPathCalled() { - base::RunLoop loop; - quit_closure_ = loop.QuitClosure(); - loop.Run(); - } - - private: - base::OnceClosure quit_closure_; - std::unique_ptr<MountPointInfo> mount_point_info_; - }; - - class WaitingFakeConciergeClient : public chromeos::FakeConciergeClient { - public: - void StartTerminaVm( - const vm_tools::concierge::StartVmRequest& request, - chromeos::DBusMethodCallback<vm_tools::concierge::StartVmResponse> - callback) override { - chromeos::FakeConciergeClient::StartTerminaVm(request, - std::move(callback)); - if (quit_closure_) { - base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, - std::move(quit_closure_)); - } - } - - void WaitForStartTerminaVmCalled() { - base::RunLoop loop; - quit_closure_ = loop.QuitClosure(); - loop.Run(); - EXPECT_TRUE(start_termina_vm_called()); - } - - private: - base::OnceClosure quit_closure_; - }; - - CrostiniInstallerTest() = default; - - void SetUp() override { - waiting_fake_concierge_client_ = new WaitingFakeConciergeClient; - chromeos::DBusThreadManager::GetSetterForTesting()->SetConciergeClient( - base::WrapUnique(waiting_fake_concierge_client_)); - - disk_mount_manager_mock_ = new chromeos::disks::MockDiskMountManager; - chromeos::disks::DiskMountManager::InitializeForTesting( - disk_mount_manager_mock_); - - profile_ = std::make_unique<TestingProfile>(); - // Needed at least for passing IsCrostiniUIAllowedForProfile() test in - // CrostiniManager. - crostini_test_helper_ = - std::make_unique<CrostiniTestHelper>(profile_.get()); - - crostini_installer_ = std::make_unique<CrostiniInstaller>(profile_.get()); - crostini_installer_->set_skip_launching_terminal_for_testing(); - } - - void TearDown() override { - crostini_installer_->Shutdown(); - crostini_installer_.reset(); - crostini_test_helper_.reset(); - profile_.reset(); - - chromeos::disks::MockDiskMountManager::Shutdown(); - chromeos::DBusThreadManager::Shutdown(); - } - - void Install() { - crostini_installer_->Install( - base::BindRepeating(&MockCallbacks::OnProgress, - base::Unretained(&mock_callbacks_)), - base::BindRepeating(&MockCallbacks::OnFinished, - base::Unretained(&mock_callbacks_))); - } - - void Cancel() { - crostini_installer_->Cancel(base::BindOnce( - &MockCallbacks::OnCanceled, base::Unretained(&mock_callbacks_))); - } - - protected: - MountPathWaiter mount_path_waiter_; - MockCallbacks mock_callbacks_; - content::TestBrowserThreadBundle thread_bundle_; - base::HistogramTester histogram_tester_; - - // Owned by DiskMountManager - chromeos::disks::MockDiskMountManager* disk_mount_manager_mock_ = nullptr; - // Owned by chromeos::DBusThreadManager - WaitingFakeConciergeClient* waiting_fake_concierge_client_ = nullptr; - - std::unique_ptr<TestingProfile> profile_; - std::unique_ptr<CrostiniTestHelper> crostini_test_helper_; - std::unique_ptr<CrostiniInstaller> crostini_installer_; - - private: - DISALLOW_COPY_AND_ASSIGN(CrostiniInstallerTest); -}; - -TEST_F(CrostiniInstallerTest, InstallFlow) { - double last_progress = 0.0; - auto greater_equal_last_progress = Truly( - [&last_progress](double progress) { return progress >= last_progress; }); - - ExpectationSet expectation_set; - expectation_set += - EXPECT_CALL(mock_callbacks_, - OnProgress(_, AllOf(greater_equal_last_progress, Le(1.0)))) - .WillRepeatedly(SaveArg<1>(&last_progress)); - expectation_set += - EXPECT_CALL(*disk_mount_manager_mock_, - MountPath("sshfs://testing_profile@hostname:", _, _, _, _, _)) - .WillOnce(Invoke(&mount_path_waiter_, &MountPathWaiter::MountPath)); - // |OnProgress()| should not happens after |OnFinished()| - EXPECT_CALL(mock_callbacks_, OnFinished(Error::NONE)).After(expectation_set); - - Install(); - mount_path_waiter_.WaitForMountPathCalled(); - - ASSERT_TRUE(mount_path_waiter_.get_mount_point_info()); - disk_mount_manager_mock_->NotifyMountEvent( - chromeos::disks::DiskMountManager::MountEvent::MOUNTING, - chromeos::MountError::MOUNT_ERROR_NONE, - *mount_path_waiter_.get_mount_point_info()); - - thread_bundle_.RunUntilIdle(); - histogram_tester_.ExpectUniqueSample( - "Crostini.SetupResult", - static_cast<base::HistogramBase::Sample>( - CrostiniInstaller::SetupResult::kSuccess), - 1); - - EXPECT_TRUE(crostini_installer_->CanInstall()) - << "Installer should recover to installable state"; -} - -TEST_F(CrostiniInstallerTest, CancelBeforeStart) { - crostini_installer_->CancelBeforeStart(); - - histogram_tester_.ExpectUniqueSample( - "Crostini.SetupResult", - static_cast<base::HistogramBase::Sample>( - CrostiniInstaller::SetupResult::kNotStarted), - 1); -} - -TEST_F(CrostiniInstallerTest, CancelAfterStart) { - MockFunction<void(std::string check_point_name)> check; - - Expectation expect_progresses = - EXPECT_CALL(mock_callbacks_, OnProgress(_, _)).Times(AnyNumber()); - // |OnProgress()| should not happen after |Cancel()| is called. - Expectation expect_calling_cancel = - EXPECT_CALL(check, Call("calling Cancel()")).After(expect_progresses); - EXPECT_CALL(mock_callbacks_, OnCanceled()).After(expect_calling_cancel); - - Install(); - - // It is too involved to also fake the cleanup process in CrostiniManager, so - // we will just skip it. - crostini_installer_->set_require_cleanup_for_testing(false); - - // This will stop just before mount disk finishes because we don't fake the - // mount event. - thread_bundle_.RunUntilIdle(); - - check.Call("calling Cancel()"); - Cancel(); - thread_bundle_.RunUntilIdle(); - - histogram_tester_.ExpectUniqueSample( - "Crostini.SetupResult", - static_cast<base::HistogramBase::Sample>( - CrostiniInstaller::SetupResult::kUserCancelledMountContainer), - 1); - EXPECT_TRUE(crostini_installer_->CanInstall()) - << "Installer should recover to installable state"; -} - -// Cancel before |OnAvailableDiskSpace()| happens is a special case, in which we -// haven't started the restarting process yet. -TEST_F(CrostiniInstallerTest, CancelAfterStartBeforeCheckDisk) { - EXPECT_CALL(mock_callbacks_, OnCanceled()); - - crostini_installer_->Install(base::DoNothing(), base::DoNothing()); - Cancel(); // Cancel immediately - - thread_bundle_.RunUntilIdle(); - - histogram_tester_.ExpectUniqueSample( - "Crostini.SetupResult", - static_cast<base::HistogramBase::Sample>( - CrostiniInstaller::SetupResult::kNotStarted), - 1); - EXPECT_TRUE(crostini_installer_->CanInstall()) - << "Installer should recover to installable state"; -} - -TEST_F(CrostiniInstallerTest, Error) { - Expectation expect_progresses = - EXPECT_CALL(mock_callbacks_, OnProgress(_, _)).Times(AnyNumber()); - // |OnProgress()| should not happens after |OnFinished()| - EXPECT_CALL(mock_callbacks_, OnFinished(Error::ERROR_STARTING_TERMINA)) - .After(expect_progresses); - - // Fake a failure for starting vm. - vm_tools::concierge::StartVmResponse response; - response.set_status(vm_tools::concierge::VM_STATUS_FAILURE); - waiting_fake_concierge_client_->set_start_vm_response(std::move(response)); - - Install(); - waiting_fake_concierge_client_->WaitForStartTerminaVmCalled(); - - histogram_tester_.ExpectUniqueSample( - "Crostini.SetupResult", - static_cast<base::HistogramBase::Sample>( - CrostiniInstaller::SetupResult::kErrorStartingTermina), - 1); - - EXPECT_TRUE(crostini_installer_->CanInstall()) - << "Installer should recover to installable state"; -} - -} // namespace crostini
diff --git a/chrome/browser/chromeos/crostini/crostini_manager.h b/chrome/browser/chromeos/crostini/crostini_manager.h index c684e99..48ca586b 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager.h +++ b/chrome/browser/chromeos/crostini/crostini_manager.h
@@ -373,9 +373,7 @@ using RestartId = int; static const RestartId kUninitializedRestartId = -1; // Runs all the steps required to restart the given crostini vm and container. - // The optional |observer| tracks progress. If provided, it must be alive - // until the restart completes (i.e. when |callback| is called) or the restart - // is aborted via |AbortRestartCrostini|. + // The optional |observer| tracks progress. RestartId RestartCrostini(std::string vm_name, std::string container_name, CrostiniResultCallback callback,
diff --git a/chrome/browser/chromeos/crostini/crostini_package_notification_unittest.cc b/chrome/browser/chromeos/crostini/crostini_package_notification_unittest.cc index aca7e430..6fc7996 100644 --- a/chrome/browser/chromeos/crostini/crostini_package_notification_unittest.cc +++ b/chrome/browser/chromeos/crostini/crostini_package_notification_unittest.cc
@@ -37,8 +37,8 @@ DBusThreadManager::Initialize(); test_browser_thread_bundle_ = std::make_unique<content::TestBrowserThreadBundle>( - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::ASYNC, + base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::ThreadPoolExecutionMode::ASYNC, content::TestBrowserThreadBundle::REAL_IO_THREAD); profile_ = std::make_unique<TestingProfile>();
diff --git a/chrome/browser/chromeos/crostini/crostini_package_service_unittest.cc b/chrome/browser/chromeos/crostini/crostini_package_service_unittest.cc index 7c88a10..4f70aca 100644 --- a/chrome/browser/chromeos/crostini/crostini_package_service_unittest.cc +++ b/chrome/browser/chromeos/crostini/crostini_package_service_unittest.cc
@@ -167,8 +167,8 @@ test_browser_thread_bundle_ = std::make_unique<content::TestBrowserThreadBundle>( - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::ASYNC, + base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::ThreadPoolExecutionMode::ASYNC, content::TestBrowserThreadBundle::REAL_IO_THREAD); profile_ = std::make_unique<TestingProfile>( base::FilePath("/home/chronos/u-0123456789abcdef"));
diff --git a/chrome/browser/chromeos/crostini/crostini_test_helper.cc b/chrome/browser/chromeos/crostini/crostini_test_helper.cc index cc99a35..b2baa98 100644 --- a/chrome/browser/chromeos/crostini/crostini_test_helper.cc +++ b/chrome/browser/chromeos/crostini/crostini_test_helper.cc
@@ -36,7 +36,7 @@ std::make_unique<chromeos::FakeChromeUserManager>()); auto* fake_user_manager = static_cast<chromeos::FakeChromeUserManager*>( user_manager::UserManager::Get()); - auto account = AccountId::FromUserEmailGaiaId("test@example.com", "12345"); + auto account = AccountId::FromUserEmail("test@example.com"); fake_user_manager->AddUserWithAffiliationAndTypeAndProfile( account, false, user_manager::USER_TYPE_REGULAR, profile); fake_user_manager->LoginUser(account);
diff --git a/chrome/browser/chromeos/crostini/crostini_unsupported_action_notifier.cc b/chrome/browser/chromeos/crostini/crostini_unsupported_action_notifier.cc index 2e6bd21..f5615e1 100644 --- a/chrome/browser/chromeos/crostini/crostini_unsupported_action_notifier.cc +++ b/chrome/browser/chromeos/crostini/crostini_unsupported_action_notifier.cc
@@ -124,8 +124,9 @@ return false; } auto* focused_window = exo::WMHelper::GetInstance()->GetFocusedWindow(); - return focused_window->GetProperty(aura::client::kAppType) == - static_cast<int>(ash::AppType::CROSTINI_APP); + return focused_window && + (focused_window->GetProperty(aura::client::kAppType) == + static_cast<int>(ash::AppType::CROSTINI_APP)); } chromeos::input_method::InputMethodDescriptor
diff --git a/chrome/browser/chromeos/crostini/fake_crostini_installer_ui_delegate.cc b/chrome/browser/chromeos/crostini/fake_crostini_installer_ui_delegate.cc deleted file mode 100644 index f92124b9..0000000 --- a/chrome/browser/chromeos/crostini/fake_crostini_installer_ui_delegate.cc +++ /dev/null
@@ -1,27 +0,0 @@ -// Copyright 2019 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/crostini/fake_crostini_installer_ui_delegate.h" - -namespace crostini { - -FakeCrostiniInstallerUIDelegate::FakeCrostiniInstallerUIDelegate() = default; -FakeCrostiniInstallerUIDelegate::~FakeCrostiniInstallerUIDelegate() = default; - -void FakeCrostiniInstallerUIDelegate::Install( - ProgressCallback progress_callback, - ResultCallback result_callback) { - progress_callback_ = std::move(progress_callback); - result_callback_ = std::move(result_callback); -} - -void FakeCrostiniInstallerUIDelegate::Cancel(base::OnceClosure callback) { - cancel_callback_ = std::move(callback); -} - -void FakeCrostiniInstallerUIDelegate::CancelBeforeStart() { - cancel_before_start_called_ = true; -} - -} // namespace crostini
diff --git a/chrome/browser/chromeos/crostini/fake_crostini_installer_ui_delegate.h b/chrome/browser/chromeos/crostini/fake_crostini_installer_ui_delegate.h deleted file mode 100644 index 3db57e2..0000000 --- a/chrome/browser/chromeos/crostini/fake_crostini_installer_ui_delegate.h +++ /dev/null
@@ -1,31 +0,0 @@ -// Copyright 2019 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_CROSTINI_FAKE_CROSTINI_INSTALLER_UI_DELEGATE_H_ -#define CHROME_BROWSER_CHROMEOS_CROSTINI_FAKE_CROSTINI_INSTALLER_UI_DELEGATE_H_ - -#include "base/callback.h" -#include "chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h" - -namespace crostini { - -class FakeCrostiniInstallerUIDelegate : public CrostiniInstallerUIDelegate { - public: - FakeCrostiniInstallerUIDelegate(); - ~FakeCrostiniInstallerUIDelegate(); - - void Install(ProgressCallback progress_callback, - ResultCallback result_callback) override; - void Cancel(base::OnceClosure callback) override; - void CancelBeforeStart() override; - - ProgressCallback progress_callback_; - ResultCallback result_callback_; - base::OnceClosure cancel_callback_; - bool cancel_before_start_called_ = false; -}; - -} // namespace crostini - -#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_FAKE_CROSTINI_INSTALLER_UI_DELEGATE_H_
diff --git a/chrome/browser/chromeos/device_sync/device_sync_client_factory.cc b/chrome/browser/chromeos/device_sync/device_sync_client_factory.cc index 03bb64f..1037af9 100644 --- a/chrome/browser/chromeos/device_sync/device_sync_client_factory.cc +++ b/chrome/browser/chromeos/device_sync/device_sync_client_factory.cc
@@ -78,7 +78,10 @@ private: // KeyedService: - void Shutdown() override { device_sync_client_.reset(); } + void Shutdown() override { + device_sync_client_.reset(); + service_.reset(); + } mojo::Remote<chromeos::device_sync::mojom::DeviceSyncService> remote_service_;
diff --git a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc index 72ff87f..6b1df96 100644 --- a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc +++ b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc
@@ -44,7 +44,6 @@ #include "chrome/browser/chromeos/arc/arc_util.h" #include "chrome/browser/chromeos/assistant/assistant_util.h" #include "chrome/browser/chromeos/crostini/crostini_export_import.h" -#include "chrome/browser/chromeos/crostini/crostini_installer.h" #include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_registry_service.h" @@ -1186,8 +1185,7 @@ // start terminal app on completion. After starting the installer, // we call RestartCrostini and we will be put in the pending restarters // queue and be notified on success/otherwise of installation. - CrostiniInstallerView::Show( - profile, crostini::CrostiniInstaller::GetForProfile(profile)); + CrostiniInstallerView::Show(profile); CrostiniInstallerView::GetActiveViewForTesting()->Accept(); crostini::CrostiniManager::GetForProfile(profile)->RestartCrostini( crostini::kCrostiniDefaultVmName, crostini::kCrostiniDefaultContainerName,
diff --git a/chrome/browser/chromeos/extensions/file_manager/device_event_router_unittest.cc b/chrome/browser/chromeos/extensions/file_manager/device_event_router_unittest.cc index e6d6710..a535640 100644 --- a/chrome/browser/chromeos/extensions/file_manager/device_event_router_unittest.cc +++ b/chrome/browser/chromeos/extensions/file_manager/device_event_router_unittest.cc
@@ -86,7 +86,7 @@ std::unique_ptr<DeviceEventRouterImpl> device_event_router; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(DeviceEventRouterTest, AddAndRemoveDevice) {
diff --git a/chrome/browser/chromeos/extensions/file_manager/job_event_router_unittest.cc b/chrome/browser/chromeos/extensions/file_manager/job_event_router_unittest.cc index b43935c..f4d6415 100644 --- a/chrome/browser/chromeos/extensions/file_manager/job_event_router_unittest.cc +++ b/chrome/browser/chromeos/extensions/file_manager/job_event_router_unittest.cc
@@ -94,7 +94,7 @@ std::unique_ptr<JobEventRouterImpl> job_event_router; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(JobEventRouterTest, Basic) {
diff --git a/chrome/browser/chromeos/kerberos/kerberos_ticket_expiry_notification_test.cc b/chrome/browser/chromeos/kerberos/kerberos_ticket_expiry_notification_test.cc index 42014cf4..afc17e7 100644 --- a/chrome/browser/chromeos/kerberos/kerberos_ticket_expiry_notification_test.cc +++ b/chrome/browser/chromeos/kerberos/kerberos_ticket_expiry_notification_test.cc
@@ -54,7 +54,7 @@ } content::TestBrowserThreadBundle test_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment::MainThreadType::UI}; TestingProfileManager profile_manager_{TestingBrowserProcess::GetGlobal()}; TestingProfile* profile_ = nullptr; std::unique_ptr<NotificationDisplayServiceTester> display_service_tester_;
diff --git a/chrome/browser/chromeos/login/demo_mode/demo_setup_controller_unittest.cc b/chrome/browser/chromeos/login/demo_mode/demo_setup_controller_unittest.cc index 2ab622e6..4ea763a0 100644 --- a/chrome/browser/chromeos/login/demo_mode/demo_setup_controller_unittest.cc +++ b/chrome/browser/chromeos/login/demo_mode/demo_setup_controller_unittest.cc
@@ -132,7 +132,7 @@ std::unique_ptr<DemoSetupController> tested_controller_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ScopedTestingLocalState testing_local_state_; ScopedStubInstallAttributes test_install_attributes_; system::ScopedFakeStatisticsProvider statistics_provider_;
diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen_unittest.cc b/chrome/browser/chromeos/login/enrollment/enrollment_screen_unittest.cc index a326a2e..96f1a066 100644 --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen_unittest.cc +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen_unittest.cc
@@ -75,7 +75,7 @@ last_screen_result_ = screen_result; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Replace main thread's task runner with a mock for duration of test. base::ScopedMockTimeMessageLoopTaskRunner runner_;
diff --git a/chrome/browser/chromeos/login/saml/in_session_password_change_manager_unittest.cc b/chrome/browser/chromeos/login/saml/in_session_password_change_manager_unittest.cc index 96ff96bc..f3db53ce 100644 --- a/chrome/browser/chromeos/login/saml/in_session_password_change_manager_unittest.cc +++ b/chrome/browser/chromeos/login/saml/in_session_password_change_manager_unittest.cc
@@ -95,8 +95,8 @@ } content::TestBrowserThreadBundle test_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; TestingProfileManager profile_manager_{TestingBrowserProcess::GetGlobal()}; TestingProfile* profile_;
diff --git a/chrome/browser/chromeos/mobile/mobile_activator_unittest.cc b/chrome/browser/chromeos/mobile/mobile_activator_unittest.cc index 078d80f4..2e87132 100644 --- a/chrome/browser/chromeos/mobile/mobile_activator_unittest.cc +++ b/chrome/browser/chromeos/mobile/mobile_activator_unittest.cc
@@ -140,7 +140,7 @@ cellular_network_.connection_state_ = state; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkState cellular_network_; TestMobileActivator mobile_activator_;
diff --git a/chrome/browser/chromeos/net/client_cert_store_chromeos_unittest.cc b/chrome/browser/chromeos/net/client_cert_store_chromeos_unittest.cc index 01b55771..b02f7fe9 100644 --- a/chrome/browser/chromeos/net/client_cert_store_chromeos_unittest.cc +++ b/chrome/browser/chromeos/net/client_cert_store_chromeos_unittest.cc
@@ -89,8 +89,7 @@ class ClientCertStoreChromeOSTest : public ::testing::Test { public: ClientCertStoreChromeOSTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} scoped_refptr<net::X509Certificate> ImportCertToSlot( const std::string& cert_filename, @@ -103,7 +102,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Ensure that cert requests, that are started before the filter is initialized,
diff --git a/chrome/browser/chromeos/net/network_throttling_observer_unittest.cc b/chrome/browser/chromeos/net/network_throttling_observer_unittest.cc index d280fb4..a719d96 100644 --- a/chrome/browser/chromeos/net/network_throttling_observer_unittest.cc +++ b/chrome/browser/chromeos/net/network_throttling_observer_unittest.cc
@@ -50,7 +50,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<NetworkStateHandler> network_state_handler_; std::unique_ptr<TestingPrefServiceSimple> local_state_; std::unique_ptr<NetworkThrottlingObserver> observer_;
diff --git a/chrome/browser/chromeos/night_light/night_light_client_unittest.cc b/chrome/browser/chromeos/night_light/night_light_client_unittest.cc index 5b92bb8..e5bcb7ce 100644 --- a/chrome/browser/chromeos/night_light/night_light_client_unittest.cc +++ b/chrome/browser/chromeos/night_light/night_light_client_unittest.cc
@@ -124,7 +124,7 @@ client_.Start(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeNightLightController controller_; FakeNightLightClient client_; @@ -141,7 +141,7 @@ EXPECT_FALSE(client_.using_geoposition()); controller_.NotifyScheduleTypeChanged(ScheduleType::kCustom); controller_.NotifyScheduleTypeChanged(ScheduleType::kSunsetToSunrise); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(client_.using_geoposition()); // Client should stop retrieving geopositions when schedule type changes to @@ -161,7 +161,7 @@ position.timestamp = base::Time::Now(); client_.set_position_to_send(position); controller_.NotifyScheduleTypeChanged(ScheduleType::kSunsetToSunrise); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1, client_.geoposition_requests_num()); EXPECT_EQ(0, controller_.position_pushes_num()); } @@ -180,7 +180,7 @@ position1.timestamp = base::Time::Now(); client_.set_position_to_send(position1); controller_.NotifyScheduleTypeChanged(ScheduleType::kSunsetToSunrise); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1, client_.geoposition_requests_num()); EXPECT_EQ(1, controller_.position_pushes_num()); EXPECT_EQ(client_.Now(), client_.last_successful_geo_request_time()); @@ -196,7 +196,7 @@ position2.timestamp = base::Time::Now(); client_.set_position_to_send(position2); controller_.NotifyScheduleTypeChanged(ScheduleType::kSunsetToSunrise); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // No new request has been triggered, however the same old valid position was // pushed to the controller. EXPECT_EQ(1, client_.geoposition_requests_num()); @@ -225,11 +225,11 @@ // When schedule type is not sunset to sunrise, timezone changes do not result // in geoposition requests. controller_.NotifyScheduleTypeChanged(ScheduleType::kNone); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(client_.using_geoposition()); auto timezone = CreateTimezone("Africa/Cairo"); client_.TimezoneChanged(*timezone); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, controller_.position_pushes_num()); EXPECT_EQ(0, client_.geoposition_requests_num()); EXPECT_EQ(GetTimezoneId(*timezone), client_.current_timezone_id()); @@ -246,14 +246,14 @@ // Change the schedule type to sunset to sunrise, and expect the geoposition // will be pushed. controller_.NotifyScheduleTypeChanged(ScheduleType::kSunsetToSunrise); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1, controller_.position_pushes_num()); EXPECT_EQ(1, client_.geoposition_requests_num()); // Updates with the same timezone does not result in new requests. timezone = CreateTimezone("Africa/Cairo"); client_.TimezoneChanged(*timezone); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1, controller_.position_pushes_num()); EXPECT_EQ(1, client_.geoposition_requests_num()); EXPECT_EQ(GetTimezoneId(*timezone), client_.current_timezone_id()); @@ -261,7 +261,7 @@ // Only new timezones results in new geoposition requests. timezone = CreateTimezone("Asia/Tokyo"); client_.TimezoneChanged(*timezone); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(2, controller_.position_pushes_num()); EXPECT_EQ(2, client_.geoposition_requests_num()); EXPECT_EQ(GetTimezoneId(*timezone), client_.current_timezone_id());
diff --git a/chrome/browser/chromeos/policy/active_directory_policy_manager_unittest.cc b/chrome/browser/chromeos/policy/active_directory_policy_manager_unittest.cc index 9087472..bcba29f 100644 --- a/chrome/browser/chromeos/policy/active_directory_policy_manager_unittest.cc +++ b/chrome/browser/chromeos/policy/active_directory_policy_manager_unittest.cc
@@ -98,7 +98,7 @@ SchemaRegistry schema_registry_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; chromeos::ScopedStubInstallAttributes install_attributes_; DISALLOW_COPY_AND_ASSIGN(ActiveDirectoryPolicyManagerTest); };
diff --git a/chrome/browser/chromeos/policy/android_management_client_unittest.cc b/chrome/browser/chromeos/policy/android_management_client_unittest.cc index c5e202f..313a835 100644 --- a/chrome/browser/chromeos/policy/android_management_client_unittest.cc +++ b/chrome/browser/chromeos/policy/android_management_client_unittest.cc
@@ -62,7 +62,7 @@ // Protobuf is used in successfil responsees. em::DeviceManagementResponse android_management_response_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockDeviceManagementService service_; StrictMock<base::MockCallback<AndroidManagementClient::StatusCallback>> callback_observer_;
diff --git a/chrome/browser/chromeos/policy/app_install_event_logger_unittest.cc b/chrome/browser/chromeos/policy/app_install_event_logger_unittest.cc index 2ea8ed51..ac9f269 100644 --- a/chrome/browser/chromeos/policy/app_install_event_logger_unittest.cc +++ b/chrome/browser/chromeos/policy/app_install_event_logger_unittest.cc
@@ -97,9 +97,8 @@ protected: AppInstallEventLoggerTest() : browser_thread_bundle_( - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) {} + base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} void SetUp() override { RegisterLocalState(pref_service_.registry());
diff --git a/chrome/browser/chromeos/policy/bluetooth_policy_handler_unittest.cc b/chrome/browser/chromeos/policy/bluetooth_policy_handler_unittest.cc index 0959080..bb0e00a 100644 --- a/chrome/browser/chromeos/policy/bluetooth_policy_handler_unittest.cc +++ b/chrome/browser/chromeos/policy/bluetooth_policy_handler_unittest.cc
@@ -46,7 +46,7 @@ chromeos::kAllowBluetooth, allow_bluetooth); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<TestingBluetoothAdapter> adapter_; chromeos::ScopedTestingCrosSettings scoped_testing_cros_settings_; };
diff --git a/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos_unittest.cc b/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos_unittest.cc index 81ae78f..9d61515 100644 --- a/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos_unittest.cc
@@ -34,7 +34,7 @@ ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir()); cached_policy_key_loader_ = std::make_unique<CachedPolicyKeyLoaderChromeOS>( - &cryptohome_client_, scoped_task_environment_.GetMainThreadTaskRunner(), + &cryptohome_client_, task_environment_.GetMainThreadTaskRunner(), account_id_, user_policy_keys_dir()); } @@ -69,8 +69,8 @@ &CachedPolicyKeyLoaderTest::OnPolicyKeyLoaded, base::Unretained(this))); } - base::test::ScopedTaskEnvironment scoped_task_environment_ = { - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_ = { + base::test::TaskEnvironment::MainThreadType::UI}; chromeos::FakeCryptohomeClient cryptohome_client_; const AccountId account_id_ = AccountId::FromUserEmail(kTestUserName); const cryptohome::AccountIdentifier cryptohome_id_ = @@ -93,7 +93,7 @@ CallEnsurePolicyKeyLoaded(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1, policy_key_loaded_callback_invocations_); EXPECT_EQ(kDummyKey1, cached_policy_key_loader_->cached_policy_key()); @@ -103,7 +103,7 @@ TEST_F(CachedPolicyKeyLoaderTest, KeyFileMissing) { CallEnsurePolicyKeyLoaded(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1, policy_key_loaded_callback_invocations_); EXPECT_EQ(std::string(), cached_policy_key_loader_->cached_policy_key()); @@ -119,7 +119,7 @@ EXPECT_EQ(0, policy_key_loaded_callback_invocations_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // We expect that the callback was called for each EnsurePolicyKeyLoaded // invocation. @@ -135,7 +135,7 @@ CallEnsurePolicyKeyLoaded(); EXPECT_EQ(0, policy_key_loaded_callback_invocations_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1, policy_key_loaded_callback_invocations_); EXPECT_EQ(kDummyKey1, cached_policy_key_loader_->cached_policy_key()); @@ -145,7 +145,7 @@ CallEnsurePolicyKeyLoaded(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // We expect that the callback was invoked, but that the cached policy key is // still the old one. EnsurePolicyKeyLoaded is not supposed to reload the key. @@ -161,7 +161,7 @@ CallEnsurePolicyKeyLoaded(); EXPECT_EQ(0, policy_key_loaded_callback_invocations_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1, policy_key_loaded_callback_invocations_); EXPECT_EQ(kDummyKey1, cached_policy_key_loader_->cached_policy_key()); @@ -171,7 +171,7 @@ CallReloadPolicyKey(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // We expect that the callback was invoked, and that the policy key file has // been reloded, so the cached policy key is now the new policy key. @@ -187,7 +187,7 @@ CallReloadPolicyKey(); EXPECT_EQ(0, policy_key_loaded_callback_invocations_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // We expect that the callback was called for both the EnsurePolicyKeyLoaded // and ReloadPolicyKey invocation.
diff --git a/chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc b/chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc index a968d38c..93bdd8ea 100644 --- a/chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc +++ b/chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc
@@ -93,7 +93,7 @@ const std::string& repsonse_data, net::HttpStatusCode response_code); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; std::unique_ptr<ResourceCache> resource_cache_; MockCloudPolicyStore cloud_policy_store_; @@ -115,7 +115,7 @@ void CloudExternalDataManagerBaseTest::SetUp() { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); resource_cache_.reset(new ResourceCache( - temp_dir_.GetPath(), scoped_task_environment_.GetMainThreadTaskRunner(), + temp_dir_.GetPath(), task_environment_.GetMainThreadTaskRunner(), /* max_cache_size */ base::nullopt)); SetUpExternalDataManager(); @@ -154,10 +154,10 @@ void CloudExternalDataManagerBaseTest::SetUpExternalDataManager() { external_data_manager_ = std::make_unique<CloudExternalDataManagerBase>( policy_details_.GetCallback(), - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); external_data_manager_->SetExternalDataStore( std::make_unique<CloudExternalDataStore>( - kCacheKey, scoped_task_environment_.GetMainThreadTaskRunner(), + kCacheKey, task_environment_.GetMainThreadTaskRunner(), resource_cache_.get())); external_data_manager_->SetPolicyStore(&cloud_policy_store_); } @@ -299,7 +299,7 @@ std::string data; EXPECT_FALSE( CloudExternalDataStore(kCacheKey, - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), resource_cache_.get()) .Load(k10BytePolicy, crypto::SHA256HashString(k10ByteData), 10, &data) .empty()); @@ -355,9 +355,9 @@ // Verify that the downloaded data is present in the cache. external_data_manager_.reset(); base::RunLoop().RunUntilIdle(); - CloudExternalDataStore cache( - kCacheKey, scoped_task_environment_.GetMainThreadTaskRunner(), - resource_cache_.get()); + CloudExternalDataStore cache(kCacheKey, + task_environment_.GetMainThreadTaskRunner(), + resource_cache_.get()); std::string data; EXPECT_FALSE( cache @@ -483,13 +483,12 @@ // Store valid external data for |k10BytePolicy| in the cache. external_data_manager_.reset(); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE( - CloudExternalDataStore(kCacheKey, - scoped_task_environment_.GetMainThreadTaskRunner(), - resource_cache_.get()) - .Store(k10BytePolicy, crypto::SHA256HashString(k10ByteData), - k10ByteData) - .empty()); + EXPECT_FALSE(CloudExternalDataStore( + kCacheKey, task_environment_.GetMainThreadTaskRunner(), + resource_cache_.get()) + .Store(k10BytePolicy, crypto::SHA256HashString(k10ByteData), + k10ByteData) + .empty()); // Instantiate an external_data_manager_ that uses the primed cache. SetUpExternalDataManager(); @@ -512,7 +511,7 @@ external_data_manager_.reset(); base::RunLoop().RunUntilIdle(); std::unique_ptr<CloudExternalDataStore> cache(new CloudExternalDataStore( - kCacheKey, scoped_task_environment_.GetMainThreadTaskRunner(), + kCacheKey, task_environment_.GetMainThreadTaskRunner(), resource_cache_.get())); // Store valid external data for |k10BytePolicy| in the cache. EXPECT_FALSE(cache @@ -539,7 +538,7 @@ base::RunLoop().RunUntilIdle(); cache.reset(new CloudExternalDataStore( - kCacheKey, scoped_task_environment_.GetMainThreadTaskRunner(), + kCacheKey, task_environment_.GetMainThreadTaskRunner(), resource_cache_.get())); std::string data; // Verify that the valid external data for |k10BytePolicy| is still in the @@ -568,7 +567,7 @@ external_data_manager_.reset(); base::RunLoop().RunUntilIdle(); std::unique_ptr<CloudExternalDataStore> cache(new CloudExternalDataStore( - kCacheKey, scoped_task_environment_.GetMainThreadTaskRunner(), + kCacheKey, task_environment_.GetMainThreadTaskRunner(), resource_cache_.get())); EXPECT_FALSE(cache ->Store(k20BytePolicy, crypto::SHA256HashString(k20ByteData), @@ -592,7 +591,7 @@ external_data_manager_.reset(); base::RunLoop().RunUntilIdle(); cache.reset(new CloudExternalDataStore( - kCacheKey, scoped_task_environment_.GetMainThreadTaskRunner(), + kCacheKey, task_environment_.GetMainThreadTaskRunner(), resource_cache_.get())); std::string data; EXPECT_TRUE(cache @@ -606,7 +605,7 @@ external_data_manager_.reset(); base::RunLoop().RunUntilIdle(); std::unique_ptr<CloudExternalDataStore> cache(new CloudExternalDataStore( - kCacheKey, scoped_task_environment_.GetMainThreadTaskRunner(), + kCacheKey, task_environment_.GetMainThreadTaskRunner(), resource_cache_.get())); // Store external data for |k10BytePolicy| that exceeds the maximal external // data size allowed for that policy. @@ -659,7 +658,7 @@ external_data_manager_.reset(); base::RunLoop().RunUntilIdle(); cache.reset(new CloudExternalDataStore( - kCacheKey, scoped_task_environment_.GetMainThreadTaskRunner(), + kCacheKey, task_environment_.GetMainThreadTaskRunner(), resource_cache_.get())); std::string data; // Verify that the invalid external data for |k10BytePolicy| has been pruned
diff --git a/chrome/browser/chromeos/policy/component_active_directory_policy_retriever_unittest.cc b/chrome/browser/chromeos/policy/component_active_directory_policy_retriever_unittest.cc index 4518f0c..e83d61a 100644 --- a/chrome/browser/chromeos/policy/component_active_directory_policy_retriever_unittest.cc +++ b/chrome/browser/chromeos/policy/component_active_directory_policy_retriever_unittest.cc
@@ -57,7 +57,7 @@ void OnPolicyStored(bool success) { policy_stored_ = success; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::vector<RetrieveResult> results_; bool policy_stored_ = false; bool callback_called_ = false; @@ -70,7 +70,7 @@ login_manager::ACCOUNT_TYPE_DEVICE, kEmptyAccountId, empty_namespaces, CreateRetrieveCallback()); retriever.Start(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(results_.empty()); EXPECT_TRUE(callback_called_); } @@ -82,7 +82,7 @@ login_manager::ACCOUNT_TYPE_DEVICE, kEmptyAccountId, namespaces, CreateRetrieveCallback()); retriever.Start(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1UL, results_.size()); EXPECT_EQ(namespaces[0], results_[0].ns); EXPECT_EQ(ResponseType::SUCCESS, results_[0].response); @@ -103,7 +103,7 @@ descriptor.set_component_id(kExtensionId); chromeos::SessionManagerClient::Get()->StorePolicy(descriptor, policy_blob, CreateStoredCallback()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(policy_stored_); // Retrieve the fake extension policy and make sure it matches. @@ -113,7 +113,7 @@ login_manager::ACCOUNT_TYPE_DEVICE, kEmptyAccountId, namespaces, CreateRetrieveCallback()); retriever.Start(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1UL, results_.size()); EXPECT_EQ(namespaces[0], results_[0].ns); EXPECT_EQ(ResponseType::SUCCESS, results_[0].response); @@ -129,7 +129,7 @@ CreateRetrieveCallback()); retriever->Start(); retriever.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(0UL, results_.size()); }
diff --git a/chrome/browser/chromeos/policy/component_active_directory_policy_service_unittest.cc b/chrome/browser/chromeos/policy/component_active_directory_policy_service_unittest.cc index 274b31e4..ec5e141 100644 --- a/chrome/browser/chromeos/policy/component_active_directory_policy_service_unittest.cc +++ b/chrome/browser/chromeos/policy/component_active_directory_policy_service_unittest.cc
@@ -150,7 +150,7 @@ EXPECT_CALL(delegate_, OnComponentActiveDirectoryPolicyUpdated()); registry_.RegisterComponent(ns, schema); registry_.SetAllDomainsReady(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); testing::Mock::VerifyAndClearExpectations(&delegate_); } @@ -198,7 +198,7 @@ const PolicyNamespace kTestExtensionNS2 = PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kTestExtensionId2); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; PolicyMap expected_policy_; SchemaRegistry registry_; std::unique_ptr<ComponentActiveDirectoryPolicyService> service_; @@ -222,7 +222,7 @@ TEST_F(ComponentActiveDirectoryPolicyServiceTest, PolicyNotSetWithoutRegistry) { EXPECT_CALL(delegate_, OnComponentActiveDirectoryPolicyUpdated()).Times(0); service_->RetrievePolicies(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(service_->policy()); } @@ -230,7 +230,7 @@ TEST_F(ComponentActiveDirectoryPolicyServiceTest, RegistryTriggersRetrieval) { EXPECT_CALL(delegate_, OnComponentActiveDirectoryPolicyUpdated()); registry_.SetAllDomainsReady(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); CheckPolicyIsEmpty(); } @@ -244,14 +244,14 @@ EXPECT_CALL(delegate_, OnComponentActiveDirectoryPolicyUpdated()).Times(0); StorePolicy(kTestUserAccountId, login_manager::POLICY_DOMAIN_EXTENSIONS, kTestExtensionId); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); testing::Mock::VerifyAndClearExpectations(&delegate_); // Calling RetrievePolicies() should get the policy now. EXPECT_CALL(delegate_, OnComponentActiveDirectoryPolicyUpdated()); service_->RetrievePolicies(); CheckPolicyIsEmpty(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); CheckPolicyMatches(*ExpectedBundle()); } @@ -274,7 +274,7 @@ // Unregistering should trigger RetrievePolicies(). EXPECT_CALL(delegate_, OnComponentActiveDirectoryPolicyUpdated()); registry_.UnregisterComponent(kTestExtensionNS); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); testing::Mock::VerifyAndClearExpectations(&delegate_); CheckPolicyIsEmpty(); } @@ -411,7 +411,7 @@ StorePolicy(kTestUserAccountId, login_manager::POLICY_DOMAIN_EXTENSIONS, kTestExtensionId2); service_->RetrievePolicies(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // We should have received policy for both namespaces. PolicyBundle expected_bundle;
diff --git a/chrome/browser/chromeos/policy/device_scheduled_update_checker_unittest.cc b/chrome/browser/chromeos/policy/device_scheduled_update_checker_unittest.cc index 35ae03fd..0c788ee2 100644 --- a/chrome/browser/chromeos/policy/device_scheduled_update_checker_unittest.cc +++ b/chrome/browser/chromeos/policy/device_scheduled_update_checker_unittest.cc
@@ -310,9 +310,8 @@ class DeviceScheduledUpdateCheckerTest : public testing::Test { public: DeviceScheduledUpdateCheckerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO, + base::test::TaskEnvironment::TimeSource::MOCK_TIME), wake_lock_provider_( connector_factory_.RegisterInstance(device::mojom::kServiceName)) { auto fake_update_engine_client = @@ -323,7 +322,7 @@ chromeos::PowerManagerClient::InitializeFake(); chromeos::FakePowerManagerClient::Get()->set_tick_clock( - scoped_task_environment_.GetMockTickClock()); + task_environment_.GetMockTickClock()); network_state_test_helper_ = std::make_unique<chromeos::NetworkStateTestHelper>( @@ -334,8 +333,8 @@ chromeos::CrosSettings::Get(), network_state_test_helper_->network_state_handler(), connector_factory_.GetDefaultConnector(), - scoped_task_environment_.GetMockClock(), - scoped_task_environment_.GetMockTickClock()); + task_environment_.GetMockClock(), + task_environment_.GetMockTickClock()); } ~DeviceScheduledUpdateCheckerTest() override { @@ -354,7 +353,7 @@ chromeos::UpdateEngineClient::Status status = {}; status.status = update_status_operation; fake_update_engine_client_->NotifyObserversThatStatusChanged(status); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Returns true only iff all stats match in @@ -417,7 +416,7 @@ fake_update_engine_client_->request_update_check_call_count(); int expected_update_check_completions = device_scheduled_update_checker_->GetUpdateCheckCompletions(); - scoped_task_environment_.FastForwardBy(delay_from_now - small_delay); + task_environment_.FastForwardBy(delay_from_now - small_delay); if (!CheckStats(expected_update_checks, expected_update_check_requests, expected_update_check_completions)) { return false; @@ -428,7 +427,7 @@ expected_update_checks += 1; expected_update_check_requests += 1; expected_update_check_completions += 1; - scoped_task_environment_.FastForwardBy(small_delay); + task_environment_.FastForwardBy(small_delay); // Simulate update check succeeding. NotifyUpdateCheckStatus( @@ -445,7 +444,7 @@ expected_update_checks += 1; expected_update_check_requests += 1; expected_update_check_completions += 1; - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromDays(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromDays(1)); // Simulate update check succeeding. NotifyUpdateCheckStatus( @@ -563,8 +562,8 @@ // Fast forward right before the new time zone's expected timer expiration // time and check if no new events happened. const base::TimeDelta small_delay = base::TimeDelta::FromMilliseconds(1); - scoped_task_environment_.FastForwardBy(new_tz_timer_expiration_delay - - small_delay); + task_environment_.FastForwardBy(new_tz_timer_expiration_delay - + small_delay); if (!CheckStats(expected_update_checks, expected_update_check_requests, expected_update_check_completions)) { ADD_FAILURE() @@ -577,7 +576,7 @@ expected_update_checks += 1; expected_update_check_requests += 1; expected_update_check_completions += 1; - scoped_task_environment_.FastForwardBy(small_delay); + task_environment_.FastForwardBy(small_delay); // Simulate update check succeeding. NotifyUpdateCheckStatus( chromeos::UpdateEngineClient::UpdateStatusOperation:: @@ -592,7 +591,7 @@ return true; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<DeviceScheduledUpdateCheckerForTest> device_scheduled_update_checker_; chromeos::ScopedTestingCrosSettings cros_settings_; @@ -632,7 +631,7 @@ cros_settings_.device_settings()->Set( chromeos::kDeviceScheduledUpdateCheck, std::move(policy_and_next_update_check_time.first)); - scoped_task_environment_.FastForwardBy(delay_from_now - small_delay); + task_environment_.FastForwardBy(delay_from_now - small_delay); EXPECT_TRUE(CheckStats(expected_update_checks, expected_update_check_requests, expected_update_check_completions)); @@ -641,7 +640,7 @@ expected_update_checks += 1; expected_update_check_requests += 1; expected_update_check_completions += 1; - scoped_task_environment_.FastForwardBy(small_delay); + task_environment_.FastForwardBy(small_delay); // Simulate update check succeeding. NotifyUpdateCheckStatus(chromeos::UpdateEngineClient::UpdateStatusOperation:: UPDATE_STATUS_UPDATED_NEED_REBOOT); @@ -652,7 +651,7 @@ expected_update_checks += 1; expected_update_check_requests += 1; expected_update_check_completions += 1; - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromDays(7)); + task_environment_.FastForwardBy(base::TimeDelta::FromDays(7)); // Simulate update check succeeding. NotifyUpdateCheckStatus(chromeos::UpdateEngineClient::UpdateStatusOperation:: UPDATE_STATUS_UPDATED_NEED_REBOOT); @@ -683,7 +682,7 @@ cros_settings_.device_settings()->Set( chromeos::kDeviceScheduledUpdateCheck, std::move(policy_and_next_update_check_time.first)); - scoped_task_environment_.FastForwardBy(delay_from_now - small_delay); + task_environment_.FastForwardBy(delay_from_now - small_delay); EXPECT_TRUE(CheckStats(expected_update_checks, expected_update_check_requests, expected_update_check_completions)); @@ -692,7 +691,7 @@ expected_update_checks += 1; expected_update_check_requests += 1; expected_update_check_completions += 1; - scoped_task_environment_.FastForwardBy(small_delay); + task_environment_.FastForwardBy(small_delay); // Simulate update check succeeding. NotifyUpdateCheckStatus(chromeos::UpdateEngineClient::UpdateStatusOperation:: UPDATE_STATUS_UPDATED_NEED_REBOOT); @@ -712,7 +711,7 @@ second_update_check_time - device_scheduled_update_checker_->GetCurrentTime(); EXPECT_GT(second_update_check_delay, update_checker_internal::kInvalidDelay); - scoped_task_environment_.FastForwardBy(second_update_check_delay); + task_environment_.FastForwardBy(second_update_check_delay); // Simulate update check succeeding. NotifyUpdateCheckStatus(chromeos::UpdateEngineClient::UpdateStatusOperation:: UPDATE_STATUS_UPDATED_NEED_REBOOT); @@ -723,7 +722,7 @@ TEST_F(DeviceScheduledUpdateCheckerTest, CheckMonthlyRolloverLogic) { // The default time at the beginning is 31st December, 1969, 19:00:00.000 // America/New_York. Move it to 31st January, 1970 to test the rollover logic. - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromDays( + task_environment_.FastForwardBy(base::TimeDelta::FromDays( GetDaysInMonthInEpochYear(static_cast<UCalendarMonths>(UCAL_JANUARY)))); // Set the first update check time to be at 31st January, 1970, 20:00:00.000 @@ -747,7 +746,7 @@ cros_settings_.device_settings()->Set( chromeos::kDeviceScheduledUpdateCheck, std::move(policy_and_next_update_check_time.first)); - scoped_task_environment_.FastForwardBy(delay_from_now); + task_environment_.FastForwardBy(delay_from_now); // Simulate update check succeeding. NotifyUpdateCheckStatus(chromeos::UpdateEngineClient::UpdateStatusOperation:: UPDATE_STATUS_UPDATED_NEED_REBOOT); @@ -768,8 +767,8 @@ EXPECT_GT(expected_next_update_check_delay, update_checker_internal::kInvalidDelay); const base::TimeDelta small_delay = base::TimeDelta::FromMilliseconds(1); - scoped_task_environment_.FastForwardBy(expected_next_update_check_delay - - small_delay); + task_environment_.FastForwardBy(expected_next_update_check_delay - + small_delay); EXPECT_TRUE(CheckStats(expected_update_checks, expected_update_check_requests, expected_update_check_completions)); @@ -777,7 +776,7 @@ expected_update_checks += 1; expected_update_check_requests += 1; expected_update_check_completions += 1; - scoped_task_environment_.FastForwardBy(small_delay); + task_environment_.FastForwardBy(small_delay); // Simulate update check succeeding. NotifyUpdateCheckStatus( chromeos::UpdateEngineClient::UpdateStatusOperation:: @@ -813,7 +812,7 @@ const base::TimeDelta failure_delay = (update_checker_internal::kMaxStartUpdateCheckTimerRetryIterations - 2) * update_checker_internal::kStartUpdateCheckTimerRetryTime; - scoped_task_environment_.FastForwardBy(failure_delay); + task_environment_.FastForwardBy(failure_delay); EXPECT_TRUE(CheckStats(expected_update_checks, expected_update_check_requests, expected_update_check_completions)); @@ -822,7 +821,7 @@ // happen yet but a check has just been scheduled. device_scheduled_update_checker_->SimulateCalculateNextUpdateCheckFailure( false); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( update_checker_internal::kStartUpdateCheckTimerRetryTime); EXPECT_TRUE(CheckStats(expected_update_checks, expected_update_check_requests, expected_update_check_completions)); @@ -836,8 +835,7 @@ // Fast forward to right before the next update check and ensure that no // update checks happened. base::TimeDelta small_delay = base::TimeDelta::FromMilliseconds(1); - scoped_task_environment_.FastForwardBy(delay_till_next_update_check - - small_delay); + task_environment_.FastForwardBy(delay_till_next_update_check - small_delay); EXPECT_TRUE(CheckStats(expected_update_checks, expected_update_check_requests, expected_update_check_completions)); @@ -845,7 +843,7 @@ expected_update_checks += 1; expected_update_check_requests += 1; expected_update_check_completions += 1; - scoped_task_environment_.FastForwardBy(small_delay); + task_environment_.FastForwardBy(small_delay); // Simulate update check succeeding. NotifyUpdateCheckStatus( chromeos::UpdateEngineClient::UpdateStatusOperation:: @@ -869,7 +867,7 @@ // Fast forward by max retries * retry period and check that no update has // happened since failure mode is still set. - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( update_checker_internal::kMaxStartUpdateCheckTimerRetryIterations * update_checker_internal::kStartUpdateCheckTimerRetryTime); EXPECT_EQ(device_scheduled_update_checker_->GetUpdateCheckTimerExpirations(), @@ -895,7 +893,7 @@ // Fast forward by max retries * retry period and check that no update has // happened since failure mode is still set. - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( update_checker_internal::kMaxStartUpdateCheckTimerRetryIterations * update_checker_internal::kStartUpdateCheckTimerRetryTime); EXPECT_EQ(device_scheduled_update_checker_->GetUpdateCheckTimerExpirations(), @@ -925,7 +923,7 @@ int expected_update_checks = 1; int expected_update_check_requests = 1; int expected_update_check_completions = 0; - scoped_task_environment_.FastForwardBy(delay_from_now); + task_environment_.FastForwardBy(delay_from_now); NotifyUpdateCheckStatus( chromeos::UpdateEngineClient::UpdateStatusOperation::UPDATE_STATUS_ERROR); EXPECT_TRUE(CheckStats(expected_update_checks, expected_update_check_requests, @@ -938,7 +936,7 @@ update_checker_internal::kMaxOsAndPoliciesUpdateCheckerRetryIterations; i++) { expected_update_check_requests += 1; - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( update_checker_internal::kOsAndPoliciesUpdateCheckerRetryTime); // Simulate update check failing. NotifyUpdateCheckStatus(chromeos::UpdateEngineClient:: @@ -955,8 +953,8 @@ (update_checker_internal::kMaxOsAndPoliciesUpdateCheckerRetryIterations * update_checker_internal::kOsAndPoliciesUpdateCheckerRetryTime); const base::TimeDelta small_delay = base::TimeDelta::FromMilliseconds(1); - scoped_task_environment_.FastForwardBy(delay_till_next_update_check_timer - - small_delay); + task_environment_.FastForwardBy(delay_till_next_update_check_timer - + small_delay); EXPECT_TRUE(CheckStats(expected_update_checks, expected_update_check_requests, expected_update_check_completions)); @@ -964,7 +962,7 @@ // initiated. expected_update_checks += 1; expected_update_check_requests += 1; - scoped_task_environment_.FastForwardBy(small_delay); + task_environment_.FastForwardBy(small_delay); EXPECT_TRUE(CheckStats(expected_update_checks, expected_update_check_requests, expected_update_check_completions)); } @@ -987,7 +985,7 @@ int expected_update_checks = 1; int expected_update_check_requests = 1; int expected_update_check_completions = 0; - scoped_task_environment_.FastForwardBy(delay_from_now); + task_environment_.FastForwardBy(delay_from_now); // Simulate update check succeeding. NotifyUpdateCheckStatus( chromeos::UpdateEngineClient::UpdateStatusOperation::UPDATE_STATUS_ERROR); @@ -1002,7 +1000,7 @@ 1); i++) { expected_update_check_requests += 1; - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( update_checker_internal::kOsAndPoliciesUpdateCheckerRetryTime); NotifyUpdateCheckStatus(chromeos::UpdateEngineClient:: UpdateStatusOperation::UPDATE_STATUS_ERROR); @@ -1015,7 +1013,7 @@ // should complete. expected_update_check_requests += 1; expected_update_check_completions += 1; - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( update_checker_internal::kOsAndPoliciesUpdateCheckerRetryTime); NotifyUpdateCheckStatus(chromeos::UpdateEngineClient::UpdateStatusOperation:: UPDATE_STATUS_UPDATED_NEED_REBOOT); @@ -1040,7 +1038,7 @@ int expected_update_checks = 1; int expected_update_check_requests = 1; int expected_update_check_completions = 0; - scoped_task_environment_.FastForwardBy(delay_from_now); + task_environment_.FastForwardBy(delay_from_now); EXPECT_TRUE(CheckStats(expected_update_checks, expected_update_check_requests, expected_update_check_completions)); @@ -1065,7 +1063,7 @@ expected_update_checks += 1; expected_update_check_requests += 1; expected_update_check_completions += 1; - scoped_task_environment_.FastForwardBy(delay_from_now); + task_environment_.FastForwardBy(delay_from_now); // Simulate update check succeeding. NotifyUpdateCheckStatus(chromeos::UpdateEngineClient::UpdateStatusOperation:: UPDATE_STATUS_UPDATED_NEED_REBOOT); @@ -1109,7 +1107,7 @@ int expected_update_check_requests = 0; int expected_update_check_completions = 0; device_scheduled_update_checker_->GetUpdateCheckCompletions(); - scoped_task_environment_.FastForwardBy(delay_from_now - small_delay); + task_environment_.FastForwardBy(delay_from_now - small_delay); EXPECT_TRUE(CheckStats(expected_update_checks, expected_update_check_requests, expected_update_check_completions)); @@ -1117,7 +1115,7 @@ // to no network being connected but no update check requests or completions // should happens. expected_update_checks += 1; - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( small_delay + update_checker_internal::kWaitForNetworkTimeout); // Go online again. This time the next scheduled update check should complete. @@ -1126,7 +1124,7 @@ expected_update_checks += 1; expected_update_check_requests += 1; expected_update_check_completions += 1; - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( base::TimeDelta::FromDays(1) - update_checker_internal::kWaitForNetworkTimeout); // Simulate update check succeeding. @@ -1157,7 +1155,7 @@ int expected_update_check_requests = 0; int expected_update_check_completions = 0; device_scheduled_update_checker_->GetUpdateCheckCompletions(); - scoped_task_environment_.FastForwardBy(delay_from_now - small_delay); + task_environment_.FastForwardBy(delay_from_now - small_delay); EXPECT_TRUE(CheckStats(expected_update_checks, expected_update_check_requests, expected_update_check_completions)); @@ -1167,8 +1165,7 @@ const base::TimeDelta network_not_present_delay = update_checker_internal::kWaitForNetworkTimeout - small_delay; expected_update_checks += 1; - scoped_task_environment_.FastForwardBy(small_delay + - network_not_present_delay); + task_environment_.FastForwardBy(small_delay + network_not_present_delay); // Go online again. The existing update check should complete. network_state_test_helper_->ConfigureService(
diff --git a/chrome/browser/chromeos/policy/external_data_handlers/device_native_printers_external_data_handler_unittest.cc b/chrome/browser/chromeos/policy/external_data_handlers/device_native_printers_external_data_handler_unittest.cc index 449feed..d8dc165e 100644 --- a/chrome/browser/chromeos/policy/external_data_handlers/device_native_printers_external_data_handler_unittest.cc +++ b/chrome/browser/chromeos/policy/external_data_handlers/device_native_printers_external_data_handler_unittest.cc
@@ -84,7 +84,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockPolicyService policy_service_; std::unique_ptr<DeviceNativePrintersExternalDataHandler> device_native_printers_external_data_handler_; @@ -100,7 +100,7 @@ key::kDeviceNativePrinters, std::make_unique<std::string>(kDeviceNativePrintersContentsJson), base::FilePath()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const auto& printers = external_printers_->GetPrinters(); @@ -121,7 +121,7 @@ base::FilePath()); device_native_printers_external_data_handler_->OnDeviceExternalDataCleared( key::kDeviceNativePrinters); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Check that policy was cleared. EXPECT_TRUE(external_printers_->GetPrinters().empty());
diff --git a/chrome/browser/chromeos/policy/pre_signin_policy_fetcher_unittest.cc b/chrome/browser/chromeos/policy/pre_signin_policy_fetcher_unittest.cc index ed99a42..1724c31 100644 --- a/chrome/browser/chromeos/policy/pre_signin_policy_fetcher_unittest.cc +++ b/chrome/browser/chromeos/policy/pre_signin_policy_fetcher_unittest.cc
@@ -160,11 +160,11 @@ pre_signin_policy_fetcher_->FetchPolicy( base::Bind(&PreSigninPolicyFetcherTestBase::OnPolicyRetrieved, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_ = { - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_ = { + base::test::TaskEnvironment::MainThreadType::UI}; std::unique_ptr<chromeos::FakeCryptohomeClient> cryptohome_client_; chromeos::FakeSessionManagerClient session_manager_client_; UserPolicyBuilder cached_policy_; @@ -378,7 +378,7 @@ std::string() /* settings_entity_id */, fresh_policy_.policy()); cloud_policy_client_->NotifyPolicyFetched(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Expect that we still get a PolicyFetchResult::SUCCESS with cached policy. EXPECT_TRUE(policy_retrieved_called_); @@ -414,7 +414,7 @@ std::string() /* settings_entity_id */, fresh_policy_.policy()); cloud_policy_client_->NotifyPolicyFetched(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Expect that we get PolicyFetchResult::SUCCESS with fresh policy. EXPECT_TRUE(policy_retrieved_called_);
diff --git a/chrome/browser/chromeos/policy/server_backed_state_keys_broker_unittest.cc b/chrome/browser/chromeos/policy/server_backed_state_keys_broker_unittest.cc index c55f0da7..c1b584d 100644 --- a/chrome/browser/chromeos/policy/server_backed_state_keys_broker_unittest.cc +++ b/chrome/browser/chromeos/policy/server_backed_state_keys_broker_unittest.cc
@@ -44,7 +44,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedMockTimeMessageLoopTaskRunner mocked_main_runner_; chromeos::FakeSessionManagerClient fake_session_manager_client_; ServerBackedStateKeysBroker broker_;
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc index d1b7fba..5dc0fa8edc 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc
@@ -121,8 +121,7 @@ class UserCloudPolicyStoreChromeOSTest : public testing::Test { protected: UserCloudPolicyStoreChromeOSTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir()); @@ -238,7 +237,7 @@ return GetUserPolicyKeyFile(user_policy_dir(), cryptohome_id_); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; chromeos::FakeCryptohomeClient cryptohome_client_; std::unique_ptr<FakeSessionManagerClient> session_manager_client_; UserPolicyBuilder policy_;
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/adapter_unittest.cc b/chrome/browser/chromeos/power/auto_screen_brightness/adapter_unittest.cc index 82e1244..8e614e1 100644 --- a/chrome/browser/chromeos/power/auto_screen_brightness/adapter_unittest.cc +++ b/chrome/browser/chromeos/power/auto_screen_brightness/adapter_unittest.cc
@@ -130,8 +130,7 @@ class AdapterTest : public testing::Test { public: AdapterTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~AdapterTest() override = default;
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/als_reader_impl_unittest.cc b/chrome/browser/chromeos/power/auto_screen_brightness/als_reader_impl_unittest.cc index 8066a4c..ab6ddea 100644 --- a/chrome/browser/chromeos/power/auto_screen_brightness/als_reader_impl_unittest.cc +++ b/chrome/browser/chromeos/power/auto_screen_brightness/als_reader_impl_unittest.cc
@@ -54,9 +54,8 @@ class AlsReaderImplTest : public testing::Test { public: AlsReaderImplTest() - : scoped_task_environment_( - std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME)) { + : task_environment_(std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::TimeSource::MOCK_TIME)) { CHECK(temp_dir_.CreateUniqueTempDir()); ambient_light_path_ = temp_dir_.GetPath().Append("test_als"); als_reader_.SetTaskRunnerForTesting(base::SequencedTaskRunnerHandle::Get()); @@ -80,7 +79,7 @@ base::FilePath ambient_light_path_; base::HistogramTester histogram_tester_; - std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_; + std::unique_ptr<base::test::TaskEnvironment> task_environment_; AlsReaderImpl als_reader_; TestObserver test_observer_; @@ -116,7 +115,7 @@ TEST_F(AlsReaderImplTest, OneAlsValue) { WriteLux(10); - scoped_task_environment_->RunUntilIdle(); + task_environment_->RunUntilIdle(); EXPECT_EQ(10, test_observer_.ambient_light()); EXPECT_EQ(1, test_observer_.num_received_ambient_lights()); } @@ -126,13 +125,13 @@ // Ambient light is read immediately after initialization, and then // periodically every |kAlsPollInterval|. Below we move time for half of // |kAlsPollInterval| to ensure there is only one reading attempt. - scoped_task_environment_->FastForwardBy(AlsReaderImpl::kAlsPollInterval / 2); + task_environment_->FastForwardBy(AlsReaderImpl::kAlsPollInterval / 2); EXPECT_EQ(10, test_observer_.ambient_light()); EXPECT_EQ(1, test_observer_.num_received_ambient_lights()); WriteLux(20); // Now move time for another |kAlsPollInterval| to trigger another read. - scoped_task_environment_->FastForwardBy(AlsReaderImpl::kAlsPollInterval); + task_environment_->FastForwardBy(AlsReaderImpl::kAlsPollInterval); EXPECT_EQ(20, test_observer_.ambient_light()); EXPECT_EQ(2, test_observer_.num_received_ambient_lights()); }
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl_unittest.cc b/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl_unittest.cc index ad16487..2b996366 100644 --- a/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl_unittest.cc +++ b/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl_unittest.cc
@@ -70,8 +70,7 @@ class BrightnessMonitorImplTest : public testing::Test { public: BrightnessMonitorImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~BrightnessMonitorImplTest() override {} @@ -105,7 +104,7 @@ monitor_->Init(); test_observer_ = std::make_unique<TestObserver>(); monitor_->AddObserver(test_observer_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } protected: @@ -117,10 +116,10 @@ change.set_cause(cause); static_cast<FakePowerManagerClient*>(PowerManagerClient::Get()) ->SendScreenBrightnessChanged(change); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::HistogramTester histogram_tester_; std::unique_ptr<BrightnessMonitorImpl> monitor_; std::unique_ptr<TestObserver> test_observer_; @@ -132,7 +131,7 @@ TEST_F(BrightnessMonitorImplTest, ReportSuccess) { SetUpBrightnessMonitor(10); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); histogram_tester_.ExpectUniqueSample( "AutoScreenBrightness.BrightnessMonitorStatus", @@ -141,7 +140,7 @@ TEST_F(BrightnessMonitorImplTest, ReportDisabled) { SetUpBrightnessMonitor(-1); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); histogram_tester_.ExpectUniqueSample( "AutoScreenBrightness.BrightnessMonitorStatus", @@ -158,7 +157,7 @@ // User request will be ignored. ReportBrightnessChangeEvent( 20, power_manager::BacklightBrightnessChange_Cause_USER_REQUEST); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( monitor_->GetBrightnessSampleDelayForTesting() * 2); EXPECT_EQ(0, test_observer_->num_brightness_changes()); EXPECT_EQ(0, test_observer_->num_user_brightness_change_requested()); @@ -178,7 +177,7 @@ EXPECT_EQ(1, test_observer_->num_user_brightness_change_requested()); EXPECT_EQ(0, test_observer_->num_brightness_changes()); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( monitor_->GetBrightnessSampleDelayForTesting() / 2); // Second user-requested brightness adjustment. ReportBrightnessChangeEvent( @@ -186,7 +185,7 @@ EXPECT_EQ(2, test_observer_->num_user_brightness_change_requested()); EXPECT_EQ(0, test_observer_->num_brightness_changes()); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( monitor_->GetBrightnessSampleDelayForTesting() * 2); EXPECT_EQ(2, test_observer_->num_user_brightness_change_requested()); @@ -210,7 +209,7 @@ EXPECT_EQ(1, test_observer_->num_user_brightness_change_requested()); EXPECT_EQ(0, test_observer_->num_brightness_changes()); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( monitor_->GetBrightnessSampleDelayForTesting() * 2); EXPECT_EQ(1, test_observer_->num_user_brightness_change_requested()); EXPECT_EQ(1, test_observer_->num_brightness_changes()); @@ -221,7 +220,7 @@ ReportBrightnessChangeEvent( 30, power_manager::BacklightBrightnessChange_Cause_USER_REQUEST); EXPECT_EQ(2, test_observer_->num_user_brightness_change_requested()); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( monitor_->GetBrightnessSampleDelayForTesting() * 2); EXPECT_EQ(2, test_observer_->num_user_brightness_change_requested()); @@ -239,7 +238,7 @@ ReportBrightnessChangeEvent( 20, power_manager::BacklightBrightnessChange_Cause_USER_ACTIVITY); EXPECT_EQ(0, test_observer_->num_user_brightness_change_requested()); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( monitor_->GetBrightnessSampleDelayForTesting() / 2); EXPECT_EQ(0, test_observer_->num_brightness_changes()); @@ -247,7 +246,7 @@ ReportBrightnessChangeEvent( 30, power_manager::BacklightBrightnessChange_Cause_USER_REQUEST); EXPECT_EQ(1, test_observer_->num_user_brightness_change_requested()); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( monitor_->GetBrightnessSampleDelayForTesting() * 2); EXPECT_EQ(1, test_observer_->num_brightness_changes()); @@ -263,14 +262,14 @@ ReportBrightnessChangeEvent( 20, power_manager::BacklightBrightnessChange_Cause_USER_ACTIVITY); EXPECT_EQ(0, test_observer_->num_user_brightness_change_requested()); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( monitor_->GetBrightnessSampleDelayForTesting() * 2); EXPECT_EQ(0, test_observer_->num_brightness_changes()); ReportBrightnessChangeEvent( 30, power_manager::BacklightBrightnessChange_Cause_USER_REQUEST); EXPECT_EQ(1, test_observer_->num_user_brightness_change_requested()); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( monitor_->GetBrightnessSampleDelayForTesting() * 2); EXPECT_EQ(1, test_observer_->num_brightness_changes()); @@ -291,7 +290,7 @@ EXPECT_EQ(0, test_observer_->num_brightness_changes()); // Non-user. - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( monitor_->GetBrightnessSampleDelayForTesting() / 2); ReportBrightnessChangeEvent( 30, power_manager::BacklightBrightnessChange_Cause_USER_ACTIVITY); @@ -307,7 +306,7 @@ EXPECT_EQ(2, test_observer_->num_user_brightness_change_requested()); EXPECT_EQ(1, test_observer_->num_brightness_changes()); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( monitor_->GetBrightnessSampleDelayForTesting() * 2); EXPECT_EQ(2, test_observer_->num_user_brightness_change_requested()); EXPECT_EQ(2, test_observer_->num_brightness_changes());
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/metrics_reporter_unittest.cc b/chrome/browser/chromeos/power/auto_screen_brightness/metrics_reporter_unittest.cc index 5cda3fe..d49fa3a 100644 --- a/chrome/browser/chromeos/power/auto_screen_brightness/metrics_reporter_unittest.cc +++ b/chrome/browser/chromeos/power/auto_screen_brightness/metrics_reporter_unittest.cc
@@ -74,7 +74,7 @@ histogram_tester.ExpectUniqueSample(histogram_name, expected_count, 1); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestingPrefServiceSimple pref_service_; std::unique_ptr<MetricsReporter> reporter_;
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl_unittest.cc b/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl_unittest.cc index f66b851..11a9e3108 100644 --- a/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl_unittest.cc +++ b/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl_unittest.cc
@@ -55,8 +55,7 @@ class ModelConfigLoaderImplTest : public testing::Test { public: ModelConfigLoaderImplTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) { + : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) { CHECK(temp_dir_.CreateUniqueTempDir()); temp_params_path_ = temp_dir_.GetPath().Append("model_params.json"); }
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl_unittest.cc b/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl_unittest.cc index 3b658a1e..1526f6a 100644 --- a/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl_unittest.cc +++ b/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl_unittest.cc
@@ -162,8 +162,7 @@ class ModellerImplTest : public testing::Test { public: ModellerImplTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) { + : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) { CHECK(temp_dir_.CreateUniqueTempDir()); TestingProfile::Builder profile_builder; profile_builder.SetProfileName("testuser@gmail.com");
diff --git a/chrome/browser/chromeos/power/ml/adaptive_screen_brightness_manager_unittest.cc b/chrome/browser/chromeos/power/ml/adaptive_screen_brightness_manager_unittest.cc index 327d5532..233aba7 100644 --- a/chrome/browser/chromeos/power/ml/adaptive_screen_brightness_manager_unittest.cc +++ b/chrome/browser/chromeos/power/ml/adaptive_screen_brightness_manager_unittest.cc
@@ -81,10 +81,9 @@ public: AdaptiveScreenBrightnessManagerTest() : ChromeRenderViewHostTestHarness( - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) {} + base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} ~AdaptiveScreenBrightnessManagerTest() override = default;
diff --git a/chrome/browser/chromeos/power/ml/boot_clock.h b/chrome/browser/chromeos/power/ml/boot_clock.h index 5d5fa77..26d06f6 100644 --- a/chrome/browser/chromeos/power/ml/boot_clock.h +++ b/chrome/browser/chromeos/power/ml/boot_clock.h
@@ -15,7 +15,7 @@ // even when system is suspended (unlike TimeTicks -- for now and unless // crbug.com/166153 resolves in favor of absolute ticks everywhere). // BootClock supports -// base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME. When time is +// base::test::TaskEnvironment::TimeSource::MOCK_TIME. When time is // mocked, it will use the mocked TimeTicks::Now() to compute its delta. class BootClock { public:
diff --git a/chrome/browser/chromeos/power/ml/boot_clock_unittest.cc b/chrome/browser/chromeos/power/ml/boot_clock_unittest.cc index f59cd51..f8533ba 100644 --- a/chrome/browser/chromeos/power/ml/boot_clock_unittest.cc +++ b/chrome/browser/chromeos/power/ml/boot_clock_unittest.cc
@@ -28,8 +28,8 @@ } TEST(BootClockTest, UnderMockTime) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); BootClock boot_clock; constexpr base::TimeDelta mock_sleep_duration =
diff --git a/chrome/browser/chromeos/power/ml/idle_event_notifier_unittest.cc b/chrome/browser/chromeos/power/ml/idle_event_notifier_unittest.cc index 8739024..1286b85 100644 --- a/chrome/browser/chromeos/power/ml/idle_event_notifier_unittest.cc +++ b/chrome/browser/chromeos/power/ml/idle_event_notifier_unittest.cc
@@ -56,9 +56,8 @@ public: IdleEventNotifierTest() : scoped_task_env_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) {} + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} ~IdleEventNotifierTest() override = default; @@ -80,7 +79,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_env_; + base::test::TaskEnvironment scoped_task_env_; std::unique_ptr<IdleEventNotifier> idle_event_notifier_; power_manager::PowerSupplyProperties ac_power_;
diff --git a/chrome/browser/chromeos/power/ml/smart_dim/model_unittest.cc b/chrome/browser/chromeos/power/ml/smart_dim/model_unittest.cc index 825baa0..d34880b 100644 --- a/chrome/browser/chromeos/power/ml/smart_dim/model_unittest.cc +++ b/chrome/browser/chromeos/power/ml/smart_dim/model_unittest.cc
@@ -119,10 +119,9 @@ class SmartDimModelImplTest : public testing::Test { public: SmartDimModelImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) {} + : task_environment_( + base::test::TaskEnvironment::MainThreadType::IO, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} ~SmartDimModelImplTest() override = default; @@ -132,7 +131,7 @@ impl->SetMlServiceClientForTesting(std::make_unique<FakeMlServiceClient>()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: DISALLOW_COPY_AND_ASSIGN(SmartDimModelImplTest); @@ -161,7 +160,7 @@ *callback_done = true; }, &callback_done)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_done); } @@ -188,7 +187,7 @@ *callback_done = true; }, &callback_done)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_done); } @@ -220,7 +219,7 @@ }, &callback_done, &num_callbacks_run)); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_done); EXPECT_EQ(1, num_callbacks_run); } @@ -243,7 +242,7 @@ }, &callback_done)); smart_dim_model.CancelPreviousRequest(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(callback_done); }
diff --git a/chrome/browser/chromeos/power/ml/user_activity_manager_unittest.cc b/chrome/browser/chromeos/power/ml/user_activity_manager_unittest.cc index 304a589..0548bf2 100644 --- a/chrome/browser/chromeos/power/ml/user_activity_manager_unittest.cc +++ b/chrome/browser/chromeos/power/ml/user_activity_manager_unittest.cc
@@ -169,9 +169,9 @@ public: UserActivityManagerTest() : ChromeRenderViewHostTestHarness( - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED), + base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED), model_(thread_bundle()->GetMainThreadTaskRunner()) {} ~UserActivityManagerTest() override = default;
diff --git a/chrome/browser/chromeos/power/power_metrics_reporter_unittest.cc b/chrome/browser/chromeos/power/power_metrics_reporter_unittest.cc index ebfa6c90..9392c32 100644 --- a/chrome/browser/chromeos/power/power_metrics_reporter_unittest.cc +++ b/chrome/browser/chromeos/power/power_metrics_reporter_unittest.cc
@@ -86,7 +86,7 @@ lid_closed_suspend_count, 1); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestingPrefServiceSimple pref_service_; std::unique_ptr<PowerMetricsReporter> reporter_;
diff --git a/chrome/browser/chromeos/power/process_data_collector_unittest.cc b/chrome/browser/chromeos/power/process_data_collector_unittest.cc index 57c4cb4..892094a 100644 --- a/chrome/browser/chromeos/power/process_data_collector_unittest.cc +++ b/chrome/browser/chromeos/power/process_data_collector_unittest.cc
@@ -358,7 +358,7 @@ // Represents the root of the simulated procfs. base::ScopedTempDir proc_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // The current time step, used in testing functions. int timestep_ = 0;
diff --git a/chrome/browser/chromeos/printing/bulk_printers_calculator_unittest.cc b/chrome/browser/chromeos/printing/bulk_printers_calculator_unittest.cc index 7b3e7904..840f8d1 100644 --- a/chrome/browser/chromeos/printing/bulk_printers_calculator_unittest.cc +++ b/chrome/browser/chromeos/printing/bulk_printers_calculator_unittest.cc
@@ -92,7 +92,7 @@ class BulkPrintersCalculatorTest : public testing::Test { public: - BulkPrintersCalculatorTest() : scoped_task_environment_() { + BulkPrintersCalculatorTest() : task_environment_() { scoped_feature_list_.InitAndEnableFeature( base::Feature(features::kBulkPrinters)); external_printers_ = BulkPrintersCalculator::Create(); @@ -104,7 +104,7 @@ protected: std::unique_ptr<BulkPrintersCalculator> external_printers_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: base::test::ScopedFeatureList scoped_feature_list_; @@ -128,7 +128,7 @@ } // printers is out of scope. Destructor has run. Pump the message queue to // see if anything strange happens. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Verifies that IsDataPolicySet returns false until data is set. @@ -138,7 +138,7 @@ EXPECT_FALSE(external_printers_->IsDataPolicySet()); external_printers_->SetData(std::move(data)); EXPECT_TRUE(external_printers_->IsDataPolicySet()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(external_printers_->IsComplete()); } @@ -150,7 +150,7 @@ external_printers_->SetData(std::move(data)); EXPECT_TRUE(external_printers_->IsDataPolicySet()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(external_printers_->IsComplete()); const auto& printers = external_printers_->GetPrinters(); EXPECT_EQ(kNumPrinters, printers.size()); @@ -167,11 +167,11 @@ external_printers_->ClearData(); external_printers_->SetData(std::move(data)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(external_printers_->IsDataPolicySet()); external_printers_->ClearData(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(external_printers_->IsDataPolicySet()); EXPECT_TRUE(external_printers_->GetPrinters().empty()); } @@ -184,12 +184,12 @@ external_printers_->ClearData(); external_printers_->SetData(std::move(data)); external_printers_->SetAccessMode(BulkPrintersCalculator::BLACKLIST_ONLY); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); external_printers_->SetBlacklist({"Second", "Third"}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(external_printers_->IsComplete()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const auto& printers = external_printers_->GetPrinters(); EXPECT_EQ(1U, printers.size()); EXPECT_EQ("LexaPrint", printers.at("First").display_name()); @@ -202,10 +202,10 @@ external_printers_->ClearData(); external_printers_->SetData(std::move(data)); external_printers_->SetAccessMode(BulkPrintersCalculator::WHITELIST_ONLY); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); external_printers_->SetWhitelist({"First"}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(external_printers_->IsComplete()); const auto& printers = external_printers_->GetPrinters(); EXPECT_EQ(1U, printers.size()); @@ -218,10 +218,10 @@ external_printers_->ClearData(); external_printers_->SetData(std::move(data)); external_printers_->SetAccessMode(BulkPrintersCalculator::BLACKLIST_ONLY); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); external_printers_->SetBlacklist({}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(external_printers_->IsComplete()); const auto& printers = external_printers_->GetPrinters(); EXPECT_EQ(kNumPrinters, printers.size()); @@ -233,10 +233,10 @@ external_printers_->ClearData(); external_printers_->SetData(std::move(data)); external_printers_->SetAccessMode(BulkPrintersCalculator::WHITELIST_ONLY); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); external_printers_->SetWhitelist({}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(external_printers_->IsComplete()); const auto& printers = external_printers_->GetPrinters(); EXPECT_EQ(0U, printers.size()); @@ -254,7 +254,7 @@ // This should result in 2 printers. But we're switching the mode anyway. external_printers_->SetAccessMode(BulkPrintersCalculator::WHITELIST_ONLY); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(external_printers_->IsComplete()); const auto& printers = external_printers_->GetPrinters(); EXPECT_EQ(1U, printers.size()); @@ -272,7 +272,7 @@ auto new_data = std::make_unique<std::string>(kMoreContentsJson); external_printers_->SetData(std::move(new_data)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const auto& printers = external_printers_->GetPrinters(); ASSERT_EQ(1U, printers.size()); EXPECT_EQ("ThirdPrime", printers.at("ThirdPrime").id()); @@ -287,13 +287,13 @@ external_printers_->SetWhitelist(std::vector<std::string>()); external_printers_->SetBlacklist(std::vector<std::string>()); external_printers_->ClearData(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1, obs.called); external_printers_->SetData( std::make_unique<std::string>(kBulkPolicyContentsJson)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(external_printers_->IsDataPolicySet()); EXPECT_EQ(2, obs.called); EXPECT_TRUE(obs.last_valid); // ready now @@ -301,17 +301,17 @@ EXPECT_EQ(kNumPrinters, external_printers_->GetPrinters().size()); external_printers_->SetAccessMode(BulkPrintersCalculator::WHITELIST_ONLY); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(3, obs.called); // effective list changed. Notified. EXPECT_TRUE(obs.last_valid); external_printers_->SetAccessMode(BulkPrintersCalculator::BLACKLIST_ONLY); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(4, obs.called); // effective list changed. Notified. EXPECT_TRUE(obs.last_valid); external_printers_->ClearData(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(5, obs.called); // Called for transition to invalid policy. EXPECT_TRUE(obs.last_valid); EXPECT_TRUE(external_printers_->GetPrinters().empty());
diff --git a/chrome/browser/chromeos/printing/cups_printers_manager_unittest.cc b/chrome/browser/chromeos/printing/cups_printers_manager_unittest.cc index 3a682c6..8b016fa 100644 --- a/chrome/browser/chromeos/printing/cups_printers_manager_unittest.cc +++ b/chrome/browser/chromeos/printing/cups_printers_manager_unittest.cc
@@ -387,7 +387,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::test::ScopedFeatureList scoped_feature_list_; // Captured printer lists from observer callbacks. @@ -451,7 +451,7 @@ TEST_F(CupsPrintersManagerTest, GetEnterprisePrinters) { synced_printers_manager_.AddEnterprisePrinters( {Printer("Foo"), Printer("Bar")}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersInClassAre(PrinterClass::kEnterprise, {"Foo", "Bar"}); } @@ -459,7 +459,7 @@ // surfaced appropriately. TEST_F(CupsPrintersManagerTest, GetSavedPrinters) { synced_printers_manager_.AddSavedPrinters({Printer("Foo"), Printer("Bar")}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersInClassAre(PrinterClass::kSaved, {"Foo", "Bar"}); } @@ -469,7 +469,7 @@ TEST_F(CupsPrintersManagerTest, GetUsbPrinters) { usb_detector_->AddDetections({MakeDiscoveredPrinter("DiscoveredPrinter"), MakeAutomaticPrinter("AutomaticPrinter")}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersInClassAre(PrinterClass::kDiscovered, {"DiscoveredPrinter"}); ExpectPrintersInClassAre(PrinterClass::kAutomatic, {"AutomaticPrinter"}); } @@ -480,7 +480,7 @@ MakeAutomaticPrinter("AutomaticPrinter")}); synced_printers_manager_.AddSavedPrinters({Printer("Foo"), Printer("Bar")}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersInClassAre(PrinterClass::kDiscovered, {"DiscoveredPrinter"}); ExpectPrintersInClassAre(PrinterClass::kAutomatic, {"AutomaticPrinter"}); } @@ -493,7 +493,7 @@ MakeDiscoveredPrinter("DiscoveredPrinter1"), MakeAutomaticPrinter("AutomaticPrinter0"), MakeAutomaticPrinter("AutomaticPrinter1")}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Before we muck with anything else, check that automatic and discovered // classes are what we intended to set up. ExpectPrintersInClassAre(PrinterClass::kDiscovered, @@ -512,7 +512,7 @@ /*is_automatic=*/true, PrinterSetupSource::kPrintPreview); manager_->SavePrinter(Printer("AutomaticPrinter0")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersInClassAre(PrinterClass::kDiscovered, {"DiscoveredPrinter1"}); ExpectPrintersInClassAre(PrinterClass::kAutomatic, {"AutomaticPrinter1"}); ExpectPrintersInClassAre(PrinterClass::kSaved, @@ -530,7 +530,7 @@ synced_printers_manager_.AddSavedPrinters({existing_saved}); usb_detector_->AddDetections({MakeDiscoveredPrinter("Discovered")}); zeroconf_detector_->AddDetections({MakeAutomaticPrinter("Automatic")}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Sanity check that we do, indeed, have one printer in each class. ExpectPrintersInClassAre(PrinterClass::kSaved, {"Saved"}); @@ -541,7 +541,7 @@ // propagated. existing_saved.set_display_name("New Display Name"); manager_->SavePrinter(existing_saved); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersInClassAre(PrinterClass::kSaved, {"Saved"}); EXPECT_EQ(manager_->GetPrinters(PrinterClass::kSaved)[0].display_name(), "New Display Name"); @@ -550,26 +550,26 @@ // Create a configuration for the zeroconf printer, which should shift it // into the saved category. manager_->SavePrinter(Printer("Automatic")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersInClassAre(PrinterClass::kAutomatic, {}); ExpectPrintersInClassAre(PrinterClass::kSaved, {"Automatic", "Saved"}); manager_->SavePrinter(Printer("Discovered")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersInClassAre(PrinterClass::kDiscovered, {}); ExpectPrintersInClassAre(PrinterClass::kSaved, {"Automatic", "Saved", "Discovered"}); // Save a printer we haven't seen before, which should just add it to kSaved. manager_->SavePrinter(Printer("NewFangled")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersInClassAre(PrinterClass::kSaved, {"Automatic", "Saved", "Discovered", "NewFangled"}); // Remove the automatic printer, make sure it ends up back in the automatic // class after removal. manager_->RemoveSavedPrinter("Automatic"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersInClassAre(PrinterClass::kSaved, {"Saved", "Discovered", "NewFangled"}); ExpectPrintersInClassAre(PrinterClass::kAutomatic, {"Automatic"}); @@ -582,7 +582,7 @@ synced_printers_manager_.AddEnterprisePrinters({Printer("Enterprise")}); usb_detector_->AddDetections({MakeDiscoveredPrinter("Discovered")}); zeroconf_detector_->AddDetections({MakeAutomaticPrinter("Automatic")}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); for (const std::string& id : {"Saved", "Enterprise", "Discovered", "Automatic"}) { @@ -601,7 +601,7 @@ TEST_F(CupsPrintersManagerTest, GetPrintersUserNativePrintersDisabled) { synced_printers_manager_.AddSavedPrinters({Printer("Saved")}); synced_printers_manager_.AddEnterprisePrinters({Printer("Enterprise")}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Disable the use of non-enterprise printers. UpdatePolicyValue(prefs::kUserNativePrintersAllowed, false); @@ -626,7 +626,7 @@ synced_printers_manager_.AddSavedPrinters({existing_saved}); usb_detector_->AddDetections({MakeDiscoveredPrinter("Discovered")}); zeroconf_detector_->AddDetections({MakeAutomaticPrinter("Automatic")}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Sanity check that we do, indeed, have one printer in each class. ExpectPrintersInClassAre(PrinterClass::kSaved, {"Saved"}); @@ -640,7 +640,7 @@ // progogate. existing_saved.set_display_name("New Display Name"); manager_->SavePrinter(existing_saved); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Reenable user printers in order to do checking. UpdatePolicyValue(prefs::kUserNativePrintersAllowed, true); @@ -651,14 +651,14 @@ // Attempt to update the Automatic and Discovered printers. In both cases // check that the printers do not move into the saved category. manager_->SavePrinter(Printer("Automatic")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); UpdatePolicyValue(prefs::kUserNativePrintersAllowed, true); ExpectPrintersInClassAre(PrinterClass::kAutomatic, {"Automatic"}); ExpectPrintersInClassAre(PrinterClass::kSaved, {"Saved"}); UpdatePolicyValue(prefs::kUserNativePrintersAllowed, false); manager_->SavePrinter(Printer("Discovered")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); UpdatePolicyValue(prefs::kUserNativePrintersAllowed, true); ExpectPrintersInClassAre(PrinterClass::kDiscovered, {"Discovered"}); ExpectPrintersInClassAre(PrinterClass::kSaved, {"Saved"}); @@ -667,7 +667,7 @@ // Attempt to update a printer that we haven't seen before, check that nothing // changed. manager_->SavePrinter(Printer("NewFangled")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); UpdatePolicyValue(prefs::kUserNativePrintersAllowed, true); ExpectPrintersInClassAre(PrinterClass::kSaved, {"Saved"}); } @@ -678,7 +678,7 @@ TEST_F(CupsPrintersManagerTest, GetPrinterUserNativePrintersDisabled) { synced_printers_manager_.AddSavedPrinters({Printer("Saved")}); synced_printers_manager_.AddEnterprisePrinters({Printer("Enterprise")}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Sanity check that the printers were added. ExpectPrintersInClassAre(PrinterClass::kSaved, {"Saved"}); @@ -700,7 +700,7 @@ const std::string& expected_manufacturer = "HP"; ppd_provider_->SetUsbManufacturer(expected_manufacturer); usb_detector_->AddDetections({MakeUsbDiscoveredPrinter("DiscoveredPrinter")}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersInClassAre(PrinterClass::kDiscovered, {"DiscoveredPrinter"}); @@ -710,7 +710,7 @@ TEST_F(CupsPrintersManagerTest, EmptyUsbManufacturer) { usb_detector_->AddDetections({MakeUsbDiscoveredPrinter("DiscoveredPrinter")}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersInClassAre(PrinterClass::kDiscovered, {"DiscoveredPrinter"}); @@ -813,7 +813,7 @@ usb_detector_->AddDetections({automatic_printer}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(printer_configurer_->IsConfigured(kPrinterId)); } @@ -829,7 +829,7 @@ zeroconf_detector_->AddDetections({automatic_printer}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(manager_->IsPrinterInstalled(automatic_printer.printer)); } @@ -844,7 +844,7 @@ usb_detector_->AddDetections({discovered_printer}); zeroconf_detector_->AddDetections({automatic_printer}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersInClassAre(PrinterClass::kDiscovered, {"Discovered"}); ExpectPrintersInClassAre(PrinterClass::kAutomatic, {"Automatic"}); @@ -857,7 +857,7 @@ discovered_printer.printer.set_uri("usb:"); usb_detector_->AddDetections({discovered_printer}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(usb_notif_controller_->IsConfigurationNotification("Discovered")); @@ -873,7 +873,7 @@ discovered_printer.printer.set_uri("ipp:"); zeroconf_detector_->AddDetections({discovered_printer}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE( usb_notif_controller_->IsConfigurationNotification("Discovered"));
diff --git a/chrome/browser/chromeos/printing/print_servers_provider_unittest.cc b/chrome/browser/chromeos/printing/print_servers_provider_unittest.cc index dfb5babe1..3528434 100644 --- a/chrome/browser/chromeos/printing/print_servers_provider_unittest.cc +++ b/chrome/browser/chromeos/printing/print_servers_provider_unittest.cc
@@ -118,7 +118,7 @@ protected: // everything must be called on Chrome_UIThread - content::TestBrowserThreadBundle scoped_task_environment_; + content::TestBrowserThreadBundle task_environment_; std::unique_ptr<PrintServersProvider> external_servers_; }; @@ -132,7 +132,7 @@ } // servers is out of scope. Destructor has run. Pump the message queue to // see if anything strange happens. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Verify that we're initially unset and empty. @@ -172,7 +172,7 @@ // single call from AddObserver, since SetData(...) is not processed yet ASSERT_EQ(obs.GetCalls().size(), 1u); // make sure that SetData(...) is processed - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // now the call from SetData(...) is there also ASSERT_EQ(obs.GetCalls().size(), 2u); EXPECT_EQ(obs.GetCalls().back().complete, true); @@ -192,7 +192,7 @@ external_servers_->SetData(std::move(blob2)); // no changes, because nothing was processed yet ASSERT_EQ(obs.GetCalls().size(), 1u); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // both calls from SetData(...) should be reported ASSERT_EQ(obs.GetCalls().size(), 3u); EXPECT_EQ(obs.GetCalls()[1].complete, false); @@ -216,7 +216,7 @@ EXPECT_EQ(obs.GetCalls().back().complete, true); EXPECT_TRUE(obs.GetCalls().back().servers.empty()); // process SetData(...) - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // no changes, effects of SetData(...) were already replaced by ClearData() ASSERT_EQ(obs.GetCalls().size(), 2u); external_servers_->RemoveObserver(&obs); @@ -239,7 +239,7 @@ EXPECT_EQ(obs.GetCalls().back().complete, false); EXPECT_TRUE(obs.GetCalls().back().servers.empty()); // process SetData(...) - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // next call with results from processed SetData(...) ASSERT_EQ(obs.GetCalls().size(), 3u); EXPECT_EQ(obs.GetCalls().back().complete, true); @@ -253,7 +253,7 @@ TestObserver obs; external_servers_->AddObserver(&obs); external_servers_->SetData(std::move(blob3)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(obs.GetCalls().size(), 2u); EXPECT_EQ(obs.GetCalls().back().complete, true); EXPECT_EQ(obs.GetCalls().back().servers, kPrintServersPolicyData3);
diff --git a/chrome/browser/chromeos/printing/printers_sync_bridge_unittest.cc b/chrome/browser/chromeos/printing/printers_sync_bridge_unittest.cc index 486abc92..08a7e8b0 100644 --- a/chrome/browser/chromeos/printing/printers_sync_bridge_unittest.cc +++ b/chrome/browser/chromeos/printing/printers_sync_bridge_unittest.cc
@@ -25,7 +25,7 @@ class PrintersSyncBridgeTest : public testing::Test { public: - PrintersSyncBridgeTest() : scoped_task_environment_() { + PrintersSyncBridgeTest() : task_environment_() { bridge_ = std::make_unique<PrintersSyncBridge>( syncer::ModelTypeStoreTestUtil::FactoryForInMemoryStoreForTest(), base::BindRepeating( @@ -36,7 +36,7 @@ std::unique_ptr<PrintersSyncBridge> bridge_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; std::unique_ptr<PrinterSpecifics> TestPrinter(const std::string& id) {
diff --git a/chrome/browser/chromeos/printing/usb_printer_detector_unittest.cc b/chrome/browser/chromeos/printing/usb_printer_detector_unittest.cc index a0da73a..cf1da0f 100644 --- a/chrome/browser/chromeos/printing/usb_printer_detector_unittest.cc +++ b/chrome/browser/chromeos/printing/usb_printer_detector_unittest.cc
@@ -85,7 +85,7 @@ base::RunLoop().RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<UsbPrinterDetector> detector_; FakePrinterDetectorClient detector_client_; device::FakeUsbDeviceManager usb_manager_;
diff --git a/chrome/browser/chromeos/printing/zeroconf_printer_detector_fuzzer.cc b/chrome/browser/chromeos/printing/zeroconf_printer_detector_fuzzer.cc index 49b11ff..1107f2a6 100644 --- a/chrome/browser/chromeos/printing/zeroconf_printer_detector_fuzzer.cc +++ b/chrome/browser/chromeos/printing/zeroconf_printer_detector_fuzzer.cc
@@ -168,7 +168,7 @@ } // namespace extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FuzzedDataProvider fuzz_data(data, size); // Creating listers in similar way as in "standard" constructor of // ZeroconfPrinterDetector. @@ -189,6 +189,6 @@ ->SetDelegate(detector.get()); } // Fuzzing. - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); return 0; }
diff --git a/chrome/browser/chromeos/printing/zeroconf_printer_detector_unittest.cc b/chrome/browser/chromeos/printing/zeroconf_printer_detector_unittest.cc index a320f72d..e27f0b6 100644 --- a/chrome/browser/chromeos/printing/zeroconf_printer_detector_unittest.cc +++ b/chrome/browser/chromeos/printing/zeroconf_printer_detector_unittest.cc
@@ -288,7 +288,7 @@ class ZeroconfPrinterDetectorTest : public testing::Test { public: ZeroconfPrinterDetectorTest() { - auto* runner = scoped_task_environment_.GetMainThreadTaskRunner().get(); + auto* runner = task_environment_.GetMainThreadTaskRunner().get(); auto ipp_lister = std::make_unique<FakeServiceDiscoveryDeviceLister>( runner, ZeroconfPrinterDetector::kIppServiceName); ipp_lister_ = ipp_lister.get(); @@ -393,7 +393,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Device listers fakes. These are initialized when the test is constructed. // These pointers don't involve ownership; ownership of the listers starts @@ -423,37 +423,37 @@ TEST_F(ZeroconfPrinterDetectorTest, SingleIppPrinter) { ipp_lister_->Announce("Printer1"); CreateDetector(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersAre({MakeExpectedPrinter("Printer1", 0)}); } TEST_F(ZeroconfPrinterDetectorTest, SingleIppsPrinter) { ipps_lister_->Announce("Printer2"); CreateDetector(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersAre({MakeExpectedPrinter("Printer2", kFlagSSL)}); } TEST_F(ZeroconfPrinterDetectorTest, SingleIppEverywherePrinter) { ippe_lister_->Announce("Printer3"); CreateDetector(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersAre({MakeExpectedPrinter("Printer3", kFlagIPPE)}); } TEST_F(ZeroconfPrinterDetectorTest, SingleIppsEverywherePrinter) { ippse_lister_->Announce("Printer4"); CreateDetector(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersAre({MakeExpectedPrinter("Printer4", kFlagSSL | kFlagIPPE)}); } // Test that an announce after the detector creation shows up as a printer. TEST_F(ZeroconfPrinterDetectorTest, AnnounceAfterDetectorCreation) { CreateDetector(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ippse_lister_->Announce("Printer4"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersAre({MakeExpectedPrinter("Printer4", kFlagSSL | kFlagIPPE)}); } @@ -462,7 +462,7 @@ TEST_F(ZeroconfPrinterDetectorTest, StableIds) { ipp_lister_->Announce("Printer1"); CreateDetector(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_FALSE(printers_found_callbacks_.empty()); ASSERT_EQ(1U, printers_found_callbacks_.back().size()); // Grab the id when it's an IPPS printer We should continue to get the same id @@ -471,20 +471,20 @@ // Remove it as an IPP printer, add it as an IPPS printer. ipp_lister_->Remove("Printer1"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(printers_found_callbacks_.back().empty()); ipps_lister_->Announce("Printer1"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_FALSE(printers_found_callbacks_.back().empty()); // Id should be the same. ASSERT_EQ(id, printers_found_callbacks_.back()[0].printer.id()); // Remove it as an IPPS printer, add it as an IPP-Everywhere printer. ipps_lister_->Remove("Printer1"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(printers_found_callbacks_.back().empty()); ippe_lister_->Announce("Printer1"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_FALSE(printers_found_callbacks_.back().empty()); // Id should be the same. ASSERT_EQ(id, printers_found_callbacks_.back()[0].printer.id()); @@ -492,10 +492,10 @@ // Remove it as an IPP-Everywhere printer, add it as an IPPS-Everywhere // printer. ippe_lister_->Remove("Printer1"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(printers_found_callbacks_.back().empty()); ippse_lister_->Announce("Printer1"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_FALSE(printers_found_callbacks_.back().empty()); // Id should be the same. ASSERT_EQ(id, printers_found_callbacks_.back()[0].printer.id()); @@ -509,13 +509,13 @@ ipp_lister_->Announce("Printer8"); ipp_lister_->Announce("Printer9"); CreateDetector(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersAre( {MakeExpectedPrinter("Printer5", 0), MakeExpectedPrinter("Printer6", 0), MakeExpectedPrinter("Printer7", 0), MakeExpectedPrinter("Printer8", 0), MakeExpectedPrinter("Printer9", 0)}); ipp_lister_->Remove("Printer7"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersAre( {MakeExpectedPrinter("Printer5", 0), MakeExpectedPrinter("Printer6", 0), MakeExpectedPrinter("Printer8", 0), MakeExpectedPrinter("Printer9", 0)}); @@ -531,26 +531,26 @@ ippe_lister_->Announce("Printer5"); ippse_lister_->Announce("Printer5"); CreateDetector(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // IPPS-E is highest priority. ExpectPrintersAre({MakeExpectedPrinter("Printer5", kFlagSSL | kFlagIPPE)}); ippse_lister_->Remove("Printer5"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // IPP-E is highest remaining priority. ExpectPrintersAre({MakeExpectedPrinter("Printer5", kFlagIPPE)}); ippe_lister_->Remove("Printer5"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // IPPS is highest remaining priority. ExpectPrintersAre({MakeExpectedPrinter("Printer5", kFlagSSL)}); ipps_lister_->Remove("Printer5"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // IPP is only remaining entry. ExpectPrintersAre({MakeExpectedPrinter("Printer5", 0)}); ipp_lister_->Remove("Printer5"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // No entries left. ExpectPrintersAre({}); } @@ -567,7 +567,7 @@ ippse_lister_->Announce("Printer10"); CreateDetector(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersAre({MakeExpectedPrinter("Printer6", 0), MakeExpectedPrinter("Printer7", kFlagSSL), MakeExpectedPrinter("Printer8", kFlagIPPE), @@ -576,7 +576,7 @@ ipps_lister_->Clear(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // With the IPPS lister cleared, Printer7 should fall back to the IPP listing. ExpectPrintersAre({MakeExpectedPrinter("Printer6", 0), MakeExpectedPrinter("Printer7", 0), @@ -588,7 +588,7 @@ EXPECT_TRUE(ipps_lister_->discovery_started()); ipp_lister_->Clear(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // With the IPP lister cleared, Printers 6 and 7 no longer should appear. ExpectPrintersAre({MakeExpectedPrinter("Printer8", kFlagIPPE), MakeExpectedPrinter("Printer9", kFlagSSL | kFlagIPPE), @@ -596,7 +596,7 @@ EXPECT_TRUE(ipps_lister_->discovery_started()); ippse_lister_->Clear(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // With the IPPSE lister cleared, Printer10 should disappear, and Printer9 // should fall back to the IPPE. ExpectPrintersAre({MakeExpectedPrinter("Printer8", kFlagIPPE), @@ -605,7 +605,7 @@ // Just for kicks, announce something new at this point. ipps_lister_->Announce("Printer11"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersAre({MakeExpectedPrinter("Printer8", kFlagIPPE), MakeExpectedPrinter("Printer9", kFlagIPPE), MakeExpectedPrinter("Printer11", kFlagSSL)}); @@ -613,7 +613,7 @@ // Clear out the IPPE lister, leaving only the new printer we announced // on the IPPS lister. ippe_lister_->Clear(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // With the IPPSE lister cleared, Printer10 should disappear, and Printer9 // should fall back to the IPPE entry. ExpectPrintersAre({MakeExpectedPrinter("Printer11", kFlagSSL)}); @@ -629,7 +629,7 @@ ipps_lister_->Announce("Printer15"); CreateDetector(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersAre({MakeExpectedPrinter("Printer12", kFlagSSL), MakeExpectedPrinter("Printer13", kFlagSSL), MakeExpectedPrinter("Printer14", kFlagSSL | kFlagIPPE), @@ -637,7 +637,7 @@ ippe_lister_->Announce("Printer13"); ipp_lister_->Announce("Printer16"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersAre({MakeExpectedPrinter("Printer12", kFlagSSL), MakeExpectedPrinter("Printer13", kFlagIPPE), MakeExpectedPrinter("Printer14", kFlagSSL | kFlagIPPE), @@ -648,7 +648,7 @@ ipps_lister_->Remove("Printer12"); ipps_lister_->Clear(); ipp_lister_->Announce("Printer17"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersAre({MakeExpectedPrinter("Printer12", 0), MakeExpectedPrinter("Printer13", kFlagIPPE), MakeExpectedPrinter("Printer14", kFlagSSL | kFlagIPPE), @@ -657,7 +657,7 @@ ipp_lister_->Clear(); ippse_lister_->Clear(); ippe_lister_->Clear(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ExpectPrintersAre({}); }
diff --git a/chrome/browser/chromeos/scheduler_configuration_manager_unittest.cc b/chrome/browser/chromeos/scheduler_configuration_manager_unittest.cc index 331f13a..513f111 100644 --- a/chrome/browser/chromeos/scheduler_configuration_manager_unittest.cc +++ b/chrome/browser/chromeos/scheduler_configuration_manager_unittest.cc
@@ -24,7 +24,7 @@ local_state_.registry()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeDebugDaemonClient debug_daemon_client_; TestingPrefServiceSimple local_state_; @@ -36,47 +36,47 @@ // Manager waits on initialization for service to be available. SchedulerConfigurationManager manager(&debug_daemon_client_, &local_state_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ("", debug_daemon_client_.scheduler_configuration_name()); // Config changes don't lead to updates while debugd isn't ready. local_state_.SetString(prefs::kSchedulerConfiguration, "config"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ("", debug_daemon_client_.scheduler_configuration_name()); // Once the debugd service becomes available, the config gets set. debug_daemon_client_.SetServiceIsAvailable(true); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ("config", debug_daemon_client_.scheduler_configuration_name()); } TEST_F(SchedulerConfigurationManagerTest, ConfigChange) { // Correct default is used when there is no configured value. SchedulerConfigurationManager manager(&debug_daemon_client_, &local_state_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(debugd::scheduler_configuration::kConservativeScheduler, debug_daemon_client_.scheduler_configuration_name()); // Change user pref, which should trigger a config change. local_state_.SetUserPref(prefs::kSchedulerConfiguration, std::make_unique<base::Value>("user")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ("user", debug_daemon_client_.scheduler_configuration_name()); // Set a policy, which should override the user setting local_state_.SetManagedPref(prefs::kSchedulerConfiguration, std::make_unique<base::Value>("policy")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ("policy", debug_daemon_client_.scheduler_configuration_name()); // Dropping the user pref doesn't change anything. local_state_.RemoveUserPref(prefs::kSchedulerConfiguration); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ("policy", debug_daemon_client_.scheduler_configuration_name()); // Dropping the policy as well reverts to the default configuration. local_state_.RemoveManagedPref(prefs::kSchedulerConfiguration); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(debugd::scheduler_configuration::kConservativeScheduler, debug_daemon_client_.scheduler_configuration_name()); } @@ -88,12 +88,12 @@ // Finch parameter selects the default. SchedulerConfigurationManager manager(&debug_daemon_client_, &local_state_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ("finch", debug_daemon_client_.scheduler_configuration_name()); // Config values override finch default. local_state_.SetString(prefs::kSchedulerConfiguration, "config"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ("config", debug_daemon_client_.scheduler_configuration_name()); }
diff --git a/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc b/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc index 2e998c2..5a2fe53 100644 --- a/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc +++ b/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc
@@ -204,7 +204,7 @@ bool reboot_after_update_ = false; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedClosureRunner reset_main_thread_task_runner_; TestingPrefServiceSimple local_state_;
diff --git a/chrome/browser/chromeos/tpm_firmware_update_unittest.cc b/chrome/browser/chromeos/tpm_firmware_update_unittest.cc index 5b46a6b..8f7126d 100644 --- a/chrome/browser/chromeos/tpm_firmware_update_unittest.cc +++ b/chrome/browser/chromeos/tpm_firmware_update_unittest.cc
@@ -118,8 +118,8 @@ base::ScopedTempDir temp_dir_; std::unique_ptr<base::ScopedPathOverride> path_override_location_; std::unique_ptr<base::ScopedPathOverride> path_override_srk_vulnerable_roca_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; ScopedCrosSettingsTestHelper cros_settings_test_helper_; chromeos::system::ScopedFakeStatisticsProvider statistics_provider_; }; @@ -162,14 +162,14 @@ TEST_F(TPMFirmwareUpdateModesTest, Pending) { SetUpdateAvailability(Availability::kPending); GetAvailableUpdateModes(std::move(callback_), base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_TRUE(callback_modes_.empty()); } TEST_F(TPMFirmwareUpdateModesTest, Available) { GetAvailableUpdateModes(std::move(callback_), base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_EQ(kAllModes, callback_modes_); } @@ -178,12 +178,12 @@ SetUpdateAvailability(Availability::kPending); GetAvailableUpdateModes(std::move(callback_), base::TimeDelta::FromSeconds(5)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(callback_received_); // When testing that file appearance triggers the callback, we can't rely on - // a single execution of ScopedTaskEnvironment::RunUntilIdle(). This is - // because ScopedTaskEnvironment doesn't know about file system events that + // a single execution of TaskEnvironment::RunUntilIdle(). This is + // because TaskEnvironment doesn't know about file system events that // haven't fired and propagated to a task scheduler thread yet so may return // early before the file system event is received. An event is expected here // though, so keep spinning the loop until the callback is received. This @@ -191,21 +191,21 @@ // with a single invocation of RunUntilIdle(). SetUpdateAvailability(Availability::kAvailable); while (!callback_received_) { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } EXPECT_EQ(kAllModes, callback_modes_); // Trigger timeout and validate there are no further callbacks or crashes. callback_received_ = false; - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(5)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(5)); + task_environment_.RunUntilIdle(); EXPECT_FALSE(callback_received_); } TEST_F(TPMFirmwareUpdateModesTest, NoUpdateVulnerableSRK) { SetUpdateAvailability(Availability::kUnavailableROCAVulnerable); GetAvailableUpdateModes(std::move(callback_), base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_EQ(std::set<Mode>{Mode::kCleanup}, callback_modes_); } @@ -213,7 +213,7 @@ TEST_F(TPMFirmwareUpdateModesTest, NoUpdateNonVulnerableSRK) { SetUpdateAvailability(Availability::kUnavailable); GetAvailableUpdateModes(std::move(callback_), base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_EQ(std::set<Mode>(), callback_modes_); } @@ -222,11 +222,11 @@ SetUpdateAvailability(Availability::kPending); GetAvailableUpdateModes(std::move(callback_), base::TimeDelta::FromSeconds(5)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(callback_received_); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(5)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(5)); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_TRUE(callback_modes_.empty()); } @@ -255,11 +255,11 @@ cros_settings_test_helper_.SetTrustedStatus( CrosSettingsProvider::TEMPORARILY_UNTRUSTED); GetAvailableUpdateModes(std::move(callback_), base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(callback_received_); cros_settings_test_helper_.SetTrustedStatus(CrosSettingsProvider::TRUSTED); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_EQ(kAllModes, callback_modes_); } @@ -268,14 +268,14 @@ cros_settings_test_helper_.SetTrustedStatus( CrosSettingsProvider::PERMANENTLY_UNTRUSTED); GetAvailableUpdateModes(std::move(callback_), base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_TRUE(callback_modes_.empty()); } TEST_F(TPMFirmwareUpdateModesEnterpriseTest, DeviceSettingNotSet) { GetAvailableUpdateModes(std::move(callback_), base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_TRUE(callback_modes_.empty()); } @@ -283,7 +283,7 @@ TEST_F(TPMFirmwareUpdateModesEnterpriseTest, DeviceSettingDisallowed) { SetPolicy({}); GetAvailableUpdateModes(std::move(callback_), base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_TRUE(callback_modes_.empty()); } @@ -291,7 +291,7 @@ TEST_F(TPMFirmwareUpdateModesEnterpriseTest, DeviceSettingPowerwashAllowed) { SetPolicy({Mode::kPowerwash}); GetAvailableUpdateModes(std::move(callback_), base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_EQ(std::set<Mode>({Mode::kPowerwash}), callback_modes_); } @@ -300,7 +300,7 @@ DeviceSettingPreserveDeviceStateAllowed) { SetPolicy({Mode::kPreserveDeviceState}); GetAvailableUpdateModes(std::move(callback_), base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_EQ(std::set<Mode>({Mode::kPreserveDeviceState}), callback_modes_); } @@ -309,7 +309,7 @@ SetUpdateAvailability(Availability::kUnavailableROCAVulnerable); SetPolicy({Mode::kPreserveDeviceState}); GetAvailableUpdateModes(std::move(callback_), base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_EQ(std::set<Mode>({Mode::kCleanup}), callback_modes_); } @@ -333,7 +333,7 @@ TEST_F(TPMFirmwareAutoUpdateTest, AutoUpdateAvaiable) { UpdateAvailable(std::move(callback_), base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_TRUE(update_available_); } @@ -341,7 +341,7 @@ TEST_F(TPMFirmwareAutoUpdateTest, VulnerableSRKNoStatePreservingUpdate) { SetUpdateAvailability(Availability::kUnavailableROCAVulnerable); UpdateAvailable(std::move(callback_), base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_FALSE(update_available_); } @@ -349,7 +349,7 @@ TEST_F(TPMFirmwareAutoUpdateTest, NoUpdate) { SetUpdateAvailability(Availability::kUnavailable); UpdateAvailable(std::move(callback_), base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_received_); EXPECT_FALSE(update_available_); }
diff --git a/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_bridge_unittest.cc b/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_bridge_unittest.cc index cc6ee49..6b243af 100644 --- a/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_bridge_unittest.cc +++ b/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_bridge_unittest.cc
@@ -232,8 +232,8 @@ mojo_wilco_dtc_supportd_service_factory_.CloseBinding(); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; private: FakeMojoWilcoDtcSupportdServiceFactory @@ -276,13 +276,13 @@ wilco_dtc_supportd_dbus_client()->SetBootstrapMojoConnectionResult(true); wilco_dtc_supportd_dbus_client()->SetBootstrapMojoConnectionResult( base::nullopt); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(is_mojo_factory_get_service_call_in_flight()); // Resolve the pending GetService Mojo call. Verify the bridge exposes the // obtained WilcoDtcSupportdService Mojo interface pointer. RespondToMojoFactoryGetServiceCall(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE( wilco_dtc_supportd_bridge()->wilco_dtc_supportd_service_mojo_proxy()); @@ -299,7 +299,7 @@ ->wait_for_service_to_be_available_in_flight_call_count()); // Verify that no extra WaitForServiceToBeAvailable calls are made. - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( WilcoDtcSupportdBridge::connection_attempt_interval_for_testing()); EXPECT_EQ(1, wilco_dtc_supportd_dbus_client() ->wait_for_service_to_be_available_in_flight_call_count()); @@ -321,7 +321,7 @@ wilco_dtc_supportd_dbus_client()->SetBootstrapMojoConnectionResult(false); wilco_dtc_supportd_dbus_client()->SetBootstrapMojoConnectionResult( base::nullopt); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Verify that no new BootstrapMojoConnection call is made immediately after // the previous one failed. @@ -329,7 +329,7 @@ ->bootstrap_mojo_connection_in_flight_call_count()); // Fast forward the clock till the next attempt should occur. - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( WilcoDtcSupportdBridge::connection_attempt_interval_for_testing()); } @@ -345,7 +345,7 @@ TEST_F(WilcoDtcSupportdBridgeTest, ImmediateMojoDisconnectionError) { wilco_dtc_supportd_dbus_client()->SetWaitForServiceToBeAvailableResult(true); wilco_dtc_supportd_dbus_client()->SetBootstrapMojoConnectionResult(true); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); for (int attempt_number = 0; attempt_number < @@ -356,11 +356,11 @@ // responding to the call. Verify that no new call happens immediately. EXPECT_TRUE(is_mojo_factory_get_service_call_in_flight()); AbortMojoConnection(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(is_mojo_factory_get_service_call_in_flight()); // Fast forward the clock till the next attempt should occur. - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( WilcoDtcSupportdBridge::connection_attempt_interval_for_testing()); } @@ -374,29 +374,29 @@ // Let the bootstrapping succeed on the first attempt. wilco_dtc_supportd_dbus_client()->SetWaitForServiceToBeAvailableResult(true); wilco_dtc_supportd_dbus_client()->SetBootstrapMojoConnectionResult(true); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(is_mojo_factory_get_service_call_in_flight()); RespondToMojoFactoryGetServiceCall(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE( wilco_dtc_supportd_bridge()->wilco_dtc_supportd_service_mojo_proxy()); // Abort the Mojo binding. Verify that no new connection attempt happens // immediately. AbortMojoConnection(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE( wilco_dtc_supportd_bridge()->wilco_dtc_supportd_service_mojo_proxy()); EXPECT_FALSE(is_mojo_factory_get_service_call_in_flight()); // Fast forward the clock till the next connection attempt. - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( WilcoDtcSupportdBridge::connection_attempt_interval_for_testing()); // Let the bootstrapping succeed again. ASSERT_TRUE(is_mojo_factory_get_service_call_in_flight()); RespondToMojoFactoryGetServiceCall(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE( wilco_dtc_supportd_bridge()->wilco_dtc_supportd_service_mojo_proxy()); } @@ -408,30 +408,30 @@ // Fail the first few connection attempts, leaving only one attempt left. wilco_dtc_supportd_dbus_client()->SetBootstrapMojoConnectionResult(false); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( WilcoDtcSupportdBridge::connection_attempt_interval_for_testing() * (WilcoDtcSupportdBridge::max_connection_attempt_count_for_testing() - 2)); // Let the bootstrapping succeed on the new attempt (the last allowed one in // this serie). wilco_dtc_supportd_dbus_client()->SetBootstrapMojoConnectionResult(true); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( WilcoDtcSupportdBridge::connection_attempt_interval_for_testing()); ASSERT_TRUE(is_mojo_factory_get_service_call_in_flight()); RespondToMojoFactoryGetServiceCall(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE( wilco_dtc_supportd_bridge()->wilco_dtc_supportd_service_mojo_proxy()); // Abort the Mojo binding. AbortMojoConnection(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE( wilco_dtc_supportd_bridge()->wilco_dtc_supportd_service_mojo_proxy()); // Fail again a few attempts as before. wilco_dtc_supportd_dbus_client()->SetBootstrapMojoConnectionResult(false); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( WilcoDtcSupportdBridge::connection_attempt_interval_for_testing() * (WilcoDtcSupportdBridge::max_connection_attempt_count_for_testing() - 1)); @@ -439,11 +439,11 @@ // the retry attempts made before the previous successful bootstrap were // ignored. wilco_dtc_supportd_dbus_client()->SetBootstrapMojoConnectionResult(true); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( WilcoDtcSupportdBridge::connection_attempt_interval_for_testing()); ASSERT_TRUE(is_mojo_factory_get_service_call_in_flight()); RespondToMojoFactoryGetServiceCall(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE( wilco_dtc_supportd_bridge()->wilco_dtc_supportd_service_mojo_proxy()); }
diff --git a/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_manager_unittest.cc b/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_manager_unittest.cc index 24ee8c0..e882b701 100644 --- a/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_manager_unittest.cc +++ b/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_manager_unittest.cc
@@ -129,7 +129,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ScopedTestingCrosSettings scoped_testing_cros_settings_; std::unique_ptr<TestUpstartClient> upstart_client_; FakeChromeUserManager* fake_user_manager_{new FakeChromeUserManager()};
diff --git a/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_messaging_unittest.cc b/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_messaging_unittest.cc index 0131863..c9652aa1 100644 --- a/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_messaging_unittest.cc +++ b/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_messaging_unittest.cc
@@ -105,7 +105,7 @@ // Test that the message channel gets closed if the WilcoDtcSupportdBridge // instance isn't created. TEST(WilcoDtcSupportdMessagingOpenedByExtensionNoBridgeTest, Test) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Create the message host. std::unique_ptr<extensions::NativeMessageHost> message_host = @@ -151,10 +151,10 @@ return testing_wilco_dtc_supportd_bridge_wrapper_.get(); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; StrictMock<MockMojoWilcoDtcSupportdService> mojo_wilco_dtc_supportd_service_; network::TestURLLoaderFactory test_url_loader_factory_; std::unique_ptr<TestingWilcoDtcSupportdBridgeWrapper>
diff --git a/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_web_request_service_unittest.cc b/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_web_request_service_unittest.cc index 563c916..22e4b43 100644 --- a/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_web_request_service_unittest.cc +++ b/chrome/browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_web_request_service_unittest.cc
@@ -150,7 +150,7 @@ std::unique_ptr<WilcoDtcSupportdWebRequestService> web_request_service_; network::TestURLLoaderFactory test_url_loader_factory_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; } // namespace
diff --git a/chrome/browser/component_updater/optimization_hints_component_installer_unittest.cc b/chrome/browser/component_updater/optimization_hints_component_installer_unittest.cc index c9f0150..0c7df79 100644 --- a/chrome/browser/component_updater/optimization_hints_component_installer_unittest.cc +++ b/chrome/browser/component_updater/optimization_hints_component_installer_unittest.cc
@@ -145,12 +145,12 @@ protected: void RunUntilIdle() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::RunLoop().RunUntilIdle(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir component_install_dir_; std::unique_ptr<TestingPrefServiceSimple> pref_service_;
diff --git a/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_unittest_android.cc b/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_unittest_android.cc index 515b2f2ee..a9847a6 100644 --- a/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_unittest_android.cc +++ b/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_unittest_android.cc
@@ -183,8 +183,8 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; JNIEnv* env_; net::MockClientSocketFactory mock_socket_factory_; std::unique_ptr<data_reduction_proxy::DataReductionProxyTestContext>
diff --git a/chrome/browser/devtools/devtools_file_watcher_unittest.cc b/chrome/browser/devtools/devtools_file_watcher_unittest.cc index c43ee56..a23b175 100644 --- a/chrome/browser/devtools/devtools_file_watcher_unittest.cc +++ b/chrome/browser/devtools/devtools_file_watcher_unittest.cc
@@ -34,7 +34,7 @@ base::ScopedTempDir temp_dir_; base::FilePath base_path_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; bool done_flag_ = false; std::set<std::string> expected_changed_paths_;
diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index acd3313..8a64a54 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -1354,8 +1354,10 @@ // Some web features, when used from an extension, are subject to browser-side // security policy enforcement. Make sure they work properly from inside a // devtools extension. +// ToDo(993982): The test is flaky (timeout, crash, and fail) on several builds: +// Debug, Windows, Mac, MSan, and ASan. IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, - DevToolsExtensionSecurityPolicyGrants) { + DISABLED_DevToolsExtensionSecurityPolicyGrants) { ASSERT_TRUE(embedded_test_server()->Start()); auto dir = std::make_unique<extensions::TestExtensionDir>();
diff --git a/chrome/browser/enterprise_reporting/report_scheduler_unittest.cc b/chrome/browser/enterprise_reporting/report_scheduler_unittest.cc index eaa13c76..9b8c9ba 100644 --- a/chrome/browser/enterprise_reporting/report_scheduler_unittest.cc +++ b/chrome/browser/enterprise_reporting/report_scheduler_unittest.cc
@@ -103,8 +103,7 @@ class ReportSchedulerTest : public ::testing::Test { public: ReportSchedulerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), local_state_(TestingBrowserProcess::GetGlobal()) {} ~ReportSchedulerTest() override = default; void SetUp() override { @@ -170,7 +169,7 @@ } base::test::ScopedFeatureList scoped_feature_list_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ScopedTestingLocalState local_state_; std::unique_ptr<ReportScheduler> scheduler_; @@ -223,7 +222,7 @@ EXPECT_FALSE(timer_->is_running()); // Run pending task. - scoped_task_environment_.FastForwardBy(base::TimeDelta()); + task_environment_.FastForwardBy(base::TimeDelta()); // Next report is scheduled. EXPECT_TRUE(timer_->is_running()); @@ -249,7 +248,7 @@ EXPECT_FALSE(timer_->is_running()); // Run pending task. - scoped_task_environment_.FastForwardBy(base::TimeDelta()); + task_environment_.FastForwardBy(base::TimeDelta()); // Next report is scheduled. EXPECT_TRUE(timer_->is_running()); @@ -277,7 +276,7 @@ EXPECT_FALSE(timer_->is_running()); // Run pending task. - scoped_task_environment_.FastForwardBy(base::TimeDelta()); + task_environment_.FastForwardBy(base::TimeDelta()); // Next report is not scheduled. EXPECT_FALSE(timer_->is_running()); @@ -309,7 +308,7 @@ EXPECT_FALSE(timer_->is_running()); // Run pending task. - scoped_task_environment_.FastForwardBy(base::TimeDelta()); + task_environment_.FastForwardBy(base::TimeDelta()); // Next report is not scheduled. EXPECT_FALSE(timer_->is_running()); @@ -387,7 +386,7 @@ EXPECT_FALSE(timer_->is_running()); // Run pending task. - scoped_task_environment_.FastForwardBy(base::TimeDelta()); + task_environment_.FastForwardBy(base::TimeDelta()); ExpectLastUploadTimestampUpdated(true); // Next report is not scheduled.
diff --git a/chrome/browser/enterprise_reporting/report_uploader_unittest.cc b/chrome/browser/enterprise_reporting/report_uploader_unittest.cc index b3998a0..815aa1f 100644 --- a/chrome/browser/enterprise_reporting/report_uploader_unittest.cc +++ b/chrome/browser/enterprise_reporting/report_uploader_unittest.cc
@@ -25,8 +25,7 @@ class ReportUploaderTest : public ::testing::Test { public: ReportUploaderTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) { + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) { CreateUploader(0); } ~ReportUploaderTest() override {} @@ -60,25 +59,25 @@ // Forwards to send next request and get response. void RunNextTask() { - scoped_task_environment_.FastForwardBy( - scoped_task_environment_.NextMainThreadPendingTaskDelay()); + task_environment_.FastForwardBy( + task_environment_.NextMainThreadPendingTaskDelay()); } // Verifies the retried is delayed properly. void VerifyRequestDelay(int delay_seconds) { if (delay_seconds == 0) { EXPECT_EQ(base::TimeDelta(), - scoped_task_environment_.NextMainThreadPendingTaskDelay()); + task_environment_.NextMainThreadPendingTaskDelay()); return; } EXPECT_GE(base::TimeDelta::FromSeconds(delay_seconds), - scoped_task_environment_.NextMainThreadPendingTaskDelay()); + task_environment_.NextMainThreadPendingTaskDelay()); EXPECT_LE( base::TimeDelta::FromSeconds(static_cast<int>(delay_seconds * 0.9)), - scoped_task_environment_.NextMainThreadPendingTaskDelay()); + task_environment_.NextMainThreadPendingTaskDelay()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<ReportUploader> uploader_; policy::MockCloudPolicyClient client_; @@ -240,7 +239,7 @@ client_.SetStatus(GetParam()); UploadReportAndSetExpectation(/*number_of_request=*/2, ReportUploader::kTransientError); - scoped_task_environment_.FastForwardBy(base::TimeDelta()); + task_environment_.FastForwardBy(base::TimeDelta()); EXPECT_TRUE(has_responded_); ::testing::Mock::VerifyAndClearExpectations(&client_); }
diff --git a/chrome/browser/enterprise_reporting/request_timer_unittest.cc b/chrome/browser/enterprise_reporting/request_timer_unittest.cc index ca19db7..d10656e4 100644 --- a/chrome/browser/enterprise_reporting/request_timer_unittest.cc +++ b/chrome/browser/enterprise_reporting/request_timer_unittest.cc
@@ -12,8 +12,7 @@ class RequestTimerTest : public ::testing::Test { public: RequestTimerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void RunTask() { task_count_ += 1; } @@ -25,7 +24,7 @@ base::Unretained(this))); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; int task_count_ = 0; RequestTimer timer_; }; @@ -46,12 +45,12 @@ StartTask(5, 10); // The first task hasn't been ran yet. - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(4)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(4)); ASSERT_TRUE(timer_.IsFirstTimerRunning()); ASSERT_EQ(0, task_count_); // The first task is due. - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); ASSERT_FALSE(timer_.IsFirstTimerRunning()); ASSERT_FALSE(timer_.IsRepeatTimerRunning()); ASSERT_EQ(1, task_count_); @@ -61,7 +60,7 @@ StartTask(0, 10); // First task is posted and ran immediately. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_FALSE(timer_.IsFirstTimerRunning()); ASSERT_FALSE(timer_.IsRepeatTimerRunning()); ASSERT_EQ(1, task_count_); @@ -71,7 +70,7 @@ StartTask(-1, 10); // First task is posted and ran immediately. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_FALSE(timer_.IsFirstTimerRunning()); ASSERT_FALSE(timer_.IsRepeatTimerRunning()); ASSERT_EQ(1, task_count_); @@ -81,14 +80,14 @@ StartTask(1, 10); // Run the first task. - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); // Reset and wait for the second task. timer_.Reset(); ASSERT_FALSE(timer_.IsFirstTimerRunning()); ASSERT_TRUE(timer_.IsRepeatTimerRunning()); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(10)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(10)); ASSERT_FALSE(timer_.IsFirstTimerRunning()); ASSERT_FALSE(timer_.IsRepeatTimerRunning()); ASSERT_EQ(2, task_count_); @@ -97,7 +96,7 @@ timer_.Reset(); ASSERT_TRUE(timer_.IsRepeatTimerRunning()); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(10)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(10)); ASSERT_FALSE(timer_.IsFirstTimerRunning()); ASSERT_FALSE(timer_.IsRepeatTimerRunning()); ASSERT_EQ(3, task_count_); @@ -107,17 +106,17 @@ StartTask(1, 10); // Run the first task. - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); ASSERT_EQ(1, task_count_); // The repeat task is not ran without reset. - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(15)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(15)); ASSERT_FALSE(timer_.IsRepeatTimerRunning()); ASSERT_EQ(1, task_count_); // Reset the task, the repeat task is ran only once. timer_.Reset(); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(60)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(60)); ASSERT_FALSE(timer_.IsRepeatTimerRunning()); ASSERT_EQ(2, task_count_); } @@ -130,7 +129,7 @@ // The task is stopped. ASSERT_FALSE(timer_.IsFirstTimerRunning()); ASSERT_FALSE(timer_.IsRepeatTimerRunning()); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(10)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(10)); ASSERT_EQ(0, task_count_); } @@ -138,18 +137,18 @@ StartTask(1, 10); // Run the first task. - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); ASSERT_EQ(1, task_count_); // Start the repeat task, stop after a while. timer_.Reset(); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(3)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(3)); timer_.Stop(); // The task is stopped. ASSERT_FALSE(timer_.IsFirstTimerRunning()); ASSERT_FALSE(timer_.IsRepeatTimerRunning()); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(60)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(60)); ASSERT_EQ(1, task_count_); }
diff --git a/chrome/browser/extensions/content_script_apitest.cc b/chrome/browser/extensions/content_script_apitest.cc index 13ee519..17e6d49 100644 --- a/chrome/browser/extensions/content_script_apitest.cc +++ b/chrome/browser/extensions/content_script_apitest.cc
@@ -430,7 +430,7 @@ // ExtensionManagementPolicyUpdater requires a single-threaded context to // call RunLoop::RunUntilIdle internally, and it isn't ready at this setup // moment. - base::test::ScopedTaskEnvironment env; + base::test::TaskEnvironment env; ExtensionManagementPolicyUpdater management_policy(&policy_provider_); management_policy.AddPolicyBlockedHost("*", "*://example.com"); }
diff --git a/chrome/browser/extensions/content_verifier_browsertest.cc b/chrome/browser/extensions/content_verifier_browsertest.cc index 0100f08..6c6a58c 100644 --- a/chrome/browser/extensions/content_verifier_browsertest.cc +++ b/chrome/browser/extensions/content_verifier_browsertest.cc
@@ -414,7 +414,7 @@ // ExtensionManagementPolicyUpdater requires a single-threaded context to // call RunLoop::RunUntilIdle internally, and it isn't ready at this setup // moment. - base::test::ScopedTaskEnvironment env; + base::test::TaskEnvironment env; ExtensionManagementPolicyUpdater management_policy(&policy_provider_); management_policy.SetIndividualExtensionAutoInstalled( id_, extension_urls::kChromeWebstoreUpdateURL, true /* forced */);
diff --git a/chrome/browser/extensions/extension_management_internal.cc b/chrome/browser/extensions/extension_management_internal.cc index 6b1e7cc2e..1dce3d0 100644 --- a/chrome/browser/extensions/extension_management_internal.cc +++ b/chrome/browser/extensions/extension_management_internal.cc
@@ -125,13 +125,14 @@ LOG(WARNING) << "Exceeded maximum number of URL match patterns (" << schema_constants::kMaxItemsURLPatternSet << ") for attribute '" << key << "'"; - return false; } out_value->ClearPatterns(); const int extension_scheme_mask = URLPattern::GetValidSchemeMaskForExtensions(); - for (size_t i = 0; i < host_list_value->GetSize(); ++i) { + auto numItems = std::min(host_list_value->GetSize(), + schema_constants::kMaxItemsURLPatternSet); + for (size_t i = 0; i < numItems; ++i) { std::string unparsed_str; host_list_value->GetString(i, &unparsed_str); URLPattern pattern(extension_scheme_mask);
diff --git a/chrome/browser/extensions/extension_management_unittest.cc b/chrome/browser/extensions/extension_management_unittest.cc index 93d1134..11d8554 100644 --- a/chrome/browser/extensions/extension_management_unittest.cc +++ b/chrome/browser/extensions/extension_management_unittest.cc
@@ -466,6 +466,28 @@ ExtensionManagement::INSTALLATION_ALLOWED); } +// Tests handling of exceeding number of urls +TEST_F(ExtensionManagementServiceTest, HostsMaximumExceeded) { + const char policy_template[] = + "{" + " \"abcdefghijklmnopabcdefghijklmnop\": {" + " \"installation_mode\": \"allowed\"," + " \"runtime_blocked_hosts\": [%s]," + " \"runtime_allowed_hosts\": [%s]" + " }" + "}"; + + std::string urls; + for (size_t i = 0; i < 200; ++i) + urls.append("\"*://example" + base::NumberToString(i) + ".com\","); + + std::string policy = + base::StringPrintf(policy_template, urls.c_str(), urls.c_str()); + SetExampleDictPref(policy); + EXPECT_EQ(100u, GetPolicyBlockedHosts(kTargetExtension).size()); + EXPECT_EQ(100u, GetPolicyAllowedHosts(kTargetExtension).size()); +} + // Tests parsing of new dictionary preference. TEST_F(ExtensionManagementServiceTest, PreferenceParsing) { SetExampleDictPref(kExampleDictPreference);
diff --git a/chrome/browser/extensions/policy_handlers.cc b/chrome/browser/extensions/policy_handlers.cc index e9a6890..33edb39 100644 --- a/chrome/browser/extensions/policy_handlers.cc +++ b/chrome/browser/extensions/policy_handlers.cc
@@ -8,6 +8,7 @@ #include <utility> #include "base/logging.h" +#include "base/strings/string_number_conversions.h" #include "build/build_config.h" #include "chrome/browser/extensions/extension_management_constants.h" #include "chrome/browser/extensions/external_policy_loader.h" @@ -334,6 +335,28 @@ } } } + + const base::ListValue* runtime_blocked_hosts = nullptr; + if (sub_dict->GetList(schema_constants::kPolicyBlockedHosts, + &runtime_blocked_hosts) && + runtime_blocked_hosts->GetList().size() > + schema_constants::kMaxItemsURLPatternSet) { + errors->AddError( + policy_name(), it.key() + "." + schema_constants::kPolicyBlockedHosts, + IDS_POLICY_EXTENSION_SETTINGS_ORIGIN_LIMIT_WARNING, + base::NumberToString(schema_constants::kMaxItemsURLPatternSet)); + } + + const base::ListValue* runtime_allowed_hosts = nullptr; + if (sub_dict->GetList(schema_constants::kPolicyAllowedHosts, + &runtime_allowed_hosts) && + runtime_allowed_hosts->GetList().size() > + schema_constants::kMaxItemsURLPatternSet) { + errors->AddError( + policy_name(), it.key() + "." + schema_constants::kPolicyAllowedHosts, + IDS_POLICY_EXTENSION_SETTINGS_ORIGIN_LIMIT_WARNING, + base::NumberToString(schema_constants::kMaxItemsURLPatternSet)); + } } return true;
diff --git a/chrome/browser/extensions/policy_handlers_unittest.cc b/chrome/browser/extensions/policy_handlers_unittest.cc index 4dbb80f..51c8f0d 100644 --- a/chrome/browser/extensions/policy_handlers_unittest.cc +++ b/chrome/browser/extensions/policy_handlers_unittest.cc
@@ -5,8 +5,11 @@ #include <utility> #include "base/json/json_reader.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" +#include "base/strings/utf_string_conversions.h" #include "build/build_config.h" +#include "chrome/browser/extensions/extension_management_constants.h" #include "chrome/browser/extensions/external_policy_loader.h" #include "chrome/browser/extensions/policy_handlers.h" #include "components/policy/core/browser/policy_error_map.h" @@ -15,8 +18,10 @@ #include "components/policy/core/common/schema.h" #include "components/policy/policy_constants.h" #include "components/prefs/pref_value_map.h" +#include "components/strings/grit/components_strings.h" #include "extensions/browser/pref_names.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/l10n/l10n_util.h" #if defined(OS_WIN) #include "base/win/win_util.h" @@ -371,6 +376,50 @@ EXPECT_FALSE(errors.empty()); } +TEST(ExtensionSettingsPolicyHandlerTest, CheckPolicySettingsTooManyHosts) { + const char policy_template[] = + "{" + " \"*\": {" + " \"runtime_blocked_hosts\": [%s]," + " \"runtime_allowed_hosts\": [%s]" + " }" + "}"; + + std::string urls; + for (size_t i = 0; i < 101; ++i) + urls.append("\"*://example" + base::NumberToString(i) + ".com\","); + + std::string policy = + base::StringPrintf(policy_template, urls.c_str(), urls.c_str()); + + std::string error; + auto policy_value = base::JSONReader::ReadAndReturnValueWithError( + policy, base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS); + policy::Schema chrome_schema = + policy::Schema::Wrap(policy::GetChromeSchemaData()); + policy::PolicyMap policy_map; + policy::PolicyErrorMap errors; + ExtensionSettingsPolicyHandler handler(chrome_schema); + + policy_map.Set(policy::key::kExtensionSettings, + policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, + policy::POLICY_SOURCE_CLOUD, + policy_value.value.value().CreateDeepCopy(), nullptr); + + EXPECT_TRUE(handler.CheckPolicySettings(policy_map, &errors)); + EXPECT_EQ(2u, errors.size()); + auto error_str = errors.GetErrors(policy::key::kExtensionSettings); + auto expected_allowed = l10n_util::GetStringFUTF16( + IDS_POLICY_EXTENSION_SETTINGS_ORIGIN_LIMIT_WARNING, + base::NumberToString16(schema_constants::kMaxItemsURLPatternSet)); + auto expected_blocked = l10n_util::GetStringFUTF16( + IDS_POLICY_EXTENSION_SETTINGS_ORIGIN_LIMIT_WARNING, + base::NumberToString16(schema_constants::kMaxItemsURLPatternSet)); + + EXPECT_TRUE(error_str.find(expected_allowed) != std::wstring::npos); + EXPECT_TRUE(error_str.find(expected_blocked) != std::wstring::npos); +} + TEST(ExtensionSettingsPolicyHandlerTest, ApplyPolicySettings) { // Mark as enterprise managed. #if defined(OS_WIN)
diff --git a/chrome/browser/extensions/updater/update_service_browsertest.cc b/chrome/browser/extensions/updater/update_service_browsertest.cc index 044b02fd..7345d4f3 100644 --- a/chrome/browser/extensions/updater/update_service_browsertest.cc +++ b/chrome/browser/extensions/updater/update_service_browsertest.cc
@@ -458,7 +458,7 @@ // ExtensionManagementPolicyUpdater requires a single-threaded context to // call RunLoop::RunUntilIdle internally, and it isn't ready at this setup // moment. - base::test::ScopedTaskEnvironment env; + base::test::TaskEnvironment env; ExtensionManagementPolicyUpdater management_policy(&policy_provider_); management_policy.SetIndividualExtensionAutoInstalled( id_, extension_urls::kChromeWebstoreUpdateURL, true /* forced */);
diff --git a/chrome/browser/feature_engagement/OWNERS b/chrome/browser/feature_engagement/OWNERS index 5a740c0b..892955c6 100644 --- a/chrome/browser/feature_engagement/OWNERS +++ b/chrome/browser/feature_engagement/OWNERS
@@ -3,3 +3,5 @@ # Backup file://components/feature_engagement/OWNERS + +# COMPONENT: Internals>FeatureEngagement
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 8657fd5e..303ac0f 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -2768,6 +2768,11 @@ "expiry_milestone": 75 }, { + "name": "profile-menu-revamp", + "owners": [ "tangltom" ], + "expiry_milestone": 82 + }, + { "name": "progress-bar-throttle", "owners": [ "mdjones" ], "expiry_milestone": 76
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index dcdf8e76..e94d38f 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -3587,6 +3587,10 @@ "Enables click to call feature signals to be handled on desktop by showing " "a list of user's available devices with telephony functionality."; +const char kProfileMenuRevampName[] = "Profile menu revamp"; +const char kProfileMenuRevampDescription[] = + "Enables the new version of the profile menu (aka user menu)."; + #endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) #if defined(OS_MACOSX) || defined(OS_CHROMEOS)
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 6ee7fb7e..82363486 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -2161,6 +2161,9 @@ extern const char kClickToCallUIName[]; extern const char kClickToCallUIDescription[]; +extern const char kProfileMenuRevampName[]; +extern const char kProfileMenuRevampDescription[]; + #endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) #if defined(OS_MACOSX) || defined(OS_CHROMEOS)
diff --git a/chrome/browser/google/google_search_domain_mixing_metrics_emitter_unittest.cc b/chrome/browser/google/google_search_domain_mixing_metrics_emitter_unittest.cc index ffa4a4f..d237f51 100644 --- a/chrome/browser/google/google_search_domain_mixing_metrics_emitter_unittest.cc +++ b/chrome/browser/google/google_search_domain_mixing_metrics_emitter_unittest.cc
@@ -19,8 +19,7 @@ class GoogleSearchDomainMixingMetricsEmitterTest : public testing::Test { public: GoogleSearchDomainMixingMetricsEmitterTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void SetUp() override { GoogleSearchDomainMixingMetricsEmitter::RegisterProfilePrefs(
diff --git a/chrome/browser/google/google_update_win.cc b/chrome/browser/google/google_update_win.cc index 733532ca..d6fbf33 100644 --- a/chrome/browser/google/google_update_win.cc +++ b/chrome/browser/google/google_update_win.cc
@@ -886,7 +886,7 @@ } // TODO(calamity): Remove once a MockTimer is implemented in -// ScopedTaskEnvironment. See https://crbug.com/708584. +// TaskEnvironment. See https://crbug.com/708584. void SetUpdateDriverTaskRunnerForTesting( base::SingleThreadTaskRunner* task_runner) { g_update_driver_task_runner = task_runner;
diff --git a/chrome/browser/internal_auth_unittest.cc b/chrome/browser/internal_auth_unittest.cc index 180d48c..c6ca69cb 100644 --- a/chrome/browser/internal_auth_unittest.cc +++ b/chrome/browser/internal_auth_unittest.cc
@@ -26,7 +26,7 @@ void TearDown() override {} - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::string long_string_; };
diff --git a/chrome/browser/local_discovery/local_domain_resolver_unittest.cc b/chrome/browser/local_discovery/local_domain_resolver_unittest.cc index badd98fe..0585180 100644 --- a/chrome/browser/local_discovery/local_domain_resolver_unittest.cc +++ b/chrome/browser/local_discovery/local_domain_resolver_unittest.cc
@@ -103,7 +103,7 @@ net::MockMDnsSocketFactory socket_factory_; net::MDnsClientImpl mdns_client_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(LocalDomainResolverTest, ResolveDomainA) {
diff --git a/chrome/browser/local_discovery/service_discovery_client_unittest.cc b/chrome/browser/local_discovery/service_discovery_client_unittest.cc index 2744219..fd79aa3 100644 --- a/chrome/browser/local_discovery/service_discovery_client_unittest.cc +++ b/chrome/browser/local_discovery/service_discovery_client_unittest.cc
@@ -231,7 +231,7 @@ net::MockMDnsSocketFactory socket_factory_; net::MDnsClientImpl mdns_client_; ServiceDiscoveryClientImpl service_discovery_client_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(ServiceDiscoveryTest, AddRemoveService) {
diff --git a/chrome/browser/mac/keystone_glue_unittest.mm b/chrome/browser/mac/keystone_glue_unittest.mm index eb51945..2fbe8a89 100644 --- a/chrome/browser/mac/keystone_glue_unittest.mm +++ b/chrome/browser/mac/keystone_glue_unittest.mm
@@ -182,7 +182,7 @@ class KeystoneGlueTest : public PlatformTest { private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // DISABLED because the mocking isn't currently working.
diff --git a/chrome/browser/media/android/cdm/media_drm_origin_id_manager_unittest.cc b/chrome/browser/media/android/cdm/media_drm_origin_id_manager_unittest.cc index 8ebfbc2b..319eb30 100644 --- a/chrome/browser/media/android/cdm/media_drm_origin_id_manager_unittest.cc +++ b/chrome/browser/media/android/cdm/media_drm_origin_id_manager_unittest.cc
@@ -139,7 +139,7 @@ protected: content::TestBrowserThreadBundle test_browser_thread_bundle_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; base::test::ScopedFeatureList scoped_feature_list_; std::unique_ptr<TestingProfile> profile_; MediaDrmOriginIdManager* origin_id_manager_;
diff --git a/chrome/browser/media/router/discovery/dial/device_description_fetcher_unittest.cc b/chrome/browser/media/router/discovery/dial/device_description_fetcher_unittest.cc index 0c585a5..386c1e9 100644 --- a/chrome/browser/media/router/discovery/dial/device_description_fetcher_unittest.cc +++ b/chrome/browser/media/router/discovery/dial/device_description_fetcher_unittest.cc
@@ -73,7 +73,7 @@ MOCK_METHOD1(OnSuccess, void(const DialDeviceDescriptionData&)); MOCK_METHOD1(OnError, void(const std::string&)); - base::test::ScopedTaskEnvironment environment_; + base::test::TaskEnvironment environment_; const GURL url_; network::TestURLLoaderFactory loader_factory_; std::unique_ptr<TestDeviceDescriptionFetcher> description_fetcher_;
diff --git a/chrome/browser/media/router/discovery/dial/device_description_service_unittest.cc b/chrome/browser/media/router/discovery/dial/device_description_service_unittest.cc index 7097d74c..c0cd43d1 100644 --- a/chrome/browser/media/router/discovery/dial/device_description_service_unittest.cc +++ b/chrome/browser/media/router/discovery/dial/device_description_service_unittest.cc
@@ -105,7 +105,7 @@ } protected: - base::test::ScopedTaskEnvironment environment_; + base::test::TaskEnvironment environment_; base::MockCallback< DeviceDescriptionService::DeviceDescriptionParseSuccessCallback> mock_success_cb_;
diff --git a/chrome/browser/media/router/discovery/dial/dial_url_fetcher_unittest.cc b/chrome/browser/media/router/discovery/dial/dial_url_fetcher_unittest.cc index 8f100be..9f49175 100644 --- a/chrome/browser/media/router/discovery/dial/dial_url_fetcher_unittest.cc +++ b/chrome/browser/media/router/discovery/dial/dial_url_fetcher_unittest.cc
@@ -45,7 +45,7 @@ MOCK_METHOD1(OnSuccess, void(const std::string&)); MOCK_METHOD2(OnError, void(int, const std::string&)); - base::test::ScopedTaskEnvironment environment_; + base::test::TaskEnvironment environment_; network::TestURLLoaderFactory loader_factory_; const GURL url_; std::unique_ptr<TestDialURLFetcher> fetcher_;
diff --git a/chrome/browser/media/router/discovery/discovery_network_monitor_metric_observer_unittest.cc b/chrome/browser/media/router/discovery/discovery_network_monitor_metric_observer_unittest.cc index 16cad93..b4d9de19 100644 --- a/chrome/browser/media/router/discovery/discovery_network_monitor_metric_observer_unittest.cc +++ b/chrome/browser/media/router/discovery/discovery_network_monitor_metric_observer_unittest.cc
@@ -61,8 +61,7 @@ class DiscoveryNetworkMonitorMetricObserverTest : public ::testing::Test { public: DiscoveryNetworkMonitorMetricObserverTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), start_ticks_(thread_bundle_.NowTicks()), metrics_(std::make_unique<MockMetrics>()), mock_metrics_(metrics_.get()),
diff --git a/chrome/browser/media/router/issue_manager_unittest.cc b/chrome/browser/media/router/issue_manager_unittest.cc index 325932e..99c5e47 100644 --- a/chrome/browser/media/router/issue_manager_unittest.cc +++ b/chrome/browser/media/router/issue_manager_unittest.cc
@@ -31,8 +31,7 @@ class IssueManagerTest : public ::testing::Test { protected: IssueManagerTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) { + : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) { manager_.set_task_runner_for_test(thread_bundle_.GetMainThreadTaskRunner()); } ~IssueManagerTest() override {}
diff --git a/chrome/browser/media/router/providers/dial/dial_activity_manager_unittest.cc b/chrome/browser/media/router/providers/dial/dial_activity_manager_unittest.cc index ec44172..36191d29 100644 --- a/chrome/browser/media/router/providers/dial/dial_activity_manager_unittest.cc +++ b/chrome/browser/media/router/providers/dial/dial_activity_manager_unittest.cc
@@ -109,7 +109,7 @@ RouteRequestResult::ResultCode)); protected: - base::test::ScopedTaskEnvironment environment_; + base::test::TaskEnvironment environment_; std::string presentation_id_ = "presentationId"; MediaSinkInternal sink_ = CreateDialSink(1); MediaSource::Id source_id_ =
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_common_unittest.cc b/chrome/browser/media/webrtc/webrtc_event_log_manager_common_unittest.cc index 93fc01e..736216b 100644 --- a/chrome/browser/media/webrtc/webrtc_event_log_manager_common_unittest.cc +++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_common_unittest.cc
@@ -323,7 +323,7 @@ } } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::Optional<WebRtcEventLogCompression> compression_; // Set in Init(). base::ScopedTempDir temp_dir_; base::FilePath path_;
diff --git a/chrome/browser/media/webrtc/webrtc_log_uploader_unittest.cc b/chrome/browser/media/webrtc/webrtc_log_uploader_unittest.cc index 4d9d21b1..7fc1afb 100644 --- a/chrome/browser/media/webrtc/webrtc_log_uploader_unittest.cc +++ b/chrome/browser/media/webrtc/webrtc_log_uploader_unittest.cc
@@ -195,7 +195,7 @@ run_loop.Run(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::FilePath test_list_path_; };
diff --git a/chrome/browser/media_galleries/media_galleries_preferences.h b/chrome/browser/media_galleries/media_galleries_preferences.h index 026abaa3..07bd418 100644 --- a/chrome/browser/media_galleries/media_galleries_preferences.h +++ b/chrome/browser/media_galleries/media_galleries_preferences.h
@@ -186,7 +186,7 @@ // Before the callback is run, other calls may not return the correct results. // Should be invoked on the UI thread; callbacks will be run on the UI thread. // This call also ensures that the StorageMonitor is initialized. - // Note for unit tests: This requires an active ScopedTaskEnvironment and + // Note for unit tests: This requires an active TaskEnvironment and // EnsureMediaDirectoriesExists instance to complete reliably. void EnsureInitialized(base::Closure callback);
diff --git a/chrome/browser/media_galleries/media_galleries_preferences_unittest.cc b/chrome/browser/media_galleries/media_galleries_preferences_unittest.cc index c48af8d..0fb85f29 100644 --- a/chrome/browser/media_galleries/media_galleries_preferences_unittest.cc +++ b/chrome/browser/media_galleries/media_galleries_preferences_unittest.cc
@@ -1172,8 +1172,8 @@ } TEST(MediaGalleriesPrefInfoTest, NameGeneration) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); ASSERT_TRUE(TestStorageMonitor::CreateAndInstall());
diff --git a/chrome/browser/memory/memory_pressure_monitor_utils_unittest.cc b/chrome/browser/memory/memory_pressure_monitor_utils_unittest.cc index 7b8c183..75ee9a33 100644 --- a/chrome/browser/memory/memory_pressure_monitor_utils_unittest.cc +++ b/chrome/browser/memory/memory_pressure_monitor_utils_unittest.cc
@@ -39,13 +39,12 @@ class ObservationWindowTest : public testing::Test { public: ObservationWindowTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), - tick_clock_(scoped_task_environment_.GetMockTickClock()) {} + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), + tick_clock_(task_environment_.GetMockTickClock()) {} ~ObservationWindowTest() override = default; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const base::TickClock* tick_clock_; @@ -80,7 +79,7 @@ // Fast forward by the length of the observation window, no sample should be // removed as all samples have an age that doesn't exceed the window length. - scoped_task_environment_.FastForwardBy(kDefaultWindowLength); + task_environment_.FastForwardBy(kDefaultWindowLength); int t1_sample = 2; base::TimeTicks t1_timestamp = tick_clock_->NowTicks(); @@ -98,7 +97,7 @@ // Fast forward by one second, the first sample should be removed the next // time a sample gets added as its age exceed the length of the observation // window. - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); int t2_sample = 3; base::TimeTicks t2_timestamp = tick_clock_->NowTicks(); @@ -138,8 +137,8 @@ // Test the detection that the system has reached the early limit. // Remove all the observations from the window. - scoped_task_environment_.FastForwardBy(kDefaultWindowLength + - base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(kDefaultWindowLength + + base::TimeDelta::FromSeconds(1)); const size_t min_sample_count_to_be_positive = static_cast<size_t>(window_config.sample_ratio_to_be_positive * @@ -166,8 +165,8 @@ // Test the detection that the system has reached the critical limit. // Remove all the observations from the window. - scoped_task_environment_.FastForwardBy(kDefaultWindowLength + - base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(kDefaultWindowLength + + base::TimeDelta::FromSeconds(1)); for (size_t i = 0; i < window_config.min_sample_count - min_sample_count_to_be_positive; @@ -209,8 +208,8 @@ EXPECT_TRUE(window.DiskIdleTimeIsLow()); // Remove all the observations from the window. - scoped_task_environment_.FastForwardBy(kDefaultWindowLength + - base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(kDefaultWindowLength + + base::TimeDelta::FromSeconds(1)); // Add a sample under the threshold, the disk idle should be considered as low // as it's under the threshold.
diff --git a/chrome/browser/memory/memory_pressure_monitor_win_unittest.cc b/chrome/browser/memory/memory_pressure_monitor_win_unittest.cc index fc5df01..dec145b 100644 --- a/chrome/browser/memory/memory_pressure_monitor_win_unittest.cc +++ b/chrome/browser/memory/memory_pressure_monitor_win_unittest.cc
@@ -36,9 +36,8 @@ class MemoryPressureMonitorWinTest : public testing::Test { public: MemoryPressureMonitorWinTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), - tick_clock_(scoped_task_environment_.GetMockTickClock()) {} + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), + tick_clock_(task_environment_.GetMockTickClock()) {} ~MemoryPressureMonitorWinTest() override = default; void SetUp() override { @@ -69,7 +68,7 @@ .disk_idle_time_percent_frequency); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const base::TickClock* tick_clock_; std::unique_ptr<performance_monitor::SystemMonitor> system_monitor_; @@ -107,9 +106,9 @@ // Fast forward to the next sample notification. EXPECT_TRUE(system_monitor_->refresh_timer_for_testing().IsRunning()); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( system_monitor_->refresh_timer_for_testing().GetCurrentDelay()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ::testing::Mock::VerifyAndClear(mock_helper_); } @@ -137,9 +136,9 @@ .MemoryIsUnderCriticalLimit()) { // Fast forward to the next sample notification. EXPECT_TRUE(system_monitor_->refresh_timer_for_testing().IsRunning()); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( system_monitor_->refresh_timer_for_testing().GetCurrentDelay()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // The disk idle time is at 100%, there's no memory pressure. @@ -157,9 +156,9 @@ .DiskIdleTimeIsLow()) { // Fast forward to the next sample notification. EXPECT_TRUE(system_monitor_->refresh_timer_for_testing().IsRunning()); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( system_monitor_->refresh_timer_for_testing().GetCurrentDelay()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } EXPECT_EQ(base::MemoryPressureListener::MemoryPressureLevel:: @@ -179,9 +178,9 @@ .MemoryIsUnderEarlyLimit()) { // Fast forward to the next sample notification. EXPECT_TRUE(system_monitor_->refresh_timer_for_testing().IsRunning()); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( system_monitor_->refresh_timer_for_testing().GetCurrentDelay()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } CheckMonitorRefreshFrequencies(SamplingFrequency::kDefaultFrequency,
diff --git a/chrome/browser/metrics/antivirus_metrics_provider_win_unittest.cc b/chrome/browser/metrics/antivirus_metrics_provider_win_unittest.cc index 5bfcf133..cb1b2af 100644 --- a/chrome/browser/metrics/antivirus_metrics_provider_win_unittest.cc +++ b/chrome/browser/metrics/antivirus_metrics_provider_win_unittest.cc
@@ -97,7 +97,7 @@ bool got_results_; bool expect_unhashed_value_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::Optional<UtilWinImpl> util_win_impl_; AntiVirusMetricsProvider provider_; base::test::ScopedFeatureList scoped_feature_list_; @@ -118,6 +118,6 @@ provider_.AsyncInit( base::Bind(&AntiVirusMetricsProviderTest::GetMetricsCallback, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(got_results_); }
diff --git a/chrome/browser/metrics/chromeos_metrics_provider.cc b/chrome/browser/metrics/chromeos_metrics_provider.cc index 680e448..be80655 100644 --- a/chrome/browser/metrics/chromeos_metrics_provider.cc +++ b/chrome/browser/metrics/chromeos_metrics_provider.cc
@@ -309,11 +309,6 @@ void ChromeOSMetricsProvider::WriteBluetoothProto( metrics::SystemProfileProto* system_profile_proto) { - // This may be called before the async init task to set |adapter_| is set, - // such as when the persistent system profile gets filled in initially. - if (!adapter_) - return; - metrics::SystemProfileProto::Hardware* hardware = system_profile_proto->mutable_hardware();
diff --git a/chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker_unittest.cc b/chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker_unittest.cc index 225527f..e5191efe 100644 --- a/chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker_unittest.cc +++ b/chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker_unittest.cc
@@ -90,7 +90,7 @@ MockDesktopSessionObserver observer_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(DesktopSessionDurationTrackerTest); };
diff --git a/chrome/browser/metrics/extensions_metrics_provider_unittest.cc b/chrome/browser/metrics/extensions_metrics_provider_unittest.cc index b9dc920..01ea4bc 100644 --- a/chrome/browser/metrics/extensions_metrics_provider_unittest.cc +++ b/chrome/browser/metrics/extensions_metrics_provider_unittest.cc
@@ -123,7 +123,7 @@ // TestExtensionsMetricsProvider is encoded properly. TEST(ExtensionsMetricsProvider, SystemProtoEncoding) { metrics::SystemProfileProto system_profile; - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestingProfileManager testing_profile_manager( TestingBrowserProcess::GetGlobal()); ASSERT_TRUE(testing_profile_manager.SetUp());
diff --git a/chrome/browser/metrics/metrics_service_browsertest.cc b/chrome/browser/metrics/metrics_service_browsertest.cc index b7e631c5..30b38d0 100644 --- a/chrome/browser/metrics/metrics_service_browsertest.cc +++ b/chrome/browser/metrics/metrics_service_browsertest.cc
@@ -298,7 +298,7 @@ // "Local State" directory is hard-coded because the FILE_LOCAL_STATE // path is not yet defined at this point. { - base::test::ScopedTaskEnvironment task_env; + base::test::TaskEnvironment task_env; auto state = base::MakeRefCounted<JsonPrefStore>( user_dir.Append(FILE_PATH_LITERAL("Local State"))); state->SetValue(
diff --git a/chrome/browser/metrics/perf/heap_collector_unittest.cc b/chrome/browser/metrics/perf/heap_collector_unittest.cc index e506fe20..85d8dd649 100644 --- a/chrome/browser/metrics/perf/heap_collector_unittest.cc +++ b/chrome/browser/metrics/perf/heap_collector_unittest.cc
@@ -193,7 +193,7 @@ public: HeapCollectorTest() : test_browser_thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void SaveProfile(std::unique_ptr<SampledProfile> sampled_profile) { cached_profile_data_.resize(cached_profile_data_.size() + 1);
diff --git a/chrome/browser/metrics/perf/metric_collector_unittest.cc b/chrome/browser/metrics/perf/metric_collector_unittest.cc index 8a1c673..e96dac7 100644 --- a/chrome/browser/metrics/perf/metric_collector_unittest.cc +++ b/chrome/browser/metrics/perf/metric_collector_unittest.cc
@@ -150,7 +150,7 @@ public: MetricCollectorTest() : test_browser_thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + base::test::TaskEnvironment::TimeSource::MOCK_TIME), perf_data_proto_(GetExamplePerfDataProto()), perf_stat_proto_(GetExamplePerfStatProto()) {}
diff --git a/chrome/browser/metrics/perf/metric_provider_unittest.cc b/chrome/browser/metrics/perf/metric_provider_unittest.cc index 7139496d..255bbdbb 100644 --- a/chrome/browser/metrics/perf/metric_provider_unittest.cc +++ b/chrome/browser/metrics/perf/metric_provider_unittest.cc
@@ -88,7 +88,7 @@ public: MetricProviderTest() : test_browser_thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void SetUp() override { CollectionParams test_params;
diff --git a/chrome/browser/metrics/perf/perf_events_collector_unittest.cc b/chrome/browser/metrics/perf/perf_events_collector_unittest.cc index 88489b9..2fe1d6d 100644 --- a/chrome/browser/metrics/perf/perf_events_collector_unittest.cc +++ b/chrome/browser/metrics/perf/perf_events_collector_unittest.cc
@@ -166,7 +166,7 @@ public: PerfCollectorTest() : test_browser_thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void SaveProfile(std::unique_ptr<SampledProfile> sampled_profile) { cached_profile_data_.resize(cached_profile_data_.size() + 1);
diff --git a/chrome/browser/metrics/perf/profile_provider_chromeos_unittest.cc b/chrome/browser/metrics/perf/profile_provider_chromeos_unittest.cc index 2c7b04cc..9df88fc 100644 --- a/chrome/browser/metrics/perf/profile_provider_chromeos_unittest.cc +++ b/chrome/browser/metrics/perf/profile_provider_chromeos_unittest.cc
@@ -147,7 +147,7 @@ public: ProfileProviderTest() : test_browser_thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void SetUp() override { // ProfileProvider requires chromeos::LoginState and
diff --git a/chrome/browser/metrics/plugin_metrics_provider_unittest.cc b/chrome/browser/metrics/plugin_metrics_provider_unittest.cc index 48f7a2e..3ae25560 100644 --- a/chrome/browser/metrics/plugin_metrics_provider_unittest.cc +++ b/chrome/browser/metrics/plugin_metrics_provider_unittest.cc
@@ -119,7 +119,7 @@ TEST_F(PluginMetricsProviderTest, RecordCurrentStateWithDelay) { content::TestBrowserThreadBundle thread_bundle( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment::TimeSource::MOCK_TIME); PluginMetricsProvider provider(prefs()); @@ -134,7 +134,7 @@ TEST_F(PluginMetricsProviderTest, RecordCurrentStateIfPending) { content::TestBrowserThreadBundle thread_bundle( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment::TimeSource::MOCK_TIME); PluginMetricsProvider provider(prefs());
diff --git a/chrome/browser/metrics/upgrade_metrics_provider_unittest.cc b/chrome/browser/metrics/upgrade_metrics_provider_unittest.cc index d8685e5..f4f28ba 100644 --- a/chrome/browser/metrics/upgrade_metrics_provider_unittest.cc +++ b/chrome/browser/metrics/upgrade_metrics_provider_unittest.cc
@@ -29,7 +29,7 @@ }; TEST_F(UpgradeMetricsProviderTest, HistogramCheck) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestHistogramLevel(UpgradeDetector::UPGRADE_ANNOYANCE_NONE); TestHistogramLevel(UpgradeDetector::UPGRADE_ANNOYANCE_VERY_LOW); TestHistogramLevel(UpgradeDetector::UPGRADE_ANNOYANCE_LOW);
diff --git a/chrome/browser/native_file_system/chrome_native_file_system_permission_context_unittest.cc b/chrome/browser/native_file_system/chrome_native_file_system_permission_context_unittest.cc index 709801ab..bfa9ec3 100644 --- a/chrome/browser/native_file_system/chrome_native_file_system_permission_context_unittest.cc +++ b/chrome/browser/native_file_system/chrome_native_file_system_permission_context_unittest.cc
@@ -114,7 +114,7 @@ const base::FilePath kTestPath = base::FilePath(FILE_PATH_LITERAL("/foo/bar")); - content::TestBrowserThreadBundle scoped_task_environment_; + content::TestBrowserThreadBundle task_environment_; base::ScopedTempDir temp_dir_; scoped_refptr<ChromeNativeFileSystemPermissionContext> permission_context_; content::RenderViewHostTestEnabler render_view_host_test_enabler_;
diff --git a/chrome/browser/net/cookie_policy_browsertest.cc b/chrome/browser/net/cookie_policy_browsertest.cc index 8045036..5d6f5b9 100644 --- a/chrome/browser/net/cookie_policy_browsertest.cc +++ b/chrome/browser/net/cookie_policy_browsertest.cc
@@ -5,16 +5,21 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/macros.h" +#include "base/path_service.h" #include "base/strings/stringprintf.h" +#include "base/test/scoped_feature_list.h" +#include "chrome/browser/content_settings/cookie_settings_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "components/content_settings/core/browser/host_content_settings_map.h" +#include "components/content_settings/core/browser/cookie_settings.h" +#include "components/content_settings/core/common/features.h" #include "components/content_settings/core/common/pref_names.h" #include "components/prefs/pref_service.h" +#include "content/public/common/content_paths.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_navigation_observer.h" #include "net/dns/mock_host_resolver.h" @@ -24,12 +29,22 @@ namespace { +// "ServiceWorker", "CacheStorage" are not available because the test server +// runs on http. +const std::vector<std::string> kStorageTypes{ + "Cookie", "LocalStorage", "FileSystem", + "SessionStorage", "IndexedDb", "WebSql", +}; + class CookiePolicyBrowserTest : public InProcessBrowserTest { protected: CookiePolicyBrowserTest() {} void SetUpOnMainThread() override { host_resolver()->AddRule("*", "127.0.0.1"); + base::FilePath path; + base::PathService::Get(content::DIR_TEST_DATA, &path); + embedded_test_server()->ServeFilesFromDirectory(path); ASSERT_TRUE(embedded_test_server()->Start()); } @@ -51,13 +66,9 @@ } void ExpectFrameContent(const std::string& expected) { - content::WebContents* web_contents = - browser()->tab_strip_model()->GetActiveWebContents(); - content::RenderFrameHost* nested = - ChildFrameAt(web_contents->GetMainFrame(), 0); std::string content; ASSERT_TRUE(ExecuteScriptAndExtractString( - nested, + GetFrame(), "window.domAutomationController.send(document.body.textContent)", &content)); EXPECT_EQ(expected, content); @@ -67,25 +78,18 @@ GURL url(embedded_test_server()->GetURL(host, path)); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); - content::RenderFrameHost* nested = - ChildFrameAt(web_contents->GetMainFrame(), 0); content::TestNavigationObserver load_observer(web_contents); ASSERT_TRUE(ExecuteScript( - nested, + GetFrame(), base::StringPrintf("document.body.querySelector('iframe').src = '%s';", url.spec().c_str()))); load_observer.Wait(); } void ExpectNestedFrameContent(const std::string& expected) { - content::WebContents* web_contents = - browser()->tab_strip_model()->GetActiveWebContents(); - content::RenderFrameHost* nested = - ChildFrameAt(web_contents->GetMainFrame(), 0); - content::RenderFrameHost* double_nested = ChildFrameAt(nested, 0); std::string content; ASSERT_TRUE(ExecuteScriptAndExtractString( - double_nested, + GetNestedFrame(), "window.domAutomationController.send(document.body.textContent)", &content)); EXPECT_EQ(expected, content); @@ -98,10 +102,53 @@ embedded_test_server()->GetURL(host, "/"))); } + void SetStorageForFrame(content::RenderFrameHost* frame) { + for (const auto& data_type : kStorageTypes) { + bool data; + EXPECT_TRUE(content::ExecuteScriptAndExtractBool( + frame, "set" + data_type + "()", &data)); + EXPECT_TRUE(data) << data_type; + } + } + + void ExpectStorageForFrame(content::RenderFrameHost* frame, bool expected) { + for (const auto& data_type : kStorageTypes) { + bool data; + EXPECT_TRUE(content::ExecuteScriptAndExtractBool( + frame, "try { has" + data_type + "(); } catch(e) { failure_(); }", + &data)); + EXPECT_EQ(expected, data) << data_type; + } + } + + content::RenderFrameHost* GetFrame() { + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + return ChildFrameAt(web_contents->GetMainFrame(), 0); + } + + content::RenderFrameHost* GetNestedFrame() { + return ChildFrameAt(GetFrame(), 0); + } + private: DISALLOW_COPY_AND_ASSIGN(CookiePolicyBrowserTest); }; +// CookiePolicyBrowserTest with a feature list that enables usage of +// TopLevelOrigin for CookieSettings. This is only required until this +// behavior can be enabled by default. https://crbug.com/988398 +class CookiePolicyTopLevelOriginBrowserTest : public CookiePolicyBrowserTest { + public: + CookiePolicyTopLevelOriginBrowserTest() { + enable_cookie_controls_.InitAndEnableFeature( + content_settings::kImprovedCookieControls); + } + + private: + base::test::ScopedFeatureList enable_cookie_controls_; +}; + // Visits a page that sets a first-party cookie. IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest, AllowFirstPartyCookies) { SetBlockThirdPartyCookies(false); @@ -264,4 +311,218 @@ ExpectNestedFrameContent("None"); } +IN_PROC_BROWSER_TEST_F(CookiePolicyTopLevelOriginBrowserTest, + ThirdPartyCookiesIFrameExceptions) { + SetBlockThirdPartyCookies(true); + + // Set a cookie on `b.com`. + content::SetCookie(browser()->profile(), + embedded_test_server()->GetURL("b.com", "/"), + "thirdparty"); + ExpectCookiesOnHost("b.com", "thirdparty"); + + // Allow all requests to b.com to have cookies. + auto cookie_settings = + CookieSettingsFactory::GetForProfile(browser()->profile()); + GURL url = embedded_test_server()->GetURL("b.com", "/"); + cookie_settings->SetCookieSetting(url, ContentSetting::CONTENT_SETTING_ALLOW); + + NavigateToPageWithFrame("a.com"); + + // Navigate iframe to a cross-site, cookie-reading endpoint, and verify that + // the cookie is sent: + NavigateFrameTo("b.com", "/echoheader?cookie"); + ExpectFrameContent("thirdparty"); + + // Navigate iframe to a cross-site frame with a frame, and navigate _that_ + // frame to a cross-site page that echos the cookie header, and verify that + // the cookie is sent: + NavigateFrameTo("b.com", "/iframe.html"); + NavigateNestedFrameTo("b.com", "/echoheader?cookie"); + ExpectNestedFrameContent("thirdparty"); + + // Navigate iframe to a cross-site frame with a frame, and navigate _that_ + // frame to a distinct cross-site page that echos the cookie header, and + // verify that the cookie is sent: + NavigateFrameTo("c.com", "/iframe.html"); + NavigateNestedFrameTo("b.com", "/echoheader?cookie"); + ExpectNestedFrameContent("thirdparty"); +} + +IN_PROC_BROWSER_TEST_F(CookiePolicyTopLevelOriginBrowserTest, + ThirdPartyCookiesIFrameThirdPartyExceptions) { + SetBlockThirdPartyCookies(true); + + // Set a cookie on `b.com`. + content::SetCookie(browser()->profile(), + embedded_test_server()->GetURL("b.com", "/"), + "thirdparty"); + ExpectCookiesOnHost("b.com", "thirdparty"); + + // Allow all requests on the top frame domain a.com to have cookies. + auto cookie_settings = + CookieSettingsFactory::GetForProfile(browser()->profile()); + GURL url = embedded_test_server()->GetURL("a.com", "/"); + cookie_settings->SetThirdPartyCookieSetting( + url, ContentSetting::CONTENT_SETTING_ALLOW); + + NavigateToPageWithFrame("a.com"); + + // Navigate iframe to a cross-site, cookie-reading endpoint, and verify that + // the cookie is sent: + NavigateFrameTo("b.com", "/echoheader?cookie"); + ExpectFrameContent("thirdparty"); + + // Navigate iframe to a cross-site frame with a frame, and navigate _that_ + // frame to a cross-site page that echos the cookie header, and verify that + // the cookie is sent: + NavigateFrameTo("b.com", "/iframe.html"); + NavigateNestedFrameTo("b.com", "/echoheader?cookie"); + ExpectNestedFrameContent("thirdparty"); + + // Navigate iframe to a cross-site frame with a frame, and navigate _that_ + // frame to a distinct cross-site page that echos the cookie header, and + // verify that the cookie is sent: + NavigateFrameTo("c.com", "/iframe.html"); + NavigateNestedFrameTo("b.com", "/echoheader?cookie"); + ExpectNestedFrameContent("thirdparty"); +} + +IN_PROC_BROWSER_TEST_F(CookiePolicyTopLevelOriginBrowserTest, + ThirdPartyIFrameStorage) { + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/browsing_data/site_data.html"); + ExpectStorageForFrame(GetFrame(), false); + SetStorageForFrame(GetFrame()); + ExpectStorageForFrame(GetFrame(), true); + + SetBlockThirdPartyCookies(true); + + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/browsing_data/site_data.html"); + ExpectStorageForFrame(GetFrame(), false); + + // Allow all requests to b.com to access storage. + auto cookie_settings = + CookieSettingsFactory::GetForProfile(browser()->profile()); + GURL a_url = embedded_test_server()->GetURL("a.com", "/"); + GURL b_url = embedded_test_server()->GetURL("b.com", "/"); + cookie_settings->SetCookieSetting(b_url, + ContentSetting::CONTENT_SETTING_ALLOW); + + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/browsing_data/site_data.html"); + ExpectStorageForFrame(GetFrame(), true); + + // Remove ALLOW setting. + cookie_settings->ResetCookieSetting(b_url); + + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/browsing_data/site_data.html"); + ExpectStorageForFrame(GetFrame(), false); + + // Allow all third-parties on a.com to access storage. + cookie_settings->SetThirdPartyCookieSetting( + a_url, ContentSetting::CONTENT_SETTING_ALLOW); + + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/browsing_data/site_data.html"); + ExpectStorageForFrame(GetFrame(), true); +} + +IN_PROC_BROWSER_TEST_F(CookiePolicyTopLevelOriginBrowserTest, + NestedThirdPartyIFrameStorage) { + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/iframe.html"); + NavigateNestedFrameTo("c.com", "/browsing_data/site_data.html"); + + ExpectStorageForFrame(GetNestedFrame(), false); + SetStorageForFrame(GetNestedFrame()); + ExpectStorageForFrame(GetNestedFrame(), true); + + SetBlockThirdPartyCookies(true); + + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/iframe.html"); + NavigateNestedFrameTo("c.com", "/browsing_data/site_data.html"); + ExpectStorageForFrame(GetNestedFrame(), false); + + // Allow all requests to b.com to access storage. + auto cookie_settings = + CookieSettingsFactory::GetForProfile(browser()->profile()); + GURL a_url = embedded_test_server()->GetURL("a.com", "/"); + GURL c_url = embedded_test_server()->GetURL("c.com", "/"); + cookie_settings->SetCookieSetting(c_url, + ContentSetting::CONTENT_SETTING_ALLOW); + + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/iframe.html"); + NavigateNestedFrameTo("c.com", "/browsing_data/site_data.html"); + ExpectStorageForFrame(GetNestedFrame(), true); + + // Remove ALLOW setting. + cookie_settings->ResetCookieSetting(c_url); + + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/iframe.html"); + NavigateNestedFrameTo("c.com", "/browsing_data/site_data.html"); + ExpectStorageForFrame(GetNestedFrame(), false); + + // Allow all third-parties on a.com to access storage. + cookie_settings->SetThirdPartyCookieSetting( + a_url, ContentSetting::CONTENT_SETTING_ALLOW); + + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/iframe.html"); + NavigateNestedFrameTo("c.com", "/browsing_data/site_data.html"); + ExpectStorageForFrame(GetNestedFrame(), true); +} + +IN_PROC_BROWSER_TEST_F(CookiePolicyTopLevelOriginBrowserTest, + NestedFirstPartyIFrameStorage) { + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/iframe.html"); + NavigateNestedFrameTo("a.com", "/browsing_data/site_data.html"); + + ExpectStorageForFrame(GetNestedFrame(), false); + SetStorageForFrame(GetNestedFrame()); + ExpectStorageForFrame(GetNestedFrame(), true); + + SetBlockThirdPartyCookies(true); + + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/iframe.html"); + NavigateNestedFrameTo("a.com", "/browsing_data/site_data.html"); + ExpectStorageForFrame(GetNestedFrame(), false); + + // Allow all requests to b.com to access storage. + auto cookie_settings = + CookieSettingsFactory::GetForProfile(browser()->profile()); + GURL a_url = embedded_test_server()->GetURL("a.com", "/"); + cookie_settings->SetCookieSetting(a_url, + ContentSetting::CONTENT_SETTING_ALLOW); + + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/iframe.html"); + NavigateNestedFrameTo("a.com", "/browsing_data/site_data.html"); + ExpectStorageForFrame(GetNestedFrame(), true); + + // Remove ALLOW setting. + cookie_settings->ResetCookieSetting(a_url); + + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/iframe.html"); + NavigateNestedFrameTo("a.com", "/browsing_data/site_data.html"); + ExpectStorageForFrame(GetNestedFrame(), false); + + // Allow all third-parties on a.com to access storage. + cookie_settings->SetThirdPartyCookieSetting( + a_url, ContentSetting::CONTENT_SETTING_ALLOW); + + NavigateToPageWithFrame("a.com"); + NavigateFrameTo("b.com", "/iframe.html"); + NavigateNestedFrameTo("a.com", "/browsing_data/site_data.html"); + ExpectStorageForFrame(GetNestedFrame(), true); +} + } // namespace
diff --git a/chrome/browser/net/file_downloader_unittest.cc b/chrome/browser/net/file_downloader_unittest.cc index 4868762..2826d27 100644 --- a/chrome/browser/net/file_downloader_unittest.cc +++ b/chrome/browser/net/file_downloader_unittest.cc
@@ -71,7 +71,7 @@ base::ScopedTempDir dir_; base::FilePath path_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; };
diff --git a/chrome/browser/net/profile_network_context_service.cc b/chrome/browser/net/profile_network_context_service.cc index 1db9dee..92f7229 100644 --- a/chrome/browser/net/profile_network_context_service.cc +++ b/chrome/browser/net/profile_network_context_service.cc
@@ -390,9 +390,18 @@ #endif ContentSettingsForOneType settings; - HostContentSettingsMapFactory::GetForProfile(profile)->GetSettingsForOneType( + HostContentSettingsMap* host_content_settings_map = + HostContentSettingsMapFactory::GetForProfile(profile); + host_content_settings_map->GetSettingsForOneType( CONTENT_SETTINGS_TYPE_COOKIES, std::string(), &settings); out->settings = std::move(settings); + + ContentSettingsForOneType settings_for_legacy_cookie_access; + host_content_settings_map->GetSettingsForOneType( + CONTENT_SETTINGS_TYPE_LEGACY_COOKIE_ACCESS, std::string(), + &settings_for_legacy_cookie_access); + out->settings_for_legacy_cookie_access = + std::move(settings_for_legacy_cookie_access); return out; } @@ -607,19 +616,40 @@ ContentSettingsType content_type, const std::string& resource_identifier) { if (content_type != CONTENT_SETTINGS_TYPE_COOKIES && + content_type != CONTENT_SETTINGS_TYPE_LEGACY_COOKIE_ACCESS && content_type != CONTENT_SETTINGS_TYPE_DEFAULT) { return; } - ContentSettingsForOneType settings; - HostContentSettingsMapFactory::GetForProfile(profile_)->GetSettingsForOneType( - CONTENT_SETTINGS_TYPE_COOKIES, std::string(), &settings); - content::BrowserContext::ForEachStoragePartition( - profile_, base::BindRepeating( - [](ContentSettingsForOneType settings, - content::StoragePartition* storage_partition) { - storage_partition->GetCookieManagerForBrowserProcess() - ->SetContentSettings(settings); - }, - settings)); + if (content_type == CONTENT_SETTINGS_TYPE_COOKIES || + content_type == CONTENT_SETTINGS_TYPE_DEFAULT) { + ContentSettingsForOneType cookies_settings; + HostContentSettingsMapFactory::GetForProfile(profile_) + ->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_COOKIES, std::string(), + &cookies_settings); + content::BrowserContext::ForEachStoragePartition( + profile_, base::BindRepeating( + [](ContentSettingsForOneType settings, + content::StoragePartition* storage_partition) { + storage_partition->GetCookieManagerForBrowserProcess() + ->SetContentSettings(settings); + }, + cookies_settings)); + } + + if (content_type == CONTENT_SETTINGS_TYPE_LEGACY_COOKIE_ACCESS || + content_type == CONTENT_SETTINGS_TYPE_DEFAULT) { + ContentSettingsForOneType legacy_cookie_access_settings; + HostContentSettingsMapFactory::GetForProfile(profile_) + ->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_LEGACY_COOKIE_ACCESS, + std::string(), &legacy_cookie_access_settings); + content::BrowserContext::ForEachStoragePartition( + profile_, base::BindRepeating( + [](ContentSettingsForOneType settings, + content::StoragePartition* storage_partition) { + storage_partition->GetCookieManagerForBrowserProcess() + ->SetContentSettingsForLegacyCookieAccess(settings); + }, + legacy_cookie_access_settings)); + } }
diff --git a/chrome/browser/notifications/notification_platform_bridge_win_unittest.cc b/chrome/browser/notifications/notification_platform_bridge_win_unittest.cc index 867b3f2..dda24ae7c 100644 --- a/chrome/browser/notifications/notification_platform_bridge_win_unittest.cc +++ b/chrome/browser/notifications/notification_platform_bridge_win_unittest.cc
@@ -49,8 +49,7 @@ class NotificationPlatformBridgeWinTest : public testing::Test { public: NotificationPlatformBridgeWinTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~NotificationPlatformBridgeWinTest() override = default;
diff --git a/chrome/browser/notifications/notification_trigger_scheduler_unittest.cc b/chrome/browser/notifications/notification_trigger_scheduler_unittest.cc index 88172838..8c369a5 100644 --- a/chrome/browser/notifications/notification_trigger_scheduler_unittest.cc +++ b/chrome/browser/notifications/notification_trigger_scheduler_unittest.cc
@@ -38,8 +38,7 @@ class NotificationTriggerSchedulerTest : public testing::Test { protected: NotificationTriggerSchedulerTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} class ProfileTestData { public:
diff --git a/chrome/browser/notifications/scheduler/internal/background_task_coordinator_unittest.cc b/chrome/browser/notifications/scheduler/internal/background_task_coordinator_unittest.cc index 1323e8e..df372ea 100644 --- a/chrome/browser/notifications/scheduler/internal/background_task_coordinator_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/background_task_coordinator_unittest.cc
@@ -129,7 +129,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; test::FakeClock clock_; SchedulerConfig config_; std::unique_ptr<BackgroundTaskCoordinator> coordinator_;
diff --git a/chrome/browser/notifications/scheduler/internal/display_decider_unittest.cc b/chrome/browser/notifications/scheduler/internal/display_decider_unittest.cc index 24593da..ca49c6d7 100644 --- a/chrome/browser/notifications/scheduler/internal/display_decider_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/display_decider_unittest.cc
@@ -114,7 +114,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestData test_data_; SchedulerConfig config_;
diff --git a/chrome/browser/notifications/scheduler/internal/icon_converter_unittest.cc b/chrome/browser/notifications/scheduler/internal/icon_converter_unittest.cc index d23d296..0289861 100644 --- a/chrome/browser/notifications/scheduler/internal/icon_converter_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/icon_converter_unittest.cc
@@ -49,7 +49,7 @@ std::vector<std::string>* encoded_data() { return &encoded_data_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<IconConverter> icon_converter_; std::vector<std::string> encoded_data_; std::vector<SkBitmap> decoded_icons_;
diff --git a/chrome/browser/notifications/scheduler/internal/icon_store_unittest.cc b/chrome/browser/notifications/scheduler/internal/icon_store_unittest.cc index f2a8869..2fce91d3 100644 --- a/chrome/browser/notifications/scheduler/internal/icon_store_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/icon_store_unittest.cc
@@ -78,7 +78,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<IconStore> store_; std::map<std::string, proto::Icon> db_entries_; std::unique_ptr<std::vector<IconEntry>> loaded_entries_;
diff --git a/chrome/browser/notifications/scheduler/internal/impression_history_tracker_unittest.cc b/chrome/browser/notifications/scheduler/internal/impression_history_tracker_unittest.cc index b77cbe6..986eaf5 100644 --- a/chrome/browser/notifications/scheduler/internal/impression_history_tracker_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/impression_history_tracker_unittest.cc
@@ -161,7 +161,7 @@ test::FakeClock* clock() { return &clock_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; test::FakeClock clock_; SchedulerConfig config_; std::unique_ptr<ImpressionHistoryTracker> impression_trakcer_;
diff --git a/chrome/browser/notifications/scheduler/internal/impression_store_unittest.cc b/chrome/browser/notifications/scheduler/internal/impression_store_unittest.cc index edc2dd27..56dd8977 100644 --- a/chrome/browser/notifications/scheduler/internal/impression_store_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/impression_store_unittest.cc
@@ -90,7 +90,7 @@ } } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::map<std::string, proto::ClientState> db_entries_; bool load_result_; Entries loaded_entries_;
diff --git a/chrome/browser/notifications/scheduler/internal/init_aware_scheduler_unittest.cc b/chrome/browser/notifications/scheduler/internal/init_aware_scheduler_unittest.cc index 6fb72f3c..77a2629 100644 --- a/chrome/browser/notifications/scheduler/internal/init_aware_scheduler_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/init_aware_scheduler_unittest.cc
@@ -64,7 +64,7 @@ MockNotificationScheduler* scheduler_impl() { return scheduler_impl_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockNotificationScheduler* scheduler_impl_; std::unique_ptr<NotificationScheduler> init_aware_scheduler_;
diff --git a/chrome/browser/notifications/scheduler/internal/notification_scheduler_unittest.cc b/chrome/browser/notifications/scheduler/internal/notification_scheduler_unittest.cc index 85d70e2d..85e59a2 100644 --- a/chrome/browser/notifications/scheduler/internal/notification_scheduler_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/notification_scheduler_unittest.cc
@@ -135,7 +135,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NotificationSchedulerClientRegistrar* registrar_; test::MockImpressionHistoryTracker* impression_tracker_; test::MockScheduledNotificationManager* notification_manager_;
diff --git a/chrome/browser/notifications/scheduler/internal/notification_store_unittest.cc b/chrome/browser/notifications/scheduler/internal/notification_store_unittest.cc index d14a4fa2..40355c58 100644 --- a/chrome/browser/notifications/scheduler/internal/notification_store_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/notification_store_unittest.cc
@@ -87,7 +87,7 @@ loaded_entries_ = std::move(entries); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Database test objects. FakeDB<proto::NotificationEntry, NotificationEntry>* db_;
diff --git a/chrome/browser/notifications/scheduler/internal/scheduled_notification_manager_unittest.cc b/chrome/browser/notifications/scheduler/internal/scheduled_notification_manager_unittest.cc index 8e0bf4e5..fbf8a5b 100644 --- a/chrome/browser/notifications/scheduler/internal/scheduled_notification_manager_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/scheduled_notification_manager_unittest.cc
@@ -155,7 +155,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockDelegate> delegate_; MockNotificationStore* notification_store_; MockIconStore* icon_store_;
diff --git a/chrome/browser/notifications/scheduler/internal/scheduler_utils_unittest.cc b/chrome/browser/notifications/scheduler/internal/scheduler_utils_unittest.cc index ede5fe4..6afb00b 100644 --- a/chrome/browser/notifications/scheduler/internal/scheduler_utils_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/scheduler_utils_unittest.cc
@@ -49,7 +49,7 @@ base::Time& beginning_of_today() { return beginning_of_today_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; test::FakeClock clock_; SchedulerConfig config_; base::Time beginning_of_today_;
diff --git a/chrome/browser/notifications/win/notification_image_retainer_unittest.cc b/chrome/browser/notifications/win/notification_image_retainer_unittest.cc index 9c373baf..4f43e1fa 100644 --- a/chrome/browser/notifications/win/notification_image_retainer_unittest.cc +++ b/chrome/browser/notifications/win/notification_image_retainer_unittest.cc
@@ -25,14 +25,13 @@ class NotificationImageRetainerTest : public ::testing::Test { public: NotificationImageRetainerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), user_data_dir_override_(chrome::DIR_USER_DATA) {} ~NotificationImageRetainerTest() override = default; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: base::ScopedPathOverride user_data_dir_override_; @@ -42,8 +41,8 @@ TEST_F(NotificationImageRetainerTest, RegisterTemporaryImage) { auto image_retainer = std::make_unique<NotificationImageRetainer>( - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMockTickClock()); + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMockTickClock()); SkBitmap icon; icon.allocN32Pixels(64, 64); @@ -56,7 +55,7 @@ // Fast-forward the task runner so that the file deletion task posted in // RegisterTemporaryImage() finishes running. - scoped_task_environment_.FastForwardBy(kDeletionDelay); + task_environment_.FastForwardBy(kDeletionDelay); // The temp file should be deleted now. ASSERT_FALSE(base::PathExists(temp_file)); @@ -69,8 +68,8 @@ TEST_F(NotificationImageRetainerTest, DeleteFilesInBatch) { auto image_retainer = std::make_unique<NotificationImageRetainer>( - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMockTickClock()); + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMockTickClock()); SkBitmap icon; icon.allocN32Pixels(64, 64); @@ -84,7 +83,7 @@ // Simulate ticking of the clock so that the next image file has a different // registration time. - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); // Create 2nd image file on disk. base::FilePath temp_file2 = image_retainer->RegisterTemporaryImage(image); @@ -93,7 +92,7 @@ // Simulate ticking of the clock so that the next image file has a different // registration time. - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); // Create 3rd image file on disk. base::FilePath temp_file3 = image_retainer->RegisterTemporaryImage(image); @@ -102,22 +101,22 @@ // Fast-forward the task runner by kDeletionDelay. The first temp file should // be deleted now, while the other two should still be around. - scoped_task_environment_.FastForwardBy(kDeletionDelay); + task_environment_.FastForwardBy(kDeletionDelay); ASSERT_FALSE(base::PathExists(temp_file1)); ASSERT_TRUE(base::PathExists(temp_file2)); ASSERT_TRUE(base::PathExists(temp_file3)); // Fast-forward the task runner again. The second and the third temp files // are deleted simultaneously. - scoped_task_environment_.FastForwardBy(kDeletionDelay); + task_environment_.FastForwardBy(kDeletionDelay); ASSERT_FALSE(base::PathExists(temp_file2)); ASSERT_FALSE(base::PathExists(temp_file3)); } TEST_F(NotificationImageRetainerTest, CleanupFilesFromPrevSessions) { auto image_retainer = std::make_unique<NotificationImageRetainer>( - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMockTickClock()); + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMockTickClock()); const base::FilePath& image_dir = image_retainer->image_dir(); ASSERT_TRUE(base::CreateDirectory(image_dir)); @@ -147,7 +146,7 @@ image_retainer->CleanupFilesFromPrevSessions(); // Now the file cleanup task finishes running. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // The two temp files from previous sessions should be deleted now. ASSERT_FALSE(base::PathExists(temp_file1)); @@ -158,7 +157,7 @@ // Fast-forward the task runner so that the file deletion task posted in // RegisterTemporaryImage() finishes running. - scoped_task_environment_.FastForwardBy(kDeletionDelay); + task_environment_.FastForwardBy(kDeletionDelay); // The temp file created in this session should be deleted now. ASSERT_FALSE(base::PathExists(temp_file3));
diff --git a/chrome/browser/notifications/win/notification_template_builder_unittest.cc b/chrome/browser/notifications/win/notification_template_builder_unittest.cc index 2bf3bea..d5d9181 100644 --- a/chrome/browser/notifications/win/notification_template_builder_unittest.cc +++ b/chrome/browser/notifications/win/notification_template_builder_unittest.cc
@@ -84,7 +84,7 @@ EXPECT_EQ(xml_template, expected_xml_template); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: DISALLOW_COPY_AND_ASSIGN(NotificationTemplateBuilderTest);
diff --git a/chrome/browser/optimization_guide/optimization_guide_hints_manager.cc b/chrome/browser/optimization_guide/optimization_guide_hints_manager.cc index 03eee2e9..499aed57 100644 --- a/chrome/browser/optimization_guide/optimization_guide_hints_manager.cc +++ b/chrome/browser/optimization_guide/optimization_guide_hints_manager.cc
@@ -436,6 +436,8 @@ } void OptimizationGuideHintsManager::OnFetchedHintsStored() { + LOCAL_HISTOGRAM_BOOLEAN("OptimizationGuide.FetchedHints.Stored", true); + hints_fetch_timer_.Stop(); hints_fetch_timer_.Start( FROM_HERE, hint_cache_->FetchedHintsUpdateTime() - clock_->Now(), this, @@ -643,3 +645,7 @@ net::EffectiveConnectionType effective_connection_type) { current_effective_connection_type_ = effective_connection_type; } + +void OptimizationGuideHintsManager::ClearFetchedHints() { + hint_cache_->ClearFetchedHints(); +}
diff --git a/chrome/browser/optimization_guide/optimization_guide_hints_manager.h b/chrome/browser/optimization_guide/optimization_guide_hints_manager.h index e63c4f2..14791d6f 100644 --- a/chrome/browser/optimization_guide/optimization_guide_hints_manager.h +++ b/chrome/browser/optimization_guide/optimization_guide_hints_manager.h
@@ -108,6 +108,9 @@ optimization_guide::proto::OptimizationType optimization_type, optimization_guide::OptimizationMetadata* optimization_metadata); + // Clears fetched hints from |hint_cache_|. + void ClearFetchedHints(); + // Overrides |hints_fetcher_| for testing. void SetHintsFetcherForTesting( std::unique_ptr<optimization_guide::HintsFetcher> hints_fetcher);
diff --git a/chrome/browser/optimization_guide/optimization_guide_hints_manager_unittest.cc b/chrome/browser/optimization_guide/optimization_guide_hints_manager_unittest.cc index 46a0486..b9a47bbf 100644 --- a/chrome/browser/optimization_guide/optimization_guide_hints_manager_unittest.cc +++ b/chrome/browser/optimization_guide/optimization_guide_hints_manager_unittest.cc
@@ -308,8 +308,8 @@ } content::TestBrowserThreadBundle browser_thread_bundle_ = { - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; std::unique_ptr<OptimizationGuideHintsManager> hints_manager_; std::unique_ptr<TestOptimizationGuideService> optimization_guide_service_;
diff --git a/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc b/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc index be22d8ff..7ef9e75 100644 --- a/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc +++ b/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc
@@ -93,6 +93,11 @@ optimization_metadata); } +void OptimizationGuideKeyedService::ClearData() { + if (hints_manager_) + hints_manager_->ClearFetchedHints(); +} + void OptimizationGuideKeyedService::Shutdown() { if (hints_manager_) { hints_manager_->Shutdown();
diff --git a/chrome/browser/optimization_guide/optimization_guide_keyed_service.h b/chrome/browser/optimization_guide/optimization_guide_keyed_service.h index 66fe52c..d124d7c 100644 --- a/chrome/browser/optimization_guide/optimization_guide_keyed_service.h +++ b/chrome/browser/optimization_guide/optimization_guide_keyed_service.h
@@ -62,6 +62,9 @@ // optimization type registered and there is a hint available. void MaybeLoadHintForNavigation(content::NavigationHandle* navigation_handle); + // Clears data specific to the user. + void ClearData(); + // optimization_guide::OptimizationGuideDecider implementation: void RegisterOptimizationTypes( std::vector<optimization_guide::proto::OptimizationType>
diff --git a/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc b/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc index 1c00b53e..c05d606 100644 --- a/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc +++ b/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc
@@ -16,6 +16,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/optimization_guide/command_line_top_host_provider.h" +#include "components/optimization_guide/hint_cache_store.h" #include "components/optimization_guide/optimization_guide_features.h" #include "components/optimization_guide/optimization_guide_prefs.h" #include "components/optimization_guide/optimization_guide_switches.h" @@ -97,20 +98,39 @@ {optimization_guide::features::kOptimizationHints, optimization_guide::features::kOptimizationGuideKeyedService}, {}); + OptimizationGuideKeyedServiceDisabledBrowserTest::SetUp(); } + void SetUpCommandLine(base::CommandLine* cmd) override { + cmd->AppendSwitch(optimization_guide::switches::kPurgeHintCacheStore); + } + void SetUpOnMainThread() override { - embedded_test_server()->RegisterRequestHandler(base::BindRepeating( + OptimizationGuideKeyedServiceDisabledBrowserTest::SetUpOnMainThread(); + + https_server_.reset( + new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS)); + https_server_->RegisterRequestHandler(base::BindRepeating( &OptimizationGuideKeyedServiceBrowserTest::HandleRequest, base::Unretained(this))); - ASSERT_TRUE(embedded_test_server()->Start()); + ASSERT_TRUE(https_server_->Start()); + url_with_hints_ = - embedded_test_server()->GetURL("somehost.com", "/hashints/whatever"); + https_server_->GetURL("somehost.com", "/hashints/whatever"); + url_that_redirects_ = https_server_->GetURL("/redirect"); + } - PushHintsComponentAndWaitForCompletion(); + void TearDown() override { + scoped_feature_list_.Reset(); - OptimizationGuideKeyedServiceDisabledBrowserTest::SetUpOnMainThread(); + OptimizationGuideKeyedServiceDisabledBrowserTest::TearDown(); + } + + void TearDownOnMainThread() override { + EXPECT_TRUE(https_server_->ShutdownAndWaitUntilComplete()); + + OptimizationGuideKeyedServiceDisabledBrowserTest::TearDownOnMainThread(); } void RegisterWithKeyedService() { @@ -118,9 +138,6 @@ ->RegisterOptimizationTypes({optimization_guide::proto::NOSCRIPT}); } - GURL url_with_hints() { return url_with_hints_; } - - private: void PushHintsComponentAndWaitForCompletion() { base::RunLoop run_loop; OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile()) @@ -138,6 +155,11 @@ run_loop.Run(); } + GURL url_with_hints() { return url_with_hints_; } + + GURL url_that_redirects() { return url_that_redirects_; } + + private: std::unique_ptr<net::test_server::HttpResponse> HandleRequest( const net::test_server::HttpRequest& request) { std::unique_ptr<net::test_server::BasicHttpResponse> response; @@ -149,7 +171,9 @@ return std::move(response); } + std::unique_ptr<net::EmbeddedTestServer> https_server_; GURL url_with_hints_; + GURL url_that_redirects_; base::test::ScopedFeatureList scoped_feature_list_; optimization_guide::testing::TestHintsComponentCreator test_hints_component_creator_; @@ -167,6 +191,8 @@ IN_PROC_BROWSER_TEST_F( OptimizationGuideKeyedServiceBrowserTest, NavigateToPageWithHintsButNoRegistrationDoesNotAttemptToLoadHint) { + PushHintsComponentAndWaitForCompletion(); + base::HistogramTester histogram_tester; ui_test_utils::NavigateToURL(browser(), url_with_hints()); @@ -176,6 +202,7 @@ IN_PROC_BROWSER_TEST_F(OptimizationGuideKeyedServiceBrowserTest, NavigateToPageWithHintsLoadsHint) { + PushHintsComponentAndWaitForCompletion(); RegisterWithKeyedService(); base::HistogramTester histogram_tester; @@ -194,12 +221,12 @@ IN_PROC_BROWSER_TEST_F( OptimizationGuideKeyedServiceBrowserTest, NavigateToPageThatRedirectsToUrlWithHintsShouldAttemptTwoLoads) { + PushHintsComponentAndWaitForCompletion(); RegisterWithKeyedService(); base::HistogramTester histogram_tester; - GURL first_url = embedded_test_server()->GetURL("/redirect"); - ui_test_utils::NavigateToURL(browser(), first_url); + ui_test_utils::NavigateToURL(browser(), url_that_redirects()); EXPECT_GE(RetryForHistogramUntilCountReached( histogram_tester, "OptimizationGuide.LoadedHint.Result", 2), @@ -214,6 +241,7 @@ IN_PROC_BROWSER_TEST_F(OptimizationGuideKeyedServiceBrowserTest, NavigateToPageWithoutHint) { + PushHintsComponentAndWaitForCompletion(); RegisterWithKeyedService(); base::HistogramTester histogram_tester; @@ -247,6 +275,8 @@ } void SetUpCommandLine(base::CommandLine* cmd) override { + OptimizationGuideKeyedServiceBrowserTest::SetUpCommandLine(cmd); + cmd->AppendSwitch("enable-spdy-proxy-auth"); // Add switch to avoid having to see the infobar in the test. cmd->AppendSwitch(previews::switches::kDoNotRequireLitePageRedirectInfoBar); @@ -308,7 +338,7 @@ SetUpCommandLine(cmd); cmd->AppendSwitchASCII(optimization_guide::switches::kFetchHintsOverride, - "whatever.com,awesome.com"); + "whatever.com,somehost.com"); } }; @@ -325,3 +355,176 @@ EXPECT_EQ(1ul, top_hosts.size()); EXPECT_EQ("whatever.com", top_hosts[0]); } + +// TODO(crbug/969558): Migrate this test directly to the HintsFetcherBrowserTest +// when it supports both the original and OptimizationGuideKeyedService path. +class OptimizationGuideKeyedServiceHintsFetcherTest + : public OptimizationGuideKeyedServiceCommandLineOverridesTest { + public: + OptimizationGuideKeyedServiceHintsFetcherTest() = default; + ~OptimizationGuideKeyedServiceHintsFetcherTest() override = default; + + void SetUp() override { + feature_list_.InitWithFeatures( + {optimization_guide::features::kOptimizationHintsFetching}, {}); + + api_server_.reset( + new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS)); + api_server_->ServeFilesFromSourceDirectory("chrome/test/data/previews"); + api_server_->RegisterRequestHandler(base::BindRepeating( + &OptimizationGuideKeyedServiceHintsFetcherTest::HandleGetHintsRequest, + base::Unretained(this))); + ASSERT_TRUE(api_server_->InitializeAndListen()); + + // We run the base class's set up after we set up here since the base class + // runs SetUpCommandLine prior to all the API server initialization and + // will have a non-existent URL to override the API server URL with. + OptimizationGuideKeyedServiceCommandLineOverridesTest::SetUp(); + } + + void SetUpCommandLine(base::CommandLine* cmd) override { + OptimizationGuideKeyedServiceCommandLineOverridesTest::SetUpCommandLine( + cmd); + + cmd->AppendSwitch(optimization_guide::switches::kFetchHintsOverrideTimer); + cmd->AppendSwitchASCII( + optimization_guide::switches::kOptimizationGuideServiceURL, + api_server_->base_url().spec()); + } + + void SetUpOnMainThread() override { + OptimizationGuideKeyedServiceCommandLineOverridesTest::SetUpOnMainThread(); + + api_server_->StartAcceptingConnections(); + + // Expect that the browser initialization will record at least one sample + // in each of the follow histograms as OnePlatform Hints are enabled. + EXPECT_GE( + RetryForHistogramUntilCountReached( + histogram_tester_, + "OptimizationGuide.HintsFetcher.GetHintsRequest.HostCount", 1), + 1); + + // There should be 2 sites passed via command line. + histogram_tester_.ExpectBucketCount( + "OptimizationGuide.HintsFetcher.GetHintsRequest.HostCount", 2, 1); + + EXPECT_GE(RetryForHistogramUntilCountReached( + histogram_tester_, + "OptimizationGuide.HintsFetcher.GetHintsRequest.Status", 1), + 1); + // There should have been 1 hint returned in the response. + histogram_tester_.ExpectUniqueSample( + "OptimizationGuide.HintsFetcher.GetHintsRequest.HintCount", 1, 1); + + // Wait until fetched hints have been stored. + EXPECT_GE( + RetryForHistogramUntilCountReached( + histogram_tester_, "OptimizationGuide.FetchedHints.Stored", 1), + 1); + } + + void TearDown() override { + // Make sure to reset the other feature list first, otherwise we hit a + // DCHECK where the feature lists aren't reset in the same order they are + // set up. + OptimizationGuideKeyedServiceCommandLineOverridesTest::TearDown(); + + feature_list_.Reset(); + } + + void TearDownOnMainThread() override { + EXPECT_TRUE(api_server_->ShutdownAndWaitUntilComplete()); + + OptimizationGuideKeyedServiceCommandLineOverridesTest:: + TearDownOnMainThread(); + } + + private: + std::unique_ptr<net::test_server::HttpResponse> HandleGetHintsRequest( + const net::test_server::HttpRequest& request) { + std::unique_ptr<net::test_server::BasicHttpResponse> response; + + response.reset(new net::test_server::BasicHttpResponse); + // If the request is a GET, it corresponds to a navigation so return a + // normal response. + EXPECT_EQ(request.method, net::test_server::METHOD_POST); + response->set_code(net::HTTP_OK); + + optimization_guide::proto::GetHintsResponse get_hints_response; + + optimization_guide::proto::Hint* hint = get_hints_response.add_hints(); + hint->set_key_representation(optimization_guide::proto::HOST_SUFFIX); + hint->set_key("somehost.com"); + optimization_guide::proto::PageHint* page_hint = hint->add_page_hints(); + page_hint->set_page_pattern("*"); + + std::string serialized_request; + get_hints_response.SerializeToString(&serialized_request); + response->set_content(serialized_request); + + return std::move(response); + } + + std::unique_ptr<net::EmbeddedTestServer> api_server_; + base::test::ScopedFeatureList feature_list_; + base::HistogramTester histogram_tester_; +}; + +// TODO(crbug/969558): Figure out why hints fetcher not fetching on ChromeOS. +#if defined(OS_CHROMEOS) +#define DISABLE_ON_CHROMEOS(x) DISABLED_##x +#else +#define DISABLE_ON_CHROMEOS(x) x +#endif + +IN_PROC_BROWSER_TEST_F(OptimizationGuideKeyedServiceHintsFetcherTest, + DISABLE_ON_CHROMEOS(ClearFetchedHints)) { + PushHintsComponentAndWaitForCompletion(); + + RegisterWithKeyedService(); + + // Prompt the loading of the hint that was just fetched. + { + base::HistogramTester histogram_tester; + ui_test_utils::NavigateToURL(browser(), url_with_hints()); + EXPECT_GE(RetryForHistogramUntilCountReached( + histogram_tester, "OptimizationGuide.LoadedHint.Result", 1), + 1); + histogram_tester.ExpectUniqueSample("OptimizationGuide.LoadedHint.Result", + true, 1); + + // Verifies that the fetched hint is loaded and not the component hint as + // fetched hints are prioritized. + histogram_tester.ExpectUniqueSample( + "OptimizationGuide.HintCache.HintType.Loaded", + static_cast<int>( + optimization_guide::HintCacheStore::StoreEntryType::kFetchedHint), + 1); + } + + // Wipe the browser history - clear all the fetched hints. + browser()->profile()->Wipe(); + // Run until idle so the hints have time to clear and the hint keys are + // repopulated. + base::RunLoop().RunUntilIdle(); + + // Try to load the same hint to confirm fetched hints are no longer there. + { + base::HistogramTester histogram_tester; + + ui_test_utils::NavigateToURL(browser(), url_with_hints()); + EXPECT_GE(RetryForHistogramUntilCountReached( + histogram_tester, "OptimizationGuide.LoadedHint.Result", 1), + 1); + histogram_tester.ExpectUniqueSample("OptimizationGuide.LoadedHint.Result", + true, 1); + + // Component Hint should be used instead. + histogram_tester.ExpectUniqueSample( + "OptimizationGuide.HintCache.HintType.Loaded", + static_cast<int>( + optimization_guide::HintCacheStore::StoreEntryType::kComponentHint), + 1); + } +}
diff --git a/chrome/browser/password_manager/password_store_signin_notifier_impl_unittest.cc b/chrome/browser/password_manager/password_store_signin_notifier_impl_unittest.cc index 8552ace..ad1200c 100644 --- a/chrome/browser/password_manager/password_store_signin_notifier_impl_unittest.cc +++ b/chrome/browser/password_manager/password_store_signin_notifier_impl_unittest.cc
@@ -36,7 +36,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; signin::IdentityTestEnvironment identity_test_env_; scoped_refptr<MockPasswordStore> store_; };
diff --git a/chrome/browser/password_manager/password_store_x_unittest.cc b/chrome/browser/password_manager/password_store_x_unittest.cc index 0a3555c..4506b1b3 100644 --- a/chrome/browser/password_manager/password_store_x_unittest.cc +++ b/chrome/browser/password_manager/password_store_x_unittest.cc
@@ -106,7 +106,7 @@ private: TestingPrefServiceSimple fake_pref_service_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; DISALLOW_COPY_AND_ASSIGN(PasswordStoreXTest);
diff --git a/chrome/browser/payments/has_enrolled_instrument_query_quota_browsertest.cc b/chrome/browser/payments/has_enrolled_instrument_query_quota_browsertest.cc new file mode 100644 index 0000000..b7a89e01 --- /dev/null +++ b/chrome/browser/payments/has_enrolled_instrument_query_quota_browsertest.cc
@@ -0,0 +1,88 @@ +// Copyright 2019 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 "base/command_line.h" +#include "base/macros.h" +#include "base/test/scoped_feature_list.h" +#include "build/build_config.h" +#include "chrome/test/base/chrome_test_utils.h" +#include "components/network_session_configurator/common/network_switches.h" +#include "components/payments/core/features.h" +#include "content/public/browser/web_contents.h" +#include "content/public/test/browser_test_utils.h" +#include "content/public/test/content_browser_test_utils.h" +#include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/embedded_test_server.h" +#include "testing/gtest/include/gtest/gtest.h" + +#if defined(OS_ANDROID) +#include "chrome/test/base/android/android_browser_test.h" +#else +#include "chrome/test/base/in_process_browser_test.h" +#endif + +namespace payments { +namespace { + +class HasEnrolledInstrumentQueryQuotaTest : public PlatformBrowserTest { + public: + HasEnrolledInstrumentQueryQuotaTest() + : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) {} + + ~HasEnrolledInstrumentQueryQuotaTest() override {} + + void SetUpCommandLine(base::CommandLine* command_line) override { + // HTTPS server only serves a valid cert for localhost, so this is needed to + // load pages from other hosts without an error. + command_line->AppendSwitch(switches::kIgnoreCertificateErrors); + } + + void SetUpOnMainThread() override { + host_resolver()->AddRule("*", "127.0.0.1"); + ASSERT_TRUE(https_server_.InitializeAndListen()); + content::SetupCrossSiteRedirector(&https_server_); + https_server_.ServeFilesFromSourceDirectory( + "components/test/data/payments"); + https_server_.StartAcceptingConnections(); + // Cannot use the default localhost hostname, because Chrome turns off the + // quota for localhost and file:/// scheme to ease web development. + ASSERT_TRUE(content::NavigateToURL( + GetActiveWebContents(), + https_server_.GetURL("a.com", "/has_enrolled_instrument.html"))); + PlatformBrowserTest::SetUpOnMainThread(); + } + + content::WebContents* GetActiveWebContents() { + return chrome_test_utils::GetActiveWebContents(this); + } + + private: + net::EmbeddedTestServer https_server_; + + DISALLOW_COPY_AND_ASSIGN(HasEnrolledInstrumentQueryQuotaTest); +}; + +IN_PROC_BROWSER_TEST_F(HasEnrolledInstrumentQueryQuotaTest, QueryQuota) { + // Payment options do not trigger query quota when the + // kStrictHasEnrolledAutofillInstrument feature is disabled. + EXPECT_EQ(false, + content::EvalJs(GetActiveWebContents(), "hasEnrolledInstrument()")); + EXPECT_EQ(false, + content::EvalJs(GetActiveWebContents(), + "hasEnrolledInstrument({requestShipping:true})")); + + base::test::ScopedFeatureList features; + features.InitAndEnableFeature(features::kStrictHasEnrolledAutofillInstrument); + + // Payment options trigger query quota for Basic Card when the + // kStrictHasEnrolledAutofillInstrument feature is enabled. + EXPECT_EQ(false, + content::EvalJs(GetActiveWebContents(), "hasEnrolledInstrument()")); + EXPECT_EQ("NotAllowedError: Exceeded query quota for hasEnrolledInstrument", + content::EvalJs(GetActiveWebContents(), + "hasEnrolledInstrument({requestShipping:true})")); +} + +} // namespace +} // namespace payments
diff --git a/chrome/browser/payments/payment_request_can_make_payment_browsertest.cc b/chrome/browser/payments/payment_request_can_make_payment_browsertest.cc index 06216bc..b8bf9c6 100644 --- a/chrome/browser/payments/payment_request_can_make_payment_browsertest.cc +++ b/chrome/browser/payments/payment_request_can_make_payment_browsertest.cc
@@ -29,7 +29,6 @@ #include "net/dns/mock_host_resolver.h" #if defined(OS_ANDROID) -#include "chrome/browser/android/background_task_scheduler/chrome_background_task_factory.h" #include "chrome/test/base/android/android_browser_test.h" #else #include "chrome/test/base/in_process_browser_test.h" @@ -77,10 +76,6 @@ autofill::PersonalDataManagerFactory::GetForProfile(profile); personal_data_manager->SetSyncServiceForTest(&sync_service_); -#if defined(OS_ANDROID) - ChromeBackgroundTaskFactory::SetAsDefault(); -#endif - payment_request_controller_.SetUpOnMainThread(); }
diff --git a/chrome/browser/performance_manager/graph/graph_test_harness.cc b/chrome/browser/performance_manager/graph/graph_test_harness.cc index 0b6db7c..b9ab3714 100644 --- a/chrome/browser/performance_manager/graph/graph_test_harness.cc +++ b/chrome/browser/performance_manager/graph/graph_test_harness.cc
@@ -10,9 +10,8 @@ namespace performance_manager { GraphTestHarness::GraphTestHarness() - : task_env_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} + : task_env_(base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} GraphTestHarness::~GraphTestHarness() = default;
diff --git a/chrome/browser/performance_manager/graph/graph_test_harness.h b/chrome/browser/performance_manager/graph/graph_test_harness.h index 8d36b05..5f19d692 100644 --- a/chrome/browser/performance_manager/graph/graph_test_harness.h +++ b/chrome/browser/performance_manager/graph/graph_test_harness.h
@@ -169,7 +169,7 @@ GraphTestHarness(); ~GraphTestHarness() override; - // Optional constructor for directly configuring the ScopedTaskEnvironment. + // Optional constructor for directly configuring the TaskEnvironment. template <class... ArgTypes> explicit GraphTestHarness(ArgTypes... args) : task_env_(args...) {} @@ -188,11 +188,11 @@ void TearDown() override; protected: - base::test::ScopedTaskEnvironment& task_env() { return task_env_; } + base::test::TaskEnvironment& task_env() { return task_env_; } GraphImpl* graph() { return &graph_; } private: - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; GraphImpl graph_; };
diff --git a/chrome/browser/performance_manager/graph/policies/working_set_trimmer_policy_chromeos_unittest.cc b/chrome/browser/performance_manager/graph/policies/working_set_trimmer_policy_chromeos_unittest.cc index d829c1c..6e68d77a 100644 --- a/chrome/browser/performance_manager/graph/policies/working_set_trimmer_policy_chromeos_unittest.cc +++ b/chrome/browser/performance_manager/graph/policies/working_set_trimmer_policy_chromeos_unittest.cc
@@ -53,8 +53,7 @@ class WorkingSetTrimmerPolicyChromeOSTest : public GraphTestHarness { public: WorkingSetTrimmerPolicyChromeOSTest() - : GraphTestHarness( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : GraphTestHarness(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~WorkingSetTrimmerPolicyChromeOSTest() override {} void SetUp() override {
diff --git a/chrome/browser/performance_manager/observers/isolation_context_metrics_unittest.cc b/chrome/browser/performance_manager/observers/isolation_context_metrics_unittest.cc index 0f229a0..09b2726 100644 --- a/chrome/browser/performance_manager/observers/isolation_context_metrics_unittest.cc +++ b/chrome/browser/performance_manager/observers/isolation_context_metrics_unittest.cc
@@ -51,8 +51,8 @@ public: IsolationContextMetricsTest() : GraphTestHarness( - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED, + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~IsolationContextMetricsTest() override = default;
diff --git a/chrome/browser/performance_manager/performance_manager_unittest.cc b/chrome/browser/performance_manager/performance_manager_unittest.cc index 334c003bb..d59b131 100644 --- a/chrome/browser/performance_manager/performance_manager_unittest.cc +++ b/chrome/browser/performance_manager/performance_manager_unittest.cc
@@ -48,7 +48,7 @@ private: std::unique_ptr<PerformanceManager> performance_manager_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(PerformanceManagerTest); };
diff --git a/chrome/browser/performance_manager/persistence/site_data/leveldb_site_data_store.h b/chrome/browser/performance_manager/persistence/site_data/leveldb_site_data_store.h index 0e00bfa..fb84041 100644 --- a/chrome/browser/performance_manager/persistence/site_data/leveldb_site_data_store.h +++ b/chrome/browser/performance_manager/persistence/site_data/leveldb_site_data_store.h
@@ -48,7 +48,7 @@ // Returns a raw pointer to the database for testing purposes. Note that as // the DB operations are made on a separate sequence it's recommended to call - // ScopedTaskEnvironment::RunUntilIdle before calling this function to ensure + // TaskEnvironment::RunUntilIdle before calling this function to ensure // that the database has been fully initialized. The LevelDB implementation is // thread safe. leveldb::DB* GetDBForTesting();
diff --git a/chrome/browser/performance_manager/persistence/site_data/leveldb_site_data_store_unittest.cc b/chrome/browser/performance_manager/persistence/site_data/leveldb_site_data_store_unittest.cc index 1ddb918..7fde667 100644 --- a/chrome/browser/performance_manager/persistence/site_data/leveldb_site_data_store_unittest.cc +++ b/chrome/browser/performance_manager/persistence/site_data/leveldb_site_data_store_unittest.cc
@@ -140,7 +140,7 @@ const url::Origin kDummyOrigin = url::Origin::Create(GURL("http://foo.com")); base::FilePath db_path_; - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; base::ScopedTempDir temp_dir_; std::unique_ptr<LevelDBSiteDataStore> db_; };
diff --git a/chrome/browser/performance_monitor/metric_evaluator_helper_win_unittest.cc b/chrome/browser/performance_monitor/metric_evaluator_helper_win_unittest.cc index 2b353dd..a75b383 100644 --- a/chrome/browser/performance_monitor/metric_evaluator_helper_win_unittest.cc +++ b/chrome/browser/performance_monitor/metric_evaluator_helper_win_unittest.cc
@@ -17,7 +17,7 @@ ~MetricEvaluatorsHelperWinTest() override = default; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MetricEvaluatorsHelperWin metric_evaluator_helper_; private: @@ -30,14 +30,14 @@ EXPECT_TRUE(value); EXPECT_GT(value.value(), 0); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // TODO(https://crbug.com/956638): Investigate why the initialization of WMI // might fail in some situations and reenable this test. TEST_F(MetricEvaluatorsHelperWinTest, DISABLED_DiskIdleTime) { while (!metric_evaluator_helper_.wmi_refresher_initialized_for_testing()) - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Measuring the disk idle time will always return base::nullopt for the first // sample on Windows.
diff --git a/chrome/browser/performance_monitor/system_monitor_unittest.cc b/chrome/browser/performance_monitor/system_monitor_unittest.cc index 2a6d9000..fa5f292 100644 --- a/chrome/browser/performance_monitor/system_monitor_unittest.cc +++ b/chrome/browser/performance_monitor/system_monitor_unittest.cc
@@ -63,8 +63,7 @@ using MetricMetadata = SystemMonitor::MetricMetadata; SystemMonitorTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void SetUp() override { EXPECT_EQ(nullptr, SystemMonitor::Get()); @@ -105,7 +104,7 @@ std::unique_ptr<SystemMonitor> system_monitor_; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(SystemMonitorTest); }; @@ -203,9 +202,9 @@ // Fast forward by enough time to get multiple samples and wait for the tasks // to complete. - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( 2 * system_monitor_->refresh_timer_for_testing().GetCurrentDelay()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ::testing::Mock::VerifyAndClear(&mock_observer_1); ::testing::Mock::VerifyAndClear(&mock_observer_2);
diff --git a/chrome/browser/performance_monitor/wmi_refresher_unittest.cc b/chrome/browser/performance_monitor/wmi_refresher_unittest.cc index 03274fe..7829f1d5 100644 --- a/chrome/browser/performance_monitor/wmi_refresher_unittest.cc +++ b/chrome/browser/performance_monitor/wmi_refresher_unittest.cc
@@ -29,7 +29,7 @@ // TODO(https://crbug.com/956638): Investigate why the initialization of WMI // might fail in some situations and reenable this test. TEST_F(WMIRefresherTest, DISABLED_EndToEnd) { - base::test::ScopedTaskEnvironment env; + base::test::TaskEnvironment env; PostTask(FROM_HERE, base::BindOnce([] { // The WMIRefresher objects have to live on a sequence with the // MayBlock trait.
diff --git a/chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc b/chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc index 9890e905..1d0f2b0 100644 --- a/chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc
@@ -202,7 +202,7 @@ // Returns the object id of the given policy object. const invalidation::ObjectId& GetPolicyObjectId(PolicyObject object) const; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Fake feature list with custom values. base::test::ScopedFeatureList feature_list_; @@ -240,7 +240,7 @@ : core_(dm_protocol::kChromeUserPolicyType, std::string(), &store_, - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), network::TestNetworkConnectionTracker::CreateGetter()), client_(nullptr), task_runner_(new base::TestSimpleTaskRunner()),
diff --git a/chrome/browser/policy/cloud/remote_commands_invalidator_unittest.cc b/chrome/browser/policy/cloud/remote_commands_invalidator_unittest.cc index e089a98..3378f52 100644 --- a/chrome/browser/policy/cloud/remote_commands_invalidator_unittest.cc +++ b/chrome/browser/policy/cloud/remote_commands_invalidator_unittest.cc
@@ -157,7 +157,7 @@ const bool is_fcm_enabled_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::test::ScopedFeatureList feature_list_;
diff --git a/chrome/browser/policy/policy_conversions.cc b/chrome/browser/policy/policy_conversions.cc index 335cc28..0a34214 100644 --- a/chrome/browser/policy/policy_conversions.cc +++ b/chrome/browser/policy/policy_conversions.cc
@@ -603,53 +603,4 @@ return chrome_policies_data; } -base::Value GetAllPolicyValuesAsArray(content::BrowserContext* context, - bool with_user_policies, - bool convert_values, - bool with_device_data, - bool is_pretty_print, - bool convert_types) { - return ArrayPolicyConversions() - .WithBrowserContext(context) - .EnableConvertTypes(convert_types) - .EnableConvertValues(convert_values) - .EnableDeviceLocalAccountPolicies(with_device_data) - .EnableDeviceInfo(false) - .EnablePrettyPrint(is_pretty_print) - .EnableUserPolicies(with_user_policies) - .ToValue(); -} - -base::Value GetAllPolicyValuesAsDictionary(content::BrowserContext* context, - bool with_user_policies, - bool convert_values, - bool with_device_data, - bool is_pretty_print, - bool convert_types) { - return DictionaryPolicyConversions() - .WithBrowserContext(context) - .EnableConvertTypes(convert_types) - .EnableConvertValues(convert_values) - .EnableDeviceLocalAccountPolicies(with_device_data) - .EnableDeviceInfo(with_device_data) - .EnablePrettyPrint(is_pretty_print) - .EnableUserPolicies(with_user_policies) - .ToValue(); -} - -std::string GetAllPolicyValuesAsJSON(content::BrowserContext* context, - bool with_user_policies, - bool with_device_data, - bool is_pretty_print) { - return DictionaryPolicyConversions() - .WithBrowserContext(context) - .EnableConvertTypes(true) - .EnableConvertValues(false) - .EnableDeviceLocalAccountPolicies(with_device_data) - .EnableDeviceInfo(with_device_data) - .EnablePrettyPrint(is_pretty_print) - .EnableUserPolicies(with_user_policies) - .ToJSON(); -} - } // namespace policy
diff --git a/chrome/browser/policy/policy_conversions.h b/chrome/browser/policy/policy_conversions.h index 23f2fb7..5acd25d 100644 --- a/chrome/browser/policy/policy_conversions.h +++ b/chrome/browser/policy/policy_conversions.h
@@ -160,46 +160,6 @@ DISALLOW_COPY_AND_ASSIGN(ArrayPolicyConversions); }; -// Returns an array with the values of all set policies, with some values -// converted to be shown in javascript, if it is specified. -// |with_user_policies| governs if values with POLICY_SCOPE_USER are included. -// |convert_types| governs if policy types are returned as string. -// DEPRECATED, use ArrayPolicyConversions::ToValue() instead. -base::Value GetAllPolicyValuesAsArray(content::BrowserContext* context, - bool with_user_policies, - bool convert_values, - bool with_device_data, - bool is_pretty_print, - bool convert_types); - -// Returns a dictionary with the values of all set policies, with some values -// converted to be shown in javascript, if it is specified. -// |with_user_policies| governs if values with POLICY_SCOPE_USER are included. -// |with_device_data| governs if device identity data (e.g. -// enrollment client ID) and device local accounts policies are included, -// it is used in logs uploads to the server. -// |is_pretty_print| governs if JSON policy value is pretty printed. -// |convert_types| governs if policy types are returned as string. -// DEPRECATED, use DictionaryPolicyConversions::ToValue() instead. -base::Value GetAllPolicyValuesAsDictionary(content::BrowserContext* context, - bool with_user_policies, - bool convert_values, - bool with_device_data, - bool is_pretty_print, - bool convert_types); - -// Returns a JSON with the values of all set policies. -// |with_user_policies| governs if values with POLICY_SCOPE_USER are included. -// |with_device_data| governs if device identity data (e.g. -// enrollment client ID) and device local accounts policies are included, -// it is used in logs uploads to the server. -// |is_pretty_print| governs if the output is formatted. -// DEPRECATED, use DictionaryPolicyConversions::ToJSON() instead. -std::string GetAllPolicyValuesAsJSON(content::BrowserContext* context, - bool with_user_policies, - bool with_device_data, - bool is_pretty_print); - } // namespace policy #endif // CHROME_BROWSER_POLICY_POLICY_CONVERSIONS_H_
diff --git a/chrome/browser/policy/profile_policy_connector_unittest.cc b/chrome/browser/policy/profile_policy_connector_unittest.cc index 8a098f10..efc7ae7 100644 --- a/chrome/browser/policy/profile_policy_connector_unittest.cc +++ b/chrome/browser/policy/profile_policy_connector_unittest.cc
@@ -53,7 +53,7 @@ .WillRepeatedly(Return(true)); cloud_policy_store_.NotifyStoreLoaded(); - const auto task_runner = scoped_task_environment_.GetMainThreadTaskRunner(); + const auto task_runner = task_environment_.GetMainThreadTaskRunner(); cloud_policy_manager_.reset(new CloudPolicyManager( std::string(), std::string(), &cloud_policy_store_, task_runner, network::TestNetworkConnectionTracker::CreateGetter())); @@ -73,7 +73,7 @@ } // Needs to be the first member. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; SchemaRegistry schema_registry_; MockConfigurationPolicyProvider mock_provider_; MockCloudPolicyStore cloud_policy_store_;
diff --git a/chrome/browser/prefs/chrome_command_line_pref_store_ssl_manager_unittest.cc b/chrome/browser/prefs/chrome_command_line_pref_store_ssl_manager_unittest.cc index 6434121..2a6e206 100644 --- a/chrome/browser/prefs/chrome_command_line_pref_store_ssl_manager_unittest.cc +++ b/chrome/browser/prefs/chrome_command_line_pref_store_ssl_manager_unittest.cc
@@ -22,7 +22,7 @@ CommandLinePrefStoreSSLManagerTest() {} protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Test that command-line settings for SSL versions are respected and that they
diff --git a/chrome/browser/prefs/profile_pref_store_manager_unittest.cc b/chrome/browser/prefs/profile_pref_store_manager_unittest.cc index 22c9ef9..9cac63b 100644 --- a/chrome/browser/prefs/profile_pref_store_manager_unittest.cc +++ b/chrome/browser/prefs/profile_pref_store_manager_unittest.cc
@@ -326,7 +326,7 @@ ADD_FAILURE() << "No validation observed for preference: " << pref_path; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::vector<prefs::mojom::TrackedPreferenceMetadataPtr> configuration_; base::ScopedTempDir profile_dir_; scoped_refptr<user_prefs::PrefRegistrySyncable> profile_pref_registry_;
diff --git a/chrome/browser/previews/previews_content_util_unittest.cc b/chrome/browser/previews/previews_content_util_unittest.cc index 51e1ac6..90c9b57 100644 --- a/chrome/browser/previews/previews_content_util_unittest.cc +++ b/chrome/browser/previews/previews_content_util_unittest.cc
@@ -126,7 +126,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; private: PreviewEnabledPreviewsDecider enabled_previews_decider_;
diff --git a/chrome/browser/previews/previews_lite_page_decider_unittest.cc b/chrome/browser/previews/previews_lite_page_decider_unittest.cc index 7dcd38d..9f9172ea 100644 --- a/chrome/browser/previews/previews_lite_page_decider_unittest.cc +++ b/chrome/browser/previews/previews_lite_page_decider_unittest.cc
@@ -32,11 +32,10 @@ class PreviewsLitePageDeciderTest : public testing::Test { protected: PreviewsLitePageDeciderTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(PreviewsLitePageDeciderTest, TestHostBypassBlacklist) {
diff --git a/chrome/browser/printing/cloud_print/privet_http_unittest.cc b/chrome/browser/printing/cloud_print/privet_http_unittest.cc index 2d64da9..df210fa 100644 --- a/chrome/browser/printing/cloud_print/privet_http_unittest.cc +++ b/chrome/browser/printing/cloud_print/privet_http_unittest.cc
@@ -353,7 +353,7 @@ const GURL kSubmitDocWithJobIDURL; const GURL kCreateJobURL; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::WeakWrapperSharedURLLoaderFactory> test_shared_url_loader_factory_;
diff --git a/chrome/browser/printing/cloud_print/privet_url_loader_unittest.cc b/chrome/browser/printing/cloud_print/privet_url_loader_unittest.cc index 3930625..4391e14 100644 --- a/chrome/browser/printing/cloud_print/privet_url_loader_unittest.cc +++ b/chrome/browser/printing/cloud_print/privet_url_loader_unittest.cc
@@ -100,12 +100,11 @@ class PrivetURLLoaderTest : public ::testing::Test { public: PrivetURLLoaderTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), test_shared_url_loader_factory_( base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( &test_url_loader_factory_)), - delegate_(scoped_task_environment_.GetMainThreadTaskRunner()) { + delegate_(task_environment_.GetMainThreadTaskRunner()) { privet_url_loader_ = std::make_unique<PrivetURLLoader>( GURL(kSamplePrivetURL), "POST", test_shared_url_loader_factory_, TRAFFIC_ANNOTATION_FOR_TESTS, &delegate_); @@ -126,7 +125,7 @@ test_url_loader_factory_.SetInterceptor(base::NullCallback()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::WeakWrapperSharedURLLoaderFactory> test_shared_url_loader_factory_;
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc index 046cb140..9707924 100644 --- a/chrome/browser/printing/print_view_manager_base.cc +++ b/chrome/browser/printing/print_view_manager_base.cc
@@ -279,6 +279,7 @@ const gfx::Size& page_size, const gfx::Rect& content_area, const gfx::Point& physical_offsets, + std::unique_ptr<DelayedFrameDispatchHelper> helper, mojom::PdfCompositor::Status status, base::ReadOnlySharedMemoryRegion region) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -296,11 +297,13 @@ return; PrintDocument(data, page_size, content_area, physical_offsets); + helper->SendCompleted(); } void PrintViewManagerBase::OnDidPrintDocument( content::RenderFrameHost* render_frame_host, - const PrintHostMsg_DidPrintDocument_Params& params) { + const PrintHostMsg_DidPrintDocument_Params& params, + std::unique_ptr<DelayedFrameDispatchHelper> helper) { if (!PrintJobHasDocument(params.document_cookie)) return; @@ -317,7 +320,8 @@ params.document_cookie, render_frame_host, content, base::BindOnce(&PrintViewManagerBase::OnComposePdfDone, weak_ptr_factory_.GetWeakPtr(), params.page_size, - params.content_area, params.physical_offsets)); + params.content_area, params.physical_offsets, + std::move(helper))); return; } auto data = base::RefCountedSharedMemoryMapping::CreateFromWholeRegion( @@ -330,6 +334,7 @@ PrintDocument(data, params.page_size, params.content_area, params.physical_offsets); + helper->SendCompleted(); } void PrintViewManagerBase::OnGetDefaultPrintSettings(
diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h index dd12f557..49d3f53 100644 --- a/chrome/browser/printing/print_view_manager_base.h +++ b/chrome/browser/printing/print_view_manager_base.h
@@ -105,7 +105,8 @@ void OnDidGetPrintedPagesCount(int cookie, int number_pages) override; void OnDidPrintDocument( content::RenderFrameHost* render_frame_host, - const PrintHostMsg_DidPrintDocument_Params& params) override; + const PrintHostMsg_DidPrintDocument_Params& params, + std::unique_ptr<DelayedFrameDispatchHelper> helper) override; void OnGetDefaultPrintSettings(content::RenderFrameHost* render_frame_host, IPC::Message* reply_msg) override; void OnPrintingFailed(int cookie) override; @@ -119,6 +120,7 @@ void OnComposePdfDone(const gfx::Size& page_size, const gfx::Rect& content_area, const gfx::Point& physical_offsets, + std::unique_ptr<DelayedFrameDispatchHelper> helper, mojom::PdfCompositor::Status status, base::ReadOnlySharedMemoryRegion region);
diff --git a/chrome/browser/profile_resetter/reset_report_uploader_unittest.cc b/chrome/browser/profile_resetter/reset_report_uploader_unittest.cc index e1c40a30..74d6a543 100644 --- a/chrome/browser/profile_resetter/reset_report_uploader_unittest.cc +++ b/chrome/browser/profile_resetter/reset_report_uploader_unittest.cc
@@ -34,7 +34,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; };
diff --git a/chrome/browser/profiles/profile_activity_metrics_recorder_unittest.cc b/chrome/browser/profiles/profile_activity_metrics_recorder_unittest.cc index 5f7940c..d2b7bb7 100644 --- a/chrome/browser/profiles/profile_activity_metrics_recorder_unittest.cc +++ b/chrome/browser/profiles/profile_activity_metrics_recorder_unittest.cc
@@ -30,8 +30,7 @@ class ProfileActivityMetricsRecorderTest : public testing::Test { public: ProfileActivityMetricsRecorderTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), profile_manager_(TestingBrowserProcess::GetGlobal()) { base::SetRecordActionTaskRunner(thread_bundle_.GetMainThreadTaskRunner()); }
diff --git a/chrome/browser/profiles/profile_downloader_unittest.cc b/chrome/browser/profiles/profile_downloader_unittest.cc index 14205d3..a5a0504 100644 --- a/chrome/browser/profiles/profile_downloader_unittest.cc +++ b/chrome/browser/profiles/profile_downloader_unittest.cc
@@ -87,7 +87,7 @@ on_access_token_request_callback_ = std::move(callback); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; signin::IdentityTestEnvironment identity_test_env_; ProfileDownloader profile_downloader_;
diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.cc b/chrome/browser/renderer_host/chrome_render_message_filter.cc index 7ec6253..d3aec50c 100644 --- a/chrome/browser/renderer_host/chrome_render_message_filter.cc +++ b/chrome/browser/renderer_host/chrome_render_message_filter.cc
@@ -37,6 +37,7 @@ #include "extensions/buildflags/buildflags.h" #include "net/base/network_isolation_key.h" #include "ppapi/buildflags/buildflags.h" +#include "url/origin.h" #if BUILDFLAG(ENABLE_EXTENSIONS) #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" @@ -203,45 +204,48 @@ void ChromeRenderMessageFilter::OnAllowDatabase( int render_frame_id, - const GURL& origin_url, - const GURL& top_origin_url, + const url::Origin& origin, + const GURL& site_for_cookies, + const url::Origin& top_frame_origin, bool* allowed) { - *allowed = - cookie_settings_->IsCookieAccessAllowed(origin_url, top_origin_url); + *allowed = cookie_settings_->IsCookieAccessAllowed( + origin.GetURL(), site_for_cookies, top_frame_origin); base::PostTask( FROM_HERE, {BrowserThread::UI}, base::BindOnce(&TabSpecificContentSettings::WebDatabaseAccessed, - render_process_id_, render_frame_id, origin_url, + render_process_id_, render_frame_id, origin.GetURL(), !*allowed)); } -void ChromeRenderMessageFilter::OnAllowDOMStorage(int render_frame_id, - const GURL& origin_url, - const GURL& top_origin_url, - bool local, - bool* allowed) { - *allowed = - cookie_settings_->IsCookieAccessAllowed(origin_url, top_origin_url); +void ChromeRenderMessageFilter::OnAllowDOMStorage( + int render_frame_id, + const url::Origin& origin, + const GURL& site_for_cookies, + const url::Origin& top_frame_origin, + bool local, + bool* allowed) { + GURL url = origin.GetURL(); + *allowed = cookie_settings_->IsCookieAccessAllowed(url, site_for_cookies, + top_frame_origin); // Record access to DOM storage for potential display in UI. base::PostTask(FROM_HERE, {BrowserThread::UI}, base::BindOnce(&OnDomStorageAccessedUI, render_process_id_, - render_frame_id, origin_url, top_origin_url, + render_frame_id, url, top_frame_origin.GetURL(), local, !*allowed)); } void ChromeRenderMessageFilter::OnRequestFileSystemAccessSync( int render_frame_id, - const GURL& origin_url, - const GURL& top_origin_url, + const url::Origin& origin, + const GURL& site_for_cookies, + const url::Origin& top_frame_origin, IPC::Message* reply_msg) { DCHECK_CURRENTLY_ON(BrowserThread::IO); base::Callback<void(bool)> callback = base::Bind( &ChromeRenderMessageFilter::OnRequestFileSystemAccessSyncResponse, base::WrapRefCounted(this), reply_msg); - OnRequestFileSystemAccess(render_frame_id, - origin_url, - top_origin_url, - callback); + OnRequestFileSystemAccess(render_frame_id, origin, site_for_cookies, + top_frame_origin, callback); } void ChromeRenderMessageFilter::OnRequestFileSystemAccessSyncResponse( @@ -255,16 +259,15 @@ void ChromeRenderMessageFilter::OnRequestFileSystemAccessAsync( int render_frame_id, int request_id, - const GURL& origin_url, - const GURL& top_origin_url) { + const url::Origin& origin, + const GURL& site_for_cookies, + const url::Origin& top_frame_origin) { DCHECK_CURRENTLY_ON(BrowserThread::IO); base::Callback<void(bool)> callback = base::Bind( &ChromeRenderMessageFilter::OnRequestFileSystemAccessAsyncResponse, base::WrapRefCounted(this), render_frame_id, request_id); - OnRequestFileSystemAccess(render_frame_id, - origin_url, - top_origin_url, - callback); + OnRequestFileSystemAccess(render_frame_id, origin, site_for_cookies, + top_frame_origin, callback); } void ChromeRenderMessageFilter::OnRequestFileSystemAccessAsyncResponse( @@ -277,13 +280,14 @@ void ChromeRenderMessageFilter::OnRequestFileSystemAccess( int render_frame_id, - const GURL& origin_url, - const GURL& top_origin_url, + const url::Origin& origin, + const GURL& site_for_cookies, + const url::Origin& top_frame_origin, base::Callback<void(bool)> callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - bool allowed = - cookie_settings_->IsCookieAccessAllowed(origin_url, top_origin_url); + bool allowed = cookie_settings_->IsCookieAccessAllowed( + origin.GetURL(), site_for_cookies, top_frame_origin); #if BUILDFLAG(ENABLE_EXTENSIONS) bool is_web_view_guest = extensions::WebViewRendererState::GetInstance() @@ -293,8 +297,8 @@ base::PostTask( FROM_HERE, {BrowserThread::UI}, base::BindOnce(&ChromeRenderMessageFilter::FileSystemAccessedOnUIThread, - render_process_id_, render_frame_id, origin_url, allowed, - callback)); + render_process_id_, render_frame_id, origin.GetURL(), + allowed, callback)); return; } #endif @@ -302,8 +306,8 @@ // Record access to file system for potential display in UI. base::PostTask(FROM_HERE, {BrowserThread::UI}, base::BindOnce(&TabSpecificContentSettings::FileSystemAccessed, - render_process_id_, render_frame_id, origin_url, - !allowed)); + render_process_id_, render_frame_id, + origin.GetURL(), !allowed)); } #if BUILDFLAG(ENABLE_EXTENSIONS) @@ -339,29 +343,33 @@ } #endif -void ChromeRenderMessageFilter::OnAllowIndexedDB(int render_frame_id, - const GURL& origin_url, - const GURL& top_origin_url, - bool* allowed) { - *allowed = - cookie_settings_->IsCookieAccessAllowed(origin_url, top_origin_url); +void ChromeRenderMessageFilter::OnAllowIndexedDB( + int render_frame_id, + const url::Origin& origin, + const GURL& site_for_cookies, + const url::Origin& top_frame_origin, + bool* allowed) { + *allowed = cookie_settings_->IsCookieAccessAllowed( + origin.GetURL(), site_for_cookies, top_frame_origin); base::PostTask(FROM_HERE, {BrowserThread::UI}, base::BindOnce(&TabSpecificContentSettings::IndexedDBAccessed, - render_process_id_, render_frame_id, origin_url, - !*allowed)); + render_process_id_, render_frame_id, + origin.GetURL(), !*allowed)); } -void ChromeRenderMessageFilter::OnAllowCacheStorage(int render_frame_id, - const GURL& origin_url, - const GURL& top_origin_url, - bool* allowed) { - *allowed = - cookie_settings_->IsCookieAccessAllowed(origin_url, top_origin_url); +void ChromeRenderMessageFilter::OnAllowCacheStorage( + int render_frame_id, + const url::Origin& origin, + const GURL& site_for_cookies, + const url::Origin& top_frame_origin, + bool* allowed) { + GURL url = origin.GetURL(); + *allowed = cookie_settings_->IsCookieAccessAllowed(url, site_for_cookies, + top_frame_origin); base::PostTask( FROM_HERE, {BrowserThread::UI}, base::BindOnce(&TabSpecificContentSettings::CacheStorageAccessed, - render_process_id_, render_frame_id, origin_url, - !*allowed)); + render_process_id_, render_frame_id, url, !*allowed)); } #if BUILDFLAG(ENABLE_PLUGINS)
diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.h b/chrome/browser/renderer_host/chrome_render_message_filter.h index a55fed3..bc8a292 100644 --- a/chrome/browser/renderer_host/chrome_render_message_filter.h +++ b/chrome/browser/renderer_host/chrome_render_message_filter.h
@@ -19,6 +19,10 @@ class GURL; class Profile; +namespace url { +class Origin; +} + namespace predictors { class PreconnectManager; } @@ -55,30 +59,35 @@ int count); void OnAllowDatabase(int render_frame_id, - const GURL& origin_url, - const GURL& top_origin_url, + const url::Origin& origin, + const GURL& site_for_cookies, + const url::Origin& top_frame_origin, bool* allowed); void OnAllowDOMStorage(int render_frame_id, - const GURL& origin_url, - const GURL& top_origin_url, + const url::Origin& origin, + const GURL& site_for_cookies, + const url::Origin& top_frame_origin, bool local, bool* allowed); void OnRequestFileSystemAccessSync(int render_frame_id, - const GURL& origin_url, - const GURL& top_origin_url, + const url::Origin& origin, + const GURL& site_for_cookies, + const url::Origin& top_frame_origin, IPC::Message* message); void OnRequestFileSystemAccessAsync(int render_frame_id, int request_id, - const GURL& origin_url, - const GURL& top_origin_url); + const url::Origin& origin, + const GURL& site_for_cookies, + const url::Origin& top_frame_origin); void OnRequestFileSystemAccessSyncResponse(IPC::Message* reply_msg, bool allowed); void OnRequestFileSystemAccessAsyncResponse(int render_frame_id, int request_id, bool allowed); void OnRequestFileSystemAccess(int render_frame_id, - const GURL& origin_url, - const GURL& top_origin_url, + const url::Origin& origin, + const GURL& site_for_cookies, + const url::Origin& top_frame_origin, base::Callback<void(bool)> callback); #if BUILDFLAG(ENABLE_EXTENSIONS) static void FileSystemAccessedOnUIThread(int render_process_id, @@ -93,12 +102,14 @@ bool allowed); #endif void OnAllowIndexedDB(int render_frame_id, - const GURL& origin_url, - const GURL& top_origin_url, + const url::Origin& origin, + const GURL& site_for_cookies, + const url::Origin& top_frame_origin, bool* allowed); void OnAllowCacheStorage(int render_frame_id, - const GURL& origin_url, - const GURL& top_origin_url, + const url::Origin& origin, + const GURL& site_for_cookies, + const url::Origin& top_frame_origin, bool* allowed); #if BUILDFLAG(ENABLE_PLUGINS) void OnIsCrashReportingEnabled(bool* enabled);
diff --git a/chrome/browser/resource_coordinator/intervention_policy_database_unittest.cc b/chrome/browser/resource_coordinator/intervention_policy_database_unittest.cc index 4de7d63..50b16a4 100644 --- a/chrome/browser/resource_coordinator/intervention_policy_database_unittest.cc +++ b/chrome/browser/resource_coordinator/intervention_policy_database_unittest.cc
@@ -64,7 +64,7 @@ } private: - base::test::ScopedTaskEnvironment test_env_; + base::test::TaskEnvironment test_env_; InterventionPolicyDatabase intervention_policy_database_; };
diff --git a/chrome/browser/resource_coordinator/leveldb_site_characteristics_database.h b/chrome/browser/resource_coordinator/leveldb_site_characteristics_database.h index c8a6a13..092c4ef 100644 --- a/chrome/browser/resource_coordinator/leveldb_site_characteristics_database.h +++ b/chrome/browser/resource_coordinator/leveldb_site_characteristics_database.h
@@ -48,7 +48,7 @@ // Returns a raw pointer to the database for testing purposes. Note that as // the DB operations are made on a separate sequence it's recommended to call - // ScopedTaskEnvironment::RunUntilIdle before calling this function to ensure + // TaskEnvironment::RunUntilIdle before calling this function to ensure // that the database has been fully initialized. The LevelDB implementation is // thread safe. leveldb::DB* GetDBForTesting();
diff --git a/chrome/browser/resource_coordinator/leveldb_site_characteristics_database_unittest.cc b/chrome/browser/resource_coordinator/leveldb_site_characteristics_database_unittest.cc index a57254e..3e44bd3 100644 --- a/chrome/browser/resource_coordinator/leveldb_site_characteristics_database_unittest.cc +++ b/chrome/browser/resource_coordinator/leveldb_site_characteristics_database_unittest.cc
@@ -143,7 +143,7 @@ const url::Origin kDummyOrigin = url::Origin::Create(GURL("http://foo.com")); base::FilePath db_path_; - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; base::ScopedTempDir temp_dir_; std::unique_ptr<LevelDBSiteCharacteristicsDatabase> db_; };
diff --git a/chrome/browser/resource_coordinator/tab_metrics_logger_unittest.cc b/chrome/browser/resource_coordinator/tab_metrics_logger_unittest.cc index 6c7b791..529bb67 100644 --- a/chrome/browser/resource_coordinator/tab_metrics_logger_unittest.cc +++ b/chrome/browser/resource_coordinator/tab_metrics_logger_unittest.cc
@@ -183,15 +183,8 @@ } }; -// TODO(crbug.com/949288, crbug.com/950244): All tests are flaky on ChromeOS -#if defined(OS_CHROMEOS) -#define MAYBE_(test) DISABLED_##test -#else -#define MAYBE_(test) test -#endif - // Tests has_form_entry. -TEST_F(TabMetricsLoggerTest, MAYBE_(MAYBE_GetHasFormEntry)) { +TEST_F(TabMetricsLoggerTest, MAYBE_GetHasFormEntry) { EXPECT_FALSE(CurrentTabFeatures().has_form_entry); content::PageImportanceSignals signal; signal.had_form_interaction = true; @@ -200,14 +193,14 @@ } // Tests is_pinned. -TEST_F(TabMetricsLoggerTest, MAYBE_(MAYBE_GetPinState)) { +TEST_F(TabMetricsLoggerTest, MAYBE_GetPinState) { EXPECT_FALSE(CurrentTabFeatures().is_pinned); tab_strip_model_->SetTabPinned(0, true); EXPECT_TRUE(CurrentTabFeatures().is_pinned); } // Tests navigation_entry_count. -TEST_F(TabMetricsLoggerTest, MAYBE_(MAYBE_GetNavigationEntryCount)) { +TEST_F(TabMetricsLoggerTest, MAYBE_GetNavigationEntryCount) { EXPECT_EQ(CurrentTabFeatures().navigation_entry_count, 1); tab_activity_simulator_.Navigate(web_contents_, GURL(kExampleUrl), pg_metrics_.page_transition); @@ -218,7 +211,7 @@ } // Tests site_engagement_score. -TEST_F(TabMetricsLoggerTest, MAYBE_(MAYBE_GetSiteEngagementScore)) { +TEST_F(TabMetricsLoggerTest, MAYBE_GetSiteEngagementScore) { EXPECT_EQ(CurrentTabFeatures().site_engagement_score, 0); SiteEngagementService::Get(profile())->ResetBaseScoreForURL( GURL(kChromiumUrl), 91); @@ -226,20 +219,20 @@ } // Tests was_recently_audible. -TEST_F(TabMetricsLoggerTest, MAYBE_(MAYBE_GetAudibleState)) { +TEST_F(TabMetricsLoggerTest, MAYBE_GetAudibleState) { EXPECT_FALSE(CurrentTabFeatures().was_recently_audible); web_contents_tester_->SetIsCurrentlyAudible(true); EXPECT_TRUE(CurrentTabFeatures().was_recently_audible); } // Tests host. -TEST_F(TabMetricsLoggerTest, MAYBE_(MAYBE_GetHost)) { +TEST_F(TabMetricsLoggerTest, MAYBE_GetHost) { EXPECT_EQ(CurrentTabFeatures().host, kChromiumDomain); } // Tests creating a flat TabFeatures structure for logging a tab and its // TabMetrics state. -TEST_F(TabMetricsLoggerTest, MAYBE_(MAYBE_GetTabFeatures)) { +TEST_F(TabMetricsLoggerTest, MAYBE_GetTabFeatures) { TabActivitySimulator tab_activity_simulator; Browser::CreateParams params(profile(), true); std::unique_ptr<Browser> browser = @@ -354,7 +347,7 @@ private: // Sets up the task scheduling/task-runner environment for each test. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Sets itself as the global UkmRecorder on construction. ukm::TestAutoSetUkmRecorder test_ukm_recorder_; // The object being tested:
diff --git a/chrome/browser/resource_coordinator/tab_ranker/tab_features_unittest.cc b/chrome/browser/resource_coordinator/tab_ranker/tab_features_unittest.cc index da9c79fcd..42be2615 100644 --- a/chrome/browser/resource_coordinator/tab_ranker/tab_features_unittest.cc +++ b/chrome/browser/resource_coordinator/tab_ranker/tab_features_unittest.cc
@@ -99,7 +99,7 @@ // correctly. TEST(TabFeaturesTest, PopulateTabFeaturesToUkmEntry) { // Sets up the task scheduling/task-runner environment for each test. - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Sets itself as the global UkmRecorder on construction. ukm::TestAutoSetUkmRecorder test_ukm_recorder;
diff --git a/chrome/browser/resource_coordinator/usage_clock_unittest.cc b/chrome/browser/resource_coordinator/usage_clock_unittest.cc index 3b777e29..b106950 100644 --- a/chrome/browser/resource_coordinator/usage_clock_unittest.cc +++ b/chrome/browser/resource_coordinator/usage_clock_unittest.cc
@@ -14,7 +14,7 @@ TEST(ResourceCoordinatorUsageClock, UsageClock) { // Required to use DesktopSessionDurationTracker. - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; { base::SimpleTestTickClock clock;
diff --git a/chrome/browser/resources/BUILD.gn b/chrome/browser/resources/BUILD.gn index d1b6a8b..e3691e7 100644 --- a/chrome/browser/resources/BUILD.gn +++ b/chrome/browser/resources/BUILD.gn
@@ -3,6 +3,7 @@ # found in the LICENSE file. import("//chrome/common/features.gni") +import("//chrome/test/base/js2gtest.gni") import("//tools/grit/grit_rule.gni") assert(!is_ios, "Chromium/iOS shouldn't use anything in //chrome") @@ -327,3 +328,28 @@ ] } } + +js2gtest("resources_unitjs_tests") { + test_type = "webui" + sources = [ + "gaia_auth_host/password_change_authenticator_test.unitjs", + ] + + # This has to be a gen_include, so it doesn't collide with other js2gtests + gen_include_files = [ "//ui/webui/resources/js/cr.js" ] + + # But these have to be extra_js_files, since it uses a native object + # EventTarget, which doesn't work at compile time. + extra_js_files = [ + "//ui/webui/resources/js/cr/event_target.js", + "gaia_auth_host/password_change_authenticator.js", + ] + defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] +} + +source_set("browser_tests") { + testonly = true + deps = [ + ":resources_unitjs_tests", + ] +}
diff --git a/chrome/browser/resources/gaia_auth_host/password_change_authenticator.js b/chrome/browser/resources/gaia_auth_host/password_change_authenticator.js index 0f5fa46..4aa27d7 100644 --- a/chrome/browser/resources/gaia_auth_host/password_change_authenticator.js +++ b/chrome/browser/resources/gaia_auth_host/password_change_authenticator.js
@@ -15,6 +15,54 @@ const BLANK_PAGE_URL = 'about:blank'; /** + * @param {string?} str A string that should be a valid URL. + * @return {URL?} A valid URL object, or null. + */ + function safeParseUrl_(str) { + try { + return new URL(str); + } catch (error) { + console.error('Invalid url: ' + str); + return null; + } + } + + /** + * @param {Object} details The web-request details. + * @return {boolean} True if we detect that a password change was successful. + */ + function detectPasswordChangeSuccess(details) { + const url = safeParseUrl_(details.url); + if (!url) { + return false; + } + + // These heuristics work for the following SAML IdPs: + // ADFS: + if (url.pathname.match(/\/updatepassword\/?$/)) { + return url.searchParams.get('status') == '0'; + } + // Azure: + if (url.pathname.endsWith('/ChangePassword.aspx')) { + return url.searchParams.get('ReturnCode') == '0'; + } + // Okta: + if (url.pathname.match(/\/internal_login\/password\/?$/)) { + // TODO(https://crbug.com/930109): This assumes all Okta password change + // attempts succeed. To check properly, we need to inspect the response. + return details.method == 'POST'; + } + // Ping: + if (url.pathname.includes('/password/chg/')) { + // TODO(https://crbug.com/930109): This assumes all Ping password change + // attempts succeed. To check properly, we need to inspect the response. + return details.method == 'POST'; + } + + return false; + } + + /** * Initializes the authenticator component. */ class Authenticator extends cr.EventTarget { @@ -67,8 +115,9 @@ this.samlHandler_, 'authPageLoaded', this.onAuthPageLoaded_.bind(this)); - this.webviewEventManager_.addEventListener( - this.webview_, 'contentload', this.onContentLoad_.bind(this)); + this.webviewEventManager_.addWebRequestEventListener( + this.webview_.request.onCompleted, this.onCompleted_.bind(this), + {urls: ['http://*/*', 'https://*/*'], types: ['main_frame']}); } /** @@ -151,17 +200,19 @@ } /** - * Invoked when a new document is loaded. + * Invoked when a new document loading completes. + * @param {Object} details The web-request details. * @private */ - onContentLoad_(e) { - const currentUrl = this.webview_.src; - // TODO(rsorokin): Implement more robust check. - if (currentUrl.lastIndexOf('status=0') != -1) { + onCompleted_(details) { + if (passwordChangeSuccessDetected(details)) { this.completeAuth_(); } } } - return {Authenticator: Authenticator}; + return { + Authenticator: Authenticator, + detectPasswordChangeSuccess: detectPasswordChangeSuccess, + }; });
diff --git a/chrome/browser/resources/gaia_auth_host/password_change_authenticator_test.unitjs b/chrome/browser/resources/gaia_auth_host/password_change_authenticator_test.unitjs new file mode 100644 index 0000000..b8dd250 --- /dev/null +++ b/chrome/browser/resources/gaia_auth_host/password_change_authenticator_test.unitjs
@@ -0,0 +1,102 @@ +// Copyright 2019 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. + +GEN_INCLUDE(['//ui/webui/resources/js/cr.js']); + +const EXAMPLE_ADFS_ENDPOINT = + 'https://example.com/adfs/portal/updatepassword/'; + +const EXAMPLE_AZURE_ENDPOINT = + 'https://example.windowsazure.com/ChangePassword.aspx'; + +const EXAMPLE_OKTA_ENDPOINT = + 'https://example.okta.com/user/profile/internal_login/password'; + +const EXAMPLE_PING_ENDPOINT = + 'https://login.pingone.com/idp/directory/a/12345/password/chg/67890'; + +PasswordChangeAuthenticatorUnitTest = class extends testing.Test { + get browsePreload() { + return DUMMY_URL; + } + + // No need to run these checks - see comment in SamlPasswordAttributesTest. + get runAccessibilityChecks() { + return false; + } + + get extraLibraries() { + return [ + '//ui/webui/resources/js/cr/event_target.js', + 'password_change_authenticator.js', + ]; + } + + assertSuccess(input) { + assertTrue(this.detectSuccess(input)); + } + + assertNotSuccess(input) { + assertFalse(this.detectSuccess(input)); + } + + detectSuccess(input) { + let details; + if (typeof input == 'string') { + details = {'url': input}; + } else { + details = input; + } + return cr.samlPasswordChange.detectPasswordChangeSuccess(details); + } +} + +TEST_F('PasswordChangeAuthenticatorUnitTest', 'DetectAdfsSuccess', function() { + const endpointUrl = EXAMPLE_ADFS_ENDPOINT; + + this.assertNotSuccess(endpointUrl); + this.assertNotSuccess(endpointUrl + '?status=1'); + this.assertNotSuccess(EXAMPLE_AZURE_ENDPOINT + '?status=0'); + + this.assertSuccess(endpointUrl + '?status=0'); +}); + +TEST_F('PasswordChangeAuthenticatorUnitTest', 'DetectAzureSuccess', function() { + const endpointUrl = EXAMPLE_AZURE_ENDPOINT; + const extraParam = 'BrandContextID=O123'; + + this.assertNotSuccess(endpointUrl); + this.assertNotSuccess(endpointUrl + '?' + extraParam); + this.assertNotSuccess(endpointUrl + '?ReturnCode=1&' + extraParam); + this.assertNotSuccess(endpointUrl + '?' + extraParam + '&ReturnCode=1'); + this.assertNotSuccess(EXAMPLE_PING_ENDPOINT + '?ReturnCode=0'); + + this.assertSuccess(endpointUrl + '?ReturnCode=0&' + extraParam); + this.assertSuccess(endpointUrl + '?' + extraParam + '&ReturnCode=0'); +}); + +TEST_F('PasswordChangeAuthenticatorUnitTest', 'DetectOktaSuccess', function() { + const endpointUrl = EXAMPLE_OKTA_ENDPOINT + + let details = {url: endpointUrl, method: 'GET'}; + this.assertNotSuccess(details); + + details = {url: EXAMPLE_ADFS_ENDPOINT, method: 'POST'}; + this.assertNotSuccess(details); + + details = {url: endpointUrl, method: 'POST'}; + this.assertSuccess(details); +}); + +TEST_F('PasswordChangeAuthenticatorUnitTest', 'DetectPingSuccess', function() { + const endpointUrl = EXAMPLE_PING_ENDPOINT; + + let details = {url: endpointUrl, method: 'GET'}; + this.assertNotSuccess(details); + details = {url: EXAMPLE_AZURE_ENDPOINT, method: 'POST'}; + this.assertNotSuccess(details); + + details = {url: endpointUrl, method: 'POST'}; + this.assertSuccess(details); +});
diff --git a/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.html b/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.html index 793770fd..dfe3e958 100644 --- a/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.html +++ b/chrome/browser/resources/settings/printing_page/cups_edit_printer_dialog.html
@@ -101,42 +101,45 @@ value="[[getPrinterURI_(pendingPrinter_)]]"> </cr-input> </div> - <div class="settings-box two-line"> - <cr-searchable-drop-down items="[[manufacturerList]]" - id="printerPPDManufacturer" - label="$i18n{printerManufacturer}" - value="{{pendingPrinter_.ppdManufacturer}}" - readonly="[[!isOnline_]]"> - </cr-searchable-drop-down> - </div> - <div class="settings-box two-line"> - <cr-searchable-drop-down items="[[modelList]]" - id="printerPPDModel" - label="$i18n{printerModel}" - value="{{pendingPrinter_.ppdModel}}" - readonly="[[!isOnline_]]"> - </cr-searchable-drop-down> - </div> - <div id="ppdLabel" class="cr-form-field-label"> - <span>$i18n{selectDriver}</span> - <a href="$i18n{printingCUPSPrintPpdLearnMoreUrl}" target="_blank"> - $i18n{learnMore} - </a> - </div> - <div class="settings-box two-line"> - <cr-input class="browse-file-input" readonly tabindex="-1" - value="[[userPPD_]]" aria-labelledby="ppdLabel" - error-message="$i18n{selectDriverErrorMessage}" - invalid="[[invalidPPD_]]"> - </cr-input> - <cr-button class="browse-button" on-click="onBrowseFile_" - disabled="[[!isOnline_]]"> - $i18n{selectDriverButtonText} - </cr-button> - </div> - <div class="eula" id="eulaUrl" hidden="[[!eulaUrl_]]"> - <a href="[[eulaUrl_]]" target="_blank">$i18n{printerEulaNotice}</a> - </div> + <template id="makeAndModelSection" is="dom-if" + if="[[!isAutoconfPrinter_(pendingPrinter_.*)]]"> + <div class="settings-box two-line"> + <cr-searchable-drop-down items="[[manufacturerList]]" + id="printerPPDManufacturer" + label="$i18n{printerManufacturer}" + value="{{pendingPrinter_.ppdManufacturer}}" + readonly="[[!isOnline_]]"> + </cr-searchable-drop-down> + </div> + <div class="settings-box two-line"> + <cr-searchable-drop-down items="[[modelList]]" + id="printerPPDModel" + label="$i18n{printerModel}" + value="{{pendingPrinter_.ppdModel}}" + readonly="[[!isOnline_]]"> + </cr-searchable-drop-down> + </div> + <div id="ppdLabel" class="cr-form-field-label"> + <span>$i18n{selectDriver}</span> + <a href="$i18n{printingCUPSPrintPpdLearnMoreUrl}" target="_blank"> + $i18n{learnMore} + </a> + </div> + <div class="settings-box two-line"> + <cr-input class="browse-file-input" readonly tabindex="-1" + value="[[userPPD_]]" aria-labelledby="ppdLabel" + error-message="$i18n{selectDriverErrorMessage}" + invalid="[[invalidPPD_]]"> + </cr-input> + <cr-button class="browse-button" on-click="onBrowseFile_" + disabled="[[!isOnline_]]"> + $i18n{selectDriverButtonText} + </cr-button> + </div> + <div class="eula" id="eulaUrl" hidden="[[!eulaUrl_]]"> + <a href="[[eulaUrl_]]" target="_blank">$i18n{printerEulaNotice}</a> + </div> + </template> </div> <div slot="dialog-buttons"> <cr-button class="cancel-button" on-click="onCancelTap_">
diff --git a/chrome/browser/rlz/chrome_rlz_tracker_delegate_unittest.cc b/chrome/browser/rlz/chrome_rlz_tracker_delegate_unittest.cc index f4e2b929..802a1d3 100644 --- a/chrome/browser/rlz/chrome_rlz_tracker_delegate_unittest.cc +++ b/chrome/browser/rlz/chrome_rlz_tracker_delegate_unittest.cc
@@ -30,7 +30,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<ChromeRLZTrackerDelegate> delegate_; };
diff --git a/chrome/browser/safe_browsing/advanced_protection_status_manager_unittest.cc b/chrome/browser/safe_browsing/advanced_protection_status_manager_unittest.cc index 2959014..0f72effe 100644 --- a/chrome/browser/safe_browsing/advanced_protection_status_manager_unittest.cc +++ b/chrome/browser/safe_browsing/advanced_protection_status_manager_unittest.cc
@@ -41,7 +41,7 @@ TestWithPrefService() { RegisterProfilePrefs(pref_service_.registry()); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; sync_preferences::TestingPrefServiceSyncable pref_service_; };
diff --git a/chrome/browser/safe_browsing/certificate_reporting_service_unittest.cc b/chrome/browser/safe_browsing/certificate_reporting_service_unittest.cc index 9bbbf3d..97678ca 100644 --- a/chrome/browser/safe_browsing/certificate_reporting_service_unittest.cc +++ b/chrome/browser/safe_browsing/certificate_reporting_service_unittest.cc
@@ -196,8 +196,8 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_;
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win_unittest.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win_unittest.cc index dcde1b4b..64482fa 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win_unittest.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win_unittest.cc
@@ -29,8 +29,7 @@ class ChromeCleanerFetcherTest : public ::testing::Test { public: ChromeCleanerFetcherTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} void TearDown() override { if (!downloaded_path_.empty()) { @@ -56,7 +55,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; base::RunLoop run_loop_;
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win_unittest.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win_unittest.cc index 62b9d05..be96802 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win_unittest.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win_unittest.cc
@@ -273,7 +273,7 @@ return base::win::ScopedHandle(duplicate_handle); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop run_loop_; ChromePromptChannelPtr channel_ = ChromePromptChannelPtr(nullptr, base::OnTaskRunnerDeleter(nullptr));
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.cc index bc983297..f5379edb 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.cc
@@ -619,7 +619,7 @@ if (options_.crash_point() == CrashPoint::kAfterConnection) exit(kDeliberateCrashExitCode); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; // After the response from the parent process is received, this will post a // task to unblock the child process's main thread.
diff --git a/chrome/browser/safe_browsing/download_protection/multipart_uploader.cc b/chrome/browser/safe_browsing/download_protection/multipart_uploader.cc index 228afc8..b829e0234 100644 --- a/chrome/browser/safe_browsing/download_protection/multipart_uploader.cc +++ b/chrome/browser/safe_browsing/download_protection/multipart_uploader.cc
@@ -126,9 +126,6 @@ } // static -MultipartUploadRequestFactory* MultipartUploadRequest::factory_ = nullptr; - -// static std::unique_ptr<MultipartUploadRequest> MultipartUploadRequest::Create( scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, const GURL& base_url, @@ -136,14 +133,9 @@ const std::string& data, const net::NetworkTrafficAnnotationTag& traffic_annotation, MultipartUploadRequest::Callback callback) { - if (!factory_) { - return std::make_unique<MultipartUploadRequest>( - url_loader_factory, base_url, metadata, data, traffic_annotation, - std::move(callback)); - } - - return factory_->Create(url_loader_factory, base_url, metadata, data, - traffic_annotation, std::move(callback)); + return std::make_unique<MultipartUploadRequest>( + url_loader_factory, base_url, metadata, data, traffic_annotation, + std::move(callback)); } } // namespace safe_browsing
diff --git a/chrome/browser/safe_browsing/download_protection/multipart_uploader.h b/chrome/browser/safe_browsing/download_protection/multipart_uploader.h index 97a981c..1e79a9e 100644 --- a/chrome/browser/safe_browsing/download_protection/multipart_uploader.h +++ b/chrome/browser/safe_browsing/download_protection/multipart_uploader.h
@@ -23,8 +23,6 @@ namespace safe_browsing { -class MultipartUploadRequestFactory; - // This class encapsulates the upload of a file with metadata using the // multipart protocol. This class is neither movable nor copyable. class MultipartUploadRequest { @@ -52,12 +50,6 @@ // will call |callback_| on the UI thread. virtual void Start(); - // Makes the passed |factory| the factory used to instantiate a - // MultipartUploadRequest. Useful for tests. - static void RegisterFactoryForTests(MultipartUploadRequestFactory* factory) { - factory_ = factory; - } - static std::unique_ptr<MultipartUploadRequest> Create( scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, const GURL& base_url, @@ -88,8 +80,6 @@ // Called to send a single request. Is overridden in tests. virtual void SendRequest(); - static MultipartUploadRequestFactory* factory_; - GURL base_url_; std::string metadata_; std::string data_; @@ -106,18 +96,6 @@ base::WeakPtrFactory<MultipartUploadRequest> weak_factory_; }; -class MultipartUploadRequestFactory { - public: - virtual ~MultipartUploadRequestFactory(); - virtual std::unique_ptr<MultipartUploadRequest> Create( - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - const GURL& base_url, - const std::string& metadata, - const std::string& data, - const net::NetworkTrafficAnnotationTag& traffic_annotation, - MultipartUploadRequest::Callback callback) = 0; -}; - } // namespace safe_browsing #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_MULTIPART_UPLOADER_H_
diff --git a/chrome/browser/safe_browsing/download_protection/multipart_uploader_unittest.cc b/chrome/browser/safe_browsing/download_protection/multipart_uploader_unittest.cc index 741241b5..32f1258 100644 --- a/chrome/browser/safe_browsing/download_protection/multipart_uploader_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection/multipart_uploader_unittest.cc
@@ -21,8 +21,7 @@ class MultipartUploadRequestTest : public testing::Test { public: MultipartUploadRequestTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} protected: content::TestBrowserThreadBundle thread_bundle_;
diff --git a/chrome/browser/search/one_google_bar/one_google_bar_service_unittest.cc b/chrome/browser/search/one_google_bar/one_google_bar_service_unittest.cc index 883ed27..0471536 100644 --- a/chrome/browser/search/one_google_bar/one_google_bar_service_unittest.cc +++ b/chrome/browser/search/one_google_bar/one_google_bar_service_unittest.cc
@@ -70,7 +70,7 @@ void SignOut() { identity_env_.SetCookieAccounts({}); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; signin::IdentityTestEnvironment identity_env_;
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_browsertest.cc b/chrome/browser/sharing/click_to_call/click_to_call_browsertest.cc index 943f176..ac708d2 100644 --- a/chrome/browser/sharing/click_to_call/click_to_call_browsertest.cc +++ b/chrome/browser/sharing/click_to_call/click_to_call_browsertest.cc
@@ -80,7 +80,7 @@ base::RunLoop run_loop; service->RegisterDeviceInTesting( - static_cast<int>(SharingDeviceCapability::kTelephony), + static_cast<int>(SharingDeviceCapability::kClickToCall), base::BindLambdaForTesting([&](SharingDeviceRegistrationResult r) { ASSERT_EQ(SharingDeviceRegistrationResult::kSuccess, r); run_loop.Quit(); @@ -174,7 +174,7 @@ SetUpDevices(/*count=*/1); auto devices = sharing_service()->GetDeviceCandidates( - static_cast<int>(SharingDeviceCapability::kTelephony)); + static_cast<int>(SharingDeviceCapability::kClickToCall)); ASSERT_EQ(1u, devices.size()); @@ -224,7 +224,7 @@ SetUpDevices(/*count=*/2); auto devices = sharing_service()->GetDeviceCandidates( - static_cast<int>(SharingDeviceCapability::kTelephony)); + static_cast<int>(SharingDeviceCapability::kClickToCall)); ASSERT_EQ(2u, devices.size());
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.cc b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.cc index a1f65404..ded7eed 100644 --- a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.cc +++ b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.cc
@@ -67,7 +67,7 @@ } int ClickToCallUiController::GetRequiredDeviceCapabilities() { - return static_cast<int>(SharingDeviceCapability::kTelephony); + return static_cast<int>(SharingDeviceCapability::kClickToCall); } void ClickToCallUiController::DoUpdateApps(UpdateAppsCallback callback) {
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller_unittest.cc b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller_unittest.cc index fcfa39f..e04de062 100644 --- a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller_unittest.cc +++ b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller_unittest.cc
@@ -126,6 +126,6 @@ // Check the call to sharing service to get all synced devices. TEST_F(ClickToCallUiControllerTest, GetSyncedDevices) { EXPECT_CALL(*service(), GetDeviceCandidates(Eq(static_cast<int>( - SharingDeviceCapability::kTelephony)))); + SharingDeviceCapability::kClickToCall)))); controller_->UpdateAndShowDialog(); }
diff --git a/chrome/browser/sharing/sharing_device_capability.h b/chrome/browser/sharing/sharing_device_capability.h index ac9cb34..c010b0e4 100644 --- a/chrome/browser/sharing/sharing_device_capability.h +++ b/chrome/browser/sharing/sharing_device_capability.h
@@ -12,7 +12,7 @@ // NEXT_FREE_BIT_ID: 2 enum class SharingDeviceCapability { kNone = 0, - kTelephony = 1 << 0, + kClickToCall = 1 << 0, kSharedClipboard = 1 << 1 };
diff --git a/chrome/browser/sharing/sharing_device_registration.cc b/chrome/browser/sharing/sharing_device_registration.cc index 2b771f52..4851f68 100644 --- a/chrome/browser/sharing/sharing_device_registration.cc +++ b/chrome/browser/sharing/sharing_device_registration.cc
@@ -195,9 +195,9 @@ return device_capabilities_testing_value_.value(); int device_capabilities = static_cast<int>(SharingDeviceCapability::kNone); - if (IsTelephonySupported()) { + if (IsClickToCallSupported()) { device_capabilities |= - static_cast<int>(SharingDeviceCapability::kTelephony); + static_cast<int>(SharingDeviceCapability::kClickToCall); } if (IsSharedClipboardSupported()) { device_capabilities |= @@ -206,7 +206,7 @@ return device_capabilities; } -bool SharingDeviceRegistration::IsTelephonySupported() const { +bool SharingDeviceRegistration::IsClickToCallSupported() const { #if defined(OS_ANDROID) if (!base::FeatureList::IsEnabled(kClickToCallReceiver)) return false;
diff --git a/chrome/browser/sharing/sharing_device_registration.h b/chrome/browser/sharing/sharing_device_registration.h index d1686a4..c581fc7e 100644 --- a/chrome/browser/sharing/sharing_device_registration.h +++ b/chrome/browser/sharing/sharing_device_registration.h
@@ -87,8 +87,8 @@ // Computes and returns a bitmask of all capabilities supported by the device. int GetDeviceCapabilities() const; - // Returns if device supports telephony capability. - bool IsTelephonySupported() const; + // Returns if device can handle receiving phone numbers for calling. + bool IsClickToCallSupported() const; // Returns if device can handle receiving of shared clipboard contents. bool IsSharedClipboardSupported() const;
diff --git a/chrome/browser/sharing/sharing_device_registration_unittest.cc b/chrome/browser/sharing/sharing_device_registration_unittest.cc index 5e4aace7..f1f48d7 100644 --- a/chrome/browser/sharing/sharing_device_registration_unittest.cc +++ b/chrome/browser/sharing/sharing_device_registration_unittest.cc
@@ -160,8 +160,8 @@ } protected: - content::TestBrowserThreadBundle scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + content::TestBrowserThreadBundle task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; sync_preferences::TestingPrefServiceSyncable prefs_; NiceMock<MockInstanceIDDriver> mock_instance_id_driver_; @@ -258,7 +258,7 @@ EXPECT_EQ(SharingDeviceRegistrationResult::kSuccess, result_); // Advance time so registration is expired. - scoped_task_environment_.FastForwardBy(kRegistrationExpiration); + task_environment_.FastForwardBy(kRegistrationExpiration); // Register the device again, Instance.GetToken will be attempted once more, // which will return a different FCM token.
diff --git a/chrome/browser/sharing/sharing_service_unittest.cc b/chrome/browser/sharing/sharing_service_unittest.cc index 326df39..b7c7272 100644 --- a/chrome/browser/sharing/sharing_service_unittest.cc +++ b/chrome/browser/sharing/sharing_service_unittest.cc
@@ -34,7 +34,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using base::test::ScopedTaskEnvironment; +using base::test::TaskEnvironment; using namespace instance_id; using namespace testing; @@ -215,8 +215,8 @@ } base::test::ScopedFeatureList scoped_feature_list_; - content::TestBrowserThreadBundle scoped_task_environment_{ - ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + content::TestBrowserThreadBundle task_environment_{ + TaskEnvironment::TimeSource::MOCK_TIME}; syncer::FakeDeviceInfoTracker device_info_tracker_; FakeLocalDeviceInfoProvider fake_local_device_info_provider_; @@ -287,8 +287,8 @@ sync_prefs_->SetSyncDevice(id, CreateFakeSyncDevice()); // Forward time until device expires. - scoped_task_environment_.FastForwardBy(kDeviceExpiration + - base::TimeDelta::FromMilliseconds(1)); + task_environment_.FastForwardBy(kDeviceExpiration + + base::TimeDelta::FromMilliseconds(1)); std::vector<std::unique_ptr<syncer::DeviceInfo>> candidates = GetSharingService()->GetDeviceCandidates(kNoCapabilities); @@ -319,7 +319,7 @@ sync_prefs_->SetSyncDevice(id1, CreateFakeSyncDevice()); // Advance time for a bit to create a newer device. - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(10)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(10)); // Add second device. std::string id2 = base::GenerateGUID(); @@ -393,7 +393,7 @@ EXPECT_EQ(kFcmToken, fake_gcm_driver_.fcm_token()); // Advance time so send message will expire. - scoped_task_environment_.FastForwardBy(kSendMessageTimeout); + task_environment_.FastForwardBy(kSendMessageTimeout); EXPECT_TRUE(send_message_success().has_value()); EXPECT_FALSE(*send_message_success()); @@ -429,7 +429,7 @@ EXPECT_EQ(kFcmToken, fake_gcm_driver_.fcm_token()); // Advance time so send message will expire. - scoped_task_environment_.FastForwardBy(kSendMessageTimeout); + task_environment_.FastForwardBy(kSendMessageTimeout); EXPECT_TRUE(send_message_success().has_value()); EXPECT_FALSE(*send_message_success()); @@ -501,7 +501,7 @@ sharing_device_registration_->SetResult( SharingDeviceRegistrationResult::kSuccess); EXPECT_CALL(*fcm_handler_, StartListening()).Times(1); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( base::TimeDelta::FromMilliseconds(kRetryBackoffPolicy.initial_delay_ms)); EXPECT_EQ(2, sharing_device_registration_->registration_attempts()); EXPECT_EQ(SharingService::State::ACTIVE, GetSharingService()->GetState());
diff --git a/chrome/browser/signin/dice_response_handler_unittest.cc b/chrome/browser/signin/dice_response_handler_unittest.cc index c994e82..0a197fdc 100644 --- a/chrome/browser/signin/dice_response_handler_unittest.cc +++ b/chrome/browser/signin/dice_response_handler_unittest.cc
@@ -94,10 +94,9 @@ protected: DiceResponseHandlerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO, - base::test::ScopedTaskEnvironment::TimeSource:: - MOCK_TIME), // URLRequestContext requires IO. + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO, + base::test::TaskEnvironment::TimeSource:: + MOCK_TIME), // URLRequestContext requires IO. signin_client_(&pref_service_), identity_test_env_(/*test_url_loader_factory=*/nullptr, &pref_service_, @@ -179,7 +178,7 @@ return identity_test_env_.identity_manager(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; sync_preferences::TestingPrefServiceSyncable pref_service_; DiceTestSigninClient signin_client_; @@ -449,7 +448,7 @@ EXPECT_EQ( 1u, dice_response_handler_->GetPendingDiceTokenFetchersCountForTesting()); // Force a timeout. - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( base::TimeDelta::FromSeconds(kDiceTokenFetchTimeoutSeconds + 1)); EXPECT_EQ( 0u, dice_response_handler_->GetPendingDiceTokenFetchersCountForTesting());
diff --git a/chrome/browser/signin/force_signin_verifier_unittest.cc b/chrome/browser/signin/force_signin_verifier_unittest.cc index c1b28513..3d51f66 100644 --- a/chrome/browser/signin/force_signin_verifier_unittest.cc +++ b/chrome/browser/signin/force_signin_verifier_unittest.cc
@@ -146,7 +146,7 @@ } // namespace TEST(ForceSigninVerifierTest, OnGetTokenSuccess) { - base::test::ScopedTaskEnvironment scoped_task_env; + base::test::TaskEnvironment scoped_task_env; signin::IdentityTestEnvironment identity_test_env; const AccountInfo account_info = identity_test_env.MakePrimaryAccountAvailable("email@test.com"); @@ -175,7 +175,7 @@ } TEST(ForceSigninVerifierTest, OnGetTokenPersistentFailure) { - base::test::ScopedTaskEnvironment scoped_task_env; + base::test::TaskEnvironment scoped_task_env; signin::IdentityTestEnvironment identity_test_env; const AccountInfo account_info = identity_test_env.MakePrimaryAccountAvailable("email@test.com"); @@ -205,7 +205,7 @@ } TEST(ForceSigninVerifierTest, OnGetTokenTransientFailure) { - base::test::ScopedTaskEnvironment scoped_task_env; + base::test::TaskEnvironment scoped_task_env; signin::IdentityTestEnvironment identity_test_env; const AccountInfo account_info = identity_test_env.MakePrimaryAccountAvailable("email@test.com"); @@ -234,7 +234,7 @@ } TEST(ForceSigninVerifierTest, OnLostConnection) { - base::test::ScopedTaskEnvironment scoped_task_env; + base::test::TaskEnvironment scoped_task_env; signin::IdentityTestEnvironment identity_test_env; const AccountInfo account_info = identity_test_env.MakePrimaryAccountAvailable("email@test.com"); @@ -258,7 +258,7 @@ } TEST(ForceSigninVerifierTest, OnReconnected) { - base::test::ScopedTaskEnvironment scoped_task_env; + base::test::TaskEnvironment scoped_task_env; signin::IdentityTestEnvironment identity_test_env; const AccountInfo account_info = identity_test_env.MakePrimaryAccountAvailable("email@test.com"); @@ -282,7 +282,7 @@ } TEST(ForceSigninVerifierTest, GetNetworkStatusAsync) { - base::test::ScopedTaskEnvironment scoped_task_env; + base::test::TaskEnvironment scoped_task_env; signin::IdentityTestEnvironment identity_test_env; const AccountInfo account_info = identity_test_env.MakePrimaryAccountAvailable("email@test.com"); @@ -304,7 +304,7 @@ } TEST(ForceSigninVerifierTest, LaunchVerifierWithoutNetwork) { - base::test::ScopedTaskEnvironment scoped_task_env; + base::test::TaskEnvironment scoped_task_env; signin::IdentityTestEnvironment identity_test_env; const AccountInfo account_info = identity_test_env.MakePrimaryAccountAvailable("email@test.com"); @@ -333,7 +333,7 @@ } TEST(ForceSigninVerifierTest, ChangeNetworkFromWIFITo4GWithOnGoingRequest) { - base::test::ScopedTaskEnvironment scoped_task_env; + base::test::TaskEnvironment scoped_task_env; signin::IdentityTestEnvironment identity_test_env; const AccountInfo account_info = identity_test_env.MakePrimaryAccountAvailable("email@test.com"); @@ -364,7 +364,7 @@ } TEST(ForceSigninVerifierTest, ChangeNetworkFromWIFITo4GWithFinishedRequest) { - base::test::ScopedTaskEnvironment scoped_task_env; + base::test::TaskEnvironment scoped_task_env; signin::IdentityTestEnvironment identity_test_env; const AccountInfo account_info = identity_test_env.MakePrimaryAccountAvailable("email@test.com");
diff --git a/chrome/browser/site_isolation/site_per_process_text_input_browsertest.cc b/chrome/browser/site_isolation/site_per_process_text_input_browsertest.cc index e85e9fa2..8c4c64e 100644 --- a/chrome/browser/site_isolation/site_per_process_text_input_browsertest.cc +++ b/chrome/browser/site_isolation/site_per_process_text_input_browsertest.cc
@@ -440,16 +440,9 @@ // creates a sequence of tab presses and verifies that after each key press, the // TextInputState.value reflects that of the focused input, i.e., the // TextInputManager is correctly tracking TextInputState across frames. -// Flaky on chromeOS; https://crbug.com/704994. -#if defined(OS_CHROMEOS) -#define MAYBE_TrackStateWhenSwitchingFocusedFrames \ - DISABLED_TrackStateWhenSwitchingFocusedFrames -#else -#define MAYBE_TrackStateWhenSwitchingFocusedFrames \ - TrackStateWhenSwitchingFocusedFrames -#endif +// Flaky on ChromeOS, Linux, Mac, and Windows; https://crbug.com/704994. IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, - MAYBE_TrackStateWhenSwitchingFocusedFrames) { + DISABLED_TrackStateWhenSwitchingFocusedFrames) { CreateIframePage("a(a,b,c(a,b,d(e, f)),g)"); std::vector<std::string> values{ "main", "node_a", "node_b", "node_c", "node_c_a",
diff --git a/chrome/browser/ssl/certificate_error_report_unittest.cc b/chrome/browser/ssl/certificate_error_report_unittest.cc index 8e7bd5ba..6ae3add 100644 --- a/chrome/browser/ssl/certificate_error_report_unittest.cc +++ b/chrome/browser/ssl/certificate_error_report_unittest.cc
@@ -208,8 +208,8 @@ // Tests that information about network time querying is included in the // report. TEST(ErrorReportTest, NetworkTimeQueryingFeatureInfo) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); std::unique_ptr<network_time::FieldTrialTest> field_trial_test( new network_time::FieldTrialTest());
diff --git a/chrome/browser/ssl/certificate_error_reporter_unittest.cc b/chrome/browser/ssl/certificate_error_reporter_unittest.cc index 7424e8d..dcef808 100644 --- a/chrome/browser/ssl/certificate_error_reporter_unittest.cc +++ b/chrome/browser/ssl/certificate_error_reporter_unittest.cc
@@ -49,8 +49,8 @@ ~ErrorReporterTest() override {} protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; uint8_t server_public_key_[32]; uint8_t server_private_key_[32];
diff --git a/chrome/browser/ssl/ssl_config_service_manager_pref_unittest.cc b/chrome/browser/ssl/ssl_config_service_manager_pref_unittest.cc index 918c85ad..70b75969 100644 --- a/chrome/browser/ssl/ssl_config_service_manager_pref_unittest.cc +++ b/chrome/browser/ssl/ssl_config_service_manager_pref_unittest.cc
@@ -84,7 +84,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestingPrefServiceSimple local_state_;
diff --git a/chrome/browser/startup_data.cc b/chrome/browser/startup_data.cc index e09bdf89..f250d7d 100644 --- a/chrome/browser/startup_data.cc +++ b/chrome/browser/startup_data.cc
@@ -78,8 +78,7 @@ // |field_trial_provider|. variations::FieldTrialsProvider field_trial_provider(nullptr, base::StringPiece()); - field_trial_provider.ProvideSystemProfileMetricsWithLogCreationTime( - base::TimeTicks(), &system_profile); + field_trial_provider.ProvideSystemProfileMetrics(&system_profile); // TODO(crbug.com/965482): Records information from other providers. metrics::GlobalPersistentSystemProfile::GetInstance()->SetSystemProfile(
diff --git a/chrome/browser/supervised_user/child_accounts/family_info_fetcher_unittest.cc b/chrome/browser/supervised_user/child_accounts/family_info_fetcher_unittest.cc index 0b3831a..683f8679 100644 --- a/chrome/browser/supervised_user/child_accounts/family_info_fetcher_unittest.cc +++ b/chrome/browser/supervised_user/child_accounts/family_info_fetcher_unittest.cc
@@ -176,7 +176,7 @@ SendResponse(net::ERR_ABORTED, std::string()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; signin::IdentityTestEnvironment identity_test_env_; network::TestURLLoaderFactory test_url_loader_factory_; std::unique_ptr<FamilyInfoFetcher> fetcher_;
diff --git a/chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary_unittest.cc b/chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary_unittest.cc index 2a385d8..b9edc0a 100644 --- a/chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary_unittest.cc +++ b/chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary_unittest.cc
@@ -85,7 +85,7 @@ MOCK_METHOD1(OnRequestCreated, void(bool success)); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::string account_id_; signin::IdentityTestEnvironment identity_test_env_; network::TestURLLoaderFactory test_url_loader_factory_;
diff --git a/chrome/browser/supervised_user/supervised_user_url_filter_unittest.cc b/chrome/browser/supervised_user/supervised_user_url_filter_unittest.cc index 9dc2b45..b3b4859 100644 --- a/chrome/browser/supervised_user/supervised_user_url_filter_unittest.cc +++ b/chrome/browser/supervised_user/supervised_user_url_filter_unittest.cc
@@ -63,7 +63,7 @@ supervised_user_error_page::MANUAL); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop run_loop_; SupervisedUserURLFilter filter_; SupervisedUserURLFilter::FilteringBehavior behavior_;
diff --git a/chrome/browser/sync/sync_ui_util_unittest.cc b/chrome/browser/sync/sync_ui_util_unittest.cc index 5d062bef..f128a899 100644 --- a/chrome/browser/sync/sync_ui_util_unittest.cc +++ b/chrome/browser/sync/sync_ui_util_unittest.cc
@@ -154,7 +154,7 @@ // This test ensures that each distinctive SyncService status will return a // unique combination of status and link messages from GetStatusLabels(). TEST(SyncUIUtilTest, DistinctCasesReportUniqueMessageSets) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; std::set<base::string16> messages; for (int index = 0; index != NUMBER_OF_STATUS_CASES; index++) { @@ -198,7 +198,7 @@ } TEST(SyncUIUtilTest, UnrecoverableErrorWithActionableError) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; syncer::TestSyncService service; signin::IdentityTestEnvironment environment; @@ -236,7 +236,7 @@ } TEST(SyncUIUtilTest, ActionableErrorWithPassiveMessage) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; syncer::TestSyncService service; signin::IdentityTestEnvironment environment; @@ -262,7 +262,7 @@ } TEST(SyncUIUtilTest, SyncSettingsConfirmationNeededTest) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; syncer::TestSyncService service; signin::IdentityTestEnvironment environment; @@ -283,7 +283,7 @@ // Errors in non-sync accounts should be ignored. TEST(SyncUIUtilTest, IgnoreSyncErrorForNonSyncAccount) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; syncer::TestSyncService service; signin::IdentityTestEnvironment environment;
diff --git a/chrome/browser/sync_file_system/drive_backend/callback_helper_unittest.cc b/chrome/browser/sync_file_system/drive_backend/callback_helper_unittest.cc index 50f76dcb..5621bd3c 100644 --- a/chrome/browser/sync_file_system/drive_backend/callback_helper_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/callback_helper_unittest.cc
@@ -43,7 +43,7 @@ } // namespace TEST(DriveBackendCallbackHelperTest, BasicTest) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; bool called = false; RelayCallbackToCurrentThread( @@ -63,7 +63,7 @@ } TEST(DriveBackendCallbackHelperTest, RunOnOtherThreadTest) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::Thread thread("WorkerThread"); thread.Start(); @@ -91,7 +91,7 @@ } TEST(DriveBackendCallbackHelperTest, PassNullFunctionTest) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::Closure closure = RelayCallbackToCurrentThread( FROM_HERE, base::Closure());
diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_unittest.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database_unittest.cc index 3438cb0..093f8b9 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_database_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_unittest.cc
@@ -625,7 +625,7 @@ private: base::ScopedTempDir database_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<leveldb::Env> in_memory_env_; std::unique_ptr<MetadataDatabase> metadata_database_;
diff --git a/chrome/browser/sync_file_system/drive_backend/sync_task_manager_unittest.cc b/chrome/browser/sync_file_system/drive_backend/sync_task_manager_unittest.cc index 6d1652bc..194a4dec 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_task_manager_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/sync_task_manager_unittest.cc
@@ -287,7 +287,7 @@ } // namespace TEST(SyncTaskManagerTest, ScheduleTask) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; TaskManagerClient client(0 /* maximum_background_task */); int callback_count = 0; SyncStatusCode callback_status = SYNC_STATUS_OK; @@ -307,7 +307,7 @@ } TEST(SyncTaskManagerTest, ScheduleTwoTasks) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; TaskManagerClient client(0 /* maximum_background_task */); int callback_count = 0; SyncStatusCode callback_status = SYNC_STATUS_OK; @@ -330,7 +330,7 @@ } TEST(SyncTaskManagerTest, ScheduleIdleTask) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; TaskManagerClient client(0 /* maximum_background_task */); client.ScheduleTaskIfIdle(kStatus1); @@ -344,7 +344,7 @@ } TEST(SyncTaskManagerTest, ScheduleIdleTaskWhileNotIdle) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; TaskManagerClient client(0 /* maximum_background_task */); int callback_count = 0; SyncStatusCode callback_status = SYNC_STATUS_OK; @@ -366,7 +366,7 @@ } TEST(SyncTaskManagerTest, ScheduleAndCancelSyncTask) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; int callback_count = 0; SyncStatusCode status = SYNC_STATUS_UNKNOWN; @@ -395,7 +395,7 @@ } TEST(SyncTaskManagerTest, ScheduleTaskAtPriority) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; SyncTaskManager task_manager(base::WeakPtr<SyncTaskManager::Client>(), 0 /* maximum_background_task */, base::ThreadTaskRunnerHandle::Get()); @@ -456,7 +456,7 @@ } TEST(SyncTaskManagerTest, BackgroundTask_Sequential) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; SyncTaskManager task_manager(base::WeakPtr<SyncTaskManager::Client>(), 10 /* maximum_background_task */, base::ThreadTaskRunnerHandle::Get()); @@ -488,7 +488,7 @@ } TEST(SyncTaskManagerTest, BackgroundTask_Parallel) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; SyncTaskManager task_manager(base::WeakPtr<SyncTaskManager::Client>(), 10 /* maximum_background_task */, base::ThreadTaskRunnerHandle::Get()); @@ -520,7 +520,7 @@ } TEST(SyncTaskManagerTest, BackgroundTask_Throttled) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; SyncTaskManager task_manager(base::WeakPtr<SyncTaskManager::Client>(), 2 /* maximum_background_task */, base::ThreadTaskRunnerHandle::Get()); @@ -552,7 +552,7 @@ } TEST(SyncTaskManagerTest, UpdateTaskBlocker) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; SyncTaskManager task_manager(base::WeakPtr<SyncTaskManager::Client>(), 10 /* maximum_background_task */, base::ThreadTaskRunnerHandle::Get());
diff --git a/chrome/browser/tracing/trace_event_system_stats_monitor_unittest.cc b/chrome/browser/tracing/trace_event_system_stats_monitor_unittest.cc index f62a510..1e42c5402 100644 --- a/chrome/browser/tracing/trace_event_system_stats_monitor_unittest.cc +++ b/chrome/browser/tracing/trace_event_system_stats_monitor_unittest.cc
@@ -14,7 +14,7 @@ using TraceSystemStatsMonitorTest = testing::Test; TEST_F(TraceSystemStatsMonitorTest, TraceEventSystemStatsMonitor) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; auto system_monitor = performance_monitor::SystemMonitor::Create(); TraceEventSystemStatsMonitor system_stats_monitor;
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/app_launch_event_logger_unittest.cc b/chrome/browser/ui/app_list/search/search_result_ranker/app_launch_event_logger_unittest.cc index 434fca9..8a5359d 100644 --- a/chrome/browser/ui/app_list/search/search_result_ranker/app_launch_event_logger_unittest.cc +++ b/chrome/browser/ui/app_list/search/search_result_ranker/app_launch_event_logger_unittest.cc
@@ -72,7 +72,7 @@ } base::test::ScopedFeatureList scoped_feature_list_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ukm::TestAutoSetUkmRecorder test_ukm_recorder_; }; @@ -90,7 +90,7 @@ nullptr); app_launch_event_logger_.OnGridClicked(kPhotosPWAApp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const auto entries = test_ukm_recorder_.GetEntriesByName("AppListAppLaunch"); ASSERT_EQ(1ul, entries.size()); @@ -131,7 +131,7 @@ nullptr); app_launch_event_logger_.OnGridClicked(kGmailChromeApp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const auto entries = test_ukm_recorder_.GetEntriesByName("AppListAppLaunch"); ASSERT_EQ(1ul, entries.size()); @@ -158,7 +158,7 @@ packages.get()); app_launch_event_logger_.OnGridClicked(kMapsArcApp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const auto entries = test_ukm_recorder_.GetEntriesByName("AppListAppLaunch"); ASSERT_EQ(1ul, entries.size()); @@ -209,7 +209,7 @@ app_launch_event_logger_.OnGridClicked(kCalculatorArcApp); app_launch_event_logger_.OnGridClicked(kPhotosPWAApp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const auto entries = test_ukm_recorder_.GetEntriesByName("AppListAppLaunch"); ASSERT_EQ(6ul, entries.size()); @@ -311,7 +311,7 @@ app_launch_event_logger_.OnSuggestionChipOrSearchBoxClicked(kPhotosPWAApp, 3, 2); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const auto entries = test_ukm_recorder_.GetEntriesByName("AppListAppLaunch"); ASSERT_EQ(1ul, entries.size()); @@ -335,7 +335,7 @@ app_launch_event_logger_.OnSuggestionChipOrSearchBoxClicked(kPhotosPWAApp, 3, 4); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const auto entries = test_ukm_recorder_.GetEntriesByName("AppListAppLaunch"); ASSERT_EQ(1ul, entries.size());
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_metrics_provider_unittest.cc b/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_metrics_provider_unittest.cc index 93716bb..98a69cd5 100644 --- a/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_metrics_provider_unittest.cc +++ b/chrome/browser/ui/app_list/search/search_result_ranker/app_list_launch_metrics_provider_unittest.cc
@@ -203,10 +203,10 @@ histogram_tester_.ExpectTotalCount("Apps.AppListLaunchRecorderError", 0); } - void Wait() { scoped_task_environment_.RunUntilIdle(); } + void Wait() { task_environment_.RunUntilIdle(); } base::HistogramTester histogram_tester_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; std::unique_ptr<AppListLaunchMetricsProvider> provider_;
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/app_search_result_ranker_unittest.cc b/chrome/browser/ui/app_list/search/search_result_ranker/app_search_result_ranker_unittest.cc index c6afe4d5..af7b665 100644 --- a/chrome/browser/ui/app_list/search/search_result_ranker/app_search_result_ranker_unittest.cc +++ b/chrome/browser/ui/app_list/search/search_result_ranker/app_search_result_ranker_unittest.cc
@@ -39,11 +39,11 @@ } // Waits for all tasks in to finish. - void Wait() { scoped_task_environment_.RunUntilIdle(); } + void Wait() { task_environment_.RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED}; base::ScopedTempDir temp_dir_; base::test::ScopedFeatureList scoped_feature_list_; };
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_unittest.cc b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_unittest.cc index 52477af..c9615345 100644 --- a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_unittest.cc +++ b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_unittest.cc
@@ -52,7 +52,7 @@ Wait(); } - void Wait() { scoped_task_environment_.RunUntilIdle(); } + void Wait() { task_environment_.RunUntilIdle(); } // Returns the config for a ranker with a fake predictor. RecurrenceRankerConfigProto MakeSimpleConfig() { @@ -180,9 +180,9 @@ } } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED}; base::ScopedTempDir temp_dir_; base::test::ScopedFeatureList scoped_feature_list_; base::HistogramTester histogram_tester_;
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util_unittest.cc b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util_unittest.cc index 3f9e362..3e8e0d51 100644 --- a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util_unittest.cc +++ b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util_unittest.cc
@@ -53,9 +53,9 @@ return converted_proto.value(); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED}; std::unique_ptr<JsonConfigConverter> converter_;
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/search_result_ranker_unittest.cc b/chrome/browser/ui/app_list/search/search_result_ranker/search_result_ranker_unittest.cc index a0cbc24b..7e5548d7 100644 --- a/chrome/browser/ui/app_list/search/search_result_ranker/search_result_ranker_unittest.cc +++ b/chrome/browser/ui/app_list/search/search_result_ranker/search_result_ranker_unittest.cc
@@ -87,8 +87,7 @@ class SearchResultRankerTest : public testing::Test { public: SearchResultRankerTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~SearchResultRankerTest() override {} // testing::Test overrides:
diff --git a/chrome/browser/ui/app_list/search/tests/mixer_unittest.cc b/chrome/browser/ui/app_list/search/tests/mixer_unittest.cc index 9e7bf56..0b28455 100644 --- a/chrome/browser/ui/app_list/search/tests/mixer_unittest.cc +++ b/chrome/browser/ui/app_list/search/tests/mixer_unittest.cc
@@ -177,7 +177,7 @@ return result; } - void Wait() { scoped_task_environment_.RunUntilIdle(); } + void Wait() { task_environment_.RunUntilIdle(); } Mixer* mixer() { return mixer_.get(); } TestSearchProvider* app_provider() { return providers_[0].get(); } @@ -185,7 +185,7 @@ TestSearchProvider* playstore_provider() { return providers_[2].get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::test::ScopedFeatureList scoped_feature_list_; base::ScopedTempDir temp_dir_;
diff --git a/chrome/browser/ui/ash/ime_controller_client_unittest.cc b/chrome/browser/ui/ash/ime_controller_client_unittest.cc index 20f3a28..142809e 100644 --- a/chrome/browser/ui/ash/ime_controller_client_unittest.cc +++ b/chrome/browser/ui/ash/ime_controller_client_unittest.cc
@@ -162,7 +162,7 @@ TestImeController ime_controller_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(ImeControllerClientTest); };
diff --git a/chrome/browser/ui/ash/wallpaper_controller_client_unittest.cc b/chrome/browser/ui/ash/wallpaper_controller_client_unittest.cc index cbaadeb..04e1c4d1 100644 --- a/chrome/browser/ui/ash/wallpaper_controller_client_unittest.cc +++ b/chrome/browser/ui/ash/wallpaper_controller_client_unittest.cc
@@ -22,7 +22,7 @@ private: ScopedTestingLocalState local_state_; chromeos::ScopedCrosSettingsTestHelper cros_settings_test_helper_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(WallpaperControllerClientTest); };
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc index 8512c28..c18ba7b 100644 --- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc +++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
@@ -597,24 +597,31 @@ // Retrieve the ax node id associated with the current web contents' element // that has a controller relation to the current autofill popup. - int32_t node_id = static_cast<AutofillExternalDelegate*>(delegate_.get()) - ->GetWebContentsPopupControllerAxId(); + int32_t node_id = delegate_->GetWebContentsPopupControllerAxId(); // We can only raise controls changed accessibility event when we have a valid // ax tree and an ax node associated with the ax tree for the popup // controller, and a valid ax unique id for the popup controllee. - if (!ax_tree_manager || !ax_tree_manager->GetDelegate(tree_id, node_id) || - !view_->GetAxUniqueId()) + if (!ax_tree_manager) + return; + ui::AXPlatformNodeDelegate* ax_platform_node_delegate = + ax_tree_manager->GetDelegate(tree_id, node_id); + if (!ax_platform_node_delegate) + return; + ui::AXPlatformNode* target_node = + ax_platform_node_delegate->GetFromNodeID(node_id); + base::Optional<int32_t> popup_ax_id = view_->GetAxUniqueId(); + if (!target_node || !popup_ax_id) return; + // All the conditions are valid, raise the accessibility event and set global + // popup ax unique id. if (is_show) - ui::SetActivePopupAxUniqueId(view_->GetAxUniqueId()); + ui::SetActivePopupAxUniqueId(popup_ax_id); else ui::ClearActivePopupAxUniqueId(); - ax_tree_manager->GetDelegate(tree_id, node_id) - ->GetFromNodeID(node_id) - ->NotifyAccessibilityEvent(ax::mojom::Event::kControlsChanged); + target_node->NotifyAccessibilityEvent(ax::mojom::Event::kControlsChanged); } } // namespace autofill
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.h b/chrome/browser/ui/autofill/autofill_popup_controller_impl.h index 5c3aa39f..c9d0d6e 100644 --- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.h +++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.h
@@ -139,6 +139,11 @@ AutofillPopupLayoutModel& LayoutModelForTesting() { return layout_model_; } + // Raise an accessibility event to indicate the controls relation of the + // form control of the popup and popup itself has changed based on the popup's + // show or hide action. + void FireControlsChangedEvent(bool is_show); + private: #if !defined(OS_ANDROID) FRIEND_TEST_ALL_PREFIXES(AutofillPopupControllerUnitTest, ElideText); @@ -155,12 +160,8 @@ // Hides |view_| unless it is null and then deletes |this|. void HideViewAndDie(); - // Raise an accessibility event to indicate the controls relation of the - // form control of the popup and popup itself has changed based on the popup's - // show or hide action. - void FireControlsChangedEvent(bool is_show); - friend class AutofillPopupControllerUnitTest; + friend class AutofillPopupControllerAccessibilityUnitTest; void SetViewForTesting(AutofillPopupView* view) { view_ = view; } PopupControllerCommon controller_common_;
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc index 82e2959..283b369 100644 --- a/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc +++ b/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc
@@ -11,6 +11,7 @@ #include "base/optional.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" +#include "chrome/browser/accessibility/accessibility_state_utils.h" #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" #include "chrome/browser/ui/autofill/autofill_popup_view.h" #include "chrome/browser/ui/autofill/popup_view_common.h" @@ -28,9 +29,20 @@ #include "content/public/browser/web_contents.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/accessibility/ax_active_popup.h" +#include "ui/accessibility/ax_node.h" +#include "ui/accessibility/ax_tree_id.h" +#include "ui/accessibility/ax_tree_manager.h" +#include "ui/accessibility/ax_tree_manager_map.h" +#include "ui/accessibility/platform/ax_platform_node_base.h" +#include "ui/accessibility/platform/ax_platform_node_delegate_base.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/text_utils.h" +#if !defined(OS_CHROMEOS) +#include "content/public/browser/browser_accessibility_state.h" +#endif + using ::testing::_; using ::testing::AtLeast; using ::testing::Mock; @@ -42,12 +54,58 @@ namespace autofill { namespace { +const char kAppLocale[] = "en-US"; +const AutofillManager::AutofillDownloadManagerState kDownloadState = + AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER; + +class MockAutofillClient : public autofill::TestAutofillClient { + public: + MockAutofillClient() : prefs_(autofill::test::PrefServiceForTesting()) {} + ~MockAutofillClient() override = default; + + PrefService* GetPrefs() override { return prefs_.get(); } + + private: + std::unique_ptr<PrefService> prefs_; + + DISALLOW_COPY_AND_ASSIGN(MockAutofillClient); +}; + +class MockAutofillDriver : public ContentAutofillDriver { + public: + MockAutofillDriver(content::RenderFrameHost* rfh, MockAutofillClient* client) + : ContentAutofillDriver(rfh, + client, + kAppLocale, + kDownloadState, + nullptr) {} + + ~MockAutofillDriver() override = default; + MOCK_CONST_METHOD0(GetAxTreeId, ui::AXTreeID()); + + private: + DISALLOW_COPY_AND_ASSIGN(MockAutofillDriver); +}; + +class MockAutofillManager : public AutofillManager { + public: + MockAutofillManager(AutofillDriver* driver, MockAutofillClient* client) + : AutofillManager(driver, + client, + client->GetPersonalDataManager(), + client->GetAutocompleteHistoryManager()) {} + ~MockAutofillManager() override = default; + + private: + DISALLOW_COPY_AND_ASSIGN(MockAutofillManager); +}; + class MockAutofillExternalDelegate : public AutofillExternalDelegate { public: MockAutofillExternalDelegate(AutofillManager* autofill_manager, AutofillDriver* autofill_driver) : AutofillExternalDelegate(autofill_manager, autofill_driver) {} - ~MockAutofillExternalDelegate() override {} + ~MockAutofillExternalDelegate() override = default; void DidSelectSuggestion(const base::string16& value, int identifier) override {} @@ -62,22 +120,10 @@ MOCK_METHOD0(OnPopupSuppressed, void()); }; -class MockAutofillClient : public autofill::TestAutofillClient { - public: - MockAutofillClient() : prefs_(autofill::test::PrefServiceForTesting()) {} - ~MockAutofillClient() override {} - - PrefService* GetPrefs() override { return prefs_.get(); } - - private: - std::unique_ptr<PrefService> prefs_; - - DISALLOW_COPY_AND_ASSIGN(MockAutofillClient); -}; - class MockAutofillPopupView : public AutofillPopupView { public: - MockAutofillPopupView() {} + MockAutofillPopupView() = default; + ~MockAutofillPopupView() override = default; MOCK_METHOD0(Show, void()); MOCK_METHOD0(Hide, void()); @@ -104,22 +150,23 @@ LayoutModelForTesting().SetUpForTesting( std::make_unique<MockPopupViewCommonForUnitTesting>()); } - ~TestAutofillPopupController() override {} + ~TestAutofillPopupController() override = default; // Making protected functions public for testing + using AutofillPopupControllerImpl::element_bounds; + using AutofillPopupControllerImpl::FireControlsChangedEvent; + using AutofillPopupControllerImpl::GetElidedLabelAt; + using AutofillPopupControllerImpl::GetElidedValueAt; using AutofillPopupControllerImpl::GetLineCount; using AutofillPopupControllerImpl::GetSuggestionAt; - using AutofillPopupControllerImpl::GetElidedValueAt; - using AutofillPopupControllerImpl::GetElidedLabelAt; + using AutofillPopupControllerImpl::GetWeakPtr; + using AutofillPopupControllerImpl::popup_bounds; + using AutofillPopupControllerImpl::RemoveSelectedLine; using AutofillPopupControllerImpl::selected_line; - using AutofillPopupControllerImpl::SetSelectedLine; using AutofillPopupControllerImpl::SelectNextLine; using AutofillPopupControllerImpl::SelectPreviousLine; - using AutofillPopupControllerImpl::RemoveSelectedLine; - using AutofillPopupControllerImpl::popup_bounds; - using AutofillPopupControllerImpl::element_bounds; + using AutofillPopupControllerImpl::SetSelectedLine; using AutofillPopupControllerImpl::SetValues; - using AutofillPopupControllerImpl::GetWeakPtr; MOCK_METHOD0(OnSuggestionsChanged, void()); MOCK_METHOD0(Hide, void()); @@ -128,6 +175,39 @@ } }; +class MockAxTreeManager : public ui::AXTreeManager { + public: + MockAxTreeManager() = default; + ~MockAxTreeManager() = default; + + MOCK_CONST_METHOD2(GetNodeFromTree, + ui::AXNode*(const ui::AXTreeID tree_id, + const int32_t node_id)); + MOCK_CONST_METHOD2(GetDelegate, + ui::AXPlatformNodeDelegate*(const ui::AXTreeID tree_id, + const int32_t node_id)); + MOCK_CONST_METHOD1(GetRootDelegate, + ui::AXPlatformNodeDelegate*(const ui::AXTreeID tree_id)); + MOCK_CONST_METHOD0(GetTreeID, ui::AXTreeID()); + MOCK_CONST_METHOD0(GetParentTreeID, ui::AXTreeID()); + MOCK_CONST_METHOD0(GetRootAsAXNode, ui::AXNode*()); + MOCK_CONST_METHOD0(GetParentNodeFromParentTreeAsAXNode, ui::AXNode*()); + + private: + DISALLOW_COPY_AND_ASSIGN(MockAxTreeManager); +}; + +class MockAxPlatformNodeDelegate : public ui::AXPlatformNodeDelegateBase { + public: + MockAxPlatformNodeDelegate() = default; + ~MockAxPlatformNodeDelegate() override = default; + + MOCK_METHOD1(GetFromNodeID, ui::AXPlatformNode*(int32_t id)); + + private: + DISALLOW_COPY_AND_ASSIGN(MockAxPlatformNodeDelegate); +}; + static constexpr base::Optional<int> kNoSelection; } // namespace @@ -137,25 +217,12 @@ AutofillPopupControllerUnitTest() : autofill_client_(new MockAutofillClient()), autofill_popup_controller_(NULL) {} - ~AutofillPopupControllerUnitTest() override {} + ~AutofillPopupControllerUnitTest() override = default; void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); - - ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( - web_contents(), autofill_client_.get(), "en-US", - AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER); - // Make sure RenderFrame is created. - NavigateAndCommit(GURL("about:blank")); - ContentAutofillDriverFactory* factory = - ContentAutofillDriverFactory::FromWebContents(web_contents()); - ContentAutofillDriver* driver = - factory->DriverForFrame(web_contents()->GetMainFrame()); - external_delegate_.reset( - new NiceMock<MockAutofillExternalDelegate>( - driver->autofill_manager(), - driver)); - autofill_popup_view_.reset(new NiceMock<MockAutofillPopupView>()); + external_delegate_ = CreateExternalDelegate(); + autofill_popup_view_ = std::make_unique<NiceMock<MockAutofillPopupView>>(); autofill_popup_controller_ = new NiceMock<TestAutofillPopupController>( external_delegate_->GetWeakPtr(), gfx::RectF()); autofill_popup_controller_->SetViewForTesting(autofill_popup_view()); @@ -171,6 +238,21 @@ ChromeRenderViewHostTestHarness::TearDown(); } + virtual std::unique_ptr<NiceMock<MockAutofillExternalDelegate>> + CreateExternalDelegate() { + ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( + web_contents(), autofill_client_.get(), "en-US", + AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER); + // Make sure RenderFrame is created. + NavigateAndCommit(GURL("about:blank")); + ContentAutofillDriverFactory* factory = + ContentAutofillDriverFactory::FromWebContents(web_contents()); + ContentAutofillDriver* driver = + factory->DriverForFrame(web_contents()->GetMainFrame()); + return std::make_unique<NiceMock<MockAutofillExternalDelegate>>( + driver->autofill_manager(), driver); + } + TestAutofillPopupController* popup_controller() { return autofill_popup_controller_; } @@ -190,6 +272,44 @@ NiceMock<TestAutofillPopupController>* autofill_popup_controller_; }; +#if !defined(OS_CHROMEOS) +class AutofillPopupControllerAccessibilityUnitTest + : public AutofillPopupControllerUnitTest { + public: + AutofillPopupControllerAccessibilityUnitTest() = default; + ~AutofillPopupControllerAccessibilityUnitTest() override = default; + + void SetUp() override { + AutofillPopupControllerUnitTest::SetUp(); + content::BrowserAccessibilityState::GetInstance() + ->AddAccessibilityModeFlags(ui::AXMode::kScreenReader); + } + + void TearDown() override { + content::BrowserAccessibilityState::GetInstance() + ->RemoveAccessibilityModeFlags(ui::AXMode::kScreenReader); + AutofillPopupControllerUnitTest::TearDown(); + } + + std::unique_ptr<NiceMock<MockAutofillExternalDelegate>> + CreateExternalDelegate() override { + autofill_driver_ = std::make_unique<NiceMock<MockAutofillDriver>>( + web_contents()->GetMainFrame(), autofill_client_.get()); + autofill_manager_ = std::make_unique<MockAutofillManager>( + autofill_driver_.get(), autofill_client_.get()); + return std::make_unique<NiceMock<MockAutofillExternalDelegate>>( + autofill_manager_.get(), autofill_driver_.get()); + } + + protected: + std::unique_ptr<MockAutofillManager> autofill_manager_; + std::unique_ptr<NiceMock<MockAutofillDriver>> autofill_driver_; + + private: + DISALLOW_COPY_AND_ASSIGN(AutofillPopupControllerAccessibilityUnitTest); +}; +#endif + TEST_F(AutofillPopupControllerUnitTest, ChangeSelectedLine) { // Set up the popup. std::vector<Suggestion> suggestions; @@ -603,4 +723,111 @@ } #endif +#if !defined(OS_CHROMEOS) +TEST_F(AutofillPopupControllerAccessibilityUnitTest, FireControlsChangedEvent) { + StrictMock<MockAxTreeManager> mock_ax_tree_manager; + StrictMock<MockAxPlatformNodeDelegate> mock_ax_platform_node_delegate; + StrictMock<ui::AXPlatformNodeBase> mock_ax_platform_node; + + const ui::AXTreeID& test_tree_id = ui::AXTreeID::CreateNewAXTreeID(); + ui::AXTreeManagerMap::GetInstance().AddTreeManager(test_tree_id, + &mock_ax_tree_manager); + + // Test for successfully firing controls changed event for popup show/hide. + { + EXPECT_CALL(*autofill_driver_, GetAxTreeId()) + .Times(2) + .WillRepeatedly(testing::Return(test_tree_id)); + EXPECT_CALL(*autofill_popup_view_, GetAxUniqueId) + .Times(2) + .WillRepeatedly(testing::Return(base::Optional<int32_t>(123))); + EXPECT_CALL(mock_ax_tree_manager, GetDelegate) + .Times(2) + .WillRepeatedly(testing::Return(&mock_ax_platform_node_delegate)); + EXPECT_CALL(mock_ax_platform_node_delegate, GetFromNodeID) + .Times(2) + .WillRepeatedly(testing::Return(&mock_ax_platform_node)); + + // Fire event for popup show and active popup ax unique id is set. + autofill_popup_controller_->FireControlsChangedEvent(true); + EXPECT_EQ(123, ui::GetActivePopupAxUniqueId()); + + // Fire event for popup hide and active popup ax unique id is cleared. + autofill_popup_controller_->FireControlsChangedEvent(false); + EXPECT_EQ(base::nullopt, ui::GetActivePopupAxUniqueId()); + } + + // Test for attempting to fire controls changed event when autofill driver + // returns an invalid ax tree id therefore no associated ax tree manager. + // No event is fired and global active popup ax unique id is not set. + { + EXPECT_CALL(*autofill_driver_, GetAxTreeId()) + .WillOnce(testing::Return(ui::AXTreeIDUnknown())); + EXPECT_CALL(*autofill_popup_view_, GetAxUniqueId).Times(0); + EXPECT_CALL(mock_ax_tree_manager, GetDelegate).Times(0); + EXPECT_CALL(mock_ax_platform_node_delegate, GetFromNodeID).Times(0); + + // No controls changed event is fired and active popup ax unique id is not + // set. + autofill_popup_controller_->FireControlsChangedEvent(true); + EXPECT_EQ(base::nullopt, ui::GetActivePopupAxUniqueId()); + } + + // Test for attempting to fire controls changed event when ax tree manager + // fails to retrieve the ax platform node delegate associated with the popup. + // No event is fired and global active popup ax unique id is not set. + { + EXPECT_CALL(*autofill_driver_, GetAxTreeId()) + .WillOnce(testing::Return(test_tree_id)); + EXPECT_CALL(mock_ax_tree_manager, GetDelegate) + .WillOnce(testing::Return(nullptr)); + EXPECT_CALL(*autofill_popup_view_, GetAxUniqueId).Times(0); + EXPECT_CALL(mock_ax_platform_node_delegate, GetFromNodeID).Times(0); + + // No controls changed event is fired and active popup ax unique id is not + // set. + autofill_popup_controller_->FireControlsChangedEvent(true); + EXPECT_EQ(base::nullopt, ui::GetActivePopupAxUniqueId()); + } + + // Test for attempting to fire controls changed event when failing to retrieve + // the ax platform node associated with the popup. + // No event is fired and global active popup ax unique id is not set. + { + EXPECT_CALL(*autofill_driver_, GetAxTreeId()) + .WillOnce(testing::Return(test_tree_id)); + EXPECT_CALL(mock_ax_tree_manager, GetDelegate) + .WillOnce(testing::Return(&mock_ax_platform_node_delegate)); + EXPECT_CALL(mock_ax_platform_node_delegate, GetFromNodeID) + .WillOnce(testing::Return(nullptr)); + EXPECT_CALL(*autofill_popup_view_, GetAxUniqueId) + .WillOnce(testing::Return(base::Optional<int32_t>(123))); + + // No controls changed event is fired and active popup ax unique id is not + // set. + autofill_popup_controller_->FireControlsChangedEvent(true); + EXPECT_EQ(base::nullopt, ui::GetActivePopupAxUniqueId()); + } + + // Test for attempting to fire controls changed event when failing to retrieve + // the autofill popup's ax unique id. + // No event is fired and global active popup ax unique id is not set. + { + EXPECT_CALL(*autofill_driver_, GetAxTreeId()) + .WillOnce(testing::Return(test_tree_id)); + EXPECT_CALL(mock_ax_tree_manager, GetDelegate) + .WillOnce(testing::Return(&mock_ax_platform_node_delegate)); + EXPECT_CALL(mock_ax_platform_node_delegate, GetFromNodeID) + .WillOnce(testing::Return(&mock_ax_platform_node)); + EXPECT_CALL(*autofill_popup_view_, GetAxUniqueId) + .WillOnce(testing::Return(base::nullopt)); + + // No controls changed event is fired and active popup ax unique id is not + // set. + autofill_popup_controller_->FireControlsChangedEvent(true); + EXPECT_EQ(base::nullopt, ui::GetActivePopupAxUniqueId()); + } +} +#endif + } // namespace autofill
diff --git a/chrome/browser/ui/autofill/payments/save_card_bubble_controller.h b/chrome/browser/ui/autofill/payments/save_card_bubble_controller.h index a2126a29..e26e7619 100644 --- a/chrome/browser/ui/autofill/payments/save_card_bubble_controller.h +++ b/chrome/browser/ui/autofill/payments/save_card_bubble_controller.h
@@ -41,6 +41,11 @@ static SaveCardBubbleController* GetOrCreate( content::WebContents* web_contents); + // Returns a reference to the SaveCardBubbleController associated with the + // given |web_contents|. If controller does not exist, this will return + // nullptr. + static SaveCardBubbleController* Get(content::WebContents* web_contents); + // Returns the title that should be displayed in the bubble. virtual base::string16 GetWindowTitle() const = 0;
diff --git a/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc b/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc index 88441576..50af48ba 100644 --- a/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc +++ b/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc
@@ -75,6 +75,15 @@ return SaveCardBubbleControllerImpl::FromWebContents(web_contents); } +// static +SaveCardBubbleController* SaveCardBubbleController::Get( + content::WebContents* web_contents) { + if (!web_contents) + return nullptr; + + return SaveCardBubbleControllerImpl::FromWebContents(web_contents); +} + void SaveCardBubbleControllerImpl::OfferLocalSave( const CreditCard& card, AutofillClient::SaveCreditCardOptions options,
diff --git a/chrome/browser/ui/cocoa/color_panel_cocoa_unittest.mm b/chrome/browser/ui/cocoa/color_panel_cocoa_unittest.mm index 6169e16..ebeef9e4 100644 --- a/chrome/browser/ui/cocoa/color_panel_cocoa_unittest.mm +++ b/chrome/browser/ui/cocoa/color_panel_cocoa_unittest.mm
@@ -28,7 +28,7 @@ [[NSColorPanel sharedColorPanel] makeKeyAndOrderFront:nil]; Init(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(ColorPanelCocoaTest, ClearTargetOnEnd) {
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller_browsertest.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller_browsertest.cc index 106dad4..8b262a9 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller_browsertest.cc +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller_browsertest.cc
@@ -181,7 +181,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, FastKeyboardLockUnlockRelock) { EnterActiveTabFullscreen(); - // TODO(crbug.com/708584): Replace with ScopedTaskEnvironment using MOCK_TIME. + // TODO(crbug.com/708584): Replace with TaskEnvironment using MOCK_TIME. auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(); base::TestMockTimeTaskRunner::ScopedContext scoped_context(task_runner.get()); @@ -200,7 +200,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, SlowKeyboardLockUnlockRelock) { EnterActiveTabFullscreen(); - // TODO(crbug.com/708584): Replace with ScopedTaskEnvironment using MOCK_TIME. + // TODO(crbug.com/708584): Replace with TaskEnvironment using MOCK_TIME. auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(); base::TestMockTimeTaskRunner::ScopedContext scoped_context(task_runner.get()); @@ -461,7 +461,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, MouseLockBubbleHideCallbackTimeout) { SetWebContentsGrantedSilentMouseLockPermission(); - // TODO(crbug.com/708584): Replace with ScopedTaskEnvironment using MOCK_TIME. + // TODO(crbug.com/708584): Replace with TaskEnvironment using MOCK_TIME. auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(); base::TestMockTimeTaskRunner::ScopedContext scoped_context(task_runner.get()); @@ -479,7 +479,7 @@ } IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, FastMouseLockUnlockRelock) { - // TODO(crbug.com/708584): Replace with ScopedTaskEnvironment using MOCK_TIME. + // TODO(crbug.com/708584): Replace with TaskEnvironment using MOCK_TIME. auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(); base::TestMockTimeTaskRunner::ScopedContext scoped_context(task_runner.get()); @@ -498,7 +498,7 @@ } IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, SlowMouseLockUnlockRelock) { - // TODO(crbug.com/708584): Replace with ScopedTaskEnvironment using MOCK_TIME. + // TODO(crbug.com/708584): Replace with TaskEnvironment using MOCK_TIME. auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(); base::TestMockTimeTaskRunner::ScopedContext scoped_context(task_runner.get());
diff --git a/chrome/browser/ui/global_media_controls/media_toolbar_button_controller_unittest.cc b/chrome/browser/ui/global_media_controls/media_toolbar_button_controller_unittest.cc index 9947ed41..c1d6576 100644 --- a/chrome/browser/ui/global_media_controls/media_toolbar_button_controller_unittest.cc +++ b/chrome/browser/ui/global_media_controls/media_toolbar_button_controller_unittest.cc
@@ -35,9 +35,8 @@ class MediaToolbarButtonControllerTest : public testing::Test { public: MediaToolbarButtonControllerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::MainThreadType::UI) {} ~MediaToolbarButtonControllerTest() override = default; void SetUp() override { @@ -55,14 +54,14 @@ void SimulateMediaStopped() { controller_->MediaSessionInfoChanged(nullptr); } void AdvanceClockMilliseconds(int milliseconds) { - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( base::TimeDelta::FromMilliseconds(milliseconds)); } MockMediaToolbarButtonControllerDelegate& delegate() { return delegate_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MediaToolbarButtonController> controller_; MockMediaToolbarButtonControllerDelegate delegate_;
diff --git a/chrome/browser/ui/omnibox/clipboard_utils_unittest.cc b/chrome/browser/ui/omnibox/clipboard_utils_unittest.cc index 3c61f60..d0053243 100644 --- a/chrome/browser/ui/omnibox/clipboard_utils_unittest.cc +++ b/chrome/browser/ui/omnibox/clipboard_utils_unittest.cc
@@ -24,8 +24,7 @@ class ClipboardUtilsTest : public PlatformTest { public: ClipboardUtilsTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { PlatformTest::SetUp(); @@ -39,7 +38,7 @@ private: // Windows requires a message loop for clipboard access. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(ClipboardUtilsTest, GetClipboardText) {
diff --git a/chrome/browser/ui/startup/credential_provider_signin_info_fetcher_win_unittest.cc b/chrome/browser/ui/startup/credential_provider_signin_info_fetcher_win_unittest.cc index 6d4dd18..819d0c4 100644 --- a/chrome/browser/ui/startup/credential_provider_signin_info_fetcher_win_unittest.cc +++ b/chrome/browser/ui/startup/credential_provider_signin_info_fetcher_win_unittest.cc
@@ -66,7 +66,7 @@ std::string valid_user_info_response_; std::string valid_access_token_fetch_response_; network::TestURLLoaderFactory test_url_loader_factory_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: scoped_refptr<network::SharedURLLoaderFactory> shared_factory_; @@ -226,7 +226,7 @@ EXPECT_THAT(GetUploadData(request), ::testing::HasSubstr(base::JoinString(scopes, "+"))); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); })); RunFetcher("a,b"); } @@ -244,7 +244,7 @@ EXPECT_THAT(GetUploadData(request), ::testing::HasSubstr(base::JoinString(scopes, "+"))); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); })); RunFetcher(" a , b "); } @@ -262,7 +262,7 @@ EXPECT_THAT(GetUploadData(request), ::testing::HasSubstr(base::JoinString(scopes, "+"))); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); })); RunFetcher("a,b,,"); } @@ -279,7 +279,7 @@ EXPECT_THAT(GetUploadData(request), ::testing::HasSubstr(base::JoinString(scopes, "+"))); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); })); RunFetcher(""); }
diff --git a/chrome/browser/ui/test/test_browser_dialog.cc b/chrome/browser/ui/test/test_browser_dialog.cc index 6a6cb50..662cb218 100644 --- a/chrome/browser/ui/test/test_browser_dialog.cc +++ b/chrome/browser/ui/test/test_browser_dialog.cc
@@ -10,6 +10,7 @@ #include "base/stl_util.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" +#include "chrome/test/pixel/browser_skia_gold_pixel_diff.h" #include "testing/gtest/include/gtest/gtest.h" #if defined(OS_CHROMEOS) @@ -21,6 +22,7 @@ #endif #if defined(TOOLKIT_VIEWS) +#include "base/strings/strcat.h" #include "ui/display/display.h" #include "ui/display/screen.h" #include "ui/views/test/widget_test.h" @@ -53,17 +55,43 @@ DISALLOW_COPY_AND_ASSIGN(WidgetCloser); }; + +class CompositorObserverEnd : public ui::CompositorObserver { + public: + void OnCompositingEnded(ui::Compositor* compositor) override { + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, + run_loop_.QuitClosure()); + } + void WaitForComplete() { run_loop_.Run(); } + + private: + base::RunLoop run_loop_; +}; + #endif // defined(TOOLKIT_VIEWS) } // namespace -TestBrowserDialog::TestBrowserDialog() = default; +TestBrowserDialog::TestBrowserDialog() : TestBrowserUi() { + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + "browser-ui-tests-verify-pixels")) { + pixel_diff_ = std::make_unique<BrowserSkiaGoldPixelDiff>(); + } +} + TestBrowserDialog::~TestBrowserDialog() = default; void TestBrowserDialog::PreShow() { UpdateWidgets(); } +void CompareAsync(const BrowserSkiaGoldPixelDiff* pixel_diff, + const std::string& name, + const views::View* view, + bool* result) { + *result = pixel_diff->CompareScreenshot(name, view); +} + // This returns true if exactly one views widget was shown that is a dialog or // has a name matching the test-specified name, and if that window is in the // work area (if |should_verify_dialog_bounds_| is true). @@ -87,13 +115,41 @@ if (added.size() != 1) return false; + views::Widget* dialog_widget = *(added.begin()); +// TODO(https://crbug.com/958242) support Mac for pixel tests. +#if !defined(OS_MACOSX) + if (pixel_diff_) { + // Wait for painting complete. + auto* compositor = dialog_widget->GetNativeView()->layer()->GetCompositor(); + CompositorObserverEnd obend; + compositor->AddObserver(&obend); + obend.WaitForComplete(); + compositor->RemoveObserver(&obend); + + base::ScopedAllowBlockingForTesting allow_blocking; + pixel_diff_->Init(dialog_widget, "BrowserUiDialog"); + auto* test_info = testing::UnitTest::GetInstance()->current_test_info(); + const std::string test_name = + base::StrCat({test_info->test_case_name(), "_", test_info->name()}); + bool result = false; + base::RunLoop run_loop; + base::ThreadTaskRunnerHandle::Get()->PostTaskAndReply( + FROM_HERE, + base::BindOnce(CompareAsync, pixel_diff_.get(), test_name, + dialog_widget->GetContentsView(), &result), + run_loop.QuitClosure()); + run_loop.Run(); + if (!result) + return false; + } +#endif // OS_MACOSX + if (!should_verify_dialog_bounds_) return true; // Verify that the dialog's dimensions do not exceed the display's work area // bounds, which may be smaller than its bounds(), e.g. in the case of the // docked magnifier or Chromevox being enabled. - views::Widget* dialog_widget = *(added.begin()); const gfx::Rect dialog_bounds = dialog_widget->GetWindowBoundsInScreen(); gfx::NativeWindow native_window = dialog_widget->GetNativeWindow(); DCHECK(native_window);
diff --git a/chrome/browser/ui/test/test_browser_dialog.h b/chrome/browser/ui/test/test_browser_dialog.h index c4a4c14..ecda917 100644 --- a/chrome/browser/ui/test/test_browser_dialog.h +++ b/chrome/browser/ui/test/test_browser_dialog.h
@@ -13,6 +13,8 @@ #include "ui/views/widget/widget.h" #endif +class BrowserSkiaGoldPixelDiff; + // A dialog-specific subclass of TestBrowserUi, which will verify that a test // showed a single dialog. class TestBrowserDialog : public TestBrowserUi { @@ -55,6 +57,9 @@ // This should always be true, but some dialogs don't yet size themselves // properly. https://crbug.com/893292. bool should_verify_dialog_bounds_ = true; + // If this variable is set, VerifyUi will verify pixel correctness for + // the dialog. + std::unique_ptr<BrowserSkiaGoldPixelDiff> pixel_diff_; DISALLOW_COPY_AND_ASSIGN(TestBrowserDialog); };
diff --git a/chrome/browser/ui/thumbnails/thumbnail_image_unittest.cc b/chrome/browser/ui/thumbnails/thumbnail_image_unittest.cc index b74ee32e..2b34a6a 100644 --- a/chrome/browser/ui/thumbnails/thumbnail_image_unittest.cc +++ b/chrome/browser/ui/thumbnails/thumbnail_image_unittest.cc
@@ -84,7 +84,7 @@ } bool is_being_observed_ = false; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(ThumbnailImageTest); };
diff --git a/chrome/browser/ui/ui_features.cc b/chrome/browser/ui/ui_features.cc index 76572a0..a4cb9e4e 100644 --- a/chrome/browser/ui/ui_features.cc +++ b/chrome/browser/ui/ui_features.cc
@@ -29,6 +29,11 @@ const base::Feature kNewTabstripAnimation{"NewTabstripAnimation", base::FEATURE_ENABLED_BY_DEFAULT}; +// Enables the new version of the profile menu(aka user menu). +// https://crbug.com/966388 +const base::Feature kProfileMenuRevamp{"ProfileMenuRevamp", + base::FEATURE_DISABLED_BY_DEFAULT}; + // Enables tabs to scroll in the tabstrip. https://crbug.com/951078 const base::Feature kScrollableTabStrip{"ScrollableTabStrip", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/browser/ui/ui_features.h b/chrome/browser/ui/ui_features.h index 72a2fa58d..abb5403 100644 --- a/chrome/browser/ui/ui_features.h +++ b/chrome/browser/ui/ui_features.h
@@ -27,6 +27,8 @@ extern const base::Feature kNewTabstripAnimation; +extern const base::Feature kProfileMenuRevamp; + extern const base::Feature kScrollableTabStrip; extern const base::Feature kShowSyncPausedReasonCookiesClearedOnExit;
diff --git a/chrome/browser/ui/views/autofill/payments/save_card_icon_view.cc b/chrome/browser/ui/views/autofill/payments/save_card_icon_view.cc index f6456f5..3f50598 100644 --- a/chrome/browser/ui/views/autofill/payments/save_card_icon_view.cc +++ b/chrome/browser/ui/views/autofill/payments/save_card_icon_view.cc
@@ -72,11 +72,7 @@ } SaveCardBubbleController* SaveCardIconView::GetController() const { - content::WebContents* web_contents = GetWebContents(); - if (!web_contents) - return nullptr; - - return SaveCardBubbleController::GetOrCreate(web_contents); + return SaveCardBubbleController::Get(GetWebContents()); } void SaveCardIconView::AnimationEnded(const gfx::Animation* animation) {
diff --git a/chrome/browser/ui/views/crostini/crostini_installer_view.cc b/chrome/browser/ui/views/crostini/crostini_installer_view.cc index 8b6bc04..82ce07d 100644 --- a/chrome/browser/ui/views/crostini/crostini_installer_view.cc +++ b/chrome/browser/ui/views/crostini/crostini_installer_view.cc
@@ -10,17 +10,30 @@ #include "ash/public/cpp/ash_typography.h" #include "base/bind.h" #include "base/metrics/histogram_functions.h" +#include "base/metrics/histogram_macros.h" +#include "base/numerics/ranges.h" +#include "base/strings/string_util.h" +#include "base/strings/utf_string_conversions.h" +#include "base/task/post_task.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/crostini/crostini_installer.h" -#include "chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h" #include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" +#include "chrome/browser/chromeos/crostini/crostini_terminal.h" +#include "chrome/browser/chromeos/crostini/crostini_util.h" +#include "chrome/browser/chromeos/login/startup_utils.h" +#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/common/url_constants.h" #include "chrome/grit/chrome_unscaled_resources.h" #include "chrome/grit/generated_resources.h" +#include "components/account_id/account_id.h" +#include "components/prefs/pref_service.h" #include "components/strings/grit/components_strings.h" +#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/network_service_instance.h" +#include "services/network/public/cpp/network_connection_tracker.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/text/bytes_formatting.h" @@ -39,11 +52,18 @@ using crostini::CrostiniResult; namespace { - -using Error = crostini::CrostiniInstallerUIDelegate::Error; - CrostiniInstallerView* g_crostini_installer_view = nullptr; +// The size of the download for the VM image. +// TODO(timloh): This is just a placeholder. +constexpr int kDownloadSizeInBytes = 300 * 1024 * 1024; +// The minimum feasible size for a VM disk image. +constexpr int64_t kMinimumDiskSize = 1ll * 1024 * 1024 * 1024; // 1 GiB +// Minimum amount of free disk space to install crostini successfully. +constexpr int kMinimumFreeDiskSpace = kDownloadSizeInBytes + kMinimumDiskSize; + +constexpr int kUninitializedDiskSpace = -1; + constexpr gfx::Insets kOOBEButtonRowInsets(32, 64, 32, 64); constexpr int kOOBEWindowWidth = 768; // TODO(timloh): The button row's preferred height (48px) adds to this. I'm not @@ -53,7 +73,19 @@ constexpr int kLinuxIllustrationWidth = 448; constexpr int kLinuxIllustrationHeight = 180; +constexpr char kCrostiniSetupResultHistogram[] = "Crostini.SetupResult"; constexpr char kCrostiniSetupSourceHistogram[] = "Crostini.SetupSource"; +constexpr char kCrostiniTimeFromDeviceSetupToInstall[] = + "Crostini.TimeFromDeviceSetupToInstall"; +constexpr char kCrostiniDiskImageSizeHistogram[] = "Crostini.DiskImageSize"; +constexpr char kCrostiniTimeToInstallSuccess[] = + "Crostini.TimeToInstallSuccess"; +constexpr char kCrostiniTimeToInstallCancel[] = "Crostini.TimeToInstallCancel"; +constexpr char kCrostiniTimeToInstallError[] = "Crostini.TimeToInstallError"; +constexpr char kCrostiniAvailableDiskSuccess[] = + "Crostini.AvailableDiskSuccess"; +constexpr char kCrostiniAvailableDiskCancel[] = "Crostini.AvailableDiskCancel"; +constexpr char kCrostiniAvailableDiskError[] = "Crostini.AvailableDiskError"; // Generates a Google Help URL which includes a "board type" parameter. Some // help pages need to be adjusted depending on the type of CrOS device that is @@ -63,45 +95,19 @@ "&b=" + base::SysInfo::GetLsbReleaseBoard()); } -base::string16 GetErrorMessage(Error error) { - switch (error) { - case Error::ERROR_LOADING_TERMINA: - return l10n_util::GetStringUTF16( - IDS_CROSTINI_INSTALLER_LOAD_TERMINA_ERROR); - case Error::ERROR_STARTING_CONCIERGE: - return l10n_util::GetStringUTF16( - IDS_CROSTINI_INSTALLER_START_CONCIERGE_ERROR); - case Error::ERROR_CREATING_DISK_IMAGE: - return l10n_util::GetStringUTF16( - IDS_CROSTINI_INSTALLER_CREATE_DISK_IMAGE_ERROR); - case Error::ERROR_STARTING_TERMINA: - return l10n_util::GetStringUTF16( - IDS_CROSTINI_INSTALLER_START_TERMINA_VM_ERROR); - case Error::ERROR_STARTING_CONTAINER: - return l10n_util::GetStringUTF16( - IDS_CROSTINI_INSTALLER_START_CONTAINER_ERROR); - case Error::ERROR_OFFLINE: - return l10n_util::GetStringFUTF16(IDS_CROSTINI_INSTALLER_OFFLINE_ERROR, - ui::GetChromeOSDeviceName()); - case Error::ERROR_FETCHING_SSH_KEYS: - return l10n_util::GetStringUTF16( - IDS_CROSTINI_INSTALLER_FETCH_SSH_KEYS_ERROR); - case Error::ERROR_MOUNTING_CONTAINER: - return l10n_util::GetStringUTF16( - IDS_CROSTINI_INSTALLER_MOUNT_CONTAINER_ERROR); - case Error::ERROR_SETTING_UP_CONTAINER: - return l10n_util::GetStringUTF16( - IDS_CROSTINI_INSTALLER_SETUP_CONTAINER_ERROR); - case Error::ERROR_INSUFFICIENT_DISK_SPACE: - return l10n_util::GetStringFUTF16( - IDS_CROSTINI_INSTALLER_INSUFFICIENT_DISK, - ui::FormatBytesWithUnits( - crostini::CrostiniInstallerUIDelegate::kMinimumFreeDiskSpace, - ui::DATA_UNITS_GIBIBYTE, - /*show_units=*/true)); - default: - return {}; - } +void RecordTimeFromDeviceSetupToInstallMetric() { + base::PostTaskAndReplyWithResult( + FROM_HERE, {base::ThreadPool(), base::MayBlock()}, + base::BindOnce(&chromeos::StartupUtils::GetTimeSinceOobeFlagFileCreation), + base::BindOnce([](base::TimeDelta time_from_device_setup) { + if (time_from_device_setup.is_zero()) + return; + + base::UmaHistogramCustomTimes(kCrostiniTimeFromDeviceSetupToInstall, + time_from_device_setup, + base::TimeDelta::FromMinutes(1), + base::TimeDelta::FromDays(365), 50); + })); } } // namespace @@ -116,42 +122,42 @@ } base::UmaHistogramEnumeration(kCrostiniSetupSourceHistogram, ui_surface, crostini::CrostiniUISurface::kCount); - return CrostiniInstallerView::Show( - profile, crostini::CrostiniInstaller::GetForProfile(profile)); + return CrostiniInstallerView::Show(profile); } -// static -void CrostiniInstallerView::Show( - Profile* profile, - crostini::CrostiniInstallerUIDelegate* delegate) { +void CrostiniInstallerView::Show(Profile* profile) { DCHECK(crostini::IsCrostiniUIAllowedForProfile(profile)); if (!g_crostini_installer_view) { - g_crostini_installer_view = new CrostiniInstallerView(profile, delegate); + g_crostini_installer_view = new CrostiniInstallerView(profile); views::DialogDelegate::CreateDialogWidget(g_crostini_installer_view, nullptr, nullptr); - - g_crostini_installer_view->GetDialogClientView()->SetButtonRowInsets( - kOOBEButtonRowInsets); - // We do our layout when the big message is at its biggest. Then we can - // set it to the desired value. - g_crostini_installer_view->big_message_label_->SetText( - l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_INSTALLING)); - g_crostini_installer_view->GetWidget()->GetRootView()->Layout(); - const base::string16 device_type = ui::GetChromeOSDeviceName(); - g_crostini_installer_view->big_message_label_->SetText( - l10n_util::GetStringFUTF16(IDS_CROSTINI_INSTALLER_TITLE, device_type)); - - // TODO(lxj): Move installer status tracking into the CrostiniInstaller. - crostini::CrostiniManager::GetForProfile(profile)->SetInstallerViewStatus( - true); } - + g_crostini_installer_view->GetDialogClientView()->SetButtonRowInsets( + kOOBEButtonRowInsets); + g_crostini_installer_view->GetWidget()->GetRootView()->Layout(); + // We do our layout when the big message is at its biggest. Then we can + // set it to the desired value. + g_crostini_installer_view->SetBigMessageLabel(); g_crostini_installer_view->GetWidget()->Show(); + + crostini::CrostiniManager::GetForProfile(profile)->SetInstallerViewStatus( + true); + + base::PostTaskAndReplyWithResult( + FROM_HERE, + {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE}, + base::BindOnce(&base::SysInfo::AmountOfFreeDiskSpace, + base::FilePath(crostini::kHomeDirectory)), + base::BindOnce( + &CrostiniInstallerView::OnAvailableDiskSpace, + g_crostini_installer_view->weak_ptr_factory_.GetWeakPtr())); } -// static -CrostiniInstallerView* CrostiniInstallerView::GetActiveViewForTesting() { - return g_crostini_installer_view; +void CrostiniInstallerView::OnAvailableDiskSpace(int64_t bytes) { + free_disk_space_ = bytes; + if (free_disk_space_callback_for_testing_) { + std::move(free_disk_space_callback_for_testing_).Run(); + } } int CrostiniInstallerView::GetDialogButtons() const { @@ -170,7 +176,7 @@ return l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_INSTALL_BUTTON); } DCHECK_EQ(button, ui::DIALOG_BUTTON_CANCEL); - if (state_ == State::SUCCESS) + if (state_ == State::INSTALL_END) return l10n_util::GetStringUTF16(IDS_APP_CLOSE); return l10n_util::GetStringUTF16(IDS_APP_CANCEL); } @@ -178,7 +184,7 @@ bool CrostiniInstallerView::IsDialogButtonEnabled( ui::DialogButton button) const { if (button == ui::DIALOG_BUTTON_CANCEL && - (state_ == State::CANCELING || state_ == State::CANCELED)) { + (state_ == State::CLEANUP || state_ == State::CLEANUP_FINISHED)) { return false; } return true; @@ -192,58 +198,125 @@ return false; } +void CrostiniInstallerView::PressAccept() { + GetDialogClientView()->AcceptWindow(); +} + bool CrostiniInstallerView::Accept() { // This dialog can be accepted from State::ERROR. In that case, we're doing a // Retry. DCHECK(state_ == State::PROMPT || state_ == State::ERROR); + // Delay starting the install process until we can check if there's enough + // disk space. + if (free_disk_space_ == kUninitializedDiskSpace) { + base::PostDelayedTask(FROM_HERE, {content::BrowserThread::UI}, + base::BindOnce(&CrostiniInstallerView::PressAccept, + weak_ptr_factory_.GetWeakPtr()), + base::TimeDelta::FromMilliseconds(50)); + return false; + } + + UpdateState(State::INSTALL_START); + install_start_time_ = base::TimeTicks::Now(); + + // The default value of kCrostiniContainers is set to migrate existing + // crostini users who don't have the pref set. If crostini is being installed, + // then we know the user must not actually have any containers yet, so we set + // this pref to the empty list. + profile_->GetPrefs()->Set(crostini::prefs::kCrostiniContainers, + base::Value(base::Value::Type::LIST)); + // |learn_more_link_| should only be present in State::PROMPT. delete learn_more_link_; learn_more_link_ = nullptr; - state_ = State::INSTALLING; - progress_bar_->SetValue(0); - progress_bar_->SetVisible(true); - message_label_->SetVisible(false); - big_message_label_->SetText( - l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_INSTALLING)); - DialogModelChanged(); - GetWidget()->GetRootView()->Layout(); + // HandleError needs the |progress_bar_|, so we delay our Offline check until + // it exists. + if (content::GetNetworkConnectionTracker()->IsOffline()) { + const base::string16 device_type = ui::GetChromeOSDeviceName(); + HandleError(l10n_util::GetStringFUTF16(IDS_CROSTINI_INSTALLER_OFFLINE_ERROR, + device_type), + SetupResult::kErrorOffline); + return false; // should not close the dialog. + } - VLOG(1) << "delegate_->Install()"; - delegate_->Install( - base::BindRepeating(&CrostiniInstallerView::OnProgressUpdate, - weak_ptr_factory_.GetWeakPtr()), - base::BindOnce(&CrostiniInstallerView::OnInstallFinished, - weak_ptr_factory_.GetWeakPtr())); + // Don't enforce minimum disk size on dev box or trybots because + // base::SysInfo::AmountOfFreeDiskSpace returns zero in testing. + if (free_disk_space_ < kMinimumFreeDiskSpace && + base::SysInfo::IsRunningOnChromeOS()) { + HandleError(l10n_util::GetStringFUTF16( + IDS_CROSTINI_INSTALLER_INSUFFICIENT_DISK, + ui::FormatBytesWithUnits(kMinimumFreeDiskSpace, + ui::DATA_UNITS_GIBIBYTE, + /*show_units=*/true)), + SetupResult::kErrorInsufficientDiskSpace); + return false; // should not close the dialog. + } + // Kick off the Crostini Restart sequence. We will be added as an observer. + restart_id_ = + crostini::CrostiniManager::GetForProfile(profile_)->RestartCrostini( + crostini::kCrostiniDefaultVmName, + crostini::kCrostiniDefaultContainerName, + base::BindOnce(&CrostiniInstallerView::MountContainerFinished, + weak_ptr_factory_.GetWeakPtr()), + this); + UpdateState(State::INSTALL_IMAGE_LOADER); return false; } bool CrostiniInstallerView::Cancel() { - switch (state_) { - case State::PROMPT: - delegate_->CancelBeforeStart(); - return true; - case State::INSTALLING: - state_ = State::CANCELING; - big_message_label_->SetText( - l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_CANCELING_TITLE)); - message_label_->SetText( - l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_CANCELING)); - message_label_->SetVisible(true); - progress_bar_->SetValue(-1); - progress_bar_->SetVisible(true); - DialogModelChanged(); - GetWidget()->GetRootView()->Layout(); - delegate_->Cancel(base::BindOnce(&CrostiniInstallerView::OnCanceled, - weak_ptr_factory_.GetWeakPtr())); - return false; - case State::CANCELING: - return false; - default: - return true; // Close the dialog. + if (!has_logged_timing_result_ && + (restart_id_ != crostini::CrostiniManager::kUninitializedRestartId || + state_ == State::INSTALL_START)) { + UMA_HISTOGRAM_LONG_TIMES(kCrostiniTimeToInstallCancel, + base::TimeTicks::Now() - install_start_time_); + has_logged_timing_result_ = true; } + if (!has_logged_free_disk_result_ && + (restart_id_ != crostini::CrostiniManager::kUninitializedRestartId || + state_ == State::INSTALL_START) && + free_disk_space_ != kUninitializedDiskSpace) { + base::UmaHistogramCounts1M(kCrostiniAvailableDiskCancel, + free_disk_space_ >> 20); + has_logged_free_disk_result_ = true; + } + if (state_ != State::INSTALL_END && state_ != State::CLEANUP && + state_ != State::CLEANUP_FINISHED && + restart_id_ != crostini::CrostiniManager::kUninitializedRestartId) { + // Abort the long-running flow, and prevent our RestartObserver methods + // being called after "this" has been destroyed. + crostini::CrostiniManager::GetForProfile(profile_)->AbortRestartCrostini( + restart_id_, base::DoNothing()); + + SetupResult result = SetupResult::kUserCancelledStart; + result = static_cast<SetupResult>(static_cast<int>(result) + + static_cast<int>(state_) - + static_cast<int>(State::INSTALL_START)); + RecordSetupResultHistogram(result); + + if (do_cleanup_) { + // Remove anything that got installed + base::PostTask( + FROM_HERE, {content::BrowserThread::UI}, + base::BindOnce( + &crostini::CrostiniManager::RemoveCrostini, + base::Unretained( + crostini::CrostiniManager::GetForProfile(profile_)), + crostini::kCrostiniDefaultVmName, + base::BindOnce(&CrostiniInstallerView::FinishCleanup, + weak_ptr_factory_.GetWeakPtr()))); + UpdateState(State::CLEANUP); + } + return !do_cleanup_; + } else if (state_ == State::CLEANUP) { + return false; + } else if (restart_id_ == + crostini::CrostiniManager::kUninitializedRestartId) { + RecordSetupResultHistogram(SetupResult::kNotStarted); + } + return true; // Should close the dialog } gfx::Size CrostiniInstallerView::CalculatePreferredSize() const { @@ -260,10 +333,167 @@ Navigate(¶ms); } -CrostiniInstallerView::CrostiniInstallerView( - Profile* profile, - crostini::CrostiniInstallerUIDelegate* delegate) - : profile_(profile), delegate_(delegate), weak_ptr_factory_(this) { +void CrostiniInstallerView::OnComponentLoaded(CrostiniResult result) { + DCHECK_EQ(state_, State::INSTALL_IMAGE_LOADER); + + if (result != CrostiniResult::SUCCESS) { + if (content::GetNetworkConnectionTracker()->IsOffline()) { + LOG(ERROR) << "Network connection dropped while downloading cros-termina"; + const base::string16 device_type = ui::GetChromeOSDeviceName(); + HandleError(l10n_util::GetStringFUTF16( + IDS_CROSTINI_INSTALLER_OFFLINE_ERROR, device_type), + SetupResult::kErrorOffline); + } else { + LOG(ERROR) << "Failed to install the cros-termina component"; + HandleError( + l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_LOAD_TERMINA_ERROR), + SetupResult::kErrorLoadingTermina); + } + return; + } + VLOG(1) << "cros-termina install success"; + UpdateState(State::START_CONCIERGE); +} + +void CrostiniInstallerView::OnConciergeStarted(bool success) { + DCHECK_EQ(state_, State::START_CONCIERGE); + if (!success) { + HandleError( + l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_START_CONCIERGE_ERROR), + SetupResult::kErrorStartingConcierge); + return; + } + VLOG(1) << "Concierge service started"; + UpdateState(State::CREATE_DISK_IMAGE); +} + +void CrostiniInstallerView::OnDiskImageCreated( + bool success, + vm_tools::concierge::DiskImageStatus status, + int64_t disk_size_available) { + DCHECK_EQ(state_, State::CREATE_DISK_IMAGE); + if (status == vm_tools::concierge::DiskImageStatus::DISK_STATUS_EXISTS) { + do_cleanup_ = false; + } else if (success) { + // Record the max space for the disk image at creation time, measured in GiB + base::UmaHistogramCustomCounts(kCrostiniDiskImageSizeHistogram, + disk_size_available >> 30, 1, 1024, 64); + } + if (!success) { + HandleError(l10n_util::GetStringUTF16( + IDS_CROSTINI_INSTALLER_CREATE_DISK_IMAGE_ERROR), + SetupResult::kErrorCreatingDiskImage); + return; + } + VLOG(1) << "Created crostini disk image"; + UpdateState(State::START_TERMINA_VM); +} + +void CrostiniInstallerView::OnVmStarted(bool success) { + DCHECK_EQ(state_, State::START_TERMINA_VM); + if (!success) { + HandleError(l10n_util::GetStringUTF16( + IDS_CROSTINI_INSTALLER_START_TERMINA_VM_ERROR), + SetupResult::kErrorStartingTermina); + return; + } + VLOG(1) << "Started Termina VM successfully"; + UpdateState(State::CREATE_CONTAINER); +} + +void CrostiniInstallerView::OnContainerDownloading(int32_t download_percent) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + DCHECK_EQ(state_, State::CREATE_CONTAINER); + container_download_percent_ = base::ClampToRange(download_percent, 0, 100); + StepProgress(); +} + +void CrostiniInstallerView::OnContainerCreated(CrostiniResult result) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + DCHECK_EQ(state_, State::CREATE_CONTAINER); + UpdateState(State::SETUP_CONTAINER); +} + +void CrostiniInstallerView::OnContainerSetup(bool success) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + DCHECK_EQ(state_, State::SETUP_CONTAINER); + + if (!success) { + if (content::GetNetworkConnectionTracker()->IsOffline()) { + LOG(ERROR) << "Network connection dropped while downloading container"; + const base::string16 device_type = ui::GetChromeOSDeviceName(); + HandleError(l10n_util::GetStringFUTF16( + IDS_CROSTINI_INSTALLER_OFFLINE_ERROR, device_type), + SetupResult::kErrorOffline); + } else { + HandleError(l10n_util::GetStringUTF16( + IDS_CROSTINI_INSTALLER_SETUP_CONTAINER_ERROR), + SetupResult::kErrorSettingUpContainer); + } + return; + } + VLOG(1) << "Set up container successfully"; + UpdateState(State::START_CONTAINER); +} + +void CrostiniInstallerView::OnContainerStarted(CrostiniResult result) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + DCHECK_EQ(state_, State::START_CONTAINER); + + if (result != CrostiniResult::SUCCESS) { + LOG(ERROR) << "Failed to start container with error code: " + << static_cast<int>(result); + HandleError( + l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_START_CONTAINER_ERROR), + SetupResult::kErrorStartingContainer); + return; + } + VLOG(1) << "Started container successfully"; + UpdateState(State::FETCH_SSH_KEYS); +} + +void CrostiniInstallerView::OnSshKeysFetched(bool success) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + DCHECK_EQ(state_, State::FETCH_SSH_KEYS); + + if (!success) { + HandleError( + l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_FETCH_SSH_KEYS_ERROR), + SetupResult::kErrorFetchingSshKeys); + return; + } + VLOG(1) << "Fetched ssh keys successfully"; + UpdateState(State::MOUNT_CONTAINER); +} + +// static +CrostiniInstallerView* CrostiniInstallerView::GetActiveViewForTesting() { + return g_crostini_installer_view; +} + +void CrostiniInstallerView::SetCloseCallbackForTesting( + base::OnceClosure quit_closure) { + quit_closure_for_testing_ = std::move(quit_closure); +} + +void CrostiniInstallerView::SetProgressBarCallbackForTesting( + base::RepeatingCallback<void(double)> callback) { + progress_bar_callback_for_testing_ = callback; +} + +void CrostiniInstallerView::SetGetFreeDiskSpaceCallbackForTesting( + base::OnceClosure quit_closure) { + if (free_disk_space_ == kUninitializedDiskSpace) { + free_disk_space_callback_for_testing_ = std::move(quit_closure); + } else { + std::move(free_disk_space_callback_for_testing_).Run(); + } +} + +CrostiniInstallerView::CrostiniInstallerView(Profile* profile) + : profile_(profile), + free_disk_space_(kUninitializedDiskSpace), + weak_ptr_factory_(this) { // Layout constants from the spec. constexpr gfx::Insets kDialogInsets(60, 64, 0, 64); constexpr int kDialogSpacingVertical = 32; @@ -297,8 +527,9 @@ const base::string16 device_type = ui::GetChromeOSDeviceName(); - big_message_label_ = - new views::Label({}, ash::AshTextContext::CONTEXT_HEADLINE_OVERSIZED); + big_message_label_ = new views::Label( + l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_INSTALLING), + ash::AshTextContext::CONTEXT_HEADLINE_OVERSIZED); big_message_label_->SetMultiLine(true); big_message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); upper_container_view->AddChildView(big_message_label_); @@ -307,10 +538,8 @@ // the UI has been fleshed out more. const base::string16 message = l10n_util::GetStringFUTF16( IDS_CROSTINI_INSTALLER_BODY, - ui::FormatBytesWithUnits( - crostini::CrostiniInstallerUIDelegate::kDownloadSizeInBytes, - ui::DATA_UNITS_MEBIBYTE, - /*show_units=*/true)); + ui::FormatBytesWithUnits(kDownloadSizeInBytes, ui::DATA_UNITS_MEBIBYTE, + /*show_units=*/true)); // Make a view to keep |message_label_| and |learn_more_link_| together with // less vertical spacing than the other dialog views. @@ -354,96 +583,287 @@ crostini::CrostiniManager::GetForProfile(profile_)->SetInstallerViewStatus( false); g_crostini_installer_view = nullptr; -} - -void CrostiniInstallerView::OnProgressUpdate(InstallationState installing_state, - double progress_fraction) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DCHECK_EQ(state_, State::INSTALLING); - if (installing_state_ != installing_state) { - installing_state_ = installing_state; - SetMessageLabel(); + if (quit_closure_for_testing_) { + std::move(quit_closure_for_testing_).Run(); } - // |progress_bar_| has been set visible in |Accept()|. - progress_bar_->SetValue(progress_fraction); - - DialogModelChanged(); - GetWidget()->GetRootView()->Layout(); } -void CrostiniInstallerView::OnInstallFinished(Error error) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - if (error == Error::NONE) { - state_ = State::SUCCESS; - GetWidget()->Close(); - return; +void CrostiniInstallerView::FinishCleanup(CrostiniResult result) { + if (result != CrostiniResult::SUCCESS) { + LOG(ERROR) << "Failed to cleanup aborted crostini install"; } - - state_ = State::ERROR; - big_message_label_->SetText( - l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_ERROR_TITLE)); - message_label_->SetText(GetErrorMessage(error)); - message_label_->SetVisible(true); - progress_bar_->SetVisible(false); - // Remove the buttons so they get recreated with correct color and - // highlighting. Without this it is possible for both buttons to be styled - // as default buttons. - delete GetDialogClientView()->ok_button(); - delete GetDialogClientView()->cancel_button(); - - DialogModelChanged(); - GetWidget()->GetRootView()->Layout(); -} - -void CrostiniInstallerView::OnCanceled() { - state_ = State::CANCELED; + // Need to do this because GetWidget()->Close() calls Cancel(), and we don't + // want to restart the cleanup process + UpdateState(State::CLEANUP_FINISHED); GetWidget()->Close(); } -void CrostiniInstallerView::SetMessageLabel() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - int message_id = 0; +void CrostiniInstallerView::HandleError(const base::string16& error_message, + SetupResult result) { + // Only ever set the error once. This check is necessary as the + // CrostiniManager can give multiple error callbacks. Only the first should be + // shown to the user. + if (state_ == State::ERROR) + return; - switch (installing_state_) { - case InstallationState::INSTALL_IMAGE_LOADER: + if (!has_logged_timing_result_) { + UMA_HISTOGRAM_LONG_TIMES(kCrostiniTimeToInstallError, + base::TimeTicks::Now() - install_start_time_); + has_logged_timing_result_ = true; + } + if (!has_logged_free_disk_result_ && + free_disk_space_ != kUninitializedDiskSpace) { + base::UmaHistogramCounts1M(kCrostiniAvailableDiskError, + free_disk_space_ >> 20); + has_logged_free_disk_result_ = true; + } + + RecordSetupResultHistogram(result); + restart_id_ = crostini::CrostiniManager::kUninitializedRestartId; + UpdateState(State::ERROR); + message_label_->SetVisible(true); + message_label_->SetText(error_message); + + // Remove the buttons so they get recreated with correct color and + // highlighting. Without this it is possible for both buttons to be styled as + // default buttons. + delete GetDialogClientView()->ok_button(); + delete GetDialogClientView()->cancel_button(); + DialogModelChanged(); + GetWidget()->GetRootView()->Layout(); +} + +void CrostiniInstallerView::MountContainerFinished(CrostiniResult result) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + if (result != CrostiniResult::SUCCESS) { + LOG(ERROR) << "Failed to mount container with error code: " + << static_cast<int>(result); + HandleError( + l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_MOUNT_CONTAINER_ERROR), + SetupResult::kErrorMountingContainer); + return; + } + ShowLoginShell(); +} + +void CrostiniInstallerView::ShowLoginShell() { + DCHECK_EQ(state_, State::MOUNT_CONTAINER); + UpdateState(State::SHOW_LOGIN_SHELL); + + crostini::LaunchContainerTerminal(profile_, crostini::kCrostiniDefaultVmName, + crostini::kCrostiniDefaultContainerName, + std::vector<std::string>()); + + RecordSetupResultHistogram(SetupResult::kSuccess); + crostini::CrostiniManager::GetForProfile(profile_) + ->UpdateLaunchMetricsForEnterpriseReporting(); + RecordTimeFromDeviceSetupToInstallMetric(); + if (!has_logged_timing_result_) { + UMA_HISTOGRAM_LONG_TIMES(kCrostiniTimeToInstallSuccess, + base::TimeTicks::Now() - install_start_time_); + has_logged_timing_result_ = true; + } + if (!has_logged_free_disk_result_ && + free_disk_space_ != kUninitializedDiskSpace) { + base::UmaHistogramCounts1M(kCrostiniAvailableDiskSuccess, + free_disk_space_ >> 20); + has_logged_free_disk_result_ = true; + } + GetWidget()->Close(); +} + +void CrostiniInstallerView::StepProgress() { + base::TimeDelta time_in_state = base::Time::Now() - state_start_time_; + + VLOG(1) << "state_ = " << static_cast<int>(state_); + + double state_start_mark = 0; + double state_end_mark = 0; + int state_max_seconds = 1; + + switch (state_) { + case State::INSTALL_START: + state_start_mark = 0; + state_end_mark = 0; + break; + case State::INSTALL_IMAGE_LOADER: + state_start_mark = 0.0; + state_end_mark = 0.25; + state_max_seconds = 30; + break; + case State::START_CONCIERGE: + state_start_mark = 0.25; + state_end_mark = 0.26; + break; + case State::CREATE_DISK_IMAGE: + state_start_mark = 0.26; + state_end_mark = 0.27; + break; + case State::START_TERMINA_VM: + state_start_mark = 0.27; + state_end_mark = 0.35; + state_max_seconds = 8; + break; + case State::CREATE_CONTAINER: + state_start_mark = 0.35; + state_end_mark = 0.90; + state_max_seconds = 180; + break; + case State::SETUP_CONTAINER: + state_start_mark = 0.90; + state_end_mark = 0.95; + state_max_seconds = 8; + break; + case State::START_CONTAINER: + state_start_mark = 0.95; + state_end_mark = 0.99; + state_max_seconds = 8; + break; + case State::FETCH_SSH_KEYS: + state_start_mark = 0.99; + state_end_mark = 1; + break; + case State::MOUNT_CONTAINER: + state_start_mark = 1; + state_end_mark = 1; + break; + + default: + break; + } + + if (State::INSTALL_START <= state_ && state_ < State::INSTALL_END) { + double state_fraction = time_in_state.InSecondsF() / state_max_seconds; + + if (state_ == State::CREATE_CONTAINER) { + // In CREATE_CONTAINER, consume half the progress bar with downloading, + // the rest with time. + state_fraction = + 0.5 * (state_fraction + 0.01 * container_download_percent_); + } + VLOG(1) << "start = " << state_start_mark << ", end = " << state_end_mark + << ", fraction = " << state_fraction; + progress_bar_->SetValue(state_start_mark + + base::ClampToRange(state_fraction, 0.0, 1.0) * + (state_end_mark - state_start_mark)); + progress_bar_->SetVisible(true); + if (progress_bar_callback_for_testing_) { + progress_bar_callback_for_testing_.Run(progress_bar_->current_value()); + } + } else if (state_ == State::CLEANUP) { + progress_bar_->SetValue(-1); + progress_bar_->SetVisible(true); + } else { + progress_bar_->SetVisible(false); + } + SetMessageLabel(); + SetBigMessageLabel(); + DialogModelChanged(); + GetWidget()->GetRootView()->Layout(); +} + +void CrostiniInstallerView::UpdateState(State new_state) { + state_start_time_ = base::Time::Now(); + state_ = new_state; + if (state_ == State::INSTALL_START) { + state_progress_timer_ = std::make_unique<base::RepeatingTimer>(); + state_progress_timer_->Start( + FROM_HERE, base::TimeDelta::FromMilliseconds(500), + base::BindRepeating(&CrostiniInstallerView::StepProgress, + weak_ptr_factory_.GetWeakPtr())); + } else if (state_ < State::INSTALL_START || state_ >= State::INSTALL_END) { + if (state_progress_timer_) { + VLOG(1) << "Killing timer, state_ = " << static_cast<int>(state_); + state_progress_timer_->AbandonAndStop(); + } + } + + StepProgress(); +} + +void CrostiniInstallerView::SetMessageLabel() { + int message_id = 0; + // The States below refer to stages that have completed. + // The messages selected refer to the next stage, now underway. + switch (state_) { + case State::INSTALL_IMAGE_LOADER: message_id = IDS_CROSTINI_INSTALLER_LOAD_TERMINA_MESSAGE; break; - case InstallationState::START_CONCIERGE: + case State::START_CONCIERGE: message_id = IDS_CROSTINI_INSTALLER_START_CONCIERGE_MESSAGE; break; - case InstallationState::CREATE_DISK_IMAGE: + case State::CREATE_DISK_IMAGE: message_id = IDS_CROSTINI_INSTALLER_CREATE_DISK_IMAGE_MESSAGE; break; - case InstallationState::START_TERMINA_VM: + case State::START_TERMINA_VM: message_id = IDS_CROSTINI_INSTALLER_START_TERMINA_VM_MESSAGE; break; - case InstallationState::CREATE_CONTAINER: - // TODO(lxj): we are using the same message as for |START_CONTAINER|, - // which is weird because user is going to see message "start container" - // then "setup container" and then "start container" again. + case State::CREATE_CONTAINER: message_id = IDS_CROSTINI_INSTALLER_START_CONTAINER_MESSAGE; break; - case InstallationState::SETUP_CONTAINER: + case State::START_CONTAINER: + message_id = IDS_CROSTINI_INSTALLER_START_CONTAINER_MESSAGE; + break; + case State::SETUP_CONTAINER: message_id = IDS_CROSTINI_INSTALLER_SETUP_CONTAINER_MESSAGE; break; - case InstallationState::START_CONTAINER: - message_id = IDS_CROSTINI_INSTALLER_START_CONTAINER_MESSAGE; - break; - case InstallationState::FETCH_SSH_KEYS: + case State::FETCH_SSH_KEYS: message_id = IDS_CROSTINI_INSTALLER_FETCH_SSH_KEYS_MESSAGE; break; - case InstallationState::MOUNT_CONTAINER: + case State::MOUNT_CONTAINER: message_id = IDS_CROSTINI_INSTALLER_MOUNT_CONTAINER_MESSAGE; break; + case State::CLEANUP: + message_id = IDS_CROSTINI_INSTALLER_CANCELING; + break; default: break; } if (message_id == 0) { message_label_->SetVisible(false); - } else { - message_label_->SetText(l10n_util::GetStringUTF16(message_id)); - message_label_->SetVisible(true); + return; } + + message_label_->SetText(l10n_util::GetStringUTF16(message_id)); + message_label_->SetVisible(true); +} + +void CrostiniInstallerView::SetBigMessageLabel() { + base::string16 message; + switch (state_) { + case State::PROMPT: { + const base::string16 device_type = ui::GetChromeOSDeviceName(); + message = + l10n_util::GetStringFUTF16(IDS_CROSTINI_INSTALLER_TITLE, device_type); + } break; + case State::ERROR: + message = l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_ERROR_TITLE); + break; + case State::INSTALL_END: + message = l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_COMPLETE); + break; + case State::CLEANUP: + message = + l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_CANCELING_TITLE); + break; + + default: + message = l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_INSTALLING); + break; + } + big_message_label_->SetText(message); + big_message_label_->SetVisible(true); +} + +void CrostiniInstallerView::RecordSetupResultHistogram(SetupResult result) { + // Prevent multiple results being logged for a given setup flow. This can + // happen due to multiple error callbacks happening in some cases, as well + // as the user being able to hit Cancel after any errors occur. + if (has_logged_result_) + return; + + base::UmaHistogramEnumeration(kCrostiniSetupResultHistogram, result, + SetupResult::kCount); + has_logged_result_ = true; }
diff --git a/chrome/browser/ui/views/crostini/crostini_installer_view.h b/chrome/browser/ui/views/crostini/crostini_installer_view.h index 6f1b1690..db41d71 100644 --- a/chrome/browser/ui/views/crostini/crostini_installer_view.h +++ b/chrome/browser/ui/views/crostini/crostini_installer_view.h
@@ -7,7 +7,10 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/chromeos/crostini/crostini_installer_ui_delegate.h" +#include "base/time/time.h" +#include "base/timer/timer.h" +#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "chrome/browser/component_updater/cros_component_installer_chromeos.h" #include "ui/views/controls/link_listener.h" #include "ui/views/window/dialog_delegate.h" @@ -18,16 +21,54 @@ class ProgressBar; } // namespace views +namespace crostini { +enum class CrostiniResult; +} // namespace crostini + class Profile; // The Crostini installer. Provides details about Crostini to the user and // installs it if the user chooses to do so. -class CrostiniInstallerView : public views::DialogDelegateView, - public views::LinkListener { +class CrostiniInstallerView + : public views::DialogDelegateView, + public views::LinkListener, + public crostini::CrostiniManager::RestartObserver { public: - static void Show(Profile* profile, - crostini::CrostiniInstallerUIDelegate* delegate); - static CrostiniInstallerView* GetActiveViewForTesting(); + // These values are persisted to logs. Entries should not be renumbered and + // numeric values should never be reused. + enum class SetupResult { + kNotStarted = 0, + + // Deprecated, use the more specific cancelled values further down + kUserCancelled = 1, + + kSuccess = 2, + kErrorLoadingTermina = 3, + kErrorStartingConcierge = 4, + kErrorCreatingDiskImage = 5, + kErrorStartingTermina = 6, + kErrorStartingContainer = 7, + kErrorOffline = 8, + kErrorFetchingSshKeys = 9, + kErrorMountingContainer = 10, + kErrorSettingUpContainer = 11, + kErrorInsufficientDiskSpace = 22, + + kUserCancelledStart = 12, + kUserCancelledInstallImageLoader = 13, + kUserCancelledStartConcierge = 14, + kUserCancelledCreateDiskImage = 15, + kUserCancelledStartTerminaVm = 16, + kUserCancelledCreateContainer = 17, + kUserCancelledStartContainer = 18, + kUserCancelledSetupContainer = 19, + kUserCancelledFetchSshKeys = 20, + kUserCancelledMountContainer = 21, + + kCount + }; + + static void Show(Profile* profile); // views::DialogDelegateView: int GetDialogButtons() const override; @@ -42,42 +83,94 @@ // views::LinkListener: void LinkClicked(views::Link* source, int event_flags) override; - private: - using InstallationState = - crostini::CrostiniInstallerUIDelegate::InstallationState; - using Error = crostini::CrostiniInstallerUIDelegate::Error; + // crostini::CrostiniManager::RestartObserver + void OnComponentLoaded(crostini::CrostiniResult result) override; + void OnConciergeStarted(bool success) override; + void OnDiskImageCreated(bool success, + vm_tools::concierge::DiskImageStatus status, + int64_t disk_size_available) override; + void OnVmStarted(bool success) override; + void OnContainerDownloading(int32_t download_percent) override; + void OnContainerCreated(crostini::CrostiniResult result) override; + void OnContainerSetup(bool success) override; + void OnContainerStarted(crostini::CrostiniResult result) override; + void OnSshKeysFetched(bool success) override; + static CrostiniInstallerView* GetActiveViewForTesting(); + void SetCloseCallbackForTesting(base::OnceClosure quit_closure); + void SetProgressBarCallbackForTesting( + base::RepeatingCallback<void(double)> callback); + void SetGetFreeDiskSpaceCallbackForTesting(base::OnceClosure quit_closure); + + private: enum class State { - PROMPT, - INSTALLING, - SUCCESS, - ERROR, - CANCELING, - CANCELED, + PROMPT, // Prompting the user to allow installation. + ERROR, // Something unexpected happened. + CLEANUP, // Deleting a partial installed + CLEANUP_FINISHED, // Finished deleting partial install + // We automatically progress through the following steps. + INSTALL_START, // The user has just clicked 'Install'. + INSTALL_IMAGE_LOADER, // Loading the Termina VM component. + START_CONCIERGE, // Starting the Concierge D-Bus client. + CREATE_DISK_IMAGE, // Creating the image for the Termina VM. + START_TERMINA_VM, // Starting the Termina VM. + CREATE_CONTAINER, // Creating the container inside the Termina VM. + START_CONTAINER, // Starting the container inside the Termina VM. + SETUP_CONTAINER, // Setting up the container inside the Termina VM. + FETCH_SSH_KEYS, // Fetch ssh keys from concierge. + MOUNT_CONTAINER, // Do sshfs mount of container. + SHOW_LOGIN_SHELL, // Showing a new crosh window. + INSTALL_END = SHOW_LOGIN_SHELL, // Marker enum for last install state. }; - explicit CrostiniInstallerView( - Profile* profile, - crostini::CrostiniInstallerUIDelegate* delegate); + explicit CrostiniInstallerView(Profile* profile); ~CrostiniInstallerView() override; - void OnProgressUpdate(InstallationState installing_state, - double progress_fraction); - void OnInstallFinished(Error error); - void OnCanceled(); + void FinishCleanup(crostini::CrostiniResult result); + void HandleError(const base::string16& error_message, SetupResult result); + void MountContainerFinished(crostini::CrostiniResult result); + void ShowLoginShell(); + void StepProgress(); + void UpdateState(State new_state); void SetMessageLabel(); + void SetBigMessageLabel(); + + void RecordSetupResultHistogram(SetupResult result); + + void OnAvailableDiskSpace(int64_t bytes); + + void PressAccept(); State state_ = State::PROMPT; - InstallationState installing_state_; - Profile* profile_; - crostini::CrostiniInstallerUIDelegate* delegate_; - views::ImageView* logo_image_ = nullptr; views::Label* big_message_label_ = nullptr; views::Label* message_label_ = nullptr; views::Link* learn_more_link_ = nullptr; views::ImageView* big_image_ = nullptr; views::ProgressBar* progress_bar_ = nullptr; + Profile* profile_; + crostini::CrostiniManager::RestartId restart_id_ = + crostini::CrostiniManager::kUninitializedRestartId; + int32_t container_download_percent_ = 0; + base::Time state_start_time_; + std::unique_ptr<base::RepeatingTimer> state_progress_timer_; + bool do_cleanup_ = true; + base::TimeTicks install_start_time_; + int64_t free_disk_space_; + + // Whether the result has been logged or not is stored to prevent multiple + // results being logged for a given setup flow. This can happen due to + // multiple error callbacks happening in some cases, as well as the user being + // able to hit Cancel after any errors occur. + bool has_logged_result_ = false; + + bool has_logged_timing_result_ = false; + + bool has_logged_free_disk_result_ = false; + + base::RepeatingCallback<void(double)> progress_bar_callback_for_testing_; + base::OnceClosure quit_closure_for_testing_; + base::OnceClosure free_disk_space_callback_for_testing_; base::WeakPtrFactory<CrostiniInstallerView> weak_ptr_factory_;
diff --git a/chrome/browser/ui/views/crostini/crostini_installer_view_browsertest.cc b/chrome/browser/ui/views/crostini/crostini_installer_view_browsertest.cc index 63178213..ea570262 100644 --- a/chrome/browser/ui/views/crostini/crostini_installer_view_browsertest.cc +++ b/chrome/browser/ui/views/crostini/crostini_installer_view_browsertest.cc
@@ -5,55 +5,144 @@ #include "chrome/browser/ui/views/crostini/crostini_installer_view.h" #include "base/bind.h" +#include "base/metrics/histogram_base.h" #include "base/run_loop.h" -#include "chrome/browser/chromeos/crostini/crostini_manager.h" +#include "base/test/metrics/histogram_tester.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" -#include "chrome/browser/chromeos/crostini/fake_crostini_installer_ui_delegate.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/app_list/app_list_client_impl.h" #include "chrome/browser/ui/app_list/crostini/crostini_app_model_builder.h" #include "chrome/browser/ui/app_list/test/chrome_app_list_test_support.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/crostini/crostini_browser_test_util.h" #include "chrome/grit/generated_resources.h" #include "chrome/test/base/in_process_browser_test.h" +#include "chromeos/dbus/cros_disks_client.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_concierge_client.h" +#include "chromeos/dbus/fake_cros_disks_client.h" +#include "chromeos/disks/disk_mount_manager.h" #include "components/crx_file/id_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/ui_base_types.h" #include "ui/views/window/dialog_client_view.h" -using Error = crostini::CrostiniInstallerUIDelegate::Error; -using InstallationState = - crostini::CrostiniInstallerUIDelegate::InstallationState; - class CrostiniInstallerViewBrowserTest : public CrostiniDialogBrowserTest { public: + class WaitingFakeConciergeClient : public chromeos::FakeConciergeClient { + public: + void StartTerminaVm( + const vm_tools::concierge::StartVmRequest& request, + chromeos::DBusMethodCallback<vm_tools::concierge::StartVmResponse> + callback) override { + chromeos::FakeConciergeClient::StartTerminaVm(request, + std::move(callback)); + if (closure_) { + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, + std::move(closure_)); + } + } + + void WaitForStartTerminaVmCalled() { + base::RunLoop loop; + closure_ = loop.QuitClosure(); + loop.Run(); + EXPECT_TRUE(start_termina_vm_called()); + } + + private: + base::OnceClosure closure_; + }; + + class WaitingDiskMountManagerObserver + : public chromeos::disks::DiskMountManager::Observer { + public: + void OnMountEvent(chromeos::disks::DiskMountManager::MountEvent event, + chromeos::MountError error_code, + const chromeos::disks::DiskMountManager::MountPointInfo& + mount_info) override { + run_loop_->Quit(); + } + + void WaitForMountEvent() { + chromeos::disks::DiskMountManager::GetInstance()->AddObserver(this); + run_loop_ = std::make_unique<base::RunLoop>(); + run_loop_->Run(); + } + + private: + std::unique_ptr<base::RunLoop> run_loop_; + }; + + class ProgressBarTracker { + public: + ProgressBarTracker() : progress_bar_position_(0.0) {} + void OnProgressBarUpdated(double value) { + EXPECT_LE(value, 1); + EXPECT_GE(value, progress_bar_position_); + EXPECT_GE(value, 0); + progress_bar_position_ = value; + } + + private: + double progress_bar_position_; + }; + CrostiniInstallerViewBrowserTest() - : CrostiniDialogBrowserTest(false /*register_termina*/) {} + : CrostiniDialogBrowserTest(true /*register_termina*/), + waiting_fake_concierge_client_(new WaitingFakeConciergeClient()), + waiting_disk_mount_manager_observer_( + new WaitingDiskMountManagerObserver) { + chromeos::DBusThreadManager::GetSetterForTesting()->SetConciergeClient( + base::WrapUnique(waiting_fake_concierge_client_)); + static_cast<chromeos::FakeCrosDisksClient*>( + chromeos::DBusThreadManager::Get()->GetCrosDisksClient()) + ->AddCustomMountPointCallback(base::BindRepeating( + &CrostiniInstallerViewBrowserTest::MaybeMountCrostini, + base::Unretained(this))); + } // CrostiniDialogBrowserTest: void ShowUi(const std::string& name) override { - CrostiniInstallerView::Show(browser()->profile(), &fake_delegate_); + ShowCrostiniInstallerView(browser()->profile(), + crostini::CrostiniUISurface::kSettings); + } + + void SetUpOnMainThread() override { + CrostiniDialogBrowserTest::SetUpOnMainThread(); } CrostiniInstallerView* ActiveView() { return CrostiniInstallerView::GetActiveViewForTesting(); } - bool HasEnabledAcceptButton() { - return ActiveView()->GetDialogClientView()->ok_button() != nullptr && - ActiveView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK); + bool HasAcceptButton() { + return ActiveView()->GetDialogClientView()->ok_button() != nullptr; } - bool HasEnabledCancelButton() { - return ActiveView()->GetDialogClientView()->cancel_button() != nullptr && - ActiveView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_CANCEL); + bool HasCancelButton() { + return ActiveView()->GetDialogClientView()->cancel_button() != nullptr; } protected: - crostini::FakeCrostiniInstallerUIDelegate fake_delegate_; + // Owned by chromeos::DBusThreadManager + WaitingFakeConciergeClient* waiting_fake_concierge_client_ = nullptr; + WaitingDiskMountManagerObserver* waiting_disk_mount_manager_observer_ = + nullptr; private: + base::FilePath MaybeMountCrostini( + const std::string& source_path, + const std::vector<std::string>& mount_options) { + GURL source_url(source_path); + DCHECK(source_url.is_valid()); + if (source_url.scheme() != "sshfs") { + return {}; + } + EXPECT_EQ("sshfs://stub-user@hostname:", source_path); + return base::FilePath( + browser()->profile()->GetPath().Append("crostini_test")); + } DISALLOW_COPY_AND_ASSIGN(CrostiniInstallerViewBrowserTest); }; @@ -63,135 +152,151 @@ } IN_PROC_BROWSER_TEST_F(CrostiniInstallerViewBrowserTest, InstallFlow) { + base::HistogramTester histogram_tester; + ShowUi("default"); EXPECT_NE(nullptr, ActiveView()); EXPECT_EQ(ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, ActiveView()->GetDialogButtons()); - EXPECT_TRUE(HasEnabledAcceptButton()); - EXPECT_TRUE(HasEnabledCancelButton()); + + EXPECT_TRUE(HasAcceptButton()); + EXPECT_TRUE(HasCancelButton()); + EXPECT_TRUE(crostini::CrostiniManager::GetForProfile(browser()->profile()) ->GetInstallerViewStatus()); - EXPECT_FALSE(fake_delegate_.progress_callback_) - << "Install() should not be called"; + + base::RunLoop run_loop; + ActiveView()->SetGetFreeDiskSpaceCallbackForTesting(run_loop.QuitClosure()); + run_loop.Run(); ActiveView()->GetDialogClientView()->AcceptWindow(); EXPECT_FALSE(ActiveView()->GetWidget()->IsClosed()); - EXPECT_FALSE(HasEnabledAcceptButton()); - EXPECT_TRUE(HasEnabledCancelButton()); - EXPECT_TRUE(fake_delegate_.progress_callback_) - << "Install() should be called"; - EXPECT_TRUE(fake_delegate_.result_callback_); + EXPECT_FALSE(HasAcceptButton()); + EXPECT_TRUE(HasCancelButton()); - fake_delegate_.progress_callback_.Run(InstallationState::CREATE_CONTAINER, - 0.4); - fake_delegate_.progress_callback_.Run(InstallationState::MOUNT_CONTAINER, - 0.8); - std::move(fake_delegate_.result_callback_).Run(Error::NONE); + waiting_disk_mount_manager_observer_->WaitForMountEvent(); - // This allow the dialog to be destructed. + // RunUntilIdle in this case will run the rest of the install steps including + // launching the terminal, on the UI thread. base::RunLoop().RunUntilIdle(); + EXPECT_EQ(nullptr, ActiveView()); + EXPECT_FALSE(crostini::CrostiniManager::GetForProfile(browser()->profile()) + ->GetInstallerViewStatus()); + + histogram_tester.ExpectUniqueSample( + "Crostini.SetupResult", + static_cast<base::HistogramBase::Sample>( + CrostiniInstallerView::SetupResult::kSuccess), + 1); +} + +IN_PROC_BROWSER_TEST_F(CrostiniInstallerViewBrowserTest, + ProgressBarOnlyMovesForwards) { + ShowUi("default"); + EXPECT_NE(nullptr, ActiveView()); + + base::RunLoop run_loop; + ActiveView()->SetCloseCallbackForTesting(run_loop.QuitClosure()); + + ProgressBarTracker progress_bar_tracker; + ActiveView()->SetProgressBarCallbackForTesting( + base::BindRepeating(&ProgressBarTracker::OnProgressBarUpdated, + base::Unretained(&progress_bar_tracker))); + ActiveView()->GetDialogClientView()->AcceptWindow(); + + run_loop.Run(); + EXPECT_EQ(nullptr, ActiveView()); +} + +IN_PROC_BROWSER_TEST_F(CrostiniInstallerViewBrowserTest, InstallFlow_Offline) { + base::HistogramTester histogram_tester; + SetConnectionType(network::mojom::ConnectionType::CONNECTION_NONE); + + ShowUi("default"); + EXPECT_NE(nullptr, ActiveView()); + EXPECT_EQ(ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, + ActiveView()->GetDialogButtons()); + + EXPECT_TRUE(HasAcceptButton()); + EXPECT_TRUE(HasCancelButton()); + + EXPECT_TRUE(crostini::CrostiniManager::GetForProfile(browser()->profile()) + ->GetInstallerViewStatus()); + + base::RunLoop run_loop; + ActiveView()->SetGetFreeDiskSpaceCallbackForTesting(run_loop.QuitClosure()); + run_loop.Run(); + + ActiveView()->GetDialogClientView()->AcceptWindow(); + EXPECT_FALSE(ActiveView()->GetWidget()->IsClosed()); + EXPECT_TRUE(HasAcceptButton()); + EXPECT_EQ(ActiveView()->GetDialogButtonLabel(ui::DIALOG_BUTTON_OK), + l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_RETRY_BUTTON)); + EXPECT_TRUE(HasCancelButton()); + + ActiveView()->GetDialogClientView()->CancelWindow(); + EXPECT_TRUE(ActiveView()->GetWidget()->IsClosed()); + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(nullptr, ActiveView()); + + EXPECT_FALSE(crostini::CrostiniManager::GetForProfile(browser()->profile()) + ->GetInstallerViewStatus()); + + histogram_tester.ExpectUniqueSample( + "Crostini.SetupResult", + static_cast<base::HistogramBase::Sample>( + CrostiniInstallerView::SetupResult::kErrorOffline), + 1); +} + +IN_PROC_BROWSER_TEST_F(CrostiniInstallerViewBrowserTest, Cancel) { + base::HistogramTester histogram_tester; + + ShowUi("default"); + EXPECT_NE(nullptr, ActiveView()); + EXPECT_TRUE(crostini::CrostiniManager::GetForProfile(browser()->profile()) + ->GetInstallerViewStatus()); + ActiveView()->GetDialogClientView()->CancelWindow(); + EXPECT_TRUE(ActiveView()->GetWidget()->IsClosed()); + base::RunLoop().RunUntilIdle(); EXPECT_EQ(nullptr, ActiveView()); EXPECT_FALSE(crostini::CrostiniManager::GetForProfile(browser()->profile()) ->GetInstallerViewStatus()); + + histogram_tester.ExpectUniqueSample( + "Crostini.SetupResult", + static_cast<base::HistogramBase::Sample>( + CrostiniInstallerView::SetupResult::kNotStarted), + 1); } IN_PROC_BROWSER_TEST_F(CrostiniInstallerViewBrowserTest, ErrorThenCancel) { + base::HistogramTester histogram_tester; ShowUi("default"); - ASSERT_NE(nullptr, ActiveView()); + EXPECT_NE(nullptr, ActiveView()); + EXPECT_TRUE(crostini::CrostiniManager::GetForProfile(browser()->profile()) + ->GetInstallerViewStatus()); + vm_tools::concierge::StartVmResponse response; + response.set_status(vm_tools::concierge::VM_STATUS_FAILURE); + waiting_fake_concierge_client_->set_start_vm_response(std::move(response)); - ActiveView()->GetDialogClientView()->AcceptWindow(); - - ASSERT_TRUE(fake_delegate_.result_callback_); - std::move(fake_delegate_.result_callback_) - .Run(Error::ERROR_CREATING_DISK_IMAGE); - - EXPECT_FALSE(ActiveView()->GetWidget()->IsClosed()); - EXPECT_TRUE(HasEnabledAcceptButton()); - EXPECT_EQ(ActiveView()->GetDialogButtonLabel(ui::DIALOG_BUTTON_OK), - l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_RETRY_BUTTON)); - EXPECT_TRUE(HasEnabledCancelButton()); - - ActiveView()->GetDialogClientView()->CancelWindow(); - EXPECT_TRUE(ActiveView()->GetWidget()->IsClosed()); - base::RunLoop().RunUntilIdle(); - EXPECT_EQ(nullptr, ActiveView()); - - EXPECT_FALSE(crostini::CrostiniManager::GetForProfile(browser()->profile()) - ->GetInstallerViewStatus()); -} - -IN_PROC_BROWSER_TEST_F(CrostiniInstallerViewBrowserTest, ErrorThenRetry) { - ShowUi("default"); - ASSERT_NE(nullptr, ActiveView()); - - ActiveView()->GetDialogClientView()->AcceptWindow(); - - ASSERT_TRUE(fake_delegate_.result_callback_); - std::move(fake_delegate_.result_callback_) - .Run(Error::ERROR_CREATING_DISK_IMAGE); - - EXPECT_FALSE(ActiveView()->GetWidget()->IsClosed()); - EXPECT_TRUE(HasEnabledAcceptButton()); - EXPECT_EQ(ActiveView()->GetDialogButtonLabel(ui::DIALOG_BUTTON_OK), - l10n_util::GetStringUTF16(IDS_CROSTINI_INSTALLER_RETRY_BUTTON)); - - ActiveView()->GetDialogClientView()->AcceptWindow(); - EXPECT_TRUE(fake_delegate_.result_callback_) - << "Install() should be called again"; - - std::move(fake_delegate_.result_callback_).Run(Error::NONE); - - // This allow the dialog to be destructed. - base::RunLoop().RunUntilIdle(); - - EXPECT_EQ(nullptr, ActiveView()); - EXPECT_FALSE(crostini::CrostiniManager::GetForProfile(browser()->profile()) - ->GetInstallerViewStatus()); -} - -IN_PROC_BROWSER_TEST_F(CrostiniInstallerViewBrowserTest, CancelBeforeStart) { - ShowUi("default"); - ASSERT_NE(nullptr, ActiveView()); - EXPECT_TRUE(HasEnabledCancelButton()); - EXPECT_FALSE(fake_delegate_.cancel_before_start_called_); - - ActiveView()->GetDialogClientView()->CancelWindow(); - - EXPECT_TRUE(ActiveView()->GetWidget()->IsClosed()); - base::RunLoop().RunUntilIdle(); - EXPECT_EQ(nullptr, ActiveView()); - EXPECT_FALSE(crostini::CrostiniManager::GetForProfile(browser()->profile()) - ->GetInstallerViewStatus()); - EXPECT_TRUE(fake_delegate_.cancel_before_start_called_); -} - -IN_PROC_BROWSER_TEST_F(CrostiniInstallerViewBrowserTest, CancelAfterStart) { - ShowUi("default"); - ASSERT_NE(nullptr, ActiveView()); - EXPECT_TRUE(HasEnabledAcceptButton()); + base::RunLoop run_loop; + ActiveView()->SetGetFreeDiskSpaceCallbackForTesting(run_loop.QuitClosure()); + run_loop.Run(); ActiveView()->GetDialogClientView()->AcceptWindow(); EXPECT_FALSE(ActiveView()->GetWidget()->IsClosed()); - EXPECT_TRUE(HasEnabledCancelButton()); - EXPECT_TRUE(fake_delegate_.progress_callback_) - << "Install() should be called"; - - EXPECT_FALSE(fake_delegate_.cancel_callback_) - << "Cancel() should not be called"; + waiting_fake_concierge_client_->WaitForStartTerminaVmCalled(); ActiveView()->GetDialogClientView()->CancelWindow(); - EXPECT_TRUE(fake_delegate_.cancel_callback_) << "Cancel() should be called"; - EXPECT_FALSE(ActiveView()->GetWidget()->IsClosed()) - << "Dialog should not close before cancel callback"; - EXPECT_FALSE(HasEnabledAcceptButton()); - EXPECT_FALSE(HasEnabledCancelButton()); - - std::move(fake_delegate_.cancel_callback_).Run(); - EXPECT_TRUE(ActiveView()->GetWidget()->IsClosed()); base::RunLoop().RunUntilIdle(); EXPECT_EQ(nullptr, ActiveView()); EXPECT_FALSE(crostini::CrostiniManager::GetForProfile(browser()->profile()) ->GetInstallerViewStatus()); - EXPECT_FALSE(fake_delegate_.cancel_before_start_called_); + histogram_tester.ExpectUniqueSample( + "Crostini.SetupResult", + static_cast<base::HistogramBase::Sample>( + CrostiniInstallerView::SetupResult::kErrorStartingTermina), + 1); }
diff --git a/chrome/browser/ui/views/frame/web_contents_close_handler_unittest.cc b/chrome/browser/ui/views/frame/web_contents_close_handler_unittest.cc index 950e5f1..c308439 100644 --- a/chrome/browser/ui/views/frame/web_contents_close_handler_unittest.cc +++ b/chrome/browser/ui/views/frame/web_contents_close_handler_unittest.cc
@@ -12,9 +12,8 @@ class MockWebContentsCloseHandlerDelegate : public WebContentsCloseHandlerDelegate { public: - explicit MockWebContentsCloseHandlerDelegate() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + MockWebContentsCloseHandlerDelegate() + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), got_clone_(false), got_destroy_(false) {} ~MockWebContentsCloseHandlerDelegate() override {} @@ -34,7 +33,7 @@ void DestroyClonedLayer() override { got_destroy_ = true; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; bool got_clone_; bool got_destroy_;
diff --git a/chrome/browser/ui/views/layout/animating_layout_manager_unittest.cc b/chrome/browser/ui/views/layout/animating_layout_manager_unittest.cc index 07fa22b..6c9c356 100644 --- a/chrome/browser/ui/views/layout/animating_layout_manager_unittest.cc +++ b/chrome/browser/ui/views/layout/animating_layout_manager_unittest.cc
@@ -139,7 +139,7 @@ View* view_; std::vector<View*> children_; AnimatingLayoutManager* animating_layout_manager_ = nullptr; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<gfx::AnimationContainerTestApi> container_test_api_; };
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc index cfeebdf..2d08051 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -864,6 +864,18 @@ // This simple logic only works because we elide only prefixes from the full // URL. Otherwise, we would have to use the FormatURL offset adjustments. size_t offset = GetText().find(original_text); + + // Some intranet URLs have an elided form that's not a substring of the full + // URL string. e.g. "https://foobar" has the elided form "foobar/". This is + // to prevent elided URLs from looking like search terms. See + // AutocompleteInput::FormattedStringWithEquivalentMeaning for details. + // + // In this special case, chop off the trailing slash and search again. + if (offset == base::string16::npos && !original_text.empty() && + original_text.back() == base::char16('/')) { + offset = GetText().find(original_text.substr(0, original_text.size() - 1)); + } + if (offset != base::string16::npos) { AutocompleteMatch match; model()->ClassifyString(original_selected_text, &match, nullptr);
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc index 7e0ae94..2e02ce17 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
@@ -901,6 +901,31 @@ EXPECT_EQ(0U, end); } +TEST_F(OmniboxViewViewsSteadyStateElisionsTest, + UnelideViaEndKeyWorksWithIntranetUrls) { + location_bar_model()->set_url(GURL("https://foobar/")); + location_bar_model()->set_formatted_full_url( + base::ASCIIToUTF16("https://foobar")); + location_bar_model()->set_url_for_display(base::ASCIIToUTF16("foobar/")); + + omnibox_view()->model()->ResetDisplayTexts(); + omnibox_view()->RevertAll(); + + SendMouseClick(0); + + // End key should unelide and move the cursor to the end of the full URL. + omnibox_textfield_view()->OnKeyPressed( + ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_END, 0)); + + EXPECT_EQ(base::ASCIIToUTF16("https://foobar"), omnibox_view()->GetText()); + EXPECT_FALSE(omnibox_view()->model()->user_input_in_progress()); + + size_t start, end; + omnibox_view()->GetSelectionBounds(&start, &end); + EXPECT_EQ(14U, start); + EXPECT_EQ(14U, end); +} + TEST_F(OmniboxViewViewsSteadyStateElisionsTest, GestureTaps) { ui::GestureEvent tap_down(0, 0, 0, ui::EventTimeForNow(), ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN));
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view.cc b/chrome/browser/ui/views/profiles/profile_menu_view.cc index 7f97000..992616ad 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view.cc +++ b/chrome/browser/ui/views/profiles/profile_menu_view.cc
@@ -147,22 +147,9 @@ void ProfileMenuView::Reset() { ProfileMenuViewBase::Reset(); - sync_error_button_ = nullptr; signin_current_profile_button_ = nullptr; - signin_with_gaia_account_button_ = nullptr; - current_profile_card_ = nullptr; first_profile_button_ = nullptr; - guest_profile_button_ = nullptr; - users_button_ = nullptr; lock_button_ = nullptr; - close_all_windows_button_ = nullptr; - dice_signin_button_view_ = nullptr; - passwords_button_ = nullptr; - credit_cards_button_ = nullptr; - addresses_button_ = nullptr; - signout_button_ = nullptr; - manage_google_account_button_ = nullptr; - cookies_cleared_on_exit_label_ = nullptr; } void ProfileMenuView::Init() { @@ -334,12 +321,10 @@ profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN, browser(), access_point_); } -void ProfileMenuView::OnSigninAccountButtonClicked() { - DCHECK(dice_signin_button_view_->account()); +void ProfileMenuView::OnSigninAccountButtonClicked(AccountInfo account) { Hide(); - signin_ui_util::EnableSyncFromPromo( - browser(), dice_signin_button_view_->account().value(), access_point_, - true /* is_default_promo_account */); + signin_ui_util::EnableSyncFromPromo(browser(), account, access_point_, + true /* is_default_promo_account */); } void ProfileMenuView::OnSignoutButtonClicked() { @@ -359,15 +344,12 @@ Hide(); } -void ProfileMenuView::StyledLabelLinkClicked(views::StyledLabel* label, - const gfx::Range& range, - int event_flags) { - DCHECK_EQ(cookies_cleared_on_exit_label_, label); +void ProfileMenuView::OnCookiesClearedOnExitLinkClicked() { + base::RecordAction( + base::UserMetricsAction("ProfileChooser_CookieSettingsClicked")); chrome::ShowSettingsSubPage(browser(), chrome::kContentSettingsSubPage + std::string("/") + chrome::kCookieSettingsSubPage); - base::RecordAction( - base::UserMetricsAction("ProfileChooser_CookieSettingsClicked")); } void ProfileMenuView::AddProfileMenuView(AvatarMenu* avatar_menu) { @@ -448,7 +430,7 @@ // Adds an action button if an action exists. if (button_string_id) { - sync_error_button_ = CreateAndAddBlueButton( + CreateAndAddBlueButton( l10n_util::GetStringUTF16(button_string_id), true /* md_style */, base::BindRepeating(&ProfileMenuView::OnSyncErrorButtonClicked, base::Unretained(this), error)); @@ -480,7 +462,7 @@ : sync_disabled ? BadgedProfilePhoto::BADGE_TYPE_SYNC_DISABLED : BadgedProfilePhoto::BADGE_TYPE_SYNC_ERROR, avatar_item.icon); - current_profile_card_ = CreateAndAddTitleCard( + views::Button* current_profile_card = CreateAndAddTitleCard( std::move(current_profile_photo), l10n_util::GetStringUTF16( show_sync_paused_ui @@ -492,13 +474,13 @@ base::Unretained(this))); if (!show_sync_paused_ui && !sync_disabled) { - static_cast<HoverButton*>(current_profile_card_) + static_cast<HoverButton*>(current_profile_card) ->SetStyle(HoverButton::STYLE_ERROR); - current_profile_card_->SetEnabled(false); + current_profile_card->SetEnabled(false); } if (!sync_disabled) { - sync_error_button_ = CreateAndAddBlueButton( + CreateAndAddBlueButton( l10n_util::GetStringUTF16(button_string_id), true /* md_style */, base::BindRepeating(&ProfileMenuView::OnSyncErrorButtonClicked, base::Unretained(this), error)); @@ -508,35 +490,16 @@ } void ProfileMenuView::AddSyncPausedReasonCookiesClearedOnExit() { - size_t offset = 0; - std::unique_ptr<views::StyledLabel> sync_paused_reason = - std::make_unique<views::StyledLabel>(base::string16(), this); - base::string16 link_text = l10n_util::GetStringUTF16( IDS_SYNC_PAUSED_REASON_CLEAR_COOKIES_ON_EXIT_LINK_TEXT); + size_t link_begin = 0; + base::string16 text = l10n_util::GetStringFUTF16( + IDS_SYNC_PAUSED_REASON_CLEAR_COOKIES_ON_EXIT, link_text, &link_begin); - base::string16 message = l10n_util::GetStringFUTF16( - IDS_SYNC_PAUSED_REASON_CLEAR_COOKIES_ON_EXIT, link_text, &offset); - - sync_paused_reason->SetText(message); - // Mark the link text as link. - sync_paused_reason->AddStyleRange( - gfx::Range(offset, offset + link_text.length()), - views::StyledLabel::RangeStyleInfo::CreateForLink()); - - // Mark the rest of the text as secondary text. - views::StyledLabel::RangeStyleInfo message_style; - message_style.text_style = STYLE_SECONDARY; - gfx::Range before_link_range(0, offset); - if (!before_link_range.is_empty()) - sync_paused_reason->AddStyleRange(before_link_range, message_style); - - gfx::Range after_link_range(offset + link_text.length(), message.length()); - if (!after_link_range.is_empty()) - sync_paused_reason->AddStyleRange(after_link_range, message_style); - - cookies_cleared_on_exit_label_ = sync_paused_reason.get(); - AddViewItem(std::move(sync_paused_reason)); + CreateAndAddLabelWithLink( + text, gfx::Range(link_begin, link_begin + link_text.length()), + base::BindRepeating(&ProfileMenuView::OnCookiesClearedOnExitLinkClicked, + base::Unretained(this))); } void ProfileMenuView::AddCurrentProfileView( @@ -570,7 +533,7 @@ ? l10n_util::GetStringUTF16(IDS_PROFILES_SYNC_COMPLETE_TITLE) : profile_name; - current_profile_card_ = CreateAndAddTitleCard( + views::Button* current_profile_card = CreateAndAddTitleCard( std::move(current_profile_photo), hover_button_title, show_email ? avatar_item.username : base::string16(), base::BindRepeating(&ProfileMenuView::OnCurrentProfileCardClicked, @@ -580,14 +543,14 @@ // setting the elision behavior, so until this bug is fixed, avoid the crash // by checking that the username is not empty. if (show_email && !avatar_item.username.empty()) - static_cast<HoverButton*>(current_profile_card_) + static_cast<HoverButton*>(current_profile_card) ->SetSubtitleElideBehavior(gfx::ELIDE_EMAIL); // The available links depend on the type of profile that is active. if (is_guest) { - current_profile_card_->SetEnabled(false); + current_profile_card->SetEnabled(false); } else if (avatar_item.signed_in) { - current_profile_card_->SetAccessibleName(l10n_util::GetStringFUTF16( + current_profile_card->SetAccessibleName(l10n_util::GetStringFUTF16( IDS_PROFILES_EDIT_SIGNED_IN_PROFILE_ACCESSIBLE_NAME, profile_name, avatar_item.username)); } else { @@ -597,7 +560,7 @@ if (!dice_enabled_ && is_signin_allowed) AddPreDiceSigninPromo(); - current_profile_card_->SetAccessibleName(l10n_util::GetStringFUTF16( + current_profile_card->SetAccessibleName(l10n_util::GetStringFUTF16( IDS_PROFILES_EDIT_PROFILE_ACCESSIBLE_NAME, profile_name)); } } @@ -636,13 +599,11 @@ CreateAndAddLabel(l10n_util::GetStringUTF16(IDS_PROFILES_DICE_SYNC_PROMO)); // Create a sign-in button without account information. - std::unique_ptr<DiceSigninButtonView> signin_button = - std::make_unique<DiceSigninButtonView>(this); - dice_signin_button_view_ = CreateAndAddDiceSigninButton( + DiceSigninButtonView* dice_signin_button_view = CreateAndAddDiceSigninButton( /*account_info=*/nullptr, /*account_icon=*/nullptr, base::BindRepeating(&ProfileMenuView::OnSigninButtonClicked, base::Unretained(this))); - signin_current_profile_button_ = dice_signin_button_view_->signin_button(); + signin_current_profile_button_ = dice_signin_button_view->signin_button(); } void ProfileMenuView::AddDiceSigninView() { @@ -674,14 +635,13 @@ account_icon = ui::ResourceBundle::GetSharedInstance().GetImageNamed( profiles::GetPlaceholderAvatarIconResourceID()); } - dice_signin_button_view_ = CreateAndAddDiceSigninButton( + CreateAndAddDiceSigninButton( &dice_promo_default_account, &account_icon, base::BindRepeating(&ProfileMenuView::OnSigninAccountButtonClicked, - base::Unretained(this))); - signin_with_gaia_account_button_ = dice_signin_button_view_->signin_button(); + base::Unretained(this), dice_promo_default_account)); // Add sign out button. - signout_button_ = CreateAndAddBlueButton( + CreateAndAddBlueButton( l10n_util::GetStringUTF16(IDS_SCREEN_LOCK_SIGN_OUT), false /* md_style */, base::BindRepeating(&ProfileMenuView::OnSignoutButtonClicked, base::Unretained(this))); @@ -738,7 +698,7 @@ PrefService* service = g_browser_process->local_state(); DCHECK(service); if (service->GetBoolean(prefs::kBrowserGuestModeEnabled)) { - guest_profile_button_ = CreateAndAddButton( + CreateAndAddButton( CreateVectorIcon(kUserMenuGuestIcon), l10n_util::GetStringUTF16(IDS_PROFILES_OPEN_GUEST_PROFILE_BUTTON), base::BindRepeating(&ProfileMenuView::OnGuestProfileButtonClicked, @@ -750,7 +710,7 @@ is_guest ? IDS_PROFILES_EXIT_GUEST : IDS_PROFILES_MANAGE_USERS_BUTTON); const gfx::VectorIcon& settings_icon = is_guest ? kCloseAllIcon : vector_icons::kSettingsIcon; - users_button_ = CreateAndAddButton( + CreateAndAddButton( CreateVectorIcon(settings_icon), text, base::BindRepeating(&ProfileMenuView::OnManageProfilesButtonClicked, base::Unretained(this))); @@ -765,7 +725,7 @@ } else if (!is_guest) { AvatarMenu::Item active_avatar_item = avatar_menu->GetItemAt(ordered_item_indices[0]); - close_all_windows_button_ = CreateAndAddButton( + CreateAndAddButton( CreateVectorIcon(kCloseAllIcon), avatar_menu->GetNumberOfItems() >= 2 ? l10n_util::GetStringFUTF16(IDS_PROFILES_EXIT_PROFILE_BUTTON, @@ -790,21 +750,21 @@ AddMenuGroup(); // Passwords. - passwords_button_ = CreateAndAddButton( + CreateAndAddButton( CreateVectorIcon(kKeyIcon), l10n_util::GetStringUTF16(IDS_PROFILES_PASSWORDS_LINK), base::BindRepeating(&ProfileMenuView::OnPasswordsButtonClicked, base::Unretained(this))); // Credit cards. - credit_cards_button_ = CreateAndAddButton( + CreateAndAddButton( CreateVectorIcon(kCreditCardIcon), l10n_util::GetStringUTF16(IDS_PROFILES_CREDIT_CARDS_LINK), base::BindRepeating(&ProfileMenuView::OnCreditCardsButtonClicked, base::Unretained(this))); // Addresses. - addresses_button_ = CreateAndAddButton( + CreateAndAddButton( CreateVectorIcon(vector_icons::kLocationOnIcon), l10n_util::GetStringUTF16(IDS_PROFILES_ADDRESSES_LINK), base::BindRepeating(&ProfileMenuView::OnAddressesButtonClicked, @@ -814,7 +774,7 @@ #if defined(GOOGLE_CHROME_BUILD) void ProfileMenuView::AddManageGoogleAccountButton() { AddMenuGroup(false); - manage_google_account_button_ = CreateAndAddButton( + CreateAndAddButton( GetGoogleIconForUserMenu(GetDefaultIconSize()), l10n_util::GetStringUTF16(IDS_SETTINGS_MANAGE_GOOGLE_ACCOUNT), base::BindRepeating(&ProfileMenuView::OnManageGoogleAccountButtonClicked,
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view.h b/chrome/browser/ui/views/profiles/profile_menu_view.h index 5cb34632..58111e4c 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view.h +++ b/chrome/browser/ui/views/profiles/profile_menu_view.h
@@ -25,9 +25,6 @@ } class Browser; -class DiceSigninButtonView; -class HoverButton; - // This bubble view is displayed when the user clicks on the avatar button. // It displays a list of profiles and allows users to switch between profiles. @@ -51,7 +48,7 @@ views::View* GetInitiallyFocusedView() override; base::string16 GetAccessibleWindowTitle() const override; - // Button actions. + // Button/link actions. void OnManageGoogleAccountButtonClicked(); void OnPasswordsButtonClicked(); void OnCreditCardsButtonClicked(); @@ -63,14 +60,10 @@ void OnSyncErrorButtonClicked(sync_ui_util::AvatarSyncErrorType error); void OnCurrentProfileCardClicked(); void OnSigninButtonClicked(); - void OnSigninAccountButtonClicked(); + void OnSigninAccountButtonClicked(AccountInfo account); void OnSignoutButtonClicked(); void OnOtherProfileButtonClicked(int profile_index); - - // views::StyledLabelListener - void StyledLabelLinkClicked(views::StyledLabel* label, - const gfx::Range& range, - int event_flags) override; + void OnCookiesClearedOnExitLinkClicked(); // AvatarMenuObserver: void OnAvatarMenuChanged(AvatarMenu* avatar_menu) override; @@ -142,36 +135,10 @@ std::unique_ptr<AvatarMenu> avatar_menu_; - // Button in the signin/sync error header on top of the desktop user menu. - views::Button* sync_error_button_; - - // Links and buttons displayed in the active profile card. - views::Link* manage_accounts_link_; - views::Button* manage_accounts_button_; - views::Button* signin_current_profile_button_; - HoverButton* sync_to_another_account_button_; - views::Button* signin_with_gaia_account_button_; - - // For material design user menu, the active profile card owns the profile - // name and photo. - views::Button* current_profile_card_; - - // Action buttons. - views::Button* first_profile_button_; - views::Button* guest_profile_button_; - views::Button* users_button_; - views::Button* lock_button_; - views::Button* close_all_windows_button_; - views::Button* passwords_button_; - views::Button* credit_cards_button_; - views::Button* addresses_button_; - views::Button* signout_button_; - views::Button* manage_google_account_button_; - - views::StyledLabel* cookies_cleared_on_exit_label_; - - // View for the signin/turn-on-sync button in the dice promo. - DiceSigninButtonView* dice_signin_button_view_; + // Button pointers used in tests. + views::Button* first_profile_button_ = nullptr; + views::Button* lock_button_ = nullptr; + views::Button* signin_current_profile_button_ = nullptr; // The GAIA service type provided in the response header. signin::GAIAServiceType gaia_service_type_;
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_base.cc b/chrome/browser/ui/views/profiles/profile_menu_view_base.cc index accabdc..534a102 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view_base.cc +++ b/chrome/browser/ui/views/profiles/profile_menu_view_base.cc
@@ -13,6 +13,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" +#include "chrome/browser/ui/views/chrome_typography.h" #include "chrome/browser/ui/views/hover_button.h" #include "chrome/browser/ui/views/profiles/incognito_menu_view.h" #include "chrome/grit/generated_resources.h" @@ -24,6 +25,7 @@ #include "ui/views/controls/button/md_text_button.h" #include "ui/views/controls/scroll_view.h" #include "ui/views/controls/separator.h" +#include "ui/views/controls/styled_label.h" #if !defined(OS_CHROMEOS) #include "chrome/browser/ui/views/profiles/profile_menu_view.h" @@ -170,14 +172,15 @@ void ProfileMenuViewBase::ButtonPressed(views::Button* sender, const ui::Event& event) { - DCHECK(!button_actions_[sender].is_null()); - button_actions_[sender].Run(); + DCHECK(!click_actions_[sender].is_null()); + click_actions_[sender].Run(); } void ProfileMenuViewBase::StyledLabelLinkClicked(views::StyledLabel* label, const gfx::Range& range, int event_flags) { - chrome::ShowSettings(browser_); + DCHECK(!click_actions_[label].is_null()); + click_actions_[label].Run(); } int ProfileMenuViewBase::GetMaxHeight() const { @@ -250,7 +253,7 @@ if (action.is_null()) title_card->SetEnabled(false); views::Button* button_ptr = title_card.get(); - RegisterButtonAction(button_ptr, std::move(action)); + RegisterClickAction(button_ptr, std::move(action)); AddMenuItemInternal(std::move(title_card), MenuItems::kTitleCard); return button_ptr; } @@ -262,7 +265,7 @@ std::unique_ptr<HoverButton> button = std::make_unique<HoverButton>(this, icon, title); views::Button* pointer = button.get(); - RegisterButtonAction(pointer, std::move(action)); + RegisterClickAction(pointer, std::move(action)); AddMenuItemInternal(std::move(button), MenuItems::kButton); return pointer; } @@ -275,7 +278,7 @@ md_style ? views::MdTextButton::CreateSecondaryUiBlueButton(this, text) : views::MdTextButton::Create(this, text); views::Button* pointer = button.get(); - RegisterButtonAction(pointer, std::move(action)); + RegisterClickAction(pointer, std::move(action)); // Add margins. std::unique_ptr<views::View> margined_view = std::make_unique<views::View>(); @@ -298,7 +301,7 @@ *account_icon, this) : std::make_unique<DiceSigninButtonView>(this); DiceSigninButtonView* pointer = button.get(); - RegisterButtonAction(pointer->signin_button(), std::move(action)); + RegisterClickAction(pointer->signin_button(), std::move(action)); // Add margins. std::unique_ptr<views::View> margined_view = std::make_unique<views::View>(); @@ -332,6 +335,21 @@ return pointer; } +views::StyledLabel* ProfileMenuViewBase::CreateAndAddLabelWithLink( + const base::string16& text, + gfx::Range link_range, + base::RepeatingClosure action) { + auto label_with_link = std::make_unique<views::StyledLabel>(text, this); + label_with_link->SetDefaultTextStyle(STYLE_SECONDARY); + label_with_link->AddStyleRange( + link_range, views::StyledLabel::RangeStyleInfo::CreateForLink()); + + views::StyledLabel* pointer = label_with_link.get(); + RegisterClickAction(pointer, std::move(action)); + AddViewItem(std::move(label_with_link)); + return pointer; +} + void ProfileMenuViewBase::AddViewItem(std::unique_ptr<views::View> view) { // Add margins. std::unique_ptr<views::View> margined_view = std::make_unique<views::View>(); @@ -342,10 +360,10 @@ AddMenuItemInternal(std::move(margined_view), MenuItems::kGeneral); } -void ProfileMenuViewBase::RegisterButtonAction(views::Button* button, - base::RepeatingClosure action) { - DCHECK(button_actions_.count(button) == 0); - button_actions_[button] = std::move(action); +void ProfileMenuViewBase::RegisterClickAction(views::View* clickable_view, + base::RepeatingClosure action) { + DCHECK(click_actions_.count(clickable_view) == 0); + click_actions_[clickable_view] = std::move(action); } void ProfileMenuViewBase::RepopulateViewFromMenuItems() {
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_base.h b/chrome/browser/ui/views/profiles/profile_menu_view_base.h index b8ea838a..87c512f 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view_base.h +++ b/chrome/browser/ui/views/profiles/profile_menu_view_base.h
@@ -123,6 +123,9 @@ views::Label* CreateAndAddLabel( const base::string16& text, int text_context = views::style::CONTEXT_LABEL); + views::StyledLabel* CreateAndAddLabelWithLink(const base::string16& text, + gfx::Range link_range, + base::RepeatingClosure action); void AddViewItem(std::unique_ptr<views::View> view); void RepopulateViewFromMenuItems(); @@ -163,10 +166,10 @@ // views::StyledLabelListener: void StyledLabelLinkClicked(views::StyledLabel* label, const gfx::Range& range, - int event_flags) override; + int event_flags) final; - void RegisterButtonAction(views::Button* button, - base::RepeatingClosure action); + void RegisterClickAction(views::View* clickable_view, + base::RepeatingClosure action); // Returns the size of different margin types. int GetMarginSize(GroupMarginSize margin_size) const; @@ -182,7 +185,7 @@ views::Button* const anchor_button_; - std::map<views::Button*, base::RepeatingClosure> button_actions_; + std::map<views::View*, base::RepeatingClosure> click_actions_; CloseBubbleOnTabActivationHelper close_bubble_helper_;
diff --git a/chrome/browser/ui/views/relaunch_notification/relaunch_notification_controller_unittest.cc b/chrome/browser/ui/views/relaunch_notification/relaunch_notification_controller_unittest.cc index ca2c532..14f9c75 100644 --- a/chrome/browser/ui/views/relaunch_notification/relaunch_notification_controller_unittest.cc +++ b/chrome/browser/ui/views/relaunch_notification/relaunch_notification_controller_unittest.cc
@@ -136,12 +136,12 @@ class RelaunchNotificationControllerTest : public ::testing::Test { protected: RelaunchNotificationControllerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED), + : task_environment_( + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED), scoped_local_state_(TestingBrowserProcess::GetGlobal()), - upgrade_detector_(scoped_task_environment_.GetMockClock(), - scoped_task_environment_.GetMockTickClock()) { + upgrade_detector_(task_environment_.GetMockClock(), + task_environment_.GetMockTickClock()) { auto mock_power_monitor_source = std::make_unique<StubPowerMonitorSource>(); mock_power_monitor_source_ = mock_power_monitor_source.get(); base::PowerMonitor::Initialize(std::move(mock_power_monitor_source)); @@ -161,27 +161,25 @@ prefs::kRelaunchNotification, std::make_unique<base::Value>(value)); } - // Returns the ScopedTaskEnvironment's MockClock. - const base::Clock* GetMockClock() { - return scoped_task_environment_.GetMockClock(); - } + // Returns the TaskEnvironment's MockClock. + const base::Clock* GetMockClock() { return task_environment_.GetMockClock(); } - // Returns the ScopedTaskEnvironment's MockTickClock. + // Returns the TaskEnvironment's MockTickClock. const base::TickClock* GetMockTickClock() { - return scoped_task_environment_.GetMockTickClock(); + return task_environment_.GetMockTickClock(); } // Fast-forwards virtual time by |delta|. void FastForwardBy(base::TimeDelta delta) { - scoped_task_environment_.FastForwardBy(delta); + task_environment_.FastForwardBy(delta); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } private: // Owned by power_monitor_. Use this to simulate a power suspend and resume. StubPowerMonitorSource* mock_power_monitor_source_ = nullptr; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ScopedTestingLocalState scoped_local_state_; FakeUpgradeDetector upgrade_detector_;
diff --git a/chrome/browser/ui/views/relaunch_notification/wall_clock_timer_unittest.cc b/chrome/browser/ui/views/relaunch_notification/wall_clock_timer_unittest.cc index 3d67e811..ae0d255 100644 --- a/chrome/browser/ui/views/relaunch_notification/wall_clock_timer_unittest.cc +++ b/chrome/browser/ui/views/relaunch_notification/wall_clock_timer_unittest.cc
@@ -35,8 +35,7 @@ class WallClockTimerTest : public ::testing::Test { protected: WallClockTimerTest() - : task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) { + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) { auto mock_power_monitor_source = std::make_unique<StubPowerMonitorSource>(); mock_power_monitor_source_ = mock_power_monitor_source.get(); base::PowerMonitor::Initialize(std::move(mock_power_monitor_source)); @@ -46,7 +45,7 @@ // Owned by power_monitor_. Use this to simulate a power suspend and resume. StubPowerMonitorSource* mock_power_monitor_source_ = nullptr; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; private: DISALLOW_COPY_AND_ASSIGN(WallClockTimerTest);
diff --git a/chrome/browser/ui/views/tabs/tab_animation_unittest.cc b/chrome/browser/ui/views/tabs/tab_animation_unittest.cc index a9dcaca7..567344ba 100644 --- a/chrome/browser/ui/views/tabs/tab_animation_unittest.cc +++ b/chrome/browser/ui/views/tabs/tab_animation_unittest.cc
@@ -21,13 +21,13 @@ class TabAnimationTest : public testing::Test { public: TabAnimationTest() - : env_(base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : env_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} float CurrentPinnedness(const TabAnimation& animation) { return animation.GetCurrentState().pinnedness(); } - base::test::ScopedTaskEnvironment env_; + base::test::TaskEnvironment env_; }; TEST_F(TabAnimationTest, StaticAnimationDoesNotChange) {
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index 12e40c9..a87617d2 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -1736,15 +1736,26 @@ // inactive windows, generate the inactive color by blending the active one // at 75% as we do in the default theme. color = tp->GetColor(ThemeProperties::COLOR_BACKGROUND_TAB_TEXT); - } else if (tab_state != TAB_ACTIVE) { - color = color_utils::PickContrastingColor( - gfx::kGoogleGrey400, gfx::kGoogleGrey800, background_color); } if (!is_active_frame) color = color_utils::AlphaBlend(color, background_color, 0.75f); - return color_utils::BlendForMinContrast(color, background_color).color; + // To minimize any readability cost of custom system frame colors, try to make + // the text reach the same contrast ratio that it would in the default theme. + const SkColor target = color_utils::GetColorWithMaxContrast(background_color); + // These contrast ratios should match the actual ratios in the default theme + // colors when no system colors are involved, except for the inactive tab/ + // inactive frame case, which has been raised from 4.48 to 4.5 to meet + // accessibility guidelines. + constexpr float kContrast[2][2] = {{5.0f, // Active tab, inactive frame + 10.46f}, // Active tab, active frame + {4.5f, // Inactive tab, inactive frame + 7.98f}}; // Inactive tab, active frame + const float contrast = kContrast[tab_state][is_active_frame]; + return color_utils::BlendForMinContrast(color, background_color, target, + contrast) + .color; } // Returns the accessible tab name for the tab.
diff --git a/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler_unittest.cc b/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler_unittest.cc index 081fdff..88bf763 100644 --- a/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler_unittest.cc +++ b/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler_unittest.cc
@@ -167,7 +167,7 @@ protected: // Must be the first member. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<user_manager::ScopedUserManager> scoped_user_manager_enabler_; FakeCryptohomeClient* fake_cryptohome_client_ = nullptr; // unowned @@ -218,7 +218,7 @@ EncryptionMigrationMode::START_MINIMAL_MIGRATION); encryption_migration_screen_handler_->SetupInitialView(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE( encryption_migration_screen_handler_->fake_wake_lock()->HasWakeLock()); @@ -247,7 +247,7 @@ EncryptionMigrationMode::RESUME_MINIMAL_MIGRATION); encryption_migration_screen_handler_->SetupInitialView(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_cryptohome_client_->NotifyDircryptoMigrationProgress( cryptohome::DircryptoMigrationStatus::DIRCRYPTO_MIGRATION_SUCCESS, @@ -272,7 +272,7 @@ EncryptionMigrationMode::START_MINIMAL_MIGRATION); encryption_migration_screen_handler_->SetupInitialView(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); encryption_migration_screen_handler_->testing_tick_clock()->Advance( base::TimeDelta::FromMinutes(1)); @@ -297,7 +297,7 @@ EncryptionMigrationMode::START_MINIMAL_MIGRATION); encryption_migration_screen_handler_->SetupInitialView(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); encryption_migration_screen_handler_->testing_tick_clock()->Advance( base::TimeDelta::FromMinutes(1));
diff --git a/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc b/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc index 7449e51..13c97c5 100644 --- a/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc +++ b/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc
@@ -58,7 +58,7 @@ void SetInputMethods2(); private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; system::ScopedFakeStatisticsProvider scoped_fake_statistics_provider_; MockInputMethodManagerWithInputMethods* input_manager_;
diff --git a/chrome/browser/upgrade_detector/upgrade_detector_chromeos_unittest.cc b/chrome/browser/upgrade_detector/upgrade_detector_chromeos_unittest.cc index e47b9a2..cc9223c7 100644 --- a/chrome/browser/upgrade_detector/upgrade_detector_chromeos_unittest.cc +++ b/chrome/browser/upgrade_detector/upgrade_detector_chromeos_unittest.cc
@@ -67,8 +67,7 @@ protected: UpgradeDetectorChromeosTest() : utc_(icu::TimeZone::createTimeZone("Etc/GMT")), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), scoped_local_state_(TestingBrowserProcess::GetGlobal()) { // Disable the detector's check to see if autoupdates are inabled. // Without this, tests put the detector into an invalid state by detecting @@ -88,15 +87,13 @@ FastForwardBy(base::TimeDelta::FromHours(2)); } - const base::Clock* GetMockClock() { - return scoped_task_environment_.GetMockClock(); - } + const base::Clock* GetMockClock() { return task_environment_.GetMockClock(); } const base::TickClock* GetMockTickClock() { - return scoped_task_environment_.GetMockTickClock(); + return task_environment_.GetMockTickClock(); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } void NotifyUpdateReadyToInstall() { chromeos::UpdateEngineClient::Status status; @@ -136,12 +133,12 @@ // Fast-forwards virtual time by |delta|. void FastForwardBy(base::TimeDelta delta) { - scoped_task_environment_.FastForwardBy(delta); + task_environment_.FastForwardBy(delta); } private: std::unique_ptr<icu::TimeZone> utc_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ScopedTestingLocalState scoped_local_state_; chromeos::FakeUpdateEngineClient* fake_update_engine_client_; // Not owned.
diff --git a/chrome/browser/upgrade_detector/upgrade_detector_impl_unittest.cc b/chrome/browser/upgrade_detector/upgrade_detector_impl_unittest.cc index 44615cb..f3448b79 100644 --- a/chrome/browser/upgrade_detector/upgrade_detector_impl_unittest.cc +++ b/chrome/browser/upgrade_detector/upgrade_detector_impl_unittest.cc
@@ -112,8 +112,7 @@ class UpgradeDetectorImplTest : public ::testing::Test { protected: UpgradeDetectorImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), scoped_local_state_(TestingBrowserProcess::GetGlobal()) { // Disable the detector's check to see if autoupdates are inabled. // Without this, tests put the detector into an invalid state by detecting @@ -122,12 +121,10 @@ std::make_unique<base::Value>(true)); } - const base::Clock* GetMockClock() { - return scoped_task_environment_.GetMockClock(); - } + const base::Clock* GetMockClock() { return task_environment_.GetMockClock(); } const base::TickClock* GetMockTickClock() { - return scoped_task_environment_.GetMockTickClock(); + return task_environment_.GetMockTickClock(); } // Sets the browser.relaunch_notification_period preference in Local State to @@ -144,15 +141,15 @@ } } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } // Fast-forwards virtual time by |delta|. void FastForwardBy(base::TimeDelta delta) { - scoped_task_environment_.FastForwardBy(delta); + task_environment_.FastForwardBy(delta); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ScopedTestingLocalState scoped_local_state_; DISALLOW_COPY_AND_ASSIGN(UpgradeDetectorImplTest);
diff --git a/chrome/browser/web_applications/components/pending_app_manager_unittest.cc b/chrome/browser/web_applications/components/pending_app_manager_unittest.cc index c28e177..a5ddbba 100644 --- a/chrome/browser/web_applications/components/pending_app_manager_unittest.cc +++ b/chrome/browser/web_applications/components/pending_app_manager_unittest.cc
@@ -65,7 +65,7 @@ EXPECT_EQ(installed_app_urls, urls); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestAppRegistrar registrar_; TestPendingAppManager pending_app_manager_; };
diff --git a/chrome/browser/web_applications/web_app_database_unittest.cc b/chrome/browser/web_applications/web_app_database_unittest.cc index c7af981..790c0eb 100644 --- a/chrome/browser/web_applications/web_app_database_unittest.cc +++ b/chrome/browser/web_applications/web_app_database_unittest.cc
@@ -170,7 +170,7 @@ protected: // Must be created before TestWebAppDatabaseFactory. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestWebAppDatabaseFactory> database_factory_; std::unique_ptr<WebAppDatabase> database_;
diff --git a/chrome/browser/webauthn/authenticator_request_dialog_model_unittest.cc b/chrome/browser/webauthn/authenticator_request_dialog_model_unittest.cc index 57fbf51..3e1b00e 100644 --- a/chrome/browser/webauthn/authenticator_request_dialog_model_unittest.cc +++ b/chrome/browser/webauthn/authenticator_request_dialog_model_unittest.cc
@@ -96,8 +96,8 @@ ~AuthenticatorRequestDialogModelTest() override {} protected: - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; base::ListValue test_paired_device_list_; private:
diff --git a/chrome/browser/win/conflicts/enumerate_input_method_editors_unittest.cc b/chrome/browser/win/conflicts/enumerate_input_method_editors_unittest.cc index 3552532..f41c45349 100644 --- a/chrome/browser/win/conflicts/enumerate_input_method_editors_unittest.cc +++ b/chrome/browser/win/conflicts/enumerate_input_method_editors_unittest.cc
@@ -33,10 +33,10 @@ registry_override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE)); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; registry_util::RegistryOverrideManager registry_override_manager_;
diff --git a/chrome/browser/win/conflicts/enumerate_shell_extensions_unittest.cc b/chrome/browser/win/conflicts/enumerate_shell_extensions_unittest.cc index 9398677a..4bbbe3882 100644 --- a/chrome/browser/win/conflicts/enumerate_shell_extensions_unittest.cc +++ b/chrome/browser/win/conflicts/enumerate_shell_extensions_unittest.cc
@@ -34,10 +34,10 @@ registry_override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE)); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; registry_util::RegistryOverrideManager registry_override_manager_;
diff --git a/chrome/browser/win/conflicts/inspection_results_cache_unittest.cc b/chrome/browser/win/conflicts/inspection_results_cache_unittest.cc index d4d0182..8c39b09 100644 --- a/chrome/browser/win/conflicts/inspection_results_cache_unittest.cc +++ b/chrome/browser/win/conflicts/inspection_results_cache_unittest.cc
@@ -48,15 +48,14 @@ class InspectionResultsCacheTest : public testing::Test { public: InspectionResultsCacheTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void SetUp() override { ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); scoped_feature_list_.InitAndEnableFeature(kInspectionResultsCache); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } base::FilePath GetCacheFilePath() { return scoped_temp_dir_.GetPath().Append(L"cache.bin"); @@ -65,7 +64,7 @@ private: base::test::ScopedFeatureList scoped_feature_list_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir scoped_temp_dir_;
diff --git a/chrome/browser/win/conflicts/module_blacklist_cache_updater_unittest.cc b/chrome/browser/win/conflicts/module_blacklist_cache_updater_unittest.cc index 456f450..e36ca75 100644 --- a/chrome/browser/win/conflicts/module_blacklist_cache_updater_unittest.cc +++ b/chrome/browser/win/conflicts/module_blacklist_cache_updater_unittest.cc
@@ -100,8 +100,7 @@ ModuleBlacklistCacheUpdaterTest() : dll1_(kDllPath1), dll2_(kDllPath2), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), user_data_dir_override_(chrome::DIR_USER_DATA), module_list_filter_(CreateModuleListFilter()), module_blacklist_cache_path_( @@ -128,12 +127,12 @@ false); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } void FastForwardBy(base::TimeDelta delta) { - scoped_task_environment_.FastForwardBy(delta); + task_environment_.FastForwardBy(delta); // The expired timer callback posts a task to update the cache. Wait for it // to finish. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } base::FilePath& module_blacklist_cache_path() { @@ -184,7 +183,7 @@ on_cache_updated_callback_invoked_ = true; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; registry_util::RegistryOverrideManager registry_override_manager_; base::ScopedPathOverride user_data_dir_override_;
diff --git a/chrome/browser/win/conflicts/module_database_unittest.cc b/chrome/browser/win/conflicts/module_database_unittest.cc index bad65ce..4e96632 100644 --- a/chrome/browser/win/conflicts/module_database_unittest.cc +++ b/chrome/browser/win/conflicts/module_database_unittest.cc
@@ -40,8 +40,8 @@ : dll1_(kDll1), dll2_(kDll2), test_browser_thread_bundle_( - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::TimeSource::MOCK_TIME), scoped_testing_local_state_(TestingBrowserProcess::GetGlobal()), module_database_(std::make_unique<ModuleDatabase>( /* third_party_blocking_policy_enabled = */ false)) {
diff --git a/chrome/browser/win/conflicts/module_inspector_unittest.cc b/chrome/browser/win/conflicts/module_inspector_unittest.cc index 1fb35748..09e9257d 100644 --- a/chrome/browser/win/conflicts/module_inspector_unittest.cc +++ b/chrome/browser/win/conflicts/module_inspector_unittest.cc
@@ -53,7 +53,7 @@ public: ModuleInspectorTest() : test_browser_thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} std::unique_ptr<ModuleInspector> CreateModuleInspector() { auto module_inspector = @@ -87,7 +87,7 @@ void ClearInspectedModules() { inspected_modules_.clear(); } - // A TestBrowserThreadBundle is required instead of a ScopedTaskEnvironment + // A TestBrowserThreadBundle is required instead of a TaskEnvironment // because of AfterStartupTaskUtils (DCHECK for BrowserThread::UI). // // Must be before the ModuleInspector.
diff --git a/chrome/browser/win/conflicts/module_load_attempt_log_listener_unittest.cc b/chrome/browser/win/conflicts/module_load_attempt_log_listener_unittest.cc index 58a74e2..d33999f 100644 --- a/chrome/browser/win/conflicts/module_load_attempt_log_listener_unittest.cc +++ b/chrome/browser/win/conflicts/module_load_attempt_log_listener_unittest.cc
@@ -57,7 +57,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; bool notified_ = false;
diff --git a/chrome/browser/win/conflicts/registry_key_watcher_unittest.cc b/chrome/browser/win/conflicts/registry_key_watcher_unittest.cc index dff7e0b..9582e24f 100644 --- a/chrome/browser/win/conflicts/registry_key_watcher_unittest.cc +++ b/chrome/browser/win/conflicts/registry_key_watcher_unittest.cc
@@ -32,7 +32,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; registry_util::RegistryOverrideManager registry_override_manager_; DISALLOW_COPY_AND_ASSIGN(RegistryKeyWatcherTest);
diff --git a/chrome/browser/win/taskbar_icon_finder_unittest.cc b/chrome/browser/win/taskbar_icon_finder_unittest.cc index 950cfd8..ae0e8f22 100644 --- a/chrome/browser/win/taskbar_icon_finder_unittest.cc +++ b/chrome/browser/win/taskbar_icon_finder_unittest.cc
@@ -13,7 +13,7 @@ // The most simple test possible to ensure that the finder doesn't leak or // cause crashes. TEST(TaskbarIconFinder, Simple) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; FindTaskbarIcon(base::Bind([](base::Closure quit_closure,
diff --git a/chrome/chrome_cleaner/components/component_manager_unittest.cc b/chrome/chrome_cleaner/components/component_manager_unittest.cc index 9efa7623..2d01a69e 100644 --- a/chrome/chrome_cleaner/components/component_manager_unittest.cc +++ b/chrome/chrome_cleaner/components/component_manager_unittest.cc
@@ -68,7 +68,7 @@ } // namespace TEST(ComponentManagerTest, Empty) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; TestComponentManagerDelegate::Calls calls; TestComponentManagerDelegate delegate(&calls); @@ -118,7 +118,7 @@ } TEST(ComponentManagerTest, All) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; TestComponentManagerDelegate::Calls delegate_calls; TestComponentManagerDelegate delegate(&delegate_calls); @@ -173,7 +173,7 @@ } TEST(ComponentManagerTest, Interrupt) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; TestComponentManagerDelegate::Calls delegate_calls; TestComponentManagerDelegate delegate(&delegate_calls);
diff --git a/chrome/chrome_cleaner/components/recovery_component_unittest.cc b/chrome/chrome_cleaner/components/recovery_component_unittest.cc index d4a3412..5720b79 100644 --- a/chrome/chrome_cleaner/components/recovery_component_unittest.cc +++ b/chrome/chrome_cleaner/components/recovery_component_unittest.cc
@@ -67,8 +67,8 @@ RecoveryComponentTest() : task_runner_(new base::TestSimpleTaskRunner) {} // Needed for the current task runner to be available. - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; // The recover component under test. This declaration must be after the // |ui_message_loop_| because the |RecoveryComponent| constructor needs
diff --git a/chrome/chrome_cleaner/engines/broker/cleaner_sandbox_interface_unittest.cc b/chrome/chrome_cleaner/engines/broker/cleaner_sandbox_interface_unittest.cc index b85b297..210e9ca 100644 --- a/chrome/chrome_cleaner/engines/broker/cleaner_sandbox_interface_unittest.cc +++ b/chrome/chrome_cleaner/engines/broker/cleaner_sandbox_interface_unittest.cc
@@ -182,7 +182,7 @@ std::unique_ptr<chrome_cleaner::FileRemoverAPI> file_remover_; bool reboot_required_ = false; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(CleanerSandboxInterfaceDeleteFileTest, DeleteFile_BasicFile) {
diff --git a/chrome/chrome_cleaner/engines/broker/engine_requests_no_blocking_unittest.cc b/chrome/chrome_cleaner/engines/broker/engine_requests_no_blocking_unittest.cc index be51772..a4a09c23 100644 --- a/chrome/chrome_cleaner/engines/broker/engine_requests_no_blocking_unittest.cc +++ b/chrome/chrome_cleaner/engines/broker/engine_requests_no_blocking_unittest.cc
@@ -435,7 +435,7 @@ }; MULTIPROCESS_TEST_MAIN(EngineRequestsNoBlocking) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; auto child_process = SetupSandboxedChildProcess(); if (!child_process) @@ -523,7 +523,7 @@ if (base::win::GetVersion() == base::win::Version::WIN8) return; - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // This event will be shared between the parent and child processes. The // parent will wait on the event to simulate a long-running function call.
diff --git a/chrome/chrome_cleaner/engines/controllers/engine_cleaner_unittest.cc b/chrome/chrome_cleaner/engines/controllers/engine_cleaner_unittest.cc index 83388cb8..4277417 100644 --- a/chrome/chrome_cleaner/engines/controllers/engine_cleaner_unittest.cc +++ b/chrome/chrome_cleaner/engines/controllers/engine_cleaner_unittest.cc
@@ -94,7 +94,7 @@ TestPUPData test_pup_data_; std::unique_ptr<EngineCleaner> engine_cleaner_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ResultCode done_status_ = RESULT_CODE_INVALID; };
diff --git a/chrome/chrome_cleaner/engines/controllers/extension_removal_unittest.cc b/chrome/chrome_cleaner/engines/controllers/extension_removal_unittest.cc index 1e971a7..ada56e7 100644 --- a/chrome/chrome_cleaner/engines/controllers/extension_removal_unittest.cc +++ b/chrome/chrome_cleaner/engines/controllers/extension_removal_unittest.cc
@@ -283,7 +283,7 @@ base::ScopedPathOverride program_files_override_{base::DIR_PROGRAM_FILES}; const std::vector<UwS::TraceLocation> trace_locations_{ chrome_cleaner::UwS_TraceLocation_FOUND_IN_SHELL}; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<EngineClient> SetupEngineClient() { SandboxConnectionErrorCallback connection_error_callback =
diff --git a/chrome/chrome_cleaner/engines/controllers/main_controller_unittest.cc b/chrome/chrome_cleaner/engines/controllers/main_controller_unittest.cc index ca5fe4a..07b187f 100644 --- a/chrome/chrome_cleaner/engines/controllers/main_controller_unittest.cc +++ b/chrome/chrome_cleaner/engines/controllers/main_controller_unittest.cc
@@ -227,8 +227,7 @@ class MainControllerTest : public testing::TestWithParam<ExecutionMode> { public: MainControllerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} TestMainController* test_main_controller() { return test_main_controller_.get(); @@ -289,7 +288,7 @@ private: TestEngineFacade test_engine_facade_; std::unique_ptr<TestMainController> test_main_controller_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ExecutionMode execution_mode_; };
diff --git a/chrome/chrome_cleaner/engines/controllers/scanner_controller_impl_unittest.cc b/chrome/chrome_cleaner/engines/controllers/scanner_controller_impl_unittest.cc index a4a874e..3101148 100644 --- a/chrome/chrome_cleaner/engines/controllers/scanner_controller_impl_unittest.cc +++ b/chrome/chrome_cleaner/engines/controllers/scanner_controller_impl_unittest.cc
@@ -210,7 +210,7 @@ } // Scoped task environment needs to be created before task runner. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::SequencedTaskRunner> task_runner_; scoped_refptr<MockEngineClient> mock_engine_client_{
diff --git a/chrome/chrome_cleaner/engines/controllers/scanner_impl_unittest.cc b/chrome/chrome_cleaner/engines/controllers/scanner_impl_unittest.cc index 92b8eaf..e589c17a 100644 --- a/chrome/chrome_cleaner/engines/controllers/scanner_impl_unittest.cc +++ b/chrome/chrome_cleaner/engines/controllers/scanner_impl_unittest.cc
@@ -182,7 +182,7 @@ } TestPUPData test_pup_data_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<StrictMockEngineClient> mock_engine_client_{ base::MakeRefCounted<StrictMockEngineClient>()};
diff --git a/chrome/chrome_cleaner/engines/controllers/uwe_scanner_wrapper_unittest.cc b/chrome/chrome_cleaner/engines/controllers/uwe_scanner_wrapper_unittest.cc index 0b635cd..44133ed5 100644 --- a/chrome/chrome_cleaner/engines/controllers/uwe_scanner_wrapper_unittest.cc +++ b/chrome/chrome_cleaner/engines/controllers/uwe_scanner_wrapper_unittest.cc
@@ -210,7 +210,7 @@ UwEMatchers matchers_; TestPUPData test_pup_data_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<StrictMockEngineClient> mock_engine_client_{ base::MakeRefCounted<StrictMockEngineClient>()};
diff --git a/chrome/chrome_cleaner/engines/target/cleaner_engine_requests_proxy_unittest.cc b/chrome/chrome_cleaner/engines/target/cleaner_engine_requests_proxy_unittest.cc index 504f9b9..d73151b 100644 --- a/chrome/chrome_cleaner/engines/target/cleaner_engine_requests_proxy_unittest.cc +++ b/chrome/chrome_cleaner/engines/target/cleaner_engine_requests_proxy_unittest.cc
@@ -146,7 +146,7 @@ scoped_refptr<TestParentProcess> parent_process_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // CleanerEngineRequestsProxyTest is parameterized with:
diff --git a/chrome/chrome_cleaner/engines/target/engine_file_requests_proxy_unittest.cc b/chrome/chrome_cleaner/engines/target/engine_file_requests_proxy_unittest.cc index b3613b1..013c8f3c 100644 --- a/chrome/chrome_cleaner/engines/target/engine_file_requests_proxy_unittest.cc +++ b/chrome/chrome_cleaner/engines/target/engine_file_requests_proxy_unittest.cc
@@ -372,7 +372,7 @@ }; TEST_P(EngineFileRequestsProxyTest, TestRequest) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Create resources that tests running in the sandbox will not have access to // create for themselves, even before calling LowerToken.
diff --git a/chrome/chrome_cleaner/engines/target/engine_requests_proxy_unittest.cc b/chrome/chrome_cleaner/engines/target/engine_requests_proxy_unittest.cc index e7d98dbd..66e6b601d 100644 --- a/chrome/chrome_cleaner/engines/target/engine_requests_proxy_unittest.cc +++ b/chrome/chrome_cleaner/engines/target/engine_requests_proxy_unittest.cc
@@ -724,7 +724,7 @@ }; TEST_P(EngineRequestsProxyTest, TestRequest) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Create resources that tests running in the sandbox will not have access to // create for themselves, even before calling LowerToken.
diff --git a/chrome/chrome_cleaner/ipc/chrome_prompt_ipc_unittest.cc b/chrome/chrome_cleaner/ipc/chrome_prompt_ipc_unittest.cc index 88206d8..86b98f8 100644 --- a/chrome/chrome_cleaner/ipc/chrome_prompt_ipc_unittest.cc +++ b/chrome/chrome_cleaner/ipc/chrome_prompt_ipc_unittest.cc
@@ -291,7 +291,7 @@ MULTIPROCESS_TEST_MAIN(ChromePromptIPCClientMain) { static constexpr int kInternalTestFailureExitCode = -1; - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; scoped_refptr<MojoTaskRunner> mojo_task_runner = MojoTaskRunner::Create(); auto child_process =
diff --git a/chrome/chrome_cleaner/ipc/mojo_sandbox_hooks_unittest.cc b/chrome/chrome_cleaner/ipc/mojo_sandbox_hooks_unittest.cc index c3af8e61..fa75eca 100644 --- a/chrome/chrome_cleaner/ipc/mojo_sandbox_hooks_unittest.cc +++ b/chrome/chrome_cleaner/ipc/mojo_sandbox_hooks_unittest.cc
@@ -38,7 +38,7 @@ scoped_refptr<MojoTaskRunner> mojo_task_runner_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // |TestMojoSandboxHooksImpl| runs and handles mojo requests in the sandbox @@ -133,7 +133,7 @@ (*impl_ptr).reset(new TestMojoSandboxHooksImpl(std::move(request))); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; void RunEchoString(mojom::TestMojoSandboxHooksPtr* test_mojo_ptr,
diff --git a/chrome/chrome_cleaner/logging/cleaner_logging_service_unittest.cc b/chrome/chrome_cleaner/logging/cleaner_logging_service_unittest.cc index bfbd9df..c5d452d 100644 --- a/chrome/chrome_cleaner/logging/cleaner_logging_service_unittest.cc +++ b/chrome/chrome_cleaner/logging/cleaner_logging_service_unittest.cc
@@ -320,8 +320,7 @@ CleanerLoggingServiceTest() : logging_service_(nullptr), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + task_environment_(base::test::TaskEnvironment::MainThreadType::UI), done_callback_called_(false), upload_success_(false), matched_uws_(&kMatchedUwSSignature), @@ -335,7 +334,7 @@ std::unique_ptr<RegistryLogger> registry_logger_; // Needed for the current task runner to be available. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // |done_callback_called_| is set to true in |LoggingServiceDone| to confirm // it was called appropriately.
diff --git a/chrome/chrome_cleaner/logging/pending_logs_service_unittest.cc b/chrome/chrome_cleaner/logging/pending_logs_service_unittest.cc index 18305b3d..60d0a2c 100644 --- a/chrome/chrome_cleaner/logging/pending_logs_service_unittest.cc +++ b/chrome/chrome_cleaner/logging/pending_logs_service_unittest.cc
@@ -39,8 +39,7 @@ public: PendingLogsServiceTest() : logging_service_(nullptr), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + task_environment_(base::test::TaskEnvironment::MainThreadType::UI), done_callback_called_(false), upload_success_(false), cleanup_execution_mode_settings_(ExecutionMode::kCleanup) {} @@ -135,7 +134,7 @@ std::unique_ptr<RegistryLogger> registry_logger_; // Needed for the current task runner to be available. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // |done_callback_called_| is set to true in |LogsUploadCallback| to confirm // it was called appropriately. bool done_callback_called_;
diff --git a/chrome/chrome_cleaner/logging/reporter_logging_service_unittest.cc b/chrome/chrome_cleaner/logging/reporter_logging_service_unittest.cc index b1bf6d5..fc41fbb2 100644 --- a/chrome/chrome_cleaner/logging/reporter_logging_service_unittest.cc +++ b/chrome/chrome_cleaner/logging/reporter_logging_service_unittest.cc
@@ -47,8 +47,7 @@ class ReporterLoggingServiceTest : public testing::Test { public: ReporterLoggingServiceTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} // LoggingServiceAPI::UploadResultCallback implementation. void LoggingServiceDone(base::OnceClosure run_loop_quit, bool success) { @@ -93,7 +92,7 @@ LoggingServiceAPI* reporter_logging_service_; // Needed for the current task runner to be available. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // |done_callback_called_| is set to true in |LoggingServiceDone| to confirm // it was called appropriately.
diff --git a/chrome/chrome_cleaner/logging/safe_browsing_reporter_unittest.cc b/chrome/chrome_cleaner/logging/safe_browsing_reporter_unittest.cc index a02c14c0..6f90c91 100644 --- a/chrome/chrome_cleaner/logging/safe_browsing_reporter_unittest.cc +++ b/chrome/chrome_cleaner/logging/safe_browsing_reporter_unittest.cc
@@ -60,8 +60,7 @@ protected: SafeBrowsingReporterTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} // Uploads a report and waits for OnReportUploadResult to be called. void DoUploadReport(const std::string& serialized_report) { @@ -74,7 +73,7 @@ } // Needed for the current task runner to be available. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // |result_| and |response_string_| are set in |OnReportUploadResult| and used // to confirm that the upload succeeded or failed appropriately.
diff --git a/chrome/chrome_cleaner/os/file_remover_unittest.cc b/chrome/chrome_cleaner/os/file_remover_unittest.cc index 2d73202..478b941 100644 --- a/chrome/chrome_cleaner/os/file_remover_unittest.cc +++ b/chrome/chrome_cleaner/os/file_remover_unittest.cc
@@ -96,7 +96,7 @@ } FileRemover default_file_remover_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; bool reboot_required_ = false; }; @@ -444,7 +444,7 @@ } bool use_reboot_removal_ = false; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; std::unique_ptr<FileRemover> file_remover_; };
diff --git a/chrome/chrome_cleaner/parsers/broker/lnk_parser_sandbox_setup_unittest.cc b/chrome/chrome_cleaner/parsers/broker/lnk_parser_sandbox_setup_unittest.cc index e250a85f..754115f 100644 --- a/chrome/chrome_cleaner/parsers/broker/lnk_parser_sandbox_setup_unittest.cc +++ b/chrome/chrome_cleaner/parsers/broker/lnk_parser_sandbox_setup_unittest.cc
@@ -55,7 +55,7 @@ ParsedLnkFile test_parsed_shortcut_; mojom::LnkParsingResult test_result_code_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::FilePath not_lnk_file_path_; base::ScopedTempDir temp_dir_;
diff --git a/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser_unittest.cc b/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser_unittest.cc index d9bd197..c637c3a 100644 --- a/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser_unittest.cc +++ b/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser_unittest.cc
@@ -97,7 +97,7 @@ base::ScopedTempDir temp_dir_without_chrome_lnk_; base::FilePath not_lnk_file_path_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; MULTIPROCESS_TEST_MAIN(SandboxedShortcutParserTargetMain) {
diff --git a/chrome/chrome_cleaner/parsers/target/parser_impl_unittest.cc b/chrome/chrome_cleaner/parsers/target/parser_impl_unittest.cc index 31ca049..36a0f13 100644 --- a/chrome/chrome_cleaner/parsers/target/parser_impl_unittest.cc +++ b/chrome/chrome_cleaner/parsers/target/parser_impl_unittest.cc
@@ -76,7 +76,7 @@ base::FilePath not_lnk_file_path_; base::ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; SandboxedShortcutParser shortcut_parser_; ParsedLnkFile test_parsed_shortcut_;
diff --git a/chrome/chrome_cleaner/ui/chrome_proxy_main_dialog_unittest.cc b/chrome/chrome_cleaner/ui/chrome_proxy_main_dialog_unittest.cc index 716f4a5..5f39890 100644 --- a/chrome/chrome_cleaner/ui/chrome_proxy_main_dialog_unittest.cc +++ b/chrome/chrome_cleaner/ui/chrome_proxy_main_dialog_unittest.cc
@@ -48,8 +48,8 @@ } TEST_F(ChromeProxyMainDialogTest, NoPUPsFound) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); base::RunLoop run_loop; EXPECT_CALL(delegate_, OnClose()) @@ -94,8 +94,8 @@ prompt_acceptance == PromptAcceptance::ACCEPTED_WITHOUT_LOGS; bool logs_allowed = prompt_acceptance == PromptAcceptance::ACCEPTED_WITH_LOGS; - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); EXPECT_CALL(mock_settings_, set_logs_allowed_in_cleanup_mode(Eq(logs_allowed)))
diff --git a/chrome/chrome_cleaner/zip_archiver/broker/sandbox_setup_unittest.cc b/chrome/chrome_cleaner/zip_archiver/broker/sandbox_setup_unittest.cc index 4391b75f..2719b58 100644 --- a/chrome/chrome_cleaner/zip_archiver/broker/sandbox_setup_unittest.cc +++ b/chrome/chrome_cleaner/zip_archiver/broker/sandbox_setup_unittest.cc
@@ -78,7 +78,7 @@ scoped_refptr<MojoTaskRunner> mojo_task_runner_; UniqueZipArchiverPtr zip_archiver_ptr_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; void OnArchiveDone(ZipArchiverResultCode* test_result_code,
diff --git a/chrome/chrome_cleaner/zip_archiver/sandboxed_zip_archiver_unittest.cc b/chrome/chrome_cleaner/zip_archiver/sandboxed_zip_archiver_unittest.cc index 93f783107..99331f6 100644 --- a/chrome/chrome_cleaner/zip_archiver/sandboxed_zip_archiver_unittest.cc +++ b/chrome/chrome_cleaner/zip_archiver/sandboxed_zip_archiver_unittest.cc
@@ -97,7 +97,7 @@ base::FilePath expect_zip_file_path_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<SandboxedZipArchiver> zip_archiver_; }; @@ -327,7 +327,7 @@ std::move(callback).Run(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<MojoTaskRunner> mojo_task_runner_; std::unique_ptr<SandboxedZipArchiver> zip_archiver_; std::unique_ptr<ArgumentVerifyingFakeArchiver, base::OnTaskRunnerDeleter>
diff --git a/chrome/chrome_cleaner/zip_archiver/target/zip_archiver_impl_unittest.cc b/chrome/chrome_cleaner/zip_archiver/target/zip_archiver_impl_unittest.cc index df1d029e..7692406 100644 --- a/chrome/chrome_cleaner/zip_archiver/target/zip_archiver_impl_unittest.cc +++ b/chrome/chrome_cleaner/zip_archiver/target/zip_archiver_impl_unittest.cc
@@ -50,7 +50,7 @@ base::FilePath zip_file_path_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; void RunArchiver(base::win::ScopedHandle src_file_handle,
diff --git a/chrome/chrome_watcher/OWNERS b/chrome/chrome_watcher/OWNERS index 3224b9e..164e70d 100644 --- a/chrome/chrome_watcher/OWNERS +++ b/chrome/chrome_watcher/OWNERS
@@ -1,2 +1,3 @@ siggi@chromium.org pmonette@chromium.org +# COMPONENT: Internals>PlatformIntegration
diff --git a/chrome/common/conflicts/module_watcher_win_unittest.cc b/chrome/common/conflicts/module_watcher_win_unittest.cc index 9efcb783..3b98503 100644 --- a/chrome/common/conflicts/module_watcher_win_unittest.cc +++ b/chrome/common/conflicts/module_watcher_win_unittest.cc
@@ -55,14 +55,14 @@ module_ = nullptr; } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } std::unique_ptr<ModuleWatcher> Create() { return ModuleWatcher::Create( base::Bind(&ModuleWatcherTest::OnModuleEvent, base::Unretained(this))); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Holds a handle to a loaded module. HMODULE module_;
diff --git a/chrome/common/conflicts/remote_module_watcher_win_unittest.cc b/chrome/common/conflicts/remote_module_watcher_win_unittest.cc index 32324d4..f6fa607 100644 --- a/chrome/common/conflicts/remote_module_watcher_win_unittest.cc +++ b/chrome/common/conflicts/remote_module_watcher_win_unittest.cc
@@ -29,8 +29,7 @@ public mojom::ModuleEventSink { public: RemoteModuleWatcherTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), service_binding_(this, test_connector_factory_.RegisterInstance( content::mojom::kSystemServiceName)), @@ -84,9 +83,9 @@ } // Runs the task scheduler until no tasks are running. - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } void FastForwardByIdleDelay() { - scoped_task_environment_.FastForwardBy(RemoteModuleWatcher::kIdleDelay); + task_environment_.FastForwardBy(RemoteModuleWatcher::kIdleDelay); } HMODULE module_handle() { return module_handle_; } @@ -99,7 +98,7 @@ } // Must be first. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestConnectorFactory test_connector_factory_;
diff --git a/chrome/common/heap_profiler_controller_unittest.cc b/chrome/common/heap_profiler_controller_unittest.cc index 9974053..ba3cd183 100644 --- a/chrome/common/heap_profiler_controller_unittest.cc +++ b/chrome/common/heap_profiler_controller_unittest.cc
@@ -21,8 +21,8 @@ class HeapProfilerControllerTest : public testing::Test { protected: - base::test::ScopedTaskEnvironment scoped_task_environment{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; }; TEST_F(HeapProfilerControllerTest, MAYBE_EmptyProfileIsNotEmitted) { @@ -34,7 +34,7 @@ })); controller.Start(); - scoped_task_environment.FastForwardBy(base::TimeDelta::FromDays(365)); + task_environment.FastForwardBy(base::TimeDelta::FromDays(365)); } // Sampling profiler is not capable of unwinding stack on Android under tests. @@ -83,7 +83,7 @@ sampler->RecordAlloc(reinterpret_cast<void*>(0x7331), kAllocationSize, base::PoissonAllocationSampler::kMalloc, nullptr); - scoped_task_environment.FastForwardUntilNoTasksRemain(); + task_environment.FastForwardUntilNoTasksRemain(); EXPECT_LE(kSnapshotsToCollect, profile_count); } #endif
diff --git a/chrome/common/media_router/mojom/media_router_mojom_traits_unittest.cc b/chrome/common/media_router/mojom/media_router_mojom_traits_unittest.cc index 6b0d182..ef5f05e 100644 --- a/chrome/common/media_router/mojom/media_router_mojom_traits_unittest.cc +++ b/chrome/common/media_router/mojom/media_router_mojom_traits_unittest.cc
@@ -35,7 +35,7 @@ std::move(callback).Run(sink); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::BindingSet<MediaRouterTraitsTestService> traits_test_bindings_; DISALLOW_COPY_AND_ASSIGN(MediaRouterStructTraitsTest);
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index c371f1a..7da5adb 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h
@@ -77,51 +77,57 @@ // Sent by the renderer process to check whether access to web databases is // granted by content settings. -IPC_SYNC_MESSAGE_CONTROL3_1(ChromeViewHostMsg_AllowDatabase, +IPC_SYNC_MESSAGE_CONTROL4_1(ChromeViewHostMsg_AllowDatabase, int /* render_frame_id */, - GURL /* origin_url */, - GURL /* top origin url */, + url::Origin /* origin */, + GURL /* site_for_cookies */, + url::Origin /* top frame_origin */, bool /* allowed */) // Sent by the renderer process to check whether access to DOM Storage is // granted by content settings. -IPC_SYNC_MESSAGE_CONTROL4_1(ChromeViewHostMsg_AllowDOMStorage, +IPC_SYNC_MESSAGE_CONTROL5_1(ChromeViewHostMsg_AllowDOMStorage, int /* render_frame_id */, - GURL /* origin_url */, - GURL /* top origin url */, + url::Origin /* origin */, + GURL /* site_for_cookies */, + url::Origin /* top frame_origin */, bool /* if true local storage, otherwise session */, bool /* allowed */) // Sent by the renderer process to check whether access to FileSystem is // granted by content settings. -IPC_SYNC_MESSAGE_CONTROL3_1(ChromeViewHostMsg_RequestFileSystemAccessSync, +IPC_SYNC_MESSAGE_CONTROL4_1(ChromeViewHostMsg_RequestFileSystemAccessSync, int /* render_frame_id */, - GURL /* origin_url */, - GURL /* top origin url */, + url::Origin /* origin */, + GURL /* site_for_cookies */, + url::Origin /* top frame_origin */, bool /* allowed */) // Sent by the renderer process to check whether access to FileSystem is // granted by content settings. -IPC_MESSAGE_CONTROL4(ChromeViewHostMsg_RequestFileSystemAccessAsync, - int /* render_frame_id */, - int /* request_id */, - GURL /* origin_url */, - GURL /* top origin url */) +IPC_MESSAGE_CONTROL5(ChromeViewHostMsg_RequestFileSystemAccessAsync, + int /* render_frame_id */, + int /* request_id */, + url::Origin /* origin */, + GURL /* site_for_cookies */, + url::Origin /* top frame_origin */) // Sent by the renderer process to check whether access to Indexed DB is // granted by content settings. -IPC_SYNC_MESSAGE_CONTROL3_1(ChromeViewHostMsg_AllowIndexedDB, +IPC_SYNC_MESSAGE_CONTROL4_1(ChromeViewHostMsg_AllowIndexedDB, int /* render_frame_id */, - GURL /* origin_url */, - GURL /* top origin url */, + url::Origin /* origin */, + GURL /* site_for_cookies */, + url::Origin /* top frame_origin */, bool /* allowed */) // Sent by the renderer process to check whether access to CacheStorage is // granted by content settings. -IPC_SYNC_MESSAGE_CONTROL3_1(ChromeViewHostMsg_AllowCacheStorage, +IPC_SYNC_MESSAGE_CONTROL4_1(ChromeViewHostMsg_AllowCacheStorage, int /* render_frame_id */, - GURL /* origin_url */, - GURL /* top origin url */, + url::Origin /* origin */, + GURL /* site_for_cookies */, + url::Origin /* top frame_origin */, bool /* allowed */) #if BUILDFLAG(ENABLE_PLUGINS)
diff --git a/chrome/common/service_process_util_mac_unittest.mm b/chrome/common/service_process_util_mac_unittest.mm index 9110247..00c50731 100644 --- a/chrome/common/service_process_util_mac_unittest.mm +++ b/chrome/common/service_process_util_mac_unittest.mm
@@ -51,14 +51,14 @@ ASSERT_TRUE(MockLaunchd::MakeABundle(GetTempDirPath(), "Test", &bundle_path_, &executable_path_)); mock_launchd_.reset(new MockLaunchd( - executable_path_, scoped_task_environment_.GetMainThreadTaskRunner(), + executable_path_, task_environment_.GetMainThreadTaskRunner(), run_loop_.QuitClosure(), true)); scoped_launchd_instance_.reset( new Launchd::ScopedInstance(mock_launchd_.get())); ASSERT_TRUE(service_process_state_.Initialize()); ASSERT_TRUE(service_process_state_.SignalReady( io_thread_.task_runner().get(), base::Closure())); - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop_.QuitWhenIdleClosure(), TestTimeouts::action_max_timeout()); } @@ -77,8 +77,8 @@ private: base::ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; base::RunLoop run_loop_; base::Thread io_thread_; base::FilePath executable_path_, bundle_path_;
diff --git a/chrome/common/service_process_util_unittest.cc b/chrome/common/service_process_util_unittest.cc index 4e0ca368..222303e 100644 --- a/chrome/common/service_process_util_unittest.cc +++ b/chrome/common/service_process_util_unittest.cc
@@ -231,7 +231,7 @@ MULTIPROCESS_TEST_MAIN(ServiceProcessStateTestShutdown) { base::PlatformThread::SetName("ServiceProcessStateTestShutdownMainThread"); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; base::Thread io_thread_("ServiceProcessStateTestShutdownIOThread"); base::Thread::Options options(base::MessagePumpType::IO, 0);
diff --git a/chrome/renderer/chromeos_delayed_callback_group_unittest.cc b/chrome/renderer/chromeos_delayed_callback_group_unittest.cc index 3a89451..5d1360c 100644 --- a/chrome/renderer/chromeos_delayed_callback_group_unittest.cc +++ b/chrome/renderer/chromeos_delayed_callback_group_unittest.cc
@@ -17,7 +17,7 @@ using base::TimeDelta; TEST(DelayedCallbackGroup, RunEmpty) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; auto callback_group = base::MakeRefCounted<DelayedCallbackGroup>( TimeDelta::FromSeconds(1), base::SequencedTaskRunnerHandle::Get()); callback_group->RunAll(); @@ -25,7 +25,7 @@ TEST(DelayedCallbackGroup, RunSimple) { const TimeDelta kTimeout = TimeDelta::FromMilliseconds(500); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; auto callback_group = base::MakeRefCounted<DelayedCallbackGroup>( TimeDelta::FromSeconds(1), base::SequencedTaskRunnerHandle::Get()); @@ -47,7 +47,7 @@ TEST(DelayedCallbackGroup, TimeoutSimple) { const TimeDelta kTimeout = TimeDelta::FromMilliseconds(500); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; auto callback_group = base::MakeRefCounted<DelayedCallbackGroup>( TimeDelta::FromSeconds(1), base::SequencedTaskRunnerHandle::Get()); @@ -68,7 +68,7 @@ TEST(DelayedCallbackGroup, TimeoutAndRun) { const TimeDelta kTimeout = TimeDelta::FromMilliseconds(500); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; auto callback_group = base::MakeRefCounted<DelayedCallbackGroup>( TimeDelta::FromSeconds(1), base::SequencedTaskRunnerHandle::Get()); @@ -110,7 +110,7 @@ TEST(DelayedCallbackGroup, DoubleExpiration) { const TimeDelta kTimeout = TimeDelta::FromMilliseconds(500); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; auto callback_group = base::MakeRefCounted<DelayedCallbackGroup>( TimeDelta::FromSeconds(1), base::SequencedTaskRunnerHandle::Get());
diff --git a/chrome/renderer/content_settings_observer.cc b/chrome/renderer/content_settings_observer.cc index 0665ee0c..67f7a209 100644 --- a/chrome/renderer/content_settings_observer.cc +++ b/chrome/renderer/content_settings_observer.cc
@@ -50,6 +50,7 @@ using blink::WebDocument; using blink::WebFrame; +using blink::WebLocalFrame; using blink::WebSecurityOrigin; using blink::WebString; using blink::WebURL; @@ -251,20 +252,21 @@ } bool ContentSettingsObserver::AllowDatabase() { - WebFrame* frame = render_frame()->GetWebFrame(); + WebLocalFrame* frame = render_frame()->GetWebFrame(); if (IsUniqueFrame(frame)) return false; bool result = false; Send(new ChromeViewHostMsg_AllowDatabase( - routing_id(), url::Origin(frame->GetSecurityOrigin()).GetURL(), - url::Origin(frame->Top()->GetSecurityOrigin()).GetURL(), &result)); + routing_id(), frame->GetSecurityOrigin(), + frame->GetDocument().SiteForCookies(), + frame->GetDocument().TopFrameOrigin(), &result)); return result; } void ContentSettingsObserver::RequestFileSystemAccessAsync( base::OnceCallback<void(bool)> callback) { - WebFrame* frame = render_frame()->GetWebFrame(); + WebLocalFrame* frame = render_frame()->GetWebFrame(); if (IsUniqueFrame(frame)) { std::move(callback).Run(false); return; @@ -279,9 +281,9 @@ DCHECK(inserted); Send(new ChromeViewHostMsg_RequestFileSystemAccessAsync( - routing_id(), current_request_id_, - url::Origin(frame->GetSecurityOrigin()).GetURL(), - url::Origin(frame->Top()->GetSecurityOrigin()).GetURL())); + routing_id(), current_request_id_, frame->GetSecurityOrigin(), + frame->GetDocument().SiteForCookies(), + frame->GetDocument().TopFrameOrigin())); } bool ContentSettingsObserver::AllowImage(bool enabled_per_settings, @@ -306,27 +308,29 @@ } bool ContentSettingsObserver::AllowIndexedDB(const WebSecurityOrigin& origin) { - WebFrame* frame = render_frame()->GetWebFrame(); + WebLocalFrame* frame = render_frame()->GetWebFrame(); if (IsUniqueFrame(frame)) return false; bool result = false; Send(new ChromeViewHostMsg_AllowIndexedDB( - routing_id(), url::Origin(frame->GetSecurityOrigin()).GetURL(), - url::Origin(frame->Top()->GetSecurityOrigin()).GetURL(), &result)); + routing_id(), frame->GetSecurityOrigin(), + frame->GetDocument().SiteForCookies(), + frame->GetDocument().TopFrameOrigin(), &result)); return result; } bool ContentSettingsObserver::AllowCacheStorage( const blink::WebSecurityOrigin& origin) { - WebFrame* frame = render_frame()->GetWebFrame(); + WebLocalFrame* frame = render_frame()->GetWebFrame(); if (IsUniqueFrame(frame)) return false; bool result = false; Send(new ChromeViewHostMsg_AllowCacheStorage( - routing_id(), url::Origin(frame->GetSecurityOrigin()).GetURL(), - url::Origin(frame->Top()->GetSecurityOrigin()).GetURL(), &result)); + routing_id(), frame->GetSecurityOrigin(), + frame->GetDocument().SiteForCookies(), + frame->GetDocument().TopFrameOrigin(), &result)); return result; } @@ -380,7 +384,7 @@ } bool ContentSettingsObserver::AllowStorage(bool local) { - blink::WebLocalFrame* frame = render_frame()->GetWebFrame(); + WebLocalFrame* frame = render_frame()->GetWebFrame(); if (IsUniqueFrame(frame)) return false; @@ -392,8 +396,9 @@ bool result = false; Send(new ChromeViewHostMsg_AllowDOMStorage( - routing_id(), url::Origin(frame->GetSecurityOrigin()).GetURL(), - url::Origin(frame->Top()->GetSecurityOrigin()).GetURL(), local, &result)); + routing_id(), frame->GetSecurityOrigin(), + frame->GetDocument().SiteForCookies(), + frame->GetDocument().TopFrameOrigin(), local, &result)); cached_storage_permissions_[key] = result; return result; }
diff --git a/chrome/renderer/content_settings_observer_browsertest.cc b/chrome/renderer/content_settings_observer_browsertest.cc index 5d8d3b2..08ff54d 100644 --- a/chrome/renderer/content_settings_observer_browsertest.cc +++ b/chrome/renderer/content_settings_observer_browsertest.cc
@@ -58,8 +58,13 @@ MOCK_METHOD2(OnContentBlocked, void(ContentSettingsType, const base::string16&)); - MOCK_METHOD5(OnAllowDOMStorage, - void(int, const GURL&, const GURL&, bool, IPC::Message*)); + MOCK_METHOD6(OnAllowDOMStorage, + void(int, + const url::Origin&, + const GURL&, + const url::Origin&, + bool, + IPC::Message*)); const GURL& image_url() const { return image_url_; } const std::string& image_origin() const { return image_origin_; } @@ -155,10 +160,9 @@ LoadHTMLWithUrlOverride("<html></html>", "https://example.com/"); MockContentSettingsObserver observer(view_->GetMainRenderFrame(), registry_.get()); - ON_CALL(observer, - OnAllowDOMStorage(_, _, _, _, _)).WillByDefault(DeleteArg<4>()); - EXPECT_CALL(observer, - OnAllowDOMStorage(_, _, _, _, _)); + ON_CALL(observer, OnAllowDOMStorage(_, _, _, _, _, _)) + .WillByDefault(DeleteArg<5>()); + EXPECT_CALL(observer, OnAllowDOMStorage(_, _, _, _, _, _)); observer.AllowStorage(true); // Accessing localStorage from the same origin again shouldn't result in a
diff --git a/chrome/renderer/extensions/extension_localization_peer_unittest.cc b/chrome/renderer/extensions/extension_localization_peer_unittest.cc index dd3b3b1..5b96974 100644 --- a/chrome/renderer/extensions/extension_localization_peer_unittest.cc +++ b/chrome/renderer/extensions/extension_localization_peer_unittest.cc
@@ -177,7 +177,7 @@ return consumer; } - base::test::ScopedTaskEnvironment scoped_environment_; + base::test::TaskEnvironment scoped_environment_; std::unique_ptr<MockIpcMessageSender> sender_; MockRequestPeer* original_peer_; std::unique_ptr<ExtensionLocalizationPeer> filter_peer_;
diff --git a/chrome/renderer/media/cast_ipc_dispatcher_unittest.cc b/chrome/renderer/media/cast_ipc_dispatcher_unittest.cc index 9b3d7bc5..97c371b 100644 --- a/chrome/renderer/media/cast_ipc_dispatcher_unittest.cc +++ b/chrome/renderer/media/cast_ipc_dispatcher_unittest.cc
@@ -26,8 +26,8 @@ } scoped_refptr<CastIPCDispatcher> dispatcher_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; }; TEST_F(CastIPCDispatcherTest, RawEvents) {
diff --git a/chrome/renderer/media/webrtc_logging_agent_impl_unittest.cc b/chrome/renderer/media/webrtc_logging_agent_impl_unittest.cc index d4a9e4d..1d29a25 100644 --- a/chrome/renderer/media/webrtc_logging_agent_impl_unittest.cc +++ b/chrome/renderer/media/webrtc_logging_agent_impl_unittest.cc
@@ -49,7 +49,7 @@ TEST(WebRtcLoggingAgentImplTest, Basic) { constexpr char kTestString[] = "abcdefghijklmnopqrstuvwxyz"; - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; mojo::UniqueReceiverSet<mojom::WebRtcLoggingClient> client_set;
diff --git a/chrome/renderer/net/net_error_helper_core_unittest.cc b/chrome/renderer/net/net_error_helper_core_unittest.cc index 87742721..4ce6e95 100644 --- a/chrome/renderer/net/net_error_helper_core_unittest.cc +++ b/chrome/renderer/net/net_error_helper_core_unittest.cc
@@ -272,9 +272,7 @@ base::MockOneShotTimer* timer() { return timer_; } - base::test::ScopedTaskEnvironment* task_environment() { - return &task_environment_; - } + base::test::TaskEnvironment* task_environment() { return &task_environment_; } content::MockRenderThread* render_thread() { return &render_thread_; } void NavigationCorrectionsLoadSuccess(const NavigationCorrection* corrections, @@ -494,7 +492,7 @@ base::MockOneShotTimer* timer_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; content::MockRenderThread render_thread_; std::unique_ptr<NetErrorHelperCore> core_;
diff --git a/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc b/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc index d3c7f299..096c156 100644 --- a/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc +++ b/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc
@@ -131,7 +131,7 @@ active_run_loop_->QuitWhenIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> active_run_loop_; MockFeatureExtractorClock clock_; std::unique_ptr<PhishingTermFeatureExtractor> extractor_;
diff --git a/chrome/renderer/v8_unwinder_unittest.cc b/chrome/renderer/v8_unwinder_unittest.cc index 016c951..8ec231b3 100644 --- a/chrome/renderer/v8_unwinder_unittest.cc +++ b/chrome/renderer/v8_unwinder_unittest.cc
@@ -51,7 +51,7 @@ class ScopedV8Environment { public: ScopedV8Environment() - : isolate_holder_(scoped_task_environment_.GetMainThreadTaskRunner(), + : isolate_holder_(task_environment_.GetMainThreadTaskRunner(), gin::IsolateHolder::IsolateType::kBlinkMainThread) { isolate()->Enter(); v8::HandleScope handle_scope(isolate()); @@ -71,7 +71,7 @@ v8::Isolate* isolate() { return isolate_holder_.isolate(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; gin::IsolateHolder isolate_holder_; v8::Persistent<v8::Context> context_; };
diff --git a/chrome/renderer/worker_content_settings_client.cc b/chrome/renderer/worker_content_settings_client.cc index 7d40793..0f4fb5b 100644 --- a/chrome/renderer/worker_content_settings_client.cc +++ b/chrome/renderer/worker_content_settings_client.cc
@@ -23,10 +23,9 @@ frame->Top()->GetSecurityOrigin().IsUnique()) is_unique_origin_ = true; sync_message_filter_ = content::RenderThread::Get()->GetSyncMessageFilter(); - document_origin_url_ = - url::Origin(frame->GetDocument().GetSecurityOrigin()).GetURL(); - top_frame_origin_url_ = - url::Origin(frame->Top()->GetSecurityOrigin()).GetURL(); + document_origin_ = frame->GetDocument().GetSecurityOrigin(); + site_for_cookies_ = frame->GetDocument().SiteForCookies(); + top_frame_origin_ = frame->GetDocument().TopFrameOrigin(); allow_running_insecure_content_ = ContentSettingsObserver::Get(render_frame) ->allow_running_insecure_content(); content_setting_rules_ = @@ -37,8 +36,9 @@ const WorkerContentSettingsClient& other) : routing_id_(other.routing_id_), is_unique_origin_(other.is_unique_origin_), - document_origin_url_(other.document_origin_url_), - top_frame_origin_url_(other.top_frame_origin_url_), + document_origin_(other.document_origin_), + site_for_cookies_(other.site_for_cookies_), + top_frame_origin_(other.top_frame_origin_), allow_running_insecure_content_(other.allow_running_insecure_content_), sync_message_filter_(other.sync_message_filter_), content_setting_rules_(other.content_setting_rules_) {} @@ -56,7 +56,8 @@ bool result = false; sync_message_filter_->Send(new ChromeViewHostMsg_RequestFileSystemAccessSync( - routing_id_, document_origin_url_, top_frame_origin_url_, &result)); + routing_id_, document_origin_, site_for_cookies_, top_frame_origin_, + &result)); return result; } @@ -67,7 +68,8 @@ bool result = false; sync_message_filter_->Send(new ChromeViewHostMsg_AllowIndexedDB( - routing_id_, document_origin_url_, top_frame_origin_url_, &result)); + routing_id_, document_origin_, site_for_cookies_, top_frame_origin_, + &result)); return result; } @@ -78,7 +80,8 @@ bool result = false; sync_message_filter_->Send(new ChromeViewHostMsg_AllowCacheStorage( - routing_id_, document_origin_url_, top_frame_origin_url_, &result)); + routing_id_, document_origin_, site_for_cookies_, top_frame_origin_, + &result)); return result; } @@ -100,8 +103,9 @@ const blink::WebURL& script_url) { bool allow = enabled_per_settings; if (allow && content_setting_rules_) { + GURL top_frame_origin_url = top_frame_origin_.GetURL(); for (const auto& rule : content_setting_rules_->script_rules) { - if (rule.primary_pattern.Matches(top_frame_origin_url_) && + if (rule.primary_pattern.Matches(top_frame_origin_url) && rule.secondary_pattern.Matches(script_url)) { allow = rule.GetContentSetting() != CONTENT_SETTING_BLOCK; break;
diff --git a/chrome/renderer/worker_content_settings_client.h b/chrome/renderer/worker_content_settings_client.h index d4566f18..7aeb81f 100644 --- a/chrome/renderer/worker_content_settings_client.h +++ b/chrome/renderer/worker_content_settings_client.h
@@ -9,6 +9,7 @@ #include "base/memory/ref_counted.h" #include "third_party/blink/public/platform/web_content_settings_client.h" #include "url/gurl.h" +#include "url/origin.h" namespace IPC { class SyncMessageFilter; @@ -49,8 +50,9 @@ // Loading document context for this worker. const int routing_id_; bool is_unique_origin_; - GURL document_origin_url_; - GURL top_frame_origin_url_; + url::Origin document_origin_; + GURL site_for_cookies_; + url::Origin top_frame_origin_; bool allow_running_insecure_content_; scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; const RendererContentSettingRules* content_setting_rules_;
diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc index 5af801c..be4aa61 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc +++ b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc
@@ -139,8 +139,8 @@ // we assume that the current thread is the IO thread where the URLFetcher // dispatches its requests to. When we wish to simulate being used from // a UI thread, we dispatch a worker thread to do so. - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; int max_retries_; Time start_time_;
diff --git a/chrome/service/cloud_print/connector_settings_unittest.cc b/chrome/service/cloud_print/connector_settings_unittest.cc index da4e309..69e0415 100644 --- a/chrome/service/cloud_print/connector_settings_unittest.cc +++ b/chrome/service/cloud_print/connector_settings_unittest.cc
@@ -72,7 +72,7 @@ } base::ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; };
diff --git a/chrome/service/cloud_print/printer_job_handler_unittest.cc b/chrome/service/cloud_print/printer_job_handler_unittest.cc index c28c7e9..7323bbe 100644 --- a/chrome/service/cloud_print/printer_job_handler_unittest.cc +++ b/chrome/service/cloud_print/printer_job_handler_unittest.cc
@@ -464,8 +464,8 @@ void BeginTest(int timeout_seconds); void MakeJobFetchReturnNoJobs(); - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; base::OnceClosure active_run_loop_quit_closure_; TestURLFetcherCallback url_callback_; MockPrinterJobHandlerDelegate jobhandler_delegate_; @@ -766,7 +766,7 @@ net::HTTP_INTERNAL_SERVER_ERROR, net::URLRequestStatus::FAILED); - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, base::BindOnce(&net::FakeURLFetcherFactory::SetFakeResponse, base::Unretained(&factory_), TicketURI(1),
diff --git a/chrome/service/net/in_process_network_connection_tracker_unittest.cc b/chrome/service/net/in_process_network_connection_tracker_unittest.cc index 1709806..d1cb1c0 100644 --- a/chrome/service/net/in_process_network_connection_tracker_unittest.cc +++ b/chrome/service/net/in_process_network_connection_tracker_unittest.cc
@@ -54,7 +54,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<net::test::MockNetworkChangeNotifier> notifier_ = net::test::MockNetworkChangeNotifier::Create(); };
diff --git a/chrome/service/service_ipc_server_unittest.cc b/chrome/service/service_ipc_server_unittest.cc index 4225a16..775012c 100644 --- a/chrome/service/service_ipc_server_unittest.cc +++ b/chrome/service/service_ipc_server_unittest.cc
@@ -78,8 +78,8 @@ protected: FakeServiceIPCServerClient service_process_client_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; base::Thread io_thread_; base::WaitableEvent shutdown_event_; std::unique_ptr<ServiceIPCServer> server_;
diff --git a/chrome/service/service_process_prefs_unittest.cc b/chrome/service/service_process_prefs_unittest.cc index 7fb42f2..29a3b44 100644 --- a/chrome/service/service_process_prefs_unittest.cc +++ b/chrome/service/service_process_prefs_unittest.cc
@@ -27,7 +27,7 @@ // The path to temporary directory used to contain the test operations. base::ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<ServiceProcessPrefs> prefs_; };
diff --git a/chrome/services/app_service/app_service_impl_unittest.cc b/chrome/services/app_service/app_service_impl_unittest.cc index fbf6910..3830c0b6f 100644 --- a/chrome/services/app_service/app_service_impl_unittest.cc +++ b/chrome/services/app_service/app_service_impl_unittest.cc
@@ -119,7 +119,7 @@ class AppServiceImplTest : public testing::Test { private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(AppServiceImplTest, PubSub) {
diff --git a/chrome/services/cups_proxy/printer_installer_unittest.cc b/chrome/services/cups_proxy/printer_installer_unittest.cc index ed3a92b..aa18d64 100644 --- a/chrome/services/cups_proxy/printer_installer_unittest.cc +++ b/chrome/services/cups_proxy/printer_installer_unittest.cc
@@ -103,7 +103,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; void OnRunInstallPrinter(base::OnceClosure finish_cb, InstallPrinterResult* ret,
diff --git a/chrome/services/cups_proxy/socket_manager_unittest.cc b/chrome/services/cups_proxy/socket_manager_unittest.cc index 1d6362f..d136dc0 100644 --- a/chrome/services/cups_proxy/socket_manager_unittest.cc +++ b/chrome/services/cups_proxy/socket_manager_unittest.cc
@@ -198,7 +198,7 @@ protected: // Must be first member. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; void OnProxyToCups(base::OnceClosure finish_cb, base::Optional<std::vector<uint8_t>>* ret,
diff --git a/chrome/services/media_gallery_util/media_parser_android_unittest.cc b/chrome/services/media_gallery_util/media_parser_android_unittest.cc index fe00a86..b974131 100644 --- a/chrome/services/media_gallery_util/media_parser_android_unittest.cc +++ b/chrome/services/media_gallery_util/media_parser_android_unittest.cc
@@ -127,7 +127,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MediaParserAndroid> parser_; base::ScopedTempDir temp_dir_;
diff --git a/chrome/services/util_win/OWNERS b/chrome/services/util_win/OWNERS index cab4a9f..228d7be2 100644 --- a/chrome/services/util_win/OWNERS +++ b/chrome/services/util_win/OWNERS
@@ -1,2 +1,3 @@ pmonette@chromium.org noel@chromium.org +# COMPONENT: Internals>Services>ServiceManager
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 28e1acc..32b54d1 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -507,6 +507,7 @@ sources = [ "../browser/engagement/important_sites_util_browsertest.cc", "../browser/payments/has_enrolled_instrument_browsertest.cc", + "../browser/payments/has_enrolled_instrument_query_quota_browsertest.cc", "../browser/payments/payment_request_can_make_payment_browsertest.cc", "../browser/payments/personal_data_manager_test_util.cc", "../browser/payments/personal_data_manager_test_util.h", @@ -642,6 +643,7 @@ "//chrome/browser", "//chrome/browser/devtools:test_support", "//chrome/browser/profiling_host:profiling_browsertests", + "//chrome/browser/resources:browser_tests", "//chrome/browser/web_applications:browser_tests", "//chrome/browser/web_applications/extensions:browser_tests", "//chrome/renderer", @@ -1787,6 +1789,7 @@ if (toolkit_views) { sources += [ "../browser/payments/has_enrolled_instrument_browsertest.cc", + "../browser/payments/has_enrolled_instrument_query_quota_browsertest.cc", "../browser/payments/manifest_verifier_browsertest.cc", "../browser/payments/payment_manifest_parser_browsertest.cc", "../browser/payments/payment_request_can_make_payment_browsertest.cc",
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/tabmodel/MockTabModelSelector.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/tabmodel/MockTabModelSelector.java index 8b04fd4..efadf739 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/tabmodel/MockTabModelSelector.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/tabmodel/MockTabModelSelector.java
@@ -28,12 +28,12 @@ for (int i = 0; i < tabCount; i++) { addMockTab(); } - if (tabCount > 0) TabModelUtils.setIndex(getModelAt(0), 0); + if (tabCount > 0) TabModelUtils.setIndex(getModel(false), 0); for (int i = 0; i < incognitoTabCount; i++) { addMockIncognitoTab(); } - if (incognitoTabCount > 0) TabModelUtils.setIndex(getModelAt(1), 0); + if (incognitoTabCount > 0) TabModelUtils.setIndex(getModel(true), 0); } private static int nextIdOffset() { @@ -41,11 +41,11 @@ } public Tab addMockTab() { - return ((MockTabModel) getModelAt(0)).addTab(ID_OFFSET + nextIdOffset()); + return ((MockTabModel) getModel(false)).addTab(ID_OFFSET + nextIdOffset()); } public Tab addMockIncognitoTab() { - return ((MockTabModel) getModelAt(1)).addTab(INCOGNITO_ID_OFFSET + nextIdOffset()); + return ((MockTabModel) getModel(true)).addTab(INCOGNITO_ID_OFFSET + nextIdOffset()); } @Override
diff --git a/chrome/test/base/browser_with_test_window_test.h b/chrome/test/base/browser_with_test_window_test.h index 43df0bf..1c1e742 100644 --- a/chrome/test/base/browser_with_test_window_test.h +++ b/chrome/test/base/browser_with_test_window_test.h
@@ -81,7 +81,7 @@ // TODO(alexclarke): Make content::TestBrowserThreadBundle::ValidTraits // imply this. - explicit ValidTraits(base::test::ScopedTaskEnvironment::ValidTrait); + explicit ValidTraits(base::test::TaskEnvironment::ValidTrait); }; // Creates a BrowserWithTestWindowTest with zero or more traits. By default
diff --git a/chrome/test/base/v8_unit_test.h b/chrome/test/base/v8_unit_test.h index c4080763c..da5d447 100644 --- a/chrome/test/base/v8_unit_test.h +++ b/chrome/test/base/v8_unit_test.h
@@ -75,7 +75,7 @@ // Initializes paths and libraries. void InitPathsAndLibraries(); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Handle scope that is used throughout the life of this class. v8::HandleScope handle_scope_;
diff --git a/chrome/test/chromedriver/commands_unittest.cc b/chrome/test/chromedriver/commands_unittest.cc index 752d1a6..49b1de5 100644 --- a/chrome/test/chromedriver/commands_unittest.cc +++ b/chrome/test/chromedriver/commands_unittest.cc
@@ -149,7 +149,7 @@ Command cmd = base::Bind(&ExecuteStubGetSession, &count); base::DictionaryValue params; - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; ExecuteGetSessions(cmd, &map, params, std::string(), base::Bind(&OnGetSessions)); @@ -192,7 +192,7 @@ int count = 0; Command cmd = base::Bind(&ExecuteStubQuit, &count); base::DictionaryValue params; - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; ExecuteQuitAll(cmd, &map, params, std::string(), base::Bind(&OnQuitAll)); ASSERT_EQ(2, count); } @@ -244,7 +244,7 @@ SessionCommand cmd = base::Bind( &ExecuteSimpleCommand, id, ¶ms, &expected_value); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; ExecuteSessionCommand( &map, "cmd", cmd, true /*w3c_standard_command*/, false, params, id, @@ -316,7 +316,7 @@ std::string id("id"); map[id] = std::move(threadInfo); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; ExecuteSessionCommand(&map, "cmd", base::Bind(&ShouldNotBeCalled), true /*w3c_standard_command*/, false, @@ -720,7 +720,7 @@ // verify the listener was called. The session owns and will destroy |proxy|. SessionCommand cmd = base::Bind(&ExecuteAddListenerToSessionCommand, base::Passed(&proxy)); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop_addlistener; // |CommandListener|s are notified immediately before commands are run. @@ -804,7 +804,7 @@ base::DictionaryValue params; // The command should never be executed if BeforeCommand fails for a listener. SessionCommand cmd = base::Bind(&ShouldNotBeCalled); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; ExecuteSessionCommand(
diff --git a/chrome/test/chromedriver/net/net_util_unittest.cc b/chrome/test/chromedriver/net/net_util_unittest.cc index f11511d..c208a18 100644 --- a/chrome/test/chromedriver/net/net_util_unittest.cc +++ b/chrome/test/chromedriver/net/net_util_unittest.cc
@@ -39,8 +39,7 @@ FetchUrlTest() : io_thread_("io"), response_(kSendHello), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { base::Thread::Options options(base::MessagePumpType::IO, 0); CHECK(io_thread_.StartWithOptions(options)); @@ -134,7 +133,7 @@ url_loader_factory_owner_; network::mojom::URLLoaderFactory* url_loader_factory_; std::string server_url_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; } // namespace
diff --git a/chrome/test/chromedriver/net/websocket_unittest.cc b/chrome/test/chromedriver/net/websocket_unittest.cc index 50d11ed..e2fb1e37 100644 --- a/chrome/test/chromedriver/net/websocket_unittest.cc +++ b/chrome/test/chromedriver/net/websocket_unittest.cc
@@ -90,7 +90,7 @@ : new WebSocket(url, listener, read_buffer_size_)); base::RunLoop run_loop; sock->Connect(base::BindOnce(&OnConnectFinished, &run_loop, &error)); - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromSeconds(10)); run_loop.Run(); if (error == net::OK) @@ -111,15 +111,15 @@ ASSERT_TRUE(sock->Send(messages[i])); } base::RunLoop run_loop; - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromSeconds(10)); run_loop.Run(); } void SetReadBufferSize(size_t size) { read_buffer_size_ = size; } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; TestHttpServer server_; size_t read_buffer_size_ = 0; }; @@ -134,7 +134,7 @@ TEST_F(WebSocketTest, Connect) { CloseListener listener(NULL); ASSERT_TRUE(CreateWebSocket(server_.web_socket_url(), &listener)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(server_.WaitForConnectionsToClose()); } @@ -147,7 +147,7 @@ server_.SetRequestAction(TestHttpServer::kNotFound); CloseListener listener(NULL); ASSERT_FALSE(CreateWebSocket(server_.web_socket_url(), NULL)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(server_.WaitForConnectionsToClose()); } @@ -164,7 +164,7 @@ std::unique_ptr<WebSocket> sock(CreateConnectedWebSocket(&listener)); ASSERT_TRUE(sock); ASSERT_TRUE(sock->Send("hi")); - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromSeconds(10)); run_loop.Run(); } @@ -177,7 +177,7 @@ server_.Stop(); sock->Send("hi"); - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromSeconds(10)); run_loop.Run(); ASSERT_FALSE(sock->Send("hi"));
diff --git a/chrome/test/data/webui/settings/chromeos/cups_printer_page_tests.js b/chrome/test/data/webui/settings/chromeos/cups_printer_page_tests.js index a10b44e..8eaec39 100644 --- a/chrome/test/data/webui/settings/chromeos/cups_printer_page_tests.js +++ b/chrome/test/data/webui/settings/chromeos/cups_printer_page_tests.js
@@ -988,6 +988,58 @@ }); }); + test('TestNonAutoConfPrintersCanSelectManufactureAndModel', function() { + dialog.pendingPrinter_ = { + ppdManufacturer: '', + ppdModel: '', + printerAddress: '03f0/e414?serial=CD4234', + printerDescription: '', + printerId: 'id_123', + printerManufacturer: '', + printerModel: '', + printerMakeAndModel: '', + printerName: 'Test Printer', + printerPPDPath: '', + printerPpdReference: { + userSuppliedPpdUrl: '', + effectiveMakeAndModel: '', + autoconf: false, + }, + printerProtocol: 'ipp', + printerQueue: 'moreinfohere', + printerStatus: '', + }; + + // Assert that the manufacturer and model drop-downs are shown. + assertFalse(dialog.$$('#makeAndModelSection').hidden); + }); + + test('TestAutoConfPrintersCannotSelectManufactureAndModel', function() { + dialog.pendingPrinter_ = { + ppdManufacturer: '', + ppdModel: '', + printerAddress: '03f0/e414?serial=CD4234', + printerDescription: '', + printerId: 'id_123', + printerManufacturer: '', + printerModel: '', + printerMakeAndModel: '', + printerName: 'Test Printer', + printerPPDPath: '', + printerPpdReference: { + userSuppliedPpdUrl: '', + effectiveMakeAndModel: '', + autoconf: true, + }, + printerProtocol: 'ipp', + printerQueue: 'moreinfohere', + printerStatus: '', + }; + + // Assert that the manufacturer and model drop-downs are hidden. + assertTrue(!dialog.$$('#makeAndModelSection').if); + }); + test('TestChangingNameEnablesSaveButton', function() { dialog.pendingPrinter_ = { ppdManufacturer: '', @@ -1150,6 +1202,8 @@ printerStatus: '', }; setPpdManufacturerAndPpdModel('manufacture', 'model'); + Polymer.dom.flush(); + // Printers are considered initialized for editing after PPD make/models // are set. dialog.arePrinterFieldsInitialized_ = true;
diff --git a/chrome/test/pixel/browser_skia_gold_pixel_diff.h b/chrome/test/pixel/browser_skia_gold_pixel_diff.h index b7532917..c9caf90 100644 --- a/chrome/test/pixel/browser_skia_gold_pixel_diff.h +++ b/chrome/test/pixel/browser_skia_gold_pixel_diff.h
@@ -25,7 +25,7 @@ class BrowserSkiaGoldPixelDiff : public SkiaGoldPixelDiff { public: BrowserSkiaGoldPixelDiff(); - ~BrowserSkiaGoldPixelDiff(); + ~BrowserSkiaGoldPixelDiff() override; // Call Init method before using this class. // Args: // widget The instance you plan to take screenshots with.
diff --git a/chrome/test/views/chrome_views_test_base.h b/chrome/test/views/chrome_views_test_base.h index 563ab9b..5d85294 100644 --- a/chrome/test/views/chrome_views_test_base.h +++ b/chrome/test/views/chrome_views_test_base.h
@@ -26,7 +26,7 @@ : views::ViewsTestBase( views::ViewsTestBase::SubclassManagesTaskEnvironment()), thread_bundle_( - base::test::ScopedTaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::MainThreadType::UI, base::trait_helpers::GetEnum< content::TestBrowserThreadBundle::TimeSource, content::TestBrowserThreadBundle::TimeSource::MOCK_TIME>(
diff --git a/chrome/updater/win/net/network_unittest.cc b/chrome/updater/win/net/network_unittest.cc index 8500a39..d4f3586 100644 --- a/chrome/updater/win/net/network_unittest.cc +++ b/chrome/updater/win/net/network_unittest.cc
@@ -12,8 +12,8 @@ namespace updater { TEST(UpdaterTestNetwork, NetworkFetcherWinHTTPFactory) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); auto fetcher = base::MakeRefCounted<NetworkFetcherFactory>()->Create(); EXPECT_NE(nullptr, fetcher.get()); }
diff --git a/chrome/utility/image_writer/image_writer_unittest.cc b/chrome/utility/image_writer/image_writer_unittest.cc index b466786f..d6205d0 100644 --- a/chrome/utility/image_writer/image_writer_unittest.cc +++ b/chrome/utility/image_writer/image_writer_unittest.cc
@@ -55,7 +55,7 @@ base::FilePath device_path_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; };
diff --git a/chromecast/base/bind_to_task_runner_unittest.cc b/chromecast/base/bind_to_task_runner_unittest.cc index 100e585..3b9f63bd 100644 --- a/chromecast/base/bind_to_task_runner_unittest.cc +++ b/chromecast/base/bind_to_task_runner_unittest.cc
@@ -50,7 +50,7 @@ public: ~BindToTaskRunnerTest() override { base::RunLoop().RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockCallbacks callbacks_; };
diff --git a/chromecast/base/metrics/cast_metrics_helper_unittest.cc b/chromecast/base/metrics/cast_metrics_helper_unittest.cc index 7b4b0380..757854eb 100644 --- a/chromecast/base/metrics/cast_metrics_helper_unittest.cc +++ b/chromecast/base/metrics/cast_metrics_helper_unittest.cc
@@ -70,20 +70,19 @@ class CastMetricsHelperTest : public ::testing::Test { public: CastMetricsHelperTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), - metrics_helper_(scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMockTickClock()) { + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), + metrics_helper_(task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMockTickClock()) { metrics_helper_.SetMetricsSink(&metrics_sink_); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockMetricsSink metrics_sink_; CastMetricsHelper metrics_helper_; }; TEST_F(CastMetricsHelperTest, RecordEventWithValue) { - const auto expected_time = scoped_task_environment_.NowTicks(); + const auto expected_time = task_environment_.NowTicks(); EXPECT_CALL( metrics_sink_, @@ -100,7 +99,7 @@ metrics_helper_.DidCompleteLoad(kAppId1, kSessionId1); metrics_helper_.UpdateSDKInfo(kSdkVersion); - const auto expected_time = scoped_task_environment_.NowTicks(); + const auto expected_time = task_environment_.NowTicks(); EXPECT_CALL( metrics_sink_, @@ -118,7 +117,7 @@ metrics_helper_.DidCompleteLoad(kAppId1, kSessionId1); metrics_helper_.UpdateSDKInfo(kSdkVersion); - const auto expected_time = scoped_task_environment_.NowTicks(); + const auto expected_time = task_environment_.NowTicks(); EXPECT_CALL( metrics_sink_, @@ -136,7 +135,7 @@ metrics_helper_.DidCompleteLoad(kAppId1, kSessionId1); constexpr base::TimeDelta kTimeToFirstPaint = base::TimeDelta::FromSeconds(5); - scoped_task_environment_.FastForwardBy(kTimeToFirstPaint); + task_environment_.FastForwardBy(kTimeToFirstPaint); EXPECT_CALL(metrics_sink_, OnTimeEvent(AllOf(HasSubstr(kAppId1), HasSubstr("TimeToFirstPaint")), @@ -149,7 +148,7 @@ metrics_helper_.DidCompleteLoad(kAppId1, kSessionId1); constexpr base::TimeDelta kTimeToFirstAudio = base::TimeDelta::FromSeconds(5); - scoped_task_environment_.FastForwardBy(kTimeToFirstAudio); + task_environment_.FastForwardBy(kTimeToFirstAudio); EXPECT_CALL(metrics_sink_, OnTimeEvent(AllOf(HasSubstr(kAppId1), HasSubstr("TimeToFirstAudio")), @@ -159,7 +158,7 @@ TEST_F(CastMetricsHelperTest, MultipleApps) { metrics_helper_.DidStartLoad(kAppId1); - scoped_task_environment_.FastForwardBy(kAppLoadTimeout); + task_environment_.FastForwardBy(kAppLoadTimeout); metrics_helper_.DidStartLoad(kAppId2); metrics_helper_.DidStartLoad(kAppId3); metrics_helper_.DidCompleteLoad(kAppId3, kSessionId3);
diff --git a/chromecast/browser/bluetooth/cast_bluetooth_chooser_unittest.cc b/chromecast/browser/bluetooth/cast_bluetooth_chooser_unittest.cc index 562073c..e2377de0 100644 --- a/chromecast/browser/bluetooth/cast_bluetooth_chooser_unittest.cc +++ b/chromecast/browser/bluetooth/cast_bluetooth_chooser_unittest.cc
@@ -52,7 +52,7 @@ provider_binding_.Bind(mojo::MakeRequest(&provider)); cast_bluetooth_chooser_ = std::make_unique<CastBluetoothChooser>( handler_.Get(), std::move(provider)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } ~CastBluetoothChooserTest() override = default; @@ -66,7 +66,7 @@ content::BluetoothChooser& chooser() { return *cast_bluetooth_chooser_; } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::MockCallback<content::BluetoothChooser::EventHandler> handler_; private: @@ -82,7 +82,7 @@ // device. |handler| should not run yet. EXPECT_TRUE(provider().client()); provider().client()->GrantAccess("aa:bb:cc:dd:ee:ff"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Make some unapproved devices available. |handler| should not run yet. AddDeviceToChooser("11:22:33:44:55:66"); @@ -93,7 +93,7 @@ "aa:bb:cc:dd:ee:ff")); EXPECT_CALL(provider().connection_closed(), Run()); AddDeviceToChooser("aa:bb:cc:dd:ee:ff"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CastBluetoothChooserTest, DiscoverDeviceBeforeAccessGranted) { @@ -109,21 +109,21 @@ "00:00:00:11:00:00")); EXPECT_CALL(provider().connection_closed(), Run()); provider().client()->GrantAccess("00:00:00:11:00:00"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CastBluetoothChooserTest, GrantAccessToAllDevicesBeforeDiscovery) { // Grant access to all devices. |handler| should not run until the first // device is made available. provider().client()->GrantAccessToAllDevices(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Now make the some device available. |handler| should be called. EXPECT_CALL(handler_, Run(content::BluetoothChooser::Event::SELECTED, "aa:bb:cc:dd:ee:ff")); EXPECT_CALL(provider().connection_closed(), Run()); AddDeviceToChooser("aa:bb:cc:dd:ee:ff"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CastBluetoothChooserTest, GrantAccessToAllDevicesAfterDiscovery) { @@ -140,21 +140,21 @@ "00:00:00:11:00:00"))); EXPECT_CALL(provider().connection_closed(), Run()); provider().client()->GrantAccessToAllDevices(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CastBluetoothChooserTest, TearDownClientAfterAllAccessGranted) { // Grant access to all devices. |handler| should not run until the first // device is made available. provider().client()->GrantAccessToAllDevices(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Tear down the client. Now that it has granted access to the client, it does // not need to keep a reference to it. However, the chooser should stay alive // and wait for devices to be made available. provider().client().reset(); EXPECT_FALSE(provider().client()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // As soon as a device is available, run the handler. EXPECT_CALL(handler_, Run(content::BluetoothChooser::Event::SELECTED, @@ -173,7 +173,7 @@ EXPECT_CALL(handler_, Run(content::BluetoothChooser::Event::CANCELLED, "")); provider().client().reset(); EXPECT_FALSE(provider().client()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } -} // namespace chromecast \ No newline at end of file +} // namespace chromecast
diff --git a/chromecast/device/bluetooth/le/le_scan_manager_impl_test.cc b/chromecast/device/bluetooth/le/le_scan_manager_impl_test.cc index 91eaf7e8..1994160 100644 --- a/chromecast/device/bluetooth/le/le_scan_manager_impl_test.cc +++ b/chromecast/device/bluetooth/le/le_scan_manager_impl_test.cc
@@ -55,7 +55,7 @@ le_scan_manager_(&le_scanner_) { le_scan_manager_.Initialize(io_task_runner_); le_scan_manager_.AddObserver(&mock_observer_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } ~LeScanManagerTest() override { le_scan_manager_.RemoveObserver(&mock_observer_); @@ -66,7 +66,7 @@ return &le_scan_manager_; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; bluetooth_v2_shlib::MockLeScanner le_scanner_; LeScanManagerImpl le_scan_manager_; @@ -87,14 +87,14 @@ EXPECT_CALL(mock_observer_, OnScanEnableChanged(true)); le_scan_manager_.RequestScan(base::BindOnce( &CopyResult<std::unique_ptr<LeScanManager::ScanHandle>>, &scan_handle)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(scan_handle); // After deleting the last handle, we expect scan to be disabled. EXPECT_CALL(le_scanner_, StopScan()).WillOnce(Return(true)); EXPECT_CALL(mock_observer_, OnScanEnableChanged(false)); scan_handle.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(LeScanManagerTest, TestMultipleHandles) { @@ -108,7 +108,7 @@ std::unique_ptr<LeScanManager::ScanHandle> handle; le_scan_manager_.RequestScan(base::BindOnce( &CopyResult<std::unique_ptr<LeScanManager::ScanHandle>>, &handle)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(handle); scan_handles.push_back(std::move(handle)); } @@ -116,14 +116,14 @@ EXPECT_CALL(le_scanner_, StopScan()).Times(0); for (int i = 0; i < kNumHandles - 1; ++i) { scan_handles.pop_back(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // After deleting the last handle, we expect scan to be disabled. EXPECT_CALL(le_scanner_, StopScan()).WillOnce(Return(true)); EXPECT_CALL(mock_observer_, OnScanEnableChanged(false)); scan_handles.pop_back(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(LeScanManagerTest, TestGetScanResultsEmpty) { @@ -133,7 +133,7 @@ le_scan_manager_.GetScanResults( base::BindOnce(&CopyResult<std::vector<LeScanResult>>, &results)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(0u, results.size()); } @@ -146,7 +146,7 @@ EXPECT_CALL(le_scanner_, StartScan()).WillOnce(Return(false)); le_scan_manager_.RequestScan(base::BindOnce( &CopyResult<std::unique_ptr<LeScanManager::ScanHandle>>, &scan_handle)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(scan_handle); } @@ -158,14 +158,14 @@ EXPECT_CALL(mock_observer_, OnNewScanResult(_)); delegate()->OnScanResult(raw_scan_result); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::vector<LeScanResult> results; // Get asynchronous scan results. le_scan_manager_.GetScanResults( base::BindOnce(&CopyResult<std::vector<LeScanResult>>, &results)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1u, results.size()); ASSERT_EQ(kTestAddr1, results[0].addr); @@ -188,14 +188,14 @@ raw_scan_result.rssi = 1234; delegate()->OnScanResult(raw_scan_result); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Get asynchronous scan results for results with service 0x4444. std::vector<LeScanResult> results; le_scan_manager_.GetScanResults( base::BindOnce(&CopyResult<std::vector<LeScanResult>>, &results), ScanFilter::From16bitUuid(0x4444)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1u, results.size()); ASSERT_EQ(kTestAddr1, results[0].addr); @@ -207,7 +207,7 @@ le_scan_manager_.GetScanResults( base::BindOnce(&CopyResult<std::vector<LeScanResult>>, &results), ScanFilter::From16bitUuid(0x5555)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1u, results.size()); ASSERT_EQ(kTestAddr2, results[0].addr); @@ -219,7 +219,7 @@ le_scan_manager_.GetScanResults( base::BindOnce(&CopyResult<std::vector<LeScanResult>>, &results), ScanFilter::From16bitUuid(0x6666)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(0u, results.size()); } @@ -246,14 +246,14 @@ raw_scan_result.rssi = 2; delegate()->OnScanResult(raw_scan_result); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::vector<LeScanResult> results; // Get asynchronous scan results. le_scan_manager_.GetScanResults( base::BindOnce(&CopyResult<std::vector<LeScanResult>>, &results)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(3u, results.size()); EXPECT_EQ(kTestAddr2, results[0].addr); @@ -276,7 +276,7 @@ raw_scan_result.adv_data = {0x03, 0x02, 0x44, 0x44}; raw_scan_result.rssi = 1; delegate()->OnScanResult(raw_scan_result); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Ensure that the observer was notified. ASSERT_EQ(kTestAddr1, result.addr); @@ -299,14 +299,14 @@ delegate()->OnScanResult(raw_scan_result); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::vector<LeScanResult> results; // Get asynchronous scan results. le_scan_manager_.GetScanResults( base::BindOnce(&CopyResult<std::vector<LeScanResult>>, &results)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // First 5 addresses should have been kicked out. ASSERT_EQ(1024u, results.size());
diff --git a/chromecast/media/audio/capture_service/capture_service_receiver_unittest.cc b/chromecast/media/audio/capture_service/capture_service_receiver_unittest.cc index c17b8ee..e1a0e37f 100644 --- a/chromecast/media/audio/capture_service/capture_service_receiver_unittest.cc +++ b/chromecast/media/audio/capture_service/capture_service_receiver_unittest.cc
@@ -44,8 +44,8 @@ ~CaptureServiceReceiverTest() override = default; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; chromecast::MockAudioInputCallback audio_; CaptureServiceReceiver receiver_; }; @@ -59,13 +59,13 @@ // Sync. receiver_.StartWithSocket(&audio_, std::move(socket1)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); receiver_.Stop(); // Async. receiver_.StartWithSocket(&audio_, std::move(socket2)); receiver_.Stop(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CaptureServiceReceiverTest, ConnectFailed) { @@ -74,7 +74,7 @@ EXPECT_CALL(audio_, OnError()); receiver_.StartWithSocket(&audio_, std::move(socket)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CaptureServiceReceiverTest, ConnectTimeout) { @@ -83,8 +83,7 @@ EXPECT_CALL(audio_, OnError()); receiver_.StartWithSocket(&audio_, std::move(socket)); - scoped_task_environment_.FastForwardBy( - CaptureServiceReceiver::kConnectTimeout); + task_environment_.FastForwardBy(CaptureServiceReceiver::kConnectTimeout); } TEST_F(CaptureServiceReceiverTest, ReceiveValidMessage) { @@ -108,7 +107,7 @@ EXPECT_CALL(audio_, OnData(_, _, 1.0 /* volume */)); receiver_.StartWithSocket(&audio_, std::move(socket)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CaptureServiceReceiverTest, ReceiveInvalidMessage) { @@ -126,7 +125,7 @@ EXPECT_CALL(audio_, OnError()); receiver_.StartWithSocket(&audio_, std::move(socket)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CaptureServiceReceiverTest, ReceiveError) { @@ -137,7 +136,7 @@ EXPECT_CALL(audio_, OnError()); receiver_.StartWithSocket(&audio_, std::move(socket)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CaptureServiceReceiverTest, ReceiveEosMessage) { @@ -147,7 +146,7 @@ EXPECT_CALL(audio_, OnError()); receiver_.StartWithSocket(&audio_, std::move(socket)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CaptureServiceReceiverTest, ReceiveTimeout) { @@ -157,8 +156,7 @@ EXPECT_CALL(audio_, OnError()); receiver_.StartWithSocket(&audio_, std::move(socket)); - scoped_task_environment_.FastForwardBy( - CaptureServiceReceiver::kInactivityTimeout); + task_environment_.FastForwardBy(CaptureServiceReceiver::kInactivityTimeout); } } // namespace
diff --git a/chromecast/media/audio/cast_audio_manager_unittest.cc b/chromecast/media/audio/cast_audio_manager_unittest.cc index 53624400..498b0c6 100644 --- a/chromecast/media/audio/cast_audio_manager_unittest.cc +++ b/chromecast/media/audio/cast_audio_manager_unittest.cc
@@ -129,7 +129,7 @@ base::BindRepeating(&CastAudioManagerTest::GetCmaBackendFactory, base::Unretained(this)), base::BindRepeating(&DummyGetSessionId), - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), audio_thread_.task_runner(), connector_.get(), use_mixer, true /* force_use_cma_backend_for_output*/ )); @@ -163,7 +163,7 @@ } void RunThreadsUntilIdle() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); audio_thread_.FlushForTesting(); } @@ -172,7 +172,7 @@ } base::Thread audio_thread_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ::media::FakeAudioLogFactory fake_audio_log_factory_; std::unique_ptr<MockCmaBackendFactory> mock_backend_factory_; ::media::MockAudioSourceCallback mock_source_callback_; @@ -287,10 +287,10 @@ EXPECT_CALL(mock_source_callback_, OnMoreData(_, _, _, _)) .WillRepeatedly(Invoke(OnMoreData)); EXPECT_CALL(mock_source_callback_, OnError()).Times(0); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); stream->Stop(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); stream->Close(); }
diff --git a/chromecast/media/audio/cast_audio_mixer_unittest.cc b/chromecast/media/audio/cast_audio_mixer_unittest.cc index c767e94..ce91c64 100644 --- a/chromecast/media/audio/cast_audio_mixer_unittest.cc +++ b/chromecast/media/audio/cast_audio_mixer_unittest.cc
@@ -140,8 +140,7 @@ class CastAudioMixerTest : public ::testing::Test { public: CastAudioMixerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), connector_(CreateConnector()), source_callback_(nullptr) {} ~CastAudioMixerTest() override {} @@ -149,7 +148,7 @@ protected: void SetUp() override { mock_manager_.reset(new StrictMock<MockCastAudioManager>( - connector_.get(), scoped_task_environment_.GetMainThreadTaskRunner())); + connector_.get(), task_environment_.GetMainThreadTaskRunner())); mock_mixer_stream_.reset(new StrictMock<MockMediaAudioOutputStream>()); ON_CALL(*mock_manager_, MakeMixerOutputStream(_)) @@ -172,7 +171,7 @@ GetAudioParams(), "", ::media::AudioManager::LogCallback()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<service_manager::Connector> connector_; std::unique_ptr<MockCastAudioManager> mock_manager_; std::unique_ptr<MockMediaAudioOutputStream> mock_mixer_stream_;
diff --git a/chromecast/media/audio/cast_audio_output_stream_unittest.cc b/chromecast/media/audio/cast_audio_output_stream_unittest.cc index 9c58872..a7c7548 100644 --- a/chromecast/media/audio/cast_audio_output_stream_unittest.cc +++ b/chromecast/media/audio/cast_audio_output_stream_unittest.cc
@@ -227,8 +227,7 @@ public: CastAudioOutputStreamTest() : audio_thread_("CastAudioThread"), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), format_(::media::AudioParameters::AUDIO_PCM_LINEAR), channel_layout_(::media::CHANNEL_LAYOUT_MONO), sample_rate_(::media::AudioParameters::kAudioCDSampleRate), @@ -288,7 +287,7 @@ base::BindRepeating(&CastAudioOutputStreamTest::GetCmaBackendFactory, base::Unretained(this)), base::BindRepeating(&DummyGetSessionId), - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), audio_thread_.task_runner(), connector_.get(), use_mixer, true /* force_use_cma_backend_for_output*/)); audio_manager_->SetConnectorForTesting(std::move(connector_)); @@ -312,7 +311,7 @@ } void RunThreadsUntilIdle() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); audio_thread_.FlushForTesting(); } @@ -332,7 +331,7 @@ } base::Thread audio_thread_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockCmaBackendFactory> mock_backend_factory_; FakeCmaBackend* cma_backend_ = nullptr; @@ -690,7 +689,7 @@ ASSERT_TRUE(cma_backend_); base::TimeDelta duration = GetAudioParams().GetBufferDuration() * 2; - scoped_task_environment_.FastForwardBy(duration); + task_environment_.FastForwardBy(duration); RunThreadsUntilIdle(); stream->Close(); @@ -721,7 +720,7 @@ ASSERT_TRUE(cma_backend_); base::TimeDelta duration = GetAudioParams().GetBufferDuration() * 2; - scoped_task_environment_.FastForwardBy(duration); + task_environment_.FastForwardBy(duration); RunThreadsUntilIdle(); }
diff --git a/chromecast/media/base/media_resource_tracker_unittest.cc b/chromecast/media/base/media_resource_tracker_unittest.cc index 02e7173..16902f6 100644 --- a/chromecast/media/base/media_resource_tracker_unittest.cc +++ b/chromecast/media/base/media_resource_tracker_unittest.cc
@@ -62,8 +62,8 @@ test_mocks_.reset(new MediaResourceTrackerTestMocks()); resource_tracker_ = new TestMediaResourceTracker( - test_mocks_.get(), scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner()); + test_mocks_.get(), task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner()); } void InitializeMediaLib() { @@ -72,7 +72,7 @@ base::RunLoop().RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestMediaResourceTracker* resource_tracker_; std::unique_ptr<MediaResourceTrackerTestMocks> test_mocks_;
diff --git a/chromecast/media/cma/backend/audio_decoder_software_wrapper_unittest.cc b/chromecast/media/cma/backend/audio_decoder_software_wrapper_unittest.cc index 7441d86..befa1d9 100644 --- a/chromecast/media/cma/backend/audio_decoder_software_wrapper_unittest.cc +++ b/chromecast/media/cma/backend/audio_decoder_software_wrapper_unittest.cc
@@ -39,7 +39,7 @@ AudioDecoderSoftwareWrapperTest() : audio_decoder_software_wrapper_(&audio_decoder_) {} - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockAudioDecoder audio_decoder_; AudioDecoderSoftwareWrapper audio_decoder_software_wrapper_; };
diff --git a/chromecast/media/cma/backend/audio_video_pipeline_device_unittest.cc b/chromecast/media/cma/backend/audio_video_pipeline_device_unittest.cc index 04f7dfc..dc11d85 100644 --- a/chromecast/media/cma/backend/audio_video_pipeline_device_unittest.cc +++ b/chromecast/media/cma/backend/audio_video_pipeline_device_unittest.cc
@@ -244,7 +244,7 @@ void OnPauseCompleted(); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MediaPipelineDeviceParams::MediaSyncType sync_type_; MediaPipelineDeviceParams::AudioStreamType audio_type_; std::unique_ptr<TaskRunnerImpl> task_runner_;
diff --git a/chromecast/media/cma/backend/fuchsia/mixer_output_stream_fuchsia_unittest.cc b/chromecast/media/cma/backend/fuchsia/mixer_output_stream_fuchsia_unittest.cc index 5d0c561..efadbe8 100644 --- a/chromecast/media/cma/backend/fuchsia/mixer_output_stream_fuchsia_unittest.cc +++ b/chromecast/media/cma/backend/fuchsia/mixer_output_stream_fuchsia_unittest.cc
@@ -18,9 +18,9 @@ class MixerOutputStreamFuchsiaTest : public ::testing::Test { protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, + base::test::TaskEnvironment::MainThreadType::IO}; MixerOutputStreamFuchsia output_; }; @@ -103,4 +103,4 @@ } } // namespace media -} // namespace chromecast \ No newline at end of file +} // namespace chromecast
diff --git a/chromecast/media/cma/backend/multizone_backend_unittest.cc b/chromecast/media/cma/backend/multizone_backend_unittest.cc index 96321e8..7fbcae71 100644 --- a/chromecast/media/cma/backend/multizone_backend_unittest.cc +++ b/chromecast/media/cma/backend/multizone_backend_unittest.cc
@@ -152,7 +152,7 @@ void OnEndOfStream(); private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::vector<std::unique_ptr<BufferFeeder>> effects_feeders_; std::unique_ptr<BufferFeeder> audio_feeder_;
diff --git a/chromecast/media/cma/base/buffering_controller_unittest.cc b/chromecast/media/cma/base/buffering_controller_unittest.cc index bbea60dd..fe4f242 100644 --- a/chromecast/media/cma/base/buffering_controller_unittest.cc +++ b/chromecast/media/cma/base/buffering_controller_unittest.cc
@@ -32,7 +32,7 @@ public: BufferingControllerTest(); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<BufferingController> buffering_controller_; MockBufferingControllerClient client_;
diff --git a/chromecast/media/cma/pipeline/audio_video_pipeline_impl_unittest.cc b/chromecast/media/cma/pipeline/audio_video_pipeline_impl_unittest.cc index 81b4acc..3262d83 100644 --- a/chromecast/media/cma/pipeline/audio_video_pipeline_impl_unittest.cc +++ b/chromecast/media/cma/pipeline/audio_video_pipeline_impl_unittest.cc
@@ -286,7 +286,7 @@ pipeline_helper_->Setup(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<PipelineHelper> pipeline_helper_; DISALLOW_COPY_AND_ASSIGN(AudioVideoPipelineImplTest); @@ -308,7 +308,7 @@ base::Closure verify_task = base::Bind(&VerifyPlay, base::Unretained(pipeline_helper_.get())); pipeline_helper_->SetPipelineStartExpectations(); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PipelineHelper::Start, base::Unretained(pipeline_helper_.get()), verify_task)); @@ -333,11 +333,11 @@ base::Closure verify_task = base::Bind(&VerifyFlush, base::Unretained(pipeline_helper_.get())); pipeline_helper_->SetPipelineStartFlushExpectations(); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PipelineHelper::Start, base::Unretained(pipeline_helper_.get()), base::Bind(&VerifyNotReached))); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PipelineHelper::Flush, base::Unretained(pipeline_helper_.get()), verify_task)); @@ -353,7 +353,7 @@ base::Unretained(pipeline_helper_.get()), stop_task); pipeline_helper_->SetPipelineStartExpectations(); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PipelineHelper::Start, base::Unretained(pipeline_helper_.get()), eos_cb)); @@ -380,7 +380,7 @@ pipeline_helper_->Setup(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<PipelineHelper> pipeline_helper_; DISALLOW_COPY_AND_ASSIGN(EncryptedAVPipelineImplTest); @@ -390,14 +390,14 @@ TEST_F(EncryptedAVPipelineImplTest, SetCdmWithLicenseBeforeStart) { base::Closure verify_task = base::Bind(&VerifyPlay, base::Unretained(pipeline_helper_.get())); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PipelineHelper::SetCdm, base::Unretained(pipeline_helper_.get()))); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PipelineHelper::SetCdmLicenseInstalled, base::Unretained(pipeline_helper_.get()))); pipeline_helper_->SetPipelineStartExpectations(); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PipelineHelper::Start, base::Unretained(pipeline_helper_.get()), verify_task)); @@ -409,16 +409,16 @@ base::Closure verify_task = base::Bind(&VerifyPlay, base::Unretained(pipeline_helper_.get())); pipeline_helper_->SetPipelineStartExpectations(); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PipelineHelper::Start, base::Unretained(pipeline_helper_.get()), verify_task)); - scoped_task_environment_.RunUntilIdle(); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.RunUntilIdle(); + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PipelineHelper::SetCdmLicenseInstalled, base::Unretained(pipeline_helper_.get()))); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PipelineHelper::SetCdm, base::Unretained(pipeline_helper_.get()))); base::RunLoop().Run(); @@ -429,16 +429,16 @@ base::Closure verify_task = base::Bind(&VerifyPlay, base::Unretained(pipeline_helper_.get())); pipeline_helper_->SetPipelineStartExpectations(); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PipelineHelper::Start, base::Unretained(pipeline_helper_.get()), verify_task)); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PipelineHelper::SetCdm, base::Unretained(pipeline_helper_.get()))); - scoped_task_environment_.RunUntilIdle(); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.RunUntilIdle(); + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PipelineHelper::SetCdmLicenseInstalled, base::Unretained(pipeline_helper_.get()))); base::RunLoop().Run();
diff --git a/chromeos/attestation/attestation_flow_unittest.cc b/chromeos/attestation/attestation_flow_unittest.cc index 5f07c6b..20e54975 100644 --- a/chromeos/attestation/attestation_flow_unittest.cc +++ b/chromeos/attestation/attestation_flow_unittest.cc
@@ -66,7 +66,7 @@ run_loop_->Run(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop* run_loop_; };
diff --git a/chromeos/audio/cras_audio_handler_unittest.cc b/chromeos/audio/cras_audio_handler_unittest.cc index 59c1499..a2bdb8b 100644 --- a/chromeos/audio/cras_audio_handler_unittest.cc +++ b/chromeos/audio/cras_audio_handler_unittest.cc
@@ -308,8 +308,7 @@ class CrasAudioHandlerTest : public testing::TestWithParam<int> { public: CrasAudioHandlerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~CrasAudioHandlerTest() override = default; void SetUp() override { @@ -484,7 +483,7 @@ return FakeCrasAudioClient::Get(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::SystemMonitor system_monitor_; SystemMonitorObserver system_monitor_observer_; CrasAudioHandler* cras_audio_handler_ = nullptr; // Not owned.
diff --git a/chromeos/components/account_manager/account_manager_unittest.cc b/chromeos/components/account_manager/account_manager_unittest.cc index 911f454f..6527024 100644 --- a/chromeos/components/account_manager/account_manager_unittest.cc +++ b/chromeos/components/account_manager/account_manager_unittest.cc
@@ -120,7 +120,7 @@ immediate_callback_runner_, base::SequencedTaskRunnerHandle::Get(), std::move(initialization_callback)); account_manager->SetPrefService(&pref_service_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(account_manager->init_state_, AccountManager::InitializationState::kInitialized); EXPECT_TRUE(account_manager->IsInitialized()); @@ -128,7 +128,7 @@ // Check base/test/scoped_task_environment.h. This must be the first member / // declared before any member that cares about tasks. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir tmp_dir_; TestingPrefServiceSimple pref_service_; network::TestURLLoaderFactory test_url_loader_factory_; @@ -239,7 +239,7 @@ TEST_F(AccountManagerTest, TestTokenPersistence) { account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, kGaiaToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResetAndInitializeAccountManager(); std::vector<AccountManager::Account> accounts = GetAccountsBlocking(); @@ -252,7 +252,7 @@ TEST_F(AccountManagerTest, TestAccountEmailPersistence) { account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, kGaiaToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResetAndInitializeAccountManager(); const std::string raw_email = GetAccountEmailBlocking(kGaiaAccountKey_); @@ -263,7 +263,7 @@ const std::string new_email = "new-email@example.org"; account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, kGaiaToken); account_manager_->UpdateEmail(kGaiaAccountKey_, new_email); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResetAndInitializeAccountManager(); const std::string raw_email = GetAccountEmailBlocking(kGaiaAccountKey_); @@ -275,7 +275,7 @@ const std::string new_email = "new-email@example.org"; account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, kGaiaToken); account_manager_->UpsertAccount(kGaiaAccountKey_, new_email, kGaiaToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResetAndInitializeAccountManager(); const std::string raw_email = GetAccountEmailBlocking(kGaiaAccountKey_); @@ -285,7 +285,7 @@ TEST_F(AccountManagerTest, UpdatingTokensShouldNotOverwriteAccountEmail) { account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, kGaiaToken); account_manager_->UpdateToken(kGaiaAccountKey_, kNewGaiaToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResetAndInitializeAccountManager(); const std::string raw_email = GetAccountEmailBlocking(kGaiaAccountKey_); @@ -300,7 +300,7 @@ account_manager_->AddObserver(observer.get()); account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, kGaiaToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(observer->is_token_upserted_callback_called_); EXPECT_EQ(1UL, observer->accounts_.size()); EXPECT_EQ(kGaiaAccountKey_, *observer->accounts_.begin()); @@ -316,12 +316,12 @@ account_manager_->AddObserver(observer.get()); account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, kGaiaToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Observers should be called when token is updated. observer->is_token_upserted_callback_called_ = false; account_manager_->UpdateToken(kGaiaAccountKey_, kNewGaiaToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(observer->is_token_upserted_callback_called_); EXPECT_EQ(1UL, observer->accounts_.size()); EXPECT_EQ(kGaiaAccountKey_, *observer->accounts_.begin()); @@ -337,12 +337,12 @@ account_manager_->AddObserver(observer.get()); account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, kGaiaToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Observers should not be called when token is not updated. observer->is_token_upserted_callback_called_ = false; account_manager_->UpdateToken(kGaiaAccountKey_, kGaiaToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(observer->is_token_upserted_callback_called_); account_manager_->RemoveObserver(observer.get()); @@ -375,7 +375,7 @@ TEST_F(AccountManagerTest, AccountRemovalIsPersistedToDisk) { account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, kGaiaToken); account_manager_->RemoveAccount(kGaiaAccountKey_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResetAndInitializeAccountManager(); EXPECT_TRUE(GetAccountsBlocking().empty()); @@ -385,7 +385,7 @@ auto observer = std::make_unique<AccountManagerObserver>(); account_manager_->AddObserver(observer.get()); account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, kGaiaToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(observer->is_account_removed_callback_called_); account_manager_->RemoveAccount(kGaiaAccountKey_); @@ -402,7 +402,7 @@ EXPECT_CALL(*account_manager_.get(), RevokeGaiaTokenOnServer(kGaiaToken)); account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, kGaiaToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); account_manager_->RemoveAccount(kGaiaAccountKey_); } @@ -414,7 +414,7 @@ account_manager_->UpsertAccount(kActiveDirectoryAccountKey_, kRawUserEmail, AccountManager::kActiveDirectoryDummyToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); account_manager_->RemoveAccount(kActiveDirectoryAccountKey_); } @@ -426,7 +426,7 @@ account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, AccountManager::kInvalidToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); account_manager_->RemoveAccount(kGaiaAccountKey_); } @@ -440,7 +440,7 @@ // Update the token. account_manager_->UpdateToken(kGaiaAccountKey_, kNewGaiaToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(AccountManagerTest, @@ -454,7 +454,7 @@ // Update the token. account_manager_->UpdateToken(kGaiaAccountKey_, kNewGaiaToken, false /* revoke_old_token */); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(AccountManagerTest, @@ -468,13 +468,13 @@ // Update the token. account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, kNewGaiaToken, false /* revoke_old_token */); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(AccountManagerTest, IsTokenAvailableReturnsTrueForValidGaiaAccounts) { EXPECT_FALSE(account_manager_->IsTokenAvailable(kGaiaAccountKey_)); account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, kGaiaToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(account_manager_->IsTokenAvailable(kGaiaAccountKey_)); } @@ -483,7 +483,7 @@ EXPECT_FALSE(account_manager_->IsTokenAvailable(kActiveDirectoryAccountKey_)); account_manager_->UpsertAccount(kActiveDirectoryAccountKey_, kRawUserEmail, AccountManager::kActiveDirectoryDummyToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(account_manager_->IsTokenAvailable(kActiveDirectoryAccountKey_)); EXPECT_TRUE( IsAccountKeyPresent(GetAccountsBlocking(), kActiveDirectoryAccountKey_)); @@ -493,7 +493,7 @@ EXPECT_FALSE(account_manager_->IsTokenAvailable(kGaiaAccountKey_)); account_manager_->UpsertAccount(kGaiaAccountKey_, kRawUserEmail, AccountManager::kInvalidToken); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(account_manager_->IsTokenAvailable(kGaiaAccountKey_)); EXPECT_TRUE(IsAccountKeyPresent(GetAccountsBlocking(), kGaiaAccountKey_)); }
diff --git a/chromeos/components/drivefs/drivefs_auth_unittest.cc b/chromeos/components/drivefs/drivefs_auth_unittest.cc index 3c455b6..a3706b0 100644 --- a/chromeos/components/drivefs/drivefs_auth_unittest.cc +++ b/chromeos/components/drivefs/drivefs_auth_unittest.cc
@@ -178,7 +178,7 @@ run_loop.Run(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestConnectorFactory connector_factory_; MockIdentityAccessor mock_identity_accessor_; base::SimpleTestClock clock_;
diff --git a/chromeos/components/drivefs/drivefs_bootstrap_unittest.cc b/chromeos/components/drivefs/drivefs_bootstrap_unittest.cc index c450667c..db496b0 100644 --- a/chromeos/components/drivefs/drivefs_bootstrap_unittest.cc +++ b/chromeos/components/drivefs/drivefs_bootstrap_unittest.cc
@@ -95,7 +95,7 @@ run_loop.Run(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; MockDriveFs mock_drivefs_; MockDriveFsDelegate mock_delegate_;
diff --git a/chromeos/components/drivefs/drivefs_host_unittest.cc b/chromeos/components/drivefs/drivefs_host_unittest.cc index 9eee170f..72feac0 100644 --- a/chromeos/components/drivefs/drivefs_host_unittest.cc +++ b/chromeos/components/drivefs/drivefs_host_unittest.cc
@@ -418,7 +418,7 @@ } base::FilePath profile_path_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; AccountId account_id_; std::unique_ptr<chromeos::disks::MockDiskMountManager> disk_manager_; std::unique_ptr<network::TestNetworkConnectionTracker>
diff --git a/chromeos/components/drivefs/drivefs_search_unittest.cc b/chromeos/components/drivefs/drivefs_search_unittest.cc index a9924a9..1d6bd78 100644 --- a/chromeos/components/drivefs/drivefs_search_unittest.cc +++ b/chromeos/components/drivefs/drivefs_search_unittest.cc
@@ -62,7 +62,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<network::TestNetworkConnectionTracker> network_connection_tracker_; MockDriveFs mock_drivefs_;
diff --git a/chromeos/components/drivefs/drivefs_session_unittest.cc b/chromeos/components/drivefs/drivefs_session_unittest.cc index 406822b6..3d9101e 100644 --- a/chromeos/components/drivefs/drivefs_session_unittest.cc +++ b/chromeos/components/drivefs/drivefs_session_unittest.cc
@@ -323,7 +323,7 @@ holder_.reset(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; struct PointerHolder { MockDiskMounter* mounter = nullptr;
diff --git a/chromeos/components/nearby/condition_variable_impl_unittest.cc b/chromeos/components/nearby/condition_variable_impl_unittest.cc index 36985b64..5bf76f67 100644 --- a/chromeos/components/nearby/condition_variable_impl_unittest.cc +++ b/chromeos/components/nearby/condition_variable_impl_unittest.cc
@@ -88,7 +88,7 @@ // testing::Test void TearDown() override { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(fake_lock_->num_locks(), fake_lock_->num_unlocks()); } @@ -132,7 +132,7 @@ expected_num_blocked_sequences /* expected_num_unlocks */); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: void WaitOnConditionVariable(bool should_succeed) { @@ -166,7 +166,7 @@ // Should unblock after notify(). condition_variable()->notify(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); VerifyNumLocksAndUnlocks(2 /* expected_num_locks */, 2 /* expected_num_unlocks */); } @@ -180,7 +180,7 @@ // All should unblock after notify(). condition_variable()->notify(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); VerifyNumLocksAndUnlocks(6 /* expected_num_locks */, 6 /* expected_num_unlocks */); }
diff --git a/chromeos/components/nearby/count_down_latch_impl_unittest.cc b/chromeos/components/nearby/count_down_latch_impl_unittest.cc index 0bd168c..a09f6cb1 100644 --- a/chromeos/components/nearby/count_down_latch_impl_unittest.cc +++ b/chromeos/components/nearby/count_down_latch_impl_unittest.cc
@@ -86,7 +86,7 @@ base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::Lock map_lock_; base::flat_map<base::UnguessableToken, base::Optional<location::nearby::ExceptionOr<bool>>>
diff --git a/chromeos/components/nearby/lock_impl_unittest.cc b/chromeos/components/nearby/lock_impl_unittest.cc index c600484c..469ac21 100644 --- a/chromeos/components/nearby/lock_impl_unittest.cc +++ b/chromeos/components/nearby/lock_impl_unittest.cc
@@ -49,7 +49,7 @@ // Makes sure that outstanding LockAndUnlockFromDifferentThread() tasks in // |different_thread_task_runner_| finish running after the test thread // relinquishes its ownership of |lock_|. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::AutoLock al(lock_->bookkeeping_lock_); EXPECT_EQ(0u, lock_->num_acquisitions_); @@ -81,7 +81,7 @@ location::nearby::Lock* lock() { return lock_.get(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: // Only meant to be posted via PostLockAndUnlockFromDifferentThread() on @@ -134,7 +134,7 @@ // Outstanding lock attempt succeed after unlocking from current thread. lock()->unlock(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(HasSuccessfullyLockedWithAttemptId(attempt_id)); } @@ -158,7 +158,7 @@ lock()->unlock(); lock()->unlock(); lock()->unlock(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(HasSuccessfullyLockedWithAttemptId(attempt_id)); } @@ -182,7 +182,7 @@ lock()->unlock(); lock()->unlock(); lock()->unlock(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(HasSuccessfullyLockedWithAttemptId(attempt_id1)); EXPECT_TRUE(HasSuccessfullyLockedWithAttemptId(attempt_id2)); EXPECT_TRUE(HasSuccessfullyLockedWithAttemptId(attempt_id3));
diff --git a/chromeos/components/nearby/scheduled_executor_impl_unittest.cc b/chromeos/components/nearby/scheduled_executor_impl_unittest.cc index 26e5af1..bd97859a 100644 --- a/chromeos/components/nearby/scheduled_executor_impl_unittest.cc +++ b/chromeos/components/nearby/scheduled_executor_impl_unittest.cc
@@ -47,10 +47,9 @@ class ScheduledExecutorImplTest : public testing::Test { protected: ScheduledExecutorImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), scheduled_executor_(std::make_unique<ScheduledExecutorImpl>( - scoped_task_environment_.GetMainThreadTaskRunner())) {} + task_environment_.GetMainThreadTaskRunner())) {} ~ScheduledExecutorImplTest() override = default; @@ -67,7 +66,7 @@ // ensures that the base::OneShotTimer associated with the Runnable has been // Start()ed, but offers no guarantee on whether the Runnable has been run() // or not. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); return cancelable; } @@ -79,7 +78,7 @@ // Ensures that the base::OneShotTimer associated with the given Cancelable // has been Stop()ped before this method returns. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void VerifySetContainsId(const base::UnguessableToken& id) { @@ -92,7 +91,7 @@ return id_set_.size(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<location::nearby::ScheduledExecutor> scheduled_executor_; private: @@ -117,7 +116,7 @@ base::UnguessableToken id = base::UnguessableToken::Create(); PostRunnableWithIdAndDelay(id, kDefaultDelayTimeDelta); - scoped_task_environment_.FastForwardBy(kDefaultDelayTimeDelta); + task_environment_.FastForwardBy(kDefaultDelayTimeDelta); EXPECT_EQ(1u, GetSetSize()); VerifySetContainsId(id); } @@ -129,11 +128,11 @@ PostRunnableWithIdAndDelay(id1, kDefaultDelayTimeDelta * 2); // Only the first scheduled task should run at first. - scoped_task_environment_.FastForwardBy(kDefaultDelayTimeDelta); + task_environment_.FastForwardBy(kDefaultDelayTimeDelta); EXPECT_EQ(1u, GetSetSize()); VerifySetContainsId(id0); - scoped_task_environment_.FastForwardBy(kDefaultDelayTimeDelta); + task_environment_.FastForwardBy(kDefaultDelayTimeDelta); EXPECT_EQ(2u, GetSetSize()); VerifySetContainsId(id1); } @@ -143,7 +142,7 @@ auto cancelable = PostRunnableWithIdAndDelay(id, kDefaultDelayTimeDelta); CancelTaskAndVerifyState(cancelable, true /* should_expect_success */); - scoped_task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); + task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); EXPECT_EQ(0u, GetSetSize()); } @@ -154,10 +153,10 @@ PostRunnableWithIdAndDelay(id1, kDefaultDelayTimeDelta * 3); CancelTaskAndVerifyState(cancelable0, true /* should_expect_success */); - scoped_task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); + task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); EXPECT_EQ(0u, GetSetSize()); - scoped_task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); + task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); EXPECT_EQ(1u, GetSetSize()); VerifySetContainsId(id1); } @@ -166,7 +165,7 @@ base::UnguessableToken id = base::UnguessableToken::Create(); auto cancelable = PostRunnableWithIdAndDelay(id, kDefaultDelayTimeDelta); - scoped_task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); + task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); CancelTaskAndVerifyState(cancelable, false /* should_expect_success */); } @@ -175,7 +174,7 @@ auto cancelable = PostRunnableWithIdAndDelay(id, kDefaultDelayTimeDelta); CancelTaskAndVerifyState(cancelable, true /* should_expect_success */); - scoped_task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); + task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); EXPECT_EQ(0u, GetSetSize()); } @@ -196,7 +195,7 @@ auto cancelable = PostRunnableWithIdAndDelay(id, kDefaultDelayTimeDelta); scheduled_executor_.reset(); - scoped_task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); + task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); CancelTaskAndVerifyState(cancelable, false /* should_expect_success */); } @@ -205,7 +204,7 @@ base::UnguessableToken id = base::UnguessableToken::Create(); auto cancelable = PostRunnableWithIdAndDelay(id, kDefaultDelayTimeDelta); - scoped_task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); + task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); EXPECT_EQ(0u, GetSetSize()); } @@ -214,7 +213,7 @@ base::UnguessableToken id = base::UnguessableToken::Create(); auto cancelable = PostRunnableWithIdAndDelay(id, kDefaultDelayTimeDelta); - scoped_task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); + task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); CancelTaskAndVerifyState(cancelable, false /* should_expect_success */); } @@ -223,7 +222,7 @@ auto cancelable = PostRunnableWithIdAndDelay(id, kDefaultDelayTimeDelta); scheduled_executor_->shutdown(); - scoped_task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); + task_environment_.FastForwardBy(kDefaultDelayTimeDelta * 2); EXPECT_EQ(1u, GetSetSize()); VerifySetContainsId(id); }
diff --git a/chromeos/components/nearby/settable_future_impl_unittest.cc b/chromeos/components/nearby/settable_future_impl_unittest.cc index 3bab8c7a..ffef269f 100644 --- a/chromeos/components/nearby/settable_future_impl_unittest.cc +++ b/chromeos/components/nearby/settable_future_impl_unittest.cc
@@ -79,7 +79,7 @@ base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: void GetAsyncResult(const base::UnguessableToken& id) {
diff --git a/chromeos/components/nearby/submittable_executor_base_unittest.cc b/chromeos/components/nearby/submittable_executor_base_unittest.cc index 060bdb7..8c6793b1 100644 --- a/chromeos/components/nearby/submittable_executor_base_unittest.cc +++ b/chromeos/components/nearby/submittable_executor_base_unittest.cc
@@ -67,10 +67,9 @@ class SubmittableExecutorBaseTest : public testing::Test { protected: SubmittableExecutorBaseTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) {} + : task_environment_( + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} ~SubmittableExecutorBaseTest() override = default; @@ -100,7 +99,7 @@ : multi_thread_executor_->execute(CreateRunnable(task_id)); // Ensures the Runnable will complete execution before this method returns. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } std::shared_ptr<location::nearby::Future<bool>> SubmitCallable( @@ -117,7 +116,7 @@ std::make_shared<SimpleCallable>())); // Ensures the Callable will complete execution before this method returns. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); return future; } @@ -143,7 +142,7 @@ base::Unretained(this), task_id)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: void OnTaskRun(const base::UnguessableToken& task_id) { @@ -233,7 +232,7 @@ base::UnguessableToken task_id = base::UnguessableToken::Create(); single_thread_executor()->execute(CreateRunnable(task_id)); single_thread_executor()->shutdown(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1u, GetNumExecutedTasks()); EXPECT_TRUE(HasTaskExecuted(task_id)); @@ -245,7 +244,7 @@ base::UnguessableToken task_id = base::UnguessableToken::Create(); multi_thread_executor()->execute(CreateRunnable(task_id)); multi_thread_executor()->shutdown(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1u, GetNumExecutedTasks()); EXPECT_TRUE(HasTaskExecuted(task_id));
diff --git a/chromeos/components/power/dark_resume_controller_unittest.cc b/chromeos/components/power/dark_resume_controller_unittest.cc index c457122..252af6e 100644 --- a/chromeos/components/power/dark_resume_controller_unittest.cc +++ b/chromeos/components/power/dark_resume_controller_unittest.cc
@@ -29,8 +29,7 @@ class DarkResumeControllerTest : public testing::Test { public: DarkResumeControllerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), wake_lock_provider_( connector_factory_.RegisterInstance(device::mojom::kServiceName)) {} @@ -75,7 +74,7 @@ return FakePowerManagerClient::Get(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestConnectorFactory connector_factory_; device::mojom::WakeLockPtr wake_lock_; std::unique_ptr<DarkResumeController> dark_resume_controller_; @@ -90,7 +89,7 @@ // Trigger a dark resume event, move time forward to trigger a wake lock check // and check if a re-suspend happened if no wake locks were acquired. fake_power_manager_client()->SendDarkSuspendImminent(); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( DarkResumeController::kDarkResumeWakeLockCheckTimeout); base::RunLoop run_loop; run_loop.RunUntilIdle(); @@ -105,7 +104,7 @@ fake_power_manager_client()->SendDarkSuspendImminent(); wake_lock_->RequestWakeLock(); wake_lock_->CancelWakeLock(); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( DarkResumeController::kDarkResumeWakeLockCheckTimeout); base::RunLoop run_loop2; run_loop2.RunUntilIdle(); @@ -122,7 +121,7 @@ // observers. fake_power_manager_client()->SendDarkSuspendImminent(); wake_lock_->RequestWakeLock(); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( DarkResumeController::kDarkResumeWakeLockCheckTimeout); base::RunLoop run_loop; run_loop.RunUntilIdle(); @@ -130,9 +129,8 @@ // Move time forward by < |kDarkResumeHardTimeout| and release the // partial wake lock. This should instantaneously re-suspend the device. - scoped_task_environment_.FastForwardBy( - DarkResumeController::kDarkResumeHardTimeout - - base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(DarkResumeController::kDarkResumeHardTimeout - + base::TimeDelta::FromSeconds(1)); wake_lock_->CancelWakeLock(); base::RunLoop run_loop2; run_loop2.RunUntilIdle(); @@ -149,7 +147,7 @@ // observers. fake_power_manager_client()->SendDarkSuspendImminent(); wake_lock_->RequestWakeLock(); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( DarkResumeController::kDarkResumeWakeLockCheckTimeout); base::RunLoop run_loop; run_loop.RunUntilIdle(); @@ -157,8 +155,7 @@ // Move time forward by |kDarkResumeHardTimeout|. At this point the // device should re-suspend even though the wake lock is acquired. - scoped_task_environment_.FastForwardBy( - DarkResumeController::kDarkResumeHardTimeout); + task_environment_.FastForwardBy(DarkResumeController::kDarkResumeHardTimeout); EXPECT_EQ(1, GetActiveWakeLocks(WakeLockType::kPreventAppSuspension)); base::RunLoop run_loop2; run_loop2.RunUntilIdle(); @@ -175,7 +172,7 @@ // observers. fake_power_manager_client()->SendDarkSuspendImminent(); wake_lock_->RequestWakeLock(); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( DarkResumeController::kDarkResumeWakeLockCheckTimeout); base::RunLoop run_loop; run_loop.RunUntilIdle();
diff --git a/chromeos/components/sync_wifi/wifi_configuration_bridge_unittest.cc b/chromeos/components/sync_wifi/wifi_configuration_bridge_unittest.cc index 0853a3d..b1e49ab 100644 --- a/chromeos/components/sync_wifi/wifi_configuration_bridge_unittest.cc +++ b/chromeos/components/sync_wifi/wifi_configuration_bridge_unittest.cc
@@ -151,7 +151,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<syncer::ModelTypeStore> store_; @@ -266,4 +266,4 @@ } // namespace -} // namespace sync_wifi \ No newline at end of file +} // namespace sync_wifi
diff --git a/chromeos/components/tether/active_host_network_state_updater_unittest.cc b/chromeos/components/tether/active_host_network_state_updater_unittest.cc index 31819c0..0ebc565 100644 --- a/chromeos/components/tether/active_host_network_state_updater_unittest.cc +++ b/chromeos/components/tether/active_host_network_state_updater_unittest.cc
@@ -98,7 +98,7 @@ EXPECT_TRUE(network_state->IsConnectedState()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkStateTestHelper helper_{true /* use_default_devices_and_services */};
diff --git a/chromeos/components/tether/asynchronous_shutdown_object_container_impl_unittest.cc b/chromeos/components/tether/asynchronous_shutdown_object_container_impl_unittest.cc index c6aae2b5..270d705c 100644 --- a/chromeos/components/tether/asynchronous_shutdown_object_container_impl_unittest.cc +++ b/chromeos/components/tether/asynchronous_shutdown_object_container_impl_unittest.cc
@@ -97,7 +97,7 @@ void OnShutdownComplete() { was_shutdown_callback_invoked_ = true; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const multidevice::RemoteDeviceRef test_device_; std::unique_ptr<device_sync::FakeDeviceSyncClient> fake_device_sync_client_;
diff --git a/chromeos/components/tether/connection_preserver_impl_unittest.cc b/chromeos/components/tether/connection_preserver_impl_unittest.cc index 86bba17..3055c65 100644 --- a/chromeos/components/tether/connection_preserver_impl_unittest.cc +++ b/chromeos/components/tether/connection_preserver_impl_unittest.cc
@@ -169,7 +169,7 @@ remote_device_to_client_channel_destruction_count_map_[remote_device]++; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkStateTestHelper helper_{true /* use_default_devices_and_services */};
diff --git a/chromeos/components/tether/crash_recovery_manager_impl_unittest.cc b/chromeos/components/tether/crash_recovery_manager_impl_unittest.cc index f809ceef5..98dc75c 100644 --- a/chromeos/components/tether/crash_recovery_manager_impl_unittest.cc +++ b/chromeos/components/tether/crash_recovery_manager_impl_unittest.cc
@@ -113,7 +113,7 @@ fake_active_host_->GetActiveHostStatus()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkStateTestHelper helper_{true /* use_default_devices_and_services */}; const multidevice::RemoteDeviceRef test_device_;
diff --git a/chromeos/components/tether/host_scan_scheduler_impl_unittest.cc b/chromeos/components/tether/host_scan_scheduler_impl_unittest.cc index d15e431..7590705 100644 --- a/chromeos/components/tether/host_scan_scheduler_impl_unittest.cc +++ b/chromeos/components/tether/host_scan_scheduler_impl_unittest.cc
@@ -163,7 +163,7 @@ return helper_->network_state_handler(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::string ethernet_service_path_; std::unique_ptr<NetworkStateTestHelper> helper_;
diff --git a/chromeos/components/tether/host_scanner_impl_unittest.cc b/chromeos/components/tether/host_scanner_impl_unittest.cc index 9dff02d2..a8f32d79 100644 --- a/chromeos/components/tether/host_scanner_impl_unittest.cc +++ b/chromeos/components/tether/host_scanner_impl_unittest.cc
@@ -392,7 +392,7 @@ return helper_.network_state_handler(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkStateTestHelper helper_{true /* use_default_devices_and_services */}; const multidevice::RemoteDeviceRefList test_devices_;
diff --git a/chromeos/components/tether/host_scanner_operation_unittest.cc b/chromeos/components/tether/host_scanner_operation_unittest.cc index 6069422..13e2745 100644 --- a/chromeos/components/tether/host_scanner_operation_unittest.cc +++ b/chromeos/components/tether/host_scanner_operation_unittest.cc
@@ -136,7 +136,7 @@ mock_tether_host_response_recorder_; FakeConnectionPreserver fake_connection_preserver_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::SimpleTestClock test_clock_; scoped_refptr<base::TestSimpleTaskRunner> test_task_runner_; MockOperationObserver mock_observer_;
diff --git a/chromeos/components/tether/network_host_scan_cache_unittest.cc b/chromeos/components/tether/network_host_scan_cache_unittest.cc index 5febf3f..22cce4b 100644 --- a/chromeos/components/tether/network_host_scan_cache_unittest.cc +++ b/chromeos/components/tether/network_host_scan_cache_unittest.cc
@@ -114,7 +114,7 @@ } } - const base::test::ScopedTaskEnvironment scoped_task_environment_; + const base::test::TaskEnvironment task_environment_; NetworkStateTestHelper helper_{true /* use_default_devices_and_services */}; const std::unordered_map<std::string, HostScanCacheEntry> test_entries_;
diff --git a/chromeos/components/tether/notification_remover_unittest.cc b/chromeos/components/tether/notification_remover_unittest.cc index 79ee61c..c508d8c 100644 --- a/chromeos/components/tether/notification_remover_unittest.cc +++ b/chromeos/components/tether/notification_remover_unittest.cc
@@ -69,7 +69,7 @@ helper_.ConfigureService(ss.str()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkStateTestHelper helper_{true /* use_default_devices_and_services */}; const std::unordered_map<std::string, HostScanCacheEntry> test_entries_;
diff --git a/chromeos/components/tether/tether_connector_impl_unittest.cc b/chromeos/components/tether/tether_connector_impl_unittest.cc index c4085ea9..b98ce3d 100644 --- a/chromeos/components/tether/tether_connector_impl_unittest.cc +++ b/chromeos/components/tether/tether_connector_impl_unittest.cc
@@ -313,7 +313,7 @@ } const multidevice::RemoteDeviceRefList test_devices_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkStateTestHelper helper_{true /* use_default_devices_and_services */}; std::unique_ptr<FakeConnectTetheringOperationFactory> fake_operation_factory_;
diff --git a/chromeos/components/tether/tether_network_disconnection_handler_unittest.cc b/chromeos/components/tether/tether_network_disconnection_handler_unittest.cc index bf6d340..c5e7a190 100644 --- a/chromeos/components/tether/tether_network_disconnection_handler_unittest.cc +++ b/chromeos/components/tether/tether_network_disconnection_handler_unittest.cc
@@ -116,7 +116,7 @@ ->last_session_completion_reason()); } - const base::test::ScopedTaskEnvironment scoped_task_environment_; + const base::test::TaskEnvironment task_environment_; NetworkStateTestHelper helper_{true /* use_default_devices_and_services */}; std::string wifi_service_path_;
diff --git a/chromeos/components/tether/wifi_hotspot_connector_unittest.cc b/chromeos/components/tether/wifi_hotspot_connector_unittest.cc index 5949c17..7b104f8 100644 --- a/chromeos/components/tether/wifi_hotspot_connector_unittest.cc +++ b/chromeos/components/tether/wifi_hotspot_connector_unittest.cc
@@ -300,7 +300,7 @@ return helper_.network_state_handler(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkStateTestHelper helper_{true /* use_default_devices_and_services */}; std::string other_wifi_service_path_;
diff --git a/chromeos/components/tether/wifi_hotspot_disconnector_impl_unittest.cc b/chromeos/components/tether/wifi_hotspot_disconnector_impl_unittest.cc index 32535163..be5e2de 100644 --- a/chromeos/components/tether/wifi_hotspot_disconnector_impl_unittest.cc +++ b/chromeos/components/tether/wifi_hotspot_disconnector_impl_unittest.cc
@@ -197,7 +197,7 @@ return helper_.GetServiceStringProperty(service_path, key); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkStateTestHelper helper_{true /* use_default_devices_and_services */}; std::unique_ptr<TestNetworkConnectionHandler>
diff --git a/chromeos/cryptohome/cryptohome_util.cc b/chromeos/cryptohome/cryptohome_util.cc index 62c1757e..5731684 100644 --- a/chromeos/cryptohome/cryptohome_util.cc +++ b/chromeos/cryptohome/cryptohome_util.cc
@@ -5,6 +5,8 @@ #include "chromeos/cryptohome/cryptohome_util.h" #include <string> +#include <utility> +#include <vector> #include "base/logging.h" #include "chromeos/cryptohome/cryptohome_parameters.h" @@ -367,6 +369,9 @@ case CRYPTOHOME_ERROR_FIRMWARE_MANAGEMENT_PARAMETERS_CANNOT_STORE: case CRYPTOHOME_ERROR_FIRMWARE_MANAGEMENT_PARAMETERS_CANNOT_REMOVE: case CRYPTOHOME_ERROR_UPDATE_USER_ACTIVITY_TIMESTAMP_FAILED: + case CRYPTOHOME_ERROR_FAILED_TO_EXTEND_PCR: + case CRYPTOHOME_ERROR_FAILED_TO_READ_PCR: + case CRYPTOHOME_ERROR_PCR_ALREADY_EXTENDED: NOTREACHED(); return MOUNT_ERROR_FATAL; }
diff --git a/chromeos/cryptohome/system_salt_getter_unittest.cc b/chromeos/cryptohome/system_salt_getter_unittest.cc index eaa6acd..9fc2556 100644 --- a/chromeos/cryptohome/system_salt_getter_unittest.cc +++ b/chromeos/cryptohome/system_salt_getter_unittest.cc
@@ -24,8 +24,7 @@ class SystemSaltGetterTest : public testing::Test { protected: SystemSaltGetterTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { CryptohomeClient::InitializeFake(); @@ -41,7 +40,7 @@ CryptohomeClient::Shutdown(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(SystemSaltGetterTest, GetSystemSalt) {
diff --git a/chromeos/dbus/audio/cras_audio_client_unittest.cc b/chromeos/dbus/audio/cras_audio_client_unittest.cc index 2a2cbabd..9979210 100644 --- a/chromeos/dbus/audio/cras_audio_client_unittest.cc +++ b/chromeos/dbus/audio/cras_audio_client_unittest.cc
@@ -437,7 +437,7 @@ // The interface name. const std::string interface_name_; // A message loop to emulate asynchronous behavior. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // The mock bus. scoped_refptr<dbus::MockBus> mock_bus_; // The mock object proxy. @@ -476,7 +476,7 @@ dbus::ObjectProxy::OnConnectedCallback* on_connected_callback) { output_mute_changed_handler_ = signal_callback; const bool success = true; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*on_connected_callback), interface_name, signal_name, success)); } @@ -490,7 +490,7 @@ dbus::ObjectProxy::OnConnectedCallback* on_connected_callback) { input_mute_changed_handler_ = signal_callback; const bool success = true; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*on_connected_callback), interface_name, signal_name, success)); } @@ -504,7 +504,7 @@ dbus::ObjectProxy::OnConnectedCallback* on_connected_callback) { nodes_changed_handler_ = signal_callback; const bool success = true; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*on_connected_callback), interface_name, signal_name, success)); } @@ -518,7 +518,7 @@ dbus::ObjectProxy::OnConnectedCallback* on_connected_callback) { active_output_node_changed_handler_ = signal_callback; const bool success = true; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*on_connected_callback), interface_name, signal_name, success)); } @@ -532,7 +532,7 @@ dbus::ObjectProxy::OnConnectedCallback* on_connected_callback) { active_input_node_changed_handler_ = signal_callback; const bool success = true; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*on_connected_callback), interface_name, signal_name, success)); } @@ -546,7 +546,7 @@ dbus::ObjectProxy::OnConnectedCallback* on_connected_callback) { output_node_volume_changed_handler_ = signal_callback; const bool success = true; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*on_connected_callback), interface_name, signal_name, success)); } @@ -560,7 +560,7 @@ dbus::ObjectProxy::OnConnectedCallback* on_connected_callback) { hotword_triggered_handler_ = signal_callback; const bool success = true; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*on_connected_callback), interface_name, signal_name, success)); } @@ -574,7 +574,7 @@ dbus::ObjectProxy::OnConnectedCallback* on_connected_callback) { number_of_active_streams_changed_handler_ = signal_callback; const bool success = true; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*on_connected_callback), interface_name, signal_name, success)); } @@ -588,7 +588,7 @@ EXPECT_EQ(expected_method_name_, method_call->GetMember()); dbus::MessageReader reader(method_call); argument_checker_.Run(&reader); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*response), response_)); }
diff --git a/chromeos/dbus/auth_policy/fake_auth_policy_client_unittest.cc b/chromeos/dbus/auth_policy/fake_auth_policy_client_unittest.cc index b1bc869..78403c4 100644 --- a/chromeos/dbus/auth_policy/fake_auth_policy_client_unittest.cc +++ b/chromeos/dbus/auth_policy/fake_auth_policy_client_unittest.cc
@@ -98,7 +98,7 @@ private: ScopedStubInstallAttributes install_attributes_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(FakeAuthPolicyClientTest); };
diff --git a/chromeos/dbus/biod/biod_client_unittest.cc b/chromeos/dbus/biod/biod_client_unittest.cc index 6f70b6b..13b1ad79 100644 --- a/chromeos/dbus/biod/biod_client_unittest.cc +++ b/chromeos/dbus/biod/biod_client_unittest.cc
@@ -158,7 +158,7 @@ std::map<std::string, std::unique_ptr<dbus::Response>> pending_method_calls_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Mock bus and proxy for simulating calls. scoped_refptr<dbus::MockBus> bus_; @@ -182,7 +182,7 @@ dbus::ObjectProxy::OnConnectedCallback* on_connected_callback) { EXPECT_EQ(interface_name, kInterface); signal_callbacks_[signal_name] = signal_callback; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*on_connected_callback), interface_name, signal_name, true /* success */)); @@ -197,7 +197,7 @@ auto pending_response = std::move(it->second); pending_method_calls_.erase(it); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&RunResponseCallback, std::move(*callback), std::move(pending_response))); }
diff --git a/chromeos/dbus/cec_service_client_unittest.cc b/chromeos/dbus/cec_service_client_unittest.cc index 48bde64..26432f7 100644 --- a/chromeos/dbus/cec_service_client_unittest.cc +++ b/chromeos/dbus/cec_service_client_unittest.cc
@@ -104,7 +104,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<CecServiceClient> client_; scoped_refptr<dbus::MockBus> mock_bus_; scoped_refptr<dbus::MockObjectProxy> mock_proxy_;
diff --git a/chromeos/dbus/cryptohome/fake_cryptohome_client_unittest.cc b/chromeos/dbus/cryptohome/fake_cryptohome_client_unittest.cc index 3c413033..119f00b3 100644 --- a/chromeos/dbus/cryptohome/fake_cryptohome_client_unittest.cc +++ b/chromeos/dbus/cryptohome/fake_cryptohome_client_unittest.cc
@@ -46,7 +46,7 @@ FakeCryptohomeClientTest() = default; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeCryptohomeClient fake_cryptohome_client_; private:
diff --git a/chromeos/dbus/fake_gnubby_client_unittest.cc b/chromeos/dbus/fake_gnubby_client_unittest.cc index 3586fdf2..67d51de 100644 --- a/chromeos/dbus/fake_gnubby_client_unittest.cc +++ b/chromeos/dbus/fake_gnubby_client_unittest.cc
@@ -33,7 +33,7 @@ FakeGnubbyClientTest() = default; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeGnubbyClient fake_gnubby_client_; private:
diff --git a/chromeos/dbus/native_timer_unittest.cc b/chromeos/dbus/native_timer_unittest.cc index 81a3817..d142a85 100644 --- a/chromeos/dbus/native_timer_unittest.cc +++ b/chromeos/dbus/native_timer_unittest.cc
@@ -19,9 +19,8 @@ class NativeTimerTest : public testing::Test { public: NativeTimerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO, + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~NativeTimerTest() override = default; @@ -29,7 +28,7 @@ void SetUp() override { PowerManagerClient::InitializeFake(); FakePowerManagerClient::Get()->set_tick_clock( - scoped_task_environment_.GetMockTickClock()); + task_environment_.GetMockTickClock()); } void TearDown() override { PowerManagerClient::Shutdown(); } @@ -42,22 +41,21 @@ base::RunLoop expiration_loop; bool start_timer_result = false; bool expiration_result = false; - timer->Start( - scoped_task_environment_.GetMockTickClock()->NowTicks() + delay, - base::BindOnce([](bool* result_out) { *result_out = true; }, - &expiration_result), - base::BindOnce( - [](bool* result_out, bool result) { *result_out = result; }, - &start_timer_result)); + timer->Start(task_environment_.GetMockTickClock()->NowTicks() + delay, + base::BindOnce([](bool* result_out) { *result_out = true; }, + &expiration_result), + base::BindOnce([](bool* result_out, + bool result) { *result_out = result; }, + &start_timer_result)); // Both starting the timer and timer firing should succeed. - scoped_task_environment_.FastForwardBy(delay); + task_environment_.FastForwardBy(delay); if (!start_timer_result) return false; return expiration_result; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: DISALLOW_COPY_AND_ASSIGN(NativeTimerTest);
diff --git a/chromeos/dbus/oobe_configuration_client_unittest.cc b/chromeos/dbus/oobe_configuration_client_unittest.cc index 393544a..38962df 100644 --- a/chromeos/dbus/oobe_configuration_client_unittest.cc +++ b/chromeos/dbus/oobe_configuration_client_unittest.cc
@@ -102,7 +102,7 @@ // The client to be tested. std::unique_ptr<OobeConfigurationClient> client_; // A message loop to emulate asynchronous behavior. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // The mock bus. scoped_refptr<dbus::MockBus> mock_bus_; // The mock object proxy. @@ -125,7 +125,7 @@ EXPECT_EQ(expected_method_name_, method_call->GetMember()); dbus::MessageReader reader(method_call); argument_checker_.Run(&reader); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*response), response_)); } };
diff --git a/chromeos/dbus/pipe_reader_unittest.cc b/chromeos/dbus/pipe_reader_unittest.cc index 6cdcee1..4e95dbcd 100644 --- a/chromeos/dbus/pipe_reader_unittest.cc +++ b/chromeos/dbus/pipe_reader_unittest.cc
@@ -42,7 +42,7 @@ public: PipeReaderTest() = default; ~PipeReaderTest() override { - // Flush the ScopedTaskEnvironment to prevent leaks of PostTaskAndReply + // Flush the TaskEnvironment to prevent leaks of PostTaskAndReply // callbacks. task_environment_.RunUntilIdle(); } @@ -52,7 +52,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(PipeReaderTest, Empty) {
diff --git a/chromeos/dbus/power/fake_power_manager_client_unittest.cc b/chromeos/dbus/power/fake_power_manager_client_unittest.cc index dbd5ccb..a79b1c0c 100644 --- a/chromeos/dbus/power/fake_power_manager_client_unittest.cc +++ b/chromeos/dbus/power/fake_power_manager_client_unittest.cc
@@ -102,8 +102,8 @@ // RequestStatusUpdate posts to the current message loop. This is // necessary because we want to make sure that NotifyObservers() is // called as a result of RequestStatusUpdate(). - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); test_observer.ClearProps(); client.RequestStatusUpdate(); base::RunLoop().RunUntilIdle();
diff --git a/chromeos/dbus/power/power_manager_client_unittest.cc b/chromeos/dbus/power/power_manager_client_unittest.cc index 1726a13..6ea74c8 100644 --- a/chromeos/dbus/power/power_manager_client_unittest.cc +++ b/chromeos/dbus/power/power_manager_client_unittest.cc
@@ -211,10 +211,10 @@ EXPECT_CALL(*bus_, GetDBusTaskRunner()) .WillRepeatedly( - Return(scoped_task_environment_.GetMainThreadTaskRunner().get())); + Return(task_environment_.GetMainThreadTaskRunner().get())); EXPECT_CALL(*bus_, GetOriginTaskRunner()) .WillRepeatedly( - Return(scoped_task_environment_.GetMainThreadTaskRunner().get())); + Return(task_environment_.GetMainThreadTaskRunner().get())); // Save |client_|'s signal and name-owner-changed callbacks. EXPECT_CALL(*proxy_, DoConnectToSignal(kInterface, _, _, _)) @@ -297,7 +297,7 @@ static const int kSuspendDelayId = 100; static const int kDarkSuspendDelayId = 200; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Mock bus and proxy for simulating calls to powerd. scoped_refptr<dbus::MockBus> bus_; @@ -323,7 +323,7 @@ CHECK_EQ(interface_name, power_manager::kPowerManagerInterface); signal_callbacks_[signal_name] = signal_callback; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*on_connected_callback), interface_name, signal_name, true /* success */)); @@ -344,7 +344,7 @@ dbus::Response::FromMethodCall(method_call)); CHECK(dbus::MessageWriter(response.get()).AppendProtoAsArrayOfBytes(proto)); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&RunResponseCallback, std::move(*callback), std::move(response))); }
diff --git a/chromeos/dbus/power/power_policy_controller_unittest.cc b/chromeos/dbus/power/power_policy_controller_unittest.cc index a64c1864..348efce2 100644 --- a/chromeos/dbus/power/power_policy_controller_unittest.cc +++ b/chromeos/dbus/power/power_policy_controller_unittest.cc
@@ -38,7 +38,7 @@ } PowerPolicyController* policy_controller_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: DISALLOW_COPY_AND_ASSIGN(PowerPolicyControllerTest);
diff --git a/chromeos/dbus/shill/modem_messaging_client_unittest.cc b/chromeos/dbus/shill/modem_messaging_client_unittest.cc index 3e0bc3c..6cd1bfa 100644 --- a/chromeos/dbus/shill/modem_messaging_client_unittest.cc +++ b/chromeos/dbus/shill/modem_messaging_client_unittest.cc
@@ -99,7 +99,7 @@ EXPECT_EQ(expected_sms_path_, sms_path); EXPECT_FALSE(reader.HasMoreData()); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*callback), response_)); } @@ -113,14 +113,14 @@ dbus::MessageReader reader(method_call); EXPECT_FALSE(reader.HasMoreData()); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*callback), response_)); } protected: ModemMessagingClient* client_ = nullptr; // Unowned convenience pointer. // A message loop to emulate asynchronous behavior. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // The mock bus. scoped_refptr<dbus::MockBus> mock_bus_; // The mock object proxy. @@ -141,7 +141,7 @@ dbus::ObjectProxy::OnConnectedCallback* on_connected_callback) { sms_received_callback_ = signal_callback; const bool success = true; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*on_connected_callback), interface_name, signal_name, success)); }
diff --git a/chromeos/dbus/shill/shill_client_unittest_base.cc b/chromeos/dbus/shill/shill_client_unittest_base.cc index 596e2d21..fc715f4a 100644 --- a/chromeos/dbus/shill/shill_client_unittest_base.cc +++ b/chromeos/dbus/shill/shill_client_unittest_base.cc
@@ -140,7 +140,7 @@ // task runner. EXPECT_CALL(*mock_bus_.get(), GetDBusTaskRunner()) .WillRepeatedly( - Return(scoped_task_environment_.GetMainThreadTaskRunner().get())); + Return(task_environment_.GetMainThreadTaskRunner().get())); // ShutdownAndBlock() will be called in TearDown(). EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); @@ -381,7 +381,7 @@ dbus::ObjectProxy::OnConnectedCallback* on_connected_callback) { platform_message_handler_ = signal_callback; const bool success = true; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*on_connected_callback), interface_name, signal_name, success)); } @@ -393,7 +393,7 @@ dbus::ObjectProxy::OnConnectedCallback* on_connected_callback) { packet_receieved__handler_ = signal_callback; const bool success = true; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*on_connected_callback), interface_name, signal_name, success)); } @@ -405,7 +405,7 @@ dbus::ObjectProxy::OnConnectedCallback* on_connected_callback) { property_changed_handler_ = signal_callback; const bool success = true; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*on_connected_callback), interface_name, signal_name, success)); } @@ -418,7 +418,7 @@ EXPECT_EQ(expected_method_name_, method_call->GetMember()); dbus::MessageReader reader(method_call); argument_checker_.Run(&reader); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*response_callback), response_)); }
diff --git a/chromeos/dbus/shill/shill_client_unittest_base.h b/chromeos/dbus/shill/shill_client_unittest_base.h index a555db3..ca8fe2f 100644 --- a/chromeos/dbus/shill/shill_client_unittest_base.h +++ b/chromeos/dbus/shill/shill_client_unittest_base.h
@@ -173,7 +173,7 @@ const base::DictionaryValue& result); // A message loop to emulate asynchronous behavior. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // The mock bus. scoped_refptr<dbus::MockBus> mock_bus_;
diff --git a/chromeos/disks/disk_mount_manager_unittest.cc b/chromeos/disks/disk_mount_manager_unittest.cc index 2e4f1157..75a7dd7 100644 --- a/chromeos/disks/disk_mount_manager_unittest.cc +++ b/chromeos/disks/disk_mount_manager_unittest.cc
@@ -495,8 +495,7 @@ class DiskMountManagerTest : public testing::Test { public: DiskMountManagerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~DiskMountManagerTest() override = default; // Sets up test dbus thread manager and disks mount manager. @@ -589,7 +588,7 @@ std::unique_ptr<MockDiskMountManagerObserver> observer_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Tests that the observer gets notified on attempt to format non existent mount
diff --git a/chromeos/geolocation/simple_geolocation_unittest.cc b/chromeos/geolocation/simple_geolocation_unittest.cc index 352a898..34386ab 100644 --- a/chromeos/geolocation/simple_geolocation_unittest.cc +++ b/chromeos/geolocation/simple_geolocation_unittest.cc
@@ -182,7 +182,7 @@ class SimpleGeolocationTest : public testing::Test { private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(SimpleGeolocationTest, ResponseOK) { @@ -368,8 +368,8 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; std::unique_ptr<GeolocationHandler> geolocation_handler_; ShillManagerClient::TestInterface* manager_test_; WifiAccessPointVector wifi_access_points_;
diff --git a/chromeos/network/auto_connect_handler_unittest.cc b/chromeos/network/auto_connect_handler_unittest.cc index a683c84..d119656 100644 --- a/chromeos/network/auto_connect_handler_unittest.cc +++ b/chromeos/network/auto_connect_handler_unittest.cc
@@ -112,8 +112,7 @@ class AutoConnectHandlerTest : public testing::Test { public: AutoConnectHandlerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { ASSERT_TRUE(test_nssdb_.is_open()); @@ -159,7 +158,7 @@ test_observer_.reset(new TestAutoConnectHandlerObserver()); auto_connect_handler_->AddObserver(test_observer_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void TearDown() override { @@ -187,13 +186,13 @@ void StartNetworkCertLoader() { NetworkCertLoader::Get()->SetUserNSSDB(test_nsscertdb_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void LoginToRegularUser() { LoginState::Get()->SetLoggedInState(LoginState::LOGGED_IN_ACTIVE, LoginState::LOGGED_IN_USER_REGULAR); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } scoped_refptr<net::X509Certificate> ImportTestClientCert() { @@ -247,7 +246,7 @@ std::string(), // no username hash *network_configs, global_config); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } std::string ConfigureService(const std::string& shill_json_string) { @@ -256,7 +255,7 @@ NetworkStateTestHelper& helper() { return helper_; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkStateTestHelper helper_{false /* use_default_devices_and_services */}; std::unique_ptr<AutoConnectHandler> auto_connect_handler_; std::unique_ptr<ClientCertResolver> client_cert_resolver_; @@ -388,7 +387,7 @@ scoped_refptr<net::X509Certificate> cert = ImportTestClientCert(); ASSERT_TRUE(cert.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(observer.DidNetworkPropertiesChange()); EXPECT_EQ(shill::kStateIdle, GetServiceState(wifi0_service_path)); @@ -428,7 +427,7 @@ scoped_refptr<net::X509Certificate> cert = ImportTestClientCert(); ASSERT_TRUE(cert.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(observer.DidNetworkPropertiesChange()); EXPECT_EQ(shill::kStateOnline, GetServiceState(wifi0_service_path));
diff --git a/chromeos/network/cellular_metrics_logger_unittest.cc b/chromeos/network/cellular_metrics_logger_unittest.cc index ade9457..41ae38f 100644 --- a/chromeos/network/cellular_metrics_logger_unittest.cc +++ b/chromeos/network/cellular_metrics_logger_unittest.cc
@@ -37,8 +37,7 @@ class CellularMetricsLoggerTest : public testing::Test { public: CellularMetricsLoggerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~CellularMetricsLoggerTest() override = default; void SetUp() override { @@ -102,7 +101,7 @@ base::RunLoop().RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ShillServiceClient::TestInterface* service_client_test() { return network_state_test_helper_.service_test(); @@ -133,7 +132,7 @@ base::RunLoop().RunUntilIdle(); histogram_tester.ExpectTotalCount(kUsageCountHistogram, 0); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( CellularMetricsLogger::kInitializationTimeout); histogram_tester.ExpectBucketCount( kUsageCountHistogram, CellularMetricsLogger::CellularUsage::kNotConnected, @@ -171,7 +170,7 @@ static const base::Value kTestIdleStateValue(shill::kStateIdle); // Should not log state if no cellular devices are available. - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( CellularMetricsLogger::kInitializationTimeout); histogram_tester.ExpectTotalCount(kUsageCountHistogram, 0); @@ -182,7 +181,7 @@ // Should log state if a new cellular device is plugged in. InitCellular(); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( CellularMetricsLogger::kInitializationTimeout); histogram_tester.ExpectBucketCount( kUsageCountHistogram, CellularMetricsLogger::CellularUsage::kNotConnected, @@ -225,7 +224,7 @@ // Should wait until initialization timeout before logging status. InitCellular(); histogram_tester.ExpectTotalCount(kActivationStatusAtLoginHistogram, 0); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( CellularMetricsLogger::kInitializationTimeout); histogram_tester.ExpectBucketCount( kActivationStatusAtLoginHistogram, @@ -276,7 +275,7 @@ service_client_test()->SetServiceProperty( kTestCellularServicePath, shill::kStateProperty, kAssocStateValue); base::RunLoop().RunUntilIdle(); - scoped_task_environment_.FastForwardBy(kTestConnectionTime); + task_environment_.FastForwardBy(kTestConnectionTime); service_client_test()->SetServiceProperty( kTestCellularServicePath, shill::kStateProperty, kOnlineStateValue); base::RunLoop().RunUntilIdle(); @@ -296,7 +295,7 @@ base::RunLoop().RunUntilIdle(); // Should log first network's connection time independently. - scoped_task_environment_.FastForwardBy(kTestConnectionTime); + task_environment_.FastForwardBy(kTestConnectionTime); service_client_test()->SetServiceProperty( kTestCellularServicePath, shill::kStateProperty, kOnlineStateValue); base::RunLoop().RunUntilIdle(); @@ -304,7 +303,7 @@ kTestConnectionTime, 1); // Should log second network's connection time independently. - scoped_task_environment_.FastForwardBy(kTestConnectionTime); + task_environment_.FastForwardBy(kTestConnectionTime); service_client_test()->SetServiceProperty( kTestCellularServicePath2, shill::kStateProperty, kOnlineStateValue); base::RunLoop().RunUntilIdle(); @@ -328,7 +327,7 @@ // Should not log user initiated disconnections. cellular_metrics_logger()->DisconnectRequested(kTestCellularServicePath); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( CellularMetricsLogger::kDisconnectRequestTimeout / 2); service_client_test()->SetServiceProperty( kTestCellularServicePath, shill::kStateProperty, kIdleStateValue); @@ -354,7 +353,7 @@ kTestCellularServicePath, shill::kStateProperty, kOnlineStateValue); base::RunLoop().RunUntilIdle(); cellular_metrics_logger()->DisconnectRequested(kTestCellularServicePath); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( CellularMetricsLogger::kDisconnectRequestTimeout * 2); service_client_test()->SetServiceProperty( kTestCellularServicePath, shill::kStateProperty, kIdleStateValue);
diff --git a/chromeos/network/client_cert_resolver_unittest.cc b/chromeos/network/client_cert_resolver_unittest.cc index 99e37416..ae495ff9 100644 --- a/chromeos/network/client_cert_resolver_unittest.cc +++ b/chromeos/network/client_cert_resolver_unittest.cc
@@ -117,9 +117,9 @@ service_test_ = ShillServiceClient::Get()->GetTestInterface(); profile_test_ = ShillProfileClient::Get()->GetTestInterface(); profile_test_->AddProfile(kUserProfilePath, kUserHash); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); service_test_->ClearServices(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); NetworkCertLoader::Initialize(); network_cert_loader_ = NetworkCertLoader::Get(); @@ -238,7 +238,7 @@ network_config_handler_.get(), nullptr /* network_device_handler */, nullptr /* prohibited_technologies_handler */); // Run all notifications before starting the cert loader to reduce run time. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); client_cert_resolver_->Init(network_state_handler_.get(), managed_config_handler_.get()); @@ -409,7 +409,7 @@ return certs; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; int network_properties_changed_count_ = 0; std::string test_cert_id_; std::unique_ptr<base::SimpleTestClock> test_clock_; @@ -444,12 +444,12 @@ SetupTestCerts("client_1", false /* do not import the issuer */); StartNetworkCertLoader(); SetupWifi(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); network_properties_changed_count_ = 0; SetupNetworkHandlers(); ASSERT_NO_FATAL_FAILURE( SetupPolicyMatchingIssuerPEM(::onc::ONC_SOURCE_USER_POLICY, "")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Verify that no client certificate was configured. std::string pkcs11_id; @@ -462,16 +462,16 @@ TEST_F(ClientCertResolverTest, MatchIssuerCNWithoutIssuerInstalled) { SetupTestCerts("client_1", false /* do not import the issuer */); SetupWifi(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); SetupNetworkHandlers(); ASSERT_NO_FATAL_FAILURE( SetupPolicyMatchingIssuerCN(::onc::ONC_SOURCE_USER_POLICY)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); network_properties_changed_count_ = 0; StartNetworkCertLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Verify that the resolver positively matched the pattern in the policy with // the test client cert and configured the network. @@ -487,17 +487,17 @@ ASSERT_NO_FATAL_FAILURE(SetupTestCertWithBadPrintableString()); SetupWifi(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); SetupNetworkHandlers(); ASSERT_NO_FATAL_FAILURE( SetupPolicyMatchingSubjectOrgForBadPrintableStringCert( ::onc::ONC_SOURCE_USER_POLICY)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); network_properties_changed_count_ = 0; StartNetworkCertLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Verify that the resolver positively matched the pattern in the policy with // the test client cert and configured the network. @@ -510,16 +510,16 @@ TEST_F(ClientCertResolverTest, ResolveOnCertificatesLoaded) { SetupTestCerts("client_1", true /* import issuer */); SetupWifi(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); SetupNetworkHandlers(); ASSERT_NO_FATAL_FAILURE( SetupPolicyMatchingIssuerPEM(::onc::ONC_SOURCE_USER_POLICY, "")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); network_properties_changed_count_ = 0; StartNetworkCertLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Verify that the resolver positively matched the pattern in the policy with // the test client cert and configured the network. @@ -532,16 +532,16 @@ TEST_F(ClientCertResolverTest, ResolveAfterPolicyApplication) { SetupTestCerts("client_1", true /* import issuer */); SetupWifi(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); StartNetworkCertLoader(); SetupNetworkHandlers(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Policy application will trigger the ClientCertResolver. network_properties_changed_count_ = 0; ASSERT_NO_FATAL_FAILURE( SetupPolicyMatchingIssuerPEM(::onc::ONC_SOURCE_USER_POLICY, "")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Verify that the resolver positively matched the pattern in the policy with // the test client cert and configured the network. @@ -554,18 +554,18 @@ TEST_F(ClientCertResolverTest, ExpiringCertificate) { SetupTestCerts("client_1", true /* import issuer */); SetupWifi(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); SetupNetworkHandlers(); ASSERT_NO_FATAL_FAILURE( SetupPolicyMatchingIssuerPEM(::onc::ONC_SOURCE_USER_POLICY, "")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); StartNetworkCertLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); SetWifiState(shill::kStateOnline); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Verify that the resolver positively matched the pattern in the policy with // the test client cert and configured the network. @@ -579,7 +579,7 @@ network_properties_changed_count_ = 0; test_clock_->SetNow(base::Time::Max()); SetWifiState(shill::kStateOffline); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetServiceProperty(shill::kEapCertIdProperty, &pkcs11_id); EXPECT_EQ(std::string(), pkcs11_id); EXPECT_EQ(1, network_properties_changed_count_); @@ -592,18 +592,18 @@ TEST_F(ClientCertResolverTest, SameCertAfterNetworkConnectionStateChanged) { SetupTestCerts("client_1", true /* import issuer */); SetupWifi(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); SetupNetworkHandlers(); ASSERT_NO_FATAL_FAILURE( SetupPolicyMatchingIssuerPEM(::onc::ONC_SOURCE_USER_POLICY, "")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); StartNetworkCertLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); SetWifiState(shill::kStateOnline); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Verify that the resolver positively matched the pattern in the policy with // the test client cert and configured the network. @@ -616,7 +616,7 @@ // observers with |network_properties_changed| = true. network_properties_changed_count_ = 0; SetWifiState(shill::kStateOffline); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetServiceProperty(shill::kEapCertIdProperty, &pkcs11_id); EXPECT_EQ(test_cert_id_, pkcs11_id); EXPECT_EQ(0, network_properties_changed_count_); @@ -625,15 +625,15 @@ TEST_F(ClientCertResolverTest, UserPolicyUsesSystemToken) { SetupTestCertInSystemToken("client_1"); SetupWifi(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); SetupNetworkHandlers(); ASSERT_NO_FATAL_FAILURE( SetupPolicyMatchingIssuerCN(::onc::ONC_SOURCE_USER_POLICY)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); StartNetworkCertLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1U, network_cert_loader_->client_certs().size()); EXPECT_TRUE(network_cert_loader_->client_certs()[0].is_device_wide()); @@ -647,7 +647,7 @@ TEST_F(ClientCertResolverTest, UserPolicyUsesSystemTokenSync) { SetupTestCertInSystemToken("client_1"); StartNetworkCertLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); client_cert::ClientCertConfig client_cert_config; SetupCertificateConfigMatchingIssuerCN(::onc::ONC_SOURCE_USER_POLICY, @@ -665,15 +665,15 @@ TEST_F(ClientCertResolverTest, DevicePolicyUsesSystemToken) { SetupTestCertInSystemToken("client_1"); SetupWifi(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); SetupNetworkHandlers(); ASSERT_NO_FATAL_FAILURE( SetupPolicyMatchingIssuerCN(::onc::ONC_SOURCE_USER_POLICY)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); StartNetworkCertLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1U, network_cert_loader_->client_certs().size()); EXPECT_TRUE(network_cert_loader_->client_certs()[0].is_device_wide()); @@ -687,7 +687,7 @@ TEST_F(ClientCertResolverTest, DevicePolicyUsesSystemTokenSync) { SetupTestCertInSystemToken("client_1"); StartNetworkCertLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); client_cert::ClientCertConfig client_cert_config; SetupCertificateConfigMatchingIssuerCN(::onc::ONC_SOURCE_DEVICE_POLICY, @@ -705,16 +705,16 @@ TEST_F(ClientCertResolverTest, DevicePolicyDoesNotUseUserToken) { SetupTestCerts("client_1", false /* do not import the issuer */); SetupWifi(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); SetupNetworkHandlers(); ASSERT_NO_FATAL_FAILURE( SetupPolicyMatchingIssuerCN(::onc::ONC_SOURCE_DEVICE_POLICY)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); network_properties_changed_count_ = 0; StartNetworkCertLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1U, network_cert_loader_->client_certs().size()); EXPECT_FALSE(network_cert_loader_->client_certs()[0].is_device_wide()); @@ -729,7 +729,7 @@ TEST_F(ClientCertResolverTest, DevicePolicyDoesNotUseUserTokenSync) { SetupTestCerts("client_1", false /* do not import the issuer */); StartNetworkCertLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); client_cert::ClientCertConfig client_cert_config; SetupCertificateConfigMatchingIssuerCN(::onc::ONC_SOURCE_DEVICE_POLICY, @@ -747,16 +747,16 @@ TEST_F(ClientCertResolverTest, PopulateIdentityFromCert) { SetupTestCerts("client_3", true /* import issuer */); SetupWifi(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); SetupNetworkHandlers(); ASSERT_NO_FATAL_FAILURE(SetupPolicyMatchingIssuerPEM( ::onc::ONC_SOURCE_USER_POLICY, "${CERT_SAN_EMAIL}")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); network_properties_changed_count_ = 0; StartNetworkCertLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Verify that the resolver read the subjectAltName email field from the // cert, and wrote it into the shill service entry. @@ -770,7 +770,7 @@ // substituted into the shill service entry. ASSERT_NO_FATAL_FAILURE(SetupPolicyMatchingIssuerPEM( ::onc::ONC_SOURCE_USER_POLICY, "upn-${CERT_SAN_UPN}-suffix")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetServiceProperty(shill::kEapIdentityProperty, &identity); EXPECT_EQ("upn-santest@ad.corp.example.com-suffix", identity); @@ -781,7 +781,7 @@ ASSERT_NO_FATAL_FAILURE(SetupPolicyMatchingIssuerPEM( ::onc::ONC_SOURCE_USER_POLICY, "subject-cn-${CERT_SUBJECT_COMMON_NAME}-suffix")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetServiceProperty(shill::kEapIdentityProperty, &identity); EXPECT_EQ("subject-cn-Client Cert F-suffix", identity); @@ -798,7 +798,7 @@ SetupNetworkHandlers(); ASSERT_NO_FATAL_FAILURE( SetupPolicyMatchingIssuerPEM(::onc::ONC_SOURCE_USER_POLICY, "")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Pretend that policy was applied, this shall queue a resolving task. static_cast<NetworkPolicyObserver*>(client_cert_resolver_.get()) @@ -815,7 +815,7 @@ ->OnCertificatesLoaded(); EXPECT_TRUE(client_cert_resolver_->IsAnyResolveTaskRunning()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(client_cert_resolver_->IsAnyResolveTaskRunning()); // Verify that the resolver positively matched the pattern in the policy with // the test client cert and configured the network. @@ -846,11 +846,11 @@ } ])"; SetupWifi(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); StartNetworkCertLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); SetupNetworkHandlers(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Make sure that expiring client certs don't cause issues. test_clock_->SetNow(base::Time::Min()); @@ -859,7 +859,7 @@ network_properties_changed_count_ = 0; ASSERT_NO_FATAL_FAILURE(SetManagedNetworkPolicy(::onc::ONC_SOURCE_USER_POLICY, test_policy_network)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // The referenced client cert does not exist yet, so expect that it has not // been resolved. @@ -876,14 +876,13 @@ ASSERT_TRUE(onc_parsed_certificates); onc::CertificateImporterImpl importer( - scoped_task_environment_.GetMainThreadTaskRunner(), - test_nsscertdb_.get()); + task_environment_.GetMainThreadTaskRunner(), test_nsscertdb_.get()); base::RunLoop import_loop; importer.ImportClientCertificates( onc_parsed_certificates->client_certificates(), base::BindOnce(&OnImportCompleted, import_loop.QuitClosure())); import_loop.Run(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Find the imported cert and get its id. net::ScopedCERTCertificateList private_slot_certs = ListCertsOnPrivateSlot();
diff --git a/chromeos/network/fast_transition_observer_unittest.cc b/chromeos/network/fast_transition_observer_unittest.cc index ce5bd27d..6900811 100644 --- a/chromeos/network/fast_transition_observer_unittest.cc +++ b/chromeos/network/fast_transition_observer_unittest.cc
@@ -48,7 +48,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<NetworkStateHandler> network_state_handler_; std::unique_ptr<TestingPrefServiceSimple> local_state_; std::unique_ptr<FastTransitionObserver> observer_;
diff --git a/chromeos/network/firewall_hole_unittest.cc b/chromeos/network/firewall_hole_unittest.cc index 90f4e9e5..dca122d 100644 --- a/chromeos/network/firewall_hole_unittest.cc +++ b/chromeos/network/firewall_hole_unittest.cc
@@ -27,8 +27,7 @@ class FirewallHoleTest : public testing::Test { public: FirewallHoleTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~FirewallHoleTest() override = default; void SetUp() override { PermissionBrokerClient::InitializeFake(); } @@ -36,7 +35,7 @@ void TearDown() override { PermissionBrokerClient::Shutdown(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(FirewallHoleTest, GrantTcpPortAccess) {
diff --git a/chromeos/network/geolocation_handler_unittest.cc b/chromeos/network/geolocation_handler_unittest.cc index 9b16d75..9a16d05 100644 --- a/chromeos/network/geolocation_handler_unittest.cc +++ b/chromeos/network/geolocation_handler_unittest.cc
@@ -22,8 +22,7 @@ class GeolocationHandlerTest : public testing::Test { public: GeolocationHandlerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~GeolocationHandlerTest() override = default; @@ -89,7 +88,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<GeolocationHandler> geolocation_handler_; ShillManagerClient::TestInterface* manager_test_ = nullptr; WifiAccessPointVector wifi_access_points_;
diff --git a/chromeos/network/managed_network_configuration_handler_unittest.cc b/chromeos/network/managed_network_configuration_handler_unittest.cc index bcc71a6..b7928654 100644 --- a/chromeos/network/managed_network_configuration_handler_unittest.cc +++ b/chromeos/network/managed_network_configuration_handler_unittest.cc
@@ -220,7 +220,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestNetworkPolicyObserver policy_observer_; std::unique_ptr<MockNetworkStateHandler> network_state_handler_;
diff --git a/chromeos/network/network_cert_loader_unittest.cc b/chromeos/network/network_cert_loader_unittest.cc index 56cb70a..bb3a27d 100644 --- a/chromeos/network/network_cert_loader_unittest.cc +++ b/chromeos/network/network_cert_loader_unittest.cc
@@ -184,7 +184,7 @@ &primary_certdb_); cert_loader_->SetUserNSSDB(primary_certdb_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetAndResetCertificatesLoadedEventsCount(); } @@ -279,7 +279,7 @@ crypto::ScopedPK11Slot(PK11_ReferenceSlot(system_db_.slot()))); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkCertLoader* cert_loader_; @@ -311,7 +311,7 @@ &primary_certdb_); net::ScopedCERTCertificateList certs; ImportCACert("root_ca_cert.pem", primary_certdb_.get(), &certs); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); cert_loader_->SetUserNSSDB(primary_certdb_.get()); @@ -322,7 +322,7 @@ EXPECT_TRUE(cert_loader_->client_certs().empty()); ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); EXPECT_TRUE(cert_loader_->initial_load_finished()); @@ -345,7 +345,7 @@ AddSystemToken(system_certdb_.get()); net::ScopedCERTCertificateList certs; ImportCACert("root_ca_cert.pem", system_certdb_.get(), &certs); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); cert_loader_->SetSystemNSSDB(system_certdb_.get()); @@ -355,7 +355,7 @@ EXPECT_TRUE(cert_loader_->client_certs().empty()); ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); EXPECT_TRUE(cert_loader_->initial_load_finished()); @@ -385,7 +385,7 @@ TEST_CLIENT_CERT_2)); ASSERT_TRUE(user_token_cert); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(cert_loader_->initial_load_of_any_database_running()); EXPECT_FALSE(cert_loader_->initial_load_finished()); @@ -399,7 +399,7 @@ EXPECT_TRUE(cert_loader_->client_certs().empty()); ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); EXPECT_TRUE(cert_loader_->initial_load_finished()); @@ -418,7 +418,7 @@ EXPECT_TRUE(cert_loader_->initial_load_of_any_database_running()); ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); EXPECT_TRUE(cert_loader_->initial_load_finished()); @@ -452,7 +452,7 @@ ASSERT_TRUE(user_token_cert); AddSystemToken(primary_certdb_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(cert_loader_->initial_load_of_any_database_running()); EXPECT_FALSE(cert_loader_->initial_load_finished()); @@ -466,7 +466,7 @@ EXPECT_TRUE(cert_loader_->client_certs().empty()); ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); EXPECT_TRUE(cert_loader_->initial_load_finished()); @@ -485,7 +485,7 @@ EXPECT_TRUE(cert_loader_->initial_load_of_any_database_running()); ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); EXPECT_TRUE(cert_loader_->initial_load_finished()); @@ -512,10 +512,10 @@ single_slot_db /* private_slot_db */, &primary_certdb_); net::ScopedCERTCertificateList certs; ImportCACert("root_ca_cert.pem", primary_certdb_.get(), &certs); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); cert_loader_->SetUserNSSDB(primary_certdb_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); EXPECT_TRUE(cert_loader_->initial_load_finished()); @@ -540,7 +540,7 @@ cert_loader_->client_certs())); ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); // The certificate list should be updated now, as the message loop's been run. @@ -561,7 +561,7 @@ net::ScopedCERTCertificateList certs; ImportCACert("root_ca_cert.pem", secondary_certdb.get(), &certs); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(IsCertInCertificateList(certs[0].get(), false /* device_wide */, cert_loader_->client_certs())); @@ -577,7 +577,7 @@ ASSERT_TRUE(cert); ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); EXPECT_TRUE(IsCertInCertificateList(cert.get(), false /* device_wide */, @@ -588,10 +588,10 @@ CreateCertDatabase(&system_db_ /* public_slot_db */, nullptr /* private_slot_db */, &system_certdb_); AddSystemToken(system_certdb_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); cert_loader_->SetSystemNSSDB(system_certdb_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); EXPECT_TRUE(cert_loader_->client_certs().empty()); @@ -600,7 +600,7 @@ ASSERT_TRUE(cert); ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); EXPECT_EQ(1U, cert_loader_->client_certs().size()); @@ -620,7 +620,7 @@ ImportClientCertAndKey(secondary_certdb.get())); ASSERT_TRUE(cert); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(IsCertInCertificateList(cert.get(), false /* device_wide */, cert_loader_->client_certs())); @@ -635,7 +635,7 @@ ImportClientCertAndKey(primary_certdb_.get())); ASSERT_TRUE(cert); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); ASSERT_TRUE(IsCertInCertificateList(cert.get(), false /* device_wide */, @@ -644,7 +644,7 @@ primary_certdb_->DeleteCertAndKey(cert.get()); ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); ASSERT_FALSE(IsCertInCertificateList(cert.get(), false /* device_wide */, @@ -657,7 +657,7 @@ net::ScopedCERTCertificateList certs; ImportCACert("root_ca_cert.pem", primary_certdb_.get(), &certs); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); ASSERT_TRUE(IsCertInCertificateList(certs[0].get(), false /* device_wide */, cert_loader_->authority_certs())); @@ -670,7 +670,7 @@ // Cert trust change should trigger certificate reload in cert_loader_. ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); }
diff --git a/chromeos/network/network_cert_migrator_unittest.cc b/chromeos/network/network_cert_migrator_unittest.cc index bc1bb374..2b48e16c 100644 --- a/chromeos/network/network_cert_migrator_unittest.cc +++ b/chromeos/network/network_cert_migrator_unittest.cc
@@ -41,9 +41,9 @@ class NetworkCertMigratorTest : public testing::Test { public: NetworkCertMigratorTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED), + : task_environment_( + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED), service_test_(nullptr) {} ~NetworkCertMigratorTest() override = default; @@ -68,9 +68,9 @@ service_test_ = ShillServiceClient::Get()->GetTestInterface(); ShillProfileClient::Get()->GetTestInterface()->AddProfile( kUserShillProfile, "" /* userhash */); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); service_test_->ClearServices(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); NetworkCertLoader::Initialize(); } @@ -202,7 +202,7 @@ } } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ShillServiceClient::TestInterface* service_test_; net::ScopedCERTCertificate test_client_cert_; std::string test_client_cert_pkcs11_id_; @@ -228,7 +228,7 @@ NetworkCertLoader::Get()->SetSystemNSSDB(test_system_nsscertdb_.get()); SetupNetworkHandlers(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Migration should not have been performed on the user profile network, // because the user NSSDB has not been loaded yet. @@ -239,7 +239,7 @@ // Load the user NSSDB now NetworkCertLoader::Get()->SetUserNSSDB(test_user_nsscertdb_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Since the PKCS11 ID is unknown, the certificate configuration of the shared // profile network will be cleared. @@ -255,7 +255,7 @@ NetworkCertLoader::Get()->SetSystemNSSDB(test_system_nsscertdb_.get()); SetupNetworkHandlers(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Since the PKCS11 ID is unknown, the certificate configuration of the shared // profile network will be cleared. @@ -272,7 +272,7 @@ SetupNetworkWithEapCertId(ShillProfile::USER, true /* wifi */, "123:" + test_client_cert_pkcs11_id_); SetupNetworkHandlers(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::string cert_id; GetEapCertId(true /* wifi */, &cert_id); @@ -286,13 +286,13 @@ SetupTestClientCert(&test_user_nssdb_); SetupNetworkHandlers(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Add a new network for migration after the handlers are initialized. SetupNetworkWithEapCertId(ShillProfile::USER, true /* wifi */, "unknown pkcs11 id"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Since the PKCS11 ID is unknown, the certificate configuration will be // cleared. std::string cert_id; @@ -305,13 +305,13 @@ SetupTestClientCert(&test_user_nssdb_); SetupNetworkHandlers(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Add a new network for migration after the handlers are initialized. SetupNetworkWithEapCertId(ShillProfile::USER, true /* wifi */, test_client_cert_pkcs11_id_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::string cert_id; GetEapCertId(true /* wifi */, &cert_id); @@ -325,13 +325,13 @@ SetupTestClientCert(&test_user_nssdb_); SetupNetworkHandlers(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Add a new network for migration after the handlers are initialized. SetupNetworkWithEapCertId(ShillProfile::USER, true /* wifi */, "123:" + test_client_cert_pkcs11_id_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::string cert_id; GetEapCertId(true /* wifi */, &cert_id); @@ -345,7 +345,7 @@ SetupTestClientCert(&test_user_nssdb_); SetupNetworkHandlers(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::string expected_cert_id = test_client_cert_slot_id_ + ":" + test_client_cert_pkcs11_id_; @@ -354,7 +354,7 @@ SetupNetworkWithEapCertId(ShillProfile::USER, true /* wifi */, expected_cert_id); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::string cert_id; GetEapCertId(true /* wifi */, &cert_id); @@ -366,7 +366,7 @@ SetupTestClientCert(&test_user_nssdb_); SetupNetworkHandlers(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const char kPkcs11Id[] = "any slot id"; @@ -376,7 +376,7 @@ true /* OpenVPN */, std::string() /* no slot id */, kPkcs11Id); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::string pkcs11_id; std::string unused_slot_id; @@ -389,7 +389,7 @@ SetupTestClientCert(&test_user_nssdb_); SetupNetworkHandlers(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Add a new network for migration after the handlers are initialized. SetupNetworkWithEapCertId(ShillProfile::USER, @@ -397,7 +397,7 @@ false /* ethernet */, "123:" + test_client_cert_pkcs11_id_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::string cert_id; GetEapCertId(false /* ethernet */, &cert_id); @@ -411,13 +411,13 @@ SetupTestClientCert(&test_user_nssdb_); SetupNetworkHandlers(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Add a new network for migration after the handlers are initialized. SetupVpnWithCertId(ShillProfile::USER, false /* IPsec */, "123", test_client_cert_pkcs11_id_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::string pkcs11_id; std::string slot_id;
diff --git a/chromeos/network/network_configuration_handler_unittest.cc b/chromeos/network/network_configuration_handler_unittest.cc index 16675fa..9fe0234 100644 --- a/chromeos/network/network_configuration_handler_unittest.cc +++ b/chromeos/network/network_configuration_handler_unittest.cc
@@ -310,8 +310,8 @@ std::unique_ptr<NetworkConfigurationHandler> network_configuration_handler_; std::unique_ptr<TestNetworkStateHandlerObserver> network_state_handler_observer_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; std::string success_callback_name_; std::string get_properties_path_; std::unique_ptr<base::DictionaryValue> get_properties_;
diff --git a/chromeos/network/network_connect_unittest.cc b/chromeos/network/network_connect_unittest.cc index d6365df..5c44f14 100644 --- a/chromeos/network/network_connect_unittest.cc +++ b/chromeos/network/network_connect_unittest.cc
@@ -175,7 +175,7 @@ std::unique_ptr<MockDelegate> mock_delegate_; std::unique_ptr<FakeTetherDelegate> fake_tether_delegate_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ShillDeviceClient::TestInterface* device_test_; ShillServiceClient::TestInterface* service_test_;
diff --git a/chromeos/network/network_connection_handler_impl_unittest.cc b/chromeos/network/network_connection_handler_impl_unittest.cc index 56e6d67..c0a8106 100644 --- a/chromeos/network/network_connection_handler_impl_unittest.cc +++ b/chromeos/network/network_connection_handler_impl_unittest.cc
@@ -134,8 +134,7 @@ class NetworkConnectionHandlerImplTest : public testing::Test { public: NetworkConnectionHandlerImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~NetworkConnectionHandlerImplTest() override = default; @@ -174,7 +173,7 @@ network_connection_handler_->AddObserver( network_connection_observer_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_tether_delegate_.reset(new FakeTetherDelegate()); } @@ -209,7 +208,7 @@ base::Bind(&NetworkConnectionHandlerImplTest::ErrorCallback, base::Unretained(this)), true /* check_error_state */, ConnectCallbackMode::ON_COMPLETED); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void Disconnect(const std::string& service_path) { @@ -219,7 +218,7 @@ base::Unretained(this)), base::Bind(&NetworkConnectionHandlerImplTest::ErrorCallback, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void SuccessCallback() { result_ = kSuccessResult; } @@ -237,13 +236,13 @@ void StartNetworkCertLoader() { NetworkCertLoader::Get()->SetUserNSSDB(test_nsscertdb_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void LoginToRegularUser() { LoginState::Get()->SetLoggedInState(LoginState::LOGGED_IN_ACTIVE, LoginState::LOGGED_IN_USER_REGULAR); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } scoped_refptr<net::X509Certificate> ImportTestClientCert() { @@ -293,7 +292,7 @@ std::string(), // no username hash *network_configs, global_config); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } std::string ConfigureService(const std::string& shill_json_string) { @@ -319,7 +318,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkStateTestHelper helper_{false /* use_default_devices_and_services */}; std::unique_ptr<NetworkConfigurationHandler> network_config_handler_; std::unique_ptr<NetworkConnectionHandler> network_connection_handler_;
diff --git a/chromeos/network/network_device_handler_impl.cc b/chromeos/network/network_device_handler_impl.cc index 3c18b81d..272667f 100644 --- a/chromeos/network/network_device_handler_impl.cc +++ b/chromeos/network/network_device_handler_impl.cc
@@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> + #include <memory> #include <utility> #include <vector> @@ -552,7 +553,7 @@ return; case MACAddressRandomizationSupport::SUPPORTED: SetDevicePropertyInternal( - device_state->path(), shill::kMACAddressRandomizationEnabledProperty, + device_state->path(), shill::kMacAddressRandomizationEnabledProperty, base::Value(mac_addr_randomization_enabled_), base::DoNothing(), network_handler::ErrorCallback()); return; @@ -566,7 +567,7 @@ const base::DictionaryValue& properties) { bool supported; if (!properties.GetBooleanWithoutPathExpansion( - shill::kMACAddressRandomizationSupportedProperty, &supported)) { + shill::kMacAddressRandomizationSupportedProperty, &supported)) { if (base::SysInfo::IsRunningOnChromeOS()) { NET_LOG(ERROR) << "Failed to determine if device " << device_path << " supports MAC address randomization";
diff --git a/chromeos/network/network_device_handler_unittest.cc b/chromeos/network/network_device_handler_unittest.cc index 93a73d7..04135672 100644 --- a/chromeos/network/network_device_handler_unittest.cc +++ b/chromeos/network/network_device_handler_unittest.cc
@@ -34,8 +34,7 @@ class NetworkDeviceHandlerTest : public testing::Test { public: NetworkDeviceHandlerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~NetworkDeviceHandlerTest() override = default; void SetUp() override { @@ -104,7 +103,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::string result_; ShillDeviceClient* fake_device_client_ = nullptr; std::unique_ptr<NetworkDeviceHandler> network_device_handler_;
diff --git a/chromeos/network/network_sms_handler_unittest.cc b/chromeos/network/network_sms_handler_unittest.cc index e9dc5d5b..2c83c62 100644 --- a/chromeos/network/network_sms_handler_unittest.cc +++ b/chromeos/network/network_sms_handler_unittest.cc
@@ -52,8 +52,7 @@ class NetworkSmsHandlerTest : public testing::Test { public: NetworkSmsHandlerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~NetworkSmsHandlerTest() override = default; void SetUp() override { @@ -89,7 +88,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<NetworkSmsHandler> network_sms_handler_; std::unique_ptr<TestObserver> test_observer_; };
diff --git a/chromeos/network/network_state_handler_unittest.cc b/chromeos/network/network_state_handler_unittest.cc index 81b419189..2f1badb 100644 --- a/chromeos/network/network_state_handler_unittest.cc +++ b/chromeos/network/network_state_handler_unittest.cc
@@ -251,8 +251,7 @@ class NetworkStateHandlerTest : public testing::Test { public: NetworkStateHandlerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), device_test_(nullptr), manager_test_(nullptr), profile_test_(nullptr), @@ -347,7 +346,7 @@ false /* visible_only */, limit, list); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<NetworkStateHandler> network_state_handler_; std::unique_ptr<TestObserver> test_observer_; ShillDeviceClient::TestInterface* device_test_;
diff --git a/chromeos/network/prohibited_technologies_handler_unittest.cc b/chromeos/network/prohibited_technologies_handler_unittest.cc index f7b3f7c..66a426cc 100644 --- a/chromeos/network/prohibited_technologies_handler_unittest.cc +++ b/chromeos/network/prohibited_technologies_handler_unittest.cc
@@ -28,8 +28,7 @@ class ProhibitedTechnologiesHandlerTest : public testing::Test { public: ProhibitedTechnologiesHandlerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { LoginState::Initialize(); @@ -111,7 +110,7 @@ prohibited_technologies_handler_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkStateTestHelper helper_{false /* use_default_devices_and_services */}; std::unique_ptr<NetworkConfigurationHandler> network_config_handler_;
diff --git a/chromeos/network/proxy/proxy_config_service_impl_unittest.cc b/chromeos/network/proxy/proxy_config_service_impl_unittest.cc index ae0d0e7..17cce62 100644 --- a/chromeos/network/proxy/proxy_config_service_impl_unittest.cc +++ b/chromeos/network/proxy/proxy_config_service_impl_unittest.cc
@@ -59,7 +59,7 @@ } protected: - base::test::ScopedTaskEnvironment environment_; + base::test::TaskEnvironment environment_; }; // By default, ProxyConfigServiceImpl should ignore the state of the nested
diff --git a/chromeos/network/proxy/ui_proxy_config_service_unittest.cc b/chromeos/network/proxy/ui_proxy_config_service_unittest.cc index c6675a0a..211000c 100644 --- a/chromeos/network/proxy/ui_proxy_config_service_unittest.cc +++ b/chromeos/network/proxy/ui_proxy_config_service_unittest.cc
@@ -98,8 +98,7 @@ class UIProxyConfigServiceTest : public testing::Test { public: UIProxyConfigServiceTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) { PrefProxyConfigTrackerImpl::RegisterProfilePrefs(user_prefs_.registry()); PrefProxyConfigTrackerImpl::RegisterPrefs(local_state_.registry()); ::onc::RegisterProfilePrefs(user_prefs_.registry()); @@ -145,7 +144,7 @@ TestingPrefServiceSimple local_state_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(UIProxyConfigServiceTest, UnknownNetwork) {
diff --git a/chromeos/network/shill_property_handler_unittest.cc b/chromeos/network/shill_property_handler_unittest.cc index 6811c98..8ff3cdd0 100644 --- a/chromeos/network/shill_property_handler_unittest.cc +++ b/chromeos/network/shill_property_handler_unittest.cc
@@ -159,8 +159,7 @@ class ShillPropertyHandlerTest : public testing::Test { public: ShillPropertyHandlerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), manager_test_(NULL), device_test_(NULL), service_test_(NULL), @@ -276,7 +275,7 @@ AddService(shill::kTypeCellular, "stub_cellular1", shill::kStateIdle); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestListener> listener_; std::unique_ptr<internal::ShillPropertyHandler> shill_property_handler_; ShillManagerClient::TestInterface* manager_test_;
diff --git a/chromeos/printing/ppd_cache_unittest.cc b/chromeos/printing/ppd_cache_unittest.cc index af9627e2..4244ceb 100644 --- a/chromeos/printing/ppd_cache_unittest.cc +++ b/chromeos/printing/ppd_cache_unittest.cc
@@ -27,8 +27,7 @@ class PpdCacheTest : public ::testing::Test { public: PpdCacheTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} void SetUp() override { ASSERT_TRUE(ppd_cache_temp_dir_.CreateUniqueTempDir()); @@ -41,7 +40,7 @@ scoped_refptr<PpdCache> CreateTestCache() { return PpdCache::CreateForTesting( ppd_cache_temp_dir_.GetPath().Append("Cache"), - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); } void CaptureFindResult(const PpdCache::FindResult& result) { @@ -51,7 +50,7 @@ protected: // Environment for task schedulers. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Number of find results we've captured. int captured_find_results_ = 0; @@ -70,7 +69,7 @@ auto cache = CreateTestCache(); cache->Find("foo", base::BindOnce(&PpdCacheTest::CaptureFindResult, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(captured_find_results_, 1); EXPECT_FALSE(find_result_.success); } @@ -83,17 +82,17 @@ cache->Find(kTestKey, base::BindOnce(&PpdCacheTest::CaptureFindResult, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(captured_find_results_, 1); EXPECT_FALSE(find_result_.success); cache->Store(kTestKey, kTestContents); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); cache->Find(kTestKey, base::BindOnce(&PpdCacheTest::CaptureFindResult, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(captured_find_results_, 2); EXPECT_TRUE(find_result_.success); EXPECT_EQ(find_result_.contents, kTestContents); @@ -101,7 +100,7 @@ cache->Find(kTestKey2, base::BindOnce(&PpdCacheTest::CaptureFindResult, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(captured_find_results_, 3); EXPECT_FALSE(find_result_.success); } @@ -112,11 +111,11 @@ const char kTestKey[] = "My totally awesome key"; const char kTestContents[] = "Like, totally awesome contents"; cache->Store(kTestKey, kTestContents); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); cache->Find(kTestKey, base::BindOnce(&PpdCacheTest::CaptureFindResult, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(captured_find_results_, 1); // The age should be well under a second, but accept anything under an hour. EXPECT_LT(find_result_.age, TimeDelta::FromHours(1));
diff --git a/chromeos/printing/ppd_provider_unittest.cc b/chromeos/printing/ppd_provider_unittest.cc index b78427a5..0584497 100644 --- a/chromeos/printing/ppd_provider_unittest.cc +++ b/chromeos/printing/ppd_provider_unittest.cc
@@ -67,8 +67,7 @@ class PpdProviderTest : public ::testing::Test { public: PpdProviderTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { TurnOffFakePpdServer(); } @@ -80,7 +79,7 @@ // Create and return a provider for a test that uses the given |locale|. If // run_cache_on_test_thread is true, we'll run the cache using the - // scoped_task_environment_; otherwise we'll let it spawn it's own background + // task_environment_; otherwise we'll let it spawn it's own background // threads. You should only run the cache on the test thread if you need to // explicity drain cache actions independently of draining ppd provider // actions; otherwise letting the cache spawn its own thread should be safe, @@ -93,7 +92,7 @@ if (run_cache_on_test_thread) { ppd_cache_ = PpdCache::CreateForTesting( ppd_cache_temp_dir_.GetPath(), - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); } else { ppd_cache_ = PpdCache::Create(ppd_cache_temp_dir_.GetPath()); } @@ -127,7 +126,7 @@ // Note this is harmless to call if we haven't started a fake ppd server. void StopFakePpdServer() { TurnOffFakePpdServer(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Capture the result of a ResolveManufacturers() call. @@ -179,7 +178,7 @@ auto provider = CreateProvider(browser_locale, false); provider->ResolveManufacturers(base::BindOnce( &PpdProviderTest::CaptureResolveManufacturers, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); provider = nullptr; ASSERT_EQ(captured_resolve_manufacturers_.size(), 1UL); EXPECT_EQ(captured_resolve_manufacturers_[0].first, PpdProvider::SUCCESS); @@ -303,7 +302,7 @@ } // Environment for task schedulers. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::vector< std::pair<PpdProvider::CallbackResultCode, std::vector<std::string>>> @@ -357,7 +356,7 @@ &PpdProviderTest::CaptureResolveManufacturers, base::Unretained(this))); provider->ResolveManufacturers(base::BindOnce( &PpdProviderTest::CaptureResolveManufacturers, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(2UL, captured_resolve_manufacturers_.size()); std::vector<std::string> expected_result( {"manufacturer_a_en", "manufacturer_b_en"}); @@ -377,7 +376,7 @@ &PpdProviderTest::CaptureResolveManufacturers, base::Unretained(this))); provider->ResolveManufacturers(base::BindOnce( &PpdProviderTest::CaptureResolveManufacturers, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(2UL, captured_resolve_manufacturers_.size()); EXPECT_EQ(PpdProvider::SERVER_ERROR, captured_resolve_manufacturers_[0].first); @@ -427,7 +426,7 @@ recognized_printer, base::BindOnce(&PpdProviderTest::CaptureResolvePpdReference, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(static_cast<size_t>(3), captured_resolve_ppd_references_.size()); EXPECT_EQ(PpdProvider::NOT_FOUND, captured_resolve_ppd_references_[0].code); @@ -476,7 +475,7 @@ provider->ResolvePpdReference( search_data, base::BindOnce(&PpdProviderTest::CaptureResolvePpdReference, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(captured_resolve_ppd_references_.size(), static_cast<size_t>(4)); EXPECT_EQ(captured_resolve_ppd_references_[0].code, PpdProvider::SUCCESS); @@ -504,7 +503,7 @@ // should be in it and we check that elsewhere. We just need to run the // resolve to populate the internal PpdProvider structures. provider->ResolveManufacturers(base::BindOnce(&ResolveManufacturersNop)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); provider->ResolvePrinters( "manufacturer_a_en", @@ -515,7 +514,7 @@ base::BindOnce(&PpdProviderTest::CaptureResolvePrinters, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(2UL, captured_resolve_printers_.size()); EXPECT_EQ(PpdProvider::SUCCESS, captured_resolve_printers_[0].first); EXPECT_EQ(PpdProvider::SUCCESS, captured_resolve_printers_[1].first); @@ -546,13 +545,13 @@ StartFakePpdServer(); auto provider = CreateProvider("en", false); provider->ResolveManufacturers(base::BindOnce(&ResolveManufacturersNop)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); provider->ResolvePrinters( "bogus_doesnt_exist", base::BindOnce(&PpdProviderTest::CaptureResolvePrinters, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1UL, captured_resolve_printers_.size()); EXPECT_EQ(PpdProvider::INTERNAL_ERROR, captured_resolve_printers_[0].first); } @@ -562,7 +561,7 @@ StartFakePpdServer(); auto provider = CreateProvider("en", false); provider->ResolveManufacturers(base::BindOnce(&ResolveManufacturersNop)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); StopFakePpdServer(); @@ -574,7 +573,7 @@ "manufacturer_b_en", base::BindOnce(&PpdProviderTest::CaptureResolvePrinters, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(2UL, captured_resolve_printers_.size()); EXPECT_EQ(PpdProvider::SERVER_ERROR, captured_resolve_printers_[0].first); EXPECT_EQ(PpdProvider::SERVER_ERROR, captured_resolve_printers_[1].first); @@ -591,7 +590,7 @@ ref.effective_make_and_model = "printer_c_ref"; provider->ResolvePpd(ref, base::BindOnce(&PpdProviderTest::CaptureResolvePpd, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(2UL, captured_resolve_ppd_.size()); EXPECT_EQ(PpdProvider::SUCCESS, captured_resolve_ppd_[0].code); @@ -613,7 +612,7 @@ "https://%s/user_supplied_ppd_directory/user_supplied.ppd", kPpdServer); provider->ResolvePpd(ref, base::BindOnce(&PpdProviderTest::CaptureResolvePpd, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1UL, captured_resolve_ppd_.size()); EXPECT_EQ(PpdProvider::INTERNAL_ERROR, captured_resolve_ppd_[0].code); @@ -640,7 +639,7 @@ base::StringPrintf("file://%s", filename.MaybeAsASCII().c_str()); provider->ResolvePpd(ref, base::BindOnce(&PpdProviderTest::CaptureResolvePpd, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1UL, captured_resolve_ppd_.size()); EXPECT_EQ(PpdProvider::SUCCESS, captured_resolve_ppd_[0].code); @@ -667,7 +666,7 @@ provider->ResolvePpd(ref, base::BindOnce(&PpdProviderTest::CaptureResolvePpd, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1UL, captured_resolve_ppd_.size()); EXPECT_EQ(PpdProvider::SUCCESS, captured_resolve_ppd_[0].code); @@ -686,7 +685,7 @@ // Re-resolve. provider->ResolvePpd(ref, base::BindOnce(&PpdProviderTest::CaptureResolvePpd, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1UL, captured_resolve_ppd_.size()); EXPECT_EQ(PpdProvider::SUCCESS, captured_resolve_ppd_[0].code); @@ -706,7 +705,7 @@ provider->ResolvePpd(ref, base::BindOnce(&PpdProviderTest::CaptureResolvePpd, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::sort(captured_resolve_ppd_[0].ppd_filters.begin(), captured_resolve_ppd_[0].ppd_filters.end()); @@ -746,7 +745,7 @@ provider->ResolvePpdReference( printer_info, base::BindOnce(&PpdProviderTest::CaptureResolvePpdReference, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::sort(captured_resolve_ppd_[0].ppd_filters.begin(), captured_resolve_ppd_[0].ppd_filters.end()); @@ -780,13 +779,13 @@ base::Unretained(this))); // TODO(skau): PpdProvider has a race condition that prevents running these // requests in parallel. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::string ref_fail = "printer_does_not_exist"; provider->ReverseLookup(ref_fail, base::BindOnce(&PpdProviderTest::CaptureReverseLookup, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(2U, captured_reverse_lookup_.size()); CapturedReverseLookup success_capture = captured_reverse_lookup_[0]; @@ -811,10 +810,10 @@ // Cache exists, and is just created, so should be fresh. ppd_cache_->StoreForTesting(PpdProvider::PpdReferenceToCacheKey(ref), cached_ppd_contents, base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); provider->ResolvePpd(ref, base::BindOnce(&PpdProviderTest::CaptureResolvePpd, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1UL, captured_resolve_ppd_.size()); // Should get the cached (not served) results back, and not have hit the @@ -839,10 +838,10 @@ ppd_cache_->StoreForTesting(PpdProvider::PpdReferenceToCacheKey(ref), cached_ppd_contents, base::TimeDelta::FromDays(180)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); provider->ResolvePpd(ref, base::BindOnce(&PpdProviderTest::CaptureResolvePpd, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1UL, captured_resolve_ppd_.size()); // Should get the served results back, not the stale cached ones. @@ -860,7 +859,7 @@ *captured_find_result = find_result; }, &captured_find_result)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(captured_find_result.success, true); EXPECT_EQ(captured_find_result.contents, expected_ppd); EXPECT_LT(captured_find_result.age, base::TimeDelta::FromDays(1)); @@ -880,10 +879,10 @@ ppd_cache_->StoreForTesting(PpdProvider::PpdReferenceToCacheKey(ref), cached_ppd_contents, base::TimeDelta::FromDays(180)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); provider->ResolvePpd(ref, base::BindOnce(&PpdProviderTest::CaptureResolvePpd, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1UL, captured_resolve_ppd_.size()); // Should successfully resolve from the cache, even though it's stale. @@ -901,7 +900,7 @@ *captured_find_result = find_result; }, &captured_find_result)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(captured_find_result.success, true); EXPECT_EQ(captured_find_result.contents, cached_ppd_contents); EXPECT_GT(captured_find_result.age, base::TimeDelta::FromDays(179)); @@ -925,7 +924,7 @@ // Put cached_ppd_contents into the cache. ppd_cache_->StoreForTesting(PpdProvider::PpdReferenceToCacheKey(ref), cached_ppd_contents, base::TimeDelta()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Write different contents to disk, so that the cached contents are // now stale. @@ -935,7 +934,7 @@ provider->ResolvePpd(ref, base::BindOnce(&PpdProviderTest::CaptureResolvePpd, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1UL, captured_resolve_ppd_.size()); EXPECT_EQ(PpdProvider::SUCCESS, captured_resolve_ppd_[0].code); EXPECT_EQ(disk_ppd_contents, captured_resolve_ppd_[0].ppd_contents); @@ -949,7 +948,7 @@ *captured_find_result = find_result; }, &captured_find_result)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(captured_find_result.success, true); EXPECT_EQ(captured_find_result.contents, disk_ppd_contents); } @@ -981,7 +980,7 @@ provider->ResolvePpdReference( search_data, base::BindOnce(&PpdProviderTest::CaptureResolvePpdReference, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(static_cast<size_t>(2), captured_resolve_ppd_references_.size()); // Was able to find the printer manufactuer but unable to find the printer
diff --git a/chromeos/process_proxy/process_output_watcher_unittest.cc b/chromeos/process_proxy/process_output_watcher_unittest.cc index e58c36f..c8a9aeb19 100644 --- a/chromeos/process_proxy/process_output_watcher_unittest.cc +++ b/chromeos/process_proxy/process_output_watcher_unittest.cc
@@ -125,14 +125,14 @@ failed_ = !expectations_.CheckExpectations(output, type); if (failed_ || expectations_.IsDone()) { ASSERT_FALSE(test_case_done_callback_.is_null()); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, test_case_done_callback_); test_case_done_callback_.Reset(); } ASSERT_FALSE(ack_callback.is_null()); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask(FROM_HERE, - ack_callback); + task_environment_.GetMainThreadTaskRunner()->PostTask(FROM_HERE, + ack_callback); } protected: @@ -193,7 +193,7 @@ private: base::Closure test_case_done_callback_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::Thread> output_watch_thread_; bool output_watch_thread_started_; bool failed_;
diff --git a/chromeos/process_proxy/process_proxy_unittest.cc b/chromeos/process_proxy/process_proxy_unittest.cc index 30b2f2e..7802102 100644 --- a/chromeos/process_proxy/process_proxy_unittest.cc +++ b/chromeos/process_proxy/process_proxy_unittest.cc
@@ -267,7 +267,7 @@ std::string id_; base::ProcessHandle handle_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Test will open new process that will run cat command, and verify data we
diff --git a/chromeos/services/assistant/platform/audio_output_provider_impl_unittest.cc b/chromeos/services/assistant/platform/audio_output_provider_impl_unittest.cc index 2d96b81e..fe23a2b 100644 --- a/chromeos/services/assistant/platform/audio_output_provider_impl_unittest.cc +++ b/chromeos/services/assistant/platform/audio_output_provider_impl_unittest.cc
@@ -80,14 +80,14 @@ class AudioDeviceOwnerTest : public testing::Test { public: AudioDeviceOwnerTest() - : task_env_(base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) {} + : task_env_( + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} ~AudioDeviceOwnerTest() override { task_env_.RunUntilIdle(); } private: - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; DISALLOW_COPY_AND_ASSIGN(AudioDeviceOwnerTest); };
diff --git a/chromeos/services/assistant/platform/power_manager_provider_impl_unittest.cc b/chromeos/services/assistant/platform/power_manager_provider_impl_unittest.cc index 8780f1de..37add6f9 100644 --- a/chromeos/services/assistant/platform/power_manager_provider_impl_unittest.cc +++ b/chromeos/services/assistant/platform/power_manager_provider_impl_unittest.cc
@@ -47,19 +47,18 @@ class PowerManagerProviderImplTest : public testing::Test { public: PowerManagerProviderImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO, + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~PowerManagerProviderImplTest() override = default; void SetUp() override { chromeos::PowerManagerClient::InitializeFake(); FakePowerManagerClient::Get()->set_tick_clock( - scoped_task_environment_.GetMockTickClock()); + task_environment_.GetMockTickClock()); power_manager_provider_impl_ = std::make_unique<PowerManagerProviderImpl>( - &test_client_, scoped_task_environment_.GetMainThreadTaskRunner()); + &test_client_, task_environment_.GetMainThreadTaskRunner()); power_manager_provider_impl_->set_tick_clock_for_testing( - scoped_task_environment_.GetMockTickClock()); + task_environment_.GetMockTickClock()); } void TearDown() override { @@ -117,7 +116,7 @@ power_manager_provider_impl_->AddWakeAlarm( relative_time_ms, max_delay_ms, std::move(wake_alarm_expiration_cb)); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( base::TimeDelta::FromMilliseconds(relative_time_ms)); if (id <= 0UL) @@ -127,7 +126,7 @@ private: // Needs to be of type |MainThreadType::IO| to use |NativeTimer|. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; device::TestWakeLockProvider wake_lock_provider_; PowerManagerProviderTestClient test_client_{&wake_lock_provider_};
diff --git a/chromeos/services/assistant/platform/system_provider_impl_unittest.cc b/chromeos/services/assistant/platform/system_provider_impl_unittest.cc index 1a4ac4f..f5da275 100644 --- a/chromeos/services/assistant/platform/system_provider_impl_unittest.cc +++ b/chromeos/services/assistant/platform/system_provider_impl_unittest.cc
@@ -61,15 +61,14 @@ class SystemProviderImplTest : public testing::Test { public: SystemProviderImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) { battery_monitor_.SetStatus(device::mojom::BatteryStatus::New( false /* charging */, 0 /* charging_time */, 0 /* discharging_time */, 0 /* level */)); system_provider_impl_ = std::make_unique<SystemProviderImpl>( std::make_unique<PowerManagerProviderImpl>( - &fake_client_, scoped_task_environment_.GetMainThreadTaskRunner()), + &fake_client_, task_environment_.GetMainThreadTaskRunner()), battery_monitor_.CreateInterfacePtrAndBind()); FlushForTesting(); } @@ -81,7 +80,7 @@ void FlushForTesting() { system_provider_impl_->FlushForTesting(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeBatteryMonitor battery_monitor_; FakeClient fake_client_; std::unique_ptr<SystemProviderImpl> system_provider_impl_;
diff --git a/chromeos/services/assistant/service_unittest.cc b/chromeos/services/assistant/service_unittest.cc index ba2f31a1..ec51c29 100644 --- a/chromeos/services/assistant/service_unittest.cc +++ b/chromeos/services/assistant/service_unittest.cc
@@ -260,7 +260,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<Service> service_; mojo::Remote<mojom::AssistantService> remote_service_;
diff --git a/chromeos/services/cellular_setup/cellular_setup_impl_unittest.cc b/chromeos/services/cellular_setup/cellular_setup_impl_unittest.cc index d27b84c..ead444f3 100644 --- a/chromeos/services/cellular_setup/cellular_setup_impl_unittest.cc +++ b/chromeos/services/cellular_setup/cellular_setup_impl_unittest.cc
@@ -113,7 +113,7 @@ std::move(quit_closure).Run(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeOtaActivatorFactory fake_ota_activator_factory_; std::unique_ptr<CellularSetupBase> cellular_setup_;
diff --git a/chromeos/services/cellular_setup/cellular_setup_service_unittest.cc b/chromeos/services/cellular_setup/cellular_setup_service_unittest.cc index d6e0c50..b7c024f 100644 --- a/chromeos/services/cellular_setup/cellular_setup_service_unittest.cc +++ b/chromeos/services/cellular_setup/cellular_setup_service_unittest.cc
@@ -158,7 +158,7 @@ ->activation_delegate(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeCellularSetup> service_;
diff --git a/chromeos/services/cellular_setup/ota_activator_impl_unittest.cc b/chromeos/services/cellular_setup/ota_activator_impl_unittest.cc index 8c98536..f720587 100644 --- a/chromeos/services/cellular_setup/ota_activator_impl_unittest.cc +++ b/chromeos/services/cellular_setup/ota_activator_impl_unittest.cc
@@ -214,7 +214,7 @@ is_finished_ = true; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkStateTestHelper test_helper_; std::unique_ptr<FakeActivationDelegate> fake_activation_delegate_;
diff --git a/chromeos/services/cros_healthd/public/cpp/service_connection_unittest.cc b/chromeos/services/cros_healthd/public/cpp/service_connection_unittest.cc index 75a2baa..12f537d 100644 --- a/chromeos/services/cros_healthd/public/cpp/service_connection_unittest.cc +++ b/chromeos/services/cros_healthd/public/cpp/service_connection_unittest.cc
@@ -64,7 +64,7 @@ MockCrosHealthdService* mock_service() { return &mock_service_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; StrictMock<MockCrosHealthdService> mock_service_; DISALLOW_COPY_AND_ASSIGN(CrosHealthdServiceConnectionTest);
diff --git a/chromeos/services/device_sync/cryptauth_api_call_flow_unittest.cc b/chromeos/services/device_sync/cryptauth_api_call_flow_unittest.cc index b8d56d6..39706269 100644 --- a/chromeos/services/device_sync/cryptauth_api_call_flow_unittest.cc +++ b/chromeos/services/device_sync/cryptauth_api_call_flow_unittest.cc
@@ -185,7 +185,7 @@ GURL(kRequestUrl), completion_status, response_head, content, network::TestURLLoaderFactory::ResponseMatchFlags::kUrlMatchPrefix)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(result_ || network_error_); } @@ -209,7 +209,7 @@ GURL(kRequestUrl), completion_status, response_head, content, network::TestURLLoaderFactory::ResponseMatchFlags::kUrlMatchPrefix)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(result_ || network_error_); } @@ -217,7 +217,7 @@ std::unique_ptr<NetworkRequestError> network_error_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> shared_factory_;
diff --git a/chromeos/services/device_sync/cryptauth_client_impl_unittest.cc b/chromeos/services/device_sync/cryptauth_client_impl_unittest.cc index 78df6a6..e83615e 100644 --- a/chromeos/services/device_sync/cryptauth_client_impl_unittest.cc +++ b/chromeos/services/device_sync/cryptauth_client_impl_unittest.cc
@@ -195,7 +195,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; signin::IdentityTestEnvironment identity_test_environment_; // Owned by |client_|. StrictMock<MockCryptAuthApiCallFlow>* api_call_flow_;
diff --git a/chromeos/services/device_sync/cryptauth_ecies_encryptor_impl_unittest.cc b/chromeos/services/device_sync/cryptauth_ecies_encryptor_impl_unittest.cc index 9cbec6f..8cee911 100644 --- a/chromeos/services/device_sync/cryptauth_ecies_encryptor_impl_unittest.cc +++ b/chromeos/services/device_sync/cryptauth_ecies_encryptor_impl_unittest.cc
@@ -225,7 +225,7 @@ } } - const base::test::ScopedTaskEnvironment scoped_task_environment_; + const base::test::TaskEnvironment task_environment_; std::unique_ptr<CryptAuthEciesEncryptor> encryptor_; base::Optional<std::string> encrypted_payload_ = kPayloadNotSet;
diff --git a/chromeos/services/device_sync/cryptauth_scheduler_impl_unittest.cc b/chromeos/services/device_sync/cryptauth_scheduler_impl_unittest.cc index fedf1c9..c149a74 100644 --- a/chromeos/services/device_sync/cryptauth_scheduler_impl_unittest.cc +++ b/chromeos/services/device_sync/cryptauth_scheduler_impl_unittest.cc
@@ -347,7 +347,7 @@ prefs::kCryptAuthSchedulerNextDeviceSyncRequestClientMetadata)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeCryptAuthSchedulerEnrollmentDelegate fake_enrollment_delegate_; FakeCryptAuthSchedulerDeviceSyncDelegate fake_device_sync_delegate_; TestingPrefServiceSimple pref_service_;
diff --git a/chromeos/services/device_sync/device_sync_service_unittest.cc b/chromeos/services/device_sync/device_sync_service_unittest.cc index a4d0529..e0ea880 100644 --- a/chromeos/services/device_sync/device_sync_service_unittest.cc +++ b/chromeos/services/device_sync/device_sync_service_unittest.cc
@@ -1141,7 +1141,7 @@ std::move(quit_closure).Run(); } - const base::test::ScopedTaskEnvironment scoped_task_environment_; + const base::test::TaskEnvironment task_environment_; const multidevice::RemoteDeviceList test_devices_; const std::vector<cryptauth::ExternalDeviceInfo> test_device_infos_; const std::vector<cryptauth::IneligibleDevice> test_ineligible_devices_;
diff --git a/chromeos/services/device_sync/public/cpp/device_sync_client_impl_unittest.cc b/chromeos/services/device_sync/public/cpp/device_sync_client_impl_unittest.cc index 7bf57203..b610d839 100644 --- a/chromeos/services/device_sync/public/cpp/device_sync_client_impl_unittest.cc +++ b/chromeos/services/device_sync/public/cpp/device_sync_client_impl_unittest.cc
@@ -426,7 +426,7 @@ void SendPendingMojoMessages() { client_->FlushForTesting(); } - const base::test::ScopedTaskEnvironment scoped_task_environment_; + const base::test::TaskEnvironment task_environment_; std::unique_ptr<signin::IdentityTestEnvironment> identity_test_environment_; std::unique_ptr<gcm::FakeGCMDriver> fake_gcm_driver_;
diff --git a/chromeos/services/ime/ime_service_unittest.cc b/chromeos/services/ime/ime_service_unittest.cc index 7949abe5..d2da80bd 100644 --- a/chromeos/services/ime/ime_service_unittest.cc +++ b/chromeos/services/ime/ime_service_unittest.cc
@@ -91,7 +91,7 @@ mojo::Remote<mojom::InputEngineManager> remote_manager_; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; ImeService service_; DISALLOW_COPY_AND_ASSIGN(ImeServiceTest);
diff --git a/chromeos/services/machine_learning/public/cpp/service_connection_unittest.cc b/chromeos/services/machine_learning/public/cpp/service_connection_unittest.cc index 0c383dc..090aba7 100644 --- a/chromeos/services/machine_learning/public/cpp/service_connection_unittest.cc +++ b/chromeos/services/machine_learning/public/cpp/service_connection_unittest.cc
@@ -47,7 +47,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(ServiceConnectionTest); };
diff --git a/chromeos/services/multidevice_setup/account_status_change_delegate_notifier_impl_unittest.cc b/chromeos/services/multidevice_setup/account_status_change_delegate_notifier_impl_unittest.cc index 678ff73..9030da0 100644 --- a/chromeos/services/multidevice_setup/account_status_change_delegate_notifier_impl_unittest.cc +++ b/chromeos/services/multidevice_setup/account_status_change_delegate_notifier_impl_unittest.cc
@@ -187,7 +187,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeAccountStatusChangeDelegate> fake_delegate_; std::unique_ptr<FakeHostStatusProvider> fake_host_status_provider_;
diff --git a/chromeos/services/multidevice_setup/multidevice_setup_impl_unittest.cc b/chromeos/services/multidevice_setup/multidevice_setup_impl_unittest.cc index 2a0b262..dbb955d 100644 --- a/chromeos/services/multidevice_setup/multidevice_setup_impl_unittest.cc +++ b/chromeos/services/multidevice_setup/multidevice_setup_impl_unittest.cc
@@ -859,7 +859,7 @@ std::move(quit_closure).Run(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; multidevice::RemoteDeviceRefList test_devices_;
diff --git a/chromeos/services/multidevice_setup/multidevice_setup_service_unittest.cc b/chromeos/services/multidevice_setup/multidevice_setup_service_unittest.cc index d28c7f64..c9f9a44b 100644 --- a/chromeos/services/multidevice_setup/multidevice_setup_service_unittest.cc +++ b/chromeos/services/multidevice_setup/multidevice_setup_service_unittest.cc
@@ -201,7 +201,7 @@ std::move(quit_closure).Run(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const multidevice::RemoteDeviceRefList test_devices_; std::unique_ptr<sync_preferences::TestingPrefServiceSyncable>
diff --git a/chromeos/services/multidevice_setup/privileged_host_device_setter_impl_unittest.cc b/chromeos/services/multidevice_setup/privileged_host_device_setter_impl_unittest.cc index 7405b06..bd141b9 100644 --- a/chromeos/services/multidevice_setup/privileged_host_device_setter_impl_unittest.cc +++ b/chromeos/services/multidevice_setup/privileged_host_device_setter_impl_unittest.cc
@@ -48,7 +48,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; void OnSetHostDeviceResult(bool success) { EXPECT_FALSE(last_set_host_success_);
diff --git a/chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client_impl_unittest.cc b/chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client_impl_unittest.cc index 2df61bf..7b437f8 100644 --- a/chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client_impl_unittest.cc +++ b/chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client_impl_unittest.cc
@@ -402,7 +402,7 @@ std::move(quit_closure).Run(); } - const base::test::ScopedTaskEnvironment scoped_task_environment_; + const base::test::TaskEnvironment task_environment_; FakeMultiDeviceSetup* fake_multidevice_setup_; std::unique_ptr<FakeMultiDeviceSetupInitializerFactory>
diff --git a/chromeos/services/network_config/cros_network_config_unittest.cc b/chromeos/services/network_config/cros_network_config_unittest.cc index 1c0a609..ff04f88 100644 --- a/chromeos/services/network_config/cros_network_config_unittest.cc +++ b/chromeos/services/network_config/cros_network_config_unittest.cc
@@ -245,7 +245,7 @@ std::string wifi1_path() { return wifi1_path_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NetworkStateTestHelper helper_{false /* use_default_devices_and_services */}; std::unique_ptr<NetworkProfileHandler> network_profile_handler_; std::unique_ptr<NetworkDeviceHandler> network_device_handler_;
diff --git a/chromeos/services/secure_channel/active_connection_manager_impl_unittest.cc b/chromeos/services/secure_channel/active_connection_manager_impl_unittest.cc index 9b6631b4..6838814 100644 --- a/chromeos/services/secure_channel/active_connection_manager_impl_unittest.cc +++ b/chromeos/services/secure_channel/active_connection_manager_impl_unittest.cc
@@ -28,7 +28,8 @@ class FakeMultiplexedChannelFactory : public MultiplexedChannelImpl::Factory { public: - FakeMultiplexedChannelFactory(MultiplexedChannel::Delegate* expected_delegate) + explicit FakeMultiplexedChannelFactory( + MultiplexedChannel::Delegate* expected_delegate) : expected_delegate_(expected_delegate) {} ~FakeMultiplexedChannelFactory() override = default; @@ -217,7 +218,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeMultiplexedChannelFactory> fake_multiplexed_channel_factory_;
diff --git a/chromeos/services/secure_channel/authenticated_channel_impl_unittest.cc b/chromeos/services/secure_channel/authenticated_channel_impl_unittest.cc index f53484f93..b6f11c6 100644 --- a/chromeos/services/secure_channel/authenticated_channel_impl_unittest.cc +++ b/chromeos/services/secure_channel/authenticated_channel_impl_unittest.cc
@@ -127,7 +127,7 @@ sent_sequence_numbers_.insert(sequence_number); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const multidevice::RemoteDeviceRef test_device_; int num_times_send_message_called_ = 0;
diff --git a/chromeos/services/secure_channel/ble_advertiser_impl_unittest.cc b/chromeos/services/secure_channel/ble_advertiser_impl_unittest.cc index 61a149f..8748c1e 100644 --- a/chromeos/services/secure_channel/ble_advertiser_impl_unittest.cc +++ b/chromeos/services/secure_channel/ble_advertiser_impl_unittest.cc
@@ -262,7 +262,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeBleAdvertiserDelegate> fake_delegate_; std::unique_ptr<FakeBleServiceDataHelper> fake_ble_service_data_helper_;
diff --git a/chromeos/services/secure_channel/ble_characteristics_finder_unittest.cc b/chromeos/services/secure_channel/ble_characteristics_finder_unittest.cc index 5a60c63..8c8d892 100644 --- a/chromeos/services/secure_channel/ble_characteristics_finder_unittest.cc +++ b/chromeos/services/secure_channel/ble_characteristics_finder_unittest.cc
@@ -157,7 +157,7 @@ // Posting to a task to allow the read to be asynchronous, although still // running only on one thread. Calls to - // |scoped_task_environment_.RunUntilIdle()| in tests will process any + // |task_environment_.RunUntilIdle()| in tests will process any // pending callbacks. ON_CALL(*characteristic.get(), ReadRemoteCharacteristic_(_, _)) .WillByDefault( @@ -261,7 +261,7 @@ std::unique_ptr<BluetoothLowEnergyCharacteristicsFinder> characteristic_finder_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<device::MockBluetoothAdapter> adapter_; BluetoothLowEnergyCharacteristicsFinder::SuccessCallback success_callback_; BluetoothLowEnergyCharacteristicsFinder::ErrorCallback error_callback_; @@ -446,7 +446,7 @@ kEidCharID); CallGattServicesDiscovered(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(kToPeripheralCharID, found_to_char.id); EXPECT_EQ(kFromPeripheralCharID, found_from_char.id); @@ -475,7 +475,7 @@ /* is_discovery_complete */ false); CallGattServicesDiscovered(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(SecureChannelBluetoothLowEnergyCharacteristicFinderTest, @@ -487,7 +487,7 @@ kEidCharID, /* correct_eid_value */ false); CallGattServicesDiscovered(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(SecureChannelBluetoothLowEnergyCharacteristicFinderTest, @@ -501,7 +501,7 @@ /* correct_eid_value */ false); CallGattServicesDiscovered(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(SecureChannelBluetoothLowEnergyCharacteristicFinderTest, @@ -518,7 +518,7 @@ /* correct_eid_value */ false); CallGattServicesDiscovered(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(kToPeripheralCharID, found_to_char.id); EXPECT_EQ(kFromPeripheralCharID, found_from_char.id); @@ -559,7 +559,7 @@ /* correct_eid_value */ false); CallGattServicesDiscovered(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(kToPeripheralCharID, found_to_char.id); EXPECT_EQ(kFromPeripheralCharID, found_from_char.id);
diff --git a/chromeos/services/secure_channel/ble_connection_manager_impl_unittest.cc b/chromeos/services/secure_channel/ble_connection_manager_impl_unittest.cc index afb1fd6..b1aceec 100644 --- a/chromeos/services/secure_channel/ble_connection_manager_impl_unittest.cc +++ b/chromeos/services/secure_channel/ble_connection_manager_impl_unittest.cc
@@ -325,9 +325,9 @@ class SecureChannelBleConnectionManagerImplTest : public testing::Test { protected: SecureChannelBleConnectionManagerImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED), + : task_environment_( + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED), test_devices_( multidevice::CreateRemoteDeviceRefListForTest(kNumTestDevices)) {} ~SecureChannelBleConnectionManagerImplTest() override = default; @@ -701,7 +701,7 @@ fake_secure_channel); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const multidevice::RemoteDeviceRefList& test_devices() { return test_devices_; }
diff --git a/chromeos/services/secure_channel/ble_initiator_operation_unittest.cc b/chromeos/services/secure_channel/ble_initiator_operation_unittest.cc index d929bdba..b18b956c 100644 --- a/chromeos/services/secure_channel/ble_initiator_operation_unittest.cc +++ b/chromeos/services/secure_channel/ble_initiator_operation_unittest.cc
@@ -97,7 +97,7 @@ failure_type_from_callback_ = failure_type; } - const base::test::ScopedTaskEnvironment scoped_task_environment_; + const base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeBleConnectionManager> fake_ble_connection_manager_; DeviceIdPair device_id_pair_;
diff --git a/chromeos/services/secure_channel/ble_listener_operation_unittest.cc b/chromeos/services/secure_channel/ble_listener_operation_unittest.cc index 9d53f17..d3e216e 100644 --- a/chromeos/services/secure_channel/ble_listener_operation_unittest.cc +++ b/chromeos/services/secure_channel/ble_listener_operation_unittest.cc
@@ -97,7 +97,7 @@ failure_type_from_callback_ = failure_type; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeBleConnectionManager> fake_ble_connection_manager_; DeviceIdPair device_id_pair_;
diff --git a/chromeos/services/secure_channel/ble_synchronizer_unittest.cc b/chromeos/services/secure_channel/ble_synchronizer_unittest.cc index a136424..1e74364 100644 --- a/chromeos/services/secure_channel/ble_synchronizer_unittest.cc +++ b/chromeos/services/secure_channel/ble_synchronizer_unittest.cc
@@ -425,7 +425,7 @@ device::UMABluetoothDiscoverySessionOutcome::UNKNOWN)))); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const scoped_refptr<FakeBluetoothAdvertisement> fake_advertisement_; scoped_refptr<NiceMock<MockBluetoothAdapterWithAdvertisements>> mock_adapter_;
diff --git a/chromeos/services/secure_channel/ble_weave_client_connection_unittest.cc b/chromeos/services/secure_channel/ble_weave_client_connection_unittest.cc index 2f081a2..be71ad1 100644 --- a/chromeos/services/secure_channel/ble_weave_client_connection_unittest.cc +++ b/chromeos/services/secure_channel/ble_weave_client_connection_unittest.cc
@@ -669,7 +669,7 @@ std::unique_ptr<device::MockBluetoothGattCharacteristic> tx_characteristic_; std::unique_ptr<device::MockBluetoothGattCharacteristic> rx_characteristic_; std::vector<uint8_t> last_value_written_on_tx_characteristic_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; int32_t rssi_for_channel_ = device::BluetoothDevice::kUnknownPower; bool last_wire_message_success_; bool has_verified_connection_result_;
diff --git a/chromeos/services/secure_channel/client_connection_parameters_impl_unittest.cc b/chromeos/services/secure_channel/client_connection_parameters_impl_unittest.cc index fb8b1e6..05d579d 100644 --- a/chromeos/services/secure_channel/client_connection_parameters_impl_unittest.cc +++ b/chromeos/services/secure_channel/client_connection_parameters_impl_unittest.cc
@@ -86,7 +86,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeConnectionDelegate> fake_connection_delegate_; mojom::ConnectionDelegate::Proxy_* fake_connection_delegate_proxy_ = nullptr;
diff --git a/chromeos/services/secure_channel/connect_to_device_operation_base_unittest.cc b/chromeos/services/secure_channel/connect_to_device_operation_base_unittest.cc index 716b1e2..c5326fc 100644 --- a/chromeos/services/secure_channel/connect_to_device_operation_base_unittest.cc +++ b/chromeos/services/secure_channel/connect_to_device_operation_base_unittest.cc
@@ -148,7 +148,7 @@ last_failure_detail_ = failure_detail; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const DeviceIdPair test_device_id_pair_; std::unique_ptr<AuthenticatedChannel> last_authenticated_channel_;
diff --git a/chromeos/services/secure_channel/connection_attempt_base_unittest.cc b/chromeos/services/secure_channel/connection_attempt_base_unittest.cc index 14f8123..5759ba2 100644 --- a/chromeos/services/secure_channel/connection_attempt_base_unittest.cc +++ b/chromeos/services/secure_channel/connection_attempt_base_unittest.cc
@@ -40,7 +40,7 @@ class TestConnectionAttempt : public ConnectionAttemptBase<BleInitiatorFailureType> { public: - TestConnectionAttempt(FakeConnectionAttemptDelegate* delegate) + explicit TestConnectionAttempt(FakeConnectionAttemptDelegate* delegate) : ConnectionAttemptBase<BleInitiatorFailureType>( delegate, ConnectionAttemptDetails(kTestRemoteDeviceId, @@ -215,7 +215,7 @@ was_operation_canceled_in_tear_down_ = true; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeConnectionAttemptDelegate> fake_delegate_;
diff --git a/chromeos/services/secure_channel/multiplexed_channel_impl_unittest.cc b/chromeos/services/secure_channel/multiplexed_channel_impl_unittest.cc index c3ad929..c53a2862 100644 --- a/chromeos/services/secure_channel/multiplexed_channel_impl_unittest.cc +++ b/chromeos/services/secure_channel/multiplexed_channel_impl_unittest.cc
@@ -297,7 +297,7 @@ sent_message_counters_.insert(message_counter); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; int next_send_message_counter_ = 0; std::unordered_set<int> sent_message_counters_;
diff --git a/chromeos/services/secure_channel/pending_ble_initiator_connection_request_unittest.cc b/chromeos/services/secure_channel/pending_ble_initiator_connection_request_unittest.cc index f6383567..201e2bf 100644 --- a/chromeos/services/secure_channel/pending_ble_initiator_connection_request_unittest.cc +++ b/chromeos/services/secure_channel/pending_ble_initiator_connection_request_unittest.cc
@@ -66,7 +66,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakePendingConnectionRequestDelegate> fake_pending_connection_request_delegate_;
diff --git a/chromeos/services/secure_channel/pending_ble_listener_connection_request_unittest.cc b/chromeos/services/secure_channel/pending_ble_listener_connection_request_unittest.cc index 77d8a7a6..9c6e8ce 100644 --- a/chromeos/services/secure_channel/pending_ble_listener_connection_request_unittest.cc +++ b/chromeos/services/secure_channel/pending_ble_listener_connection_request_unittest.cc
@@ -66,7 +66,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakePendingConnectionRequestDelegate> fake_pending_connection_request_delegate_;
diff --git a/chromeos/services/secure_channel/pending_connection_manager_impl_unittest.cc b/chromeos/services/secure_channel/pending_connection_manager_impl_unittest.cc index bf2c3e91..0faa22d 100644 --- a/chromeos/services/secure_channel/pending_connection_manager_impl_unittest.cc +++ b/chromeos/services/secure_channel/pending_connection_manager_impl_unittest.cc
@@ -586,7 +586,7 @@ std::move(fake_client_connection_parameters), connection_priority); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakePendingConnectionManagerDelegate> fake_delegate_; std::unique_ptr<FakeBleConnectionManager> fake_ble_connection_manager_;
diff --git a/chromeos/services/secure_channel/pending_connection_request_base_unittest.cc b/chromeos/services/secure_channel/pending_connection_request_base_unittest.cc index 6929b7f..ff28c81 100644 --- a/chromeos/services/secure_channel/pending_connection_request_base_unittest.cc +++ b/chromeos/services/secure_channel/pending_connection_request_base_unittest.cc
@@ -116,7 +116,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeClientConnectionParameters* fake_client_connection_parameters_; std::unique_ptr<FakePendingConnectionRequestDelegate>
diff --git a/chromeos/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc b/chromeos/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc index d857a36..17d8781 100644 --- a/chromeos/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc +++ b/chromeos/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc
@@ -96,7 +96,7 @@ static_cast<ClientChannelImpl*>(client_channel_.get())->FlushForTesting(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeChannel> fake_channel_; mojom::MessageReceiverPtr message_receiver_ptr_;
diff --git a/chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc b/chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc index 1d739011..4b5cd8b 100644 --- a/chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc +++ b/chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc
@@ -200,7 +200,7 @@ static_cast<SecureChannelClientImpl*>(client_.get())->FlushForTesting(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeSecureChannel* fake_secure_channel_; std::unique_ptr<FakeSecureChannelInitializerFactory>
diff --git a/chromeos/services/secure_channel/secure_channel_service_unittest.cc b/chromeos/services/secure_channel/secure_channel_service_unittest.cc index 0cdf2b7..9bf2c51 100644 --- a/chromeos/services/secure_channel/secure_channel_service_unittest.cc +++ b/chromeos/services/secure_channel/secure_channel_service_unittest.cc
@@ -826,7 +826,7 @@ return test_remote_device_cache_factory_->instance(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const multidevice::RemoteDeviceList test_devices_; scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> mock_adapter_;
diff --git a/chromeos/services/secure_channel/single_client_message_proxy_impl_unittest.cc b/chromeos/services/secure_channel/single_client_message_proxy_impl_unittest.cc index 73eee08..908b8494 100644 --- a/chromeos/services/secure_channel/single_client_message_proxy_impl_unittest.cc +++ b/chromeos/services/secure_channel/single_client_message_proxy_impl_unittest.cc
@@ -177,7 +177,7 @@ last_metadata_from_channel_ = std::move(connection_metadata_ptr); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeSingleClientMessageProxyDelegate> fake_proxy_delegate_; FakeClientConnectionParameters* fake_client_connection_parameters_;
diff --git a/chromeos/timezone/timezone_unittest.cc b/chromeos/timezone/timezone_unittest.cc index 26d58d8..1e7b615 100644 --- a/chromeos/timezone/timezone_unittest.cc +++ b/chromeos/timezone/timezone_unittest.cc
@@ -159,7 +159,7 @@ class TimeZoneTest : public testing::Test { private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(TimeZoneTest, ResponseOK) {
diff --git a/chromeos/tpm/install_attributes_unittest.cc b/chromeos/tpm/install_attributes_unittest.cc index bc25e362..cbd8561 100644 --- a/chromeos/tpm/install_attributes_unittest.cc +++ b/chromeos/tpm/install_attributes_unittest.cc
@@ -43,8 +43,7 @@ class InstallAttributesTest : public testing::Test { protected: InstallAttributesTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); @@ -72,7 +71,7 @@ attribute->set_value(value); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; std::unique_ptr<InstallAttributes> install_attributes_;
diff --git a/chromeos/tpm/tpm_token_info_getter_unittest.cc b/chromeos/tpm/tpm_token_info_getter_unittest.cc index 57b6b28..741c5d3 100644 --- a/chromeos/tpm/tpm_token_info_getter_unittest.cc +++ b/chromeos/tpm/tpm_token_info_getter_unittest.cc
@@ -226,7 +226,7 @@ std::vector<int64_t> delays_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(SystemTPMTokenInfoGetterTest); }; @@ -252,7 +252,7 @@ std::vector<int64_t> delays_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(UserTPMTokenInfoGetterTest); };
diff --git a/components/arc/power/arc_power_bridge_unittest.cc b/components/arc/power/arc_power_bridge_unittest.cc index 1069971..ee4a856 100644 --- a/components/arc/power/arc_power_bridge_unittest.cc +++ b/components/arc/power/arc_power_bridge_unittest.cc
@@ -103,7 +103,7 @@ return chromeos::FakePowerManagerClient::Get(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestConnectorFactory connector_factory_;
diff --git a/components/arc/session/arc_data_remover_unittest.cc b/components/arc/session/arc_data_remover_unittest.cc index 75c4d6c..827154b 100644 --- a/components/arc/session/arc_data_remover_unittest.cc +++ b/components/arc/session/arc_data_remover_unittest.cc
@@ -72,7 +72,7 @@ private: TestingPrefServiceSimple prefs_; const cryptohome::Identification cryptohome_id_{EmptyAccountId()}; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestUpstartClient> test_upstart_client_; DISALLOW_COPY_AND_ASSIGN(ArcDataRemoverTest);
diff --git a/components/arc/session/arc_session_impl_unittest.cc b/components/arc/session/arc_session_impl_unittest.cc index 83f7951..4fcc1f86 100644 --- a/components/arc/session/arc_session_impl_unittest.cc +++ b/components/arc/session/arc_session_impl_unittest.cc
@@ -224,7 +224,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; user_manager::ScopedUserManager scoped_user_manager_{ std::make_unique<user_manager::FakeUserManager>()};
diff --git a/components/arc/session/arc_session_runner_unittest.cc b/components/arc/session/arc_session_runner_unittest.cc index dcea0d3..e3c8659 100644 --- a/components/arc/session/arc_session_runner_unittest.cc +++ b/components/arc/session/arc_session_runner_unittest.cc
@@ -56,8 +56,7 @@ public ArcSessionRunner::Observer { public: ArcSessionRunnerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { chromeos::SessionManagerClient::InitializeFakeInMemory(); @@ -137,7 +136,7 @@ bool stopped_called_; bool restarting_called_; std::unique_ptr<ArcSessionRunner> arc_session_runner_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(ArcSessionRunnerTest); };
diff --git a/components/arc/wake_lock/arc_wake_lock_bridge_unittest.cc b/components/arc/wake_lock/arc_wake_lock_bridge_unittest.cc index af2e3c1..1528547 100644 --- a/components/arc/wake_lock/arc_wake_lock_bridge_unittest.cc +++ b/components/arc/wake_lock/arc_wake_lock_bridge_unittest.cc
@@ -27,8 +27,7 @@ class ArcWakeLockBridgeTest : public testing::Test { public: ArcWakeLockBridgeTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), wake_lock_provider_( connector_factory_.RegisterInstance(device::mojom::kServiceName)) { bridge_service_ = std::make_unique<ArcBridgeService>(); @@ -98,7 +97,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestConnectorFactory connector_factory_; device::TestWakeLockProvider wake_lock_provider_;
diff --git a/components/assist_ranker/base_predictor_unittest.cc b/components/assist_ranker/base_predictor_unittest.cc index 9339229b..2886785 100644 --- a/components/assist_ranker/base_predictor_unittest.cc +++ b/components/assist_ranker/base_predictor_unittest.cc
@@ -113,7 +113,7 @@ private: // Sets up the task scheduling/task-runner environment for each test. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Sets itself as the global UkmRecorder on construction. ukm::TestAutoSetUkmRecorder test_ukm_recorder_;
diff --git a/components/assist_ranker/ranker_model_loader_impl_unittest.cc b/components/assist_ranker/ranker_model_loader_impl_unittest.cc index c8476fe..dd8f4110 100644 --- a/components/assist_ranker/ranker_model_loader_impl_unittest.cc +++ b/components/assist_ranker/ranker_model_loader_impl_unittest.cc
@@ -76,7 +76,7 @@ void OnModelAvailable(std::unique_ptr<RankerModel> model); // Sets up the task scheduling/task-runner environment for each test. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Override the default URL loader to return custom responses for tests. network::TestURLLoaderFactory test_loader_factory_; @@ -175,7 +175,7 @@ test_shared_loader_factory_, model_path, model_url, "RankerModelLoaderImplTest"); loader->NotifyOfRankerActivity(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); return true; }
diff --git a/components/autofill/content/renderer/renderer_save_password_progress_logger_unittest.cc b/components/autofill/content/renderer/renderer_save_password_progress_logger_unittest.cc index 88f3bd8..52dcf93 100644 --- a/components/autofill/content/renderer/renderer_save_password_progress_logger_unittest.cc +++ b/components/autofill/content/renderer/renderer_save_password_progress_logger_unittest.cc
@@ -102,7 +102,7 @@ } // namespace TEST(RendererSavePasswordProgressLoggerTest, SendLog) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; FakeContentPasswordManagerDriver fake_driver; mojom::PasswordManagerDriverPtr driver_ptr = fake_driver.CreateInterfacePtrAndBind();
diff --git a/components/autofill/core/browser/address_normalizer_impl_unittest.cc b/components/autofill/core/browser/address_normalizer_impl_unittest.cc index 37f0a97..df119d3 100644 --- a/components/autofill/core/browser/address_normalizer_impl_unittest.cc +++ b/components/autofill/core/browser/address_normalizer_impl_unittest.cc
@@ -94,7 +94,7 @@ ~AddressNormalizerTest() override {} void WaitForAddressValidatorInitialization() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } bool normalization_successful() const { return success_; } @@ -103,7 +103,7 @@ TestAddressNormalizer* normalizer() { return &normalizer_; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; bool AreRulesLoadedForRegion(const std::string& region_code) { return normalizer_.AreRulesLoadedForRegion(region_code); @@ -187,7 +187,7 @@ base::Unretained(this))); // Let the timeout execute. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Since the rules are never loaded and the timeout is 0, the callback should // get notified that the address could not be normalized. @@ -338,7 +338,7 @@ base::Unretained(this))); // Let the timeout execute. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Make sure the address was not normalized. EXPECT_FALSE(normalization_successful());
diff --git a/components/autofill/core/browser/autocomplete_history_manager_unittest.cc b/components/autofill/core/browser/autocomplete_history_manager_unittest.cc index d47ec4f7..f1f1ae4b 100644 --- a/components/autofill/core/browser/autocomplete_history_manager_unittest.cc +++ b/components/autofill/core/browser/autocomplete_history_manager_unittest.cc
@@ -150,7 +150,7 @@ date_last_used); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<MockWebDataService> web_data_service_; std::unique_ptr<AutocompleteHistoryManager> autocomplete_manager_; std::unique_ptr<PrefService> prefs_;
diff --git a/components/autofill/core/browser/autofill_assistant_unittest.cc b/components/autofill/core/browser/autofill_assistant_unittest.cc index 6c7d46e0..aa282652 100644 --- a/components/autofill/core/browser/autofill_assistant_unittest.cc +++ b/components/autofill/core/browser/autofill_assistant_unittest.cc
@@ -148,7 +148,7 @@ return static_cast<CardUnmaskDelegate*>(full_card_request); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestAutofillClient autofill_client_; testing::NiceMock<TestAutofillDriver> autofill_driver_; TestPersonalDataManager pdm_;
diff --git a/components/autofill/core/browser/autofill_download_manager_unittest.cc b/components/autofill/core/browser/autofill_download_manager_unittest.cc index 8e2de6b..7c7cd4be 100644 --- a/components/autofill/core/browser/autofill_download_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_download_manager_unittest.cc
@@ -251,7 +251,7 @@ }; ScopedActiveAutofillExperiments scoped_active_autofill_experiments; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::list<ResponseData> responses_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; network::TestURLLoaderFactory test_url_loader_factory_; @@ -1492,8 +1492,8 @@ return succeeded; } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; base::test::ScopedCommandLine scoped_command_line_; base::test::ScopedFeatureList scoped_feature_list_1_; base::test::ScopedFeatureList scoped_feature_list_2_;
diff --git a/components/autofill/core/browser/autofill_driver_factory_unittest.cc b/components/autofill/core/browser/autofill_driver_factory_unittest.cc index 7e11d2a..2819151 100644 --- a/components/autofill/core/browser/autofill_driver_factory_unittest.cc +++ b/components/autofill/core/browser/autofill_driver_factory_unittest.cc
@@ -100,7 +100,7 @@ protected: // For TestAutofillDriver. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; MockAutofillClient client_;
diff --git a/components/autofill/core/browser/autofill_external_delegate.cc b/components/autofill/core/browser/autofill_external_delegate.cc index 50d988b..60c4d7fe 100644 --- a/components/autofill/core/browser/autofill_external_delegate.cc +++ b/components/autofill/core/browser/autofill_external_delegate.cc
@@ -286,6 +286,10 @@ return driver_; } +int32_t AutofillExternalDelegate::GetWebContentsPopupControllerAxId() const { + return query_field_.form_control_ax_id; +} + void AutofillExternalDelegate::RegisterDeletionCallback( base::OnceClosure deletion_callback) { deletion_callback_ = std::move(deletion_callback); @@ -295,10 +299,6 @@ manager_->client()->HideAutofillPopup(); } -int32_t AutofillExternalDelegate::GetWebContentsPopupControllerAxId() const { - return query_field_.form_control_ax_id; -} - base::WeakPtr<AutofillExternalDelegate> AutofillExternalDelegate::GetWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); }
diff --git a/components/autofill/core/browser/autofill_external_delegate.h b/components/autofill/core/browser/autofill_external_delegate.h index aa6b69d..2e2b813 100644 --- a/components/autofill/core/browser/autofill_external_delegate.h +++ b/components/autofill/core/browser/autofill_external_delegate.h
@@ -53,10 +53,17 @@ base::string16* body) override; bool RemoveSuggestion(const base::string16& value, int identifier) override; void ClearPreviewedForm() override; + // Returns PopupType::kUnspecified for all popups prior to |onQuery|, or the // popup type after call to |onQuery|. PopupType GetPopupType() const override; + AutofillDriver* GetAutofillDriver() override; + + // Returns the ax node id associated with the current web contents' element + // who has a controller relation to the current autofill popup. + int32_t GetWebContentsPopupControllerAxId() const override; + void RegisterDeletionCallback(base::OnceClosure deletion_callback) override; // Records and associates a query_id with web form data. Called @@ -96,10 +103,6 @@ // values or settings. void Reset(); - // Returns the ax node id associated with the current web contents' element - // who has a controller relation to the current autofill popup. - int32_t GetWebContentsPopupControllerAxId() const; - const FormData& query_form() const { return query_form_; } protected:
diff --git a/components/autofill/core/browser/autofill_external_delegate_unittest.cc b/components/autofill/core/browser/autofill_external_delegate_unittest.cc index c9d6c18..fcd4054 100644 --- a/components/autofill/core/browser/autofill_external_delegate_unittest.cc +++ b/components/autofill/core/browser/autofill_external_delegate_unittest.cc
@@ -181,7 +181,7 @@ kQueryId, suggestions, /*autoselect_first_suggestion=*/false); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; testing::NiceMock<MockAutofillClient> autofill_client_; std::unique_ptr<testing::NiceMock<MockAutofillDriver>> autofill_driver_;
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc index e051f81..ce115a1 100644 --- a/components/autofill/core/browser/autofill_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -589,7 +589,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockAutofillClient autofill_client_; std::unique_ptr<MockAutofillDriver> autofill_driver_; std::unique_ptr<TestAutofillManager> autofill_manager_;
diff --git a/components/autofill/core/browser/autofill_merge_unittest.cc b/components/autofill/core/browser/autofill_merge_unittest.cc index 2427d94..07a797b 100644 --- a/components/autofill/core/browser/autofill_merge_unittest.cc +++ b/components/autofill/core/browser/autofill_merge_unittest.cc
@@ -183,7 +183,7 @@ // Deserializes |str| into a field type. ServerFieldType StringToFieldType(const std::string& str); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestAutofillClient autofill_client_; PersonalDataManagerMock personal_data_; std::unique_ptr<FormDataImporter> form_data_importer_;
diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc index e6419b9..b359afb7 100644 --- a/components/autofill/core/browser/autofill_metrics_unittest.cc +++ b/components/autofill/core/browser/autofill_metrics_unittest.cc
@@ -283,7 +283,7 @@ // Purge recorded UKM metrics for running more tests. void PurgeUKM(); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockAutofillClient autofill_client_; ukm::TestUkmRecorder* test_ukm_recorder_; syncer::TestSyncService sync_service_;
diff --git a/components/autofill/core/browser/autofill_profile_validator_unittest.cc b/components/autofill/core/browser/autofill_profile_validator_unittest.cc index e2cd547c..fca0dcb 100644 --- a/components/autofill/core/browser/autofill_profile_validator_unittest.cc +++ b/components/autofill/core/browser/autofill_profile_validator_unittest.cc
@@ -105,7 +105,7 @@ expected_validity_; private: - base::test::ScopedTaskEnvironment scoped_task_scheduler; + base::test::TaskEnvironment scoped_task_scheduler; DISALLOW_COPY_AND_ASSIGN(AutofillProfileValidatorTest); };
diff --git a/components/autofill/core/browser/field_filler_unittest.cc b/components/autofill/core/browser/field_filler_unittest.cc index fbdf18c..7b579c9 100644 --- a/components/autofill/core/browser/field_filler_unittest.cc +++ b/components/autofill/core/browser/field_filler_unittest.cc
@@ -758,14 +758,14 @@ std::unique_ptr<Storage>(new NullStorage), "en-US"); // Make sure the normalizer is done initializing its member(s) in // background task(s). - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } protected: AddressNormalizer* normalizer() { return normalizer_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<AddressNormalizerImpl> normalizer_; DISALLOW_COPY_AND_ASSIGN(AutofillSelectWithStatesTest);
diff --git a/components/autofill/core/browser/form_data_importer_unittest.cc b/components/autofill/core/browser/form_data_importer_unittest.cc index a672b8a..930ded1f 100644 --- a/components/autofill/core/browser/form_data_importer_unittest.cc +++ b/components/autofill/core/browser/form_data_importer_unittest.cc
@@ -223,8 +223,8 @@ run_loop.Run(); } - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; std::unique_ptr<PrefService> prefs_; scoped_refptr<AutofillWebDataService> autofill_database_service_; scoped_refptr<WebDatabaseService> web_database_;
diff --git a/components/autofill/core/browser/geo/subkey_requester_unittest.cc b/components/autofill/core/browser/geo/subkey_requester_unittest.cc index 4ae481a..92d1970 100644 --- a/components/autofill/core/browser/geo/subkey_requester_unittest.cc +++ b/components/autofill/core/browser/geo/subkey_requester_unittest.cc
@@ -102,7 +102,7 @@ ~SubKeyRequesterTest() override {} - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestSubKeyRequester> requester_; private: @@ -157,7 +157,7 @@ requester_->StartRegionSubKeysRequest(kLocale, kLanguage, 0, std::move(cb)); // Let the timeout execute. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Since the rules are never loaded and the timeout is 0, the delegate should // get notified that the subkeys could not be received.
diff --git a/components/autofill/core/browser/payments/autofill_wallet_data_type_controller_unittest.cc b/components/autofill/core/browser/payments/autofill_wallet_data_type_controller_unittest.cc index 1730dc5..32b617d7 100644 --- a/components/autofill/core/browser/payments/autofill_wallet_data_type_controller_unittest.cc +++ b/components/autofill/core/browser/payments/autofill_wallet_data_type_controller_unittest.cc
@@ -148,7 +148,7 @@ last_error_ = error; } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestingPrefServiceSimple prefs_; syncer::UserShare user_share_; testing::NiceMock<syncer::MockSyncService> sync_service_;
diff --git a/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc b/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc index b81573bd..f6925be 100644 --- a/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc +++ b/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc
@@ -141,10 +141,9 @@ class CreditCardAccessManagerTest : public testing::Test { public: CreditCardAccessManagerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) {} + : task_environment_( + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} void SetUp() override { autofill_client_.SetPrefs(test::PrefServiceForTesting()); @@ -283,11 +282,11 @@ credit_card_access_manager_->ready_to_start_authentication_.Signal(); } - void WaitForCallbacks() { scoped_task_environment_.RunUntilIdle(); } + void WaitForCallbacks() { task_environment_.RunUntilIdle(); } protected: std::unique_ptr<TestAccessor> accessor_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; payments::TestPaymentsClient* payments_client_; TestAutofillClient autofill_client_; std::unique_ptr<TestAutofillDriver> autofill_driver_;
diff --git a/components/autofill/core/browser/payments/credit_card_cvc_authenticator_unittest.cc b/components/autofill/core/browser/payments/credit_card_cvc_authenticator_unittest.cc index 0ff4083..66c0365 100644 --- a/components/autofill/core/browser/payments/credit_card_cvc_authenticator_unittest.cc +++ b/components/autofill/core/browser/payments/credit_card_cvc_authenticator_unittest.cc
@@ -151,7 +151,7 @@ protected: std::unique_ptr<TestAuthenticationRequester> requester_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestAutofillClient autofill_client_; std::unique_ptr<TestAutofillDriver> autofill_driver_; scoped_refptr<AutofillWebDataService> database_;
diff --git a/components/autofill/core/browser/payments/credit_card_fido_authenticator_unittest.cc b/components/autofill/core/browser/payments/credit_card_fido_authenticator_unittest.cc index 311a94f..a2d744a 100644 --- a/components/autofill/core/browser/payments/credit_card_fido_authenticator_unittest.cc +++ b/components/autofill/core/browser/payments/credit_card_fido_authenticator_unittest.cc
@@ -225,7 +225,7 @@ protected: std::unique_ptr<TestAuthenticationRequester> requester_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestAutofillClient autofill_client_; std::unique_ptr<TestAutofillDriver> autofill_driver_; scoped_refptr<AutofillWebDataService> database_;
diff --git a/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc b/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc index 9b3e87b..78fa295 100644 --- a/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc +++ b/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc
@@ -349,7 +349,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestAutofillClient autofill_client_; std::unique_ptr<TestAutofillDriver> autofill_driver_; std::unique_ptr<TestAutofillManager> autofill_manager_;
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 972146b7..abff621a 100644 --- a/components/autofill/core/browser/payments/full_card_request_unittest.cc +++ b/components/autofill/core/browser/payments/full_card_request_unittest.cc
@@ -107,7 +107,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; MockPersonalDataManager personal_data_; MockResultDelegate result_delegate_; MockUIDelegate ui_delegate_;
diff --git a/components/autofill/core/browser/payments/local_card_migration_manager_unittest.cc b/components/autofill/core/browser/payments/local_card_migration_manager_unittest.cc index 0b32e53..2e72102 100644 --- a/components/autofill/core/browser/payments/local_card_migration_manager_unittest.cc +++ b/components/autofill/core/browser/payments/local_card_migration_manager_unittest.cc
@@ -305,7 +305,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestAutofillClient autofill_client_; std::unique_ptr<TestAutofillDriver> autofill_driver_; std::unique_ptr<TestAutofillManager> autofill_manager_;
diff --git a/components/autofill/core/browser/payments/payments_client_unittest.cc b/components/autofill/core/browser/payments/payments_client_unittest.cc index be6d6b0..9527c121 100644 --- a/components/autofill/core/browser/payments/payments_client_unittest.cc +++ b/components/autofill/core/browser/payments/payments_client_unittest.cc
@@ -318,7 +318,7 @@ // A tip message to be displayed during local card migration. std::string display_text_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; TestPersonalDataManager test_personal_data_;
diff --git a/components/autofill/core/browser/payments/strike_database_integrator_test_strike_database_unittest.cc b/components/autofill/core/browser/payments/strike_database_integrator_test_strike_database_unittest.cc index 853d0a2..ebf93403 100644 --- a/components/autofill/core/browser/payments/strike_database_integrator_test_strike_database_unittest.cc +++ b/components/autofill/core/browser/payments/strike_database_integrator_test_strike_database_unittest.cc
@@ -43,12 +43,12 @@ // to a task runner, requires running the loop to complete. strike_database_.reset(); strike_database_service_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } protected: base::HistogramTester* GetHistogramTester() { return &histogram_tester_; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; std::unique_ptr<leveldb_proto::ProtoDatabaseProvider> db_provider_; std::unique_ptr<StrikeDatabase> strike_database_service_;
diff --git a/components/autofill/core/browser/payments/strike_database_unittest.cc b/components/autofill/core/browser/payments/strike_database_unittest.cc index f03e13c..a65a3cf 100644 --- a/components/autofill/core/browser/payments/strike_database_unittest.cc +++ b/components/autofill/core/browser/payments/strike_database_unittest.cc
@@ -129,7 +129,7 @@ protected: base::HistogramTester* GetHistogramTester() { return &histogram_tester_; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<leveldb_proto::ProtoDatabaseProvider> db_provider_; std::unique_ptr<TestStrikeDatabase> strike_database_; base::ScopedTempDir temp_dir_;
diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc index 1e20f7ba..94257dc 100644 --- a/components/autofill/core/browser/personal_data_manager_unittest.cc +++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
@@ -297,8 +297,8 @@ run_loop.Run(); } - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; std::unique_ptr<PrefService> prefs_; network::TestURLLoaderFactory test_url_loader_factory_; signin::IdentityTestEnvironment identity_test_env_;
diff --git a/components/autofill/core/browser/ui/autofill_popup_delegate.h b/components/autofill/core/browser/ui/autofill_popup_delegate.h index 923f96f7..c51ad87c 100644 --- a/components/autofill/core/browser/ui/autofill_popup_delegate.h +++ b/components/autofill/core/browser/ui/autofill_popup_delegate.h
@@ -56,6 +56,10 @@ // Returns the associated AutofillDriver. virtual AutofillDriver* GetAutofillDriver() = 0; + // Returns the ax node id associated with the current web contents' element + // who has a controller relation to the current autofill popup. + virtual int32_t GetWebContentsPopupControllerAxId() const = 0; + // Sets |deletion_callback| to be called from the delegate's destructor. // Useful for deleting objects which cannot be owned by the delegate but // should not outlive it.
diff --git a/components/autofill/core/browser/webdata/autocomplete_sync_bridge_unittest.cc b/components/autofill/core/browser/webdata/autocomplete_sync_bridge_unittest.cc index cb4168f85..76b0d2a 100644 --- a/components/autofill/core/browser/webdata/autocomplete_sync_bridge_unittest.cc +++ b/components/autofill/core/browser/webdata/autocomplete_sync_bridge_unittest.cc
@@ -293,7 +293,7 @@ private: ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; testing::NiceMock<MockAutofillWebDataBackend> backend_; AutofillTable table_; WebDatabase db_;
diff --git a/components/autofill/core/browser/webdata/autofill_profile_sync_bridge_unittest.cc b/components/autofill/core/browser/webdata/autofill_profile_sync_bridge_unittest.cc index fe32010..18b4248 100644 --- a/components/autofill/core/browser/webdata/autofill_profile_sync_bridge_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_profile_sync_bridge_unittest.cc
@@ -321,7 +321,7 @@ private: autofill::TestAutofillClock test_clock_; ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; testing::NiceMock<MockAutofillWebDataBackend> backend_; AutofillTable table_; WebDatabase db_;
diff --git a/components/autofill/core/browser/webdata/autofill_profile_sync_difference_tracker_unittest.cc b/components/autofill/core/browser/webdata/autofill_profile_sync_difference_tracker_unittest.cc index 799ff003..e7955e7 100644 --- a/components/autofill/core/browser/webdata/autofill_profile_sync_difference_tracker_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_profile_sync_difference_tracker_unittest.cc
@@ -107,7 +107,7 @@ private: autofill::TestAutofillClock test_clock_; base::ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; AutofillTable table_; WebDatabase db_;
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_metadata_sync_bridge_unittest.cc b/components/autofill/core/browser/webdata/autofill_wallet_metadata_sync_bridge_unittest.cc index 70da95f..98168b6 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_metadata_sync_bridge_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_metadata_sync_bridge_unittest.cc
@@ -452,7 +452,7 @@ int response_version = 0; autofill::TestAutofillClock test_clock_; ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; testing::NiceMock<MockAutofillWebDataBackend> backend_; AutofillTable table_; WebDatabase db_;
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_sync_bridge_unittest.cc b/components/autofill/core/browser/webdata/autofill_wallet_sync_bridge_unittest.cc index 19c63cf9..3836ca75 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_sync_bridge_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_sync_bridge_unittest.cc
@@ -336,7 +336,7 @@ private: autofill::TestAutofillClock test_clock_; ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NiceMock<MockAutofillWebDataBackend> backend_; AutofillTable table_; WebDatabase db_;
diff --git a/components/autofill/core/browser/webdata/web_data_service_unittest.cc b/components/autofill/core/browser/webdata/web_data_service_unittest.cc index 842588b..c54e023 100644 --- a/components/autofill/core/browser/webdata/web_data_service_unittest.cc +++ b/components/autofill/core/browser/webdata/web_data_service_unittest.cc
@@ -91,8 +91,7 @@ class WebDataServiceTest : public testing::Test { public: WebDataServiceTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} protected: void SetUp() override { @@ -119,10 +118,10 @@ wdbs_->ShutdownDatabase(); wds_ = nullptr; wdbs_ = nullptr; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::FilePath profile_dir_; scoped_refptr<AutofillWebDataService> wds_; scoped_refptr<WebDatabaseService> wdbs_; @@ -207,7 +206,7 @@ static const int limit = 10; handle = wds_->GetFormValuesForElementName( name1_, base::string16(), limit, &consumer); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle, consumer.handle()); ASSERT_EQ(1U, consumer.result().size()); EXPECT_EQ(value1_, consumer.result()[0].key().value()); @@ -284,7 +283,7 @@ AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>> consumer; WebDataServiceBase::Handle handle = wds_->GetAutofillProfiles(&consumer); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle, consumer.handle()); ASSERT_EQ(1U, consumer.result().size()); EXPECT_EQ(profile, *consumer.result()[0]); @@ -303,7 +302,7 @@ AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>> consumer; WebDataServiceBase::Handle handle = wds_->GetAutofillProfiles(&consumer); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle, consumer.handle()); ASSERT_EQ(1U, consumer.result().size()); EXPECT_EQ(profile, *consumer.result()[0]); @@ -322,7 +321,7 @@ AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>> consumer2; WebDataServiceBase::Handle handle2 = wds_->GetAutofillProfiles(&consumer2); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle2, consumer2.handle()); ASSERT_EQ(0U, consumer2.result().size()); } @@ -348,7 +347,7 @@ AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>> consumer; WebDataServiceBase::Handle handle = wds_->GetAutofillProfiles(&consumer); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle, consumer.handle()); ASSERT_EQ(2U, consumer.result().size()); EXPECT_EQ(profile2, *consumer.result()[0]); @@ -370,7 +369,7 @@ AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>> consumer2; WebDataServiceBase::Handle handle2 = wds_->GetAutofillProfiles(&consumer2); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle2, consumer2.handle()); ASSERT_EQ(2U, consumer2.result().size()); EXPECT_EQ(profile2_changed, *consumer2.result()[0]); @@ -386,7 +385,7 @@ AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>> consumer; WebDataServiceBase::Handle handle = wds_->GetCreditCards(&consumer); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle, consumer.handle()); ASSERT_EQ(1U, consumer.result().size()); EXPECT_EQ(card, *consumer.result()[0]); @@ -402,7 +401,7 @@ AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>> consumer; WebDataServiceBase::Handle handle = wds_->GetCreditCards(&consumer); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle, consumer.handle()); ASSERT_EQ(1U, consumer.result().size()); EXPECT_EQ(credit_card, *consumer.result()[0]); @@ -414,7 +413,7 @@ AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>> consumer2; WebDataServiceBase::Handle handle2 = wds_->GetCreditCards(&consumer2); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle2, consumer2.handle()); ASSERT_EQ(0U, consumer2.result().size()); } @@ -432,7 +431,7 @@ AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>> consumer; WebDataServiceBase::Handle handle = wds_->GetCreditCards(&consumer); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle, consumer.handle()); ASSERT_EQ(2U, consumer.result().size()); EXPECT_EQ(card2, *consumer.result()[0]); @@ -447,7 +446,7 @@ AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>> consumer2; WebDataServiceBase::Handle handle2 = wds_->GetCreditCards(&consumer2); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle2, consumer2.handle()); ASSERT_EQ(2U, consumer2.result().size()); EXPECT_NE(card2, *consumer2.result()[0]); @@ -468,7 +467,7 @@ profile_consumer; WebDataServiceBase::Handle handle = wds_->GetAutofillProfiles(&profile_consumer); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle, profile_consumer.handle()); ASSERT_EQ(1U, profile_consumer.result().size()); EXPECT_EQ(profile, *profile_consumer.result()[0]); @@ -481,7 +480,7 @@ AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>> card_consumer; handle = wds_->GetCreditCards(&card_consumer); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle, card_consumer.handle()); ASSERT_EQ(1U, card_consumer.result().size()); EXPECT_EQ(credit_card, *card_consumer.result()[0]); @@ -501,7 +500,7 @@ profile_consumer2; WebDataServiceBase::Handle handle2 = wds_->GetAutofillProfiles(&profile_consumer2); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle2, profile_consumer2.handle()); ASSERT_EQ(0U, profile_consumer2.result().size()); @@ -509,7 +508,7 @@ AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>> card_consumer2; handle2 = wds_->GetCreditCards(&card_consumer2); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(handle2, card_consumer2.handle()); ASSERT_EQ(0U, card_consumer2.result().size()); }
diff --git a/components/autofill/core/common/mojom/autofill_types_mojom_traits_unittest.cc b/components/autofill/core/common/mojom/autofill_types_mojom_traits_unittest.cc index 7dec3980..827be95 100644 --- a/components/autofill/core/common/mojom/autofill_types_mojom_traits_unittest.cc +++ b/components/autofill/core/common/mojom/autofill_types_mojom_traits_unittest.cc
@@ -254,7 +254,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; mojo::BindingSet<TypeTraitsTest> bindings_; };
diff --git a/components/autofill_assistant/browser/actions/configure_bottom_sheet_action_unittest.cc b/components/autofill_assistant/browser/actions/configure_bottom_sheet_action_unittest.cc index d33e409..52821b56 100644 --- a/components/autofill_assistant/browser/actions/configure_bottom_sheet_action_unittest.cc +++ b/components/autofill_assistant/browser/actions/configure_bottom_sheet_action_unittest.cc
@@ -29,7 +29,7 @@ class ConfigureBottomSheetActionTest : public testing::Test { public: ConfigureBottomSheetActionTest() - : task_env_(base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_env_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void SetUp() override { ON_CALL(mock_action_delegate_, GetViewportMode()) @@ -84,7 +84,7 @@ // task_env_ must be first to guarantee other field // creation run in that environment. - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; MockActionDelegate mock_action_delegate_; MockWebController mock_web_controller_;
diff --git a/components/autofill_assistant/browser/actions/prompt_action_unittest.cc b/components/autofill_assistant/browser/actions/prompt_action_unittest.cc index 1e7d19b..f46eede 100644 --- a/components/autofill_assistant/browser/actions/prompt_action_unittest.cc +++ b/components/autofill_assistant/browser/actions/prompt_action_unittest.cc
@@ -33,7 +33,7 @@ class PromptActionTest : public testing::Test { public: PromptActionTest() - : task_env_(base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_env_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void SetUp() override { ON_CALL(mock_web_controller_, OnElementCheck(_, _)) @@ -56,7 +56,7 @@ protected: // task_env_ must be first to guarantee other field // creation run in that environment. - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; MockActionDelegate mock_action_delegate_; MockWebController mock_web_controller_;
diff --git a/components/autofill_assistant/browser/actions/wait_for_document_action_unittest.cc b/components/autofill_assistant/browser/actions/wait_for_document_action_unittest.cc index 467e36c..65e3ff7 100644 --- a/components/autofill_assistant/browser/actions/wait_for_document_action_unittest.cc +++ b/components/autofill_assistant/browser/actions/wait_for_document_action_unittest.cc
@@ -33,7 +33,7 @@ class WaitForDocumentActionTest : public testing::Test { public: WaitForDocumentActionTest() - : task_env_(base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_env_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void SetUp() override { ON_CALL(mock_action_delegate_, OnWaitForDocumentReadyState(_, _, _)) @@ -61,7 +61,7 @@ protected: // task_env_ must be first to guarantee other field // creation run in that environment. - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; MockActionDelegate mock_action_delegate_; WaitForDocumentProto proto_;
diff --git a/components/autofill_assistant/browser/controller_unittest.cc b/components/autofill_assistant/browser/controller_unittest.cc index fbedd27b..96c70d98 100644 --- a/components/autofill_assistant/browser/controller_unittest.cc +++ b/components/autofill_assistant/browser/controller_unittest.cc
@@ -76,8 +76,8 @@ public: ControllerTest() : RenderViewHostTestHarness( - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~ControllerTest() override {} void SetUp() override {
diff --git a/components/autofill_assistant/browser/element_area_unittest.cc b/components/autofill_assistant/browser/element_area_unittest.cc index b271af9..e25fcf3 100644 --- a/components/autofill_assistant/browser/element_area_unittest.cc +++ b/components/autofill_assistant/browser/element_area_unittest.cc
@@ -68,8 +68,7 @@ class ElementAreaTest : public testing::Test { protected: ElementAreaTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), element_area_(&delegate_) { delegate_.SetWebController(&mock_web_controller_); delegate_.GetMutableSettings()->element_position_update_interval = @@ -104,9 +103,9 @@ reported_restricted_area_ = restricted_area; } - // scoped_task_environment_ must be first to guarantee other field + // task_environment_ must be first to guarantee other field // creation run in that environment. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockWebController mock_web_controller_; FakeScriptExecutorDelegate delegate_; @@ -382,8 +381,7 @@ EXPECT_THAT(reported_area_, ElementsAre(MatchingRectF(0, 25, 100, 50))); - scoped_task_environment_.FastForwardBy( - base::TimeDelta::FromMilliseconds(100)); + task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(100)); // Updated area is available std::vector<RectF> rectangles;
diff --git a/components/autofill_assistant/browser/retry_timer_unittest.cc b/components/autofill_assistant/browser/retry_timer_unittest.cc index e467d15..9499104 100644 --- a/components/autofill_assistant/browser/retry_timer_unittest.cc +++ b/components/autofill_assistant/browser/retry_timer_unittest.cc
@@ -23,11 +23,10 @@ class RetryTimerTest : public testing::Test { protected: RetryTimerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void FastForwardOneSecond() { - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); } base::RepeatingCallback<void(base::OnceCallback<void(bool)>)> @@ -65,9 +64,9 @@ captured_callback_ = std::move(callback); } - // scoped_task_environment_ must be first to guarantee other field + // task_environment_ must be first to guarantee other field // creation run in that environment. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; int try_count_ = 0; base::OnceCallback<void(bool)> captured_callback_;
diff --git a/components/autofill_assistant/browser/script_executor_unittest.cc b/components/autofill_assistant/browser/script_executor_unittest.cc index 1a791ae..cd6d17a 100644 --- a/components/autofill_assistant/browser/script_executor_unittest.cc +++ b/components/autofill_assistant/browser/script_executor_unittest.cc
@@ -76,8 +76,7 @@ protected: ScriptExecutorTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} // Implements ScriptExecutor::Listener void OnServerPayloadChanged(const std::string& global_payload, @@ -145,9 +144,9 @@ interrupts_.emplace_back(std::move(interrupt)); } - // scoped_task_environment_ must be first to guarantee other field + // task_environment_ must be first to guarantee other field // creation run in that environment. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeScriptExecutorDelegate delegate_; Script script_; StrictMock<MockService> mock_service_; @@ -364,14 +363,13 @@ // executor_callback_.Run() not expected to be run just yet, as the action is // delayed. executor_->Run(executor_callback_.Get()); - EXPECT_TRUE(scoped_task_environment_.NextTaskIsDelayed()); + EXPECT_TRUE(task_environment_.NextTaskIsDelayed()); // Moving forward in time triggers action execution. EXPECT_CALL(executor_callback_, Run(Field(&ScriptExecutor::Result::success, true))); - scoped_task_environment_.FastForwardBy( - base::TimeDelta::FromMilliseconds(1000)); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(1000)); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } TEST_F(ScriptExecutorTest, ClearDetailsWhenFinished) { @@ -533,7 +531,7 @@ OnElementCheck(Eq(Selector({"element"})), _)) .WillRepeatedly(RunOnceCallback<1>(true)); EXPECT_CALL(executor_callback_, Run(_)); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); ASSERT_EQ(1u, processed_actions_capture.size()); EXPECT_EQ(ACTION_APPLIED, processed_actions_capture[0].status()); @@ -562,7 +560,7 @@ OnElementCheck(Eq(Selector({"element"})), _)) .WillRepeatedly(RunOnceCallback<1>(false)); EXPECT_CALL(executor_callback_, Run(_)); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); ASSERT_EQ(1u, processed_actions_capture.size()); EXPECT_EQ(ACTION_APPLIED, processed_actions_capture[0].status()); @@ -1012,7 +1010,7 @@ // timeout. delegate_.UpdateNavigationState(/* navigating= */ true, /* error= */ false); for (int i = 0; i < 5; i++) { - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); } // The end of navigation un-pauses WaitForDom. @@ -1166,7 +1164,7 @@ EXPECT_CALL(mock_web_controller_, OnElementCheck(Eq(Selector({"element"})), _)) .WillOnce(RunOnceCallback<1>(true)); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); ASSERT_THAT(processed_actions_capture, SizeIs(1)); EXPECT_EQ(ACTION_APPLIED, processed_actions_capture[0].status());
diff --git a/components/background_task_scheduler/README.md b/components/background_task_scheduler/README.md index 160441f..652b713 100644 --- a/components/background_task_scheduler/README.md +++ b/components/background_task_scheduler/README.md
@@ -62,13 +62,6 @@ A task must also have a unique ID, and it must be listed in `TaskIds` to ensure there is no overlap between different tasks. -The connection between `TaskIds` and the corresponding `BackgroundTask` classes is done by injecting -a `BackgroundTaskFactory` class in `BackgroundTaskSchedulerFactory`. For the //chrome embedder -(which is the only one needing the association), the `ChromeBackgroundTaskFactory` [implementation] -(https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chrome/browser -/background_task_scheduler/ChromeBackgroundTaskFactory.java) was created. Anyone that adds a new -task id to `TaskIds` should add a case in this class to. - ## How to schedule a task A task is scheduled by creating an object containing information about the task, @@ -80,29 +73,21 @@ tasks are only executed once, whereas periodic tasks are executed once per a defined interval. -There are two steps in the process of creating a TaskInfo: - - 1. the specific timing info is created; there are two objects available - `OneOffInfo` and - `PeriodicInfo`; each one of these objects has its own builder; - 2. the task info is created using the `createTask` method; other parameters can be set afterwards. - As an example for how to create a one-off task that executes in 200 minutes, you can do the following: ```java -TaskInfo.TimingInfo oneOffInfo = TaskInfo.OneOffInfo.create() - .setWindowEndTimeMs(TimeUnit.MINUTES.toMillis(200)).build(); -TaskInfo taskInfo = TaskInfo.createTask(TaskIds.YOUR_FEATURE, - oneOffInfo).build(); +TaskInfo.createOneOffTask(TaskIds.YOUR_FEATURE, + MyBackgroundTask.class, + TimeUnit.MINUTES.toMillis(200)).build(); ``` For a periodic task that executes every 200 minutes, you can call: ```java -TaskInfo.TimingInfo periodicInfo = TaskInfo.PeriodicInfo.create() - .setIntervalMs(TimeUnit.MINUTES.toMillis(200)).build(); -TaskInfo taskInfo = TaskInfo.createTask(TaskIds.YOUR_FEATURE, - periodicInfo).build(); +TaskInfo.createPeriodicTask(TaskIds.YOUR_FEATURE, + MyBackgroundTask.class, + TimeUnit.MINUTES.toMillis(200)).build(); ``` Typically you will also set other required parameters such as what type of @@ -110,11 +95,12 @@ be charging. They can be set on the builder like this: ```java -TaskInfo.TimingInfo oneOffInfo = TaskInfo.OneOffInfo.create() - .setWindowStartTimeMs(TimeUnit.MINUTES.toMillis(100)) - .setWindowEndTimeMs(TimeUnit.MINUTES.toMillis(200)).build(); -TaskInfo taskInfo = TaskInfo.createTask(TaskIds.YOUR_FEATURE, - oneOffInfo) +TaskInfo.createOneOffTask(TaskIds.YOUR_FEATURE, + MyBackgroundTask.class, + /* windowStartTimeMs= */ + TimeUnit.MINUTES.toMillis(100) + /* windowEndTimeMs= */ + TimeUnit.MINUTES.toMillis(200)) .setRequiresCharging(true) .setRequiredNetworkType( TaskInfo.NETWORK_TYPE_UNMETERED) @@ -151,11 +137,10 @@ myBundle.putString("foo", "bar"); myBundle.putLong("number", 1337L); -TaskInfo.TimingInfo oneOffInfo = TaskInfo.OneOffInfo.create() - .setWindowStartTimeMs(TimeUnit.MINUTES.toMillis(100)) - .setWindowEndTimeMs(TimeUnit.MINUTES.toMillis(200)).build(); -TaskInfo taskInfo = TaskInfo.createTask(TaskIds.YOUR_FEATURE, - oneOffInfo) +TaskInfo.createOneOffTask(TaskIds.YOUR_FEATURE, + MyBackgroundTask.class, + TimeUnit.MINUTES.toMillis(100) + TimeUnit.MINUTES.toMillis(200)) .setExtras(myBundle) .build(); ``` @@ -174,29 +159,6 @@ } ``` -## Performing actions over TimingInfo objects - -To perform actions over the `TimingInfo` objects, based on their implementation, the Visitor design -pattern was used. A public interface is exposed for this: `TimingInfoVisitor`. To use this -interface, someone should create a class that would look like this: - -```java -class ImplementedActionVisitor implements TaskInfo.TimingInfoVisitor { - @Override - public void visit(TaskInfo.OneOffInfo oneOffInfo) { ... } - - @Override - public void visit(TaskInfo.PeriodicInfo periodicInfo) { ... } -} -``` - -To use this visitor, someone would make the following calls: - -```java -ImplementedActionVisitor visitor = new ImplementedActionVisitor(); -myTimingInfo.accept(visitor); -``` - ## Loading Native parts Some of the tasks running in the background require native parts of the browser
diff --git a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerGcmNetworkManager.java b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerGcmNetworkManager.java index f4b23c5c..36fb2e9 100644 --- a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerGcmNetworkManager.java +++ b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerGcmNetworkManager.java
@@ -84,13 +84,20 @@ @VisibleForTesting static Task createTaskFromTaskInfo(@NonNull TaskInfo taskInfo) { Bundle taskExtras = new Bundle(); + if (!taskInfo.isPeriodic() && taskInfo.getOneOffInfo().expiresAfterWindowEndTime()) { + taskExtras.putLong(BACKGROUND_TASK_DEADLINE_KEY, getDeadlineTime(taskInfo)); + } taskExtras.putBundle(BACKGROUND_TASK_EXTRAS_KEY, taskInfo.getExtras()); - TaskBuilderVisitor taskBuilderVisitor = new TaskBuilderVisitor(taskExtras); - taskInfo.getTimingInfo().accept(taskBuilderVisitor); - Task.Builder builder = taskBuilderVisitor.getBuilder(); + Task.Builder builder; + if (taskInfo.isPeriodic()) { + builder = getPeriodicTaskBuilder(taskInfo.getPeriodicInfo()); + } else { + builder = getOneOffTaskBuilder(taskInfo.getOneOffInfo()); + } - builder.setPersisted(taskInfo.isPersisted()) + builder.setExtras(taskExtras) + .setPersisted(taskInfo.isPersisted()) .setRequiredNetwork(getGcmNetworkManagerNetworkTypeFromTypeFromTaskNetworkType( taskInfo.getRequiredNetworkType())) .setRequiresCharging(taskInfo.requiresCharging()) @@ -101,49 +108,27 @@ return builder.build(); } - private static class TaskBuilderVisitor implements TaskInfo.TimingInfoVisitor { - private Task.Builder mBuilder; - private final Bundle mTaskExtras; - - TaskBuilderVisitor(Bundle taskExtras) { - mTaskExtras = taskExtras; + private static Task.Builder getPeriodicTaskBuilder(TaskInfo.PeriodicInfo periodicInfo) { + PeriodicTask.Builder builder = new PeriodicTask.Builder(); + builder.setPeriod(TimeUnit.MILLISECONDS.toSeconds(periodicInfo.getIntervalMs())); + if (periodicInfo.hasFlex()) { + builder.setFlex(TimeUnit.MILLISECONDS.toSeconds(periodicInfo.getFlexMs())); } + return builder; + } - // Only valid after a TimingInfo object was visited. - Task.Builder getBuilder() { - return mBuilder; + private static Task.Builder getOneOffTaskBuilder(TaskInfo.OneOffInfo oneOffInfo) { + OneoffTask.Builder builder = new OneoffTask.Builder(); + long windowStartSeconds = oneOffInfo.hasWindowStartTimeConstraint() + ? TimeUnit.MILLISECONDS.toSeconds(oneOffInfo.getWindowStartTimeMs()) + : 0; + long windowEndTimeMs = oneOffInfo.getWindowEndTimeMs(); + if (oneOffInfo.expiresAfterWindowEndTime()) { + windowEndTimeMs += DEADLINE_DELTA_MS; } - - @Override - public void visit(TaskInfo.OneOffInfo oneOffInfo) { - if (oneOffInfo.expiresAfterWindowEndTime()) { - mTaskExtras.putLong(BACKGROUND_TASK_DEADLINE_KEY, - sClock.currentTimeMillis() + oneOffInfo.getWindowEndTimeMs()); - } - - OneoffTask.Builder builder = new OneoffTask.Builder(); - long windowStartSeconds = oneOffInfo.hasWindowStartTimeConstraint() - ? TimeUnit.MILLISECONDS.toSeconds(oneOffInfo.getWindowStartTimeMs()) - : 0; - long windowEndTimeMs = oneOffInfo.getWindowEndTimeMs(); - if (oneOffInfo.expiresAfterWindowEndTime()) { - windowEndTimeMs += DEADLINE_DELTA_MS; - } - builder.setExecutionWindow( - windowStartSeconds, TimeUnit.MILLISECONDS.toSeconds(windowEndTimeMs)); - builder.setExtras(mTaskExtras); - mBuilder = builder; - } - - @Override - public void visit(TaskInfo.PeriodicInfo periodicInfo) { - PeriodicTask.Builder builder = new PeriodicTask.Builder(); - builder.setPeriod(TimeUnit.MILLISECONDS.toSeconds(periodicInfo.getIntervalMs())); - if (periodicInfo.hasFlex()) { - builder.setFlex(TimeUnit.MILLISECONDS.toSeconds(periodicInfo.getFlexMs())); - } - mBuilder = builder; - } + builder.setExecutionWindow( + windowStartSeconds, TimeUnit.MILLISECONDS.toSeconds(windowEndTimeMs)); + return builder; } private static int getGcmNetworkManagerNetworkTypeFromTypeFromTaskNetworkType(
diff --git a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerImpl.java b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerImpl.java index 74454ba..3c81477 100644 --- a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerImpl.java +++ b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerImpl.java
@@ -46,12 +46,10 @@ boolean success = mSchedulerDelegate.schedule(context, taskInfo); BackgroundTaskSchedulerUma.getInstance().reportTaskScheduled( taskInfo.getTaskId(), success); - - // Retain expiration metrics - ExpirationMetricsVisitor expirationMetricsVisitor = - new ExpirationMetricsVisitor(taskInfo.getTaskId()); - taskInfo.getTimingInfo().accept(expirationMetricsVisitor); - + if (!taskInfo.isPeriodic()) { + BackgroundTaskSchedulerUma.getInstance().reportTaskCreatedAndExpirationState( + taskInfo.getTaskId(), taskInfo.getOneOffInfo().expiresAfterWindowEndTime()); + } if (success) { BackgroundTaskSchedulerPrefs.addScheduledTask(taskInfo); } @@ -59,26 +57,6 @@ } } - private class ExpirationMetricsVisitor implements TaskInfo.TimingInfoVisitor { - private final int mTaskId; - - ExpirationMetricsVisitor(int taskId) { - mTaskId = taskId; - } - - @Override - public void visit(TaskInfo.OneOffInfo oneOffInfo) { - BackgroundTaskSchedulerUma.getInstance().reportTaskCreatedAndExpirationState( - mTaskId, oneOffInfo.expiresAfterWindowEndTime()); - } - - @Override - public void visit(TaskInfo.PeriodicInfo periodicInfo) { - BackgroundTaskSchedulerUma.getInstance().reportTaskCreatedAndExpirationState( - mTaskId, periodicInfo.expiresAfterWindowEndTime()); - } - } - @Override public void cancel(Context context, int taskId) { try (TraceEvent te = TraceEvent.scoped(
diff --git a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerJobService.java b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerJobService.java index 31e59d3..af6b9ef 100644 --- a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerJobService.java +++ b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerJobService.java
@@ -48,6 +48,11 @@ return extras.getLong(BACKGROUND_TASK_DEADLINE_KEY); } + private static long getDeadlineTime(TaskInfo taskInfo) { + long windowEndTimeMs = taskInfo.getOneOffInfo().getWindowEndTimeMs(); + return sClock.currentTimeMillis() + windowEndTimeMs; + } + /** * Retrieves the {@link TaskParameters} from the {@link JobParameters}, which are passed as * one of the keys. Only values valid for {@link android.os.BaseBundle} are supported, and other @@ -74,6 +79,10 @@ static JobInfo createJobInfoFromTaskInfo(Context context, TaskInfo taskInfo) { PersistableBundle jobExtras = new PersistableBundle(); + if (!taskInfo.isPeriodic() && taskInfo.getOneOffInfo().expiresAfterWindowEndTime()) { + jobExtras.putLong(BACKGROUND_TASK_DEADLINE_KEY, getDeadlineTime(taskInfo)); + } + PersistableBundle persistableBundle = getTaskExtrasAsPersistableBundle(taskInfo); jobExtras.putPersistableBundle(BACKGROUND_TASK_EXTRAS_KEY, persistableBundle); @@ -81,60 +90,42 @@ new JobInfo .Builder(taskInfo.getTaskId(), new ComponentName(context, BackgroundTaskJobService.class)) + .setExtras(jobExtras) .setPersisted(taskInfo.isPersisted()) .setRequiresCharging(taskInfo.requiresCharging()) .setRequiredNetworkType(getJobInfoNetworkTypeFromTaskNetworkType( taskInfo.getRequiredNetworkType())); - JobInfoBuilderVisitor jobInfoBuilderVisitor = new JobInfoBuilderVisitor(builder, jobExtras); - taskInfo.getTimingInfo().accept(jobInfoBuilderVisitor); - builder = jobInfoBuilderVisitor.getBuilder(); + if (taskInfo.isPeriodic()) { + builder = getPeriodicJobInfo(builder, taskInfo); + } else { + builder = getOneOffJobInfo(builder, taskInfo); + } return builder.build(); } - private static class JobInfoBuilderVisitor implements TaskInfo.TimingInfoVisitor { - private final JobInfo.Builder mBuilder; - private final PersistableBundle mJobExtras; - - JobInfoBuilderVisitor(JobInfo.Builder builder, PersistableBundle jobExtras) { - mBuilder = builder; - mJobExtras = jobExtras; + private static JobInfo.Builder getOneOffJobInfo(JobInfo.Builder builder, TaskInfo taskInfo) { + TaskInfo.OneOffInfo oneOffInfo = taskInfo.getOneOffInfo(); + if (oneOffInfo.hasWindowStartTimeConstraint()) { + builder = builder.setMinimumLatency(oneOffInfo.getWindowStartTimeMs()); } - - // Only valid after a TimingInfo object was visited. - JobInfo.Builder getBuilder() { - return mBuilder; + long windowEndTimeMs = oneOffInfo.getWindowEndTimeMs(); + if (oneOffInfo.expiresAfterWindowEndTime()) { + windowEndTimeMs += DEADLINE_DELTA_MS; } + return builder.setOverrideDeadline(windowEndTimeMs); + } - @Override - public void visit(TaskInfo.OneOffInfo oneOffInfo) { - if (oneOffInfo.expiresAfterWindowEndTime()) { - mJobExtras.putLong(BACKGROUND_TASK_DEADLINE_KEY, - sClock.currentTimeMillis() + oneOffInfo.getWindowEndTimeMs()); + private static JobInfo.Builder getPeriodicJobInfo(JobInfo.Builder builder, TaskInfo taskInfo) { + TaskInfo.PeriodicInfo periodicInfo = taskInfo.getPeriodicInfo(); + if (periodicInfo.hasFlex()) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + return builder.setPeriodic(periodicInfo.getIntervalMs(), periodicInfo.getFlexMs()); } - mBuilder.setExtras(mJobExtras); - - if (oneOffInfo.hasWindowStartTimeConstraint()) { - mBuilder.setMinimumLatency(oneOffInfo.getWindowStartTimeMs()); - } - long windowEndTimeMs = oneOffInfo.getWindowEndTimeMs(); - if (oneOffInfo.expiresAfterWindowEndTime()) { - windowEndTimeMs += DEADLINE_DELTA_MS; - } - mBuilder.setOverrideDeadline(windowEndTimeMs); + return builder.setPeriodic(periodicInfo.getIntervalMs()); } - - @Override - public void visit(TaskInfo.PeriodicInfo periodicInfo) { - mBuilder.setExtras(mJobExtras); - - if (periodicInfo.hasFlex() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - mBuilder.setPeriodic(periodicInfo.getIntervalMs(), periodicInfo.getFlexMs()); - return; - } - mBuilder.setPeriodic(periodicInfo.getIntervalMs()); - } + return builder.setPeriodic(periodicInfo.getIntervalMs()); } private static int getJobInfoNetworkTypeFromTaskNetworkType(
diff --git a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/TaskInfo.java b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/TaskInfo.java index d08f7b2f..5126237 100644 --- a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/TaskInfo.java +++ b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/TaskInfo.java
@@ -9,8 +9,6 @@ import android.support.annotation.IntDef; import android.support.annotation.NonNull; -import org.chromium.base.Log; - import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -19,56 +17,22 @@ * parameters, such as whether a special type of network is available. */ public class TaskInfo { - private static final String TAG = "BkgrdTaskInfo"; - - /** - * Common interface for all types of task information. - */ - public interface TimingInfo { - /** - * Receives a {@link TimingInfoVisitor}, which will perform actions on this object. - * @param visitor object that will perform actions on this instance. - */ - void accept(TimingInfoVisitor visitor); - } - - /** - * Common interface for actions over TimingInfo implementations. - * - * This implements the Visitor design pattern over {@link TimingInfo} objects. - * For a guide on how to use it, see the `Performing actions over TimingInfo objects` section - * in //components/background_task_scheduler/README.md. - */ - public interface TimingInfoVisitor { - /** - * Applies actions on a given {@link OneOffInfo}. This affects information regarding - * timing for a one-off task. - * @param oneOffInfo object to act on. - */ - void visit(OneOffInfo oneOffInfo); - /** - * Applies actions on a given {@link PeriodicInfo}. This affects information regarding - * timing for a periodic task. - * @param periodicInfo object to act on. - */ - void visit(PeriodicInfo periodicInfo); - } - /** * Specifies information regarding one-off tasks. - * This is part of a {@link TaskInfo} if the task is NOT a periodic task. + * This is part of a {@link TaskInfo} iff the task is NOT a periodic task. */ - public static class OneOffInfo implements TimingInfo { + public static class OneOffInfo { private final long mWindowStartTimeMs; private final long mWindowEndTimeMs; private final boolean mHasWindowStartTimeConstraint; private final boolean mExpiresAfterWindowEndTime; - private OneOffInfo(Builder builder) { - mWindowStartTimeMs = builder.mWindowStartTimeMs; - mWindowEndTimeMs = builder.mWindowEndTimeMs; - mHasWindowStartTimeConstraint = builder.mHasWindowStartTimeConstraint; - mExpiresAfterWindowEndTime = builder.mExpiresAfterWindowEndTime; + private OneOffInfo(long windowStartTimeMs, long windowEndTimeMs, + boolean hasWindowStartTimeConstraint, boolean expiresAfterWindowEndTime) { + mWindowStartTimeMs = windowStartTimeMs; + mWindowEndTimeMs = windowEndTimeMs; + mHasWindowStartTimeConstraint = hasWindowStartTimeConstraint; + mExpiresAfterWindowEndTime = expiresAfterWindowEndTime; } /** @@ -103,11 +67,6 @@ } @Override - public void accept(TimingInfoVisitor visitor) { - visitor.visit(this); - } - - @Override public String toString() { StringBuilder sb = new StringBuilder("{"); if (hasWindowStartTimeConstraint()) { @@ -118,70 +77,24 @@ sb.append("}"); return sb.toString(); } - - /** - * @return a new {@link Builder} object to set the values of the one-off task. - */ - public static Builder create() { - return new Builder(); - } - - /** - * A helper builder to provide a way to build {@link OneOffInfo}. - * - * @see #create() - */ - public static final class Builder { - private long mWindowStartTimeMs; - private long mWindowEndTimeMs; - // By default, a {@link OneOffInfo} doesn't have a set start time. The start time is - // considered the time of scheduling the task. - private boolean mHasWindowStartTimeConstraint; - // By default, a {@link OneOffInfo} doesn't have the expiration feature activated. - private boolean mExpiresAfterWindowEndTime; - - public Builder setWindowStartTimeMs(long windowStartTimeMs) { - mWindowStartTimeMs = windowStartTimeMs; - mHasWindowStartTimeConstraint = true; - return this; - } - - public Builder setWindowEndTimeMs(long windowEndTimeMs) { - mWindowEndTimeMs = windowEndTimeMs; - return this; - } - - public Builder setExpiresAfterWindowEndTime(boolean expiresAfterWindowEndTime) { - mExpiresAfterWindowEndTime = expiresAfterWindowEndTime; - return this; - } - - /** - * Build the {@link OneOffInfo object} specified by this builder. - * - * @return the {@link OneOffInfo} object. - */ - public OneOffInfo build() { - return new OneOffInfo(this); - } - } } /** * Specifies information regarding periodic tasks. - * This is part of a {@link TaskInfo} if the task is a periodic task. + * This is part of a {@link TaskInfo} iff the task is a periodic task. */ - public static class PeriodicInfo implements TimingInfo { + public static class PeriodicInfo { private final long mIntervalMs; private final long mFlexMs; private final boolean mHasFlex; private final boolean mExpiresAfterWindowEndTime; - private PeriodicInfo(PeriodicInfo.Builder builder) { - mIntervalMs = builder.mIntervalMs; - mFlexMs = builder.mFlexMs; - mHasFlex = builder.mHasFlex; - mExpiresAfterWindowEndTime = builder.mExpiresAfterWindowEndTime; + private PeriodicInfo( + long intervalMs, long flexMs, boolean hasFlex, boolean expiresAfterWindowEndTime) { + mIntervalMs = intervalMs; + mFlexMs = flexMs; + mHasFlex = hasFlex; + mExpiresAfterWindowEndTime = expiresAfterWindowEndTime; } /** @@ -216,11 +129,6 @@ } @Override - public void accept(TimingInfoVisitor visitor) { - visitor.visit(this); - } - - @Override public String toString() { StringBuilder sb = new StringBuilder("{"); sb.append("intervalMs: ").append(mIntervalMs).append(", "); @@ -231,52 +139,6 @@ sb.append("}"); return sb.toString(); } - - /** - * @return a new {@link OneOffInfo.Builder} object to set the values of the one-off task. - */ - public static PeriodicInfo.Builder create() { - return new PeriodicInfo.Builder(); - } - - /** - * A helper builder to provide a way to build {@link OneOffInfo}. - * - * @see #create() - */ - public static final class Builder { - private long mIntervalMs; - private long mFlexMs; - // By default, a {@link PeriodicInfo} doesn't have a specified flex and the default - // one will be used in the scheduler. - private boolean mHasFlex; - // By default, a {@link PeriodicInfo} doesn't have the expiration feature activated. - private boolean mExpiresAfterWindowEndTime; - - public Builder setIntervalMs(long intervalMs) { - mIntervalMs = intervalMs; - return this; - } - - public Builder setFlexMs(long flexMs) { - mFlexMs = flexMs; - mHasFlex = true; - return this; - } - - public Builder setExpiresAfterWindowEndTime(boolean expiresAfterWindowEndTime) { - mExpiresAfterWindowEndTime = expiresAfterWindowEndTime; - return this; - } - /** - * Build the {@link PeriodicInfo object} specified by this builder. - * - * @return the {@link PeriodicInfo} object. - */ - public PeriodicInfo build() { - return new PeriodicInfo(this); - } - } } @IntDef({NetworkType.NONE, NetworkType.ANY, NetworkType.UNMETERED}) @@ -309,6 +171,12 @@ private final int mTaskId; /** + * The {@link BackgroundTask} to invoke when this task is run. + */ + @NonNull + private final Class<? extends BackgroundTask> mBackgroundTaskClass; + + /** * The extras to provide to the {@link BackgroundTask} when it is run. */ @NonNull @@ -336,18 +204,38 @@ private final boolean mUpdateCurrent; /** - * Task information regarding a type of task. + * Whether this task is periodic. */ - private final TimingInfo mTimingInfo; + private final boolean mIsPeriodic; + + /** + * Task information regarding one-off tasks. Non-null iff {@link #mIsPeriodic} is false. + */ + private final OneOffInfo mOneOffInfo; + + /** + * Task information regarding periodic tasks. Non-null iff {@link #mIsPeriodic} is true. + */ + private final PeriodicInfo mPeriodicInfo; private TaskInfo(Builder builder) { mTaskId = builder.mTaskId; + mBackgroundTaskClass = builder.mBackgroundTaskClass; mExtras = builder.mExtras == null ? new Bundle() : builder.mExtras; mRequiredNetworkType = builder.mRequiredNetworkType; mRequiresCharging = builder.mRequiresCharging; mIsPersisted = builder.mIsPersisted; mUpdateCurrent = builder.mUpdateCurrent; - mTimingInfo = builder.mTimingInfo; + mIsPeriodic = builder.mIsPeriodic; + if (mIsPeriodic) { + mOneOffInfo = null; + mPeriodicInfo = new PeriodicInfo(builder.mIntervalMs, builder.mFlexMs, builder.mHasFlex, + builder.mExpiresAfterWindowEndTime); + } else { + mOneOffInfo = new OneOffInfo(builder.mWindowStartTimeMs, builder.mWindowEndTimeMs, + builder.mHasWindowStartTimeConstraint, builder.mExpiresAfterWindowEndTime); + mPeriodicInfo = null; + } } /** @@ -362,13 +250,7 @@ */ @NonNull public Class<? extends BackgroundTask> getBackgroundTaskClass() { - BackgroundTask backgroundTask = - BackgroundTaskSchedulerFactory.getBackgroundTaskFromTaskId(mTaskId); - if (backgroundTask == null) { - Log.w(TAG, "Cannot get BackgorundTask class from task id " + mTaskId); - return null; - } - return backgroundTask.getClass(); + return mBackgroundTaskClass; } /** @@ -411,38 +293,28 @@ /** * @return Whether or not this task is a periodic task. */ - @Deprecated public boolean isPeriodic() { - return mTimingInfo instanceof PeriodicInfo; + return mIsPeriodic; } /** - * This is part of a {@link TaskInfo} iff the task is a one-off task. - * - * @return the specific data if it is a one-off tasks and null otherwise. - */ - @Deprecated + * This is part of a {@link TaskInfo} iff the task is NOT a periodic task, i.e. + * {@link TaskInfo#isPeriodic()} returns false. + * + * @return the specific data that is only available for one-off tasks. + */ public OneOffInfo getOneOffInfo() { - if (mTimingInfo instanceof OneOffInfo) return (OneOffInfo) mTimingInfo; - return null; + return mOneOffInfo; } /** - * This is part of a {@link TaskInfo} iff the task is a periodic task. + * This is part of a {@link TaskInfo} iff the task is a periodic task, i.e. + * {@link TaskInfo#isPeriodic()} returns true. * - * @return the specific data that if it is a periodic tasks and null otherwise. + * @return the specific data that is only available for periodic tasks. */ - @Deprecated public PeriodicInfo getPeriodicInfo() { - if (mTimingInfo instanceof PeriodicInfo) return (PeriodicInfo) mTimingInfo; - return null; - } - - /** - * @return the specific data based on the type of task. - */ - public TimingInfo getTimingInfo() { - return mTimingInfo; + return mPeriodicInfo; } @Override @@ -450,29 +322,23 @@ StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append("taskId: ").append(mTaskId); + sb.append(", backgroundTaskClass: ").append(mBackgroundTaskClass); sb.append(", extras: ").append(mExtras); sb.append(", requiredNetworkType: ").append(mRequiredNetworkType); sb.append(", requiresCharging: ").append(mRequiresCharging); sb.append(", isPersisted: ").append(mIsPersisted); sb.append(", updateCurrent: ").append(mUpdateCurrent); - sb.append(", timingInfo: ").append(mTimingInfo); + sb.append(", isPeriodic: ").append(mIsPeriodic); + if (isPeriodic()) { + sb.append(", periodicInfo: ").append(mPeriodicInfo); + } else { + sb.append(", oneOffInfo: ").append(mOneOffInfo); + } sb.append("}"); return sb.toString(); } /** - * Creates a task that holds all information necessary to schedule it. - * - * @param taskId the unique task ID for this task. Should be listed in {@link TaskIds}. - * @param timingInfo the task information specific to each type of task. - * @return the builder which can be used to continue configuration and {@link Builder#build()}. - * @see TaskIds - */ - public static Builder createTask(int taskId, TimingInfo timingInfo) { - return new Builder(taskId).setTimingInfo(timingInfo); - } - - /** * Schedule a one-off task to execute within a deadline. If windowEndTimeMs is 0, the task will * run as soon as possible. For executing a task within a time window, see * {@link #createOneOffTask(int, Class, long, long)}. @@ -485,16 +351,10 @@ * prerequisite conditions are not met. * @return the builder which can be used to continue configuration and {@link Builder#build()}. * @see TaskIds - * - * @deprecated the {@see #createTask(int, Class, TimingInfo)} method should be used instead. - * This method requires an additional step for the caller: the creation of the specific - * {@link TimingInfo} object with the wanted properties. */ - @Deprecated public static Builder createOneOffTask( int taskId, Class<? extends BackgroundTask> backgroundTaskClass, long windowEndTimeMs) { - TimingInfo oneOffInfo = OneOffInfo.create().setWindowEndTimeMs(windowEndTimeMs).build(); - return new Builder(taskId).setTimingInfo(oneOffInfo); + return new Builder(taskId, backgroundTaskClass, false).setWindowEndTimeMs(windowEndTimeMs); } /** @@ -511,20 +371,31 @@ * prerequisite conditions are not met. * @return the builder which can be used to continue configuration and {@link Builder#build()}. * @see TaskIds - * - * @deprecated the {@see #createTask(int, Class, TimingInfo)} method should be used instead. - * This method requires an additional step for the caller: the creation of the specific - * {@link TimingInfo} object with the wanted properties. */ - @Deprecated public static Builder createOneOffTask(int taskId, Class<? extends BackgroundTask> backgroundTaskClass, long windowStartTimeMs, long windowEndTimeMs) { - TimingInfo oneOffInfo = OneOffInfo.create() - .setWindowStartTimeMs(windowStartTimeMs) - .setWindowEndTimeMs(windowEndTimeMs) - .build(); - return new Builder(taskId).setTimingInfo(oneOffInfo); + return new Builder(taskId, backgroundTaskClass, false) + .setWindowStartTimeMs(windowStartTimeMs) + .setWindowEndTimeMs(windowEndTimeMs); + } + + /** + * Schedule a periodic task that will recur at the specified interval, without the need to + * be rescheduled. The task will continue to recur until + * {@link BackgroundTaskScheduler#cancel(Context, int)} is invoked with the task ID from this + * {@link TaskInfo}. + * + * @param taskId the unique task ID for this task. Should be listed in {@link TaskIds}. + * @param backgroundTaskClass the {@link BackgroundTask} class that will be instantiated for + * this task. + * @param intervalMs the interval between occurrences of this task in milliseconds. + * @return the builder which can be used to continue configuration and {@link Builder#build()}. + * @see TaskIds + */ + public static Builder createPeriodicTask( + int taskId, Class<? extends BackgroundTask> backgroundTaskClass, long intervalMs) { + return new Builder(taskId, backgroundTaskClass, true).setIntervalMs(intervalMs); } /** @@ -545,42 +416,88 @@ * length at the end of the period. It is reported in milliseconds. * @return the builder which can be used to continue configuration and {@link Builder#build()}. * @see TaskIds - * - * @deprecated the {@see #createTask(int, Class, TimingInfo)} method should be used instead. - * This method requires an additional step for the caller: the creation of the specific - * {@link TimingInfo} object with the wanted properties. */ - @Deprecated public static Builder createPeriodicTask(int taskId, Class<? extends BackgroundTask> backgroundTaskClass, long intervalMs, long flexMs) { - TimingInfo periodicInfo = - PeriodicInfo.create().setIntervalMs(intervalMs).setFlexMs(flexMs).build(); - return new Builder(taskId).setTimingInfo(periodicInfo); + return new Builder(taskId, backgroundTaskClass, true) + .setIntervalAndFlexMs(intervalMs, flexMs); } /** * A helper builder to provide a way to build {@link TaskInfo}. To create a {@link Builder} - * use the createTask method on {@link TaskInfo}. + * use one of the create* class method on {@link TaskInfo}. * - * @see @createTask(int, Class, TimingInfo) + * @see #createOneOffTask(int, Class, long) + * @see #createOneOffTask(int, Class, long, long) + * @see #createPeriodicTask(int, Class, long) + * @see #createPeriodicTask(int, Class, long, long) */ public static final class Builder { private final int mTaskId; - + @NonNull + private final Class<? extends BackgroundTask> mBackgroundTaskClass; + private final boolean mIsPeriodic; private Bundle mExtras; @NetworkType private int mRequiredNetworkType; private boolean mRequiresCharging; private boolean mIsPersisted; private boolean mUpdateCurrent; - private TimingInfo mTimingInfo; - Builder(int taskId) { + // Data about one-off tasks. + private long mWindowStartTimeMs; + private long mWindowEndTimeMs; + private boolean mHasWindowStartTimeConstraint; + private boolean mExpiresAfterWindowEndTime; + + // Data about periodic tasks. + private long mIntervalMs; + private long mFlexMs; + private boolean mHasFlex; + + Builder(int taskId, @NonNull Class<? extends BackgroundTask> backgroundTaskClass, + boolean isPeriodic) { mTaskId = taskId; + mBackgroundTaskClass = backgroundTaskClass; + mIsPeriodic = isPeriodic; } - Builder setTimingInfo(TimingInfo timingInfo) { - mTimingInfo = timingInfo; + Builder setWindowStartTimeMs(long windowStartTimeMs) { + assert !mIsPeriodic; + mWindowStartTimeMs = windowStartTimeMs; + mHasWindowStartTimeConstraint = true; + return this; + } + + Builder setWindowEndTimeMs(long windowEndTimeMs) { + assert !mIsPeriodic; + mWindowEndTimeMs = windowEndTimeMs; + return this; + } + + /** + * Set whether the task should expire if not scheduled until the window end time. + * This should be called only for One-Off tasks. + * + * @param expiresAfterWindowEndTime whether the task expires or not. + * @return this {@link Builder}. + */ + public Builder setExpiresAfterWindowEndTime(boolean expiresAfterWindowEndTime) { + mExpiresAfterWindowEndTime = expiresAfterWindowEndTime; + return this; + } + + Builder setIntervalMs(long intervalMs) { + assert mIsPeriodic; + mIntervalMs = intervalMs; + return this; + } + + Builder setIntervalAndFlexMs(long intervalMs, long flexMs) { + assert mIsPeriodic; + mIntervalMs = intervalMs; + mFlexMs = flexMs; + mHasFlex = true; return this; }
diff --git a/components/background_task_scheduler/android/javatests/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerImplWithMockTest.java b/components/background_task_scheduler/android/javatests/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerImplWithMockTest.java index afc61ac..67b8520 100644 --- a/components/background_task_scheduler/android/javatests/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerImplWithMockTest.java +++ b/components/background_task_scheduler/android/javatests/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerImplWithMockTest.java
@@ -42,11 +42,9 @@ @Test @SmallTest public void testOneOffTaskScheduling() { - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create() - .setWindowEndTimeMs(TimeUnit.MINUTES.toMillis(TEST_MINUTES)) - .build(); - TaskInfo oneOffTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTask = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TimeUnit.MINUTES.toMillis(TEST_MINUTES)) + .build(); MockBackgroundTaskSchedulerDelegate delegate = new MockBackgroundTaskSchedulerDelegate(); BackgroundTaskScheduler taskScheduler = new BackgroundTaskSchedulerImpl(delegate); @@ -61,11 +59,9 @@ @Test @SmallTest public void testPeriodicTaskScheduling() { - TaskInfo.TimingInfo timingInfo = - TaskInfo.PeriodicInfo.create() - .setIntervalMs(TimeUnit.MINUTES.toMillis(TEST_MINUTES)) - .build(); - TaskInfo periodicTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo periodicTask = TaskInfo.createPeriodicTask(TaskIds.TEST, TestBackgroundTask.class, + TimeUnit.MINUTES.toMillis(TEST_MINUTES)) + .build(); MockBackgroundTaskSchedulerDelegate delegate = new MockBackgroundTaskSchedulerDelegate(); BackgroundTaskScheduler taskScheduler = new BackgroundTaskSchedulerImpl(delegate);
diff --git a/components/background_task_scheduler/android/javatests/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerJobServiceTest.java b/components/background_task_scheduler/android/javatests/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerJobServiceTest.java index cb55c94..c10a8c6 100644 --- a/components/background_task_scheduler/android/javatests/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerJobServiceTest.java +++ b/components/background_task_scheduler/android/javatests/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerJobServiceTest.java
@@ -64,9 +64,9 @@ @Test @SmallTest public void testOneOffTaskWithDeadline() { - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TIME_200_MIN_TO_MS).build(); - TaskInfo oneOffTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTask = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TIME_200_MIN_TO_MS) + .build(); JobInfo jobInfo = BackgroundTaskSchedulerJobService.createJobInfoFromTaskInfo( InstrumentationRegistry.getTargetContext(), oneOffTask); Assert.assertEquals(oneOffTask.getTaskId(), jobInfo.getId()); @@ -77,11 +77,10 @@ @Test @SmallTest public void testOneOffTaskWithDeadlineAndExpiration() { - TaskInfo.TimingInfo timingInfo = TaskInfo.OneOffInfo.create() - .setWindowEndTimeMs(TIME_200_MIN_TO_MS) - .setExpiresAfterWindowEndTime(true) - .build(); - TaskInfo oneOffTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTask = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TIME_200_MIN_TO_MS) + .setExpiresAfterWindowEndTime(true) + .build(); JobInfo jobInfo = BackgroundTaskSchedulerJobService.createJobInfoFromTaskInfo( InstrumentationRegistry.getTargetContext(), oneOffTask); Assert.assertEquals(END_TIME_WITH_DEADLINE_MS, jobInfo.getMaxExecutionDelayMillis()); @@ -93,11 +92,9 @@ @Test @SmallTest public void testOneOffTaskWithWindow() { - TaskInfo.TimingInfo timingInfo = TaskInfo.OneOffInfo.create() - .setWindowStartTimeMs(TIME_100_MIN_TO_MS) - .setWindowEndTimeMs(TIME_200_MIN_TO_MS) - .build(); - TaskInfo oneOffTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTask = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TIME_100_MIN_TO_MS, TIME_200_MIN_TO_MS) + .build(); JobInfo jobInfo = BackgroundTaskSchedulerJobService.createJobInfoFromTaskInfo( InstrumentationRegistry.getTargetContext(), oneOffTask); Assert.assertEquals(oneOffTask.getTaskId(), jobInfo.getId()); @@ -109,12 +106,10 @@ @Test @SmallTest public void testOneOffTaskWithWindowAndExpiration() { - TaskInfo.TimingInfo timingInfo = TaskInfo.OneOffInfo.create() - .setWindowStartTimeMs(TIME_100_MIN_TO_MS) - .setWindowEndTimeMs(TIME_200_MIN_TO_MS) - .setExpiresAfterWindowEndTime(true) - .build(); - TaskInfo oneOffTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTask = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TIME_100_MIN_TO_MS, TIME_200_MIN_TO_MS) + .setExpiresAfterWindowEndTime(true) + .build(); JobInfo jobInfo = BackgroundTaskSchedulerJobService.createJobInfoFromTaskInfo( InstrumentationRegistry.getTargetContext(), oneOffTask); Assert.assertEquals( @@ -128,9 +123,9 @@ @Test @SmallTest public void testPeriodicTaskWithoutFlex() { - TaskInfo.TimingInfo timingInfo = - TaskInfo.PeriodicInfo.create().setIntervalMs(TIME_200_MIN_TO_MS).build(); - TaskInfo periodicTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo periodicTask = TaskInfo.createPeriodicTask(TaskIds.TEST, TestBackgroundTask.class, + TIME_200_MIN_TO_MS) + .build(); JobInfo jobInfo = BackgroundTaskSchedulerJobService.createJobInfoFromTaskInfo( InstrumentationRegistry.getTargetContext(), periodicTask); Assert.assertEquals(periodicTask.getTaskId(), jobInfo.getId()); @@ -141,11 +136,9 @@ @Test @SmallTest public void testPeriodicTaskWithFlex() { - TaskInfo.TimingInfo timingInfo = TaskInfo.PeriodicInfo.create() - .setIntervalMs(TIME_200_MIN_TO_MS) - .setFlexMs(TIME_50_MIN_TO_MS) - .build(); - TaskInfo periodicTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo periodicTask = TaskInfo.createPeriodicTask(TaskIds.TEST, TestBackgroundTask.class, + TIME_200_MIN_TO_MS, TIME_50_MIN_TO_MS) + .build(); JobInfo jobInfo = BackgroundTaskSchedulerJobService.createJobInfoFromTaskInfo( InstrumentationRegistry.getTargetContext(), periodicTask); Assert.assertEquals(TIME_200_MIN_TO_MS, jobInfo.getIntervalMillis()); @@ -161,10 +154,10 @@ taskExtras.putString("foo", "bar"); taskExtras.putBoolean("bools", true); taskExtras.putLong("longs", 1342543L); - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TIME_200_MIN_TO_MS).build(); - TaskInfo oneOffTask = - TaskInfo.createTask(TaskIds.TEST, timingInfo).setExtras(taskExtras).build(); + TaskInfo oneOffTask = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TIME_200_MIN_TO_MS) + .setExtras(taskExtras) + .build(); JobInfo jobInfo = BackgroundTaskSchedulerJobService.createJobInfoFromTaskInfo( InstrumentationRegistry.getTargetContext(), oneOffTask); Assert.assertEquals(oneOffTask.getTaskId(), jobInfo.getId()); @@ -180,9 +173,8 @@ @Test @SmallTest public void testTaskInfoWithManyConstraints() { - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TIME_200_MIN_TO_MS).build(); - TaskInfo.Builder taskBuilder = TaskInfo.createTask(TaskIds.TEST, timingInfo); + TaskInfo.Builder taskBuilder = TaskInfo.createOneOffTask( + TaskIds.TEST, TestBackgroundTask.class, TIME_200_MIN_TO_MS); JobInfo jobInfo = BackgroundTaskSchedulerJobService.createJobInfoFromTaskInfo( InstrumentationRegistry.getTargetContext(),
diff --git a/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskGcmTaskServiceTest.java b/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskGcmTaskServiceTest.java index 506ef28..113492c 100644 --- a/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskGcmTaskServiceTest.java +++ b/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskGcmTaskServiceTest.java
@@ -199,9 +199,9 @@ ReflectionHelpers.setStaticField( Build.VERSION.class, "SDK_INT", Build.VERSION_CODES.LOLLIPOP); - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TimeUnit.DAYS.toMillis(1)).build(); - TaskInfo task = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo task = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TimeUnit.DAYS.toMillis(1)) + .build(); BackgroundTaskSchedulerPrefs.addScheduledTask(task); assertEquals(0, TestBackgroundTask.getRescheduleCalls()); @@ -215,9 +215,9 @@ BackgroundTaskSchedulerFactory.setBackgroundTaskFactory(new TestBackgroundTaskFactory()); ReflectionHelpers.setStaticField(Build.VERSION.class, "SDK_INT", Build.VERSION_CODES.M); - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TimeUnit.DAYS.toMillis(1)).build(); - TaskInfo task = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo task = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TimeUnit.DAYS.toMillis(1)) + .build(); BackgroundTaskSchedulerPrefs.addScheduledTask(task); assertEquals(0, TestBackgroundTask.getRescheduleCalls());
diff --git a/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerGcmNetworkManagerTest.java b/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerGcmNetworkManagerTest.java index cc9443f..9f38603 100644 --- a/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerGcmNetworkManagerTest.java +++ b/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerGcmNetworkManagerTest.java
@@ -61,15 +61,14 @@ mGcmNetworkManager = (ShadowGcmNetworkManager) Shadow.extract( GcmNetworkManager.getInstance(ContextUtils.getApplicationContext())); BackgroundTaskSchedulerGcmNetworkManager.setClockForTesting(mClock); - BackgroundTaskSchedulerFactory.setBackgroundTaskFactory(new TestBackgroundTaskFactory()); } @Test @Feature({"BackgroundTaskScheduler"}) public void testOneOffTaskWithDeadline() { - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TIME_200_MIN_TO_MS).build(); - TaskInfo oneOffTaskInfo = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTaskInfo = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TIME_200_MIN_TO_MS) + .build(); Task task = BackgroundTaskSchedulerGcmNetworkManager.createTaskFromTaskInfo(oneOffTaskInfo); assertTrue(task instanceof OneoffTask); OneoffTask oneOffTask = (OneoffTask) task; @@ -81,11 +80,10 @@ @Test @Feature({"BackgroundTaskScheduler"}) public void testOneOffTaskWithDeadlineAndExpiration() { - TaskInfo.TimingInfo timingInfo = TaskInfo.OneOffInfo.create() - .setWindowEndTimeMs(TIME_200_MIN_TO_MS) - .setExpiresAfterWindowEndTime(true) - .build(); - TaskInfo oneOffTaskInfo = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTaskInfo = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TIME_200_MIN_TO_MS) + .setExpiresAfterWindowEndTime(true) + .build(); Task task = BackgroundTaskSchedulerGcmNetworkManager.createTaskFromTaskInfo(oneOffTaskInfo); assertTrue(task instanceof OneoffTask); OneoffTask oneOffTask = (OneoffTask) task; @@ -100,11 +98,9 @@ @Test @Feature({"BackgroundTaskScheduler"}) public void testOneOffTaskWithWindow() { - TaskInfo.TimingInfo timingInfo = TaskInfo.OneOffInfo.create() - .setWindowStartTimeMs(TIME_100_MIN_TO_MS) - .setWindowEndTimeMs(TIME_200_MIN_TO_MS) - .build(); - TaskInfo oneOffTaskInfo = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTaskInfo = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TIME_100_MIN_TO_MS, TIME_200_MIN_TO_MS) + .build(); Task task = BackgroundTaskSchedulerGcmNetworkManager.createTaskFromTaskInfo(oneOffTaskInfo); assertTrue(task instanceof OneoffTask); OneoffTask oneOffTask = (OneoffTask) task; @@ -116,12 +112,10 @@ @Test @Feature({"BackgroundTaskScheduler"}) public void testOneOffTaskWithWindowAndExpiration() { - TaskInfo.TimingInfo timingInfo = TaskInfo.OneOffInfo.create() - .setWindowStartTimeMs(TIME_100_MIN_TO_MS) - .setWindowEndTimeMs(TIME_200_MIN_TO_MS) - .setExpiresAfterWindowEndTime(true) - .build(); - TaskInfo oneOffTaskInfo = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTaskInfo = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TIME_100_MIN_TO_MS, TIME_200_MIN_TO_MS) + .setExpiresAfterWindowEndTime(true) + .build(); Task task = BackgroundTaskSchedulerGcmNetworkManager.createTaskFromTaskInfo(oneOffTaskInfo); assertTrue(task instanceof OneoffTask); OneoffTask oneOffTask = (OneoffTask) task; @@ -136,9 +130,9 @@ @Test @Feature({"BackgroundTaskScheduler"}) public void testPeriodicTaskWithoutFlex() { - TaskInfo.TimingInfo timingInfo = - TaskInfo.PeriodicInfo.create().setIntervalMs(TIME_200_MIN_TO_MS).build(); - TaskInfo periodicTaskInfo = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo periodicTaskInfo = TaskInfo.createPeriodicTask(TaskIds.TEST, + TestBackgroundTask.class, TIME_200_MIN_TO_MS) + .build(); Task task = BackgroundTaskSchedulerGcmNetworkManager.createTaskFromTaskInfo(periodicTaskInfo); assertEquals(Integer.toString(TaskIds.TEST), task.getTag()); @@ -150,11 +144,10 @@ @Test @Feature({"BackgroundTaskScheduler"}) public void testPeriodicTaskWithFlex() { - TaskInfo.TimingInfo timingInfo = TaskInfo.PeriodicInfo.create() - .setIntervalMs(TIME_200_MIN_TO_MS) - .setFlexMs(TimeUnit.MINUTES.toMillis(50)) - .build(); - TaskInfo periodicTaskInfo = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo periodicTaskInfo = + TaskInfo.createPeriodicTask(TaskIds.TEST, TestBackgroundTask.class, + TIME_200_MIN_TO_MS, TimeUnit.MINUTES.toMillis(50)) + .build(); Task task = BackgroundTaskSchedulerGcmNetworkManager.createTaskFromTaskInfo(periodicTaskInfo); assertEquals(Integer.toString(TaskIds.TEST), task.getTag()); @@ -171,10 +164,10 @@ userExtras.putString("foo", "bar"); userExtras.putBoolean("bools", true); userExtras.putLong("longs", 1342543L); - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TIME_200_MIN_TO_MS).build(); - TaskInfo oneOffTaskInfo = - TaskInfo.createTask(TaskIds.TEST, timingInfo).setExtras(userExtras).build(); + TaskInfo oneOffTaskInfo = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TIME_200_MIN_TO_MS) + .setExtras(userExtras) + .build(); Task task = BackgroundTaskSchedulerGcmNetworkManager.createTaskFromTaskInfo(oneOffTaskInfo); assertEquals(Integer.toString(TaskIds.TEST), task.getTag()); assertTrue(task instanceof OneoffTask); @@ -192,9 +185,8 @@ @Test @Feature({"BackgroundTaskScheduler"}) public void testTaskInfoWithManyConstraints() { - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TIME_200_MIN_TO_MS).build(); - TaskInfo.Builder taskBuilder = TaskInfo.createTask(TaskIds.TEST, timingInfo); + TaskInfo.Builder taskBuilder = TaskInfo.createOneOffTask( + TaskIds.TEST, TestBackgroundTask.class, TIME_200_MIN_TO_MS); Task task = BackgroundTaskSchedulerGcmNetworkManager.createTaskFromTaskInfo( taskBuilder.setIsPersisted(true).build()); @@ -229,6 +221,8 @@ @Test @Feature({"BackgroundTaskScheduler"}) public void testGetBackgroundTaskFromTaskParams() { + BackgroundTaskSchedulerFactory.setBackgroundTaskFactory(new TestBackgroundTaskFactory()); + TaskParams params = new TaskParams(Integer.toString(TaskIds.TEST), new Bundle()); BackgroundTask backgroundTask = BackgroundTaskSchedulerFactory.getBackgroundTaskFromTaskId( Integer.valueOf(params.getTag())); @@ -240,9 +234,9 @@ @Test @Feature({"BackgroundTaskScheduler"}) public void testSchedule() { - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TIME_24_H_TO_MS).build(); - TaskInfo oneOffTaskInfo = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTaskInfo = + TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, TIME_24_H_TO_MS) + .build(); assertNull(mGcmNetworkManager.getScheduledTask()); @@ -269,9 +263,9 @@ Shadows.shadowOf(GoogleApiAvailability.getInstance()) .setIsGooglePlayServicesAvailable(ConnectionResult.SERVICE_MISSING); - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TIME_24_H_TO_MS).build(); - TaskInfo oneOffTaskInfo = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTaskInfo = + TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, TIME_24_H_TO_MS) + .build(); assertFalse(new BackgroundTaskSchedulerGcmNetworkManager().schedule( ContextUtils.getApplicationContext(), oneOffTaskInfo)); @@ -280,9 +274,9 @@ @Test @Feature("BackgroundTaskScheduler") public void testCancel() { - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TIME_24_H_TO_MS).build(); - TaskInfo oneOffTaskInfo = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTaskInfo = + TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, TIME_24_H_TO_MS) + .build(); BackgroundTaskSchedulerDelegate delegate = new BackgroundTaskSchedulerGcmNetworkManager(); @@ -300,9 +294,9 @@ Shadows.shadowOf(GoogleApiAvailability.getInstance()) .setIsGooglePlayServicesAvailable(ConnectionResult.SERVICE_MISSING); - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TIME_24_H_TO_MS).build(); - TaskInfo oneOffTaskInfo = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTaskInfo = + TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, TIME_24_H_TO_MS) + .build(); // Ensure there was a previously scheduled task. mGcmNetworkManager.schedule(
diff --git a/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerImplTest.java b/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerImplTest.java index eaae2c4..b5093a8 100644 --- a/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerImplTest.java +++ b/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerImplTest.java
@@ -65,16 +65,13 @@ mGcmNetworkManager = (ShadowGcmNetworkManager) Shadow.extract( GcmNetworkManager.getInstance(ContextUtils.getApplicationContext())); - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TimeUnit.DAYS.toMillis(1)).build(); - mTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); - TaskInfo.TimingInfo expirationTimingInfo = - TaskInfo.OneOffInfo.create() - .setWindowEndTimeMs(TimeUnit.DAYS.toMillis(1)) - .setExpiresAfterWindowEndTime(true) + mTask = TaskInfo.createOneOffTask( + TaskIds.TEST, TestBackgroundTask.class, TimeUnit.DAYS.toMillis(1)) .build(); - mExpirationTask = TaskInfo.createTask(TaskIds.TEST, expirationTimingInfo).build(); - + mExpirationTask = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TimeUnit.DAYS.toMillis(1)) + .setExpiresAfterWindowEndTime(true) + .build(); BackgroundTaskSchedulerFactory.setBackgroundTaskFactory(new TestBackgroundTaskFactory()); }
diff --git a/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerPrefsTest.java b/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerPrefsTest.java index 2b6714a..adf7c32 100644 --- a/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerPrefsTest.java +++ b/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerPrefsTest.java
@@ -41,28 +41,19 @@ private TaskInfo mTask1; private TaskInfo mTask2; - private class AllValidTestBackgroundTaskFactory implements BackgroundTaskFactory { - @Override - public BackgroundTask getBackgroundTaskFromTaskId(int taskId) { - return new TestBackgroundTask(); - } - } - @Before public void setUp() { MockitoAnnotations.initMocks(this); BackgroundTaskSchedulerUma.setInstanceForTesting(mUmaSpy); doNothing().when(mUmaSpy).assertNativeIsLoaded(); - TaskInfo.TimingInfo timingInfo1 = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TimeUnit.DAYS.toMillis(1)).build(); - mTask1 = TaskInfo.createTask(TaskIds.TEST, timingInfo1).build(); - TaskInfo.TimingInfo timingInfo2 = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TimeUnit.DAYS.toMillis(1)).build(); - mTask2 = TaskInfo.createTask(TaskIds.OFFLINE_PAGES_BACKGROUND_JOB_ID, timingInfo2).build(); - - BackgroundTaskSchedulerFactory.setBackgroundTaskFactory( - new AllValidTestBackgroundTaskFactory()); + mTask1 = TaskInfo.createOneOffTask( + TaskIds.TEST, TestBackgroundTask.class, TimeUnit.DAYS.toMillis(1)) + .build(); + mTask2 = TaskInfo.createOneOffTask(TaskIds.OFFLINE_PAGES_BACKGROUND_JOB_ID, + TestBackgroundTask.class, TimeUnit.DAYS.toMillis(1)) + .build(); + BackgroundTaskSchedulerFactory.setBackgroundTaskFactory(new TestBackgroundTaskFactory()); } @Test @@ -79,10 +70,9 @@ BackgroundTaskSchedulerPrefs.addScheduledTask(mTask2); assertEquals("There should be 2 tasks in shared prefs.", 2, BackgroundTaskSchedulerPrefs.getScheduledTaskIds().size()); - - TaskInfo.TimingInfo timingInfo = - TaskInfo.OneOffInfo.create().setWindowEndTimeMs(TimeUnit.DAYS.toMillis(1)).build(); - TaskInfo task3 = TaskInfo.createTask(TaskIds.OMAHA_JOB_ID, timingInfo).build(); + TaskInfo task3 = TaskInfo.createOneOffTask(TaskIds.OMAHA_JOB_ID, TestBackgroundTask.class, + TimeUnit.DAYS.toMillis(1)) + .build(); BackgroundTaskSchedulerPrefs.addScheduledTask(task3); assertEquals("There should be 3 tasks in shared prefs.", 3,
diff --git a/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/TaskInfoTest.java b/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/TaskInfoTest.java index 613cdc0..7bb71a4 100644 --- a/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/TaskInfoTest.java +++ b/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/TaskInfoTest.java
@@ -6,8 +6,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import org.junit.Before; @@ -31,42 +29,38 @@ @Before public void setUp() { TestBackgroundTask.reset(); - BackgroundTaskSchedulerFactory.setBackgroundTaskFactory(new TestBackgroundTaskFactory()); } - private void checkGeneralTaskInfoFields(TaskInfo taskInfo, int taskId) { + private void checkGeneralTaskInfoFields( + TaskInfo taskInfo, int taskId, Class<? extends BackgroundTask> backgroundTaskClass) { assertEquals(taskId, taskInfo.getTaskId()); - assertEquals(TestBackgroundTask.class, taskInfo.getBackgroundTaskClass()); + assertEquals(backgroundTaskClass, taskInfo.getBackgroundTaskClass()); } @Test @Feature({"BackgroundTaskScheduler"}) public void testOneOffExpirationWithinDeadline() { - TaskInfo.TimingInfo timingInfo = TaskInfo.OneOffInfo.create() - .setWindowEndTimeMs(TEST_END_MS) - .setExpiresAfterWindowEndTime(true) - .build(); - TaskInfo oneOffTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTask = + TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, TEST_END_MS) + .setExpiresAfterWindowEndTime(true) + .build(); - checkGeneralTaskInfoFields(oneOffTask, TaskIds.TEST); + checkGeneralTaskInfoFields(oneOffTask, TaskIds.TEST, TestBackgroundTask.class); assertFalse(oneOffTask.getOneOffInfo().hasWindowStartTimeConstraint()); assertEquals(TEST_END_MS, oneOffTask.getOneOffInfo().getWindowEndTimeMs()); assertTrue(oneOffTask.getOneOffInfo().expiresAfterWindowEndTime()); - assertNotNull(oneOffTask.getOneOffInfo()); - assertNull(oneOffTask.getPeriodicInfo()); + assertEquals(null, oneOffTask.getPeriodicInfo()); } @Test @Feature({"BackgroundTaskScheduler"}) public void testOneOffExpirationWithinTimeWindow() { - TaskInfo.TimingInfo timingInfo = TaskInfo.OneOffInfo.create() - .setWindowStartTimeMs(TEST_START_MS) - .setWindowEndTimeMs(TEST_END_MS) - .setExpiresAfterWindowEndTime(true) - .build(); - TaskInfo oneOffTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTask = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TEST_START_MS, TEST_END_MS) + .setExpiresAfterWindowEndTime(true) + .build(); assertTrue(oneOffTask.getOneOffInfo().hasWindowStartTimeConstraint()); assertEquals(TEST_START_MS, oneOffTask.getOneOffInfo().getWindowStartTimeMs()); @@ -77,12 +71,10 @@ @Test @Feature({"BackgroundTaskScheduler"}) public void testOneOffExpirationWithinZeroTimeWindow() { - TaskInfo.TimingInfo timingInfo = TaskInfo.OneOffInfo.create() - .setWindowStartTimeMs(TEST_END_MS) - .setWindowEndTimeMs(TEST_END_MS) - .setExpiresAfterWindowEndTime(true) - .build(); - TaskInfo oneOffTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo oneOffTask = TaskInfo.createOneOffTask(TaskIds.TEST, TestBackgroundTask.class, + TEST_END_MS, TEST_END_MS) + .setExpiresAfterWindowEndTime(true) + .build(); assertEquals(TEST_END_MS, oneOffTask.getOneOffInfo().getWindowStartTimeMs()); assertEquals(TEST_END_MS, oneOffTask.getOneOffInfo().getWindowEndTimeMs()); @@ -91,25 +83,13 @@ @Test @Feature({"BackgroundTaskScheduler"}) - public void testOneOffNoParamsSet() { - TaskInfo.TimingInfo timingInfo = TaskInfo.OneOffInfo.create().build(); - TaskInfo oneOffTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); - - assertFalse(oneOffTask.getOneOffInfo().hasWindowStartTimeConstraint()); - assertEquals(0, oneOffTask.getOneOffInfo().getWindowEndTimeMs()); - assertFalse(oneOffTask.getOneOffInfo().expiresAfterWindowEndTime()); - } - - @Test - @Feature({"BackgroundTaskScheduler"}) public void testPeriodicExpirationWithInterval() { - TaskInfo.TimingInfo timingInfo = TaskInfo.PeriodicInfo.create() - .setIntervalMs(TEST_END_MS) - .setExpiresAfterWindowEndTime(true) - .build(); - TaskInfo periodicTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo periodicTask = + TaskInfo.createPeriodicTask(TaskIds.TEST, TestBackgroundTask.class, TEST_END_MS) + .setExpiresAfterWindowEndTime(true) + .build(); - checkGeneralTaskInfoFields(periodicTask, TaskIds.TEST); + checkGeneralTaskInfoFields(periodicTask, TaskIds.TEST, TestBackgroundTask.class); assertFalse(periodicTask.getPeriodicInfo().hasFlex()); assertEquals(TEST_END_MS, periodicTask.getPeriodicInfo().getIntervalMs()); @@ -121,27 +101,14 @@ @Test @Feature({"BackgroundTaskScheduler"}) public void testPeriodicExpirationWithIntervalAndFlex() { - TaskInfo.TimingInfo timingInfo = TaskInfo.PeriodicInfo.create() - .setIntervalMs(TEST_END_MS) - .setFlexMs(TEST_FLEX_MS) - .setExpiresAfterWindowEndTime(true) - .build(); - TaskInfo periodicTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); + TaskInfo periodicTask = TaskInfo.createPeriodicTask(TaskIds.TEST, TestBackgroundTask.class, + TEST_END_MS, TEST_FLEX_MS) + .setExpiresAfterWindowEndTime(true) + .build(); assertTrue(periodicTask.getPeriodicInfo().hasFlex()); assertEquals(TEST_FLEX_MS, periodicTask.getPeriodicInfo().getFlexMs()); assertEquals(TEST_END_MS, periodicTask.getPeriodicInfo().getIntervalMs()); assertTrue(periodicTask.getPeriodicInfo().expiresAfterWindowEndTime()); } - - @Test - @Feature({"BackgroundTaskScheduler"}) - public void testPeriodicNoParamsSet() { - TaskInfo.TimingInfo timingInfo = TaskInfo.PeriodicInfo.create().build(); - TaskInfo periodicTask = TaskInfo.createTask(TaskIds.TEST, timingInfo).build(); - - assertFalse(periodicTask.getPeriodicInfo().hasFlex()); - assertEquals(0, periodicTask.getPeriodicInfo().getIntervalMs()); - assertFalse(periodicTask.getPeriodicInfo().expiresAfterWindowEndTime()); - } } \ No newline at end of file
diff --git a/components/blacklist/opt_out_blacklist/opt_out_blacklist_unittest.cc b/components/blacklist/opt_out_blacklist/opt_out_blacklist_unittest.cc index 2967635e..6324aaa 100644 --- a/components/blacklist/opt_out_blacklist/opt_out_blacklist_unittest.cc +++ b/components/blacklist/opt_out_blacklist/opt_out_blacklist_unittest.cc
@@ -271,7 +271,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; // Observer to |black_list_|. TestOptOutBlacklistDelegate blacklist_delegate_;
diff --git a/components/blacklist/opt_out_blacklist/sql/opt_out_store_sql_unittest.cc b/components/blacklist/opt_out_blacklist/sql/opt_out_store_sql_unittest.cc index b251df1..30a60d8 100644 --- a/components/blacklist/opt_out_blacklist/sql/opt_out_store_sql_unittest.cc +++ b/components/blacklist/opt_out_blacklist/sql/opt_out_store_sql_unittest.cc
@@ -93,7 +93,7 @@ void TearDown() override { DestroyStore(); } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; // The backing SQL store. std::unique_ptr<OptOutStoreSQL> store_;
diff --git a/components/bookmarks/browser/bookmark_expanded_state_tracker_unittest.cc b/components/bookmarks/browser/bookmark_expanded_state_tracker_unittest.cc index 3541b48..f365d6a 100644 --- a/components/bookmarks/browser/bookmark_expanded_state_tracker_unittest.cc +++ b/components/bookmarks/browser/bookmark_expanded_state_tracker_unittest.cc
@@ -32,7 +32,7 @@ void SetUp() override; void TearDown() override; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestingPrefServiceSimple prefs_; std::unique_ptr<BookmarkModel> model_;
diff --git a/components/bookmarks/browser/bookmark_model_unittest.cc b/components/bookmarks/browser/bookmark_model_unittest.cc index aafb321..43d179c5 100644 --- a/components/bookmarks/browser/bookmark_model_unittest.cc +++ b/components/bookmarks/browser/bookmark_model_unittest.cc
@@ -1231,7 +1231,7 @@ // Create a model with a single url. base::ScopedTempDir tmp_dir; ASSERT_TRUE(tmp_dir.CreateUniqueTempDir()); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<BookmarkModel> model = std::make_unique<BookmarkModel>(std::make_unique<TestBookmarkClient>()); model->Load(nullptr, tmp_dir.GetPath(), base::ThreadTaskRunnerHandle::Get(),
diff --git a/components/bookmarks/browser/bookmark_node_data_unittest.cc b/components/bookmarks/browser/bookmark_node_data_unittest.cc index 2abbcde..44add896 100644 --- a/components/bookmarks/browser/bookmark_node_data_unittest.cc +++ b/components/bookmarks/browser/bookmark_node_data_unittest.cc
@@ -27,8 +27,7 @@ class BookmarkNodeDataTest : public testing::Test { public: BookmarkNodeDataTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { model_ = TestBookmarkClient::CreateModel(); @@ -56,7 +55,7 @@ private: base::ScopedTempDir profile_dir_; std::unique_ptr<BookmarkModel> model_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(BookmarkNodeDataTest); };
diff --git a/components/bookmarks/browser/bookmark_utils.cc b/components/bookmarks/browser/bookmark_utils.cc index e8a7f51..5dc86d7 100644 --- a/components/bookmarks/browser/bookmark_utils.cc +++ b/components/bookmarks/browser/bookmark_utils.cc
@@ -95,18 +95,6 @@ return true; } -// Returns true if |node|s title or url contains the strings in |words|. -bool DoesBookmarkContainWords(const BookmarkNode* node, - const std::vector<base::string16>& words) { - return DoesBookmarkTextContainWords(node->GetTitle(), words) || - DoesBookmarkTextContainWords(base::UTF8ToUTF16(node->url().spec()), - words) || - DoesBookmarkTextContainWords( - url_formatter::FormatUrl( - node->url(), url_formatter::kFormatUrlOmitNothing, - net::UnescapeRule::NORMAL, nullptr, nullptr, nullptr), - words); -} // This is used with a tree iterator to skip subtrees which are not visible. bool PruneInvisibleFolders(const BookmarkNode* node) { @@ -196,7 +184,8 @@ while (iterator.has_next()) { const BookmarkNode* node = iterator.Next(); if ((!query_words.empty() && - !DoesBookmarkContainWords(node, query_words)) || + !DoesBookmarkContainWords(node->GetTitle(), node->url(), + query_words)) || model->is_permanent_node(node)) { continue; } @@ -404,15 +393,9 @@ const QueryFields& query, size_t max_count, std::vector<const BookmarkNode*>* nodes) { - std::vector<base::string16> query_words; - query_parser::QueryParser parser; - if (query.word_phrase_query) { - parser.ParseQueryWords(base::i18n::ToLower(*query.word_phrase_query), - query_parser::MatchingAlgorithm::DEFAULT, - &query_words); - if (query_words.empty()) - return; - } + std::vector<base::string16> query_words = ParseBookmarkQuery(query); + if (query.word_phrase_query && query_words.empty()) + return; if (query.url) { // Shortcut into the BookmarkModel if searching for URL. @@ -431,6 +414,32 @@ } } +// Parses the provided query and returns a vector of query words. +std::vector<base::string16> ParseBookmarkQuery( + const bookmarks::QueryFields& query) { + std::vector<base::string16> query_words; + query_parser::QueryParser parser; + if (query.word_phrase_query) { + parser.ParseQueryWords(base::i18n::ToLower(*query.word_phrase_query), + query_parser::MatchingAlgorithm::DEFAULT, + &query_words); + } + return query_words; +} + +// Returns true if |node|s title or url contains the strings in |words|. +bool DoesBookmarkContainWords(const base::string16& title, + const GURL& url, + const std::vector<base::string16>& words) { + return DoesBookmarkTextContainWords(title, words) || + DoesBookmarkTextContainWords(base::UTF8ToUTF16(url.spec()), words) || + DoesBookmarkTextContainWords( + url_formatter::FormatUrl(url, url_formatter::kFormatUrlOmitNothing, + net::UnescapeRule::NORMAL, nullptr, + nullptr, nullptr), + words); +} + void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { registry->RegisterBooleanPref( prefs::kShowBookmarkBar,
diff --git a/components/bookmarks/browser/bookmark_utils.h b/components/bookmarks/browser/bookmark_utils.h index 59a606a..62eed75 100644 --- a/components/bookmarks/browser/bookmark_utils.h +++ b/components/bookmarks/browser/bookmark_utils.h
@@ -90,6 +90,16 @@ size_t max_count, std::vector<const BookmarkNode*>* nodes); +// Parses the provided query and returns a vector of query words. +std::vector<base::string16> ParseBookmarkQuery( + const bookmarks::QueryFields& query); + +// Returns true iff |title| or |url| contains each string in |words|. This is +// used when searching for bookmarks. +bool DoesBookmarkContainWords(const base::string16& title, + const GURL& url, + const std::vector<base::string16>& words); + // Register user preferences for Bookmarks Bar. void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
diff --git a/components/bookmarks/browser/bookmark_utils_unittest.cc b/components/bookmarks/browser/bookmark_utils_unittest.cc index 9cfd4d9f..2a73c0b 100644 --- a/components/bookmarks/browser/bookmark_utils_unittest.cc +++ b/components/bookmarks/browser/bookmark_utils_unittest.cc
@@ -32,8 +32,7 @@ public BaseBookmarkModelObserver { public: BookmarkUtilsTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), grouped_changes_beginning_count_(0), grouped_changes_ended_count_(0) {} @@ -74,7 +73,7 @@ } // Clipboard requires a message loop. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; int grouped_changes_beginning_count_; int grouped_changes_ended_count_;
diff --git a/components/bookmarks/managed/managed_bookmarks_tracker_unittest.cc b/components/bookmarks/managed/managed_bookmarks_tracker_unittest.cc index 4015e23a..c9760d7 100644 --- a/components/bookmarks/managed/managed_bookmarks_tracker_unittest.cc +++ b/components/bookmarks/managed/managed_bookmarks_tracker_unittest.cc
@@ -165,7 +165,7 @@ } base::ScopedTempDir scoped_temp_dir_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestingPrefServiceSimple prefs_; std::unique_ptr<BookmarkModel> model_; MockBookmarkModelObserver observer_;
diff --git a/components/browser_watcher/watcher_metrics_provider_win_unittest.cc b/components/browser_watcher/watcher_metrics_provider_win_unittest.cc index f2c70b2bc..9b159a3 100644 --- a/components/browser_watcher/watcher_metrics_provider_win_unittest.cc +++ b/components/browser_watcher/watcher_metrics_provider_win_unittest.cc
@@ -65,7 +65,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; registry_util::RegistryOverrideManager override_manager_; base::HistogramTester histogram_tester_; }; @@ -138,7 +138,7 @@ provider.OnRecordingDisabled(); // Flush the task(s). - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Make sure the subkey for the pseudo process has been deleted on reporting. ASSERT_EQ(ERROR_FILE_NOT_FOUND,
diff --git a/components/browsing_data/core/browsing_data_utils_unittest.cc b/components/browsing_data/core/browsing_data_utils_unittest.cc index defe1227..acef4a6 100644 --- a/components/browsing_data/core/browsing_data_utils_unittest.cc +++ b/components/browsing_data/core/browsing_data_utils_unittest.cc
@@ -50,7 +50,7 @@ PrefService* prefs() { return &prefs_; } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable prefs_; };
diff --git a/components/browsing_data/core/counters/browsing_data_counter_unittest.cc b/components/browsing_data/core/counters/browsing_data_counter_unittest.cc index 60ddc66..1c4e23c 100644 --- a/components/browsing_data/core/counters/browsing_data_counter_unittest.cc +++ b/components/browsing_data/core/counters/browsing_data_counter_unittest.cc
@@ -104,7 +104,7 @@ private: std::unique_ptr<TestingPrefServiceSimple> pref_service_; std::unique_ptr<MockBrowsingDataCounter> counter_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(BrowsingDataCounterTest, NoResponse) {
diff --git a/components/browsing_data/core/history_notice_utils_unittest.cc b/components/browsing_data/core/history_notice_utils_unittest.cc index 2aacba6..9e19f736 100644 --- a/components/browsing_data/core/history_notice_utils_unittest.cc +++ b/components/browsing_data/core/history_notice_utils_unittest.cc
@@ -60,7 +60,7 @@ std::unique_ptr<syncer::TestSyncService> sync_service_; std::unique_ptr<history::FakeWebHistoryService> history_service_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(HistoryNoticeUtilsTest, NotSyncing) {
diff --git a/components/captive_portal/captive_portal_detector_unittest.cc b/components/captive_portal/captive_portal_detector_unittest.cc index badce52..8228f13 100644 --- a/components/captive_portal/captive_portal_detector_unittest.cc +++ b/components/captive_portal/captive_portal_detector_unittest.cc
@@ -114,7 +114,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<CaptivePortalDetector> detector_; };
diff --git a/components/cast_channel/cast_message_handler_unittest.cc b/components/cast_channel/cast_message_handler_unittest.cc index f835e3c6..f0613333 100644 --- a/components/cast_channel/cast_message_handler_unittest.cc +++ b/components/cast_channel/cast_message_handler_unittest.cc
@@ -73,8 +73,7 @@ class CastMessageHandlerTest : public testing::Test { public: CastMessageHandlerTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), cast_socket_service_(new base::TestSimpleTaskRunner()), handler_(&cast_socket_service_, /* connector */ nullptr,
diff --git a/components/cast_channel/cast_transport_unittest.cc b/components/cast_channel/cast_transport_unittest.cc index 1b3fb37..4b5ec71 100644 --- a/components/cast_channel/cast_transport_unittest.cc +++ b/components/cast_channel/cast_transport_unittest.cc
@@ -166,7 +166,7 @@ run_loop.RunUntilIdle(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; MockCastTransportDelegate* delegate_; MockSocket mock_socket_; Logger* logger_;
diff --git a/components/cast_channel/keep_alive_delegate_unittest.cc b/components/cast_channel/keep_alive_delegate_unittest.cc index 7b4c25cb..99ce35f 100644 --- a/components/cast_channel/keep_alive_delegate_unittest.cc +++ b/components/cast_channel/keep_alive_delegate_unittest.cc
@@ -98,7 +98,7 @@ run_loop.RunUntilIdle(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; MockCastSocket socket_; std::unique_ptr<KeepAliveDelegate> keep_alive_; scoped_refptr<Logger> logger_;
diff --git a/components/certificate_transparency/chrome_require_ct_delegate_unittest.cc b/components/certificate_transparency/chrome_require_ct_delegate_unittest.cc index b0df303..7242c3c 100644 --- a/components/certificate_transparency/chrome_require_ct_delegate_unittest.cc +++ b/components/certificate_transparency/chrome_require_ct_delegate_unittest.cc
@@ -39,8 +39,8 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; scoped_refptr<net::X509Certificate> cert_; net::HashValueVector hashes_; };
diff --git a/components/chromeos_camera/jpeg_encode_accelerator_unittest.cc b/components/chromeos_camera/jpeg_encode_accelerator_unittest.cc index fe03912..c200df1 100644 --- a/components/chromeos_camera/jpeg_encode_accelerator_unittest.cc +++ b/components/chromeos_camera/jpeg_encode_accelerator_unittest.cc
@@ -160,7 +160,7 @@ }; void JpegEncodeAcceleratorTestEnvironment::SetUp() { - // Since base::test::ScopedTaskEnvironment will call + // Since base::test::TaskEnvironment will call // TestTimeouts::action_max_timeout(), TestTimeouts::Initialize() needs to be // called in advance. TestTimeouts::Initialize(); @@ -680,7 +680,7 @@ // This is needed to allow the usage of methods in post_task.h in // JpegEncodeAccelerator implementations. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // The elements of |test_aligned_images_| and |test_images_| are // owned by JpegEncodeAcceleratorTestEnvironment.
diff --git a/components/chromeos_camera/mojo_mjpeg_decode_accelerator_service_unittest.cc b/components/chromeos_camera/mojo_mjpeg_decode_accelerator_service_unittest.cc index ff7af02e..1cf4f201 100644 --- a/components/chromeos_camera/mojo_mjpeg_decode_accelerator_service_unittest.cc +++ b/components/chromeos_camera/mojo_mjpeg_decode_accelerator_service_unittest.cc
@@ -46,7 +46,7 @@ private: // This is required to allow base::ThreadTaskRunnerHandle::Get() from the // test execution thread. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(MojoMjpegDecodeAcceleratorServiceTest, InitializeAndDecode) {
diff --git a/components/component_updater/component_installer_unittest.cc b/components/component_updater/component_installer_unittest.cc index f963f8b..f67f37a6 100644 --- a/components/component_updater/component_installer_unittest.cc +++ b/components/component_updater/component_installer_unittest.cc
@@ -200,7 +200,7 @@ void Unpack(const base::FilePath& crx_path); ComponentUnpacker::Result result() const { return result_; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: void UnpackComplete(const ComponentUnpacker::Result& result); @@ -357,7 +357,7 @@ EXPECT_EQ(0, result.error); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(base::PathExists(unpack_path)); EXPECT_CALL(update_client(), Stop()).Times(1); @@ -388,7 +388,7 @@ result.error); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(base::PathExists(unpack_path)); EXPECT_CALL(update_client(), Stop()).Times(1);
diff --git a/components/component_updater/component_updater_service_unittest.cc b/components/component_updater/component_updater_service_unittest.cc index 42552e6..a73b9ef 100644 --- a/components/component_updater/component_updater_service_unittest.cc +++ b/components/component_updater/component_updater_service_unittest.cc
@@ -165,7 +165,7 @@ const UpdateScheduler::UserTask& user_task, const UpdateScheduler::OnStopTaskCallback& on_stop); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop runloop_; scoped_refptr<TestConfigurator> config_ = @@ -257,7 +257,7 @@ void ComponentUpdaterTest::RunUpdateTask( const UpdateScheduler::UserTask& user_task) { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindRepeating( [](const UpdateScheduler::UserTask& user_task, ComponentUpdaterTest* test) {
diff --git a/components/component_updater/timer_unittest.cc b/components/component_updater/timer_unittest.cc index 9d5c63ea..956cdefe 100644 --- a/components/component_updater/timer_unittest.cc +++ b/components/component_updater/timer_unittest.cc
@@ -19,12 +19,11 @@ class ComponentUpdaterTimerTest : public testing::Test { public: ComponentUpdaterTimerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~ComponentUpdaterTimerTest() override {} private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(ComponentUpdaterTimerTest, Start) {
diff --git a/components/consent_auditor/consent_sync_bridge_impl_unittest.cc b/components/consent_auditor/consent_sync_bridge_impl_unittest.cc index 8a46ab5..e8c8b58e 100644 --- a/components/consent_auditor/consent_sync_bridge_impl_unittest.cc +++ b/components/consent_auditor/consent_sync_bridge_impl_unittest.cc
@@ -164,7 +164,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; testing::NiceMock<MockModelTypeChangeProcessor> mock_processor_; std::unique_ptr<ConsentSyncBridgeImpl> bridge_; };
diff --git a/components/content_capture/common/content_capture_mojom_traits_unittest.cc b/components/content_capture/common/content_capture_mojom_traits_unittest.cc index f30bf75c..a655319 100644 --- a/components/content_capture/common/content_capture_mojom_traits_unittest.cc +++ b/components/content_capture/common/content_capture_mojom_traits_unittest.cc
@@ -32,7 +32,7 @@ std::move(callback).Run(i); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::BindingSet<TraitsTestService> traits_test_bindings_; DISALLOW_COPY_AND_ASSIGN(ContentCaptureStructTraitsTest);
diff --git a/components/content_settings/core/browser/BUILD.gn b/components/content_settings/core/browser/BUILD.gn index 90aa5e8f..3918713 100644 --- a/components/content_settings/core/browser/BUILD.gn +++ b/components/content_settings/core/browser/BUILD.gn
@@ -110,6 +110,7 @@ "//components/prefs:test_support", "//components/sync_preferences:test_support", "//extensions/buildflags", + "//net", "//ppapi/buildflags:buildflags", "//testing/gmock", "//testing/gtest",
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc index fed77bf..b60c49a9 100644 --- a/components/content_settings/core/browser/content_settings_registry.cc +++ b/components/content_settings/core/browser/content_settings_registry.cc
@@ -14,6 +14,7 @@ #include "components/content_settings/core/browser/content_settings_utils.h" #include "components/content_settings/core/browser/website_settings_registry.h" #include "components/content_settings/core/common/content_settings.h" +#include "net/cookies/cookie_util.h" #if defined(OS_ANDROID) #include "media/base/android/media_drm_bridge.h" @@ -349,13 +350,16 @@ ContentSettingsInfo::PERSISTENT, ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS); + ContentSetting legacy_cookie_access_initial_default = + net::cookie_util::IsSameSiteByDefaultCookiesEnabled() + ? CONTENT_SETTING_BLOCK + : CONTENT_SETTING_ALLOW; Register(CONTENT_SETTINGS_TYPE_LEGACY_COOKIE_ACCESS, "legacy-cookie-access", - CONTENT_SETTING_BLOCK, WebsiteSettingsInfo::UNSYNCABLE, - WhitelistedSchemes(), + legacy_cookie_access_initial_default, + WebsiteSettingsInfo::UNSYNCABLE, WhitelistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, - WebsiteSettingsRegistry::DESKTOP | - WebsiteSettingsRegistry::PLATFORM_ANDROID, + WebsiteSettingsRegistry::ALL_PLATFORMS, ContentSettingsInfo::INHERIT_IN_INCOGNITO, ContentSettingsInfo::PERSISTENT, ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS);
diff --git a/components/content_settings/core/browser/cookie_settings.cc b/components/content_settings/core/browser/cookie_settings.cc index 44b4fc0..98c234d 100644 --- a/components/content_settings/core/browser/cookie_settings.cc +++ b/components/content_settings/core/browser/cookie_settings.cc
@@ -17,8 +17,6 @@ #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h" #include "extensions/buildflags/buildflags.h" -#include "net/base/net_errors.h" -#include "net/base/static_cookie_policy.h" #include "url/gurl.h" namespace content_settings { @@ -118,15 +116,27 @@ return setting == CONTENT_SETTING_ALLOW; } +void CookieSettings::GetSettingForLegacyCookieAccess( + const GURL& cookie_domain, + ContentSetting* setting) const { + DCHECK(setting); + + *setting = host_content_settings_map_->GetContentSetting( + cookie_domain, GURL(), CONTENT_SETTINGS_TYPE_LEGACY_COOKIE_ACCESS, + std::string() /* resource_identifier */); +} + void CookieSettings::ShutdownOnUIThread() { DCHECK(thread_checker_.CalledOnValidThread()); pref_change_registrar_.RemoveAll(); } -void CookieSettings::GetCookieSetting(const GURL& url, - const GURL& first_party_url, - content_settings::SettingSource* source, - ContentSetting* cookie_setting) const { +void CookieSettings::GetCookieSettingInternal( + const GURL& url, + const GURL& first_party_url, + bool is_third_party_request, + content_settings::SettingSource* source, + ContentSetting* cookie_setting) const { DCHECK(cookie_setting); // Auto-allow in extensions or for WebUI embedded in a secure origin. if (first_party_url.SchemeIs(kChromeUIScheme) && @@ -158,14 +168,11 @@ info.secondary_pattern.MatchesAllHosts() && ShouldBlockThirdPartyCookies() && !first_party_url.SchemeIs(extension_scheme_); - net::StaticCookiePolicy policy( - net::StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES); // We should always have a value, at least from the default provider. DCHECK(value); ContentSetting setting = ValueToContentSetting(value.get()); - bool block = - block_third && policy.CanAccessCookies(url, first_party_url) != net::OK; + bool block = block_third && is_third_party_request; *cookie_setting = block ? CONTENT_SETTING_BLOCK : setting; } @@ -182,6 +189,9 @@ pref_change_registrar_.prefs()->GetBoolean( prefs::kCookieControlsEnabled)); + // Safe to read |block_third_party_cookies_| without locking here because the + // only place that writes to it is this method and it will always be run on + // the same thread. if (block_third_party_cookies_ != new_block_third_party_cookies) { { base::AutoLock auto_lock(lock_);
diff --git a/components/content_settings/core/browser/cookie_settings.h b/components/content_settings/core/browser/cookie_settings.h index 481987c..bd5a2c9 100644 --- a/components/content_settings/core/browser/cookie_settings.h +++ b/components/content_settings/core/browser/cookie_settings.h
@@ -102,17 +102,15 @@ // This method may be called on any thread. bool ShouldBlockThirdPartyCookies() const; + // content_settings::CookieSettingsBase: + void GetSettingForLegacyCookieAccess(const GURL& cookie_domain, + ContentSetting* setting) const override; + // Detaches the |CookieSettings| from |PrefService|. This methods needs to be // called before destroying the service. Afterwards, only const methods can be // called. void ShutdownOnUIThread() override; - // content_settings::CookieSettingsBase: - void GetCookieSetting(const GURL& url, - const GURL& first_party_url, - content_settings::SettingSource* source, - ContentSetting* cookie_setting) const override; - static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); void AddObserver(Observer* obs) { observers_.AddObserver(obs); } @@ -122,6 +120,13 @@ private: ~CookieSettings() override; + // content_settings::CookieSettingsBase: + void GetCookieSettingInternal(const GURL& url, + const GURL& first_party_url, + bool is_third_party_request, + content_settings::SettingSource* source, + ContentSetting* cookie_setting) const override; + void OnCookiePreferencesChanged(); base::ThreadChecker thread_checker_;
diff --git a/components/content_settings/core/browser/cookie_settings_unittest.cc b/components/content_settings/core/browser/cookie_settings_unittest.cc index 4f2a18a99..0b218a6 100644 --- a/components/content_settings/core/browser/cookie_settings_unittest.cc +++ b/components/content_settings/core/browser/cookie_settings_unittest.cc
@@ -7,12 +7,18 @@ #include "base/scoped_observer.h" #include "base/test/scoped_feature_list.h" #include "base/test/scoped_task_environment.h" +#include "components/content_settings/core/browser/content_settings_registry.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/common/content_settings_pattern.h" #include "components/content_settings/core/common/features.h" #include "components/content_settings/core/common/pref_names.h" +#include "components/content_settings/core/test/content_settings_mock_provider.h" +#include "components/content_settings/core/test/content_settings_test_utils.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "extensions/buildflags/buildflags.h" +#include "net/base/features.h" +#include "net/cookies/cookie_constants.h" +#include "net/cookies/cookie_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" @@ -55,11 +61,19 @@ kDomain("example.com"), kDotDomain(".example.com"), kSubDomain("www.example.com"), + kOtherDomain("www.not-example.com"), + kDomainWildcardPattern("[*.]example.com"), kHttpSite("http://example.com"), kHttpsSite("https://example.com"), kHttpsSubdomainSite("https://www.example.com"), kHttpsSite8080("https://example.com:8080"), kAllHttpsSitesPattern(ContentSettingsPattern::FromString("https://*")) { + } + + ~CookieSettingsTest() override { settings_map_->ShutdownOnUIThread(); } + + void SetUp() override { + ContentSettingsRegistry::GetInstance()->ResetForTest(); CookieSettings::RegisterProfilePrefs(prefs_.registry()); HostContentSettingsMap::RegisterProfilePrefs(prefs_.registry()); settings_map_ = new HostContentSettingsMap( @@ -69,8 +83,6 @@ new CookieSettings(settings_map_.get(), &prefs_, "chrome-extension"); } - ~CookieSettingsTest() override { settings_map_->ShutdownOnUIThread(); } - protected: bool ShouldDeleteCookieOnExit(const std::string& domain, bool is_https) { ContentSettingsForOneType settings; @@ -81,7 +93,7 @@ // There must be a valid ThreadTaskRunnerHandle in HostContentSettingsMap's // scope. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable prefs_; scoped_refptr<HostContentSettingsMap> settings_map_; @@ -94,6 +106,8 @@ const std::string kDomain; const std::string kDotDomain; const std::string kSubDomain; + const std::string kOtherDomain; + const std::string kDomainWildcardPattern; const GURL kHttpSite; const GURL kHttpsSite; const GURL kHttpsSubdomainSite; @@ -416,6 +430,182 @@ EXPECT_TRUE(observer.last_value()); } +TEST_F(CookieSettingsTest, LegacyCookieAccessAllowAll) { + settings_map_->SetDefaultContentSetting( + CONTENT_SETTINGS_TYPE_LEGACY_COOKIE_ACCESS, CONTENT_SETTING_ALLOW); + EXPECT_EQ( + net::CookieAccessSemantics::LEGACY, + cookie_settings_->GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL(kDomain, true /* is_https */))); + EXPECT_EQ(net::CookieAccessSemantics::LEGACY, + cookie_settings_->GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL(kDotDomain, + true /* is_https */))); +} + +TEST_F(CookieSettingsTest, LegacyCookieAccessBlockAll) { + settings_map_->SetDefaultContentSetting( + CONTENT_SETTINGS_TYPE_LEGACY_COOKIE_ACCESS, CONTENT_SETTING_BLOCK); + EXPECT_EQ( + net::CookieAccessSemantics::NONLEGACY, + cookie_settings_->GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL(kDomain, true /* is_https */))); + EXPECT_EQ(net::CookieAccessSemantics::NONLEGACY, + cookie_settings_->GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL(kDotDomain, + false /* is_https */))); +} + +// Test SameSite-by-default disabled (default semantics is LEGACY) +// TODO(crbug.com/953306): Remove this when legacy code path is removed. +TEST_F(CookieSettingsTest, + LegacyCookieAccessAllowDomainPattern_SameSiteByDefaultDisabled) { + // Override the policy provider for this test, since the legacy cookie access + // setting can only be set by policy. + TestUtils::OverrideProvider( + settings_map_.get(), std::make_unique<MockProvider>(), + HostContentSettingsMap::ProviderType::POLICY_PROVIDER); + settings_map_->SetContentSettingCustomScope( + ContentSettingsPattern::FromString(kDomain), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_LEGACY_COOKIE_ACCESS, std::string(), + CONTENT_SETTING_BLOCK); + const struct { + net::CookieAccessSemantics status; + std::string cookie_domain; + } kTestCases[] = { + // These two test cases are NONLEGACY because they match the setting. + {net::CookieAccessSemantics::NONLEGACY, kDomain}, + {net::CookieAccessSemantics::NONLEGACY, kDotDomain}, + // These two test cases default into LEGACY. + // Subdomain does not match pattern. + {net::CookieAccessSemantics::LEGACY, kSubDomain}, + {net::CookieAccessSemantics::LEGACY, kOtherDomain}}; + for (const auto& test : kTestCases) { + EXPECT_EQ(test.status, cookie_settings_->GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, true /* is_https */))); + EXPECT_EQ(test.status, cookie_settings_->GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, false /* is_https */))); + } +} + +// Test SameSite-by-default disabled (default semantics is LEGACY) +// TODO(crbug.com/953306): Remove this when legacy code path is removed. +TEST_F(CookieSettingsTest, + LegacyCookieAccessAllowDomainWildcardPattern_SameSiteByDefaultDisabled) { + // Override the policy provider for this test, since the legacy cookie access + // setting can only be set by policy. + TestUtils::OverrideProvider( + settings_map_.get(), std::make_unique<MockProvider>(), + HostContentSettingsMap::ProviderType::POLICY_PROVIDER); + settings_map_->SetContentSettingCustomScope( + ContentSettingsPattern::FromString(kDomainWildcardPattern), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_LEGACY_COOKIE_ACCESS, std::string(), + CONTENT_SETTING_BLOCK); + const struct { + net::CookieAccessSemantics status; + std::string cookie_domain; + } kTestCases[] = { + // These three test cases are NONLEGACY because they match the setting. + {net::CookieAccessSemantics::NONLEGACY, kDomain}, + {net::CookieAccessSemantics::NONLEGACY, kDotDomain}, + // Subdomain matches pattern. + {net::CookieAccessSemantics::NONLEGACY, kSubDomain}, + // This test case defaults into LEGACY. + {net::CookieAccessSemantics::LEGACY, kOtherDomain}}; + for (const auto& test : kTestCases) { + EXPECT_EQ(test.status, cookie_settings_->GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, true /* is_https */))); + EXPECT_EQ(test.status, cookie_settings_->GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, false /* is_https */))); + } +} + +// Test fixture with SameSiteByDefaultCookies enabled. +class SameSiteByDefaultCookieSettingsTest : public CookieSettingsTest { + public: + SameSiteByDefaultCookieSettingsTest() : CookieSettingsTest() { + feature_list_.InitAndEnableFeature( + net::features::kSameSiteByDefaultCookies); + } + + private: + base::test::ScopedFeatureList feature_list_; +}; + +// Test SameSite-by-default enabled (default semantics is NONLEGACY) +TEST_F(SameSiteByDefaultCookieSettingsTest, + LegacyCookieAccessAllowDomainPattern_SameSiteByDefaultEnabled) { + // Override the policy provider for this test, since the legacy cookie access + // setting can only be set by policy. + TestUtils::OverrideProvider( + settings_map_.get(), std::make_unique<MockProvider>(), + HostContentSettingsMap::ProviderType::POLICY_PROVIDER); + settings_map_->SetContentSettingCustomScope( + ContentSettingsPattern::FromString(kDomain), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_LEGACY_COOKIE_ACCESS, std::string(), + CONTENT_SETTING_ALLOW); + const struct { + net::CookieAccessSemantics status; + std::string cookie_domain; + } kTestCases[] = { + // These two test cases are LEGACY because they match the setting. + {net::CookieAccessSemantics::LEGACY, kDomain}, + {net::CookieAccessSemantics::LEGACY, kDotDomain}, + // These two test cases default into NONLEGACY. + // Subdomain does not match pattern. + {net::CookieAccessSemantics::NONLEGACY, kSubDomain}, + {net::CookieAccessSemantics::NONLEGACY, kOtherDomain}}; + for (const auto& test : kTestCases) { + EXPECT_EQ(test.status, cookie_settings_->GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, true /* is_https */))); + EXPECT_EQ(test.status, cookie_settings_->GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, false /* is_https */))); + } +} + +// Test SameSite-by-default enabled (default semantics is NONLEGACY) +TEST_F(SameSiteByDefaultCookieSettingsTest, + LegacyCookieAccessAllowDomainWildcardPattern_SameSiteByDefaultEnabled) { + // Override the policy provider for this test, since the legacy cookie access + // setting can only be set by policy. + TestUtils::OverrideProvider( + settings_map_.get(), std::make_unique<MockProvider>(), + HostContentSettingsMap::ProviderType::POLICY_PROVIDER); + settings_map_->SetContentSettingCustomScope( + ContentSettingsPattern::FromString(kDomainWildcardPattern), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_LEGACY_COOKIE_ACCESS, std::string(), + CONTENT_SETTING_ALLOW); + const struct { + net::CookieAccessSemantics status; + std::string cookie_domain; + } kTestCases[] = { + // These three test cases are LEGACY because they match the setting. + {net::CookieAccessSemantics::LEGACY, kDomain}, + {net::CookieAccessSemantics::LEGACY, kDotDomain}, + // Subdomain matches pattern. + {net::CookieAccessSemantics::LEGACY, kSubDomain}, + // This test case defaults into NONLEGACY. + {net::CookieAccessSemantics::NONLEGACY, kOtherDomain}}; + for (const auto& test : kTestCases) { + EXPECT_EQ(test.status, cookie_settings_->GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, true /* is_https */))); + EXPECT_EQ(test.status, cookie_settings_->GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, false /* is_https */))); + } +} + } // namespace } // namespace content_settings
diff --git a/components/content_settings/core/common/BUILD.gn b/components/content_settings/core/common/BUILD.gn index f396acdb2..78123bb 100644 --- a/components/content_settings/core/common/BUILD.gn +++ b/components/content_settings/core/common/BUILD.gn
@@ -18,14 +18,16 @@ "content_settings_utils.h", "cookie_settings_base.cc", "cookie_settings_base.h", - "features.cc", - "features.h", "pref_names.cc", "pref_names.h", ] configs += [ "//build/config/compiler:wexit_time_destructors" ] + public_deps = [ + ":features", + ] + deps = [ "//base", "//mojo/public/cpp/base", @@ -62,3 +64,18 @@ "//mojo/public/mojom/base", ] } + +component("features") { + output_name = "content_settings_features" + + defines = [ "IS_CONTENT_SETTINGS_FEATURES_IMPL" ] + + sources = [ + "features.cc", + "features.h", + ] + + deps = [ + "//base", + ] +}
diff --git a/components/content_settings/core/common/DEPS b/components/content_settings/core/common/DEPS index 7aab713..43d061f8 100644 --- a/components/content_settings/core/common/DEPS +++ b/components/content_settings/core/common/DEPS
@@ -3,6 +3,7 @@ "+mojo/public/cpp/bindings", "+net/base", "+net/cookies/cookie_util.h", + "+net/cookies/cookie_constants.h", "+testing", "+url", ]
diff --git a/components/content_settings/core/common/cookie_settings_base.cc b/components/content_settings/core/common/cookie_settings_base.cc index e4909a9..afbff06 100644 --- a/components/content_settings/core/common/cookie_settings_base.cc +++ b/components/content_settings/core/common/cookie_settings_base.cc
@@ -3,10 +3,25 @@ // found in the LICENSE file. #include "components/content_settings/core/common/cookie_settings_base.h" + +#include "base/debug/stack_trace.h" +#include "base/debug/task_trace.h" +#include "base/feature_list.h" +#include "base/logging.h" +#include "components/content_settings/core/common/features.h" +#include "net/base/net_errors.h" +#include "net/base/static_cookie_policy.h" #include "net/cookies/cookie_util.h" #include "url/gurl.h" namespace content_settings { +namespace { +bool IsThirdPartyRequest(const GURL& url, const GURL& site_for_cookies) { + net::StaticCookiePolicy policy( + net::StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES); + return policy.CanAccessCookies(url, site_for_cookies) != net::OK; +} +} // namespace bool CookieSettingsBase::ShouldDeleteCookieOnExit( const ContentSettingsForOneType& cookie_settings, @@ -38,14 +53,45 @@ return setting == CONTENT_SETTING_SESSION_ONLY || matches_session_only_rule; } +void CookieSettingsBase::GetCookieSetting( + const GURL& url, + const GURL& first_party_url, + content_settings::SettingSource* source, + ContentSetting* cookie_setting) const { + GetCookieSettingInternal(url, first_party_url, + IsThirdPartyRequest(url, first_party_url), source, + cookie_setting); +} + bool CookieSettingsBase::IsCookieAccessAllowed( const GURL& url, const GURL& first_party_url) const { + DCHECK(!base::FeatureList::IsEnabled(kImprovedCookieControls) || + !first_party_url.is_empty() || url.is_empty()) + << url; ContentSetting setting; GetCookieSetting(url, first_party_url, nullptr, &setting); return IsAllowed(setting); } +bool CookieSettingsBase::IsCookieAccessAllowed( + const GURL& url, + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const { + // TODO(crbug.com/988398): top_frame_origin is not yet always available. + // Ensure that the DCHECK always passes and remove the FeatureList check. + if (!base::FeatureList::IsEnabled(kImprovedCookieControls)) + return IsCookieAccessAllowed(url, site_for_cookies); + DCHECK(top_frame_origin || site_for_cookies.is_empty()) + << url << " " << site_for_cookies; + + ContentSetting setting; + GetCookieSettingInternal( + url, top_frame_origin ? top_frame_origin->GetURL() : GURL(), + IsThirdPartyRequest(url, site_for_cookies), nullptr, &setting); + return IsAllowed(setting); +} + bool CookieSettingsBase::IsCookieSessionOnly(const GURL& origin) const { ContentSetting setting; GetCookieSetting(origin, origin, nullptr, &setting); @@ -53,6 +99,23 @@ return setting == CONTENT_SETTING_SESSION_ONLY; } +net::CookieAccessSemantics +CookieSettingsBase::GetCookieAccessSemanticsForDomain( + const GURL& cookie_domain) const { + ContentSetting setting; + GetSettingForLegacyCookieAccess(cookie_domain, &setting); + DCHECK(IsValidSettingForLegacyAccess(setting)); + switch (setting) { + case CONTENT_SETTING_ALLOW: + return net::CookieAccessSemantics::LEGACY; + case CONTENT_SETTING_BLOCK: + return net::CookieAccessSemantics::NONLEGACY; + default: + NOTREACHED(); + } + return net::CookieAccessSemantics::UNKNOWN; +} + // static bool CookieSettingsBase::IsValidSetting(ContentSetting setting) { return (setting == CONTENT_SETTING_ALLOW || @@ -67,4 +130,9 @@ setting == CONTENT_SETTING_SESSION_ONLY); } +// static +bool CookieSettingsBase::IsValidSettingForLegacyAccess(ContentSetting setting) { + return (setting == CONTENT_SETTING_ALLOW || setting == CONTENT_SETTING_BLOCK); +} + } // namespace content_settings
diff --git a/components/content_settings/core/common/cookie_settings_base.h b/components/content_settings/core/common/cookie_settings_base.h index e2318177..e410e0d 100644 --- a/components/content_settings/core/common/cookie_settings_base.h +++ b/components/content_settings/core/common/cookie_settings_base.h
@@ -7,10 +7,54 @@ #include <string> +#include "base/optional.h" #include "components/content_settings/core/common/content_settings.h" +#include "net/cookies/cookie_constants.h" + +namespace url { +class Origin; +} namespace content_settings { +// Many CookieSettings methods handle the parameters |url|, |site_for_cookies| +// |top_frame_origin| and |first_party_url|. +// +// |url| is the URL of the requested resource. +// |site_for_cookies| is usually the URL shown in the omnibox but can also be +// empty, e.g. for subresource loads initiated from cross-site iframes, and is +// used to determine if a request is done in a third-party context. +// |top_frame_origin| is the origin shown in the omnibox. +// +// Example: +// https://a.com/index.html +// <html> +// <body> +// <iframe href="https://b.com/frame.html"> +// <img href="https://a.com/img.jpg> +// <img href="https://b.com/img.jpg> +// <img href="https://c.com/img.jpg> +// </iframe> +// </body> +// </html> +// +// When each of these resources get fetched, |top_frame_origin| will always be +// "https://a.com" and |site_for_cookies| is set the following: +// https://a.com/index.html -> https://a.com/ (1p request) +// https://b.com/frame.html -> https://a.com/ (3p request) +// https://a.com/img.jpg -> <empty-url> (treated as 3p request) +// https://b.com/img.jpg -> <empty-url> (3p because from cross site iframe) +// https://c.com/img.jpg -> <empty-url> (3p request in cross site iframe) +// +// Content settings can be used to allow or block access to cookies. +// When third-party cookies are blocked, an ALLOW setting will give access to +// cookies in third-party contexts. +// The primary pattern of each setting is matched against |url|. +// The secondary pattern is matched against |top_frame_origin|. +// +// Some methods only take |url| and |first_party_url|. For |first_party_url|, +// clients either pass a value that is like |site_for_cookies| or +// |top_frame_origin|. This is done inconsistently and needs to be fixed. class CookieSettingsBase { public: CookieSettingsBase() = default; @@ -31,12 +75,25 @@ bool is_https) const; // Returns true if the page identified by (|url|, |first_party_url|) is - // allowed to access (i.e., read or write) cookies. + // allowed to access (i.e., read or write) cookies. |first_party_url| + // is used to determine third-party-ness of |url|. // // This may be called on any thread. + // DEPRECATED: Replace with IsCookieAccessAllowed(GURL, GURL, Origin). bool IsCookieAccessAllowed(const GURL& url, const GURL& first_party_url) const; + // Similar to IsCookieAccessAllowed(GURL, GURL) but provides a mechanism + // to specify a separate |site_for_cookies|, which is used to determine + // whether a request is in a third_party context and |top_frame_origin|, which + // is used to check if there are any content_settings exceptions. + // |top_frame_origin| should at least be specified when |site_for_cookies| is + // non-empty. + bool IsCookieAccessAllowed( + const GURL& url, + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const; + // Returns true if the cookie set by a page identified by |url| should be // session only. Querying this only makes sense if |IsCookieAccessAllowed| // has returned true. @@ -45,17 +102,41 @@ bool IsCookieSessionOnly(const GURL& url) const; // A helper for applying third party cookie blocking rules. - virtual void GetCookieSetting(const GURL& url, - const GURL& first_party_url, - content_settings::SettingSource* source, - ContentSetting* cookie_setting) const = 0; + void GetCookieSetting(const GURL& url, + const GURL& first_party_url, + content_settings::SettingSource* source, + ContentSetting* cookie_setting) const; + + // Returns the cookie access semantics (legacy or nonlegacy) to be applied for + // cookies on the given domain. + // + // This may be called on any thread. + net::CookieAccessSemantics GetCookieAccessSemanticsForDomain( + const GURL& cookie_domain) const; + + // Gets the setting that controls whether legacy access is allowed for a given + // cookie domain (provided as a URL). + virtual void GetSettingForLegacyCookieAccess( + const GURL& cookie_domain, + ContentSetting* setting) const = 0; // Determines whether |setting| is a valid content setting for cookies. static bool IsValidSetting(ContentSetting setting); // Determines whether |setting| means the cookie should be allowed. static bool IsAllowed(ContentSetting setting); + // Determines whether |setting| is a valid content setting for legacy cookie + // access. + static bool IsValidSettingForLegacyAccess(ContentSetting setting); + private: + virtual void GetCookieSettingInternal( + const GURL& url, + const GURL& first_party_url, + bool is_third_party_request, + content_settings::SettingSource* source, + ContentSetting* cookie_setting) const = 0; + DISALLOW_COPY_AND_ASSIGN(CookieSettingsBase); };
diff --git a/components/content_settings/core/common/cookie_settings_base_unittest.cc b/components/content_settings/core/common/cookie_settings_base_unittest.cc index 0d960de..a606322f 100644 --- a/components/content_settings/core/common/cookie_settings_base_unittest.cc +++ b/components/content_settings/core/common/cookie_settings_base_unittest.cc
@@ -29,12 +29,17 @@ : callback_(std::move(callback)) {} // CookieSettingsBase: - void GetCookieSetting(const GURL& url, - const GURL& first_party_url, - content_settings::SettingSource* source, - ContentSetting* cookie_setting) const override { + void GetCookieSettingInternal(const GURL& url, + const GURL& first_party_url, + bool is_third_party_request, + content_settings::SettingSource* source, + ContentSetting* cookie_setting) const override { *cookie_setting = callback_.Run(url); } + void GetSettingForLegacyCookieAccess(const GURL& cookie_domain, + ContentSetting* setting) const override { + *setting = callback_.Run(cookie_domain); + } private: GetSettingCallback callback_; @@ -102,37 +107,48 @@ TEST(CookieSettingsBaseTest, CookieAccessNotAllowedWithBlockedSetting) { CallbackCookieSettings settings( base::BindRepeating([](const GURL&) { return CONTENT_SETTING_BLOCK; })); - EXPECT_FALSE(settings.IsCookieAccessAllowed(GURL(), GURL())); + EXPECT_FALSE(settings.IsCookieAccessAllowed(GURL(kDomain), GURL(kDomain))); } TEST(CookieSettingsBaseTest, CookieAccessAllowedWithAllowSetting) { CallbackCookieSettings settings( base::BindRepeating([](const GURL&) { return CONTENT_SETTING_ALLOW; })); - EXPECT_TRUE(settings.IsCookieAccessAllowed(GURL(), GURL())); + EXPECT_TRUE(settings.IsCookieAccessAllowed(GURL(kDomain), GURL(kDomain))); } TEST(CookieSettingsBaseTest, CookieAccessAllowedWithSessionOnlySetting) { CallbackCookieSettings settings(base::BindRepeating( [](const GURL&) { return CONTENT_SETTING_SESSION_ONLY; })); - EXPECT_TRUE(settings.IsCookieAccessAllowed(GURL(), GURL())); + EXPECT_TRUE(settings.IsCookieAccessAllowed(GURL(kDomain), GURL(kDomain))); +} + +TEST(CookieSettingsBaseTest, LegacyCookieAccessSemantics) { + CallbackCookieSettings settings1( + base::BindRepeating([](const GURL&) { return CONTENT_SETTING_ALLOW; })); + EXPECT_EQ(net::CookieAccessSemantics::LEGACY, + settings1.GetCookieAccessSemanticsForDomain(GURL())); + CallbackCookieSettings settings2( + base::BindRepeating([](const GURL&) { return CONTENT_SETTING_BLOCK; })); + EXPECT_EQ(net::CookieAccessSemantics::NONLEGACY, + settings2.GetCookieAccessSemanticsForDomain(GURL())); } TEST(CookieSettingsBaseTest, IsCookieSessionOnlyWithAllowSetting) { CallbackCookieSettings settings( base::BindRepeating([](const GURL&) { return CONTENT_SETTING_ALLOW; })); - EXPECT_FALSE(settings.IsCookieSessionOnly(GURL())); + EXPECT_FALSE(settings.IsCookieSessionOnly(GURL(kDomain))); } TEST(CookieSettingsBaseTest, IsCookieSessionOnlyWithBlockSetting) { CallbackCookieSettings settings( base::BindRepeating([](const GURL&) { return CONTENT_SETTING_BLOCK; })); - EXPECT_FALSE(settings.IsCookieSessionOnly(GURL())); + EXPECT_FALSE(settings.IsCookieSessionOnly(GURL(kDomain))); } TEST(CookieSettingsBaseTest, IsCookieSessionOnlySessionWithOnlySetting) { CallbackCookieSettings settings(base::BindRepeating( [](const GURL&) { return CONTENT_SETTING_SESSION_ONLY; })); - EXPECT_TRUE(settings.IsCookieSessionOnly(GURL())); + EXPECT_TRUE(settings.IsCookieSessionOnly(GURL(kDomain))); } TEST(CookieSettingsBaseTest, IsValidSetting) { @@ -149,5 +165,18 @@ EXPECT_TRUE(CookieSettingsBase::IsAllowed(CONTENT_SETTING_SESSION_ONLY)); } +TEST(CookieSettingsBaseTest, IsValidLegacyAccessSetting) { + EXPECT_FALSE(CookieSettingsBase::IsValidSettingForLegacyAccess( + CONTENT_SETTING_DEFAULT)); + EXPECT_FALSE( + CookieSettingsBase::IsValidSettingForLegacyAccess(CONTENT_SETTING_ASK)); + EXPECT_TRUE( + CookieSettingsBase::IsValidSettingForLegacyAccess(CONTENT_SETTING_ALLOW)); + EXPECT_TRUE( + CookieSettingsBase::IsValidSettingForLegacyAccess(CONTENT_SETTING_BLOCK)); + EXPECT_FALSE(CookieSettingsBase::IsValidSettingForLegacyAccess( + CONTENT_SETTING_SESSION_ONLY)); +} + } // namespace } // namespace content_settings
diff --git a/components/content_settings/core/common/features.h b/components/content_settings/core/common/features.h index 817b2f1c..846d495 100644 --- a/components/content_settings/core/common/features.h +++ b/components/content_settings/core/common/features.h
@@ -5,6 +5,8 @@ #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_FEATURES_H_ #define COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_FEATURES_H_ +#include "base/component_export.h" + namespace base { struct Feature; } // namespace base @@ -12,6 +14,7 @@ namespace content_settings { // Feature to enable a better cookie controls ui. +COMPONENT_EXPORT(CONTENT_SETTINGS_FEATURES) extern const base::Feature kImprovedCookieControls; } // namespace content_settings
diff --git a/components/crash/content/app/breakpad_linux.cc b/components/crash/content/app/breakpad_linux.cc index f3f9932d..505156ad 100644 --- a/components/crash/content/app/breakpad_linux.cc +++ b/components/crash/content/app/breakpad_linux.cc
@@ -1154,10 +1154,6 @@ void SetCrashLoopBeforeTime(const std::string& process_type, const base::CommandLine& parsed_command_line) { #if defined(OS_CHROMEOS) - if (!ShouldPassCrashLoopBefore(process_type)) { - return; - } - std::string crash_loop_before = parsed_command_line.GetSwitchValueASCII(switches::kCrashLoopBefore); if (crash_loop_before.empty()) { @@ -2169,21 +2165,6 @@ } #endif // OS_ANDROID -#if defined(OS_CHROMEOS) -bool ShouldPassCrashLoopBefore(const std::string& process_type) { - if (process_type == ::switches::kRendererProcess || - process_type == ::switches::kUtilityProcess || - process_type == ::switches::kPpapiPluginProcess || - process_type == service_manager::switches::kZygoteProcess) { - // These process types never cause a log-out, even if they crash. So the - // normal crash handling process should work fine; we shouldn't need to - // invoke the special crash-loop mode. - return false; - } - return true; -} -#endif // defined(OS_CHROMEOS) - bool IsCrashReporterEnabled() { return g_is_crash_reporter_enabled; }
diff --git a/components/crash/content/app/breakpad_linux.h b/components/crash/content/app/breakpad_linux.h index fb7f0a8a..6e95af6 100644 --- a/components/crash/content/app/breakpad_linux.h +++ b/components/crash/content/app/breakpad_linux.h
@@ -58,13 +58,6 @@ extern void SuppressDumpGeneration(); #endif // defined(OS_ANDROID) -#if defined(OS_CHROMEOS) -// If true, processes of this type should pass crash-loop-before down to the -// crash reporter and to their children (if the children's type is a process -// type that wants crash-loop-before). -bool ShouldPassCrashLoopBefore(const std::string& process_type); -#endif - // Checks if crash reporting is enabled. Note that this is not the same as // being opted into metrics reporting (and crash reporting), which controls // whether InitCrashReporter() is called.
diff --git a/components/crash/content/app/crashpad.h b/components/crash/content/app/crashpad.h index 2324c1eb..1ffb7f6 100644 --- a/components/crash/content/app/crashpad.h +++ b/components/crash/content/app/crashpad.h
@@ -170,6 +170,10 @@ // success. class CrashReporterClient; bool DumpWithoutCrashingForClient(CrashReporterClient* client); + +// Used under WebView to whitelist a memory range so it's accessible using +// crashpad's ProcessMemory interface. +void WhitelistMemoryRange(void* begin, size_t size); #endif // OS_ANDROID namespace internal {
diff --git a/components/crash/content/app/crashpad_android.cc b/components/crash/content/app/crashpad_android.cc index 954e8a0..59a3b3f2 100644 --- a/components/crash/content/app/crashpad_android.cc +++ b/components/crash/content/app/crashpad_android.cc
@@ -30,6 +30,7 @@ #include "base/rand_util.h" #include "base/stl_util.h" #include "base/strings/stringprintf.h" +#include "base/synchronization/lock.h" #include "build/build_config.h" #include "components/crash/android/jni_headers/PackagePaths_jni.h" #include "components/crash/content/app/crash_reporter_client.h" @@ -50,6 +51,43 @@ namespace crashpad { namespace { +class MemoryRangeWhitelist { + public: + MemoryRangeWhitelist() { + whitelist_.entries = 0; + whitelist_.size = 0; + } + + void AddEntry(VMAddress base, VMSize length) { + SanitizationMemoryRangeWhitelist::Range new_entry; + new_entry.base = base; + new_entry.length = length; + + base::AutoLock lock(lock_); + std::vector<SanitizationMemoryRangeWhitelist::Range> new_array(array_); + new_array.push_back(new_entry); + whitelist_.entries = FromPointerCast<VMAddress>(new_array.data()); + whitelist_.size += 1; + array_ = std::move(new_array); + } + + SanitizationMemoryRangeWhitelist* GetSanitizationAddress() { + return &whitelist_; + } + + static MemoryRangeWhitelist* Singleton() { + static base::NoDestructor<MemoryRangeWhitelist> singleton; + return singleton.get(); + } + + private: + base::Lock lock_; + SanitizationMemoryRangeWhitelist whitelist_; + std::vector<SanitizationMemoryRangeWhitelist::Range> array_; + + DISALLOW_COPY_AND_ASSIGN(MemoryRangeWhitelist); +}; + bool SetSanitizationInfo(crash_reporter::CrashReporterClient* client, SanitizationInformation* info) { const char* const* whitelist = nullptr; @@ -59,7 +97,8 @@ &sanitize_stacks); info->annotations_whitelist_address = FromPointerCast<VMAddress>(whitelist); info->target_module_address = FromPointerCast<VMAddress>(target_module); - info->memory_range_whitelist_address = 0; + info->memory_range_whitelist_address = FromPointerCast<VMAddress>( + MemoryRangeWhitelist::Singleton()->GetSanitizationAddress()); info->sanitize_stacks = sanitize_stacks; return whitelist != nullptr || target_module != nullptr || sanitize_stacks; } @@ -636,6 +675,12 @@ return handler_client.RequestCrashDump(info) == 0; } +void WhitelistMemoryRange(void* begin, size_t length) { + crashpad::MemoryRangeWhitelist::Singleton()->AddEntry( + crashpad::FromPointerCast<crashpad::VMAddress>(begin), + static_cast<crashpad::VMSize>(length)); +} + namespace internal { bool StartHandlerForClient(int fd) {
diff --git a/components/crash/content/browser/crash_metrics_reporter_android_unittest.cc b/components/crash/content/browser/crash_metrics_reporter_android_unittest.cc index 97330ca..35fde1c 100644 --- a/components/crash/content/browser/crash_metrics_reporter_android_unittest.cc +++ b/components/crash/content/browser/crash_metrics_reporter_android_unittest.cc
@@ -45,8 +45,7 @@ class CrashMetricsReporterTest : public testing::Test { public: CrashMetricsReporterTest() - : scoped_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : scoped_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~CrashMetricsReporterTest() override {} protected: @@ -82,7 +81,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_environment_; + base::test::TaskEnvironment scoped_environment_; DISALLOW_COPY_AND_ASSIGN(CrashMetricsReporterTest); };
diff --git a/components/cronet/android/java/src/org/chromium/net/impl/JavaUrlRequestUtils.java b/components/cronet/android/java/src/org/chromium/net/impl/JavaUrlRequestUtils.java index 9bba43b..62bb044 100644 --- a/components/cronet/android/java/src/org/chromium/net/impl/JavaUrlRequestUtils.java +++ b/components/cronet/android/java/src/org/chromium/net/impl/JavaUrlRequestUtils.java
@@ -77,14 +77,21 @@ Thread currentThread = Thread.currentThread(); InlineCheckingRunnable runnable = new InlineCheckingRunnable(command, currentThread); mDelegate.execute(runnable); + // This next read doesn't require synchronization; only the current thread could have + // written to runnable.mExecutedInline. if (runnable.mExecutedInline != null) { throw runnable.mExecutedInline; } else { // It's possible that this method is being called on an executor, and the runnable - // that - // was just queued will run on this thread after the current runnable returns. By - // nulling out the mCallingThread field, the InlineCheckingRunnable's current thread - // comparison will not fire. + // that was just queued will run on this thread after the current runnable returns. + // By nulling out the mCallingThread field, the InlineCheckingRunnable's current + // thread comparison will not fire. + // + // Java reference assignment is always atomic (no tearing, even on 64-bit VMs, see + // JLS 17.7), but other threads aren't guaranteed to ever see updates without + // something like locking, volatile, or AtomicReferences. We're ok in + // this instance, since this write only needs to be seen in the case that + // InlineCheckingRunnable.run() runs on the same thread as this execute() method. runnable.mCallingThread = null; } }
diff --git a/components/cronet/host_cache_persistence_manager_unittest.cc b/components/cronet/host_cache_persistence_manager_unittest.cc index e87ce34..ab39478c 100644 --- a/components/cronet/host_cache_persistence_manager_unittest.cc +++ b/components/cronet/host_cache_persistence_manager_unittest.cc
@@ -80,7 +80,7 @@ static const char kPrefName[]; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedMockTimeMessageLoopTaskRunner task_runner_; // The HostCache and PrefService have to outlive the
diff --git a/components/cronet/native/runnables_unittest.cc b/components/cronet/native/runnables_unittest.cc index 868d99ac..00e92ae 100644 --- a/components/cronet/native/runnables_unittest.cc +++ b/components/cronet/native/runnables_unittest.cc
@@ -43,7 +43,7 @@ bool callback_called() const { return callback_called_; } // Provide a message loop for use by TestExecutor instances. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; private: bool callback_called_ = false;
diff --git a/components/cronet/native/test/buffer_test.cc b/components/cronet/native/test/buffer_test.cc index a92129c..bf275e4 100644 --- a/components/cronet/native/test/buffer_test.cc +++ b/components/cronet/native/test/buffer_test.cc
@@ -27,8 +27,8 @@ // Provide a task environment for use by TestExecutor instances. Do not // initialize the ThreadPool as this is done by the Cronet_Engine - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY}; private: void set_on_destroy_called(bool value) { on_destroy_called_ = value; }
diff --git a/components/cronet/native/test/executors_test.cc b/components/cronet/native/test/executors_test.cc index ab92dd7..6cd59d1 100644 --- a/components/cronet/native/test/executors_test.cc +++ b/components/cronet/native/test/executors_test.cc
@@ -24,8 +24,8 @@ // Provide a task environment for use by TestExecutor instances. Do not // initialize the ThreadPool as this is done by the Cronet_Engine - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY}; private: void set_runnable_called(bool value) { runnable_called_ = value; }
diff --git a/components/cronet/native/test/url_request_test.cc b/components/cronet/native/test/url_request_test.cc index f74bc0a..02a2f79 100644 --- a/components/cronet/native/test/url_request_test.cc +++ b/components/cronet/native/test/url_request_test.cc
@@ -486,8 +486,8 @@ protected: // Provide a task environment for use by TestExecutor instances. Do not // initialize the ThreadPool as this is done by the Cronet_Engine - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY}; // Not owned, |request_finished_listener_| destroys itself when run. This // pointer is only needed to unregister the listener from the Engine in
diff --git a/components/cronet/stale_host_resolver_unittest.cc b/components/cronet/stale_host_resolver_unittest.cc index bbe32a619..335cb33 100644 --- a/components/cronet/stale_host_resolver_unittest.cc +++ b/components/cronet/stale_host_resolver_unittest.cc
@@ -131,8 +131,7 @@ class StaleHostResolverTest : public testing::Test { protected: StaleHostResolverTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), mock_network_change_notifier_( net::test::MockNetworkChangeNotifier::Create()), mock_proc_(new MockHostResolverProc(net::OK)), @@ -339,7 +338,7 @@ private: // Needed for HostResolver to run HostResolverProc callbacks. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::SimpleTestTickClock tick_clock_; std::unique_ptr<net::test::MockNetworkChangeNotifier> mock_network_change_notifier_;
diff --git a/components/cronet/url_request_context_config_unittest.cc b/components/cronet/url_request_context_config_unittest.cc index fa88471..5f39f3d33 100644 --- a/components/cronet/url_request_context_config_unittest.cc +++ b/components/cronet/url_request_context_config_unittest.cc
@@ -57,8 +57,8 @@ } // namespace TEST(URLRequestContextConfigTest, TestExperimentalOptionParsing) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::IO); // Create JSON for experimental options. base::DictionaryValue options; @@ -290,8 +290,8 @@ } TEST(URLRequestContextConfigTest, SetSupportedQuicVersion) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::IO); URLRequestContextConfig config( // Enable QUIC. @@ -343,8 +343,8 @@ } TEST(URLRequestContextConfigTest, SetUnsupportedQuicVersion) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::IO); URLRequestContextConfig config( // Enable QUIC. @@ -396,8 +396,8 @@ } TEST(URLRequestContextConfigTest, SetQuicServerMigrationOptions) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::IO); URLRequestContextConfig config( // Enable QUIC. @@ -457,8 +457,8 @@ #endif TEST(URLRequestContextConfigTest, MAYBE_SetQuicGoAwaySessionsOnIPChangeByDefault) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::IO); URLRequestContextConfig config( // Enable QUIC. @@ -519,8 +519,8 @@ #endif TEST(URLRequestContextConfigTest, MAYBE_SetQuicGoAwaySessionsOnIPChangeViaExperimentOptions) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::IO); URLRequestContextConfig config( // Enable QUIC. @@ -581,8 +581,8 @@ #endif TEST(URLRequestContextConfigTest, MAYBE_DisableQuicGoAwaySessionsOnIPChangeViaExperimentOptions) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::IO); URLRequestContextConfig config( // Enable QUIC. @@ -633,8 +633,8 @@ } TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationV2Options) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::IO); URLRequestContextConfig config( // Enable QUIC. @@ -707,8 +707,8 @@ } TEST(URLRequestContextConfigTest, SetQuicStaleDNSracing) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::IO); URLRequestContextConfig config( // Enable QUIC. @@ -758,8 +758,8 @@ } TEST(URLRequestContextConfigTest, SetQuicHostWhitelist) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::IO); URLRequestContextConfig config( // Enable QUIC. @@ -810,8 +810,8 @@ } TEST(URLRequestContextConfigTest, SetQuicMaxTimeBeforeCryptoHandshake) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::IO); URLRequestContextConfig config( // Enable QUIC. @@ -866,8 +866,8 @@ } TEST(URLURLRequestContextConfigTest, SetQuicConnectionOptions) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::IO); URLRequestContextConfig config( // Enable QUIC. @@ -928,8 +928,8 @@ } TEST(URLURLRequestContextConfigTest, SetAcceptLanguageAndUserAgent) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::IO); URLRequestContextConfig config( // Enable QUIC.
diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_pingback_client_impl_unittest.cc b/components/data_reduction_proxy/content/browser/data_reduction_proxy_pingback_client_impl_unittest.cc index d51e488..178f207 100644 --- a/components/data_reduction_proxy/content/browser/data_reduction_proxy_pingback_client_impl_unittest.cc +++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_pingback_client_impl_unittest.cc
@@ -106,10 +106,9 @@ class DataReductionProxyPingbackClientImplTest : public testing::Test { public: DataReductionProxyPingbackClientImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::ASYNC) { - } + : task_environment_( + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::ASYNC) {} TestDataReductionProxyPingbackClientImpl* pingback_client() const { return pingback_client_.get(); @@ -233,7 +232,7 @@ int num_network_requests() { return num_network_requests_; } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: network::TestURLLoaderFactory test_url_loader_factory_; @@ -760,7 +759,7 @@ false /* black_listed */); // Don't report the crash dump details. - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(5)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(5)); EXPECT_EQ(upload_content_type(), "application/x-protobuf"); RecordPageloadMetricsRequest batched_request;
diff --git a/components/data_reduction_proxy/content/common/data_reduction_proxy_url_loader_throttle_unittest.cc b/components/data_reduction_proxy/content/common/data_reduction_proxy_url_loader_throttle_unittest.cc index b479deda..88941c0 100644 --- a/components/data_reduction_proxy/content/common/data_reduction_proxy_url_loader_throttle_unittest.cc +++ b/components/data_reduction_proxy/content/common/data_reduction_proxy_url_loader_throttle_unittest.cc
@@ -139,7 +139,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockMojoDataReductionProxy mock_mojo_data_reduction_proxy_; };
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc index f7d56f6a..676f010 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc
@@ -114,8 +114,7 @@ class DataReductionProxyCompressionStatsTest : public testing::Test { protected: DataReductionProxyCompressionStatsTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) { EXPECT_TRUE(base::Time::FromString(kLastUpdateTime, &now_)); } @@ -500,7 +499,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<DataReductionProxyTestContext> drp_test_context_; std::unique_ptr<DataReductionProxyCompressionStats> compression_stats_; base::Time now_;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc index 0bb1795e0..fcc54f4 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc
@@ -400,7 +400,7 @@ private: base::test::ScopedFeatureList scoped_feature_list_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory>
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc index cfa0d34d..aaa70f5 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
@@ -201,7 +201,7 @@ } content::TestBrowserThreadBundle task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<DataReductionProxyTestContext> test_context_;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc index b363d69..135770c0 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc
@@ -101,7 +101,7 @@ } TestingPrefServiceSimple test_prefs; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<DataReductionProxyTestContext> test_context_; std::unique_ptr<DataReductionProxyConfigurator> config_; std::unique_ptr<NetworkPropertiesManager> manager_;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_unittest.cc index 2056849..cf9fba09 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_unittest.cc
@@ -26,8 +26,8 @@ DataReductionProxyDataTest() {} private: - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; }; TEST_F(DataReductionProxyDataTest, BasicSettersAndGetters) {
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc index 3b9b8d7..6a4e617 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc
@@ -173,8 +173,8 @@ EXPECT_EQ(expected_header, header_value); } - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<TestDataReductionProxyRequestOptions> request_options_; std::unique_ptr<DataReductionProxyTestContext> test_context_; net::HttpRequestHeaders callback_headers_;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_service_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_service_unittest.cc index 65c0702..c3d839a 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_service_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_service_unittest.cc
@@ -72,7 +72,7 @@ PrefService* prefs() { return &prefs_; } protected: - content::TestBrowserThreadBundle scoped_task_environment_; + content::TestBrowserThreadBundle task_environment_; private: TestingPrefServiceSimple prefs_;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc index 323e4323a..60dff09a 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
@@ -129,8 +129,8 @@ data_reduction_proxy::switches::kDataReductionProxyHttpProxies, kHttpsProxy.ToURI() + ";" + kHttpProxy.ToURI()); - base::test::ScopedTaskEnvironment task_environment{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::MainThreadType::IO}; struct TestCase { const char* response_headers; const char* response_body; @@ -200,8 +200,8 @@ } TEST(DataReductionProxySettingsStandaloneTest, TestOnProxyEnabledPrefChange) { - base::test::ScopedTaskEnvironment task_environment{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<DataReductionProxyTestContext> drp_test_context = DataReductionProxyTestContext::Builder() .WithMockConfig() @@ -232,8 +232,8 @@ } TEST(DataReductionProxySettingsStandaloneTest, TestIsProxyEnabledOrManaged) { - base::test::ScopedTaskEnvironment task_environment{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<DataReductionProxyTestContext> drp_test_context = DataReductionProxyTestContext::Builder() .WithMockConfig() @@ -273,8 +273,8 @@ } TEST(DataReductionProxySettingsStandaloneTest, TestCanUseDataReductionProxy) { - base::test::ScopedTaskEnvironment task_environment{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<DataReductionProxyTestContext> drp_test_context = DataReductionProxyTestContext::Builder() .WithMockConfig() @@ -475,8 +475,8 @@ // that already have data reduction proxy on. TEST(DataReductionProxySettingsStandaloneTest, TestDaysSinceEnabledExistingUser) { - base::test::ScopedTaskEnvironment task_environment{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<DataReductionProxyTestContext> drp_test_context = DataReductionProxyTestContext::Builder() .WithMockConfig()
diff --git a/components/data_reduction_proxy/core/browser/network_properties_manager_unittest.cc b/components/data_reduction_proxy/core/browser/network_properties_manager_unittest.cc index 32982d4..fca9bd38 100644 --- a/components/data_reduction_proxy/core/browser/network_properties_manager_unittest.cc +++ b/components/data_reduction_proxy/core/browser/network_properties_manager_unittest.cc
@@ -41,8 +41,8 @@ base::HistogramTester histogram_tester; TestingPrefServiceSimple test_prefs; test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestNetworkPropertiesManager network_properties_manager(&test_prefs); std::string network_id("test"); @@ -92,8 +92,8 @@ TEST(NetworkPropertyTest, TestSetterGetterDisallowedByCarrier) { TestingPrefServiceSimple test_prefs; test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestNetworkPropertiesManager network_properties_manager(&test_prefs); network_properties_manager.SetIsSecureProxyDisallowedByCarrier(true); @@ -110,8 +110,8 @@ TEST(NetworkPropertyTest, TestWarmupURLFailedOnSecureCoreProxy) { TestingPrefServiceSimple test_prefs; test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestNetworkPropertiesManager network_properties_manager(&test_prefs); network_properties_manager.SetHasWarmupURLProbeFailed( @@ -136,8 +136,8 @@ TEST(NetworkPropertyTest, TestWarmupURLFailedOnInSecureCoreProxy) { TestingPrefServiceSimple test_prefs; test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestNetworkPropertiesManager network_properties_manager(&test_prefs); EXPECT_TRUE(network_properties_manager.IsInsecureProxyAllowed(true)); @@ -165,8 +165,8 @@ TEST(NetworkPropertyTest, TestLimitPrefSize) { TestingPrefServiceSimple test_prefs; test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestNetworkPropertiesManager network_properties_manager(&test_prefs); size_t num_network_ids = 100; @@ -225,8 +225,8 @@ TEST(NetworkPropertyTest, TestChangeNetworkIDBackAndForth) { TestingPrefServiceSimple test_prefs; test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestNetworkPropertiesManager network_properties_manager(&test_prefs); // First network ID has a captive portal. @@ -274,8 +274,8 @@ TEST(NetworkPropertyTest, TestNetworkQualitiesOverwrite) { TestingPrefServiceSimple test_prefs; test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestNetworkPropertiesManager network_properties_manager(&test_prefs); // First network ID has a captive portal. @@ -325,8 +325,8 @@ base::HistogramTester histogram_tester; TestingPrefServiceSimple test_prefs; test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestNetworkPropertiesManager network_properties_manager(&test_prefs); std::string network_id("test"); @@ -383,8 +383,8 @@ TestingPrefServiceSimple test_prefs; test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestNetworkPropertiesManager network_properties_manager(&test_clock, &test_prefs); @@ -443,8 +443,8 @@ TestingPrefServiceSimple test_prefs; test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestNetworkPropertiesManager network_properties_manager(&test_prefs); // First network ID has a captive portal and the canary check failed.
diff --git a/components/data_reduction_proxy/core/browser/warmup_url_fetcher_unittest.cc b/components/data_reduction_proxy/core/browser/warmup_url_fetcher_unittest.cc index a27bc32..de0932a8 100644 --- a/components/data_reduction_proxy/core/browser/warmup_url_fetcher_unittest.cc +++ b/components/data_reduction_proxy/core/browser/warmup_url_fetcher_unittest.cc
@@ -126,7 +126,7 @@ // Test that query param for the warmup URL is randomly set. TEST(WarmupURLFetcherTest, TestGetWarmupURLWithQueryParam) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; network::TestURLLoaderFactory test_url_loader_factory; WarmupURLFetcherTest warmup_url_fetcher(&test_url_loader_factory); @@ -157,7 +157,7 @@ } TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLNoViaHeader) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; network::TestURLLoaderFactory test_url_loader_factory; base::HistogramTester histogram_tester; @@ -167,7 +167,7 @@ EXPECT_FALSE(warmup_url_fetcher.IsFetchInFlight()); warmup_url_fetcher.FetchWarmupURL(0, DataReductionProxyServer(proxy_server)); EXPECT_TRUE(warmup_url_fetcher.IsFetchInFlight()); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); auto resource_response_head = network::CreateResourceResponseHead(net::HTTP_OK); @@ -203,7 +203,7 @@ } TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLWithViaHeader) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; network::TestURLLoaderFactory test_url_loader_factory; base::HistogramTester histogram_tester; @@ -213,7 +213,7 @@ EXPECT_FALSE(warmup_url_fetcher.IsFetchInFlight()); warmup_url_fetcher.FetchWarmupURL(0, DataReductionProxyServer(proxy_server)); EXPECT_TRUE(warmup_url_fetcher.IsFetchInFlight()); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); auto resource_response_head = network::CreateResourceResponseHead(net::HTTP_NOT_FOUND); @@ -255,7 +255,7 @@ TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLWithViaHeaderExperimentNotEnabled) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; network::TestURLLoaderFactory test_url_loader_factory; base::HistogramTester histogram_tester; @@ -295,7 +295,7 @@ } TEST(WarmupURLFetcherTest, TestConnectionResetFetchWarmupURL) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; network::TestURLLoaderFactory test_url_loader_factory; base::HistogramTester histogram_tester; @@ -337,7 +337,7 @@ } TEST(WarmupURLFetcherTest, TestFetchTimesout) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; network::TestURLLoaderFactory test_url_loader_factory; base::HistogramTester histogram_tester; @@ -372,8 +372,8 @@ } TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLWithDelay) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); network::TestURLLoaderFactory test_url_loader_factory; base::HistogramTester histogram_tester; @@ -383,7 +383,7 @@ EXPECT_FALSE(warmup_url_fetcher.IsFetchInFlight()); warmup_url_fetcher.SetFetchWaitTime(base::TimeDelta::FromMilliseconds(1)); warmup_url_fetcher.FetchWarmupURL(1, DataReductionProxyServer(proxy_server)); - scoped_task_environment.FastForwardBy(base::TimeDelta::FromMilliseconds(2)); + task_environment.FastForwardBy(base::TimeDelta::FromMilliseconds(2)); auto resource_response_head = network::CreateResourceResponseHead(net::HTTP_NOT_FOUND); @@ -430,7 +430,7 @@ base::HistogramTester histogram_tester; - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; network::TestURLLoaderFactory test_url_loader_factory; DataReductionProxyServer proxy_server(net::ProxyServer::Direct()); @@ -460,7 +460,7 @@ TEST(WarmupURLFetcherTest, TestFetchWaitTime) { base::HistogramTester histogram_tester; - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; network::TestURLLoaderFactory test_url_loader_factory; DataReductionProxyServer proxy_server(net::ProxyServer::Direct());
diff --git a/components/discardable_memory/service/discardable_shared_memory_manager_unittest.cc b/components/discardable_memory/service/discardable_shared_memory_manager_unittest.cc index ba0b7aa..7be8b933 100644 --- a/components/discardable_memory/service/discardable_shared_memory_manager_unittest.cc +++ b/components/discardable_memory/service/discardable_shared_memory_manager_unittest.cc
@@ -66,7 +66,7 @@ } // DiscardableSharedMemoryManager requires a message loop. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestDiscardableSharedMemoryManager> manager_; }; @@ -240,7 +240,7 @@ void SetUp() override { manager_.reset(new DiscardableSharedMemoryManager); } // DiscardableSharedMemoryManager requires a message loop. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<DiscardableSharedMemoryManager> manager_; };
diff --git a/components/dom_distiller/core/distilled_content_store_unittest.cc b/components/dom_distiller/core/distilled_content_store_unittest.cc index f223607..b62c2148 100644 --- a/components/dom_distiller/core/distilled_content_store_unittest.cc +++ b/components/dom_distiller/core/distilled_content_store_unittest.cc
@@ -78,7 +78,7 @@ // Tests whether saving and then loading a single article works as expected. TEST_F(InMemoryContentStoreTest, SaveAndLoadSingleArticle) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; const ArticleEntry entry = CreateEntry("test-id", "url1", "url2", "url3"); const DistilledArticleProto stored_proto = CreateDistilledArticleForEntry(entry); @@ -101,7 +101,7 @@ // Tests that loading articles which have never been stored, yields a callback // where success is false. TEST_F(InMemoryContentStoreTest, LoadNonExistentArticle) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; const ArticleEntry entry = CreateEntry("bogus-id", "url1", "url2", "url3"); store_->LoadContent(entry, base::Bind(&InMemoryContentStoreTest::OnLoadCallback, @@ -114,7 +114,7 @@ // of save and store does not matter when the total number of articles does not // exceed |kDefaultMaxNumCachedEntries|. TEST_F(InMemoryContentStoreTest, SaveAndLoadMultipleArticles) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; // Store first article. const ArticleEntry first_entry = CreateEntry("first", "url1", "url2", "url3"); const DistilledArticleProto first_stored_proto = @@ -162,7 +162,7 @@ // Verifies that the content store does not store unlimited number of articles, // but expires the oldest ones when the limit for number of articles is reached. TEST_F(InMemoryContentStoreTest, SaveAndLoadMoreThanMaxArticles) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; // Create a new store with only |kMaxNumArticles| articles as the limit. const int kMaxNumArticles = 3; @@ -239,7 +239,7 @@ // Tests whether saving and then loading a single article works as expected. TEST_F(InMemoryContentStoreTest, LookupArticleByURL) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; const ArticleEntry entry = CreateEntry("test-id", "url1", "url2", "url3"); const DistilledArticleProto stored_proto = CreateDistilledArticleForEntry(entry); @@ -275,7 +275,7 @@ // Verifies that the content store does not store unlimited number of articles, // but expires the oldest ones when the limit for number of articles is reached. TEST_F(InMemoryContentStoreTest, LoadArticleByURLAfterExpungedFromCache) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; // Create a new store with only |kMaxNumArticles| articles as the limit. const int kMaxNumArticles = 1;
diff --git a/components/dom_distiller/core/distilled_page_prefs_unittests.cc b/components/dom_distiller/core/distilled_page_prefs_unittests.cc index 921d4fbc..073aba3 100644 --- a/components/dom_distiller/core/distilled_page_prefs_unittests.cc +++ b/components/dom_distiller/core/distilled_page_prefs_unittests.cc
@@ -58,7 +58,7 @@ std::unique_ptr<DistilledPagePrefs> distilled_page_prefs_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(DistilledPagePrefsTest, TestingOnChangeFontIsBeingCalled) {
diff --git a/components/dom_distiller/core/distiller_unittest.cc b/components/dom_distiller/core/distiller_unittest.cc index 48a1ee4..2f9ff255 100644 --- a/components/dom_distiller/core/distiller_unittest.cc +++ b/components/dom_distiller/core/distiller_unittest.cc
@@ -308,8 +308,8 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; std::unique_ptr<DistillerImpl> distiller_; std::unique_ptr<DistilledArticleProto> article_proto_; std::vector<ArticleDistillationUpdate> in_sequence_updates_;
diff --git a/components/dom_distiller/core/distiller_url_fetcher_unittest.cc b/components/dom_distiller/core/distiller_url_fetcher_unittest.cc index 0d5317409..66b4e68 100644 --- a/components/dom_distiller/core/distiller_url_fetcher_unittest.cc +++ b/components/dom_distiller/core/distiller_url_fetcher_unittest.cc
@@ -50,8 +50,8 @@ CHECK_EQ(expected_response, response_); } - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; std::unique_ptr<dom_distiller::DistillerURLFetcher> url_fetcher_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory>
diff --git a/components/dom_distiller/core/dom_distiller_service_unittest.cc b/components/dom_distiller/core/dom_distiller_service_unittest.cc index 5a6c5ac..85bea86a 100644 --- a/components/dom_distiller/core/dom_distiller_service_unittest.cc +++ b/components/dom_distiller/core/dom_distiller_service_unittest.cc
@@ -103,7 +103,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; // store is owned by service_. DomDistillerStoreInterface* store_; MockDistillerFactory* distiller_factory_;
diff --git a/components/dom_distiller/core/dom_distiller_store_unittest.cc b/components/dom_distiller/core/dom_distiller_store_unittest.cc index c68f6d3..6c11665 100644 --- a/components/dom_distiller/core/dom_distiller_store_unittest.cc +++ b/components/dom_distiller/core/dom_distiller_store_unittest.cc
@@ -159,7 +159,7 @@ return data; } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; EntryMap db_model_; EntryMap sync_model_;
diff --git a/components/dom_distiller/core/task_tracker_unittest.cc b/components/dom_distiller/core/task_tracker_unittest.cc index b31e3f5..c2b9398 100644 --- a/components/dom_distiller/core/task_tracker_unittest.cc +++ b/components/dom_distiller/core/task_tracker_unittest.cc
@@ -78,7 +78,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::string entry_id_; GURL page_0_url_; GURL page_1_url_;
diff --git a/components/domain_reliability/uploader_unittest.cc b/components/domain_reliability/uploader_unittest.cc index 374f2fe..70bc6c4a 100644 --- a/components/domain_reliability/uploader_unittest.cc +++ b/components/domain_reliability/uploader_unittest.cc
@@ -196,8 +196,8 @@ } private: - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; UploadInterceptor* interceptor_; MockTime time_;
diff --git a/components/download/internal/background_service/in_memory_download_unittest.cc b/components/download/internal/background_service/in_memory_download_unittest.cc index 535f4903..dbcdd77a 100644 --- a/components/download/internal/background_service/in_memory_download_unittest.cc +++ b/components/download/internal/background_service/in_memory_download_unittest.cc
@@ -172,7 +172,7 @@ std::unique_ptr<base::Thread> io_thread_; // Created before other objects to provide test environment. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<InMemoryDownloadImpl> download_; std::unique_ptr<NiceMock<MockDelegate>> mock_delegate_;
diff --git a/components/download/internal/background_service/scheduler/device_status_listener_unittest.cc b/components/download/internal/background_service/scheduler/device_status_listener_unittest.cc index e3da016..0bd083403 100644 --- a/components/download/internal/background_service/scheduler/device_status_listener_unittest.cc +++ b/components/download/internal/background_service/scheduler/device_status_listener_unittest.cc
@@ -146,7 +146,7 @@ MockObserver mock_observer_; // Needed for network change notifier and power monitor. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::PowerMonitorTestSource* power_source_; TestBatteryStatusListener* test_battery_listener_; };
diff --git a/components/download/internal/common/download_db_cache_unittest.cc b/components/download/internal/common/download_db_cache_unittest.cc index 1133226..2700a647 100644 --- a/components/download/internal/common/download_db_cache_unittest.cc +++ b/components/download/internal/common/download_db_cache_unittest.cc
@@ -109,7 +109,7 @@ leveldb_proto::test::FakeDB<download_pb::DownloadDBEntry>* db_; std::unique_ptr<DownloadDBCache> db_cache_; scoped_refptr<base::TestMockTimeTaskRunner> task_runner_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(DownloadDBCacheTest); };
diff --git a/components/download/internal/common/download_file_unittest.cc b/components/download/internal/common/download_file_unittest.cc index 767e646..a6a6e320 100644 --- a/components/download/internal/common/download_file_unittest.cc +++ b/components/download/internal/common/download_file_unittest.cc
@@ -500,7 +500,7 @@ closure.Run(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // DownloadFile::RenameAndAnnotate and DownloadFile::RenameAndUniquify have a
diff --git a/components/download/internal/common/download_item_impl_unittest.cc b/components/download/internal/common/download_item_impl_unittest.cc index 5b66866..9dbc005 100644 --- a/components/download/internal/common/download_item_impl_unittest.cc +++ b/components/download/internal/common/download_item_impl_unittest.cc
@@ -232,8 +232,8 @@ public: DownloadItemTest() : task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED), + base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED), next_download_id_(DownloadItem::kInvalidId + 1) { create_info_.reset(new DownloadCreateInfo()); create_info_->save_info = @@ -377,7 +377,7 @@ bool canceled() { return canceled_; } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; private: StrictMock<MockDelegate> mock_delegate_;
diff --git a/components/download/internal/common/download_path_reservation_tracker_unittest.cc b/components/download/internal/common/download_path_reservation_tracker_unittest.cc index 1b6ccde74..7c4cad2 100644 --- a/components/download/internal/common/download_path_reservation_tracker_unittest.cc +++ b/components/download/internal/common/download_path_reservation_tracker_unittest.cc
@@ -75,7 +75,7 @@ base::ScopedTempDir test_download_dir_; base::FilePath default_download_path_; base::FilePath fallback_directory_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: void TestReservedPathCallback(base::FilePath* return_path, @@ -138,7 +138,7 @@ } void DownloadPathReservationTrackerTest::RunUntilIdle() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void DownloadPathReservationTrackerTest::CallGetReservedPath( @@ -157,7 +157,7 @@ create_directory, conflict_action, base::Bind(&DownloadPathReservationTrackerTest::TestReservedPathCallback, weak_ptr_factory.GetWeakPtr(), return_path, return_result)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void DownloadPathReservationTrackerTest::TestReservedPathCallback(
diff --git a/components/download/internal/common/download_ukm_helper_unittest.cc b/components/download/internal/common/download_ukm_helper_unittest.cc index a3c3fed2..d6b9fa84 100644 --- a/components/download/internal/common/download_ukm_helper_unittest.cc +++ b/components/download/internal/common/download_ukm_helper_unittest.cc
@@ -45,7 +45,7 @@ protected: int download_id_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<ukm::TestAutoSetUkmRecorder> test_recorder_; DISALLOW_COPY_AND_ASSIGN(DownloadUkmHelperTest);
diff --git a/components/download/internal/common/parallel_download_job_unittest.cc b/components/download/internal/common/parallel_download_job_unittest.cc index c3abdd9..4b4e5084 100644 --- a/components/download/internal/common/parallel_download_job_unittest.cc +++ b/components/download/internal/common/parallel_download_job_unittest.cc
@@ -107,9 +107,9 @@ class ParallelDownloadJobTest : public testing::Test { public: ParallelDownloadJobTest() - : task_environment_(base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment:: - ThreadPoolExecutionMode::QUEUED) {} + : task_environment_( + base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} void CreateParallelJob(int64_t initial_request_offset, int64_t content_length, @@ -162,7 +162,7 @@ file_initialized_ = true; } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockDownloadItem> download_item_; std::unique_ptr<ParallelDownloadJobForTest> job_; bool file_initialized_;
diff --git a/components/drive/drive_uploader_unittest.cc b/components/drive/drive_uploader_unittest.cc index f45c1cf2..4a7c850 100644 --- a/components/drive/drive_uploader_unittest.cc +++ b/components/drive/drive_uploader_unittest.cc
@@ -420,7 +420,7 @@ void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; };
diff --git a/components/drive/local_file_reader_unittest.cc b/components/drive/local_file_reader_unittest.cc index b6a9e46..e464a361 100644 --- a/components/drive/local_file_reader_unittest.cc +++ b/components/drive/local_file_reader_unittest.cc
@@ -56,7 +56,7 @@ std::make_unique<LocalFileReader>(worker_thread_->task_runner().get()); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; std::unique_ptr<base::Thread> worker_thread_; std::unique_ptr<LocalFileReader> file_reader_;
diff --git a/components/drive/service/fake_drive_service_unittest.cc b/components/drive/service/fake_drive_service_unittest.cc index 49b3c63..bbf1d4372 100644 --- a/components/drive/service/fake_drive_service_unittest.cc +++ b/components/drive/service/fake_drive_service_unittest.cc
@@ -227,7 +227,7 @@ return about_resource->largest_change_id(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; FakeDriveService fake_service_; };
diff --git a/components/exo/data_source_unittest.cc b/components/exo/data_source_unittest.cc index e1cf092..22ca10b 100644 --- a/components/exo/data_source_unittest.cc +++ b/components/exo/data_source_unittest.cc
@@ -20,9 +20,9 @@ class DataSourceTest : public testing::Test { protected: - base::test::ScopedTaskEnvironment scoped_task_environment_ = { - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::ASYNC}; + base::test::TaskEnvironment task_environment_ = { + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::ASYNC}; }; class TestDataSourceDelegate : public DataSourceDelegate { @@ -94,7 +94,7 @@ std::string string_data(data.begin(), data.end()); EXPECT_EQ(std::string(kTestData), string_data); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(DataSourceTest, ReadDataArbitraryMimeType) { @@ -109,7 +109,7 @@ std::string string_data(data.begin(), data.end()); EXPECT_EQ(std::string(kTestData), string_data); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(DataSourceTest, ReadData_UnknownMimeType) { @@ -124,7 +124,7 @@ FAIL() << "Callback should not be invoked when known " "mimetype is not offerred"; })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(DataSourceTest, ReadData_Destroyed) { @@ -141,7 +141,7 @@ "data source is destroyed"; })); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(DataSourceTest, ReadData_Cancelled) { @@ -156,7 +156,7 @@ FAIL() << "Callback should not be invoked after cancelled"; })); data_source.Cancelled(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(DataSourceTest, PreferredMimeTypeUTF16) {
diff --git a/components/exo/wayland/clients/test/run_all_client_perftests.cc b/components/exo/wayland/clients/test/run_all_client_perftests.cc index 90c54c8..023acaf 100644 --- a/components/exo/wayland/clients/test/run_all_client_perftests.cc +++ b/components/exo/wayland/clients/test/run_all_client_perftests.cc
@@ -55,9 +55,8 @@ if (run_with_external_wayland_server_) { base::TestSuite::Initialize(); - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + task_environment_ = std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::MainThreadType::UI); } else { // We only need initialized ash related stuff for running wayland server // within the test. @@ -65,9 +64,8 @@ // Initialize task envrionment here instead of Test::SetUp(), because all // tests and their SetUp() will be running in client thread. - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + task_environment_ = std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::MainThreadType::UI); // Set the UI thread task runner to WaylandClientTest, so all tests can // post tasks to UI thread. @@ -78,11 +76,11 @@ void Shutdown() override { if (run_with_external_wayland_server_) { - scoped_task_environment_ = nullptr; + task_environment_ = nullptr; base::TestSuite::Shutdown(); } else { WaylandClientTest::SetUIThreadTaskRunner(nullptr); - scoped_task_environment_ = nullptr; + task_environment_ = nullptr; ash::AshTestSuite::Shutdown(); } } @@ -96,7 +94,7 @@ // Do not run the wayland server within the test. const bool run_with_external_wayland_server_ = false; - std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_; + std::unique_ptr<base::test::TaskEnvironment> task_environment_; // Result of RUN_ALL_TESTS(). int result_ = 1;
diff --git a/components/exo/wayland/fuzzer/server_environment.h b/components/exo/wayland/fuzzer/server_environment.h index 04f15b50..6b1a1d21 100644 --- a/components/exo/wayland/fuzzer/server_environment.h +++ b/components/exo/wayland/fuzzer/server_environment.h
@@ -31,7 +31,7 @@ private: std::unique_ptr<aura::Env> env_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::Thread ui_thread_; };
diff --git a/components/favicon/core/favicon_handler_unittest.cc b/components/favicon/core/favicon_handler_unittest.cc index 24d2156..d54b4e0 100644 --- a/components/favicon/core/favicon_handler_unittest.cc +++ b/components/favicon/core/favicon_handler_unittest.cc
@@ -492,8 +492,7 @@ const GURL kIconURL64x64 = GURL("http://www.google.com/favicon64x64"); FaviconHandlerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) { // Register various known icon URLs. delegate_.fake_image_downloader().Add(kIconURL10x10, IntVector{10}); delegate_.fake_image_downloader().Add(kIconURL12x12, IntVector{12}); @@ -547,7 +546,7 @@ candidates, manifest_url); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<ui::test::ScopedSetSupportedScaleFactors> scoped_set_supported_scale_factors_; testing::NiceMock<MockFaviconServiceWithFake> favicon_service_;
diff --git a/components/favicon/core/favicon_service_impl_unittest.cc b/components/favicon/core/favicon_service_impl_unittest.cc index 65709ea3..97b67d9 100644 --- a/components/favicon/core/favicon_service_impl_unittest.cc +++ b/components/favicon/core/favicon_service_impl_unittest.cc
@@ -17,7 +17,7 @@ namespace { TEST(FaviconServiceImplTest, ShouldCacheUnableToDownloadFavicons) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; base::ScopedTempDir history_dir; CHECK(history_dir.CreateUniqueTempDir()); std::unique_ptr<history::HistoryService> history_service =
diff --git a/components/favicon/core/large_icon_service_impl_unittest.cc b/components/favicon/core/large_icon_service_impl_unittest.cc index 5be7802..eaf99de 100644 --- a/components/favicon/core/large_icon_service_impl_unittest.cc +++ b/components/favicon/core/large_icon_service_impl_unittest.cc
@@ -127,7 +127,7 @@ ~LargeIconServiceTest() override {} protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ui::test::ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; NiceMock<MockImageFetcher>* mock_image_fetcher_; testing::NiceMock<MockFaviconService> mock_favicon_service_; @@ -175,7 +175,7 @@ EXPECT_CALL(callback, Run(favicon_base::GoogleFaviconServerRequestStatus::SUCCESS)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); histogram_tester_.ExpectUniqueSample( "Favicons.LargeIconService.DownloadedSize", 64, /*expected_count=*/1); } @@ -221,7 +221,7 @@ EXPECT_CALL(callback, Run(favicon_base::GoogleFaviconServerRequestStatus::SUCCESS)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(LargeIconServiceTest, ShouldTrimQueryParametersForGoogleServer) { @@ -254,7 +254,7 @@ TRAFFIC_ANNOTATION_FOR_TESTS, favicon_base::GoogleFaviconServerCallback()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(LargeIconServiceTest, ShouldNotCheckOnPublicUrls) { @@ -284,7 +284,7 @@ EXPECT_CALL(callback, Run(favicon_base::GoogleFaviconServerRequestStatus:: FAILURE_CONNECTION_ERROR)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(LargeIconServiceTest, ShouldNotQueryGoogleServerIfInvalidScheme) { @@ -302,7 +302,7 @@ EXPECT_CALL(callback, Run(favicon_base::GoogleFaviconServerRequestStatus:: FAILURE_TARGET_URL_SKIPPED)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(histogram_tester_.GetAllSamples( "Favicons.LargeIconService.DownloadedSize"), IsEmpty()); @@ -323,7 +323,7 @@ EXPECT_CALL(callback, Run(favicon_base::GoogleFaviconServerRequestStatus:: FAILURE_TARGET_URL_INVALID)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(histogram_tester_.GetAllSamples( "Favicons.LargeIconService.DownloadedSize"), IsEmpty()); @@ -360,7 +360,7 @@ EXPECT_CALL(callback, Run(favicon_base::GoogleFaviconServerRequestStatus:: FAILURE_CONNECTION_ERROR)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Verify that download failure gets recorded. histogram_tester_.ExpectUniqueSample( "Favicons.LargeIconService.DownloadedSize", 0, /*expected_count=*/1); @@ -388,7 +388,7 @@ EXPECT_CALL(callback, Run(favicon_base::GoogleFaviconServerRequestStatus:: FAILURE_HTTP_ERROR_CACHED)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(histogram_tester_.GetAllSamples( "Favicons.LargeIconService.DownloadedSize"), IsEmpty()); @@ -417,7 +417,7 @@ EXPECT_CALL(callback, Run(favicon_base::GoogleFaviconServerRequestStatus:: FAILURE_ICON_EXISTS_IN_DB)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(histogram_tester_.GetAllSamples( "Favicons.LargeIconService.DownloadedSize"), IsEmpty()); @@ -448,7 +448,7 @@ base::Unretained(this)), &cancelable_task_tracker_); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void RawBitmapResultCallback(const favicon_base::LargeIconResult& result) {
diff --git a/components/feature_engagement/internal/in_memory_event_store_unittest.cc b/components/feature_engagement/internal/in_memory_event_store_unittest.cc index 73bf2b4..4e5b3145 100644 --- a/components/feature_engagement/internal/in_memory_event_store_unittest.cc +++ b/components/feature_engagement/internal/in_memory_event_store_unittest.cc
@@ -33,7 +33,7 @@ bool load_callback_has_been_invoked_; bool last_result_; std::unique_ptr<std::vector<Event>> loaded_events_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; } // namespace
diff --git a/components/feature_engagement/internal/never_availability_model_unittest.cc b/components/feature_engagement/internal/never_availability_model_unittest.cc index a8d5421..90e981e 100644 --- a/components/feature_engagement/internal/never_availability_model_unittest.cc +++ b/components/feature_engagement/internal/never_availability_model_unittest.cc
@@ -31,7 +31,7 @@ base::Optional<bool> success_; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(NeverAvailabilityModelTest); };
diff --git a/components/feature_engagement/internal/tracker_impl_unittest.cc b/components/feature_engagement/internal/tracker_impl_unittest.cc index 6c422e6..d2e7330 100644 --- a/components/feature_engagement/internal/tracker_impl_unittest.cc +++ b/components/feature_engagement/internal/tracker_impl_unittest.cc
@@ -415,7 +415,7 @@ virtual bool ShouldAvailabilityStoreBeReady() { return true; } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TrackerImpl> tracker_; TestTrackerInMemoryEventStore* event_store_; TestTrackerAvailabilityModel* availability_model_;
diff --git a/components/feed/content/feed_offline_host_unittest.cc b/components/feed/content/feed_offline_host_unittest.cc index e27102bfc..29c9106 100644 --- a/components/feed/content/feed_offline_host_unittest.cc +++ b/components/feed/content/feed_offline_host_unittest.cc
@@ -130,7 +130,7 @@ return status_notifications_; } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } void SetupHost() { EXPECT_CALL(*offline_page_model(), AddObserver(testing::_)) @@ -172,7 +172,7 @@ status_notifications_.emplace_back(url, available_offline); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestOfflinePageModel offline_page_model_; TestPrefetchService prefetch_service_; std::unique_ptr<FeedOfflineHost> host_;
diff --git a/components/feed/core/feed_content_database_unittest.cc b/components/feed/core/feed_content_database_unittest.cc index f154aace..f564d29 100644 --- a/components/feed/core/feed_content_database_unittest.cc +++ b/components/feed/core/feed_content_database_unittest.cc
@@ -120,7 +120,7 @@ RunUntilIdle(); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } scoped_refptr<base::SequencedTaskRunner> task_runner() { return task_runner_; @@ -138,7 +138,7 @@ MOCK_METHOD1(OnStorageCommitted, void(bool)); private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::map<std::string, ContentStorageProto> content_db_storage_;
diff --git a/components/feed/core/feed_image_manager_unittest.cc b/components/feed/core/feed_image_manager_unittest.cc index 418724a..ebc0323 100644 --- a/components/feed/core/feed_image_manager_unittest.cc +++ b/components/feed/core/feed_image_manager_unittest.cc
@@ -111,7 +111,7 @@ ASSERT_TRUE(image_database_->IsInitialized()); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } FeedImageDatabase* image_database() { return image_database_; } @@ -144,7 +144,7 @@ FeedImageDatabase* image_database_; base::ScopedTempDir database_dir_; FakeImageDecoder* fake_image_decoder_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; HistogramTester histogram_; DISALLOW_COPY_AND_ASSIGN(FeedImageManagerTest);
diff --git a/components/feed/core/feed_journal_database_unittest.cc b/components/feed/core/feed_journal_database_unittest.cc index 7bb4a06b..9be85b1 100644 --- a/components/feed/core/feed_journal_database_unittest.cc +++ b/components/feed/core/feed_journal_database_unittest.cc
@@ -128,7 +128,7 @@ RunUntilIdle(); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } scoped_refptr<base::SequencedTaskRunner> task_runner() { return task_runner_; @@ -145,7 +145,7 @@ MOCK_METHOD2(OnCheckJournalExistReceived, void(bool, bool)); private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::map<std::string, JournalStorageProto> journal_db_storage_;
diff --git a/components/feed/core/feed_networking_host_unittest.cc b/components/feed/core/feed_networking_host_unittest.cc index 57c9db4..9e13b46 100644 --- a/components/feed/core/feed_networking_host_unittest.cc +++ b/components/feed/core/feed_networking_host_unittest.cc
@@ -72,8 +72,7 @@ &test_factory_); net_service_ = std::make_unique<FeedNetworkingHost>( identity_test_env_.identity_manager(), "dummy_api_key", - shared_url_loader_factory_, - scoped_task_environment_.GetMockTickClock()); + shared_url_loader_factory_, task_environment_.GetMockTickClock()); } FeedNetworkingHost* service() { return net_service_.get(); } @@ -96,7 +95,7 @@ test_factory_.AddResponse(url, head, response_string, status); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } void SendRequestAndRespond(const std::string& url_string, @@ -136,8 +135,8 @@ network::TestURLLoaderFactory* test_factory() { return &test_factory_; } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; private: signin::IdentityTestEnvironment identity_test_env_; @@ -172,7 +171,7 @@ &done_callback2); SendRequestAndRespond("http://foobar.com/other", "POST", "", "", net::HTTP_OK, network::URLLoaderCompletionStatus(), &done_callback3); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_TRUE(done_callback1.has_run); EXPECT_TRUE(done_callback2.has_run); @@ -192,7 +191,7 @@ net::HTTP_OK, network::URLLoaderCompletionStatus(), &done_callback); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_TRUE(done_callback.has_run); EXPECT_EQ(done_callback.code, 200); } @@ -291,7 +290,7 @@ service()->Send(GURL("http://foobar.com/feed2"), "POST", request_body, base::BindOnce(&MockResponseDoneCallback::Done, base::Unretained(&done_callback2))); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); service()->CancelRequests(); } @@ -346,7 +345,7 @@ service()->Send(url, "POST", request_body, base::BindOnce(&MockResponseDoneCallback::Done, base::Unretained(&done_callback))); - scoped_task_environment_.FastForwardBy(duration); + task_environment_.FastForwardBy(duration); Respond(url, "", net::HTTP_OK, network::URLLoaderCompletionStatus()); EXPECT_TRUE(done_callback.has_run); @@ -363,10 +362,10 @@ service()->Send(url, "POST", request_body, base::BindOnce(&MockResponseDoneCallback::Done, base::Unretained(&done_callback))); - scoped_task_environment_.FastForwardBy(TimeDelta::FromSeconds(29)); + task_environment_.FastForwardBy(TimeDelta::FromSeconds(29)); EXPECT_FALSE(done_callback.has_run); - scoped_task_environment_.FastForwardBy(TimeDelta::FromSeconds(29)); + task_environment_.FastForwardBy(TimeDelta::FromSeconds(29)); EXPECT_TRUE(done_callback.has_run); histogram_tester.ExpectTimeBucketCount( "ContentSuggestions.Feed.Network.Duration", TimeDelta::FromSeconds(30), @@ -384,10 +383,10 @@ service()->Send(url, "POST", request_body, base::BindOnce(&MockResponseDoneCallback::Done, base::Unretained(&done_callback))); - scoped_task_environment_.FastForwardBy(TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(TimeDelta::FromSeconds(1)); EXPECT_FALSE(done_callback.has_run); - scoped_task_environment_.FastForwardBy(TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(TimeDelta::FromSeconds(1)); EXPECT_TRUE(done_callback.has_run); }
diff --git a/components/gcm_driver/account_tracker.cc b/components/gcm_driver/account_tracker.cc index 1a875bc..c7cda1c 100644 --- a/components/gcm_driver/account_tracker.cc +++ b/components/gcm_driver/account_tracker.cc
@@ -46,7 +46,7 @@ } std::vector<AccountIds> AccountTracker::GetAccounts() const { - const std::string active_account_id = + const CoreAccountId active_account_id = identity_manager_->GetPrimaryAccountId(); std::vector<AccountIds> accounts; @@ -116,7 +116,7 @@ observer.OnAccountSignInChanged(account.ids, account.is_signed_in); } -void AccountTracker::UpdateSignInState(const std::string& account_key, +void AccountTracker::UpdateSignInState(const CoreAccountId& account_key, bool is_signed_in) { StartTrackingAccount(account_key); AccountState& account = accounts_[account_key]; @@ -131,18 +131,18 @@ NotifySignInChanged(account); } -void AccountTracker::StartTrackingAccount(const std::string& account_key) { +void AccountTracker::StartTrackingAccount(const CoreAccountId& account_key) { if (!base::Contains(accounts_, account_key)) { DVLOG(1) << "StartTracking " << account_key; AccountState account_state; account_state.ids.account_key = account_key; - account_state.ids.email = account_key; + account_state.ids.email = account_key.id; account_state.is_signed_in = false; - accounts_.insert(make_pair(account_key, account_state)); + accounts_.insert(std::make_pair(account_key, account_state)); } } -void AccountTracker::StopTrackingAccount(const std::string account_key) { +void AccountTracker::StopTrackingAccount(const CoreAccountId account_key) { DVLOG(1) << "StopTracking " << account_key; if (base::Contains(accounts_, account_key)) { AccountState& account = accounts_[account_key]; @@ -161,7 +161,7 @@ StopTrackingAccount(accounts_.begin()->first); } -void AccountTracker::StartFetchingUserInfo(const std::string& account_key) { +void AccountTracker::StartFetchingUserInfo(const CoreAccountId& account_key) { if (base::Contains(user_info_requests_, account_key)) { DeleteFetcher(user_info_requests_[account_key].get()); } @@ -175,7 +175,7 @@ void AccountTracker::OnUserInfoFetchSuccess(AccountIdFetcher* fetcher, const std::string& gaia_id) { - const std::string& account_key = fetcher->account_key(); + const CoreAccountId& account_key = fetcher->account_key(); DCHECK(base::Contains(accounts_, account_key)); AccountState& account = accounts_[account_key]; @@ -189,14 +189,14 @@ void AccountTracker::OnUserInfoFetchFailure(AccountIdFetcher* fetcher) { LOG(WARNING) << "Failed to get UserInfo for " << fetcher->account_key(); - std::string key = fetcher->account_key(); + CoreAccountId key = fetcher->account_key(); DeleteFetcher(fetcher); StopTrackingAccount(key); } void AccountTracker::DeleteFetcher(AccountIdFetcher* fetcher) { DVLOG(1) << "DeleteFetcher " << fetcher->account_key(); - const std::string& account_key = fetcher->account_key(); + const CoreAccountId& account_key = fetcher->account_key(); DCHECK(base::Contains(user_info_requests_, account_key)); DCHECK_EQ(fetcher, user_info_requests_[account_key].get()); user_info_requests_.erase(account_key); @@ -206,13 +206,13 @@ signin::IdentityManager* identity_manager, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, AccountTracker* tracker, - const std::string& account_key) + const CoreAccountId& account_key) : identity_manager_(identity_manager), url_loader_factory_(std::move(url_loader_factory)), tracker_(tracker), account_key_(account_key) { TRACE_EVENT_ASYNC_BEGIN1("identity", "AccountIdFetcher", this, "account_key", - account_key); + account_key.id); } AccountIdFetcher::~AccountIdFetcher() {
diff --git a/components/gcm_driver/account_tracker.h b/components/gcm_driver/account_tracker.h index e051e96..6158e76 100644 --- a/components/gcm_driver/account_tracker.h +++ b/components/gcm_driver/account_tracker.h
@@ -14,6 +14,7 @@ #include "base/observer_list.h" #include "components/signin/public/identity_manager/access_token_fetcher.h" #include "components/signin/public/identity_manager/identity_manager.h" +#include "google_apis/gaia/core_account_id.h" #include "google_apis/gaia/gaia_oauth_client.h" class GoogleServiceAuthError; @@ -29,7 +30,7 @@ namespace gcm { struct AccountIds { - std::string account_key; // The account ID used by IdentityManager. + CoreAccountId account_key; // The account ID used by IdentityManager. std::string gaia; std::string email; }; @@ -96,23 +97,24 @@ void NotifySignInChanged(const AccountState& account); - void UpdateSignInState(const std::string& account_key, bool is_signed_in); + void UpdateSignInState(const CoreAccountId& account_key, bool is_signed_in); - void StartTrackingAccount(const std::string& account_key); + void StartTrackingAccount(const CoreAccountId& account_key); // Note: |account_key| is passed by value here, because the original // object may be stored in |accounts_| and if so, it will be destroyed // after erasing the key from the map. - void StopTrackingAccount(const std::string account_key); + void StopTrackingAccount(const CoreAccountId account_key); void StopTrackingAllAccounts(); - void StartFetchingUserInfo(const std::string& account_key); + void StartFetchingUserInfo(const CoreAccountId& account_key); void DeleteFetcher(AccountIdFetcher* fetcher); signin::IdentityManager* identity_manager_; scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; - std::map<std::string, std::unique_ptr<AccountIdFetcher>> user_info_requests_; - std::map<std::string, AccountState> accounts_; + std::map<CoreAccountId, std::unique_ptr<AccountIdFetcher>> + user_info_requests_; + std::map<CoreAccountId, AccountState> accounts_; base::ObserverList<Observer>::Unchecked observer_list_; bool shutdown_called_; }; @@ -123,10 +125,10 @@ signin::IdentityManager* identity_manager, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, AccountTracker* tracker, - const std::string& account_key); + const CoreAccountId& account_key); ~AccountIdFetcher() override; - const std::string& account_key() { return account_key_; } + const CoreAccountId& account_key() { return account_key_; } void Start(); @@ -142,7 +144,7 @@ signin::IdentityManager* identity_manager_; scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; AccountTracker* tracker_; - const std::string account_key_; + const CoreAccountId account_key_; std::unique_ptr<signin::AccessTokenFetcher> access_token_fetcher_; std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_;
diff --git a/components/gcm_driver/account_tracker_unittest.cc b/components/gcm_driver/account_tracker_unittest.cc index f1da246..cee2875 100644 --- a/components/gcm_driver/account_tracker_unittest.cc +++ b/components/gcm_driver/account_tracker_unittest.cc
@@ -331,8 +331,8 @@ private: // net:: stuff needs IO message loop. - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; network::TestURLLoaderFactory test_url_loader_factory_; signin::IdentityTestEnvironment identity_test_env_;
diff --git a/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc b/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc index 02055c8..495c576 100644 --- a/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc +++ b/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc
@@ -189,7 +189,7 @@ encrypted_message_ = std::move(message); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir scoped_temp_dir_; base::HistogramTester histogram_tester_;
diff --git a/components/gcm_driver/crypto/gcm_key_store_unittest.cc b/components/gcm_driver/crypto/gcm_key_store_unittest.cc index a30f26cc..708f0f9 100644 --- a/components/gcm_driver/crypto/gcm_key_store_unittest.cc +++ b/components/gcm_driver/crypto/gcm_key_store_unittest.cc
@@ -146,7 +146,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir scoped_temp_dir_; base::HistogramTester histogram_tester_;
diff --git a/components/gcm_driver/gcm_account_mapper.cc b/components/gcm_driver/gcm_account_mapper.cc index da94cea..3f70c4ec 100644 --- a/components/gcm_driver/gcm_account_mapper.cc +++ b/components/gcm_driver/gcm_account_mapper.cc
@@ -299,7 +299,7 @@ account_mapping.account_id)); } -void GCMAccountMapper::OnSendFinished(const std::string& account_id, +void GCMAccountMapper::OnSendFinished(const CoreAccountId& account_id, const std::string& message_id, GCMClient::Result result) { // TODO(fgorski): Add another attempt, in case the QUEUE is not full. @@ -361,7 +361,7 @@ } AccountMapping* GCMAccountMapper::FindMappingByAccountId( - const std::string& account_id) { + const CoreAccountId& account_id) { for (auto iter = accounts_.begin(); iter != accounts_.end(); ++iter) { if (iter->account_id == account_id) return &*iter;
diff --git a/components/gcm_driver/gcm_account_mapper.h b/components/gcm_driver/gcm_account_mapper.h index 76bc360c..ca8126a 100644 --- a/components/gcm_driver/gcm_account_mapper.h +++ b/components/gcm_driver/gcm_account_mapper.h
@@ -75,7 +75,7 @@ void CreateAndSendMessage(const AccountMapping& account_mapping); // Callback for sending a message. - void OnSendFinished(const std::string& account_id, + void OnSendFinished(const CoreAccountId& account_id, const std::string& message_id, GCMClient::Result result); @@ -96,7 +96,7 @@ const AccountMapping& account_mapping) const; // Finds an account mapping in |accounts_| by |account_id|. - AccountMapping* FindMappingByAccountId(const std::string& account_id); + AccountMapping* FindMappingByAccountId(const CoreAccountId& account_id); // Finds an account mapping in |accounts_| by |message_id|. // Returns iterator that can be used to delete the account. AccountMappings::iterator FindMappingByMessageId(
diff --git a/components/gcm_driver/gcm_account_tracker.cc b/components/gcm_driver/gcm_account_tracker.cc index 18d7109..98d6b7c 100644 --- a/components/gcm_driver/gcm_account_tracker.cc +++ b/components/gcm_driver/gcm_account_tracker.cc
@@ -113,7 +113,7 @@ } void GCMAccountTracker::OnAccessTokenFetchCompleteForAccount( - std::string account_id, + CoreAccountId account_id, GoogleServiceAuthError error, signin::AccessTokenInfo access_token_info) { auto iter = account_infos_.find(account_id);
diff --git a/components/gcm_driver/gcm_account_tracker.h b/components/gcm_driver/gcm_account_tracker.h index a55e724..8e958021 100644 --- a/components/gcm_driver/gcm_account_tracker.h +++ b/components/gcm_driver/gcm_account_tracker.h
@@ -98,14 +98,14 @@ // Maps account keys to account states. Keyed by account_ids as used by // IdentityManager. - typedef std::map<std::string, AccountInfo> AccountInfos; + typedef std::map<CoreAccountId, AccountInfo> AccountInfos; // AccountTracker::Observer overrides. void OnAccountSignInChanged(const AccountIds& ids, bool is_signed_in) override; void OnAccessTokenFetchCompleteForAccount( - std::string account_id, + CoreAccountId account_id, GoogleServiceAuthError error, signin::AccessTokenInfo access_token_info); @@ -156,7 +156,7 @@ // completion or upon signout of the account for which the request is being // made. using AccountIDToTokenFetcherMap = - std::map<std::string, std::unique_ptr<signin::AccessTokenFetcher>>; + std::map<CoreAccountId, std::unique_ptr<signin::AccessTokenFetcher>>; AccountIDToTokenFetcherMap pending_token_requests_; // Creates weak pointers used to postpone reporting tokens. See
diff --git a/components/gcm_driver/gcm_account_tracker_unittest.cc b/components/gcm_driver/gcm_account_tracker_unittest.cc index 1364489..09bb766 100644 --- a/components/gcm_driver/gcm_account_tracker_unittest.cc +++ b/components/gcm_driver/gcm_account_tracker_unittest.cc
@@ -204,7 +204,7 @@ private: CustomFakeGCMDriver driver_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; signin::IdentityTestEnvironment identity_test_env_;
diff --git a/components/gcm_driver/gcm_channel_status_request_unittest.cc b/components/gcm_driver/gcm_channel_status_request_unittest.cc index 0108bfc2..12e399d4 100644 --- a/components/gcm_driver/gcm_channel_status_request_unittest.cc +++ b/components/gcm_driver/gcm_channel_status_request_unittest.cc
@@ -44,7 +44,7 @@ network::TestURLLoaderFactory* test_url_loader_factory(); std::unique_ptr<GCMChannelStatusRequest> request_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; bool request_callback_invoked_;
diff --git a/components/gcm_driver/gcm_client_impl_unittest.cc b/components/gcm_driver/gcm_client_impl_unittest.cc index 5d5649e..0406d31 100644 --- a/components/gcm_driver/gcm_client_impl_unittest.cc +++ b/components/gcm_driver/gcm_client_impl_unittest.cc
@@ -424,12 +424,12 @@ } void FastForwardBy(const base::TimeDelta& duration) { - scoped_task_environment_.FastForwardBy(duration); + task_environment_.FastForwardBy(duration); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; // Must be declared first so that it is destroyed last. Injected to // GCM client. @@ -460,7 +460,7 @@ : last_event_(NONE), last_result_(GCMClient::UNKNOWN_ERROR), url_request_context_getter_(new net::TestURLRequestContextGetter( - scoped_task_environment_.GetMainThreadTaskRunner())) {} + task_environment_.GetMainThreadTaskRunner())) {} GCMClientImplTest::~GCMClientImplTest() {} @@ -503,7 +503,7 @@ } void GCMClientImplTest::PumpLoopUntilIdle() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } bool GCMClientImplTest::CreateUniqueTempDir() { @@ -612,7 +612,7 @@ chrome_build_info.product_category_for_subtypes = kProductCategoryForSubtypes; gcm_client_->Initialize( chrome_build_info, gcm_store_path(), - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), base::ThreadTaskRunnerHandle::Get(), base::DoNothing(), base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( &test_url_loader_factory_),
diff --git a/components/gcm_driver/gcm_driver_desktop_unittest.cc b/components/gcm_driver/gcm_driver_desktop_unittest.cc index b40a9721..c8a20ca 100644 --- a/components/gcm_driver/gcm_driver_desktop_unittest.cc +++ b/components/gcm_driver/gcm_driver_desktop_unittest.cc
@@ -166,8 +166,8 @@ private: base::ScopedTempDir temp_dir_; TestingPrefServiceSimple prefs_; - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; base::Thread io_thread_; network::TestURLLoaderFactory test_url_loader_factory_;
diff --git a/components/gcm_driver/gcm_driver_unittest.cc b/components/gcm_driver/gcm_driver_unittest.cc index b9735a04..7cc22dba 100644 --- a/components/gcm_driver/gcm_driver_unittest.cc +++ b/components/gcm_driver/gcm_driver_unittest.cc
@@ -103,8 +103,8 @@ private: base::ScopedTempDir temp_dir_; TestingPrefServiceSimple prefs_; - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; base::Thread io_thread_; network::TestURLLoaderFactory test_url_loader_factory_;
diff --git a/components/gcm_driver/gcm_profile_service.cc b/components/gcm_driver/gcm_profile_service.cc index b26cf41..f4994a5 100644 --- a/components/gcm_driver/gcm_profile_service.cc +++ b/components/gcm_driver/gcm_profile_service.cc
@@ -62,7 +62,7 @@ // The account ID that this service is responsible for. Empty when the service // is not running. - std::string account_id_; + CoreAccountId account_id_; base::WeakPtrFactory<GCMProfileService::IdentityObserver> weak_ptr_factory_{ this}; @@ -100,7 +100,7 @@ void GCMProfileService::IdentityObserver::OnPrimaryAccountCleared( const CoreAccountInfo& previous_primary_account_info) { - account_id_.clear(); + account_id_ = CoreAccountId(); // Still need to notify GCMDriver for UMA purpose. driver_->OnSignedOut();
diff --git a/components/gcm_driver/instance_id/instance_id_driver_unittest.cc b/components/gcm_driver/instance_id/instance_id_driver_unittest.cc index af1d93f..c10636c 100644 --- a/components/gcm_driver/instance_id/instance_id_driver_unittest.cc +++ b/components/gcm_driver/instance_id/instance_id_driver_unittest.cc
@@ -88,7 +88,7 @@ void GetTokenCompleted(const std::string& token, InstanceID::Result result); void DeleteTokenCompleted(InstanceID::Result result); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeGCMDriverForInstanceID> gcm_driver_; std::unique_ptr<InstanceIDDriver> driver_; @@ -109,8 +109,7 @@ }; InstanceIDDriverTest::InstanceIDDriverTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), result_(InstanceID::UNKNOWN_ERROR), async_operation_completed_(false) {}
diff --git a/components/gwp_asan/client/BUILD.gn b/components/gwp_asan/client/BUILD.gn index 0b7b81b..8145cf7 100644 --- a/components/gwp_asan/client/BUILD.gn +++ b/components/gwp_asan/client/BUILD.gn
@@ -45,6 +45,10 @@ "//components/crash/core/common:crash_key", "//components/gwp_asan/common", ] + + if (is_android) { + deps += [ "//components/crash/content/app" ] + } } source_set("unit_tests") {
diff --git a/components/gwp_asan/client/DEPS b/components/gwp_asan/client/DEPS index 90e574c..24a3177 100644 --- a/components/gwp_asan/client/DEPS +++ b/components/gwp_asan/client/DEPS
@@ -1,3 +1,4 @@ include_rules = [ "+components/crash/core/common/crash_key.h", + "+components/crash/content/app/crashpad.h", ]
diff --git a/components/gwp_asan/client/guarded_page_allocator.cc b/components/gwp_asan/client/guarded_page_allocator.cc index 2a9cdb5..ee8d512 100644 --- a/components/gwp_asan/client/guarded_page_allocator.cc +++ b/components/gwp_asan/client/guarded_page_allocator.cc
@@ -21,6 +21,10 @@ #include "components/gwp_asan/common/crash_key_name.h" #include "components/gwp_asan/common/pack_stack_trace.h" +#if defined(OS_ANDROID) +#include "components/crash/content/app/crashpad.h" // nogncheck +#endif + #if defined(OS_MACOSX) #include <pthread.h> #endif @@ -166,6 +170,27 @@ metadata_ = std::make_unique<AllocatorState::SlotMetadata[]>(state_.num_metadata); state_.metadata_addr = reinterpret_cast<uintptr_t>(metadata_.get()); + +#if defined(OS_ANDROID) + // Explicitly whitelist memory ranges the crash_handler needs to reads. This + // is required for WebView because it has a stricter set of privacy + // constraints on what it reads from the crashing process. + for (auto& region : GetInternalMemoryRegions()) + crash_reporter::WhitelistMemoryRange(region.first, region.second); +#endif +} + +std::vector<std::pair<void*, size_t>> +GuardedPageAllocator::GetInternalMemoryRegions() { + std::vector<std::pair<void*, size_t>> regions; + regions.push_back(std::make_pair(&state_, sizeof(state_))); + regions.push_back(std::make_pair( + metadata_.get(), + sizeof(AllocatorState::SlotMetadata) * state_.num_metadata)); + regions.push_back( + std::make_pair(slot_to_metadata_idx_.data(), + sizeof(AllocatorState::MetadataIdx) * state_.total_pages)); + return regions; } GuardedPageAllocator::~GuardedPageAllocator() {
diff --git a/components/gwp_asan/client/guarded_page_allocator.h b/components/gwp_asan/client/guarded_page_allocator.h index 6292e59..2709754 100644 --- a/components/gwp_asan/client/guarded_page_allocator.h +++ b/components/gwp_asan/client/guarded_page_allocator.h
@@ -84,6 +84,10 @@ // crash handler. std::string GetCrashKey() const; + // Returns internal memory used by the allocator (required for sanitization + // on supported platforms.) + std::vector<std::pair<void*, size_t>> GetInternalMemoryRegions(); + // Returns true if ptr points to memory managed by this class. inline bool PointerIsMine(const void* ptr) const { return state_.PointerIsMine(reinterpret_cast<uintptr_t>(ptr));
diff --git a/components/gwp_asan/crash_handler/crash_handler_unittest.cc b/components/gwp_asan/crash_handler/crash_handler_unittest.cc index effaa97..f22e5e6d 100644 --- a/components/gwp_asan/crash_handler/crash_handler_unittest.cc +++ b/components/gwp_asan/crash_handler/crash_handler_unittest.cc
@@ -34,6 +34,10 @@ #include "third_party/crashpad/crashpad/snapshot/minidump/process_snapshot_minidump.h" #include "third_party/crashpad/crashpad/tools/tool_support.h" +#if defined(OS_LINUX) || defined(OS_ANDROID) +#include "third_party/crashpad/crashpad/snapshot/sanitized/sanitization_information.h" +#endif + namespace gwp_asan { namespace internal { @@ -118,18 +122,43 @@ std::map<std::string, std::string> annotations; std::vector<std::string> arguments; - crashpad::CrashpadClient* client = new crashpad::CrashpadClient(); +#if defined(OS_LINUX) || defined(OS_ANDROID) + static crashpad::SanitizationInformation sanitization_info = {}; + static crashpad::SanitizationMemoryRangeWhitelist memory_whitelist; + if (cmd_line->HasSwitch("sanitize")) { + auto memory_ranges = gpa->GetInternalMemoryRegions(); + auto* range_array = + new crashpad::SanitizationMemoryRangeWhitelist::Range[memory_ranges + .size()]; + for (size_t i = 0; i < memory_ranges.size(); i++) { + range_array[i].base = + reinterpret_cast<crashpad::VMAddress>(memory_ranges[i].first); + range_array[i].length = memory_ranges[i].second; + } + memory_whitelist.size = memory_ranges.size(); + memory_whitelist.entries = + reinterpret_cast<crashpad::VMAddress>(range_array); + sanitization_info.memory_range_whitelist_address = + reinterpret_cast<crashpad::VMAddress>(&memory_whitelist); + arguments.push_back(base::StringPrintf("--sanitization-information=%p", + &sanitization_info)); + } +#endif + #if !defined(OS_ANDROID) arguments.push_back("--test-child-process=CrashpadHandler"); - bool handler = client->StartHandler(/* handler */ cmd_line->GetProgram(), - /* database */ directory, - /* metrics_dir */ metrics_dir, - /* url */ "", - /* annotations */ annotations, - /* arguments */ arguments, - /* restartable */ false, - /* asynchronous_start */ false); -#else +#endif + + crashpad::CrashpadClient* client = new crashpad::CrashpadClient(); +#if defined(OS_LINUX) + bool handler = + client->StartHandlerAtCrash(/* handler */ cmd_line->GetProgram(), + /* database */ directory, + /* metrics_dir */ metrics_dir, + /* url */ "", + /* annotations */ annotations, + /* arguments */ arguments); +#elif defined(OS_ANDROID) // TODO: Once the minSdkVersion is >= Q define a CrashpadHandlerMain() and // use the /system/bin/linker approach instead of using // libchrome_crashpad_handler.so @@ -149,7 +178,17 @@ bool handler = client->StartHandlerAtCrash( executable_path, directory, metrics_dir, "", annotations, arguments); +#else + bool handler = client->StartHandler(/* handler */ cmd_line->GetProgram(), + /* database */ directory, + /* metrics_dir */ metrics_dir, + /* url */ "", + /* annotations */ annotations, + /* arguments */ arguments, + /* restartable */ false, + /* asynchronous_start */ false); #endif + if (!handler) { LOG(ERROR) << "Crash handler failed to launch"; return kSuccess; @@ -204,10 +243,18 @@ return kSuccess; } +struct TestParams { + TestParams(const char* allocator, bool sanitize) + : allocator(allocator), sanitize(sanitize) {} + + const char* allocator; + bool sanitize; +}; + class CrashHandlerTest : public base::MultiProcessTest, - public testing::WithParamInterface<const char*> { + public testing::WithParamInterface<TestParams> { protected: - CrashHandlerTest() : allocator_(GetParam()) {} + CrashHandlerTest() : params_(GetParam()) {} // Launch a child process and wait for it to crash. Set |gwp_asan_found_| if a // GWP-ASan data was found and if so, read it into |proto_|. @@ -239,7 +286,10 @@ base::GetMultiProcessTestChildBaseCommandLine(); cmd_line.AppendSwitchPath("directory", database_dir); cmd_line.AppendSwitchASCII("test-name", test_name); - cmd_line.AppendSwitchASCII("allocator", allocator_); + cmd_line.AppendSwitchASCII("allocator", params_.allocator); + + if (params_.sanitize) + cmd_line.AppendSwitch("sanitize"); base::LaunchOptions options; #if defined(OS_WIN) @@ -339,16 +389,16 @@ EXPECT_FALSE(proto_.missing_metadata()); EXPECT_TRUE(proto_.has_allocator()); - if (allocator_ == "malloc") + if (!strcmp(params_.allocator, "malloc")) EXPECT_EQ(proto_.allocator(), Crash_Allocator_MALLOC); - else if (allocator_ == "partitionalloc") + else if (!strcmp(params_.allocator, "partitionalloc")) EXPECT_EQ(proto_.allocator(), Crash_Allocator_PARTITIONALLOC); else ASSERT_TRUE(false) << "Unknown allocator name"; } gwp_asan::Crash proto_; - std::string allocator_; + TestParams params_; bool gwp_asan_found_; }; @@ -407,7 +457,12 @@ INSTANTIATE_TEST_SUITE_P(VaryAllocator, CrashHandlerTest, - testing::Values("malloc", "partitionalloc")); + testing::Values( +#if defined(OS_LINUX) || defined(OS_ANDROID) + TestParams("malloc", true), +#endif + TestParams("malloc", false), + TestParams("partitionalloc", false))); } // namespace
diff --git a/components/history/core/browser/browsing_history_service_unittest.cc b/components/history/core/browser/browsing_history_service_unittest.cc index 2b8a03e..739cd94 100644 --- a/components/history/core/browser/browsing_history_service_unittest.cc +++ b/components/history/core/browser/browsing_history_service_unittest.cc
@@ -297,7 +297,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Duplicates on the same day in the local timezone are removed, so set a // baseline time in local time.
diff --git a/components/history/core/browser/expire_history_backend_unittest.cc b/components/history/core/browser/expire_history_backend_unittest.cc index 2d0770e..af6e3fd 100644 --- a/components/history/core/browser/expire_history_backend_unittest.cc +++ b/components/history/core/browser/expire_history_backend_unittest.cc
@@ -84,7 +84,7 @@ : backend_client_(history_client_.CreateBackendClient()), expirer_(this, backend_client_.get(), - scoped_task_environment_.GetMainThreadTaskRunner()), + task_environment_.GetMainThreadTaskRunner()), now_(PretendNow()) {} protected: @@ -131,7 +131,7 @@ // This must be destroyed last. base::ScopedTempDir tmp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; HistoryClientFakeBookmarks history_client_; std::unique_ptr<HistoryBackendClient> backend_client_;
diff --git a/components/history/core/browser/history_backend_unittest.cc b/components/history/core/browser/history_backend_unittest.cc index 89e723b3..ee3b1d6 100644 --- a/components/history/core/browser/history_backend_unittest.cc +++ b/components/history/core/browser/history_backend_unittest.cc
@@ -282,7 +282,7 @@ URLsModifiedList urls_modified_notifications_; URLsDeletedList urls_deleted_notifications_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::FilePath test_dir_; DISALLOW_COPY_AND_ASSIGN(HistoryBackendTestBase);
diff --git a/components/history/core/browser/history_querying_unittest.cc b/components/history/core/browser/history_querying_unittest.cc index b51d9e9..225641d0 100644 --- a/components/history/core/browser/history_querying_unittest.cc +++ b/components/history/core/browser/history_querying_unittest.cc
@@ -194,7 +194,7 @@ base::ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::FilePath history_dir_;
diff --git a/components/history/core/browser/history_service_unittest.cc b/components/history/core/browser/history_service_unittest.cc index 1d86557..63cf56ad 100644 --- a/components/history/core/browser/history_service_unittest.cc +++ b/components/history/core/browser/history_service_unittest.cc
@@ -58,8 +58,7 @@ class HistoryServiceTest : public testing::Test { public: HistoryServiceTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~HistoryServiceTest() override {} @@ -155,7 +154,7 @@ base::ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MostVisitedURLList most_visited_urls_;
diff --git a/components/history/core/browser/sync/delete_directive_handler_unittest.cc b/components/history/core/browser/sync/delete_directive_handler_unittest.cc index a7155d84..34e4aa2 100644 --- a/components/history/core/browser/sync/delete_directive_handler_unittest.cc +++ b/components/history/core/browser/sync/delete_directive_handler_unittest.cc
@@ -122,7 +122,7 @@ DeleteDirectiveHandler* handler() { return delete_directive_handler_.get(); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir test_dir_; scoped_refptr<HistoryBackend> history_backend_; std::unique_ptr<DeleteDirectiveHandler> delete_directive_handler_;
diff --git a/components/history/core/browser/sync/typed_url_sync_bridge_unittest.cc b/components/history/core/browser/sync/typed_url_sync_bridge_unittest.cc index 81d39d1..63132b2 100644 --- a/components/history/core/browser/sync/typed_url_sync_bridge_unittest.cc +++ b/components/history/core/browser/sync/typed_url_sync_bridge_unittest.cc
@@ -512,7 +512,7 @@ RecordingModelTypeChangeProcessor& processor() { return *processor_; } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir test_dir_; scoped_refptr<TestHistoryBackend> fake_history_backend_; TypedURLSyncBridge* typed_url_sync_bridge_;
diff --git a/components/history/core/browser/top_sites_impl_unittest.cc b/components/history/core/browser/top_sites_impl_unittest.cc index a4acc31..8b93214 100644 --- a/components/history/core/browser/top_sites_impl_unittest.cc +++ b/components/history/core/browser/top_sites_impl_unittest.cc
@@ -247,7 +247,7 @@ top_sites_impl_->ShutdownOnUIThread(); top_sites_impl_ = nullptr; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } @@ -258,7 +258,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir scoped_temp_dir_;
diff --git a/components/history/core/browser/web_history_service_unittest.cc b/components/history/core/browser/web_history_service_unittest.cc index 07e3f844..d529952 100644 --- a/components/history/core/browser/web_history_service_unittest.cc +++ b/components/history/core/browser/web_history_service_unittest.cc
@@ -237,7 +237,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; TestingWebHistoryService web_history_service_;
diff --git a/components/history/core/test/history_backend_db_base_test.cc b/components/history/core/test/history_backend_db_base_test.cc index 61b10a0..c76b6d28 100644 --- a/components/history/core/test/history_backend_db_base_test.cc +++ b/components/history/core/test/history_backend_db_base_test.cc
@@ -59,8 +59,7 @@ }; HistoryBackendDBBaseTest::HistoryBackendDBBaseTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), db_(nullptr), last_profile_error_(sql::INIT_OK) {}
diff --git a/components/history/core/test/history_backend_db_base_test.h b/components/history/core/test/history_backend_db_base_test.h index 1c5cfd5..738e53a 100644 --- a/components/history/core/test/history_backend_db_base_test.h +++ b/components/history/core/test/history_backend_db_base_test.h
@@ -59,7 +59,7 @@ base::ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // names of the database files base::FilePath history_dir_;
diff --git a/components/image_fetcher/core/cache/image_cache_unittest.cc b/components/image_fetcher/core/cache/image_cache_unittest.cc index 19347e2..b2564338d 100644 --- a/components/image_fetcher/core/cache/image_cache_unittest.cc +++ b/components/image_fetcher/core/cache/image_cache_unittest.cc
@@ -171,7 +171,7 @@ FakeDB<CachedImageMetadataProto>* db_; std::map<std::string, CachedImageMetadataProto> db_store_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::HistogramTester histogram_tester_; DISALLOW_COPY_AND_ASSIGN(CachedImageFetcherImageCacheTest);
diff --git a/components/image_fetcher/core/cache/image_data_store_disk_unittest.cc b/components/image_fetcher/core/cache/image_data_store_disk_unittest.cc index fecf8bb1..524d9282 100644 --- a/components/image_fetcher/core/cache/image_data_store_disk_unittest.cc +++ b/components/image_fetcher/core/cache/image_data_store_disk_unittest.cc
@@ -92,7 +92,7 @@ ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(CachedImageFetcherImageDataStoreDiskTest); };
diff --git a/components/image_fetcher/core/cache/image_metadata_store_leveldb_unittest.cc b/components/image_fetcher/core/cache/image_metadata_store_leveldb_unittest.cc index 402bb75c..97c9d3e 100644 --- a/components/image_fetcher/core/cache/image_metadata_store_leveldb_unittest.cc +++ b/components/image_fetcher/core/cache/image_metadata_store_leveldb_unittest.cc
@@ -119,7 +119,7 @@ ASSERT_EQ(entry.needs_transcoding(), needs_transcoding); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } base::SimpleTestClock* clock() { return clock_.get(); } ImageMetadataStore* metadata_store() { return metadata_store_.get(); } FakeDB<CachedImageMetadataProto>* db() { return db_; } @@ -136,7 +136,7 @@ std::map<std::string, CachedImageMetadataProto> db_store_; std::unique_ptr<ImageMetadataStoreLevelDB> metadata_store_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(CachedImageFetcherImageMetadataStoreLevelDBTest); };
diff --git a/components/image_fetcher/core/cached_image_fetcher_unittest.cc b/components/image_fetcher/core/cached_image_fetcher_unittest.cc index 2323f8bd5..8fa05ad 100644 --- a/components/image_fetcher/core/cached_image_fetcher_unittest.cc +++ b/components/image_fetcher/core/cached_image_fetcher_unittest.cc
@@ -113,7 +113,7 @@ RunUntilIdle(); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } CachedImageFetcher* cached_image_fetcher() { return cached_image_fetcher_.get(); @@ -142,7 +142,7 @@ FakeDB<CachedImageMetadataProto>* db_; std::map<std::string, CachedImageMetadataProto> metadata_store_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::HistogramTester histogram_tester_; DISALLOW_COPY_AND_ASSIGN(CachedImageFetcherTest);
diff --git a/components/image_fetcher/core/image_data_fetcher_unittest.cc b/components/image_fetcher/core/image_data_fetcher_unittest.cc index b2905c4..ef2724e 100644 --- a/components/image_fetcher/core/image_data_fetcher_unittest.cc +++ b/components/image_fetcher/core/image_data_fetcher_unittest.cc
@@ -53,7 +53,7 @@ void(const std::string&, const RequestMetadata&)); protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> shared_factory_;
diff --git a/components/image_fetcher/core/image_fetcher_impl_unittest.cc b/components/image_fetcher/core/image_fetcher_impl_unittest.cc index 61ad10c..f6e48b8 100644 --- a/components/image_fetcher/core/image_fetcher_impl_unittest.cc +++ b/components/image_fetcher/core/image_fetcher_impl_unittest.cc
@@ -48,7 +48,7 @@ std::move(decoder), shared_factory_); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } FakeImageDecoder* image_decoder() { return fake_image_decoder_; } network::TestURLLoaderFactory* test_url_loader_factory() { @@ -61,7 +61,7 @@ FakeImageDecoder* fake_image_decoder_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> shared_factory_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(ImageFetcherImplTest); };
diff --git a/components/image_fetcher/core/reduced_mode_image_fetcher_unittest.cc b/components/image_fetcher/core/reduced_mode_image_fetcher_unittest.cc index ba0242b6..0ffd891 100644 --- a/components/image_fetcher/core/reduced_mode_image_fetcher_unittest.cc +++ b/components/image_fetcher/core/reduced_mode_image_fetcher_unittest.cc
@@ -106,7 +106,7 @@ RunUntilIdle(); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } void VerifyCacheHit() { RunUntilIdle(); @@ -152,7 +152,7 @@ FakeDB<CachedImageMetadataProto>* db_; std::map<std::string, CachedImageMetadataProto> metadata_store_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::HistogramTester histogram_tester_; DISALLOW_COPY_AND_ASSIGN(ReducedModeImageFetcherTest);
diff --git a/components/image_fetcher/ios/ios_image_data_fetcher_wrapper_unittest.mm b/components/image_fetcher/ios/ios_image_data_fetcher_wrapper_unittest.mm index 1f8bcb2..6794d244 100644 --- a/components/image_fetcher/ios/ios_image_data_fetcher_wrapper_unittest.mm +++ b/components/image_fetcher/ios/ios_image_data_fetcher_wrapper_unittest.mm
@@ -125,7 +125,7 @@ } // Message loop for the main test thread. - base::test::ScopedTaskEnvironment environment_; + base::test::TaskEnvironment environment_; base::mac::ScopedBlock<ImageDataFetcherBlock> callback_; network::TestURLLoaderFactory factory_;
diff --git a/components/image_fetcher/ios/ios_image_decoder_impl_unittest.mm b/components/image_fetcher/ios/ios_image_decoder_impl_unittest.mm index 278e1bb..e0895b0 100644 --- a/components/image_fetcher/ios/ios_image_decoder_impl_unittest.mm +++ b/components/image_fetcher/ios/ios_image_decoder_impl_unittest.mm
@@ -65,7 +65,7 @@ ~IOSImageDecoderImplTest() override {} - base::test::ScopedTaskEnvironment scoped_task_evironment_; + base::test::TaskEnvironment scoped_task_evironment_; std::unique_ptr<ImageDecoder> ios_image_decoder_impl_; gfx::Image decoded_image_;
diff --git a/components/invalidation/impl/fcm_invalidation_listener_unittest.cc b/components/invalidation/impl/fcm_invalidation_listener_unittest.cc index 54d1cac4..69700d1 100644 --- a/components/invalidation/impl/fcm_invalidation_listener_unittest.cc +++ b/components/invalidation/impl/fcm_invalidation_listener_unittest.cc
@@ -284,7 +284,7 @@ Topics registred_topics_; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; data_decoder::TestingJsonParser::ScopedFactoryOverride factory_override_; FCMSyncNetworkChannel* fcm_sync_network_channel_; MockRegistrationManager* registration_manager_;
diff --git a/components/invalidation/impl/fcm_invalidation_service_unittest.cc b/components/invalidation/impl/fcm_invalidation_service_unittest.cc index 0d50ec4..0b049c2 100644 --- a/components/invalidation/impl/fcm_invalidation_service_unittest.cc +++ b/components/invalidation/impl/fcm_invalidation_service_unittest.cc
@@ -202,7 +202,7 @@ ConvertObjectIdInvalidationMapToTopicInvalidationMap(invalidation_map)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; data_decoder::TestingJsonParser::ScopedFactoryOverride factory_override_; std::unique_ptr<gcm::GCMDriver> gcm_driver_; std::unique_ptr<MockInstanceIDDriver> mock_instance_id_driver_;
diff --git a/components/invalidation/impl/fcm_network_handler_unittests.cc b/components/invalidation/impl/fcm_network_handler_unittests.cc index 443850d..7a0349e3 100644 --- a/components/invalidation/impl/fcm_network_handler_unittests.cc +++ b/components/invalidation/impl/fcm_network_handler_unittests.cc
@@ -280,7 +280,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<StrictMock<MockGCMDriver>> mock_gcm_driver_; std::unique_ptr<StrictMock<MockInstanceIDDriver>> mock_instance_id_driver_; std::unique_ptr<StrictMock<MockInstanceID>> mock_instance_id_;
diff --git a/components/invalidation/impl/gcm_invalidation_bridge_unittest.cc b/components/invalidation/impl/gcm_invalidation_bridge_unittest.cc index cfb1d7e..a008a3bb 100644 --- a/components/invalidation/impl/gcm_invalidation_bridge_unittest.cc +++ b/components/invalidation/impl/gcm_invalidation_bridge_unittest.cc
@@ -98,7 +98,7 @@ connection_online_ = online; } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; signin::IdentityTestEnvironment identity_test_env_; std::unique_ptr<gcm::GCMDriver> gcm_driver_; std::unique_ptr<ProfileIdentityProvider> identity_provider_;
diff --git a/components/invalidation/impl/gcm_network_channel_unittest.cc b/components/invalidation/impl/gcm_network_channel_unittest.cc index 13e2c554..d05205e 100644 --- a/components/invalidation/impl/gcm_network_channel_unittest.cc +++ b/components/invalidation/impl/gcm_network_channel_unittest.cc
@@ -189,7 +189,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestGCMNetworkChannelDelegate* delegate_; std::unique_ptr<GCMNetworkChannel> gcm_network_channel_; int network_request_count_;
diff --git a/components/invalidation/impl/invalidation_notifier_unittest.cc b/components/invalidation/impl/invalidation_notifier_unittest.cc index 942cde8f..09ad397 100644 --- a/components/invalidation/impl/invalidation_notifier_unittest.cc +++ b/components/invalidation/impl/invalidation_notifier_unittest.cc
@@ -75,7 +75,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<InvalidationNotifier> invalidator_; };
diff --git a/components/invalidation/impl/non_blocking_invalidator_unittest.cc b/components/invalidation/impl/non_blocking_invalidator_unittest.cc index f5530d0..04a982cc 100644 --- a/components/invalidation/impl/non_blocking_invalidator_unittest.cc +++ b/components/invalidation/impl/non_blocking_invalidator_unittest.cc
@@ -87,7 +87,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::Thread io_thread_; std::unique_ptr<jingle_glue::NetworkServiceConfigTestUtil> net_config_helper_; std::unique_ptr<NonBlockingInvalidator> invalidator_;
diff --git a/components/invalidation/impl/per_user_topic_registration_manager_unittest.cc b/components/invalidation/impl/per_user_topic_registration_manager_unittest.cc index 7b270ca..3eabc1ec 100644 --- a/components/invalidation/impl/per_user_topic_registration_manager_unittest.cc +++ b/components/invalidation/impl/per_user_topic_registration_manager_unittest.cc
@@ -182,7 +182,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; data_decoder::TestingJsonParser::ScopedFactoryOverride factory_override_; network::TestURLLoaderFactory url_loader_factory_; TestingPrefServiceSimple pref_service_;
diff --git a/components/invalidation/impl/per_user_topic_registration_request_unittest.cc b/components/invalidation/impl/per_user_topic_registration_request_unittest.cc index 91306258..06596736 100644 --- a/components/invalidation/impl/per_user_topic_registration_request_unittest.cc +++ b/components/invalidation/impl/per_user_topic_registration_request_unittest.cc
@@ -74,7 +74,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; data_decoder::TestingJsonParser::ScopedFactoryOverride factory_override_; network::TestURLLoaderFactory url_loader_factory_;
diff --git a/components/invalidation/impl/registration_manager_unittest.cc b/components/invalidation/impl/registration_manager_unittest.cc index 6129b4e7..ba0bfb2c 100644 --- a/components/invalidation/impl/registration_manager_unittest.cc +++ b/components/invalidation/impl/registration_manager_unittest.cc
@@ -223,7 +223,7 @@ private: // Needed by timers in RegistrationManager. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(RegistrationManagerTest); };
diff --git a/components/invalidation/impl/sync_invalidation_listener_unittest.cc b/components/invalidation/impl/sync_invalidation_listener_unittest.cc index dac233cb..b76cb7120 100644 --- a/components/invalidation/impl/sync_invalidation_listener_unittest.cc +++ b/components/invalidation/impl/sync_invalidation_listener_unittest.cc
@@ -445,7 +445,7 @@ ObjectIdSet registered_ids_; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; notifier::FakePushClient* const fake_push_client_; protected:
diff --git a/components/invalidation/impl/sync_system_resources_unittest.cc b/components/invalidation/impl/sync_system_resources_unittest.cc index 799dc00..aee59db 100644 --- a/components/invalidation/impl/sync_system_resources_unittest.cc +++ b/components/invalidation/impl/sync_system_resources_unittest.cc
@@ -85,7 +85,7 @@ } // Needed by |sync_system_resources_|. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; MockStateWriter mock_state_writer_; PushClientChannel push_client_channel_; SyncSystemResources sync_system_resources_;
diff --git a/components/invalidation/impl/ticl_invalidation_service_unittest.cc b/components/invalidation/impl/ticl_invalidation_service_unittest.cc index 03223d2..d1ca6f88 100644 --- a/components/invalidation/impl/ticl_invalidation_service_unittest.cc +++ b/components/invalidation/impl/ticl_invalidation_service_unittest.cc
@@ -79,7 +79,7 @@ fake_invalidator_->EmitOnIncomingInvalidation(invalidation_map); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; signin::IdentityTestEnvironment identity_test_env_; std::unique_ptr<gcm::GCMDriver> gcm_driver_; std::unique_ptr<invalidation::IdentityProvider> identity_provider_;
diff --git a/components/language/content/browser/geo_language_model_unittest.cc b/components/language/content/browser/geo_language_model_unittest.cc index 36230f8..85f301ca 100644 --- a/components/language/content/browser/geo_language_model_unittest.cc +++ b/components/language/content/browser/geo_language_model_unittest.cc
@@ -30,8 +30,7 @@ class GeoLanguageModelTest : public testing::Test { public: GeoLanguageModelTest() - : geo_language_provider_( - scoped_task_environment_.GetMainThreadTaskRunner()), + : geo_language_provider_(task_environment_.GetMainThreadTaskRunner()), geo_language_model_(&geo_language_provider_), mock_ip_geo_location_provider_(&mock_geo_location_) { service_manager::mojom::ConnectorRequest request; @@ -58,8 +57,8 @@ GeoLanguageModel* language_model() { return &geo_language_model_; } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; private: GeoLanguageProvider geo_language_provider_; @@ -75,7 +74,7 @@ // Setup a random place in Madhya Pradesh, India. MoveToLocation(23.0, 80.0); StartGeoLanguageProvider(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(language_model()->GetLanguages(), testing::ElementsAre( @@ -87,7 +86,7 @@ // Setup a random place outside of India. MoveToLocation(45.5, 73.5); StartGeoLanguageProvider(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0UL, language_model()->GetLanguages().size()); }
diff --git a/components/language/content/browser/geo_language_provider_unittest.cc b/components/language/content/browser/geo_language_provider_unittest.cc index a006532..267e918 100644 --- a/components/language/content/browser/geo_language_provider_unittest.cc +++ b/components/language/content/browser/geo_language_provider_unittest.cc
@@ -25,8 +25,7 @@ class GeoLanguageProviderTest : public testing::Test { public: GeoLanguageProviderTest() - : geo_language_provider_( - scoped_task_environment_.GetMainThreadTaskRunner()), + : geo_language_provider_(task_environment_.GetMainThreadTaskRunner()), mock_ip_geo_location_provider_(&mock_geo_location_) { service_manager::mojom::ConnectorRequest request; connector_ = service_manager::Connector::Create(&request); @@ -81,8 +80,8 @@ } base::test::ScopedFeatureList scoped_feature_list_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; private: // Object under test. @@ -97,7 +96,7 @@ // Setup a random place in West Bengal, India. MoveToLocation(23.0, 85.7); StartGeoLanguageProvider(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::vector<std::string> expected_langs = {"hi", "bn", "en"}; EXPECT_EQ(expected_langs, GetCurrentGeoLanguages()); @@ -107,7 +106,7 @@ // Setup a random place in Montreal, Canada. MoveToLocation(45.5, 73.5); StartGeoLanguageProvider(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::vector<std::string> expected_langs = {}; EXPECT_EQ(expected_langs, GetCurrentGeoLanguages()); @@ -117,13 +116,13 @@ // Setup a random place in Madhya Pradesh, India. MoveToLocation(23.0, 80.0); StartGeoLanguageProvider(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const std::vector<std::string>& result = GetCurrentGeoLanguages(); std::vector<std::string> expected_langs = {"hi", "en"}; EXPECT_EQ(expected_langs, result); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromHours(12)); + task_environment_.FastForwardBy(base::TimeDelta::FromHours(12)); EXPECT_EQ(1, GetQueryNextPositionCalledTimes()); EXPECT_EQ(expected_langs, GetCachedLanguages()); } @@ -132,7 +131,7 @@ // Setup a random place in Madhya Pradesh, India. MoveToLocation(23.0, 80.0); StartGeoLanguageProvider(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::vector<std::string> result = GetCurrentGeoLanguages(); std::vector<std::string> expected_langs = {"hi", "en"}; @@ -141,7 +140,7 @@ // Move to another random place in Karnataka, India. MoveToLocation(23.0, 85.7); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromHours(25)); + task_environment_.FastForwardBy(base::TimeDelta::FromHours(25)); EXPECT_EQ(2, GetQueryNextPositionCalledTimes()); result = GetCurrentGeoLanguages(); @@ -158,7 +157,7 @@ std::vector<std::string> expected_langs = {"en", "fr"}; EXPECT_EQ(expected_langs, GetCurrentGeoLanguages()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); expected_langs = {"hi", "en"}; EXPECT_EQ(expected_langs, GetCurrentGeoLanguages());
diff --git a/components/leveldb_proto/internal/proto_database_impl_unittest.cc b/components/leveldb_proto/internal/proto_database_impl_unittest.cc index 98ce3ea..2ee3c43 100644 --- a/components/leveldb_proto/internal/proto_database_impl_unittest.cc +++ b/components/leveldb_proto/internal/proto_database_impl_unittest.cc
@@ -394,7 +394,7 @@ private: std::unique_ptr<base::ScopedTempDir> temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::test::ScopedFeatureList scoped_feature_list_; // Shared database.
diff --git a/components/leveldb_proto/internal/shared_proto_database_client_unittest.cc b/components/leveldb_proto/internal/shared_proto_database_client_unittest.cc index d89e912..957c9326 100644 --- a/components/leveldb_proto/internal/shared_proto_database_client_unittest.cc +++ b/components/leveldb_proto/internal/shared_proto_database_client_unittest.cc
@@ -289,7 +289,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<SharedProtoDatabase> db_; std::unique_ptr<base::ScopedTempDir> temp_dir_; @@ -670,4 +670,4 @@ SharedDBMetadataProto::MIGRATION_NOT_ATTEMPTED); } -} // namespace leveldb_proto \ No newline at end of file +} // namespace leveldb_proto
diff --git a/components/leveldb_proto/internal/shared_proto_database_unittest.cc b/components/leveldb_proto/internal/shared_proto_database_unittest.cc index e2a59649..cd6b16d 100644 --- a/components/leveldb_proto/internal/shared_proto_database_unittest.cc +++ b/components/leveldb_proto/internal/shared_proto_database_unittest.cc
@@ -53,7 +53,7 @@ FROM_HERE, base::BindOnce(&SharedProtoDatabase::Init, db_, create_if_missing, client_name, std::move(callback), - scoped_task_environment_.GetMainThreadTaskRunner())); + task_environment_.GetMainThreadTaskRunner())); } void KillDB() { db_.reset(); } @@ -85,14 +85,14 @@ } scoped_refptr<base::SequencedTaskRunner> GetMainThreadTaskRunner() { - return scoped_task_environment_.GetMainThreadTaskRunner(); + return task_environment_.GetMainThreadTaskRunner(); } SharedProtoDatabase* db() { return db_.get(); } ProtoLevelDBWrapper* wrapper() { return db_->db_wrapper_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::ScopedTempDir> temp_dir_; scoped_refptr<SharedProtoDatabase> db_;
diff --git a/components/leveldb_proto/internal/unique_proto_database_unittest.cc b/components/leveldb_proto/internal/unique_proto_database_unittest.cc index 71dcb9c7..9ba27e6c 100644 --- a/components/leveldb_proto/internal/unique_proto_database_unittest.cc +++ b/components/leveldb_proto/internal/unique_proto_database_unittest.cc
@@ -30,7 +30,7 @@ #include "third_party/leveldatabase/leveldb_chrome.h" using base::ScopedTempDir; -using base::test::ScopedTaskEnvironment; +using base::test::TaskEnvironment; using leveldb_env::Options; using testing::_; using testing::Invoke; @@ -231,7 +231,7 @@ } const Matcher<const Options&> options_; - ScopedTaskEnvironment task_environment_; + TaskEnvironment task_environment_; std::unique_ptr<ProtoDatabaseImpl<TestProto>> db_; }; @@ -561,7 +561,7 @@ void TearDown() override { base::RunLoop().RunUntilIdle(); } private: - ScopedTaskEnvironment scoped_task_environment_; + TaskEnvironment task_environment_; }; TEST_F(UniqueProtoDatabaseLevelDBTest, TestDBSaveAndLoadKeys) { @@ -793,7 +793,7 @@ // This tests that normal usage of the real database does not cause any // threading violations. TEST(UniqueProtoDatabaseThreadingTest, TestDBDestruction) { - ScopedTaskEnvironment scoped_task_environment; + TaskEnvironment task_environment; ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -827,7 +827,7 @@ // This tests that normal usage of the real database does not cause any // threading violations. TEST(UniqueProtoDatabaseThreadingTest, TestDBDestroy) { - ScopedTaskEnvironment scoped_task_environment; + TaskEnvironment task_environment; ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
diff --git a/components/media_message_center/media_controls_progress_view_unittest.cc b/components/media_message_center/media_controls_progress_view_unittest.cc index 0caf91c..ecab850c 100644 --- a/components/media_message_center/media_controls_progress_view_unittest.cc +++ b/components/media_message_center/media_controls_progress_view_unittest.cc
@@ -19,7 +19,7 @@ public: MediaControlsProgressViewTest() : views::ViewsTestBase( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~MediaControlsProgressViewTest() override = default; // ViewsTestBase: @@ -110,8 +110,8 @@ base::ASCIIToUTF16("05:00")); EXPECT_EQ(progress_view_->progress_bar_for_testing()->current_value(), .5); - scoped_task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(30)); - scoped_task_environment_->RunUntilIdle(); + task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(30)); + task_environment_->RunUntilIdle(); EXPECT_EQ(progress_view_->duration_for_testing(), base::ASCIIToUTF16("10:00")); @@ -133,8 +133,8 @@ base::ASCIIToUTF16("05:00")); EXPECT_EQ(progress_view_->progress_bar_for_testing()->current_value(), .5); - scoped_task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(15)); - scoped_task_environment_->RunUntilIdle(); + task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(15)); + task_environment_->RunUntilIdle(); EXPECT_EQ(progress_view_->duration_for_testing(), base::ASCIIToUTF16("10:00")); @@ -156,8 +156,8 @@ base::ASCIIToUTF16("05:00")); EXPECT_EQ(progress_view_->progress_bar_for_testing()->current_value(), .5); - scoped_task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(60)); - scoped_task_environment_->RunUntilIdle(); + task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(60)); + task_environment_->RunUntilIdle(); EXPECT_EQ(progress_view_->duration_for_testing(), base::ASCIIToUTF16("10:00")); @@ -179,8 +179,8 @@ base::ASCIIToUTF16("05:00")); EXPECT_EQ(progress_view_->progress_bar_for_testing()->current_value(), .5); - scoped_task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(30)); - scoped_task_environment_->RunUntilIdle(); + task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(30)); + task_environment_->RunUntilIdle(); EXPECT_EQ(progress_view_->duration_for_testing(), base::ASCIIToUTF16("10:00")); @@ -203,8 +203,8 @@ EXPECT_EQ(progress_view_->progress_bar_for_testing()->current_value(), .5); // Move forward in time past the duration. - scoped_task_environment_->FastForwardBy(base::TimeDelta::FromMinutes(6)); - scoped_task_environment_->RunUntilIdle(); + task_environment_->FastForwardBy(base::TimeDelta::FromMinutes(6)); + task_environment_->RunUntilIdle(); // Verify the progress does not go past the duration. EXPECT_EQ(progress_view_->duration_for_testing(), @@ -228,8 +228,8 @@ EXPECT_EQ(progress_view_->progress_bar_for_testing()->current_value(), .5); // Move forward in time before the start using negative playback rate. - scoped_task_environment_->FastForwardBy(base::TimeDelta::FromMinutes(6)); - scoped_task_environment_->RunUntilIdle(); + task_environment_->FastForwardBy(base::TimeDelta::FromMinutes(6)); + task_environment_->RunUntilIdle(); // Verify the progress does not go below 0. EXPECT_EQ(progress_view_->duration_for_testing(), @@ -252,8 +252,8 @@ base::ASCIIToUTF16("05:00")); EXPECT_EQ(progress_view_->progress_bar_for_testing()->current_value(), .5); - scoped_task_environment_->FastForwardBy(base::TimeDelta::FromMinutes(6)); - scoped_task_environment_->RunUntilIdle(); + task_environment_->FastForwardBy(base::TimeDelta::FromMinutes(6)); + task_environment_->RunUntilIdle(); // Verify the progress does not change while media is paused. EXPECT_EQ(progress_view_->duration_for_testing(),
diff --git a/components/metrics/child_call_stack_profile_collector_unittest.cc b/components/metrics/child_call_stack_profile_collector_unittest.cc index 84f33bb..732323b 100644 --- a/components/metrics/child_call_stack_profile_collector_unittest.cc +++ b/components/metrics/child_call_stack_profile_collector_unittest.cc
@@ -50,7 +50,7 @@ return child_collector_.profiles_; } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; mojom::CallStackProfileCollectorPtr receiver_; std::unique_ptr<Receiver> receiver_impl_; ChildCallStackProfileCollector child_collector_;
diff --git a/components/metrics/delegating_provider.cc b/components/metrics/delegating_provider.cc index aeeab06c..6a06ffa 100644 --- a/components/metrics/delegating_provider.cc +++ b/components/metrics/delegating_provider.cc
@@ -63,17 +63,8 @@ void DelegatingProvider::ProvideSystemProfileMetrics( SystemProfileProto* system_profile_proto) { - // ProvideSystemProfileMetricsWithLogCreationTime() should be called instead. - NOTREACHED(); -} - -void DelegatingProvider::ProvideSystemProfileMetricsWithLogCreationTime( - base::TimeTicks log_creation_time, - SystemProfileProto* system_profile_proto) { - for (auto& provider : metrics_providers_) { - provider->ProvideSystemProfileMetricsWithLogCreationTime( - log_creation_time, system_profile_proto); - } + for (auto& provider : metrics_providers_) + provider->ProvideSystemProfileMetrics(system_profile_proto); } bool DelegatingProvider::HasPreviousSessionData() {
diff --git a/components/metrics/delegating_provider.h b/components/metrics/delegating_provider.h index 4e0cd1a..24fa7c7 100644 --- a/components/metrics/delegating_provider.h +++ b/components/metrics/delegating_provider.h
@@ -36,9 +36,6 @@ bool HasIndependentMetrics() override; void ProvideSystemProfileMetrics( SystemProfileProto* system_profile_proto) override; - void ProvideSystemProfileMetricsWithLogCreationTime( - base::TimeTicks log_creation_time, - SystemProfileProto* system_profile_proto) override; bool HasPreviousSessionData() override; void ProvidePreviousSessionData( ChromeUserMetricsExtension* uma_proto) override;
diff --git a/components/metrics/field_trials_provider.cc b/components/metrics/field_trials_provider.cc index bb7c97b..9e5bbeb 100644 --- a/components/metrics/field_trials_provider.cc +++ b/components/metrics/field_trials_provider.cc
@@ -36,14 +36,13 @@ variations::GetFieldTrialActiveGroupIds(suffix_, field_trial_ids); } -void FieldTrialsProvider::ProvideSystemProfileMetrics( - metrics::SystemProfileProto* system_profile_proto) { - // ProvideSystemProfileMetricsWithLogCreationTime() should be called instead. - NOTREACHED(); +void FieldTrialsProvider::OnDidCreateMetricsLog() { + if (registry_) { + creation_times_.push_back(base::TimeTicks::Now()); + } } -void FieldTrialsProvider::ProvideSystemProfileMetricsWithLogCreationTime( - base::TimeTicks log_creation_time, +void FieldTrialsProvider::ProvideSystemProfileMetrics( metrics::SystemProfileProto* system_profile_proto) { std::vector<ActiveGroupId> field_trial_ids; const std::string& version = variations::GetSeedVersion(); @@ -53,8 +52,14 @@ WriteFieldTrials(field_trial_ids, system_profile_proto); if (registry_) { + base::TimeTicks creation_time; + // Should always be true, but don't crash even if there is a bug. + if (!creation_times_.empty()) { + creation_time = creation_times_.back(); + creation_times_.pop_back(); + } std::vector<ActiveGroupId> synthetic_trials; - registry_->GetSyntheticFieldTrialsOlderThan(log_creation_time, + registry_->GetSyntheticFieldTrialsOlderThan(creation_time, &synthetic_trials); WriteFieldTrials(synthetic_trials, system_profile_proto); }
diff --git a/components/metrics/field_trials_provider.h b/components/metrics/field_trials_provider.h index 6d115e5..d93988e 100644 --- a/components/metrics/field_trials_provider.h +++ b/components/metrics/field_trials_provider.h
@@ -5,6 +5,8 @@ #ifndef COMPONENTS_METRICS_FIELD_TRIALS_PROVIDER_H_ #define COMPONENTS_METRICS_FIELD_TRIALS_PROVIDER_H_ +#include <vector> + #include "base/strings/string_piece.h" #include "base/time/time.h" #include "components/metrics/metrics_provider.h" @@ -25,11 +27,9 @@ ~FieldTrialsProvider() override; // metrics::MetricsProvider: + void OnDidCreateMetricsLog() override; void ProvideSystemProfileMetrics( metrics::SystemProfileProto* system_profile_proto) override; - void ProvideSystemProfileMetricsWithLogCreationTime( - base::TimeTicks log_creation_time, - metrics::SystemProfileProto* system_profile_proto) override; private: // Overrideable for testing. @@ -41,7 +41,13 @@ // Suffix used for the field trial names before they are hashed for uploads. std::string suffix_; - DISALLOW_COPY_AND_ASSIGN(FieldTrialsProvider); + // A stack of log creation times. + // While the initial metrics log exists, there will be two logs open. + // Use a stack so that we use the right creation time for the first ongoing + // log. + // TODO(crbug/746098): Simplify InitialMetricsLog logic so this is not + // necessary. + std::vector<base::TimeTicks> creation_times_; }; } // namespace variations
diff --git a/components/metrics/field_trials_provider_unittest.cc b/components/metrics/field_trials_provider_unittest.cc index 0190615..d7974c7 100644 --- a/components/metrics/field_trials_provider_unittest.cc +++ b/components/metrics/field_trials_provider_unittest.cc
@@ -96,17 +96,14 @@ // Make sure these trials are older than the log. WaitUntilTimeChanges(base::TimeTicks::Now()); - // Get the current time and wait for it to change. - base::TimeTicks log_creation_time = base::TimeTicks::Now(); - + provider.OnDidCreateMetricsLog(); // Make sure that the log is older than the trials that should be excluded. - WaitUntilTimeChanges(log_creation_time); + WaitUntilTimeChanges(base::TimeTicks::Now()); RegisterExtraSyntheticTrial(); metrics::SystemProfileProto proto; - provider.ProvideSystemProfileMetricsWithLogCreationTime(log_creation_time, - &proto); + provider.ProvideSystemProfileMetrics(&proto); ASSERT_EQ(base::size(kFieldTrialIds) + base::size(kSyntheticTrials), static_cast<size_t>(proto.field_trial_size())); @@ -118,8 +115,7 @@ TestProvider provider(nullptr, base::StringPiece()); metrics::SystemProfileProto proto; - provider.ProvideSystemProfileMetricsWithLogCreationTime(base::TimeTicks(), - &proto); + provider.ProvideSystemProfileMetrics(&proto); ASSERT_EQ(base::size(kFieldTrialIds), static_cast<size_t>(proto.field_trial_size()));
diff --git a/components/metrics/metrics_log.cc b/components/metrics/metrics_log.cc index 3868423..1f3f1ec 100644 --- a/components/metrics/metrics_log.cc +++ b/components/metrics/metrics_log.cc
@@ -297,10 +297,7 @@ const SystemProfileProto& MetricsLog::RecordEnvironment( DelegatingProvider* delegating_provider) { - // Clear any previous system profile. This will be present in the case when - // the initial system profile got recorded on start up. Clearing it ensures - // there is no duplication of repeated fields. - uma_proto()->clear_system_profile(); + DCHECK(!has_environment_); has_environment_ = true; SystemProfileProto* system_profile = uma_proto()->mutable_system_profile(); @@ -312,8 +309,7 @@ if (client_->GetBrand(&brand_code)) system_profile->set_brand_code(brand_code); - delegating_provider->ProvideSystemProfileMetricsWithLogCreationTime( - creation_time_, system_profile); + delegating_provider->ProvideSystemProfileMetrics(system_profile); return *system_profile; }
diff --git a/components/metrics/metrics_provider.cc b/components/metrics/metrics_provider.cc index fb6fd3d..390f5806 100644 --- a/components/metrics/metrics_provider.cc +++ b/components/metrics/metrics_provider.cc
@@ -48,12 +48,7 @@ } void MetricsProvider::ProvideSystemProfileMetrics( - SystemProfileProto* system_profile_proto) {} - -void MetricsProvider::ProvideSystemProfileMetricsWithLogCreationTime( - base::TimeTicks log_creation_time, SystemProfileProto* system_profile_proto) { - ProvideSystemProfileMetrics(system_profile_proto); } bool MetricsProvider::HasPreviousSessionData() {
diff --git a/components/metrics/metrics_provider.h b/components/metrics/metrics_provider.h index 9560bcb5..b1af6620 100644 --- a/components/metrics/metrics_provider.h +++ b/components/metrics/metrics_provider.h
@@ -7,7 +7,6 @@ #include "base/callback.h" #include "base/macros.h" -#include "base/time/time.h" namespace base { class HistogramSnapshotManager; @@ -65,19 +64,10 @@ ChromeUserMetricsExtension* uma_proto, base::HistogramSnapshotManager* snapshot_manager); - // Provides additional metrics into the system profile. This is a convenience - // method over ProvideSystemProfileMetricsWithLogCreationTime() without the - // |log_creation_time| param. Should not be called directly by services. + // Provides additional metrics into the system profile. virtual void ProvideSystemProfileMetrics( SystemProfileProto* system_profile_proto); - // Provides additional metrics into the system profile. The log creation - // time param provides a timestamp of when the log was opened, which is needed - // for some metrics providers. - virtual void ProvideSystemProfileMetricsWithLogCreationTime( - base::TimeTicks log_creation_time, - SystemProfileProto* system_profile_proto); - // Called once at startup to see whether this provider has critical data // to provide about the previous session. // Returning true will trigger ProvidePreviousSessionData on all other
diff --git a/components/metrics/metrics_service.cc b/components/metrics/metrics_service.cc index d170db88..1d7ce1d 100644 --- a/components/metrics/metrics_service.cc +++ b/components/metrics/metrics_service.cc
@@ -316,17 +316,16 @@ state_manager_->ForceClientIdCreation(); client_->SetMetricsClientId(state_manager_->client_id()); + SystemProfileProto system_profile; + MetricsLog::RecordCoreSystemProfile(client_, &system_profile); + GlobalPersistentSystemProfile::GetInstance()->SetSystemProfile( + system_profile, /*complete=*/false); + if (!log_manager_.current_log()) OpenNewLog(); delegating_provider_.OnRecordingEnabled(); - // Fill in the system profile in the log and persist it (to prefs, .pma and - // crashpad). This includes running the providers so that information like - // field trials and hardware info is provided. If Chrome crashes before this - // log is completed, the .pma file will have this system profile. - RecordCurrentEnvironment(log_manager_.current_log(), /*complete=*/false); - base::RemoveActionCallback(action_callback_); action_callback_ = base::Bind(&MetricsService::OnUserAction, base::Unretained(this)); @@ -621,7 +620,7 @@ // MetricsLog class. MetricsLog* current_log = log_manager_.current_log(); DCHECK(current_log); - RecordCurrentEnvironment(current_log, /*complete=*/true); + RecordCurrentEnvironment(current_log); base::TimeDelta incremental_uptime; base::TimeDelta uptime; GetUptimes(local_state_, &incremental_uptime, &uptime); @@ -753,7 +752,7 @@ void MetricsService::PrepareInitialMetricsLog() { DCHECK_EQ(INIT_TASK_DONE, state_); - RecordCurrentEnvironment(initial_metrics_log_.get(), /*complete=*/true); + RecordCurrentEnvironment(initial_metrics_log_.get()); base::TimeDelta incremental_uptime; base::TimeDelta uptime; GetUptimes(local_state_, &incremental_uptime, &uptime); @@ -807,14 +806,6 @@ log_type, client_); } -void MetricsService::SetPersistentSystemProfile( - const std::string& serialized_proto, - bool complete) { - GlobalPersistentSystemProfile::GetInstance()->SetSystemProfile( - serialized_proto, complete); -} - -// static std::string MetricsService::RecordCurrentEnvironmentHelper( MetricsLog* log, PrefService* local_state, @@ -825,12 +816,12 @@ return recorder.SerializeAndRecordEnvironmentToPrefs(system_profile); } -void MetricsService::RecordCurrentEnvironment(MetricsLog* log, bool complete) { +void MetricsService::RecordCurrentEnvironment(MetricsLog* log) { DCHECK(client_); std::string serialized_proto = RecordCurrentEnvironmentHelper(log, local_state_, &delegating_provider_); - - SetPersistentSystemProfile(serialized_proto, complete); + GlobalPersistentSystemProfile::GetInstance()->SetSystemProfile( + serialized_proto, /*complete=*/true); client_->OnEnvironmentUpdate(&serialized_proto); }
diff --git a/components/metrics/metrics_service.h b/components/metrics/metrics_service.h index aec3471..5414270 100644 --- a/components/metrics/metrics_service.h +++ b/components/metrics/metrics_service.h
@@ -38,6 +38,8 @@ class PrefRegistrySimple; FORWARD_DECLARE_TEST(ChromeMetricsServiceClientTest, TestRegisterMetricsServiceProviders); +FORWARD_DECLARE_TEST(IOSChromeMetricsServiceClientTest, + TestRegisterMetricsServiceProviders); namespace base { class HistogramSamples; @@ -180,10 +182,6 @@ return reporting_service_.metrics_log_store(); } - // Sets the persistent system profile. Virtual for tests. - virtual void SetPersistentSystemProfile(const std::string& serialized_proto, - bool complete); - // Records the current environment (system profile) in |log|, and persists // the results in prefs. // Exposed for testing. @@ -295,7 +293,8 @@ // Records the current environment (system profile) in |log|, and persists // the results in prefs and GlobalPersistentSystemProfile. - void RecordCurrentEnvironment(MetricsLog* log, bool complete); + // Exposed for testing. + void RecordCurrentEnvironment(MetricsLog* log); // Record complete list of histograms into the current log. // Called when we close a log. @@ -393,6 +392,8 @@ FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); FRIEND_TEST_ALL_PREFIXES(::ChromeMetricsServiceClientTest, TestRegisterMetricsServiceProviders); + FRIEND_TEST_ALL_PREFIXES(::IOSChromeMetricsServiceClientTest, + TestRegisterMetricsServiceProviders); SEQUENCE_CHECKER(sequence_checker_); // Weak pointers factory used to post task on different threads. All weak
diff --git a/components/metrics/metrics_service_unittest.cc b/components/metrics/metrics_service_unittest.cc index 43d7d30..bf84ff3 100644 --- a/components/metrics/metrics_service_unittest.cc +++ b/components/metrics/metrics_service_unittest.cc
@@ -62,24 +62,7 @@ using MetricsService::log_store; using MetricsService::RecordCurrentEnvironmentHelper; - // MetricsService: - void SetPersistentSystemProfile(const std::string& serialized_proto, - bool complete) override { - persistent_system_profile_provided_ = true; - persistent_system_profile_complete_ = complete; - } - - bool persistent_system_profile_provided() const { - return persistent_system_profile_provided_; - } - bool persistent_system_profile_complete() const { - return persistent_system_profile_complete_; - } - private: - bool persistent_system_profile_provided_ = false; - bool persistent_system_profile_complete_ = false; - DISALLOW_COPY_AND_ASSIGN(TestMetricsService); }; @@ -362,30 +345,6 @@ EXPECT_TRUE(test_provider->init_called()); } -TEST_F(MetricsServiceTest, SystemProfileDataProvidedOnEnableRecording) { - EnableMetricsReporting(); - TestMetricsServiceClient client; - TestMetricsService service(GetMetricsStateManager(), &client, - GetLocalState()); - - TestMetricsProvider* test_provider = new TestMetricsProvider(); - service.RegisterMetricsProvider( - std::unique_ptr<MetricsProvider>(test_provider)); - - service.InitializeMetricsRecordingState(); - - // ProvideSystemProfileMetrics() shouldn't be called initially. - EXPECT_FALSE(test_provider->provide_system_profile_metrics_called()); - EXPECT_FALSE(service.persistent_system_profile_provided()); - - service.Start(); - - // Start should call ProvideSystemProfileMetrics(). - EXPECT_TRUE(test_provider->provide_system_profile_metrics_called()); - EXPECT_TRUE(service.persistent_system_profile_provided()); - EXPECT_FALSE(service.persistent_system_profile_complete()); -} - TEST_F(MetricsServiceTest, SplitRotation) { EnableMetricsReporting(); TestMetricsServiceClient client;
diff --git a/components/metrics/net/net_metrics_log_uploader_unittest.cc b/components/metrics/net/net_metrics_log_uploader_unittest.cc index 484f490..ec8283f 100644 --- a/components/metrics/net/net_metrics_log_uploader_unittest.cc +++ b/components/metrics/net/net_metrics_log_uploader_unittest.cc
@@ -113,7 +113,7 @@ scoped_refptr<network::SharedURLLoaderFactory> test_shared_url_loader_factory_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop loop_; std::string upload_data_;
diff --git a/components/metrics/single_sample_metrics_factory_impl_unittest.cc b/components/metrics/single_sample_metrics_factory_impl_unittest.cc index a14d23f..b1d62a1 100644 --- a/components/metrics/single_sample_metrics_factory_impl_unittest.cc +++ b/components/metrics/single_sample_metrics_factory_impl_unittest.cc
@@ -75,7 +75,7 @@ kBucketCount); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; SingleSampleMetricsFactoryImpl* factory_; base::Thread thread_; size_t provider_count_ = 0;
diff --git a/components/metrics/ui/screen_info_metrics_provider.cc b/components/metrics/ui/screen_info_metrics_provider.cc index 4465d903..f35639af 100644 --- a/components/metrics/ui/screen_info_metrics_provider.cc +++ b/components/metrics/ui/screen_info_metrics_provider.cc
@@ -66,17 +66,12 @@ void ScreenInfoMetricsProvider::ProvideSystemProfileMetrics( SystemProfileProto* system_profile_proto) { - // This may be called before the screen info has been initialized, such as - // when the persistent system profile gets filled in initially. - const base::Optional<gfx::Size> display_size = GetScreenSize(); - if (!display_size.has_value()) - return; - SystemProfileProto::Hardware* hardware = system_profile_proto->mutable_hardware(); - hardware->set_primary_screen_width(display_size->width()); - hardware->set_primary_screen_height(display_size->height()); + const gfx::Size display_size = GetScreenSize(); + hardware->set_primary_screen_width(display_size.width()); + hardware->set_primary_screen_height(display_size.height()); hardware->set_primary_screen_scale_factor(GetScreenDeviceScaleFactor()); hardware->set_screen_count(GetScreenCount()); @@ -85,11 +80,8 @@ #endif } -base::Optional<gfx::Size> ScreenInfoMetricsProvider::GetScreenSize() const { - auto* screen = display::Screen::GetScreen(); - if (!screen) - return base::nullopt; - return base::make_optional(screen->GetPrimaryDisplay().GetSizeInPixel()); +gfx::Size ScreenInfoMetricsProvider::GetScreenSize() const { + return display::Screen::GetScreen()->GetPrimaryDisplay().GetSizeInPixel(); } float ScreenInfoMetricsProvider::GetScreenDeviceScaleFactor() const {
diff --git a/components/metrics/ui/screen_info_metrics_provider.h b/components/metrics/ui/screen_info_metrics_provider.h index f92caac0b..51ef2b7 100644 --- a/components/metrics/ui/screen_info_metrics_provider.h +++ b/components/metrics/ui/screen_info_metrics_provider.h
@@ -6,7 +6,6 @@ #define COMPONENTS_METRICS_UI_SCREEN_INFO_METRICS_PROVIDER_H_ #include "base/macros.h" -#include "base/optional.h" #include "components/metrics/metrics_provider.h" #include "ui/gfx/geometry/size.h" @@ -25,8 +24,8 @@ protected: // Exposed for the sake of mocking in test code. - // Returns the screen size for the primary monitor if available. - virtual base::Optional<gfx::Size> GetScreenSize() const; + // Returns the screen size for the primary monitor. + virtual gfx::Size GetScreenSize() const; // Returns the device scale factor for the primary monitor. virtual float GetScreenDeviceScaleFactor() const;
diff --git a/components/metrics/ui/screen_info_metrics_provider_unittest.cc b/components/metrics/ui/screen_info_metrics_provider_unittest.cc index 0c74ac4..836e977 100644 --- a/components/metrics/ui/screen_info_metrics_provider_unittest.cc +++ b/components/metrics/ui/screen_info_metrics_provider_unittest.cc
@@ -24,8 +24,8 @@ ~TestScreenInfoMetricsProvider() override {} private: - base::Optional<gfx::Size> GetScreenSize() const override { - return base::make_optional(gfx::Size(kScreenWidth, kScreenHeight)); + gfx::Size GetScreenSize() const override { + return gfx::Size(kScreenWidth, kScreenHeight); } float GetScreenDeviceScaleFactor() const override {
diff --git a/components/mirroring/browser/single_client_video_capture_host_unittest.cc b/components/mirroring/browser/single_client_video_capture_host_unittest.cc index 826667ee..e0555576 100644 --- a/components/mirroring/browser/single_client_video_capture_host_unittest.cc +++ b/components/mirroring/browser/single_client_video_capture_host_unittest.cc
@@ -242,7 +242,7 @@ run_loop.Run(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockVideoCaptureObserver> consumer_; base::WeakPtr<VideoFrameReceiver> frame_receiver_; MockVideoCaptureDevice* launched_device_ = nullptr; @@ -280,7 +280,7 @@ { EXPECT_CALL(*consumer_, OnBufferDestroyedCall(0)).Times(0); frame_receiver_->OnBufferRetired(0); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Re-use buffer 0.
diff --git a/components/mirroring/service/captured_audio_input_unittest.cc b/components/mirroring/service/captured_audio_input_unittest.cc index 060c14b75..02d3936 100644 --- a/components/mirroring/service/captured_audio_input_unittest.cc +++ b/components/mirroring/service/captured_audio_input_unittest.cc
@@ -51,9 +51,7 @@ public: CapturedAudioInputTest() {} - ~CapturedAudioInputTest() override { - scoped_task_environment_.RunUntilIdle(); - } + ~CapturedAudioInputTest() override { task_environment_.RunUntilIdle(); } void CreateMockStream(bool initially_muted, mojom::AudioStreamCreatorClientPtr client, @@ -91,7 +89,7 @@ void CloseStream() { EXPECT_TRUE(audio_input_); audio_input_->CloseStream(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); socket_.Close(); audio_input_.reset(); stream_ = nullptr; @@ -134,7 +132,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<media::AudioInputIPC> audio_input_; MockDelegate delegate_; MockStream* stream_ = nullptr;
diff --git a/components/mirroring/service/media_remoter_unittest.cc b/components/mirroring/service/media_remoter_unittest.cc index 4d58946..e7ceff60 100644 --- a/components/mirroring/service/media_remoter_unittest.cc +++ b/components/mirroring/service/media_remoter_unittest.cc
@@ -74,7 +74,7 @@ mojo::MakeRequest(&inbound_channel_), error_callback_.Get()), sink_metadata_(DefaultSinkMetadata()) {} - ~MediaRemoterTest() override { scoped_task_environment_.RunUntilIdle(); } + ~MediaRemoterTest() override { task_environment_.RunUntilIdle(); } protected: MOCK_METHOD1(Send, void(mojom::CastMessagePtr)); @@ -97,7 +97,7 @@ EXPECT_CALL(remoting_source_, OnSinkAvailable(_)).Times(1); media_remoter_ = std::make_unique<MediaRemoter>(this, sink_metadata_, &message_dispatcher_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Mock::VerifyAndClear(this); Mock::VerifyAndClear(&remoting_source_); } @@ -107,7 +107,7 @@ ASSERT_TRUE(remoter_); EXPECT_CALL(*this, RequestRemotingStreaming()).Times(1); remoter_->Start(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Mock::VerifyAndClear(this); } @@ -119,7 +119,7 @@ EXPECT_CALL(remoting_source_, OnSinkGone()).Times(1); EXPECT_CALL(*this, RestartMirroringStreaming()).Times(1); remoter_->Stop(media::mojom::RemotingStopReason::USER_DISABLED); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Mock::VerifyAndClear(this); Mock::VerifyAndClear(&remoting_source_); } @@ -130,15 +130,15 @@ scoped_refptr<media::cast::CastEnvironment> cast_environment = new media::cast::CastEnvironment( base::DefaultTickClock::GetInstance(), - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner()); EXPECT_CALL(remoting_source_, OnStarted()).Times(1); media_remoter_->StartRpcMessaging( cast_environment, nullptr, media::cast::FrameSenderConfig(), MirrorSettings::GetDefaultVideoConfig(RtpPayloadType::REMOTE_VIDEO, Codec::CODEC_VIDEO_REMOTE)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Mock::VerifyAndClear(&remoting_source_); } @@ -146,7 +146,7 @@ void MirroringResumed() { EXPECT_CALL(remoting_source_, OnSinkAvailable(_)).Times(1); media_remoter_->OnMirroringResumed(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Mock::VerifyAndClear(&remoting_source_); } @@ -157,7 +157,7 @@ EXPECT_CALL(remoting_source_, OnSinkGone()).Times(1); EXPECT_CALL(*this, RestartMirroringStreaming()).Times(1); media_remoter_->OnRemotingFailed(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Mock::VerifyAndClear(this); Mock::VerifyAndClear(&remoting_source_); } @@ -169,7 +169,7 @@ return outbound_channel_ptr; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::Binding<mojom::CastMessageChannel> binding_; base::MockCallback<MessageDispatcher::ErrorCallback> error_callback_; mojom::CastMessageChannelPtr inbound_channel_;
diff --git a/components/mirroring/service/message_dispatcher_unittest.cc b/components/mirroring/service/message_dispatcher_unittest.cc index 62c19d6..ff8f904 100644 --- a/components/mirroring/service/message_dispatcher_unittest.cc +++ b/components/mirroring/service/message_dispatcher_unittest.cc
@@ -73,7 +73,7 @@ base::BindRepeating(&MessageDispatcherTest::OnStatusResponse, base::Unretained(this))); } - ~MessageDispatcherTest() override { scoped_task_environment_.RunUntilIdle(); } + ~MessageDispatcherTest() override { task_environment_.RunUntilIdle(); } void OnParsingError(const std::string& error_message) { last_error_message_ = error_message; @@ -103,7 +103,7 @@ inbound_channel_->Send(message.Clone()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MessageDispatcher> message_dispatcher_; CastMessage last_outbound_message_; std::string last_error_message_; @@ -120,14 +120,14 @@ const std::string test1 = "{\"a\": 1, \"b\": 2}"; const CastMessage message1 = CastMessage{mojom::kWebRtcNamespace, test1}; message_dispatcher_->SendOutboundMessage(message1.Clone()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(IsEqual(message1, last_outbound_message_)); EXPECT_TRUE(last_error_message_.empty()); const std::string test2 = "{\"m\": 99, \"i\": 98, \"u\": 97}"; const CastMessage message2 = CastMessage{mojom::kWebRtcNamespace, test2}; message_dispatcher_->SendOutboundMessage(message2.Clone()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(IsEqual(message2, last_outbound_message_)); EXPECT_TRUE(last_error_message_.empty()); } @@ -141,7 +141,7 @@ const CastMessage answer_message = CastMessage{mojom::kWebRtcNamespace, answer_response}; SendInboundMessage(answer_message); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(last_answer_response_); EXPECT_FALSE(last_status_response_); EXPECT_EQ(12345, last_answer_response_->sequence_number); @@ -160,7 +160,7 @@ const CastMessage status_message = CastMessage{mojom::kWebRtcNamespace, status_response}; SendInboundMessage(status_message); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(last_answer_response_); ASSERT_TRUE(last_status_response_); EXPECT_EQ(12345, last_status_response_->sequence_number); @@ -174,7 +174,7 @@ // nothing should happen. message_dispatcher_->Unsubscribe(ResponseType::ANSWER); SendInboundMessage(answer_message); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(last_answer_response_); EXPECT_FALSE(last_status_response_); EXPECT_FALSE(last_error_message_.empty()); // Expect an error reported. @@ -183,7 +183,7 @@ // However, STATUS_RESPONSE messages should still be dispatcher to the // remaining subscriber. SendInboundMessage(status_message); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(last_answer_response_); EXPECT_TRUE(last_status_response_); last_status_response_.reset(); @@ -193,13 +193,13 @@ // either an ANSWER or a STATUS_RESPONSE message, nothing should happen. message_dispatcher_->Unsubscribe(ResponseType::STATUS_RESPONSE); SendInboundMessage(answer_message); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(last_answer_response_); EXPECT_FALSE(last_status_response_); EXPECT_FALSE(last_error_message_.empty()); last_error_message_.clear(); SendInboundMessage(status_message); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(last_answer_response_); EXPECT_FALSE(last_status_response_); EXPECT_FALSE(last_error_message_.empty()); @@ -209,7 +209,7 @@ const CastMessage message = CastMessage{mojom::kWebRtcNamespace, "MUAHAHAHAHAHAHAHA!"}; SendInboundMessage(message); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(last_answer_response_); EXPECT_FALSE(last_status_response_); EXPECT_FALSE(last_error_message_.empty()); @@ -222,7 +222,7 @@ const CastMessage answer_message = CastMessage{"Wrong_namespace", answer_response}; SendInboundMessage(answer_message); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(last_answer_response_); EXPECT_FALSE(last_status_response_); // Messages with different namespace are ignored with no error reported. @@ -233,7 +233,7 @@ EXPECT_FALSE(last_answer_response_); EXPECT_FALSE(last_status_response_); message_dispatcher_->Unsubscribe(ResponseType::ANSWER); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const std::string fake_offer = "{\"type\":\"OFFER\",\"seqNum\":45623}"; const CastMessage offer_message = CastMessage{mojom::kWebRtcNamespace, fake_offer}; @@ -242,7 +242,7 @@ base::TimeDelta::FromMilliseconds(100), base::BindRepeating(&MessageDispatcherTest::OnAnswerResponse, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Received the request to send the outbound message. EXPECT_TRUE(IsEqual(offer_message, last_outbound_message_)); @@ -252,7 +252,7 @@ CastMessage answer_message = CastMessage{mojom::kWebRtcNamespace, answer_response}; SendInboundMessage(answer_message); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // The answer message with mismatched sequence number is ignored. EXPECT_FALSE(last_answer_response_); EXPECT_FALSE(last_status_response_); @@ -263,7 +263,7 @@ "\"answer\":{\"udpPort\":50691}}"; answer_message = CastMessage{mojom::kWebRtcNamespace, answer_response}; SendInboundMessage(answer_message); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(last_answer_response_); EXPECT_FALSE(last_status_response_); EXPECT_TRUE(last_error_message_.empty()); @@ -275,7 +275,7 @@ // Expect that the callback for ANSWER message was already unsubscribed. SendInboundMessage(answer_message); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(last_answer_response_); EXPECT_FALSE(last_status_response_); EXPECT_FALSE(last_error_message_.empty()); @@ -288,7 +288,7 @@ base::TimeDelta::FromMilliseconds(100), base::BindRepeating(&MessageDispatcherTest::OnAnswerResponse, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Received the request to send the outbound message. EXPECT_TRUE(IsEqual(fake_message, last_outbound_message_)); EXPECT_FALSE(last_answer_response_); @@ -296,7 +296,7 @@ // Destroy the dispatcher. message_dispatcher_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_FALSE(last_answer_response_); EXPECT_FALSE(last_status_response_); }
diff --git a/components/mirroring/service/remoting_sender_unittest.cc b/components/mirroring/service/remoting_sender_unittest.cc index 2dab6e4..5ec6bcc9 100644 --- a/components/mirroring/service/remoting_sender_unittest.cc +++ b/components/mirroring/service/remoting_sender_unittest.cc
@@ -107,9 +107,9 @@ RemotingSenderTest() : cast_environment_(new media::cast::CastEnvironment( base::DefaultTickClock::GetInstance(), - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner())), + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner())), expecting_error_callback_run_(false), receiver_ssrc_(-1) { const MojoCreateDataPipeOptions data_pipe_options{ @@ -150,7 +150,7 @@ } // Allow pending tasks, such as Mojo method calls, to execute. - void RunPendingTasks() { scoped_task_environment_.RunUntilIdle(); } + void RunPendingTasks() { task_environment_.RunUntilIdle(); } protected: media::cast::FrameId latest_acked_frame_id() const { @@ -250,7 +250,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const scoped_refptr<media::cast::CastEnvironment> cast_environment_; FakeTransport transport_; std::unique_ptr<RemotingSender> remoting_sender_;
diff --git a/components/mirroring/service/rtp_stream_unittest.cc b/components/mirroring/service/rtp_stream_unittest.cc index b3b9bbe..098e87b0 100644 --- a/components/mirroring/service/rtp_stream_unittest.cc +++ b/components/mirroring/service/rtp_stream_unittest.cc
@@ -61,16 +61,16 @@ RtpStreamTest() : cast_environment_(new media::cast::CastEnvironment( &testing_clock_, - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner())) { + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner())) { testing_clock_.Advance(base::TimeTicks::Now() - base::TimeTicks()); } - ~RtpStreamTest() override { scoped_task_environment_.RunUntilIdle(); } + ~RtpStreamTest() override { task_environment_.RunUntilIdle(); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::SimpleTestTickClock testing_clock_; const scoped_refptr<media::cast::CastEnvironment> cast_environment_; DummyClient client_; @@ -105,7 +105,7 @@ run_loop.Run(); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Test the audio streaming pipeline. @@ -131,7 +131,7 @@ run_loop.Run(); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } // namespace mirroring
diff --git a/components/mirroring/service/session_monitor_unittest.cc b/components/mirroring/service/session_monitor_unittest.cc index 29fcd700..9b21602 100644 --- a/components/mirroring/service/session_monitor_unittest.cc +++ b/components/mirroring/service/session_monitor_unittest.cc
@@ -142,37 +142,37 @@ "\"wifiFcsError\": [12, 13, 12, 12]}" // This will be ignored. "}"; inbound_channel_->Send(message.Clone()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } void StartStreamingSession() { cast_environment_ = new media::cast::CastEnvironment( base::DefaultTickClock::GetInstance(), - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner()); EXPECT_TRUE(session_monitor_); auto wifi_status_monitor = std::make_unique<WifiStatusMonitor>(&message_dispatcher_); session_monitor_->StartStreamingSession( cast_environment_, std::move(wifi_status_monitor), SessionMonitor::AUDIO_AND_VIDEO, false /* is_remoting */); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void StopStreamingSession() { EXPECT_TRUE(session_monitor_); session_monitor_->StopStreamingSession(); cast_environment_ = nullptr; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } std::vector<SessionMonitor::EventsAndStats> AssembleBundleAndVerify( const std::vector<int32_t>& bundle_sizes) { std::vector<SessionMonitor::EventsAndStats> bundles = session_monitor_->AssembleBundlesAndClear(bundle_sizes); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(bundle_sizes.size(), bundles.size()); for (size_t i = 0; i < bundles.size(); ++i) { EXPECT_FALSE(bundles[i].first.empty()); @@ -197,19 +197,19 @@ url_loader_factory_->AddResponse( "http://" + receiver_address_.ToString() + ":8008/setup/eureka_info", setup_info); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void TakeSnapshot() { ASSERT_TRUE(session_monitor_); session_monitor_->TakeSnapshot(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void ReportError(SessionError error) { ASSERT_TRUE(session_monitor_); session_monitor_->OnStreamingError(error); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } private: @@ -219,7 +219,7 @@ return outbound_channel_ptr; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const net::IPAddress receiver_address_; mojo::Binding<mojom::CastMessageChannel> binding_; mojom::CastMessageChannelPtr inbound_channel_;
diff --git a/components/mirroring/service/session_unittest.cc b/components/mirroring/service/session_unittest.cc index a256406d..ebb5aa3 100644 --- a/components/mirroring/service/session_unittest.cc +++ b/components/mirroring/service/session_unittest.cc
@@ -78,7 +78,7 @@ session_observer_binding_(this), outbound_channel_binding_(this) {} - ~SessionTest() override { scoped_task_environment_.RunUntilIdle(); } + ~SessionTest() override { task_environment_.RunUntilIdle(); } protected: // mojom::SessionObserver implemenation. @@ -185,7 +185,7 @@ response.answer = std::move(answer); session_->OnAnswer(audio_configs, video_configs, response); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Create a mirroring session. Expect to send OFFER message. @@ -212,7 +212,7 @@ std::move(session_observer_ptr), std::move(resource_provider_ptr), std::move(outbound_channel_ptr), mojo::MakeRequest(&inbound_channel_), nullptr); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Mock::VerifyAndClear(this); } @@ -231,7 +231,7 @@ EXPECT_CALL(*this, OnOutboundMessage("GET_CAPABILITIES")).Times(1); EXPECT_CALL(*this, DidStart()).Times(1); SendAnswer(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Mock::VerifyAndClear(this); } @@ -240,7 +240,7 @@ EXPECT_CALL(*video_host_, OnStopped()).Times(1); EXPECT_CALL(*this, DidStop()).Times(1); session_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Mock::VerifyAndClear(this); } @@ -252,7 +252,7 @@ EXPECT_CALL(*video_host_, ReleaseBuffer(_, _, _)).Times(1); // Send one video frame to the consumer. video_host_->SendOneFrame(gfx::Size(64, 32), base::TimeTicks::Now()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Mock::VerifyAndClear(network_context_.get()); Mock::VerifyAndClear(video_host_.get()); } @@ -274,7 +274,7 @@ } session_->OnAnswer(std::vector<FrameSenderConfig>(), std::vector<FrameSenderConfig>(), ReceiverResponse()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); cast_mode_ = "mirroring"; Mock::VerifyAndClear(this); Mock::VerifyAndClear(&remoting_source_); @@ -291,7 +291,7 @@ response.capabilities->media_caps = std::vector<std::string>({"video", "audio", "vp8", "opus"}); session_->OnCapabilitiesResponse(response); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Mock::VerifyAndClear(this); Mock::VerifyAndClear(&remoting_source_); } @@ -305,7 +305,7 @@ .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); remoter_->Start(); run_loop.Run(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); cast_mode_ = "remoting"; Mock::VerifyAndClear(this); } @@ -314,7 +314,7 @@ ASSERT_TRUE(cast_mode_ == "remoting"); EXPECT_CALL(remoting_source_, OnStarted()).Times(1); SendAnswer(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Mock::VerifyAndClear(this); Mock::VerifyAndClear(&remoting_source_); } @@ -326,14 +326,14 @@ EXPECT_CALL(*this, OnOutboundMessage("OFFER")).Times(1); EXPECT_CALL(remoting_source_, OnStopped(reason)).Times(1); remoter_->Stop(reason); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); cast_mode_ = "mirroring"; Mock::VerifyAndClear(this); Mock::VerifyAndClear(&remoting_source_); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const net::IPEndPoint receiver_endpoint_; mojo::Binding<mojom::ResourceProvider> resource_provider_binding_; mojo::Binding<mojom::SessionObserver> session_observer_binding_;
diff --git a/components/mirroring/service/udp_socket_client_unittest.cc b/components/mirroring/service/udp_socket_client_unittest.cc index b88f2c7a..84a1c6aa 100644 --- a/components/mirroring/service/udp_socket_client_unittest.cc +++ b/components/mirroring/service/udp_socket_client_unittest.cc
@@ -47,7 +47,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::mojom::NetworkContextPtr network_context_ptr_; std::unique_ptr<MockNetworkContext> network_context_; std::unique_ptr<UdpSocketClient> udp_transport_client_; @@ -70,7 +70,7 @@ &UdpSocketClientTest::OnReceivedPacket, base::Unretained(this))); run_loop.Run(); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); MockUdpSocket* socket = network_context_->udp_socket(); @@ -117,7 +117,7 @@ EXPECT_CALL(resume_send_cb, Run()).Times(0); EXPECT_FALSE(udp_transport_client_->SendPacket( new base::RefCountedData<Packet>(packet), resume_send_cb.Get())); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } { // Expect the UDPSocket to be created when calling StartReceiving().
diff --git a/components/mirroring/service/video_capture_client_unittest.cc b/components/mirroring/service/video_capture_client_unittest.cc index 586e7f6..ad4734b 100644 --- a/components/mirroring/service/video_capture_client_unittest.cc +++ b/components/mirroring/service/video_capture_client_unittest.cc
@@ -59,7 +59,7 @@ client_->Stop(); run_loop.Run(); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } MOCK_METHOD1(OnFrameReceived, void(const gfx::Size&)); @@ -80,7 +80,7 @@ base::Unretained(this)), error_cb_.Get()); run_loop.Run(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void OnNewBuffer(int buffer_id, int buffer_size) { @@ -96,7 +96,7 @@ media::mojom::VideoBufferHandle::NewReadOnlyShmemRegion( mojo::CreateReadOnlySharedMemoryRegion(buffer_size).region)); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void OnBufferReady(int buffer_id, const gfx::Size& frame_size) { @@ -109,11 +109,11 @@ .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); client_->OnBufferReady(buffer_id, GetVideoFrameInfo(frame_size)); run_loop.Run(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::MockCallback<base::OnceClosure> error_cb_; std::unique_ptr<FakeVideoCaptureHost> host_impl_; std::unique_ptr<VideoCaptureClient> client_;
diff --git a/components/mirroring/service/wifi_status_monitor_unittest.cc b/components/mirroring/service/wifi_status_monitor_unittest.cc index 8fd597a6..d5c7ef6 100644 --- a/components/mirroring/service/wifi_status_monitor_unittest.cc +++ b/components/mirroring/service/wifi_status_monitor_unittest.cc
@@ -97,7 +97,7 @@ message.message_namespace = mojom::kWebRtcNamespace; message.json_format_data = response; inbound_channel_->Send(message.Clone()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Creates a WifiStatusMonitor and start monitoring the status. @@ -106,7 +106,7 @@ EXPECT_CALL(error_callback_, Run(_)).Times(0); auto status_monitor = std::make_unique<WifiStatusMonitor>(&message_dispatcher_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Expect to receive request to send GET_STATUS message when create a // WifiStatusMonitor. EXPECT_EQ(mojom::kWebRtcNamespace, @@ -119,7 +119,7 @@ return status_monitor; } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } private: mojom::CastMessageChannelPtr CreateInterfacePtrAndBind() { @@ -128,7 +128,7 @@ return outbound_channel_ptr; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::Binding<mojom::CastMessageChannel> binding_; mojom::CastMessageChannelPtr inbound_channel_; base::MockCallback<MessageDispatcher::ErrorCallback> error_callback_;
diff --git a/components/module_installer/android/BUILD.gn b/components/module_installer/android/BUILD.gn index 59757ee..1c804c4 100644 --- a/components/module_installer/android/BUILD.gn +++ b/components/module_installer/android/BUILD.gn
@@ -14,7 +14,9 @@ "java/src-common/org/chromium/components/module_installer/ModuleInstaller.java", "java/src-common/org/chromium/components/module_installer/OnModuleInstallFinishedListener.java", "java/src-common/org/chromium/components/module_installer/Module.java", - "java/src-common/org/chromium/components/module_installer/ModuleActivityObserver.java", + "java/src-common/org/chromium/components/module_installer/observers/ModuleActivityObserver.java", + "java/src-common/org/chromium/components/module_installer/observers/ObserverStrategy.java", + "java/src-common/org/chromium/components/module_installer/observers/ObserverStrategyImpl.java", ] jar_excluded_patterns = [ "*/ModuleInstallerImpl.class" ] deps = [ @@ -63,7 +65,7 @@ } junit_binary("module_installer_junit_tests") { - java_files = [ "junit/src/org/chromium/components/module_installer/ModuleActivityObserverTest.java" ] + java_files = [ "junit/src/org/chromium/components/module_installer/observers/ModuleActivityObserverTest.java" ] deps = [ ":module_installer_impl_java", "//base:base_java",
diff --git a/components/module_installer/android/java/src-common/org/chromium/components/module_installer/ModuleActivityObserver.java b/components/module_installer/android/java/src-common/org/chromium/components/module_installer/observers/ModuleActivityObserver.java similarity index 63% rename from components/module_installer/android/java/src-common/org/chromium/components/module_installer/ModuleActivityObserver.java rename to components/module_installer/android/java/src-common/org/chromium/components/module_installer/observers/ModuleActivityObserver.java index 7000421..650fe8f5 100644 --- a/components/module_installer/android/java/src-common/org/chromium/components/module_installer/ModuleActivityObserver.java +++ b/components/module_installer/android/java/src-common/org/chromium/components/module_installer/observers/ModuleActivityObserver.java
@@ -2,25 +2,37 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.components.module_installer; +package org.chromium.components.module_installer.observers; import android.app.Activity; import org.chromium.base.ActivityState; import org.chromium.base.ApplicationStatus; import org.chromium.base.ThreadUtils; -import org.chromium.base.VisibleForTesting; import java.util.HashSet; -import java.util.List; -/** Observer for activities so that DFMs can be lazily installed on-demand. */ +/** + * Observer for activities so that DFMs can be lazily installed on-demand. + * Note that ActivityIds are managed globally and therefore any changes to it are to be made + * using a single thread (in this case, the UI thread). + */ public class ModuleActivityObserver implements ApplicationStatus.ActivityStateListener { - /** Tracks activities that have been splitcompatted. */ private static HashSet<Integer> sActivityIds = new HashSet<Integer>(); + private final ObserverStrategy mStrategy; + + public ModuleActivityObserver() { + this(new ObserverStrategyImpl()); + } + + public ModuleActivityObserver(ObserverStrategy strategy) { + mStrategy = strategy; + } @Override public void onActivityStateChange(Activity activity, @ActivityState int newState) { + ThreadUtils.assertOnUiThread(); + if (newState == ActivityState.CREATED || newState == ActivityState.RESUMED) { splitCompatActivity(activity); } else if (newState == ActivityState.DESTROYED) { @@ -34,8 +46,8 @@ sActivityIds.clear(); - for (Activity activity : getRunningActivities()) { - if (getStateForActivity(activity) == ActivityState.RESUMED) { + for (Activity activity : mStrategy.getRunningActivities()) { + if (mStrategy.getStateForActivity(activity) == ActivityState.RESUMED) { splitCompatActivity(activity); } } @@ -46,22 +58,7 @@ Integer key = activity.hashCode(); if (!sActivityIds.contains(key)) { sActivityIds.add(key); - getModuleInstaller().initActivity(activity); + mStrategy.getModuleInstaller().initActivity(activity); } } - - @VisibleForTesting - public ModuleInstaller getModuleInstaller() { - return ModuleInstallerImpl.getInstance(); - } - - @VisibleForTesting - public List<Activity> getRunningActivities() { - return ApplicationStatus.getRunningActivities(); - } - - @VisibleForTesting - public int getStateForActivity(Activity activity) { - return ApplicationStatus.getStateForActivity(activity); - } } \ No newline at end of file
diff --git a/components/module_installer/android/java/src-common/org/chromium/components/module_installer/observers/ObserverStrategy.java b/components/module_installer/android/java/src-common/org/chromium/components/module_installer/observers/ObserverStrategy.java new file mode 100644 index 0000000..9bd9af49 --- /dev/null +++ b/components/module_installer/android/java/src-common/org/chromium/components/module_installer/observers/ObserverStrategy.java
@@ -0,0 +1,18 @@ +// Copyright 2019 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.components.module_installer.observers; + +import android.app.Activity; + +import org.chromium.components.module_installer.ModuleInstaller; + +import java.util.List; + +/** Interface outlining the necessary strategy to load activities and install modules. */ +interface ObserverStrategy { + public ModuleInstaller getModuleInstaller(); + public List<Activity> getRunningActivities(); + public int getStateForActivity(Activity activity); +} \ No newline at end of file
diff --git a/components/module_installer/android/java/src-common/org/chromium/components/module_installer/observers/ObserverStrategyImpl.java b/components/module_installer/android/java/src-common/org/chromium/components/module_installer/observers/ObserverStrategyImpl.java new file mode 100644 index 0000000..db46dba --- /dev/null +++ b/components/module_installer/android/java/src-common/org/chromium/components/module_installer/observers/ObserverStrategyImpl.java
@@ -0,0 +1,30 @@ +// Copyright 2019 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.components.module_installer.observers; + +import android.app.Activity; + +import org.chromium.base.ApplicationStatus; +import org.chromium.components.module_installer.ModuleInstaller; + +import java.util.List; + +/** Strategy utilizing ModuleInstaller and ApplicationStatus. */ +class ObserverStrategyImpl implements ObserverStrategy { + @Override + public ModuleInstaller getModuleInstaller() { + return ModuleInstaller.getInstance(); + } + + @Override + public List<Activity> getRunningActivities() { + return ApplicationStatus.getRunningActivities(); + } + + @Override + public int getStateForActivity(Activity activity) { + return ApplicationStatus.getStateForActivity(activity); + } +} \ No newline at end of file
diff --git a/components/module_installer/android/java/src-impl/org/chromium/components/module_installer/ModuleInstallerImpl.java b/components/module_installer/android/java/src-impl/org/chromium/components/module_installer/ModuleInstallerImpl.java index fc250eb..74b6fa4 100644 --- a/components/module_installer/android/java/src-impl/org/chromium/components/module_installer/ModuleInstallerImpl.java +++ b/components/module_installer/android/java/src-impl/org/chromium/components/module_installer/ModuleInstallerImpl.java
@@ -21,6 +21,7 @@ import org.chromium.base.annotations.MainDex; import org.chromium.components.crash.CrashKeyIndex; import org.chromium.components.crash.CrashKeys; +import org.chromium.components.module_installer.observers.ModuleActivityObserver; import java.util.Arrays; import java.util.HashMap;
diff --git a/components/module_installer/android/junit/src/org/chromium/components/module_installer/ModuleActivityObserverTest.java b/components/module_installer/android/junit/src/org/chromium/components/module_installer/observers/ModuleActivityObserverTest.java similarity index 82% rename from components/module_installer/android/junit/src/org/chromium/components/module_installer/ModuleActivityObserverTest.java rename to components/module_installer/android/junit/src/org/chromium/components/module_installer/observers/ModuleActivityObserverTest.java index 0554c72..a43fc42 100644 --- a/components/module_installer/android/junit/src/org/chromium/components/module_installer/ModuleActivityObserverTest.java +++ b/components/module_installer/android/junit/src/org/chromium/components/module_installer/observers/ModuleActivityObserverTest.java
@@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.components.module_installer; +package org.chromium.components.module_installer.observers; import static org.mockito.Mockito.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -22,6 +21,7 @@ import org.chromium.base.ActivityState; import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.components.module_installer.ModuleInstaller; import java.util.ArrayList; import java.util.List; @@ -33,20 +33,24 @@ public class ModuleActivityObserverTest { @Mock private ModuleInstaller mModuleInstallerMock; + @Mock private Activity mActivityMock; + @Mock + private ObserverStrategy mStrategy; + private ModuleActivityObserver mObserver; @Before - public void beforeTests() { + public void setUp() { MockitoAnnotations.initMocks(this); - mObserver = spy(new ModuleActivityObserver()); + mObserver = new ModuleActivityObserver(mStrategy); - doReturn(mModuleInstallerMock).when(mObserver).getModuleInstaller(); - doReturn(new ArrayList<>()).when(mObserver).getRunningActivities(); - doReturn(ActivityState.CREATED).when(mObserver).getStateForActivity(any(Activity.class)); + doReturn(mModuleInstallerMock).when(mStrategy).getModuleInstaller(); + doReturn(new ArrayList<>()).when(mStrategy).getRunningActivities(); + doReturn(ActivityState.CREATED).when(mStrategy).getStateForActivity(any(Activity.class)); } @Test @@ -121,10 +125,7 @@ // Arrange. @ActivityState Integer newState = ActivityState.RESUMED; - - ModuleInstaller newModuleInstallerMock = mock(ModuleInstaller.class); - ModuleActivityObserver newObserver = spy(new ModuleActivityObserver()); - doReturn(newModuleInstallerMock).when(newObserver).getModuleInstaller(); + ModuleActivityObserver newObserver = new ModuleActivityObserver(mStrategy); // Act. mObserver.onActivityStateChange(mActivityMock, newState); @@ -132,7 +133,6 @@ // Assert. verify(mModuleInstallerMock, times(1)).initActivity(mActivityMock); - verify(newModuleInstallerMock, never()).initActivity(mActivityMock); } @Test @@ -147,11 +147,11 @@ activitiesList.add(activityMock2); activitiesList.add(activityMock3); - doReturn(activitiesList).when(mObserver).getRunningActivities(); + doReturn(activitiesList).when(mStrategy).getRunningActivities(); - doReturn(ActivityState.RESUMED).when(mObserver).getStateForActivity(activityMock1); - doReturn(ActivityState.PAUSED).when(mObserver).getStateForActivity(activityMock2); - doReturn(ActivityState.DESTROYED).when(mObserver).getStateForActivity(activityMock3); + doReturn(ActivityState.RESUMED).when(mStrategy).getStateForActivity(activityMock1); + doReturn(ActivityState.PAUSED).when(mStrategy).getStateForActivity(activityMock2); + doReturn(ActivityState.DESTROYED).when(mStrategy).getStateForActivity(activityMock3); // Act. mObserver.onModuleInstalled();
diff --git a/components/nacl/loader/nacl_ipc_adapter_unittest.cc b/components/nacl/loader/nacl_ipc_adapter_unittest.cc index 9eaa4b01..98c8f962 100644 --- a/components/nacl/loader/nacl_ipc_adapter_unittest.cc +++ b/components/nacl/loader/nacl_ipc_adapter_unittest.cc
@@ -59,7 +59,7 @@ return adapter_->Send(&msg); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<NaClIPCAdapter> adapter_;
diff --git a/components/net_log/net_export_file_writer_unittest.cc b/components/net_log/net_export_file_writer_unittest.cc index 2d41be3..c125ba6 100644 --- a/components/net_log/net_export_file_writer_unittest.cc +++ b/components/net_log/net_export_file_writer_unittest.cc
@@ -254,8 +254,7 @@ class NetExportFileWriterTest : public ::testing::Test { public: NetExportFileWriterTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), network_change_notifier_(net::NetworkChangeNotifier::CreateMock()), network_service_(network::NetworkService::CreateForTesting()) {} @@ -440,7 +439,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Use a mock NetworkChangeNotifier so the real one can't add any logging. std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_; std::unique_ptr<network::NetworkService> network_service_;
diff --git a/components/network_time/network_time_tracker_unittest.cc b/components/network_time/network_time_tracker_unittest.cc index 364efa2d..7e77a599 100644 --- a/components/network_time/network_time_tracker_unittest.cc +++ b/components/network_time/network_time_tracker_unittest.cc
@@ -48,8 +48,7 @@ ~NetworkTimeTrackerTest() override {} NetworkTimeTrackerTest() - : task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), field_trial_test_(new FieldTrialTest()), clock_(new base::SimpleTestClock), tick_clock_(new base::SimpleTestTickClock), @@ -156,7 +155,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FieldTrialTest> field_trial_test_; base::TimeDelta resolution_; base::TimeDelta latency_;
diff --git a/components/ntp_snippets/content_suggestions_service_unittest.cc b/components/ntp_snippets/content_suggestions_service_unittest.cc index 231c09a..f46a5ed 100644 --- a/components/ntp_snippets/content_suggestions_service_unittest.cc +++ b/components/ntp_snippets/content_suggestions_service_unittest.cc
@@ -259,7 +259,7 @@ TEST_F(ContentSuggestionsServiceTest, ShouldCallbackEmptyImageForUnavailableProvider) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; // Assuming there will never be a category with the id below.
diff --git a/components/ntp_snippets/remote/cached_image_fetcher_unittest.cc b/components/ntp_snippets/remote/cached_image_fetcher_unittest.cc index 96e3b6d..24bddd1 100644 --- a/components/ntp_snippets/remote/cached_image_fetcher_unittest.cc +++ b/components/ntp_snippets/remote/cached_image_fetcher_unittest.cc
@@ -121,7 +121,7 @@ image_db_->GetCallback(true); } break; } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } RemoteSuggestionsDatabase* database() { return database_.get(); } @@ -152,7 +152,7 @@ FakeDB<SnippetImageProto>* image_db_; TestingPrefServiceSimple pref_service_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(NtpSnippetsCachedImageFetcherTest); };
diff --git a/components/ntp_snippets/remote/remote_suggestions_fetcher_impl_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_fetcher_impl_unittest.cc index 42a2904..edc57cf 100644 --- a/components/ntp_snippets/remote/remote_suggestions_fetcher_impl_unittest.cc +++ b/components/ntp_snippets/remote/remote_suggestions_fetcher_impl_unittest.cc
@@ -201,7 +201,7 @@ base::BindRepeating(&ParseJsonDelayed), GetFetchEndpoint(), api_key, user_classifier_.get()); - fetcher_->SetClockForTesting(scoped_task_environment_.GetMockClock()); + fetcher_->SetClockForTesting(task_environment_.GetMockClock()); } void SignIn() { identity_test_env_.MakePrimaryAccountAvailable(kTestEmail); } @@ -215,7 +215,7 @@ RemoteSuggestionsFetcherImpl& fetcher() { return *fetcher_; } MockSnippetsAvailableCallback& mock_callback() { return mock_callback_; } void FastForwardUntilNoTasksRemain() { - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } base::HistogramTester& histogram_tester() { return histogram_tester_; } @@ -253,8 +253,8 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; std::map<std::string, std::string> default_variation_params_; signin::IdentityTestEnvironment identity_test_env_; network::TestURLLoaderFactory test_url_loader_factory_;
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc index 6648e669..d0818289 100644 --- a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc +++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
@@ -389,7 +389,7 @@ void RunUntilIdle() { timer_mock_task_runner_->RunUntilIdle(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void SetCategoryRanker(std::unique_ptr<CategoryRanker> category_ranker) { @@ -595,7 +595,7 @@ image_fetcher::FakeImageDecoder image_decoder_; std::unique_ptr<MockScheduler> scheduler_; RemoteSuggestionsStatusService* remote_suggestions_status_service_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; RemoteSuggestionsStatusService::StatusChangeCallback status_change_callback_;
diff --git a/components/ntp_tiles/custom_links_manager_impl_unittest.cc b/components/ntp_tiles/custom_links_manager_impl_unittest.cc index 88411c6..4f398bce 100644 --- a/components/ntp_tiles/custom_links_manager_impl_unittest.cc +++ b/components/ntp_tiles/custom_links_manager_impl_unittest.cc
@@ -103,7 +103,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable prefs_; base::ScopedTempDir scoped_temp_dir_; std::unique_ptr<history::HistoryService> history_service_; @@ -469,7 +469,7 @@ base::UTF8ToUTF16(kTestCase2[0].title), true}}), custom_links_->GetLinks()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CustomLinksManagerImplTest, @@ -494,7 +494,7 @@ /*restrict_urls=*/base::nullopt)); EXPECT_TRUE(custom_links_->GetLinks().empty()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CustomLinksManagerImplTest, ShouldDeleteOnHistoryDeletionAfterShutdown) { @@ -523,7 +523,7 @@ /*restrict_urls=*/base::nullopt)); EXPECT_TRUE(custom_links_->GetLinks().empty()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CustomLinksManagerImplTest, ShouldNotDeleteCustomLinkOnHistoryDeletion) { @@ -567,7 +567,7 @@ {Link{GURL(kTestUrl), base::UTF8ToUTF16(kTestTitle), false}}), custom_links_->GetLinks()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CustomLinksManagerImplTest, ShouldIgnoreHistoryExpiredDeletions) { @@ -601,7 +601,7 @@ EXPECT_EQ(initial_links, custom_links_->GetLinks()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CustomLinksManagerImplTest, ShouldIgnoreEmptyHistoryDeletions) { @@ -622,7 +622,7 @@ EXPECT_EQ(initial_links, custom_links_->GetLinks()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CustomLinksManagerImplTest, ShouldNotUndoAfterHistoryDeletion) { @@ -654,7 +654,7 @@ EXPECT_FALSE(custom_links_->UndoAction()); EXPECT_EQ(links_after_add, custom_links_->GetLinks()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CustomLinksManagerImplTest, UpdateListAfterRemoteChange) {
diff --git a/components/ntp_tiles/icon_cacher_impl_unittest.cc b/components/ntp_tiles/icon_cacher_impl_unittest.cc index 5b20ce1..4b8a18a 100644 --- a/components/ntp_tiles/icon_cacher_impl_unittest.cc +++ b/components/ntp_tiles/icon_cacher_impl_unittest.cc
@@ -132,7 +132,7 @@ loop.RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir history_dir_; history::HistoryService history_service_; favicon::FaviconServiceImpl favicon_service_; @@ -365,7 +365,7 @@ base::MockCallback<base::Closure> done; EXPECT_CALL(done, Run()).Times(0); cacher.StartFetchMostLikely(page_url, done.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(IconIsCachedFor(page_url, favicon_base::IconType::kFavicon)); EXPECT_TRUE(IconIsCachedFor(page_url, favicon_base::IconType::kTouchIcon)); @@ -397,7 +397,7 @@ // Both these task runners need to be flushed in order to get |done| called by // running the main loop. WaitForHistoryThreadTasksToFinish(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); loop.Run(); EXPECT_FALSE(IconIsCachedFor(page_url, favicon_base::IconType::kFavicon)); @@ -429,7 +429,7 @@ // Both these task runners need to be flushed before flushing the main thread // queue in order to finish the work. WaitForHistoryThreadTasksToFinish(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(IconIsCachedFor(page_url, favicon_base::IconType::kFavicon)); EXPECT_FALSE(IconIsCachedFor(page_url, favicon_base::IconType::kTouchIcon)); @@ -452,14 +452,14 @@ // Finish the posted tasks on the main and the history thread to find out if // we can write the icon. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); WaitForHistoryThreadTasksToFinish(); // Continue with the work in large icon service - fetch and decode the data. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Do the work on the history thread to write down the icon WaitForHistoryThreadTasksToFinish(); // Finish the tasks on the main thread. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Even though the callbacks are not called, the icon gets written out. EXPECT_FALSE(IconIsCachedFor(page_url, favicon_base::IconType::kFavicon)); @@ -493,10 +493,10 @@ // Finish the posted tasks on the main and the history thread to find out if // we can write the icon. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); WaitForHistoryThreadTasksToFinish(); // Continue with the work in large icon service - fetch and decode the data. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Do the work on the history thread to write down the icon WaitForHistoryThreadTasksToFinish(); // Finish the tasks on the main thread.
diff --git a/components/ntp_tiles/most_visited_sites_unittest.cc b/components/ntp_tiles/most_visited_sites_unittest.cc index e099000..548c06d 100644 --- a/components/ntp_tiles/most_visited_sites_unittest.cc +++ b/components/ntp_tiles/most_visited_sites_unittest.cc
@@ -559,7 +559,7 @@ suggestions_service_callbacks_; TopSitesCallbackList top_sites_callbacks_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; data_decoder::TestingJsonParser::ScopedFactoryOverride factory_override_; sync_preferences::TestingPrefServiceSyncable pref_service_; PopularSitesFactoryForTest popular_sites_factory_;
diff --git a/components/ntp_tiles/popular_sites_impl_unittest.cc b/components/ntp_tiles/popular_sites_impl_unittest.cc index b965d6b..e61eca2 100644 --- a/components/ntp_tiles/popular_sites_impl_unittest.cc +++ b/components/ntp_tiles/popular_sites_impl_unittest.cc
@@ -211,8 +211,8 @@ const TestPopularSite kYouTube; const TestPopularSite kChromium; - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; data_decoder::TestingJsonParser::ScopedFactoryOverride factory_override_; std::unique_ptr<sync_preferences::TestingPrefServiceSyncable> prefs_; network::TestURLLoaderFactory test_url_loader_factory_;
diff --git a/components/offline_pages/content/renovations/test/page_renovator_browsertest.cc b/components/offline_pages/content/renovations/test/page_renovator_browsertest.cc index b3f88cd7..cfcc0ad 100644 --- a/components/offline_pages/content/renovations/test/page_renovator_browsertest.cc +++ b/components/offline_pages/content/renovations/test/page_renovator_browsertest.cc
@@ -155,7 +155,7 @@ void PageRenovatorBrowserTest::Navigate(const std::string& test_page_path) { GURL url = test_server_.GetURL(test_page_path); - content::NavigateToURL(shell(), url); + EXPECT_TRUE(content::NavigateToURL(shell(), url)); render_frame_ = shell()->web_contents()->GetMainFrame(); }
diff --git a/components/offline_pages/core/prefetch/prefetch_gcm_app_handler_unittest.cc b/components/offline_pages/core/prefetch/prefetch_gcm_app_handler_unittest.cc index 69bc7ca3..417a5b8 100644 --- a/components/offline_pages/core/prefetch/prefetch_gcm_app_handler_unittest.cc +++ b/components/offline_pages/core/prefetch/prefetch_gcm_app_handler_unittest.cc
@@ -54,7 +54,7 @@ ~PrefetchGCMAppHandlerTest() override { // Ensures that the store is properly disposed off. prefetch_service_taco_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TestPrefetchDispatcher* dispatcher() { return test_dispatcher_; } @@ -62,7 +62,7 @@ TestTokenFactory* token_factory() { return token_factory_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<PrefetchServiceTestTaco> prefetch_service_taco_; // Owned by the taco.
diff --git a/components/offline_pages/core/prefetch/suggested_articles_observer_unittest.cc b/components/offline_pages/core/prefetch/suggested_articles_observer_unittest.cc index 664ae3d..0991d09 100644 --- a/components/offline_pages/core/prefetch/suggested_articles_observer_unittest.cc +++ b/components/offline_pages/core/prefetch/suggested_articles_observer_unittest.cc
@@ -52,7 +52,7 @@ ~OfflinePageSuggestedArticlesObserverTest() override { // Ensure the store can be properly disposed off. prefetch_service_test_taco_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } SuggestedArticlesObserver* observer() { @@ -69,7 +69,7 @@ Category::FromKnownCategory(ntp_snippets::KnownCategories::ARTICLES); private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<PrefetchServiceTestTaco> prefetch_service_test_taco_; // Owned by the PrefetchServiceTestTaco.
diff --git a/components/omnibox/browser/autocomplete_provider_unittest.cc b/components/omnibox/browser/autocomplete_provider_unittest.cc index 0897dc3..99e706e 100644 --- a/components/omnibox/browser/autocomplete_provider_unittest.cc +++ b/components/omnibox/browser/autocomplete_provider_unittest.cc
@@ -312,7 +312,7 @@ // platform, flags, etc.) be instantiated. void ResetControllerWithType(int type); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<AutocompleteController> controller_; // Owned by |controller_|. AutocompleteProviderClientWithClosure* client_;
diff --git a/components/omnibox/browser/autocomplete_result_unittest.cc b/components/omnibox/browser/autocomplete_result_unittest.cc index 801d745b..cbdc123 100644 --- a/components/omnibox/browser/autocomplete_result_unittest.cc +++ b/components/omnibox/browser/autocomplete_result_unittest.cc
@@ -130,7 +130,7 @@ template_url_service_->Load(); } - void TearDown() override { scoped_task_environment_.RunUntilIdle(); } + void TearDown() override { task_environment_.RunUntilIdle(); } // Configures |match| from |data|. void PopulateAutocompleteMatch(const TestData& data, @@ -162,7 +162,7 @@ std::unique_ptr<TemplateURLService> template_url_service_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::FieldTrialList> field_trial_list_; // For every provider mentioned in TestData, we need a mock provider.
diff --git a/components/omnibox/browser/base_search_provider_unittest.cc b/components/omnibox/browser/base_search_provider_unittest.cc index 6f43cb0f..7cb62d2 100644 --- a/components/omnibox/browser/base_search_provider_unittest.cc +++ b/components/omnibox/browser/base_search_provider_unittest.cc
@@ -85,7 +85,7 @@ AutocompleteProvider::TYPE_SEARCH, client_.get()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<NiceMock<TestBaseSearchProvider>> provider_; std::unique_ptr<MockAutocompleteProviderClient> client_; };
diff --git a/components/omnibox/browser/document_suggestions_service_unittest.cc b/components/omnibox/browser/document_suggestions_service_unittest.cc index e0464f3a..b9ff412 100644 --- a/components/omnibox/browser/document_suggestions_service_unittest.cc +++ b/components/omnibox/browser/document_suggestions_service_unittest.cc
@@ -37,8 +37,7 @@ class DocumentSuggestionsServiceTest : public testing::Test { protected: DocumentSuggestionsServiceTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), shared_url_loader_factory_( base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( &test_url_loader_factory_)), @@ -60,7 +59,7 @@ base::FieldTrialList::CreateFieldTrial("trial name", "group name")->group(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_; sync_preferences::TestingPrefServiceSyncable prefs_;
diff --git a/components/omnibox/browser/fake_autocomplete_provider_client.cc b/components/omnibox/browser/fake_autocomplete_provider_client.cc index 1a3b396..e481142 100644 --- a/components/omnibox/browser/fake_autocomplete_provider_client.cc +++ b/components/omnibox/browser/fake_autocomplete_provider_client.cc
@@ -48,7 +48,7 @@ // it to prevent memory leaks. GetHistoryService()->Shutdown(); // Note that RunUntilIdle() must still be called after this, from - // whichever task model is being used, probably ScopedTaskEnvironment, + // whichever task model is being used, probably TaskEnvironment, // or there will be memory leaks. }
diff --git a/components/omnibox/browser/fake_autocomplete_provider_client.h b/components/omnibox/browser/fake_autocomplete_provider_client.h index 3aa86d3..424c6a81 100644 --- a/components/omnibox/browser/fake_autocomplete_provider_client.h +++ b/components/omnibox/browser/fake_autocomplete_provider_client.h
@@ -28,9 +28,9 @@ // Note: The history index rebuild task is created from main thread, usually // during SetUp(), performed on DB thread and must be deleted on main thread. // Run main loop to process delete task, to prevent leaks. -// Note that these tests have switched to using a ScopedTaskEnvironment, +// Note that these tests have switched to using a TaskEnvironment, // so clearing that task queue is done through -// scoped_task_environment_.RunUntilIdle(). +// task_environment_.RunUntilIdle(). class FakeAutocompleteProviderClient : public MockAutocompleteProviderClient { public: explicit FakeAutocompleteProviderClient(bool create_history_db = true);
diff --git a/components/omnibox/browser/history_provider_unittest.cc b/components/omnibox/browser/history_provider_unittest.cc index 16cc78b..a45c8a5 100644 --- a/components/omnibox/browser/history_provider_unittest.cc +++ b/components/omnibox/browser/history_provider_unittest.cc
@@ -42,7 +42,7 @@ HistoryProvider* provider() { return &(*provider_); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeAutocompleteProviderClient> client_; scoped_refptr<TestHistoryProvider> provider_; @@ -57,7 +57,7 @@ void HistoryProviderTest::TearDown() { provider_ = nullptr; client_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Placeholder test. Remove after adding a substantive test.
diff --git a/components/omnibox/browser/history_quick_provider_performance_unittest.cc b/components/omnibox/browser/history_quick_provider_performance_unittest.cc index 793ec31..cc97840 100644 --- a/components/omnibox/browser/history_quick_provider_performance_unittest.cc +++ b/components/omnibox/browser/history_quick_provider_performance_unittest.cc
@@ -99,7 +99,7 @@ private: base::TimeDelta RunTest(const base::string16& text); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeAutocompleteProviderClient> client_; scoped_refptr<HistoryQuickProvider> provider_; @@ -118,7 +118,7 @@ void HQPPerfTestOnePopularURL::TearDown() { provider_ = nullptr; client_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void HQPPerfTestOnePopularURL::PrepareData() {
diff --git a/components/omnibox/browser/history_quick_provider_unittest.cc b/components/omnibox/browser/history_quick_provider_unittest.cc index a7e23ca..090b943 100644 --- a/components/omnibox/browser/history_quick_provider_unittest.cc +++ b/components/omnibox/browser/history_quick_provider_unittest.cc
@@ -180,7 +180,7 @@ HistoryQuickProvider& provider() { return *provider_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeAutocompleteProviderClient> client_; ACMatches ac_matches_; // The resulting matches after running RunTest. @@ -213,7 +213,7 @@ void HistoryQuickProviderTest::TearDown() { provider_ = nullptr; client_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } std::vector<HistoryQuickProviderTest::TestURLInfo>
diff --git a/components/omnibox/browser/history_url_provider_unittest.cc b/components/omnibox/browser/history_url_provider_unittest.cc index 70a17f0..c650510 100644 --- a/components/omnibox/browser/history_url_provider_unittest.cc +++ b/components/omnibox/browser/history_url_provider_unittest.cc
@@ -236,7 +236,7 @@ size_t expected_match_location, size_t expected_match_length); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ACMatches matches_; std::unique_ptr<FakeAutocompleteProviderClient> client_; scoped_refptr<HistoryURLProvider> autocomplete_; @@ -282,7 +282,7 @@ void HistoryURLProviderTest::TearDown() { autocomplete_ = nullptr; client_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void HistoryURLProviderTest::FillData() {
diff --git a/components/omnibox/browser/in_memory_url_index_unittest.cc b/components/omnibox/browser/in_memory_url_index_unittest.cc index 25315c7..3d53b02 100644 --- a/components/omnibox/browser/in_memory_url_index_unittest.cc +++ b/components/omnibox/browser/in_memory_url_index_unittest.cc
@@ -169,7 +169,7 @@ void ExpectPrivateDataEqual(const URLIndexPrivateData& expected, const URLIndexPrivateData& actual); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir history_dir_; std::unique_ptr<history::HistoryService> history_service_; history::HistoryDatabase* history_database_ = nullptr; @@ -292,7 +292,7 @@ // it is destroyed in order to prevent HistoryService calling dead observer. if (url_index_) url_index_->Shutdown(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } base::FilePath::StringType InMemoryURLIndexTest::TestDBName() const { @@ -1433,7 +1433,7 @@ void set_history_dir(const base::FilePath& dir_path); bool GetCacheFilePath(base::FilePath* file_path) const; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; std::unique_ptr<InMemoryURLIndex> url_index_; };
diff --git a/components/omnibox/browser/keyword_provider_unittest.cc b/components/omnibox/browser/keyword_provider_unittest.cc index 943116e..afc4e80 100644 --- a/components/omnibox/browser/keyword_provider_unittest.cc +++ b/components/omnibox/browser/keyword_provider_unittest.cc
@@ -87,7 +87,7 @@ protected: static const TemplateURLService::Initializer kTestData[]; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::FieldTrialList> field_trial_list_; scoped_refptr<KeywordProvider> kw_provider_; std::unique_ptr<MockAutocompleteProviderClient> client_;
diff --git a/components/omnibox/browser/location_bar_model_impl_unittest.cc b/components/omnibox/browser/location_bar_model_impl_unittest.cc index 983cf5e..6749d021 100644 --- a/components/omnibox/browser/location_bar_model_impl_unittest.cc +++ b/components/omnibox/browser/location_bar_model_impl_unittest.cc
@@ -88,7 +88,7 @@ LocationBarModelImpl* model() { return &model_; } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; FakeLocationBarModelDelegate delegate_; LocationBarModelImpl model_; };
diff --git a/components/omnibox/browser/omnibox_controller_unittest.cc b/components/omnibox/browser/omnibox_controller_unittest.cc index b594984..06480f4 100644 --- a/components/omnibox/browser/omnibox_controller_unittest.cc +++ b/components/omnibox/browser/omnibox_controller_unittest.cc
@@ -33,7 +33,7 @@ void SetUp() override; void TearDown() override; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestOmniboxClient> omnibox_client_; std::unique_ptr<OmniboxController> omnibox_controller_;
diff --git a/components/omnibox/browser/omnibox_edit_model_unittest.cc b/components/omnibox/browser/omnibox_edit_model_unittest.cc index fc50cafb..350f2ed 100644 --- a/components/omnibox/browser/omnibox_edit_model_unittest.cc +++ b/components/omnibox/browser/omnibox_edit_model_unittest.cc
@@ -46,7 +46,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestOmniboxEditController> controller_; std::unique_ptr<TestOmniboxView> view_; };
diff --git a/components/omnibox/browser/omnibox_pedal_implementations_unittest.cc b/components/omnibox/browser/omnibox_pedal_implementations_unittest.cc index 777c470..ebc2321 100644 --- a/components/omnibox/browser/omnibox_pedal_implementations_unittest.cc +++ b/components/omnibox/browser/omnibox_pedal_implementations_unittest.cc
@@ -19,7 +19,7 @@ : omnibox_client_(new TestOmniboxClient), omnibox_edit_controller_(new TestOmniboxEditController) {} - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestOmniboxClient> omnibox_client_; std::unique_ptr<TestOmniboxEditController> omnibox_edit_controller_; };
diff --git a/components/omnibox/browser/omnibox_popup_model_unittest.cc b/components/omnibox/browser/omnibox_popup_model_unittest.cc index 1273add..4932628c 100644 --- a/components/omnibox/browser/omnibox_popup_model_unittest.cc +++ b/components/omnibox/browser/omnibox_popup_model_unittest.cc
@@ -59,7 +59,7 @@ OmniboxPopupModel* popup_model() { return &popup_model_; } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestOmniboxEditController controller_; TestOmniboxView view_; TestOmniboxEditModel model_;
diff --git a/components/omnibox/browser/omnibox_view_unittest.cc b/components/omnibox/browser/omnibox_view_unittest.cc index 1d3c68d..0aee4d12 100644 --- a/components/omnibox/browser/omnibox_view_unittest.cc +++ b/components/omnibox/browser/omnibox_view_unittest.cc
@@ -58,7 +58,7 @@ bookmarks::BookmarkModel* bookmark_model() { return bookmark_model_.get(); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestOmniboxEditController> controller_; std::unique_ptr<TestOmniboxView> view_; std::unique_ptr<bookmarks::BookmarkModel> bookmark_model_;
diff --git a/components/omnibox/browser/on_device_head_provider_unittest.cc b/components/omnibox/browser/on_device_head_provider_unittest.cc index f58d319f3..8309a53 100644 --- a/components/omnibox/browser/on_device_head_provider_unittest.cc +++ b/components/omnibox/browser/on_device_head_provider_unittest.cc
@@ -29,13 +29,13 @@ client_.reset(new FakeAutocompleteProviderClient()); SetTestOnDeviceHeadModel(); provider_ = OnDeviceHeadProvider::Create(client_.get(), this); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void TearDown() override { provider_ = nullptr; client_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // AutocompleteProviderListener: @@ -52,7 +52,7 @@ auto* update_listener = OnDeviceModelUpdateListener::GetInstance(); if (update_listener) update_listener->OnModelUpdate(file_path); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void ResetServingInstance() { @@ -63,7 +63,7 @@ } } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeAutocompleteProviderClient> client_; scoped_refptr<OnDeviceHeadProvider> provider_; }; @@ -80,7 +80,7 @@ provider_->Start(input, false); if (!provider_->done()) - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(provider_->matches().empty()); EXPECT_TRUE(provider_->done()); @@ -94,7 +94,7 @@ provider_->Start(input, false); if (!provider_->done()) - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(provider_->matches().empty()); EXPECT_TRUE(provider_->done()); @@ -110,7 +110,7 @@ provider_->Start(input, false); if (!provider_->done()) - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(provider_->matches().empty()); EXPECT_TRUE(provider_->done()); @@ -128,7 +128,7 @@ provider_->Start(input, false); if (!provider_->done()) - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(provider_->matches().empty()); EXPECT_TRUE(provider_->done()); @@ -145,7 +145,7 @@ provider_->Start(input, false); if (!provider_->done()) - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(provider_->matches().empty()); EXPECT_TRUE(provider_->done()); @@ -162,7 +162,7 @@ provider_->Start(input, false); if (!provider_->done()) - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(provider_->done()); ASSERT_EQ(3U, provider_->matches().size()); @@ -190,7 +190,7 @@ provider_->Start(input2, false); if (!provider_->done()) - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(provider_->done()); ASSERT_EQ(3U, provider_->matches().size());
diff --git a/components/omnibox/browser/shortcuts_backend_unittest.cc b/components/omnibox/browser/shortcuts_backend_unittest.cc index b64f98f..c9552a8 100644 --- a/components/omnibox/browser/shortcuts_backend_unittest.cc +++ b/components/omnibox/browser/shortcuts_backend_unittest.cc
@@ -60,7 +60,7 @@ TemplateURLService* GetTemplateURLService(); private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir profile_dir_; std::unique_ptr<TemplateURLService> template_url_service_; std::unique_ptr<history::HistoryService> history_service_; @@ -124,7 +124,7 @@ void ShortcutsBackendTest::TearDown() { backend_->RemoveObserver(this); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void ShortcutsBackendTest::OnShortcutsLoaded() { @@ -140,7 +140,7 @@ ASSERT_FALSE(load_notified_); ASSERT_FALSE(backend_->initialized()); backend_->Init(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(load_notified_); EXPECT_TRUE(backend_->initialized()); }
diff --git a/components/omnibox/browser/shortcuts_provider_unittest.cc b/components/omnibox/browser/shortcuts_provider_unittest.cc index 845e512..6147995 100644 --- a/components/omnibox/browser/shortcuts_provider_unittest.cc +++ b/components/omnibox/browser/shortcuts_provider_unittest.cc
@@ -200,7 +200,7 @@ const ShortcutsDatabase::Shortcut& shortcut, int max_relevance); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeAutocompleteProviderClient> client_; scoped_refptr<ShortcutsProvider> provider_; }; @@ -220,7 +220,7 @@ void ShortcutsProviderTest::TearDown() { provider_ = nullptr; client_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } int ShortcutsProviderTest::CalculateScore(
diff --git a/components/omnibox/browser/zero_suggest_provider_unittest.cc b/components/omnibox/browser/zero_suggest_provider_unittest.cc index b33210d..ffb6ec38 100644 --- a/components/omnibox/browser/zero_suggest_provider_unittest.cc +++ b/components/omnibox/browser/zero_suggest_provider_unittest.cc
@@ -155,7 +155,7 @@ void CreateMostVisitedFieldTrial(); void SetZeroSuggestVariantForAllContexts(const std::string& variant); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::test::ScopedFeatureList> scoped_feature_list_; std::unique_ptr<FakeAutocompleteProviderClient> client_;
diff --git a/components/optimization_guide/hint_cache_unittest.cc b/components/optimization_guide/hint_cache_unittest.cc index 6d6ebf7..c317930 100644 --- a/components/optimization_guide/hint_cache_unittest.cc +++ b/components/optimization_guide/hint_cache_unittest.cc
@@ -46,8 +46,7 @@ void CreateAndInitializeHintCache(int memory_cache_size, bool purge_existing_data = false) { auto database_path = temp_dir_.GetPath(); - auto database_task_runner = - scoped_task_environment_.GetMainThreadTaskRunner(); + auto database_task_runner = task_environment_.GetMainThreadTaskRunner(); hint_cache_ = std::make_unique<HintCache>( std::make_unique<HintCacheStore>(db_provider_.get(), database_path, nullptr /* pref_service */, @@ -120,7 +119,7 @@ private: void RunUntilIdle() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::RunLoop().RunUntilIdle(); } @@ -131,7 +130,7 @@ loaded_hint_ = hint; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<HintCache> hint_cache_; const proto::Hint* loaded_hint_;
diff --git a/components/optimization_guide/hints_fetcher_unittest.cc b/components/optimization_guide/hints_fetcher_unittest.cc index 429e563..5210f2c 100644 --- a/components/optimization_guide/hints_fetcher_unittest.cc +++ b/components/optimization_guide/hints_fetcher_unittest.cc
@@ -92,12 +92,12 @@ private: void RunUntilIdle() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::RunLoop().RunUntilIdle(); } bool hints_fetched_ = false; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<HintsFetcher> hints_fetcher_;
diff --git a/components/optimization_guide/optimization_guide_service_unittest.cc b/components/optimization_guide/optimization_guide_service_unittest.cc index 5a76835..58752e8 100644 --- a/components/optimization_guide/optimization_guide_service_unittest.cc +++ b/components/optimization_guide/optimization_guide_service_unittest.cc
@@ -63,7 +63,7 @@ void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); optimization_guide_service_ = std::make_unique<OptimizationGuideService>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); observer_ = std::make_unique<TestObserver>(); } @@ -82,14 +82,14 @@ void MaybeUpdateHintsComponent(const HintsComponentInfo& info) { optimization_guide_service_->MaybeUpdateHintsComponent(info); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::RunLoop().RunUntilIdle(); } base::FilePath temp_dir() const { return temp_dir_.GetPath(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; std::unique_ptr<OptimizationGuideService> optimization_guide_service_;
diff --git a/components/os_crypt/keychain_password_mac_unittest.mm b/components/os_crypt/keychain_password_mac_unittest.mm index 1502ce10..b208d7c 100644 --- a/components/os_crypt/keychain_password_mac_unittest.mm +++ b/components/os_crypt/keychain_password_mac_unittest.mm
@@ -94,7 +94,7 @@ #if !defined(OS_IOS) // Waits until all tasks in the task runner's queue are finished. - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } base::HistogramTester& histogram_tester() { return histogram_tester_; } @@ -107,7 +107,7 @@ private: #if !defined(OS_IOS) base::HistogramTester histogram_tester_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; #endif DISALLOW_COPY_AND_ASSIGN(KeychainPasswordTest);
diff --git a/components/page_image_annotation/core/page_annotator_unittest.cc b/components/page_image_annotation/core/page_annotator_unittest.cc index 2630345..3adad59e 100644 --- a/components/page_image_annotation/core/page_annotator_unittest.cc +++ b/components/page_image_annotation/core/page_annotator_unittest.cc
@@ -89,7 +89,7 @@ TEST(PageAnnotatorTest, ImageTracking) { const auto get_pixels = base::BindRepeating([]() { return SkBitmap(); }); - base::test::ScopedTaskEnvironment test_task_env; + base::test::TaskEnvironment test_task_env; PageAnnotator page_annotator((mojo::NullRemote())); @@ -119,7 +119,7 @@ // the local ImageProcessor. const auto get_pixels = base::BindRepeating([]() { return SkBitmap(); }); - base::test::ScopedTaskEnvironment test_task_env; + base::test::TaskEnvironment test_task_env; TestAnnotator test_annotator; PageAnnotator page_annotator(test_annotator.GetRemote());
diff --git a/components/password_manager/core/browser/android_affiliation/affiliated_match_helper_unittest.cc b/components/password_manager/core/browser/android_affiliation/affiliated_match_helper_unittest.cc index e1ad3d4..f0d416a 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliated_match_helper_unittest.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliated_match_helper_unittest.cc
@@ -348,7 +348,7 @@ RunUntilIdle(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedMockTimeMessageLoopTaskRunner mock_time_task_runner_; std::vector<std::string> last_result_realms_;
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_backend_unittest.cc b/components/password_manager/core/browser/android_affiliation/affiliation_backend_unittest.cc index 44f78d3f..e5cce3f 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_backend_unittest.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliation_backend_unittest.cc
@@ -363,7 +363,7 @@ GetTestEquivalenceClassGamma()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::TestMockTimeTaskRunner> backend_task_runner_; scoped_refptr<base::TestSimpleTaskRunner> consumer_task_runner_;
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_fetch_throttler_unittest.cc b/components/password_manager/core/browser/android_affiliation/affiliation_fetch_throttler_unittest.cc index e430ff3f2..6485e3f 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_fetch_throttler_unittest.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliation_fetch_throttler_unittest.cc
@@ -82,7 +82,7 @@ network::TestNetworkConnectionTracker::GetInstance()->SetConnectionType( has_connectivity ? network::mojom::ConnectionType::CONNECTION_ETHERNET : network::mojom::ConnectionType::CONNECTION_NONE); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Runs the task runner until no tasks remain, and asserts that by this time, @@ -127,7 +127,7 @@ private: // Needed because NetworkConnectionTracker uses base::ObserverList, which // notifies observers on the sequence from which they have registered. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::TestMockTimeTaskRunner> task_runner_; MockAffiliationFetchThrottlerDelegate mock_delegate_;
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_fetcher_unittest.cc b/components/password_manager/core/browser/android_affiliation/affiliation_fetcher_unittest.cc index 1caccd2..4096334cd 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_fetcher_unittest.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliation_fetcher_unittest.cc
@@ -112,14 +112,14 @@ test_url_loader_factory_.AddResponse(interception_url(), head, "", status); } - void WaitForResponse() { scoped_task_environment_.RunUntilIdle(); } + void WaitForResponse() { task_environment_.RunUntilIdle(); } scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory() { return test_shared_loader_factory_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; std::string intercepted_body_;
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_service_unittest.cc b/components/password_manager/core/browser/android_affiliation/affiliation_service_unittest.cc index 20f73f2..7877dd89 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_service_unittest.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliation_service_unittest.cc
@@ -70,7 +70,7 @@ return &fake_affiliation_api_; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: // testing::Test: @@ -129,7 +129,7 @@ testing::Contains(testing::Field( &Facet::uri, FacetURI::FromCanonicalSpec(kTestFacetURIAlpha1)))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); testing::Mock::VerifyAndClearExpectations(mock_consumer()); // The second request should be (and can be) served from cache. @@ -141,7 +141,7 @@ ASSERT_FALSE(fake_affiliation_api()->HasPendingRequest()); mock_consumer()->ExpectSuccessWithResult(equivalence_class_alpha); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); testing::Mock::VerifyAndClearExpectations(mock_consumer()); // The third request is also restricted to the cache, but cannot be served @@ -154,7 +154,7 @@ ASSERT_FALSE(fake_affiliation_api()->HasPendingRequest()); mock_consumer()->ExpectFailure(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); testing::Mock::VerifyAndClearExpectations(mock_consumer()); } @@ -169,7 +169,7 @@ background_task_runner()->RunUntilIdle(); mock_consumer()->ExpectFailure(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); testing::Mock::VerifyAndClearExpectations(mock_consumer()); }
diff --git a/components/password_manager/core/browser/blacklisted_credentials_cleaner_unittest.cc b/components/password_manager/core/browser/blacklisted_credentials_cleaner_unittest.cc index 2f4a072..32c13517 100644 --- a/components/password_manager/core/browser/blacklisted_credentials_cleaner_unittest.cc +++ b/components/password_manager/core/browser/blacklisted_credentials_cleaner_unittest.cc
@@ -71,11 +71,11 @@ ~BlacklistedCredentialsCleanerTest() override { store_->ShutdownOnUIThread(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::HistogramTester histogram_tester_; const scoped_refptr<TestPasswordStore> store_ = base::MakeRefCounted<TestPasswordStore>(); @@ -98,7 +98,7 @@ MockCredentialsCleanerObserver observer; cleaner_.StartCleaning(&observer); EXPECT_CALL(observer, CleaningCompleted); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(prefs_.GetBoolean(prefs::kBlacklistedCredentialsNormalized)); } @@ -111,7 +111,7 @@ MockCredentialsCleanerObserver observer; cleaner_.StartCleaning(&observer); EXPECT_CALL(observer, CleaningCompleted); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); TestPasswordStore::PasswordMap stored_passwords = store_->stored_passwords(); ASSERT_EQ(1u, stored_passwords.size()); @@ -133,7 +133,7 @@ MockCredentialsCleanerObserver observer; cleaner_.StartCleaning(&observer); EXPECT_CALL(observer, CleaningCompleted); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); TestPasswordStore::PasswordMap stored_passwords = store_->stored_passwords(); ASSERT_EQ(1u, stored_passwords.size()); @@ -148,7 +148,7 @@ // Create a duplicated entry for the same signon realm. test_credential.username_value = base::ASCIIToUTF16(kTestUsername2); store_->AddLogin(test_credential); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const TestPasswordStore::PasswordMap& stored_passwords = store_->stored_passwords(); @@ -158,7 +158,7 @@ MockCredentialsCleanerObserver observer; cleaner_.StartCleaning(&observer); EXPECT_CALL(observer, CleaningCompleted); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(1u, stored_passwords.size()); // Only one credential for the signon realm is left.
diff --git a/components/password_manager/core/browser/credential_manager_impl_unittest.cc b/components/password_manager/core/browser/credential_manager_impl_unittest.cc index bae6bd4a..788bf3b 100644 --- a/components/password_manager/core/browser/credential_manager_impl_unittest.cc +++ b/components/password_manager/core/browser/credential_manager_impl_unittest.cc
@@ -333,10 +333,10 @@ std::move(callback)); } - void RunAllPendingTasks() { scoped_task_environment_.RunUntilIdle(); } + void RunAllPendingTasks() { task_environment_.RunUntilIdle(); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; autofill::PasswordForm form_; autofill::PasswordForm affiliated_form1_; autofill::PasswordForm affiliated_form2_;
diff --git a/components/password_manager/core/browser/credential_manager_password_form_manager_unittest.cc b/components/password_manager/core/browser/credential_manager_password_form_manager_unittest.cc index 25bd809..ad1e5c7 100644 --- a/components/password_manager/core/browser/credential_manager_password_form_manager_unittest.cc +++ b/components/password_manager/core/browser/credential_manager_password_form_manager_unittest.cc
@@ -97,7 +97,7 @@ } // Necessary for callbacks, and for TestAutofillDriver. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; StubPasswordManagerClient client_; MockDelegate delegate_;
diff --git a/components/password_manager/core/browser/export/password_manager_exporter_unittest.cc b/components/password_manager/core/browser/export/password_manager_exporter_unittest.cc index 3595289..6593091 100644 --- a/components/password_manager/core/browser/export/password_manager_exporter_unittest.cc +++ b/components/password_manager/core/browser/export/password_manager_exporter_unittest.cc
@@ -95,8 +95,7 @@ class PasswordManagerExporterTest : public testing::Test { public: PasswordManagerExporterTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), exporter_(&fake_credential_provider_, mock_on_progress_.Get()), destination_path_(kNullFileName) { exporter_.SetWriteForTesting(mock_write_file_.Get()); @@ -110,7 +109,7 @@ ~PasswordManagerExporterTest() override = default; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::vector<std::unique_ptr<autofill::PasswordForm>> password_list_; FakeCredentialProvider fake_credential_provider_; base::MockCallback<base::RepeatingCallback< @@ -145,7 +144,7 @@ exporter_.PreparePasswordsForExport(); exporter_.SetDestination(destination_path_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // When writing fails, we should notify the UI of the failure and try to cleanup @@ -166,7 +165,7 @@ exporter_.PreparePasswordsForExport(); exporter_.SetDestination(destination_path_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // A partial write should be considered a failure and be cleaned up. @@ -189,7 +188,7 @@ exporter_.PreparePasswordsForExport(); exporter_.SetDestination(destination_path_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Test that GetProgressStatus() returns the last ExportProgressStatus sent @@ -212,7 +211,7 @@ exporter_.SetDestination(destination_path_); ASSERT_EQ(exporter_.GetProgressStatus(), status); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(exporter_.GetProgressStatus(), status); } @@ -224,7 +223,7 @@ exporter_.SetDestination(destination_path_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(PasswordManagerExporterTest, CancelAfterPasswords) { @@ -236,7 +235,7 @@ exporter_.PreparePasswordsForExport(); exporter_.Cancel(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(PasswordManagerExporterTest, CancelWhileExporting) { @@ -253,7 +252,7 @@ exporter_.SetDestination(destination_path_); exporter_.Cancel(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // The "Cancel" button may still be visible on the UI after we've completed @@ -274,10 +273,10 @@ exporter_.PreparePasswordsForExport(); exporter_.SetDestination(destination_path_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); exporter_.Cancel(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } #if defined(OS_POSIX) @@ -292,7 +291,7 @@ exporter_.PreparePasswordsForExport(); exporter_.SetDestination(destination_path_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } #endif
diff --git a/components/password_manager/core/browser/form_fetcher_impl_unittest.cc b/components/password_manager/core/browser/form_fetcher_impl_unittest.cc index 3f2137f..feb0143 100644 --- a/components/password_manager/core/browser/form_fetcher_impl_unittest.cc +++ b/components/password_manager/core/browser/form_fetcher_impl_unittest.cc
@@ -200,11 +200,11 @@ #endif EXPECT_CALL(*mock_store_, GetLogins(form_digest_, form_fetcher_.get())); form_fetcher_->Fetch(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); testing::Mock::VerifyAndClearExpectations(mock_store_.get()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; PasswordStore::FormDigest form_digest_; std::unique_ptr<FormFetcherImpl> form_fetcher_; MockConsumer consumer_; @@ -422,7 +422,7 @@ EXPECT_CALL(*mock_store_, GetSiteStatsImpl(stats.origin_domain)) .WillOnce(Return(db_stats)); form_fetcher_->Fetch(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(form_fetcher_->GetInteractionsStats(), UnorderedElementsAre(stats)); @@ -432,7 +432,7 @@ EXPECT_CALL(*mock_store_, GetLogins(form_digest_, form_fetcher_.get())); EXPECT_CALL(*mock_store_, GetSiteStatsImpl(_)).Times(0); form_fetcher_->Fetch(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } #endif
diff --git a/components/password_manager/core/browser/form_saver_impl_unittest.cc b/components/password_manager/core/browser/form_saver_impl_unittest.cc index d117476..58687c7f 100644 --- a/components/password_manager/core/browser/form_saver_impl_unittest.cc +++ b/components/password_manager/core/browser/form_saver_impl_unittest.cc
@@ -77,7 +77,7 @@ protected: // For the MockPasswordStore. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<StrictMock<MockPasswordStore>> mock_store_; FormSaverImpl form_saver_;
diff --git a/components/password_manager/core/browser/generation/password_requirements_spec_fetcher_unittest.cc b/components/password_manager/core/browser/generation/password_requirements_spec_fetcher_unittest.cc index 9ec93ad52..5b6a270 100644 --- a/components/password_manager/core/browser/generation/password_requirements_spec_fetcher_unittest.cc +++ b/components/password_manager/core/browser/generation/password_requirements_spec_fetcher_unittest.cc
@@ -207,8 +207,8 @@ SCOPED_TRACE(test.test_name); base::HistogramTester histogram_tester; - base::test::ScopedTaskEnvironment environment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment environment( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); network::TestURLLoaderFactory loader_factory; loader_factory.AddResponse(test.requested_url, test.response_content, test.response_status); @@ -262,8 +262,8 @@ (*shard.mutable_specs())["b.com"].set_min_length(18); shard.SerializeToString(&serialized_shard); - base::test::ScopedTaskEnvironment environment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment environment( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); network::TestURLLoaderFactory loader_factory; // Target into which data will be written by the callback. @@ -315,7 +315,7 @@ // In case of incognito mode, we won't have a URL loader factory. // Test that an empty spec is returned by the spec fetcher in this case. TEST(PasswordRequirementsSpecFetcherTest, FetchDataWithoutURLLoaderFactory) { - base::test::ScopedTaskEnvironment environment; + base::test::TaskEnvironment environment; // Target into which data will be written by the callback. PasswordRequirementsSpec received_spec;
diff --git a/components/password_manager/core/browser/hsts_query_unittest.cc b/components/password_manager/core/browser/hsts_query_unittest.cc index ebd21cb..5b4012e 100644 --- a/components/password_manager/core/browser/hsts_query_unittest.cc +++ b/components/password_manager/core/browser/hsts_query_unittest.cc
@@ -71,7 +71,7 @@ private: // Used by request_context_. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<net::TestURLRequestContextGetter> request_context_; network::mojom::NetworkContextPtr network_context_pipe_; std::unique_ptr<network::NetworkContext> network_context_;
diff --git a/components/password_manager/core/browser/http_auth_manager_unittest.cc b/components/password_manager/core/browser/http_auth_manager_unittest.cc index 3da807da..234cfbc 100644 --- a/components/password_manager/core/browser/http_auth_manager_unittest.cc +++ b/components/password_manager/core/browser/http_auth_manager_unittest.cc
@@ -122,7 +122,7 @@ HttpAuthManagerImpl* httpauth_manager() { return httpauth_manager_.get(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<MockPasswordStore> store_; testing::NiceMock<MockPasswordManagerClient> client_; std::unique_ptr<HttpAuthManagerImpl> httpauth_manager_;
diff --git a/components/password_manager/core/browser/http_credentials_cleaner_unittest.cc b/components/password_manager/core/browser/http_credentials_cleaner_unittest.cc index 1e8e20ed..379f9c2 100644 --- a/components/password_manager/core/browser/http_credentials_cleaner_unittest.cc +++ b/components/password_manager/core/browser/http_credentials_cleaner_unittest.cc
@@ -138,7 +138,7 @@ static const base::string16 password[2] = {base::ASCIIToUTF16("pass0"), base::ASCIIToUTF16("pass1")}; - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; ASSERT_TRUE(store_->Init(syncer::SyncableService::StartSyncFlare(), nullptr)); TestCase test = GetParam(); SCOPED_TRACE(testing::Message() @@ -187,7 +187,7 @@ run_loop.QuitClosure()); run_loop.Run(); } - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); base::HistogramTester histogram_tester; const TestPasswordStore::PasswordMap passwords_before_cleaning = @@ -212,7 +212,7 @@ &prefs); EXPECT_CALL(observer, CleaningCompleted); cleaner.StartCleaning(&observer); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); histogram_tester.ExpectUniqueSample( "PasswordManager.HttpCredentials", @@ -237,7 +237,7 @@ } store_->ShutdownOnUIThread(); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } INSTANTIATE_TEST_SUITE_P(, @@ -249,7 +249,7 @@ SCOPED_TRACE(testing::Message() << "should_start_clean_up=" << should_start_clean_up); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; auto password_store = base::MakeRefCounted<TestPasswordStore>(); ASSERT_TRUE(password_store->Init(syncer::SyncableService::StartSyncFlare(), nullptr)); @@ -275,7 +275,7 @@ if (!should_start_clean_up) { password_store->ShutdownOnUIThread(); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); continue; } @@ -304,13 +304,13 @@ EXPECT_TRUE(cleaner.NeedsCleaning()); EXPECT_CALL(observer, CleaningCompleted); cleaner.StartCleaning(&observer); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); EXPECT_NE(prefs.GetDouble(prefs::kLastTimeObsoleteHttpCredentialsRemoved), last_time); password_store->ShutdownOnUIThread(); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } }
diff --git a/components/password_manager/core/browser/http_password_store_migrator_unittest.cc b/components/password_manager/core/browser/http_password_store_migrator_unittest.cc index 459704325..ccfab58 100644 --- a/components/password_manager/core/browser/http_password_store_migrator_unittest.cc +++ b/components/password_manager/core/browser/http_password_store_migrator_unittest.cc
@@ -130,7 +130,7 @@ MockPasswordStore& store() { return *mock_store_; } MockPasswordManagerClient& client() { return client_; } - void WaitForPasswordStore() { scoped_task_environment_.RunUntilIdle(); } + void WaitForPasswordStore() { task_environment_.RunUntilIdle(); } protected: void TestEmptyStore(bool is_hsts); @@ -138,7 +138,7 @@ void TestMigratorDeletionByConsumer(bool is_hsts); private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockConsumer consumer_; scoped_refptr<MockPasswordStore> mock_store_; MockPasswordManagerClient client_;
diff --git a/components/password_manager/core/browser/import/password_importer_unittest.cc b/components/password_manager/core/browser/import/password_importer_unittest.cc index 48a632b..59c69b9 100644 --- a/components/password_manager/core/browser/import/password_importer_unittest.cc +++ b/components/password_manager/core/browser/import/password_importer_unittest.cc
@@ -36,7 +36,7 @@ base::Bind(&PasswordImporterTest::OnImportFinished, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(callback_called_); } @@ -57,7 +57,7 @@ base::ScopedTempDir temp_directory_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; bool callback_called_; PasswordImporter::Result result_;
diff --git a/components/password_manager/core/browser/leak_detection/authenticated_leak_check.cc b/components/password_manager/core/browser/leak_detection/authenticated_leak_check.cc index fadaf81..7878ec2 100644 --- a/components/password_manager/core/browser/leak_detection/authenticated_leak_check.cc +++ b/components/password_manager/core/browser/leak_detection/authenticated_leak_check.cc
@@ -226,12 +226,24 @@ void AuthenticatedLeakCheck::OnLookupSingleLeakResponse( std::unique_ptr<SingleLookupResponse> response) { + request_.reset(); if (!response) { delegate_->OnError(LeakDetectionError::kInvalidServerResponse); return; } - delegate_->OnLeakDetectionDone(ParseLookupSingleLeakResponse(*response), url_, + DVLOG(0) << "Leak check: number of matching encrypted prefixes=" + << response->encrypted_leak_match_prefixes.size(); + + AnalyzeResponseResult( + std::move(response), encryption_key_, + base::BindOnce(&AuthenticatedLeakCheck::OnAnalazeSingleLeakResponse, + weak_ptr_factory_.GetWeakPtr())); +} + +void AuthenticatedLeakCheck::OnAnalazeSingleLeakResponse(bool is_leaked) { + DVLOG(0) << "Leak check result=" << is_leaked; + delegate_->OnLeakDetectionDone(is_leaked, std::move(url_), base::UTF8ToUTF16(username_)); }
diff --git a/components/password_manager/core/browser/leak_detection/authenticated_leak_check.h b/components/password_manager/core/browser/leak_detection/authenticated_leak_check.h index 83731904..da7fa85 100644 --- a/components/password_manager/core/browser/leak_detection/authenticated_leak_check.h +++ b/components/password_manager/core/browser/leak_detection/authenticated_leak_check.h
@@ -79,6 +79,10 @@ void OnLookupSingleLeakResponse( std::unique_ptr<SingleLookupResponse> response); + // Called when the network response is analazyed on the background thread. The + // method is called on the main thread. + void OnAnalazeSingleLeakResponse(bool is_leaked); + // Delegate for the instance. Should outlive |this|. LeakDetectionDelegateInterface* const delegate_; // Helper class to asynchronously prepare the data for the request.
diff --git a/components/password_manager/core/browser/leak_detection/authenticated_leak_check_unittest.cc b/components/password_manager/core/browser/leak_detection/authenticated_leak_check_unittest.cc index f52fd6e..8212bda 100644 --- a/components/password_manager/core/browser/leak_detection/authenticated_leak_check_unittest.cc +++ b/components/password_manager/core/browser/leak_detection/authenticated_leak_check_unittest.cc
@@ -6,10 +6,13 @@ #include "base/strings/utf_string_conversions.h" #include "base/test/scoped_task_environment.h" +#include "components/password_manager/core/browser/leak_detection/encryption_utils.h" #include "components/password_manager/core/browser/leak_detection/leak_detection_delegate_interface.h" #include "components/password_manager/core/browser/leak_detection/leak_detection_request_factory.h" #include "components/password_manager/core/browser/leak_detection/mock_leak_detection_delegate.h" +#include "components/password_manager/core/browser/leak_detection/single_lookup_response.h" #include "components/signin/public/identity_manager/identity_test_environment.h" +#include "crypto/sha2.h" #include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/test/test_shared_url_loader_factory.h" #include "testing/gmock/include/gmock/gmock.h" @@ -40,6 +43,22 @@ LookupSingleLeakCallback)); }; +struct TestLeakDetectionRequest : public LeakDetectionRequestInterface { + ~TestLeakDetectionRequest() override = default; + // LeakDetectionRequestInterface: + void LookupSingleLeak(network::mojom::URLLoaderFactory* url_loader_factory, + const std::string& access_token, + std::string username_hash_prefix, + std::string encrypted_payload, + LookupSingleLeakCallback callback) override { + encrypted_payload_ = std::move(encrypted_payload); + callback_ = std::move(callback); + } + + std::string encrypted_payload_; + LookupSingleLeakCallback callback_; +}; + class MockLeakDetectionRequestFactory : public LeakDetectionRequestFactory { public: // LeakDetectionRequestFactory: @@ -47,6 +66,12 @@ std::unique_ptr<LeakDetectionRequestInterface>()); }; +// Helper struct for making a fake network request. +struct PayloadAndCallback { + std::string payload; + LeakDetectionRequestInterface::LookupSingleLeakCallback callback; +}; + class AuthenticatedLeakCheckTest : public testing::Test { public: AuthenticatedLeakCheckTest() @@ -61,7 +86,7 @@ } ~AuthenticatedLeakCheckTest() override = default; - base::test::ScopedTaskEnvironment& task_env() { return task_env_; } + base::test::TaskEnvironment& task_env() { return task_env_; } signin::IdentityTestEnvironment& identity_env() { return identity_test_env_; } MockLeakDetectionDelegateInterface& delegate() { return delegate_; } MockLeakDetectionRequestFactory* request_factory() { @@ -69,14 +94,43 @@ } AuthenticatedLeakCheck& leak_check() { return leak_check_; } + // Brings |leak_check_| to the state right after the network request. + // The check is done for |kUsername|/|kPassword| credential on |kExampleCom|. + // Returns |encrypted_payload| and |callback| arguments of LookupSingleLeak(). + PayloadAndCallback ImitateNetworkRequest(); + private: - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; signin::IdentityTestEnvironment identity_test_env_; StrictMock<MockLeakDetectionDelegateInterface> delegate_; MockLeakDetectionRequestFactory* request_factory_; AuthenticatedLeakCheck leak_check_; }; +PayloadAndCallback AuthenticatedLeakCheckTest::ImitateNetworkRequest() { + AccountInfo info = identity_env().MakeAccountAvailable(kTestEmail); + identity_env().SetCookieAccounts({{info.email, info.account_id}}); + identity_env().SetRefreshTokenForAccount(info.account_id); + + leak_check().Start(GURL(kExampleCom), base::ASCIIToUTF16(kUsername), + base::ASCIIToUTF16(kPassword)); + // Crypto stuff is done here. + task_env().RunUntilIdle(); + + static constexpr char access_token[] = "access_token"; + auto network_request = std::make_unique<TestLeakDetectionRequest>(); + TestLeakDetectionRequest* raw_request = network_request.get(); + EXPECT_CALL(*request_factory(), CreateNetworkRequest) + .WillOnce(Return(ByMove(std::move(network_request)))); + + // Return the access token. + identity_env().WaitForAccessTokenRequestIfNecessaryAndRespondWithToken( + access_token, base::Time::Max()); + + return {std::move(raw_request->encrypted_payload_), + std::move(raw_request->callback_)}; +} + } // namespace TEST_F(AuthenticatedLeakCheckTest, Create) { @@ -157,4 +211,45 @@ GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED)); } +// Perform the whole cycle of a leak check. The server returns data signalling +// that the password wasn't leaked. +TEST_F(AuthenticatedLeakCheckTest, ParseResponse_NoLeak) { + PayloadAndCallback payload_and_callback = ImitateNetworkRequest(); + ASSERT_TRUE(!payload_and_callback.payload.empty()); + + auto response = std::make_unique<SingleLookupResponse>(); + std::string key_server; + response->reencrypted_lookup_hash = + CipherReEncrypt(payload_and_callback.payload, &key_server); + response->encrypted_leak_match_prefixes.push_back( + crypto::SHA256HashString(CipherEncryptWithKey( + ScryptHashUsernameAndPassword("another_username", kPassword), + key_server))); + + EXPECT_CALL(delegate(), OnLeakDetectionDone(false, GURL(kExampleCom), + base::ASCIIToUTF16(kUsername))); + std::move(payload_and_callback.callback).Run(std::move(response)); + task_env().RunUntilIdle(); +} + +// Perform the whole cycle of a leak check. The server returns data signalling +// that the password was leaked. +TEST_F(AuthenticatedLeakCheckTest, ParseResponse_Leak) { + PayloadAndCallback payload_and_callback = ImitateNetworkRequest(); + ASSERT_TRUE(!payload_and_callback.payload.empty()); + + auto response = std::make_unique<SingleLookupResponse>(); + std::string key_server; + response->reencrypted_lookup_hash = + CipherReEncrypt(payload_and_callback.payload, &key_server); + response->encrypted_leak_match_prefixes.push_back( + crypto::SHA256HashString(CipherEncryptWithKey( + ScryptHashUsernameAndPassword(kUsername, kPassword), key_server))); + + EXPECT_CALL(delegate(), OnLeakDetectionDone(true, GURL(kExampleCom), + base::ASCIIToUTF16(kUsername))); + std::move(payload_and_callback.callback).Run(std::move(response)); + task_env().RunUntilIdle(); +} + } // namespace password_manager
diff --git a/components/password_manager/core/browser/leak_detection/leak_detection_check_factory_impl_unittest.cc b/components/password_manager/core/browser/leak_detection/leak_detection_check_factory_impl_unittest.cc index 5a38d805..32bd6919 100644 --- a/components/password_manager/core/browser/leak_detection/leak_detection_check_factory_impl_unittest.cc +++ b/components/password_manager/core/browser/leak_detection/leak_detection_check_factory_impl_unittest.cc
@@ -35,7 +35,7 @@ LeakDetectionCheckFactoryImpl& request_factory() { return request_factory_; } private: - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; signin::IdentityTestEnvironment identity_test_env_; StrictMock<MockLeakDetectionDelegateInterface> delegate_; scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_ =
diff --git a/components/password_manager/core/browser/leak_detection/leak_detection_delegate_interface.h b/components/password_manager/core/browser/leak_detection/leak_detection_delegate_interface.h index 0b035b08..ec4c1eb 100644 --- a/components/password_manager/core/browser/leak_detection/leak_detection_delegate_interface.h +++ b/components/password_manager/core/browser/leak_detection/leak_detection_delegate_interface.h
@@ -40,9 +40,10 @@ // Called when the request is finished without error. // |leak| is true iff the checked credential was leaked. // |url| and |username| are taken from Start() for presentation in the UI. + // Pass parameters by value because the caller can be destroyed here. virtual void OnLeakDetectionDone(bool leaked, - const GURL& url, - base::StringPiece16 username) = 0; + GURL url, + base::string16 username) = 0; virtual void OnError(LeakDetectionError error) = 0; };
diff --git a/components/password_manager/core/browser/leak_detection/leak_detection_request_unittest.cc b/components/password_manager/core/browser/leak_detection/leak_detection_request_unittest.cc index 36c2303..56f58e4 100644 --- a/components/password_manager/core/browser/leak_detection/leak_detection_request_unittest.cc +++ b/components/password_manager/core/browser/leak_detection/leak_detection_request_unittest.cc
@@ -24,14 +24,14 @@ ~LeakDetectionRequestTest() override = default; - base::test::ScopedTaskEnvironment& task_env() { return task_env_; } + base::test::TaskEnvironment& task_env() { return task_env_; } network::TestURLLoaderFactory* test_url_loader_factory() { return &test_url_loader_factory_; } LeakDetectionRequest& request() { return request_; } private: - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; network::TestURLLoaderFactory test_url_loader_factory_; LeakDetectionRequest request_; };
diff --git a/components/password_manager/core/browser/leak_detection/leak_detection_request_utils.cc b/components/password_manager/core/browser/leak_detection/leak_detection_request_utils.cc index f03aa42..34570ba 100644 --- a/components/password_manager/core/browser/leak_detection/leak_detection_request_utils.cc +++ b/components/password_manager/core/browser/leak_detection/leak_detection_request_utils.cc
@@ -78,16 +78,4 @@ std::move(callback)); } -bool ParseLookupSingleLeakResponse(const SingleLookupResponse& response) { - // TODO(crbug.com/086298): Implement decrypting the response and checking - // whether the credential was actually leaked. - DVLOG(0) << "Number of Encrypted Leak Match Prefixes: " - << response.encrypted_leak_match_prefixes.size(); - - base::span<const char> hash = response.reencrypted_lookup_hash; - DVLOG(0) << "Reencrypted Lookup Hash: " - << base::HexEncode(base::as_bytes(hash)); - return false; -} - } // namespace password_manager
diff --git a/components/password_manager/core/browser/leak_detection/leak_detection_request_utils.h b/components/password_manager/core/browser/leak_detection/leak_detection_request_utils.h index 94c3fe6..88ddecc 100644 --- a/components/password_manager/core/browser/leak_detection/leak_detection_request_utils.h +++ b/components/password_manager/core/browser/leak_detection/leak_detection_request_utils.h
@@ -46,10 +46,6 @@ const std::string& encryption_key, SingleLeakResponseAnalysisCallback callback); -// Processes the provided |response| and returns whether the relevant credential -// was leaked. -bool ParseLookupSingleLeakResponse(const SingleLookupResponse& response); - } // namespace password_manager #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LEAK_DETECTION_LEAK_DETECTION_REQUEST_UTILS_H_
diff --git a/components/password_manager/core/browser/leak_detection/leak_detection_request_utils_unittest.cc b/components/password_manager/core/browser/leak_detection/leak_detection_request_utils_unittest.cc index 3d8aee0e..2db6b25 100644 --- a/components/password_manager/core/browser/leak_detection/leak_detection_request_utils_unittest.cc +++ b/components/password_manager/core/browser/leak_detection/leak_detection_request_utils_unittest.cc
@@ -7,7 +7,6 @@ #include "base/test/mock_callback.h" #include "base/test/scoped_task_environment.h" #include "components/password_manager/core/browser/leak_detection/encryption_utils.h" -#include "components/password_manager/core/browser/leak_detection/leak_detection_api.pb.h" #include "components/password_manager/core/browser/leak_detection/single_lookup_response.h" #include "crypto/sha2.h" #include "testing/gmock/include/gmock/gmock.h" @@ -27,7 +26,7 @@ } // namespace TEST(LeakDetectionRequestUtils, PrepareSingleLeakRequestData) { - base::test::ScopedTaskEnvironment task_env; + base::test::TaskEnvironment task_env; base::MockCallback<SingleLeakRequestDataCallback> callback; PrepareSingleLeakRequestData("jonsnow", "1234", callback.Get()); @@ -42,7 +41,7 @@ } TEST(LeakDetectionRequestUtils, AnalyzeResponseResult_NoLeak) { - base::test::ScopedTaskEnvironment task_env; + base::test::TaskEnvironment task_env; constexpr char kUsernamePasswordHash[] = "abcdefg"; auto response = std::make_unique<SingleLookupResponse>(); @@ -69,7 +68,7 @@ } TEST(LeakDetectionRequestUtils, AnalyzeResponseResult_Leak) { - base::test::ScopedTaskEnvironment task_env; + base::test::TaskEnvironment task_env; constexpr char kUsernamePasswordHash[] = "abcdefg"; auto response = std::make_unique<SingleLookupResponse>();
diff --git a/components/password_manager/core/browser/leak_detection/mock_leak_detection_delegate.h b/components/password_manager/core/browser/leak_detection/mock_leak_detection_delegate.h index 077fffcc..e8b8d65 100644 --- a/components/password_manager/core/browser/leak_detection/mock_leak_detection_delegate.h +++ b/components/password_manager/core/browser/leak_detection/mock_leak_detection_delegate.h
@@ -17,8 +17,7 @@ ~MockLeakDetectionDelegateInterface() override; // LeakDetectionDelegateInterface: - MOCK_METHOD3(OnLeakDetectionDone, - void(bool, const GURL&, base::StringPiece16)); + MOCK_METHOD3(OnLeakDetectionDone, void(bool, GURL, base::string16)); MOCK_METHOD1(OnError, void(LeakDetectionError)); };
diff --git a/components/password_manager/core/browser/leak_detection_delegate.cc b/components/password_manager/core/browser/leak_detection_delegate.cc index e66bf151..f9ff1354 100644 --- a/components/password_manager/core/browser/leak_detection_delegate.cc +++ b/components/password_manager/core/browser/leak_detection_delegate.cc
@@ -39,8 +39,8 @@ } void LeakDetectionDelegate::OnLeakDetectionDone(bool leaked, - const GURL& url, - base::StringPiece16 username) { + GURL url, + base::string16 username) { leak_check_.reset(); if (password_manager_util::IsLoggingActive(client_)) { BrowserSavePasswordProgressLogger logger(client_->GetLogManager());
diff --git a/components/password_manager/core/browser/leak_detection_delegate.h b/components/password_manager/core/browser/leak_detection_delegate.h index faf68b7..a079309 100644 --- a/components/password_manager/core/browser/leak_detection_delegate.h +++ b/components/password_manager/core/browser/leak_detection_delegate.h
@@ -44,8 +44,8 @@ private: // LeakDetectionDelegateInterface: void OnLeakDetectionDone(bool leaked, - const GURL& url, - base::StringPiece16 username) override; + GURL url, + base::string16 username) override; void OnError(LeakDetectionError error) override; PasswordManagerClient* client_;
diff --git a/components/password_manager/core/browser/login_database_ios_unittest.cc b/components/password_manager/core/browser/login_database_ios_unittest.cc index c9cf4b51..16896d2 100644 --- a/components/password_manager/core/browser/login_database_ios_unittest.cc +++ b/components/password_manager/core/browser/login_database_ios_unittest.cc
@@ -46,7 +46,7 @@ protected: base::ScopedTempDir temp_dir_; std::unique_ptr<LoginDatabase> login_db_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; void LoginDatabaseIOSTest::ClearKeychain() {
diff --git a/components/password_manager/core/browser/login_database_unittest.cc b/components/password_manager/core/browser/login_database_unittest.cc index 58721ec..a986c89 100644 --- a/components/password_manager/core/browser/login_database_unittest.cc +++ b/components/password_manager/core/browser/login_database_unittest.cc
@@ -273,7 +273,7 @@ base::ScopedTempDir temp_dir_; base::FilePath file_; std::unique_ptr<LoginDatabase> db_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(LoginDatabaseTest, Logins) { @@ -1934,7 +1934,7 @@ private: base::FilePath database_dump_location_; base::ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; void LoginDatabaseMigrationTest::MigrationToVCurrent( @@ -2088,12 +2088,12 @@ return testing_local_state_; } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } private: base::FilePath database_path_; base::ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestingPrefServiceSimple testing_local_state_; DISALLOW_COPY_AND_ASSIGN(LoginDatabaseUndecryptableLoginsTest);
diff --git a/components/password_manager/core/browser/password_autofill_manager.cc b/components/password_manager/core/browser/password_autofill_manager.cc index 2ab505f..ef5b4ac 100644 --- a/components/password_manager/core/browser/password_autofill_manager.cc +++ b/components/password_manager/core/browser/password_autofill_manager.cc
@@ -260,6 +260,13 @@ return password_manager_driver_->GetAutofillDriver(); } +int32_t PasswordAutofillManager::GetWebContentsPopupControllerAxId() const { + // TODO: Needs to be implemented when we step up accessibility features in the + // future. + NOTIMPLEMENTED_LOG_ONCE() << "See http://crbug.com/991253"; + return 0; +} + void PasswordAutofillManager::RegisterDeletionCallback( base::OnceClosure deletion_callback) { deletion_callback_ = std::move(deletion_callback);
diff --git a/components/password_manager/core/browser/password_autofill_manager.h b/components/password_manager/core/browser/password_autofill_manager.h index 981e4a2..618b014 100644 --- a/components/password_manager/core/browser/password_autofill_manager.h +++ b/components/password_manager/core/browser/password_autofill_manager.h
@@ -55,6 +55,7 @@ void ClearPreviewedForm() override; autofill::PopupType GetPopupType() const override; autofill::AutofillDriver* GetAutofillDriver() override; + int32_t GetWebContentsPopupControllerAxId() const override; void RegisterDeletionCallback(base::OnceClosure deletion_callback) override; // Invoked when a password mapping is added.
diff --git a/components/password_manager/core/browser/password_autofill_manager_unittest.cc b/components/password_manager/core/browser/password_autofill_manager_unittest.cc index 67362c00..ba4a1af 100644 --- a/components/password_manager/core/browser/password_autofill_manager_unittest.cc +++ b/components/password_manager/core/browser/password_autofill_manager_unittest.cc
@@ -194,7 +194,7 @@ // The TestAutofillDriver uses a SequencedWorkerPool which expects the // existence of a MessageLoop. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(PasswordAutofillManagerTest, FillSuggestion) {
diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc index 8b2ff26..40cfaae 100644 --- a/components/password_manager/core/browser/password_form_manager_unittest.cc +++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -1017,7 +1017,7 @@ private: // Necessary for callbacks, and for TestAutofillDriver. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; PasswordForm observed_form_; PasswordForm saved_match_;
diff --git a/components/password_manager/core/browser/password_form_metrics_recorder_unittest.cc b/components/password_manager/core/browser/password_form_metrics_recorder_unittest.cc index ce979a3..8858878 100644 --- a/components/password_manager/core/browser/password_form_metrics_recorder_unittest.cc +++ b/components/password_manager/core/browser/password_form_metrics_recorder_unittest.cc
@@ -69,7 +69,7 @@ // Test the metrics recorded around password generation and the user's // interaction with the offer to generate passwords. TEST(PasswordFormMetricsRecorder, Generation) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; static constexpr struct { bool generation_available; bool has_generated_password; @@ -200,7 +200,7 @@ // Test the recording of metrics around manager_action, user_action, and // submit_result. TEST(PasswordFormMetricsRecorder, Actions) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; static constexpr struct { // Stimuli: bool is_main_frame_secure; @@ -297,7 +297,7 @@ } TEST(PasswordFormMetricsRecorder, SubmittedFormType) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; static constexpr struct { // Stimuli: bool is_main_frame_secure; @@ -356,7 +356,7 @@ } TEST(PasswordFormMetricsRecorder, RecordPasswordBubbleShown) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; using Trigger = PasswordFormMetricsRecorder::BubbleTrigger; static constexpr struct { // Stimuli: @@ -451,7 +451,7 @@ } TEST(PasswordFormMetricsRecorder, RecordUIDismissalReason) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; static constexpr struct { // Stimuli: metrics_util::UIDisplayDisposition display_disposition; @@ -503,7 +503,7 @@ // Verify that it is ok to open and close the password bubble more than once // and still get accurate metrics. TEST(PasswordFormMetricsRecorder, SequencesOfBubbles) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; using BubbleDismissalReason = PasswordFormMetricsRecorder::BubbleDismissalReason; using BubbleTrigger = PasswordFormMetricsRecorder::BubbleTrigger; @@ -550,7 +550,7 @@ // Verify that one-time actions are only recorded once per life-cycle of a // PasswordFormMetricsRecorder. TEST(PasswordFormMetricsRecorder, RecordDetailedUserAction) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; using Action = PasswordFormMetricsRecorder::DetailedUserAction; ukm::TestAutoSetUkmRecorder test_ukm_recorder; { @@ -576,7 +576,7 @@ // Verify that the the mapping is correct and that metrics are actually // recorded. TEST(PasswordFormMetricsRecorder, RecordShowManualFallbackForSaving) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; struct { bool has_generated_password; bool is_update; @@ -606,7 +606,7 @@ // Verify that no 0 is recorded if now fallback icon is shown. TEST(PasswordFormMetricsRecorder, NoRecordShowManualFallbackForSaving) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ukm::TestAutoSetUkmRecorder test_ukm_recorder; { auto recorder = CreatePasswordFormMetricsRecorder( @@ -621,7 +621,7 @@ // Verify that only the latest value is recorded TEST(PasswordFormMetricsRecorder, RecordShowManualFallbackForSavingLatestOnly) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ukm::TestAutoSetUkmRecorder test_ukm_recorder; { auto recorder = CreatePasswordFormMetricsRecorder( @@ -736,7 +736,7 @@ << ", is_main_frame_secure: " << std::boolalpha << is_main_frame_secure); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::HistogramTester histogram_tester; FormData form_data = ConvertToFormData(test_case.fields);
diff --git a/components/password_manager/core/browser/password_generation_frame_helper_unittest.cc b/components/password_manager/core/browser/password_generation_frame_helper_unittest.cc index f2bf07a..57d5e3a 100644 --- a/components/password_manager/core/browser/password_generation_frame_helper_unittest.cc +++ b/components/password_manager/core/browser/password_generation_frame_helper_unittest.cc
@@ -182,7 +182,7 @@ return GetGenerationHelper()->IsGenerationEnabled(true); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockPasswordManagerClient> client_; };
diff --git a/components/password_manager/core/browser/password_generation_state_unittest.cc b/components/password_manager/core/browser/password_generation_state_unittest.cc index dd47e532..101cc0c 100644 --- a/components/password_manager/core/browser/password_generation_state_unittest.cc +++ b/components/password_manager/core/browser/password_generation_state_unittest.cc
@@ -133,7 +133,7 @@ private: // For the MockPasswordStore. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<MockPasswordStore> mock_store_; // Test with the real form saver for better robustness. FormSaverImpl form_saver_;
diff --git a/components/password_manager/core/browser/password_manager_metrics_recorder_unittest.cc b/components/password_manager/core/browser/password_manager_metrics_recorder_unittest.cc index b48005f..ee412ebf 100644 --- a/components/password_manager/core/browser/password_manager_metrics_recorder_unittest.cc +++ b/components/password_manager/core/browser/password_manager_metrics_recorder_unittest.cc
@@ -34,7 +34,7 @@ } // namespace TEST(PasswordManagerMetricsRecorder, UserModifiedPasswordField) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ukm::TestAutoSetUkmRecorder test_ukm_recorder; { PasswordManagerMetricsRecorder recorder(CreateMetricsRecorder()); @@ -52,7 +52,7 @@ } TEST(PasswordManagerMetricsRecorder, UserModifiedPasswordFieldMultipleTimes) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ukm::TestAutoSetUkmRecorder test_ukm_recorder; { PasswordManagerMetricsRecorder recorder(CreateMetricsRecorder()); @@ -71,7 +71,7 @@ } TEST(PasswordManagerMetricsRecorder, UserModifiedPasswordFieldNotCalled) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ukm::TestAutoSetUkmRecorder test_ukm_recorder; { PasswordManagerMetricsRecorder recorder(CreateMetricsRecorder()); } const auto& entries =
diff --git a/components/password_manager/core/browser/password_manager_onboarding_unittest.cc b/components/password_manager/core/browser/password_manager_onboarding_unittest.cc index 7044b20..bdab255 100644 --- a/components/password_manager/core/browser/password_manager_onboarding_unittest.cc +++ b/components/password_manager/core/browser/password_manager_onboarding_unittest.cc
@@ -55,7 +55,7 @@ PrefService* GetPrefs() { return prefs_.get(); } - void RunAllPendingTasks() { scoped_task_environment_.RunUntilIdle(); } + void RunAllPendingTasks() { task_environment_.RunUntilIdle(); } PasswordForm MakeSimpleForm(int id) { PasswordForm form; @@ -76,7 +76,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<TestPasswordStore> store_; std::unique_ptr<TestingPrefServiceSimple> prefs_; };
diff --git a/components/password_manager/core/browser/password_manager_unittest.cc b/components/password_manager/core/browser/password_manager_unittest.cc index c26555f5..4429e60 100644 --- a/components/password_manager/core/browser/password_manager_unittest.cc +++ b/components/password_manager/core/browser/password_manager_unittest.cc
@@ -518,7 +518,7 @@ } const GURL test_url_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<MockPasswordStore> store_; testing::NiceMock<MockPasswordManagerClient> client_; MockPasswordManagerDriver driver_;
diff --git a/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc b/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc index d46fbe5c..dc11af29 100644 --- a/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc +++ b/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc
@@ -52,7 +52,7 @@ protected: // It's needed for an initialisation of thread runners that are used in // MockPasswordStore. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockPasswordManagerClient client_; scoped_refptr<MockPasswordStore> store_;
diff --git a/components/password_manager/core/browser/password_store_default_unittest.cc b/components/password_manager/core/browser/password_store_default_unittest.cc index 88e8a5f..22a7388 100644 --- a/components/password_manager/core/browser/password_store_default_unittest.cc +++ b/components/password_manager/core/browser/password_store_default_unittest.cc
@@ -97,7 +97,7 @@ base::FilePath test_login_db_file_path() const; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; scoped_refptr<PasswordStoreDefault> store_; @@ -105,8 +105,7 @@ }; PasswordStoreDefaultTestDelegate::PasswordStoreDefaultTestDelegate() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) { OSCryptMocker::SetUp(); SetupTempDir(); store_ = CreateInitializedStore( @@ -115,8 +114,7 @@ PasswordStoreDefaultTestDelegate::PasswordStoreDefaultTestDelegate( std::unique_ptr<LoginDatabase> database) - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) { OSCryptMocker::SetUp(); SetupTempDir(); store_ = CreateInitializedStore(std::move(database)); @@ -128,7 +126,7 @@ } void PasswordStoreDefaultTestDelegate::FinishAsyncProcessing() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void PasswordStoreDefaultTestDelegate::SetupTempDir() {
diff --git a/components/password_manager/core/browser/password_store_unittest.cc b/components/password_manager/core/browser/password_store_unittest.cc index 5391763..157307c 100644 --- a/components/password_manager/core/browser/password_store_unittest.cc +++ b/components/password_manager/core/browser/password_store_unittest.cc
@@ -109,8 +109,7 @@ class PasswordStoreTest : public testing::Test { protected: PasswordStoreTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); @@ -123,7 +122,7 @@ OSCryptMocker::TearDown(); } - void WaitForPasswordStore() { scoped_task_environment_.RunUntilIdle(); } + void WaitForPasswordStore() { task_environment_.RunUntilIdle(); } base::FilePath test_login_db_file_path() const { return temp_dir_.GetPath().Append(FILE_PATH_LITERAL("login_test")); @@ -131,7 +130,7 @@ private: base::ScopedTempDir temp_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(PasswordStoreTest); };
diff --git a/components/password_manager/core/browser/sync/password_syncable_service_unittest.cc b/components/password_manager/core/browser/sync/password_syncable_service_unittest.cc index 0b0abb5a6..44078521 100644 --- a/components/password_manager/core/browser/sync/password_syncable_service_unittest.cc +++ b/components/password_manager/core/browser/sync/password_syncable_service_unittest.cc
@@ -230,7 +230,7 @@ private: // Used by the password store. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; PasswordSyncableServiceWrapper wrapper_; };
diff --git a/components/password_manager/core/browser/sync_username_test_base.h b/components/password_manager/core/browser/sync_username_test_base.h index 440b998..ba243920 100644 --- a/components/password_manager/core/browser/sync_username_test_base.h +++ b/components/password_manager/core/browser/sync_username_test_base.h
@@ -43,7 +43,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_env_; + base::test::TaskEnvironment scoped_task_env_; signin::IdentityTestEnvironment identity_test_env_; syncer::TestSyncService sync_service_; };
diff --git a/components/password_manager/core/browser/votes_uploader_unittest.cc b/components/password_manager/core/browser/votes_uploader_unittest.cc index 9643c8e..87b38a00 100644 --- a/components/password_manager/core/browser/votes_uploader_unittest.cc +++ b/components/password_manager/core/browser/votes_uploader_unittest.cc
@@ -107,7 +107,7 @@ return ASCIIToUTF16("field") + base::NumberToString16(index); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockAutofillDownloadManager mock_autofill_download_manager_; MockPasswordManagerClient client_;
diff --git a/components/password_manager/core/common/passwords_directory_util_ios_unittest.cc b/components/password_manager/core/common/passwords_directory_util_ios_unittest.cc index e4d9945e..bb83750 100644 --- a/components/password_manager/core/common/passwords_directory_util_ios_unittest.cc +++ b/components/password_manager/core/common/passwords_directory_util_ios_unittest.cc
@@ -12,7 +12,7 @@ // Tests that DeletePasswordsDirectory() actually deletes the directory. TEST(PasswordsDirectoryUtilTest, Deletion) { - base::test::ScopedTaskEnvironment environment; + base::test::TaskEnvironment environment; base::FilePath dir; ASSERT_TRUE(password_manager::GetPasswordsDirectory(&dir)); ASSERT_TRUE(CreateDirectory(dir));
diff --git a/components/payments/content/payment_request.cc b/components/payments/content/payment_request.cc index bda9375..4291f2e3 100644 --- a/components/payments/content/payment_request.cc +++ b/components/payments/content/payment_request.cc
@@ -713,11 +713,10 @@ void PaymentRequest::HasEnrolledInstrumentCallback( bool per_method_quota, bool has_enrolled_instrument) { - if (!spec_ || - CanMakePaymentQueryFactory::GetInstance() - ->GetForContext(web_contents_->GetBrowserContext()) - ->CanQuery(top_level_origin_, frame_origin_, - spec_->stringified_method_data(), per_method_quota)) { + if (!spec_ || CanMakePaymentQueryFactory::GetInstance() + ->GetForContext(web_contents_->GetBrowserContext()) + ->CanQuery(top_level_origin_, frame_origin_, + spec_->query_for_quota(), per_method_quota)) { RespondToHasEnrolledInstrumentQuery(has_enrolled_instrument, /*warn_local_development=*/false); } else if (UrlUtil::IsLocalDevelopmentUrl(frame_origin_)) {
diff --git a/components/payments/content/payment_request_spec.cc b/components/payments/content/payment_request_spec.cc index 792689b..c8b7c31 100644 --- a/components/payments/content/payment_request_spec.cc +++ b/components/payments/content/payment_request_spec.cc
@@ -8,12 +8,15 @@ #include "base/feature_list.h" #include "base/logging.h" +#include "base/stl_util.h" +#include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "components/payments/content/payment_request_converter.h" #include "components/payments/core/features.h" #include "components/payments/core/payment_instrument.h" #include "components/payments/core/payment_method_data.h" #include "components/payments/core/payment_request_data_util.h" +#include "components/payments/core/payments_experimental_features.h" #include "components/strings/grit/components_strings.h" #include "ui/base/l10n/l10n_util.h" @@ -68,6 +71,10 @@ payment_method_identifiers_set, stringified_method_data); } +std::string ToString(bool value) { + return value ? "true" : "false"; +} + } // namespace const char kBasicCardMethodName[] = "basic-card"; @@ -100,6 +107,18 @@ &supported_card_networks_set_, &supported_card_types_set_, &url_payment_method_identifiers_, &payment_method_identifiers_set_, &stringified_method_data_); + + query_for_quota_ = stringified_method_data_; + if (base::Contains(payment_method_identifiers_set_, "basic-card") && + PaymentsExperimentalFeatures::IsEnabled( + features::kStrictHasEnrolledAutofillInstrument)) { + query_for_quota_["basic-card-payment-options"] = { + base::ReplaceStringPlaceholders( + "{payerEmail:$1,payerName:$2,payerPhone:$3,shipping:$4}", + {ToString(request_payer_email()), ToString(request_payer_name()), + ToString(request_payer_phone()), ToString(request_shipping())}, + nullptr)}; + } } PaymentRequestSpec::~PaymentRequestSpec() {}
diff --git a/components/payments/content/payment_request_spec.h b/components/payments/content/payment_request_spec.h index 693de31e..80735b7 100644 --- a/components/payments/content/payment_request_spec.h +++ b/components/payments/content/payment_request_spec.h
@@ -125,6 +125,19 @@ bool request_payer_email() const override; PaymentShippingType shipping_type() const override; + // Returns the query to be used for the quota on hasEnrolledInstrument() + // calls. Generally this returns the payment method identifiers and their + // corresponding data. However, in the case of basic-card with + // kStrictHasEnrolledAutofillInstrument feature enabled, this method also + // returns the following payment options: + // - requestPayerEmail + // - requestPayerName + // - requestPayerPhone + // - requestShipping + const std::map<std::string, std::set<std::string>>& query_for_quota() const { + return query_for_quota_; + } + bool supports_basic_card() const { return !supported_card_networks_.empty(); } const std::vector<std::string>& supported_card_networks() const { @@ -260,6 +273,16 @@ // payment method specific data. std::map<std::string, std::set<std::string>> stringified_method_data_; + // A mapping of the payment method names to the corresponding JSON-stringified + // payment method specific data. If kStrictHasEnrolledAutofillInstrument is + // enabled, then the key "basic-card-payment-options" also maps to the + // following payment options: + // - requestPayerEmail + // - requestPayerName + // - requestPayerPhone + // - requestShipping + std::map<std::string, std::set<std::string>> query_for_quota_; + // The reason why this payment request is waiting for updateWith. UpdateReason current_update_reason_;
diff --git a/components/payments/core/can_make_payment_query_unittest.cc b/components/payments/core/can_make_payment_query_unittest.cc index c7be1ff..63db448 100644 --- a/components/payments/core/can_make_payment_query_unittest.cc +++ b/components/payments/core/can_make_payment_query_unittest.cc
@@ -16,7 +16,7 @@ CanMakePaymentQuery guard_; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; // An HTTPS website is not allowed to query all of the networks of the cards in
diff --git a/components/payments/core/journey_logger_unittest.cc b/components/payments/core/journey_logger_unittest.cc index 348f582..25939971 100644 --- a/components/payments/core/journey_logger_unittest.cc +++ b/components/payments/core/journey_logger_unittest.cc
@@ -931,7 +931,7 @@ // the Payment Request. TEST(JourneyLoggerTest, RecordJourneyStatsHistograms_CheckoutFunnelUkm_UserAborted) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; using UkmEntry = ukm::builders::PaymentRequest_CheckoutEvents; ukm::TestAutoSetUkmRecorder ukm_recorder; char test_url[] = "http://www.google.com/"; @@ -982,7 +982,7 @@ // completes the Payment Request. TEST(JourneyLoggerTest, RecordJourneyStatsHistograms_CheckoutFunnelUkm_Completed) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; using UkmEntry = ukm::builders::PaymentRequest_CheckoutEvents; ukm::TestAutoSetUkmRecorder ukm_recorder; char test_url[] = "http://www.google.com/";
diff --git a/components/payments/core/payment_manifest_downloader_unittest.cc b/components/payments/core/payment_manifest_downloader_unittest.cc index b460cb7..4138e3b 100644 --- a/components/payments/core/payment_manifest_downloader_unittest.cc +++ b/components/payments/core/payment_manifest_downloader_unittest.cc
@@ -84,7 +84,7 @@ private: GURL test_url_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_factory_; scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_; PaymentManifestDownloader downloader_; @@ -381,7 +381,7 @@ private: GURL test_url_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_factory_; scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_; PaymentManifestDownloader downloader_;
diff --git a/components/policy/core/browser/configuration_policy_pref_store_test.h b/components/policy/core/browser/configuration_policy_pref_store_test.h index bad9c61..f0c8ba63 100644 --- a/components/policy/core/browser/configuration_policy_pref_store_test.h +++ b/components/policy/core/browser/configuration_policy_pref_store_test.h
@@ -38,7 +38,7 @@ MockConfigurationPolicyProvider provider_; std::unique_ptr<PolicyServiceImpl> policy_service_; scoped_refptr<ConfigurationPolicyPrefStore> store_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyPrefStoreTest);
diff --git a/components/policy/core/browser/url_blacklist_manager_unittest.cc b/components/policy/core/browser/url_blacklist_manager_unittest.cc index 0930f96..236ddaf8 100644 --- a/components/policy/core/browser/url_blacklist_manager_unittest.cc +++ b/components/policy/core/browser/url_blacklist_manager_unittest.cc
@@ -70,19 +70,19 @@ pref_service_.registry()->RegisterListPref(policy_prefs::kUrlBlacklist); pref_service_.registry()->RegisterListPref(policy_prefs::kUrlWhitelist); blacklist_manager_.reset(new TestingURLBlacklistManager(&pref_service_)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void TearDown() override { if (blacklist_manager_) - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); blacklist_manager_.reset(); } TestingPrefServiceSimple pref_service_; std::unique_ptr<TestingURLBlacklistManager> blacklist_manager_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Parameters for the FilterToComponents test. @@ -209,7 +209,7 @@ list->AppendString("example.com"); pref_service_.SetManagedPref(policy_prefs::kUrlBlacklist, std::move(list)); auto manager = std::make_unique<URLBlacklistManager>(&pref_service_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(URLBlacklist::URL_IN_BLACKLIST, manager->GetURLBlacklistState(GURL("http://example.com"))); } @@ -219,7 +219,7 @@ list->AppendString("example.com"); pref_service_.SetManagedPref(policy_prefs::kUrlWhitelist, std::move(list)); auto manager = std::make_unique<URLBlacklistManager>(&pref_service_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(URLBlacklist::URL_IN_WHITELIST, manager->GetURLBlacklistState(GURL("http://example.com"))); } @@ -233,7 +233,7 @@ std::move(blacklist)); pref_service_.SetManagedPref(policy_prefs::kUrlBlacklist, std::move(whitelist)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1, blacklist_manager_->update_called()); }
diff --git a/components/policy/core/common/async_policy_provider_unittest.cc b/components/policy/core/common/async_policy_provider_unittest.cc index cc845b2a..70c9524 100644 --- a/components/policy/core/common/async_policy_provider_unittest.cc +++ b/components/policy/core/common/async_policy_provider_unittest.cc
@@ -84,7 +84,7 @@ void SetUp() override; void TearDown() override; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; SchemaRegistry schema_registry_; PolicyBundle initial_bundle_; MockPolicyLoader* loader_;
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 ed54943..639cdb7 100644 --- a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc +++ b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc
@@ -589,7 +589,7 @@ em::DeviceManagementResponse upload_app_install_report_response_; em::DeviceManagementResponse upload_policy_validation_report_response_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DeviceManagementService::JobConfiguration::JobType job_type_; DeviceManagementService::JobConfiguration::ParameterMap query_params_; em::DeviceManagementRequest job_request_;
diff --git a/components/policy/core/common/cloud/cloud_policy_core_unittest.cc b/components/policy/core/common/cloud/cloud_policy_core_unittest.cc index 5082a02..457f9f6 100644 --- a/components/policy/core/common/cloud/cloud_policy_core_unittest.cc +++ b/components/policy/core/common/cloud/cloud_policy_core_unittest.cc
@@ -64,7 +64,7 @@ bad_callback_count_++; } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestingPrefServiceSimple prefs_; MockCloudPolicyStore store_;
diff --git a/components/policy/core/common/cloud/cloud_policy_manager_unittest.cc b/components/policy/core/common/cloud/cloud_policy_manager_unittest.cc index 369939b1..b273826 100644 --- a/components/policy/core/common/cloud/cloud_policy_manager_unittest.cc +++ b/components/policy/core/common/cloud/cloud_policy_manager_unittest.cc
@@ -185,7 +185,7 @@ EXPECT_CALL(store_, Load()); manager_.reset(new TestCloudPolicyManager( - &store_, scoped_task_environment_.GetMainThreadTaskRunner())); + &store_, task_environment_.GetMainThreadTaskRunner())); manager_->Init(&schema_registry_); Mock::VerifyAndClearExpectations(&store_); manager_->AddObserver(&observer_); @@ -197,7 +197,7 @@ } // Needs to be the first member. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Testing policy. const std::string policy_type_;
diff --git a/components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc b/components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc index f98850e..82b90097 100644 --- a/components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc +++ b/components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc
@@ -168,7 +168,7 @@ last_update_ticks_ = base::TimeTicks::Now(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; MockCloudPolicyClient client_; MockCloudPolicyStore store_; std::unique_ptr<MockCloudPolicyService> service_;
diff --git a/components/policy/core/common/cloud/cloud_policy_validator_unittest.cc b/components/policy/core/common/cloud/cloud_policy_validator_unittest.cc index 0f03aba2..8c02ffa 100644 --- a/components/policy/core/common/cloud/cloud_policy_validator_unittest.cc +++ b/components/policy/core/common/cloud/cloud_policy_validator_unittest.cc
@@ -57,8 +57,7 @@ class CloudPolicyValidatorTest : public testing::Test { public: CloudPolicyValidatorTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), timestamp_(base::Time::FromJavaTime(PolicyBuilder::kFakeTimestamp)), timestamp_option_(CloudPolicyValidatorBase::TIMESTAMP_VALIDATED), dm_token_option_(CloudPolicyValidatorBase::DM_TOKEN_REQUIRED), @@ -154,7 +153,7 @@ EXPECT_EQ(kMessage, result.message); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::Time timestamp_; CloudPolicyValidatorBase::ValidateTimestampOption timestamp_option_; CloudPolicyValidatorBase::ValidateDMTokenOption dm_token_option_;
diff --git a/components/policy/core/common/cloud/component_cloud_policy_service_unittest.cc b/components/policy/core/common/cloud/component_cloud_policy_service_unittest.cc index e576757..f32010f 100644 --- a/components/policy/core/common/cloud/component_cloud_policy_service_unittest.cc +++ b/components/policy/core/common/cloud/component_cloud_policy_service_unittest.cc
@@ -222,7 +222,7 @@ const PolicyNamespace kTestExtensionNS2 = PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kTestExtension2); - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; network::TestURLLoaderFactory loader_factory_; MockComponentCloudPolicyDelegate delegate_;
diff --git a/components/policy/core/common/cloud/component_cloud_policy_updater_unittest.cc b/components/policy/core/common/cloud/component_cloud_policy_updater_unittest.cc index cc079834..cc93b95 100644 --- a/components/policy/core/common/cloud/component_cloud_policy_updater_unittest.cc +++ b/components/policy/core/common/cloud/component_cloud_policy_updater_unittest.cc
@@ -80,7 +80,7 @@ std::unique_ptr<em::PolicyFetchResponse> CreateResponse(); const PolicyNamespace kTestPolicyNS{POLICY_DOMAIN_EXTENSIONS, kTestExtension}; - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; std::unique_ptr<ComponentCloudPolicyStore> store_; MockComponentCloudPolicyStoreDelegate store_delegate_; network::TestURLLoaderFactory loader_factory_; @@ -96,7 +96,7 @@ }; ComponentCloudPolicyUpdaterTest::ComponentCloudPolicyUpdaterTest() - : task_env_(base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) { + : task_env_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) { builder_.SetDefaultSigningKey(); builder_.policy_data().set_policy_type( dm_protocol::kChromeExtensionPolicyType);
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 2a37abac..0b37ae7a 100644 --- a/components/policy/core/common/cloud/device_management_service_unittest.cc +++ b/components/policy/core/common/cloud/device_management_service_unittest.cc
@@ -242,7 +242,7 @@ MOCK_METHOD0(OnJobRetry, void()); - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory url_loader_factory_; scoped_refptr<network::WeakWrapperSharedURLLoaderFactory> shared_url_loader_factory_;
diff --git a/components/policy/core/common/cloud/external_policy_data_fetcher_unittest.cc b/components/policy/core/common/cloud/external_policy_data_fetcher_unittest.cc index 35ef7e18..b93cae3 100644 --- a/components/policy/core/common/cloud/external_policy_data_fetcher_unittest.cc +++ b/components/policy/core/common/cloud/external_policy_data_fetcher_unittest.cc
@@ -52,7 +52,7 @@ std::unique_ptr<std::string> data); int GetAndResetCallbackCount(); - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::TestSimpleTaskRunner> owner_task_runner_; network::TestURLLoaderFactory test_url_loader_factory_; std::unique_ptr<ExternalPolicyDataFetcherBackend> fetcher_backend_;
diff --git a/components/policy/core/common/cloud/external_policy_data_updater_unittest.cc b/components/policy/core/common/cloud/external_policy_data_updater_unittest.cc index 465b6e7..713160a5 100644 --- a/components/policy/core/common/cloud/external_policy_data_updater_unittest.cc +++ b/components/policy/core/common/cloud/external_policy_data_updater_unittest.cc
@@ -73,7 +73,7 @@ void RequestExternalDataFetch(int key_index, int url_index); void RequestExternalDataFetch(int index); - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; MockFetchSuccessCallbackListener callback_listener_; scoped_refptr<base::TestSimpleTaskRunner> backend_task_runner_;
diff --git a/components/policy/core/common/cloud/machine_level_user_cloud_policy_store_unittest.cc b/components/policy/core/common/cloud/machine_level_user_cloud_policy_store_unittest.cc index 239803d..1374777e 100644 --- a/components/policy/core/common/cloud/machine_level_user_cloud_policy_store_unittest.cc +++ b/components/policy/core/common/cloud/machine_level_user_cloud_policy_store_unittest.cc
@@ -26,8 +26,7 @@ class MachineLevelUserCloudPolicyStoreTest : public ::testing::Test { public: MachineLevelUserCloudPolicyStoreTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) { policy_.SetDefaultInitialSigningKey(); policy_.policy_data().set_policy_type( dm_protocol::kChromeMachineLevelUserCloudPolicyType); @@ -74,7 +73,7 @@ PolicyMap expected_policy_map_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(MachineLevelUserCloudPolicyStoreTest); };
diff --git a/components/policy/core/common/cloud/resource_cache_unittest.cc b/components/policy/core/common/cloud/resource_cache_unittest.cc index feddcbb..7f302f6 100644 --- a/components/policy/core/common/cloud/resource_cache_unittest.cc +++ b/components/policy/core/common/cloud/resource_cache_unittest.cc
@@ -51,7 +51,7 @@ void TearDown() override { task_environment_.RunUntilIdle(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; };
diff --git a/components/policy/core/common/cloud/user_cloud_policy_manager_unittest.cc b/components/policy/core/common/cloud/user_cloud_policy_manager_unittest.cc index 656054fe..3559fdc9 100644 --- a/components/policy/core/common/cloud/user_cloud_policy_manager_unittest.cc +++ b/components/policy/core/common/cloud/user_cloud_policy_manager_unittest.cc
@@ -51,7 +51,7 @@ void CreateManager() { store_ = new MockUserCloudPolicyStore(); EXPECT_CALL(*store_, Load()); - const auto task_runner = scoped_task_environment_.GetMainThreadTaskRunner(); + const auto task_runner = task_environment_.GetMainThreadTaskRunner(); manager_.reset(new UserCloudPolicyManager( std::unique_ptr<UserCloudPolicyStore>(store_), base::FilePath(), std::unique_ptr<CloudExternalDataManager>(), task_runner, @@ -62,7 +62,7 @@ } // Needs to be the first member. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Convenience policy objects. PolicyMap policy_map_;
diff --git a/components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc b/components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc index 4476a6c..9f82002 100644 --- a/components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc +++ b/components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc
@@ -55,8 +55,7 @@ class UserCloudPolicyStoreTest : public testing::Test { public: UserCloudPolicyStoreTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir()); @@ -135,7 +134,7 @@ std::unique_ptr<UserCloudPolicyStore> store_; std::unique_ptr<MockCloudExternalDataManager> external_data_manager_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir tmp_dir_;
diff --git a/components/policy/core/common/cloud/user_info_fetcher_unittest.cc b/components/policy/core/common/cloud/user_info_fetcher_unittest.cc index 3e81cb9..54f174be 100644 --- a/components/policy/core/common/cloud/user_info_fetcher_unittest.cc +++ b/components/policy/core/common/cloud/user_info_fetcher_unittest.cc
@@ -47,7 +47,7 @@ ~UserInfoFetcherTest() override = default; protected: - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; network::TestURLLoaderFactory loader_factory_; DISALLOW_COPY_AND_ASSIGN(UserInfoFetcherTest);
diff --git a/components/policy/core/common/config_dir_policy_loader_unittest.cc b/components/policy/core/common/config_dir_policy_loader_unittest.cc index 4a50c9b..51f7f50d 100644 --- a/components/policy/core/common/config_dir_policy_loader_unittest.cc +++ b/components/policy/core/common/config_dir_policy_loader_unittest.cc
@@ -190,9 +190,8 @@ // The preferences dictionary is expected to be empty when there are no files to // load. TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsEmpty) { - ConfigDirPolicyLoader loader( - scoped_task_environment_.GetMainThreadTaskRunner(), harness_.test_dir(), - POLICY_SCOPE_MACHINE); + ConfigDirPolicyLoader loader(task_environment_.GetMainThreadTaskRunner(), + harness_.test_dir(), POLICY_SCOPE_MACHINE); std::unique_ptr<PolicyBundle> bundle(loader.Load()); ASSERT_TRUE(bundle.get()); const PolicyBundle kEmptyBundle; @@ -204,9 +203,8 @@ TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsNonExistentDirectory) { base::FilePath non_existent_dir( harness_.test_dir().Append(FILE_PATH_LITERAL("not_there"))); - ConfigDirPolicyLoader loader( - scoped_task_environment_.GetMainThreadTaskRunner(), non_existent_dir, - POLICY_SCOPE_MACHINE); + ConfigDirPolicyLoader loader(task_environment_.GetMainThreadTaskRunner(), + non_existent_dir, POLICY_SCOPE_MACHINE); std::unique_ptr<PolicyBundle> bundle(loader.Load()); ASSERT_TRUE(bundle.get()); const PolicyBundle kEmptyBundle; @@ -230,9 +228,8 @@ for (unsigned int i = 5; i <= 8; ++i) harness_.WriteConfigFile(test_dict_bar, base::NumberToString(i)); - ConfigDirPolicyLoader loader( - scoped_task_environment_.GetMainThreadTaskRunner(), harness_.test_dir(), - POLICY_SCOPE_USER); + ConfigDirPolicyLoader loader(task_environment_.GetMainThreadTaskRunner(), + harness_.test_dir(), POLICY_SCOPE_USER); std::unique_ptr<PolicyBundle> bundle(loader.Load()); ASSERT_TRUE(bundle.get()); PolicyBundle expected_bundle;
diff --git a/components/policy/core/common/configuration_policy_provider_test.cc b/components/policy/core/common/configuration_policy_provider_test.cc index 9fbbeb5..fc015fcf 100644 --- a/components/policy/core/common/configuration_policy_provider_test.cc +++ b/components/policy/core/common/configuration_policy_provider_test.cc
@@ -136,7 +136,7 @@ } void PolicyTestBase::TearDown() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } bool PolicyTestBase::RegisterSchema(const PolicyNamespace& ns, @@ -209,7 +209,7 @@ provider_->Init(&schema_registry_); // Some providers do a reload on init. Make sure any notifications generated // are fired now. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const PolicyBundle kEmptyBundle; EXPECT_TRUE(provider_->policies().Equals(kEmptyBundle)); @@ -230,7 +230,7 @@ // Install the value, reload policy and check the provider for the value. install_value.Run(); provider_->RefreshPolicies(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); PolicyBundle expected_bundle; expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) .Set(policy_name, test_harness_->policy_level(), @@ -243,7 +243,7 @@ TEST_P(ConfigurationPolicyProviderTest, Empty) { provider_->RefreshPolicies(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const PolicyBundle kEmptyBundle; EXPECT_TRUE(provider_->policies().Equals(kEmptyBundle)); } @@ -334,7 +334,7 @@ provider_->AddObserver(&observer); EXPECT_CALL(observer, OnUpdatePolicy(provider_.get())).Times(1); provider_->RefreshPolicies(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Mock::VerifyAndClearExpectations(&observer); EXPECT_TRUE(provider_->policies().Equals(bundle)); @@ -343,7 +343,7 @@ test_harness_->InstallStringPolicy(test_keys::kKeyString, "value"); EXPECT_CALL(observer, OnUpdatePolicy(provider_.get())).Times(1); provider_->RefreshPolicies(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Mock::VerifyAndClearExpectations(&observer); bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) @@ -364,7 +364,7 @@ EXPECT_CALL(*migrator, Migrate(_)); provider_->AddMigrator(std::unique_ptr<ExtensionPolicyMigrator>(migrator)); provider_->RefreshPolicies(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } Configuration3rdPartyPolicyProviderTest:: @@ -407,7 +407,7 @@ test_harness_->Install3rdPartyPolicy(&policy_3rdparty); provider_->RefreshPolicies(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); PolicyMap expected_policy; expected_policy.Set(test_keys::kKeyDictionary, test_harness_->policy_level(),
diff --git a/components/policy/core/common/configuration_policy_provider_test.h b/components/policy/core/common/configuration_policy_provider_test.h index 0d314b3..9b7c765 100644 --- a/components/policy/core/common/configuration_policy_provider_test.h +++ b/components/policy/core/common/configuration_policy_provider_test.h
@@ -53,7 +53,7 @@ const std::string& schema); // Needs to be the first member - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; SchemaRegistry schema_registry_; private:
diff --git a/components/policy/core/common/policy_loader_mac_unittest.cc b/components/policy/core/common/policy_loader_mac_unittest.cc index b579ac2..846af796 100644 --- a/components/policy/core/common/policy_loader_mac_unittest.cc +++ b/components/policy/core/common/policy_loader_mac_unittest.cc
@@ -148,9 +148,8 @@ void SetUp() override { PolicyTestBase::SetUp(); - std::unique_ptr<AsyncPolicyLoader> loader( - new PolicyLoaderMac(scoped_task_environment_.GetMainThreadTaskRunner(), - base::FilePath(), prefs_)); + std::unique_ptr<AsyncPolicyLoader> loader(new PolicyLoaderMac( + task_environment_.GetMainThreadTaskRunner(), base::FilePath(), prefs_)); provider_.reset( new AsyncPolicyProvider(&schema_registry_, std::move(loader))); provider_->Init(&schema_registry_); @@ -178,7 +177,7 @@ // Make the provider read the updated |prefs_|. provider_->RefreshPolicies(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const PolicyBundle kEmptyBundle; EXPECT_TRUE(provider_->policies().Equals(kEmptyBundle)); } @@ -193,7 +192,7 @@ // Make the provider read the updated |prefs_|. provider_->RefreshPolicies(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); PolicyBundle expected_bundle; expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) .Set(test_keys::kKeyString, POLICY_LEVEL_RECOMMENDED,
diff --git a/components/policy/core/common/policy_loader_win_unittest.cc b/components/policy/core/common/policy_loader_win_unittest.cc index e05e75f8..6fd6a14 100644 --- a/components/policy/core/common/policy_loader_win_unittest.cc +++ b/components/policy/core/common/policy_loader_win_unittest.cc
@@ -426,7 +426,7 @@ } bool Matches(const PolicyBundle& expected) { - PolicyLoaderWin loader(scoped_task_environment_.GetMainThreadTaskRunner(), + PolicyLoaderWin loader(task_environment_.GetMainThreadTaskRunner(), kTestPolicyKey); std::unique_ptr<PolicyBundle> loaded( loader.InitialLoad(schema_registry_.schema_map()));
diff --git a/components/policy/core/common/policy_scheduler_unittest.cc b/components/policy/core/common/policy_scheduler_unittest.cc index 2950f3f1..20160f1 100644 --- a/components/policy/core/common/policy_scheduler_unittest.cc +++ b/components/policy/core/common/policy_scheduler_unittest.cc
@@ -54,7 +54,7 @@ PolicyScheduler::TaskCallback slow_callback_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(PolicySchedulerTest, Run) {
diff --git a/components/policy/core/common/policy_service_impl_unittest.cc b/components/policy/core/common/policy_service_impl_unittest.cc index 5e2fe42..7bf0de0 100644 --- a/components/policy/core/common/policy_service_impl_unittest.cc +++ b/components/policy/core/common/policy_service_impl_unittest.cc
@@ -151,7 +151,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; MockConfigurationPolicyProvider provider0_; MockConfigurationPolicyProvider provider1_; MockConfigurationPolicyProvider provider2_;
diff --git a/components/policy/proto/chrome_device_policy.proto b/components/policy/proto/chrome_device_policy.proto index 69a17d4..3e57f715 100644 --- a/components/policy/proto/chrome_device_policy.proto +++ b/components/policy/proto/chrome_device_policy.proto
@@ -222,8 +222,7 @@ // The types of connections that are OK to use for OS updates. OS updates // potentially put heavy strain on the connection due to their size and may // incur additional cost. Therefore, they are by default not enabled for - // connection types that are considered expensive, which include WiMax, - // Bluetooth and Cellular at the moment. + // connection types that are considered expensive (currently only Cellular). repeated ConnectionType allowed_connection_types = 5; // This has been replaced by |reboot_after_update| below.
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index d8bb4a3..36a6068 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -7961,9 +7961,9 @@ 'id': 146, 'caption': '''Connection types allowed for updates''', 'tags': [], - 'desc': ''' The types of connections that are allowed to use for OS updates. OS updates potentially put heavy strain on the connection due to their size and may incur additional cost. Therefore, they are by default not enabled for connection types that are considered expensive, which include WiMax, Bluetooth and Cellular at the moment. + 'desc': ''' The types of connections that are allowed to use for OS updates. OS updates potentially put heavy strain on the connection due to their size and may incur additional cost. Therefore, they are by default not enabled for connection types that are considered expensive (currently only "cellular"). - The recognized connection type identifiers are "ethernet", "wifi", "wimax", "bluetooth" and "cellular".''', + The recognized connection type identifiers are "ethernet", "wifi", and "cellular".''', }, { 'name': 'DeviceUpdateHttpDownloadsEnabled', @@ -11472,7 +11472,7 @@ { 'name': 'UsbDetachableWhitelist', 'owners': ['vpalatin@chromium.org', 'poromov@chromium.org'], - 'type': 'list', + 'type': 'dict', 'schema': { 'type': 'array', 'items': { @@ -17012,6 +17012,10 @@ 'desc': '''Caption text of the field 'windows registry location' in the summary chart of a policy in the generated documentation''', 'text': '''Windows registry location for Windows clients:''' }, + 'doc_oma_uri': { + 'desc': '''Caption text of the field 'oma-uri' in the summary chart of a policy in the generated documentation''', + 'text': '''<ph name="OMA_URI">OMA-URI</ph>:''' + }, 'doc_chrome_os_reg_loc': { 'desc': '''Caption text of the field '<ph name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> registry location' in the summary chart of a policy in the generated documentation''', 'text': '''Windows registry location for <ph name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> clients:'''
diff --git a/components/policy/tools/template_writers/policy_template_generator.py b/components/policy/tools/template_writers/policy_template_generator.py index 43f38b6a6..d3462f3b 100755 --- a/components/policy/tools/template_writers/policy_template_generator.py +++ b/components/policy/tools/template_writers/policy_template_generator.py
@@ -60,6 +60,7 @@ for key in self._messages.keys(): self._messages[key]['text'] = self._ImportMessage( self._messages[key]['text']) + self._AddGroups(self._policy_data['policy_definitions']) self._AddAtomicGroups(self._policy_data['policy_definitions'], self._policy_data['policy_atomic_group_definitions']) self._policy_data[ @@ -180,6 +181,25 @@ policy_data_copy = copy.deepcopy(self._policy_data) return template_writer.WriteTemplate(policy_data_copy) + + def _AddGroups(self, policy_list): + '''Adds a 'group' field, which is set to be the group's name, to the + policies that are part of a group. + + Args: + policy_list: A list of policies and groups whose policies will have a + 'group' field added. + ''' + groups = [policy for policy in policy_list if policy['type'] == 'group'] + policy_lookup = { + policy['name']: policy + for policy in policy_list + if not IsGroupOrAtomicGroup(policy) + } + for group in groups: + for policy_name in group['policies']: + policy_lookup[policy_name]['group'] = group['name'] + def _AddAtomicGroups(self, policy_list, policy_atomic_groups): '''Adds an 'atomic_group' field to the policies that are part of an atomic group.
diff --git a/components/policy/tools/template_writers/writers/doc_writer.py b/components/policy/tools/template_writers/writers/doc_writer.py index dd9ab50..b852743e 100755 --- a/components/policy/tools/template_writers/writers/doc_writer.py +++ b/components/policy/tools/template_writers/writers/doc_writer.py
@@ -216,6 +216,12 @@ 'reg_mandatory_key_name' return self.config['win_config'][platform][key] + def _GetOmaUriPath(self, policy): + product = 'googlechrome' if self.config['build'] == 'chrome' else 'chromium' + group = '~' + policy['group'] if 'group' in policy else '' + return '.\\Device\\Vendor\\MSFT\\Policy\\Config\\Chrome~Policy~%s%s\\%s' % ( + product, group, policy['name']) + def _AddListExampleAndroidLinux(self, parent, policy): '''Adds an example value for Android/Linux of a 'list' policy to a DOM node. @@ -399,6 +405,46 @@ if self.IsPolicySupportedOnPlatform(policy, 'mac'): self._AddDictionaryExampleMac(examples, policy) + def _AddIntuneExample(self, parent, policy): + example_value = policy['example_value'] + policy_type = policy['type'] + + container = self._AddStyledElement(parent, 'dl', []) + self.AddElement(container, 'dt', {}, 'Windows (Intune):') + + if policy_type == 'main': + self._AddStyledElement( + container, + 'dd', ['.monospace', '.pre-wrap'], + text='<enabled/>' if example_value else '<disabled/>') + return + + self._AddStyledElement( + container, 'dd', ['.monospace', '.pre-wrap'], text='<enabled/>') + if policy_type == 'list': + values = [ + '%s%s' % (index, value) + for index, value in enumerate(example_value, start=1) + ] + self._AddStyledElement( + container, + 'dd', ['.monospace', '.pre-wrap'], + text='<data id="%s" value="%s"/>' % (policy['name'] + 'Desc', + ''.join(values))) + return + elif policy_type == 'int' or policy_type == 'int-enum': + self._AddStyledElement( + container, + 'dd', ['.monospace', '.pre-wrap'], + text='<data id="%s" value="%s"/>' % (policy['name'], example_value)) + else: + self._AddStyledElement( + container, + 'dd', ['.monospace', '.pre-wrap'], + text='<data id="%s" value="%s"/>' % (policy['name'], + json.dumps(example_value)[1:-1])) + return + def _AddExample(self, parent, policy): '''Adds the HTML DOM representation of the example value of a policy to a DOM node. It is simple text for boolean policies, like @@ -457,6 +503,9 @@ else: raise Exception('Unknown policy type: ' + policy_type) + if self.IsPolicySupportedOnWindows(policy): + self._AddIntuneExample(parent, policy) + def _AddPolicyAttribute(self, dl, term_id, @@ -562,9 +611,13 @@ '(%s)' % self.GetLocalizedMessage('complex_policies_on_windows')) self._AddPolicyAttribute(dl, 'data_type', ' '.join(data_type)) if self.IsPolicySupportedOnWindows(policy): - key_name = self._GetRegistryKeyName(policy, True) + registry_key_name = self._GetRegistryKeyName(policy, True) self._AddPolicyAttribute(dl, 'win_reg_loc', - key_name + '\\' + policy['name'], ['.monospace']) + registry_key_name + '\\' + policy['name'], + ['.monospace']) + self._AddPolicyAttribute(dl, 'oma_uri', self._GetOmaUriPath(policy), + ['.monospace']) + if self.IsPolicySupportedOnPlatform( policy, 'chrome_os', management='active_directory'): key_name = self._GetRegistryKeyName(policy, False)
diff --git a/components/policy/tools/template_writers/writers/doc_writer_unittest.py b/components/policy/tools/template_writers/writers/doc_writer_unittest.py index 7d2a211..85e7ee96 100755 --- a/components/policy/tools/template_writers/writers/doc_writer_unittest.py +++ b/components/policy/tools/template_writers/writers/doc_writer_unittest.py
@@ -132,6 +132,9 @@ 'doc_win_reg_loc': { 'text': '_test_win_reg_loc' }, + 'doc_oma_uri': { + 'text': '_test_oma_uri' + }, 'doc_chrome_os_reg_loc': { 'text': '_test_chrome_os_reg_loc' }, @@ -430,7 +433,10 @@ self.assertEquals( e1.toxml(), '<e1>0x00000001 (Windows),' ' true (Linux), true (Android),' - ' <true /> (Mac)</e1>') + ' <true /> (Mac)' + '<dl><dt>Windows (Intune):</dt>' + '<dd style="style_.monospace;style_.pre-wrap;"><enabled/></dd></dl>' + '</e1>') policy = { 'name': 'PolicyName', @@ -445,7 +451,10 @@ self.assertEquals( e2.toxml(), '<e2>0x00000000 (Windows),' ' false (Linux), false (Android),' - ' <false /> (Mac)</e2>') + ' <false /> (Mac)' + '<dl><dt>Windows (Intune):</dt>' + '<dd style="style_.monospace;style_.pre-wrap;"><disabled/></dd></dl>' + '</e2>') def testIntEnumExample(self): # Test representation of 'int-enum' example values. @@ -460,14 +469,21 @@ self.writer._AddExample(self.doc_root, policy) self.assertEquals( self.doc_root.toxml(), - '<root>0x00000010 (Windows), 16 (Linux), 16 (Android), 16 (Mac)</root>') + '<root>0x00000010 (Windows), 16 (Linux), 16 (Android), 16 (Mac)' + '<dl><dt>Windows (Intune):</dt>' + '<dd style="style_.monospace;style_.pre-wrap;"><enabled/></dd>' + '<dd style="style_.monospace;style_.pre-wrap;"><data id="PolicyName" value="16"/></dd></dl>' + '</root>') def testStringEnumExample(self): # Test representation of 'string-enum' example values. policy = { 'name': 'PolicyName', 'type': 'string-enum', - 'example_value': "wacky" + 'example_value': "wacky", + 'supported_on': [{ + 'platforms': [] + }] } self.writer._AddExample(self.doc_root, policy) self.assertEquals(self.doc_root.toxml(), '<root>"wacky"</root>') @@ -519,7 +535,10 @@ policy = { 'name': 'PolicyName', 'type': 'string', - 'example_value': 'awesome-example' + 'example_value': 'awesome-example', + 'supported_on': [{ + 'platforms': [] + }] } self.writer._AddExample(self.doc_root, policy) self.assertEquals(self.doc_root.toxml(), @@ -538,7 +557,11 @@ self.writer._AddExample(self.doc_root, policy) self.assertEquals( self.doc_root.toxml(), - '<root>0x0000001a (Windows), 26 (Linux), 26 (Android), 26 (Mac)</root>') + '<root>0x0000001a (Windows), 26 (Linux), 26 (Android), 26 (Mac)' + '<dl><dt>Windows (Intune):</dt>' + '<dd style="style_.monospace;style_.pre-wrap;"><enabled/></dd>' + '<dd style="style_.monospace;style_.pre-wrap;"><data id="PolicyName" value="26"/></dd></dl>' + '</root>') def testAddPolicyAttribute(self): # Test creating a policy attribute term-definition pair. @@ -600,6 +623,8 @@ '<dd>Boolean [Windows:REG_DWORD]</dd>' '<dt style="style_dt;">_test_win_reg_loc</dt>' '<dd style="style_.monospace;">MockKey\TestPolicyName</dd>' + '<dt style="style_dt;">_test_oma_uri</dt>' + '<dd style="style_.monospace;">.\\Device\\Vendor\\MSFT\\Policy\\Config\\Chrome~Policy~chromium\\TestPolicyName</dd>' '<dt style="style_dt;">_test_chrome_os_reg_loc</dt>' '<dd style="style_.monospace;">MockKeyCrOS\TestPolicyName</dd>' '<dt style="style_dt;">_test_mac_linux_pref_name</dt>' @@ -624,7 +649,10 @@ '<dd><p>TestArcSupportNote</p></dd>' '<dt style="style_dt;">_test_example_value</dt>' '<dd>0x00000000 (Windows), false (Linux),' - ' false (Android), <false /> (Mac)</dd>' + ' false (Android), <false /> (Mac)' + '<dl><dt>Windows (Intune):</dt>' + '<dd style="style_.monospace;style_.pre-wrap;"><disabled/></dd></dl>' + '</dd>' '</dl></root>') def testAddPolicyDetailsNoArcSupport(self): @@ -714,6 +742,8 @@ '<dd>Dictionary [Windows:REG_SZ] (_test_complex_policies_win)</dd>' '<dt style="style_dt;">_test_win_reg_loc</dt>' '<dd style="style_.monospace;">MockKey\TestPolicyName</dd>' + '<dt style="style_dt;">_test_oma_uri</dt>' + '<dd style="style_.monospace;">.\\Device\\Vendor\\MSFT\\Policy\\Config\\Chrome~Policy~chromium\\TestPolicyName</dd>' '<dt style="style_dt;">_test_chrome_os_reg_loc</dt>' '<dd style="style_.monospace;">MockKeyCrOS\TestPolicyName</dd>' '<dt style="style_dt;">_test_mac_linux_pref_name</dt>' @@ -768,6 +798,9 @@ '</dict>' '</dd>' '</dl>' + '<dl><dt>Windows (Intune):</dt>' + '<dd style="style_.monospace;style_.pre-wrap;"><enabled/></dd>' + '<dd style="style_.monospace;style_.pre-wrap;"><data id="TestPolicyName" value=""foo": 123"/></dd></dl>' '</dd>' '</dl></root>') @@ -816,6 +849,8 @@ '<dd>External data reference [Windows:REG_SZ] (_test_complex_policies_win)</dd>' '<dt style="style_dt;">_test_win_reg_loc</dt>' '<dd style="style_.monospace;">MockKey\TestPolicyName</dd>' + '<dt style="style_dt;">_test_oma_uri</dt>' + '<dd style="style_.monospace;">.\\Device\\Vendor\\MSFT\\Policy\\Config\\Chrome~Policy~chromium\\TestPolicyName</dd>' '<dt style="style_dt;">_test_mac_linux_pref_name</dt>' '<dd style="style_.monospace;">TestPolicyName</dd>' '<dt style="style_dt;">_test_supported_on</dt>' @@ -867,6 +902,9 @@ '/dict>' '</dd>' '</dl>' + '<dl><dt>Windows (Intune):</dt>' + '<dd style="style_.monospace;style_.pre-wrap;"><enabled/></dd>' + '<dd style="style_.monospace;style_.pre-wrap;"><data id="TestPolicyName" value=""url": "https://example.com/avatar.jpg", "hash": "deadbeef""/></dd></dl>' '</dd>' '</dl></root>') @@ -913,6 +951,8 @@ '<dd>Boolean [Windows:REG_DWORD]</dd>' '<dt style="style_dt;">_test_win_reg_loc</dt>' '<dd style="style_.monospace;">MockKeyRec\TestPolicyName</dd>' + '<dt style="style_dt;">_test_oma_uri</dt>' + '<dd style="style_.monospace;">.\\Device\\Vendor\\MSFT\\Policy\\Config\\Chrome~Policy~chromium\\TestPolicyName</dd>' '<dt style="style_dt;">_test_chrome_os_reg_loc</dt>' '<dd style="style_.monospace;">MockKeyCrOSRec\TestPolicyName</dd>' '<dt style="style_dt;">_test_mac_linux_pref_name</dt>' @@ -934,7 +974,10 @@ '<dt style="style_dt;">_test_description</dt><dd><p>TestPolicyDesc</p></dd>' '<dt style="style_dt;">_test_example_value</dt>' '<dd>0x00000000 (Windows), false (Linux),' - ' false (Android), <false /> (Mac)</dd>' + ' false (Android), <false /> (Mac)' + '<dl><dt>Windows (Intune):</dt>' + '<dd style="style_.monospace;style_.pre-wrap;"><disabled/></dd></dl>' + '</dd>' '</dl></root>') def testAddPolicyNote(self): @@ -1014,6 +1057,8 @@ '<dd>String [Windows:REG_SZ]</dd>' '<dt style="style_dt;">_test_win_reg_loc</dt>' '<dd style="style_.monospace;">MockKey\\PolicyName</dd>' + '<dt style="style_dt;">_test_oma_uri</dt>' + '<dd style="style_.monospace;">.\\Device\\Vendor\\MSFT\\Policy\\Config\\Chrome~Policy~chromium\\PolicyName</dd>' '<dt style="style_dt;">_test_chrome_os_reg_loc</dt>' '<dd style="style_.monospace;">MockKeyCrOS\\PolicyName</dd>' '<dt style="style_dt;">_test_mac_linux_pref_name</dt>' @@ -1029,7 +1074,11 @@ '<dt style="style_dt;">_test_description</dt>' '<dd><p>PolicyDesc</p></dd>' '<dt style="style_dt;">_test_example_value</dt>' - '<dd>"False"</dd>' + '<dd>"False"' + '<dl><dt>Windows (Intune):</dt>' + '<dd style="style_.monospace;style_.pre-wrap;"><enabled/></dd>' + '<dd style="style_.monospace;style_.pre-wrap;"><data id="PolicyName" value="False"/></dd></dl>' + '</dd>' '</dl>' '<a href="#top">_test_back_to_top</a>' '</div>' @@ -1083,6 +1132,8 @@ '<dd>String [Windows:REG_SZ]</dd>' '<dt style="style_dt;">_test_win_reg_loc</dt>' '<dd style="style_.monospace;">MockKey\\PolicyName</dd>' + '<dt style="style_dt;">_test_oma_uri</dt>' + '<dd style="style_.monospace;">.\\Device\\Vendor\\MSFT\\Policy\\Config\\Chrome~Policy~chromium\\PolicyName</dd>' '<dt style="style_dt;">_test_chrome_os_reg_loc</dt>' '<dd style="style_.monospace;">MockKeyCrOS\\PolicyName</dd>' '<dt style="style_dt;">_test_mac_linux_pref_name</dt>' @@ -1098,7 +1149,11 @@ '<dt style="style_dt;">_test_description</dt>' '<dd><p>PolicyDesc</p></dd>' '<dt style="style_dt;">_test_example_value</dt>' - '<dd>"False"</dd>' + '<dd>"False"' + '<dl><dt>Windows (Intune):</dt>' + '<dd style="style_.monospace;style_.pre-wrap;"><enabled/></dd>' + '<dd style="style_.monospace;style_.pre-wrap;"><data id="PolicyName" value="False"/></dd></dl>' + '</dd>' '<dt style="style_dt;">_test_policy_atomic_group</dt>' '<dd>_test_policy_in_atomic_group <a href="./policy-list-3/atomic_groups#PolicyGroup">PolicyGroup</a></dd>' '</dl>' @@ -1139,6 +1194,8 @@ '<dd>Integer [Windows:REG_DWORD]</dd>' '<dt style="style_dt;">_test_win_reg_loc</dt>' '<dd style="style_.monospace;">MockKey\\PolicyName</dd>' + '<dt style="style_dt;">_test_oma_uri</dt>' + '<dd style="style_.monospace;">.\\Device\\Vendor\\MSFT\\Policy\\Config\\Chrome~Policy~chromium\\PolicyName</dd>' '<dt style="style_dt;">_test_supported_on</dt>' '<dd>' '<ul style="style_ul;">' @@ -1150,7 +1207,11 @@ '<dt style="style_dt;">_test_description</dt>' '<dd><p>PolicyDesc</p></dd>' '<dt style="style_dt;">_test_example_value</dt>' - '<dd>0x0000007b (Windows)</dd>' + '<dd>0x0000007b (Windows)' + '<dl><dt>Windows (Intune):</dt>' + '<dd style="style_.monospace;style_.pre-wrap;"><enabled/></dd>' + '<dd style="style_.monospace;style_.pre-wrap;"><data id="PolicyName" value="123"/></dd></dl>' + '</dd>' '</dl>' '<a href="#top">_test_back_to_top</a>' '</div>' @@ -1189,6 +1250,8 @@ '<dd>Integer [Windows:REG_DWORD]</dd>' '<dt style="style_dt;">_test_win_reg_loc</dt>' '<dd style="style_.monospace;">MockKey\\PolicyName</dd>' + '<dt style="style_dt;">_test_oma_uri</dt>' + '<dd style="style_.monospace;">.\\Device\\Vendor\\MSFT\\Policy\\Config\\Chrome~Policy~chromium\\PolicyName</dd>' '<dt style="style_dt;">_test_supported_on</dt>' '<dd>' '<ul style="style_ul;">' @@ -1200,7 +1263,11 @@ '<dt style="style_dt;">_test_description</dt>' '<dd><p>PolicyDesc</p></dd>' '<dt style="style_dt;">_test_example_value</dt>' - '<dd>0x0000007b (Windows)</dd>' + '<dd>0x0000007b (Windows)' + '<dl><dt>Windows (Intune):</dt>' + '<dd style="style_.monospace;style_.pre-wrap;"><enabled/></dd>' + '<dd style="style_.monospace;style_.pre-wrap;"><data id="PolicyName" value="123"/></dd></dl>' + '</dd>' '</dl>' '<a href="#top">_test_back_to_top</a>' '</div>'
diff --git a/components/policy_strings.grdp b/components/policy_strings.grdp index 8794456..66646b60 100644 --- a/components/policy_strings.grdp +++ b/components/policy_strings.grdp
@@ -160,6 +160,9 @@ <message name="IDS_POLICY_NOT_SPECIFIED_ERROR" desc="The text displayed in the status column when a policy value should have been specified but wasn't."> Must be specified. </message> + <message name="IDS_POLICY_EXTENSION_SETTINGS_ORIGIN_LIMIT_WARNING" desc="The text displayed in the status column of the 'Extension Settings' policy when more than 100 origins are specified."> + This field should not have more than <ph name="MAX_ITEMS_LIMIT">$1<ex>100</ex></ph> entries. All further entries will be discarded. + </message> <message name="IDS_POLICY_SUBKEY_ERROR" desc="The text displayed in the status column for errors in a subkey of a policy."> Key "<ph name="SUBKEY">$1<ex>ProxyMode</ex></ph>": <ph name="ERROR">$2<ex>Must be specified.</ex></ph> </message>
diff --git a/components/prefs/in_memory_pref_store_unittest.cc b/components/prefs/in_memory_pref_store_unittest.cc index b2b6780..f8382bf7 100644 --- a/components/prefs/in_memory_pref_store_unittest.cc +++ b/components/prefs/in_memory_pref_store_unittest.cc
@@ -22,7 +22,7 @@ void SetUp() override { store_ = new InMemoryPrefStore(); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<InMemoryPrefStore> store_; PrefStoreObserverMock observer_; }; @@ -107,7 +107,7 @@ } TEST_F(InMemoryPrefStoreTest, CommitPendingWriteWithCallback) { - TestCommitPendingWriteWithCallback(store_.get(), &scoped_task_environment_); + TestCommitPendingWriteWithCallback(store_.get(), &task_environment_); } } // namespace
diff --git a/components/prefs/json_pref_store_unittest.cc b/components/prefs/json_pref_store_unittest.cc index 8ba14d16..c25ca9c 100644 --- a/components/prefs/json_pref_store_unittest.cc +++ b/components/prefs/json_pref_store_unittest.cc
@@ -134,31 +134,30 @@ WITH_SYNCHRONOUS_CALLBACK, }; -base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode GetExecutionMode( +base::test::TaskEnvironment::ThreadPoolExecutionMode GetExecutionMode( CommitPendingWriteMode commit_mode) { switch (commit_mode) { case CommitPendingWriteMode::WITHOUT_CALLBACK: FALLTHROUGH; case CommitPendingWriteMode::WITH_CALLBACK: - return base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED; + return base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED; case CommitPendingWriteMode::WITH_SYNCHRONOUS_CALLBACK: // Synchronous callbacks require async tasks to run on their own. - return base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::ASYNC; + return base::test::TaskEnvironment::ThreadPoolExecutionMode::ASYNC; } } -void CommitPendingWrite( - JsonPrefStore* pref_store, - CommitPendingWriteMode commit_pending_write_mode, - base::test::ScopedTaskEnvironment* scoped_task_environment) { +void CommitPendingWrite(JsonPrefStore* pref_store, + CommitPendingWriteMode commit_pending_write_mode, + base::test::TaskEnvironment* task_environment) { switch (commit_pending_write_mode) { case CommitPendingWriteMode::WITHOUT_CALLBACK: { pref_store->CommitPendingWrite(); - scoped_task_environment->RunUntilIdle(); + task_environment->RunUntilIdle(); break; } case CommitPendingWriteMode::WITH_CALLBACK: { - TestCommitPendingWriteWithCallback(pref_store, scoped_task_environment); + TestCommitPendingWriteWithCallback(pref_store, task_environment); break; } case CommitPendingWriteMode::WITH_SYNCHRONOUS_CALLBACK: { @@ -176,16 +175,15 @@ : public testing::TestWithParam<CommitPendingWriteMode> { public: JsonPrefStoreTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - GetExecutionMode(GetParam())) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::DEFAULT, + GetExecutionMode(GetParam())) {} protected: void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // The path to temporary directory used to contain the test operations. base::ScopedTempDir temp_dir_; @@ -229,11 +227,10 @@ // This function is used to avoid code duplication while testing synchronous // and asynchronous version of the JsonPrefStore loading. It validates that the // given output file's contents matches kWriteGolden. -void RunBasicJsonPrefStoreTest( - JsonPrefStore* pref_store, - const base::FilePath& output_file, - CommitPendingWriteMode commit_pending_write_mode, - base::test::ScopedTaskEnvironment* scoped_task_environment) { +void RunBasicJsonPrefStoreTest(JsonPrefStore* pref_store, + const base::FilePath& output_file, + CommitPendingWriteMode commit_pending_write_mode, + base::test::TaskEnvironment* task_environment) { const char kNewWindowsInTabs[] = "tabs.new_windows_in_tabs"; const char kMaxTabs[] = "tabs.max_tabs"; const char kLongIntPref[] = "long_int.pref"; @@ -294,8 +291,7 @@ EXPECT_EQ(214748364842LL, value); // Serialize and compare to expected output. - CommitPendingWrite(pref_store, commit_pending_write_mode, - scoped_task_environment); + CommitPendingWrite(pref_store, commit_pending_write_mode, task_environment); std::string output_contents; ASSERT_TRUE(base::ReadFileToString(output_file, &output_contents)); @@ -326,7 +322,7 @@ // } RunBasicJsonPrefStoreTest(pref_store.get(), input_file, GetParam(), - &scoped_task_environment_); + &task_environment_); } TEST_P(JsonPrefStoreTest, BasicAsync) { @@ -347,7 +343,7 @@ EXPECT_CALL(mock_observer, OnInitializationCompleted(true)).Times(1); EXPECT_CALL(*mock_error_delegate, OnError(PersistentPrefStore::PREF_READ_ERROR_NONE)).Times(0); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); pref_store->RemoveObserver(&mock_observer); EXPECT_FALSE(pref_store->ReadOnly()); @@ -365,7 +361,7 @@ // } RunBasicJsonPrefStoreTest(pref_store.get(), input_file, GetParam(), - &scoped_task_environment_); + &task_environment_); } TEST_P(JsonPrefStoreTest, PreserveEmptyValues) { @@ -380,7 +376,7 @@ WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); // Write to file. - CommitPendingWrite(pref_store.get(), GetParam(), &scoped_task_environment_); + CommitPendingWrite(pref_store.get(), GetParam(), &task_environment_); // Reload. pref_store = base::MakeRefCounted<JsonPrefStore>(pref_file); @@ -429,7 +425,7 @@ EXPECT_CALL(mock_observer, OnInitializationCompleted(true)).Times(1); EXPECT_CALL(*mock_error_delegate, OnError(PersistentPrefStore::PREF_READ_ERROR_NO_FILE)).Times(1); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); pref_store->RemoveObserver(&mock_observer); EXPECT_FALSE(pref_store->ReadOnly()); @@ -474,7 +470,7 @@ // } RunBasicJsonPrefStoreTest(pref_store.get(), input_file, GetParam(), - &scoped_task_environment_); + &task_environment_); } TEST_P(JsonPrefStoreTest, ReadAsyncWithInterceptor) { @@ -501,7 +497,7 @@ EXPECT_CALL(mock_observer, OnInitializationCompleted(true)).Times(0); // EXPECT_CALL(*mock_error_delegate, // OnError(PersistentPrefStore::PREF_READ_ERROR_NONE)).Times(0); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(pref_store->ReadOnly()); EXPECT_TRUE(raw_intercepting_pref_filter_->has_intercepted_prefs()); @@ -535,7 +531,7 @@ // } RunBasicJsonPrefStoreTest(pref_store.get(), input_file, GetParam(), - &scoped_task_environment_); + &task_environment_); } INSTANTIATE_TEST_SUITE_P( @@ -573,7 +569,7 @@ // Get the contents of kTestFile. Pumps the message loop before returning the // result. std::string GetTestFileContents() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::string file_contents; ReadFileToString(test_file_, &file_contents); return file_contents; @@ -836,9 +832,9 @@ WriteCallbacksObserver write_callback_observer_; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED}; base::ScopedTempDir temp_dir_; @@ -870,7 +866,7 @@ EXPECT_EQ(NOT_CALLED, write_callback_observer_.GetAndResetPostWriteObservationState()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(write_callback_observer_.GetAndResetPreWriteObservationState()); EXPECT_EQ(CALLED_WITH_SUCCESS, @@ -886,7 +882,7 @@ successful_write_reply_observer_.ObserveNextWriteCallback(pref_store.get()); write_callback_observer_.ObserveNextWriteCallback(pref_store.get()); file_writer->WriteNow(std::make_unique<std::string>("foo")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(successful_write_reply_observer_.GetAndResetObservationState()); EXPECT_TRUE(write_callback_observer_.GetAndResetPreWriteObservationState()); EXPECT_EQ(CALLED_WITH_SUCCESS, @@ -897,7 +893,7 @@ successful_write_reply_observer_.ObserveNextWriteCallback(pref_store.get()); write_callback_observer_.ObserveNextWriteCallback(pref_store.get()); file_writer->WriteNow(std::make_unique<std::string>("foo")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(successful_write_reply_observer_.GetAndResetObservationState()); EXPECT_TRUE(write_callback_observer_.GetAndResetPreWriteObservationState()); EXPECT_EQ(CALLED_WITH_SUCCESS, @@ -906,7 +902,7 @@ // Test RegisterOnNextSuccessfulWriteReply only. successful_write_reply_observer_.ObserveNextWriteCallback(pref_store.get()); file_writer->WriteNow(std::make_unique<std::string>("foo")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(successful_write_reply_observer_.GetAndResetObservationState()); EXPECT_FALSE(write_callback_observer_.GetAndResetPreWriteObservationState()); EXPECT_EQ(NOT_CALLED, @@ -915,7 +911,7 @@ // Test RegisterOnNextWriteSynchronousCallbacks only. write_callback_observer_.ObserveNextWriteCallback(pref_store.get()); file_writer->WriteNow(std::make_unique<std::string>("foo")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState()); EXPECT_TRUE(write_callback_observer_.GetAndResetPreWriteObservationState()); EXPECT_EQ(CALLED_WITH_SUCCESS, @@ -928,7 +924,7 @@ // Confirm that the observers are invoked. successful_write_reply_observer_.ObserveNextWriteCallback(pref_store.get()); TriggerFakeWriteForCallback(pref_store.get(), true); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(successful_write_reply_observer_.GetAndResetObservationState()); EXPECT_EQ(CALLED_WITH_SUCCESS, write_callback_observer_.GetAndResetPostWriteObservationState()); @@ -941,7 +937,7 @@ // Confirm that re-installing the observers works for another write. successful_write_reply_observer_.ObserveNextWriteCallback(pref_store.get()); TriggerFakeWriteForCallback(pref_store.get(), true); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(successful_write_reply_observer_.GetAndResetObservationState()); EXPECT_EQ(CALLED_WITH_SUCCESS, write_callback_observer_.GetAndResetPostWriteObservationState()); @@ -950,7 +946,7 @@ // write, and that the synchronous observer is invoked. successful_write_reply_observer_.ObserveNextWriteCallback(pref_store.get()); TriggerFakeWriteForCallback(pref_store.get(), false); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState()); EXPECT_EQ(CALLED_WITH_ERROR, write_callback_observer_.GetAndResetPostWriteObservationState()); @@ -959,7 +955,7 @@ // being set by |PostWriteCallback| by the last TriggerFakeWriteCallback. ImportantFileWriter* file_writer = GetImportantFileWriter(pref_store.get()); file_writer->WriteNow(std::make_unique<std::string>("foo")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(successful_write_reply_observer_.GetAndResetObservationState()); EXPECT_EQ(NOT_CALLED, write_callback_observer_.GetAndResetPostWriteObservationState()); @@ -979,7 +975,7 @@ soon_out_of_scope_pref_store.get()); file_writer->WriteNow(std::make_unique<std::string>("foo")); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState()); EXPECT_TRUE(write_callback_observer_.GetAndResetPreWriteObservationState()); EXPECT_EQ(CALLED_WITH_SUCCESS,
diff --git a/components/prefs/overlay_user_pref_store_unittest.cc b/components/prefs/overlay_user_pref_store_unittest.cc index 5f0d725..2d38f71c 100644 --- a/components/prefs/overlay_user_pref_store_unittest.cc +++ b/components/prefs/overlay_user_pref_store_unittest.cc
@@ -40,7 +40,7 @@ ~OverlayUserPrefStoreTest() override {} - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<TestingPrefStore> underlay_; scoped_refptr<OverlayUserPrefStore> overlay_; }; @@ -275,7 +275,7 @@ } TEST_F(OverlayUserPrefStoreTest, CommitPendingWriteWithCallback) { - TestCommitPendingWriteWithCallback(overlay_.get(), &scoped_task_environment_); + TestCommitPendingWriteWithCallback(overlay_.get(), &task_environment_); } } // namespace base
diff --git a/components/prefs/persistent_pref_store_unittest.cc b/components/prefs/persistent_pref_store_unittest.cc index d297858..fe9a418 100644 --- a/components/prefs/persistent_pref_store_unittest.cc +++ b/components/prefs/persistent_pref_store_unittest.cc
@@ -12,7 +12,7 @@ void TestCommitPendingWriteWithCallback( PersistentPrefStore* store, - base::test::ScopedTaskEnvironment* scoped_task_environment) { + base::test::TaskEnvironment* task_environment) { base::RunLoop run_loop; base::SequenceCheckerImpl sequence_checker; store->CommitPendingWrite(base::BindOnce( @@ -21,6 +21,6 @@ run_loop->Quit(); }, base::Unretained(&sequence_checker), base::Unretained(&run_loop))); - scoped_task_environment->RunUntilIdle(); + task_environment->RunUntilIdle(); run_loop.Run(); }
diff --git a/components/prefs/persistent_pref_store_unittest.h b/components/prefs/persistent_pref_store_unittest.h index ea658e1c..121f942b 100644 --- a/components/prefs/persistent_pref_store_unittest.h +++ b/components/prefs/persistent_pref_store_unittest.h
@@ -7,18 +7,18 @@ namespace base { namespace test { -class ScopedTaskEnvironment; +class TaskEnvironment; } } // namespace base class PersistentPrefStore; // Calls CommitPendingWrite() on |store| with a callback. Verifies that the -// callback runs on the appropriate sequence. |scoped_task_environment| is the -// test's ScopedTaskEnvironment. This function is meant to be reused in the +// callback runs on the appropriate sequence. |task_environment| is the +// test's TaskEnvironment. This function is meant to be reused in the // tests of various PersistentPrefStore implementations. void TestCommitPendingWriteWithCallback( PersistentPrefStore* store, - base::test::ScopedTaskEnvironment* scoped_task_environment); + base::test::TaskEnvironment* task_environment); #endif // COMPONENTS_PREFS_PERSISTENT_PREF_STORE_UNITTEST_H_
diff --git a/components/prefs/pref_member_unittest.cc b/components/prefs/pref_member_unittest.cc index 420d24b..28e2a4a 100644 --- a/components/prefs/pref_member_unittest.cc +++ b/components/prefs/pref_member_unittest.cc
@@ -100,7 +100,7 @@ } // anonymous namespace class PrefMemberTest : public testing::Test { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(PrefMemberTest, BasicGetAndSet) {
diff --git a/components/previews/content/previews_decider_impl_unittest.cc b/components/previews/content/previews_decider_impl_unittest.cc index bdbe9ca..4e08ed7 100644 --- a/components/previews/content/previews_decider_impl_unittest.cc +++ b/components/previews/content/previews_decider_impl_unittest.cc
@@ -396,7 +396,7 @@ : field_trial_list_(nullptr), previews_decider_impl_(nullptr), optimization_guide_service_( - scoped_task_environment_.GetMainThreadTaskRunner()) { + task_environment_.GetMainThreadTaskRunner()) { clock_.SetNow(base::Time::Now()); network_quality_tracker_.ReportEffectiveConnectionTypeForTesting( @@ -438,7 +438,7 @@ std::move(previews_decider_impl), std::make_unique<TestOptOutStore>(), std::make_unique<TestPreviewsOptimizationGuide>( &optimization_guide_service_, - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT}), @@ -451,7 +451,7 @@ void InitializeUIService() { InitializeUIServiceWithoutWaitingForBlackList(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::RunLoop().RunUntilIdle(); } @@ -480,7 +480,7 @@ base::SimpleTestClock clock_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::FieldTrialList field_trial_list_; TestPreviewsDeciderImpl* previews_decider_impl_; optimization_guide::OptimizationGuideService optimization_guide_service_;
diff --git a/components/previews/content/previews_hints_unittest.cc b/components/previews/content/previews_hints_unittest.cc index a41c91cd..3b239b8 100644 --- a/components/previews/content/previews_hints_unittest.cc +++ b/components/previews/content/previews_hints_unittest.cc
@@ -89,7 +89,7 @@ hint_cache_ = std::make_unique<optimization_guide::HintCache>( std::make_unique<optimization_guide::HintCacheStore>( db_provider_.get(), temp_dir_.GetPath(), nullptr /* pref_service */, - scoped_task_environment_.GetMainThreadTaskRunner())); + task_environment_.GetMainThreadTaskRunner())); is_store_initialized_ = false; hint_cache_->Initialize( @@ -147,7 +147,7 @@ void MaybeLoadHintAndLogHintCacheMatch(const GURL& url, bool is_committed); void RunUntilIdle() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::RunLoop().RunUntilIdle(); } @@ -169,7 +169,7 @@ void MaybeLoadHint(const GURL& url); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; bool is_store_initialized_; bool are_previews_hints_initialized_;
diff --git a/components/previews/content/previews_optimization_guide_unittest.cc b/components/previews/content/previews_optimization_guide_unittest.cc index 3c2b106..8c74784 100644 --- a/components/previews/content/previews_optimization_guide_unittest.cc +++ b/components/previews/content/previews_optimization_guide_unittest.cc
@@ -201,9 +201,8 @@ : public optimization_guide::ProtoDatabaseProviderTestBase { public: PreviewsOptimizationGuideTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~PreviewsOptimizationGuideTest() override {} @@ -281,7 +280,7 @@ } optimization_guide_service_ = std::make_unique<TestOptimizationGuideService>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); pref_service_ = std::make_unique<TestingPrefServiceSimple>(); // Registry pref for DataSaver with default off. @@ -291,12 +290,12 @@ guide_ = std::make_unique<TestPreviewsOptimizationGuide>( optimization_guide_service_.get(), - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner(), temp_dir(), + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), temp_dir(), pref_service_.get(), db_provider_.get(), optimization_guide_top_host_provider_.get(), url_loader_factory_); - guide_->SetTimeClockForTesting(scoped_task_environment_.GetMockClock()); + guide_->SetTimeClockForTesting(task_environment_.GetMockClock()); base::test::ScopedFeatureList scoped_list; scoped_list.InitAndEnableFeature( @@ -310,7 +309,7 @@ } const base::Clock* GetMockClock() const { - return scoped_task_environment_.GetMockClock(); + return task_environment_.GetMockClock(); } void ResetGuide() { @@ -329,15 +328,15 @@ base::FilePath temp_dir() const { return temp_dir_.GetPath(); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; void MoveClockForwardBy(base::TimeDelta time_delta) { - scoped_task_environment_.FastForwardBy(time_delta); + task_environment_.FastForwardBy(time_delta); base::RunLoop().RunUntilIdle(); } void RunUntilIdle() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::RunLoop().RunUntilIdle(); }
diff --git a/components/previews/content/previews_ui_service_unittest.cc b/components/previews/content/previews_ui_service_unittest.cc index eede77b..875c9d5d 100644 --- a/components/previews/content/previews_ui_service_unittest.cc +++ b/components/previews/content/previews_ui_service_unittest.cc
@@ -214,7 +214,7 @@ protected: // Run this test on a single thread. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestPreviewsLogger* logger_ptr_; network::TestNetworkQualityTracker test_network_quality_tracker_;
diff --git a/components/previews/core/previews_black_list_unittest.cc b/components/previews/core/previews_black_list_unittest.cc index 5db93c2a..d5cd2490 100644 --- a/components/previews/core/previews_black_list_unittest.cc +++ b/components/previews/core/previews_black_list_unittest.cc
@@ -152,7 +152,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; // Observer to |black_list_|. TestOptOutBlacklistDelegate blacklist_delegate_;
diff --git a/components/printing/browser/print_manager.cc b/components/printing/browser/print_manager.cc index 3134a10..8579ed8 100644 --- a/components/printing/browser/print_manager.cc +++ b/components/printing/browser/print_manager.cc
@@ -24,8 +24,42 @@ IPC::Message* reply_msg) { manager->OnScriptedPrint(render_frame_host, scripted_params, reply_msg); } + + void OnDidPrintDocument(const PrintHostMsg_DidPrintDocument_Params& params, + IPC::Message* reply_msg) { + // If DidPrintDocument message was received then need to transition from + // a variable allocated on stack (which has efficient memory management + // when dealing with any other incoming message) to a persistent variable + // on the heap that can be referenced by the asynchronous processing which + // occurs beyond the scope of PrintViewManagerBase::OnMessageReceived(). + manager->OnDidPrintDocument(render_frame_host, params, + std::make_unique<DelayedFrameDispatchHelper>( + render_frame_host, reply_msg)); + } }; +PrintManager::DelayedFrameDispatchHelper::DelayedFrameDispatchHelper( + content::RenderFrameHost* render_frame_host, + IPC::Message* reply_msg) + : render_frame_host_(render_frame_host), reply_msg_(reply_msg) {} + +PrintManager::DelayedFrameDispatchHelper::~DelayedFrameDispatchHelper() { + if (reply_msg_) { + PrintHostMsg_DidPrintDocument::WriteReplyParams(reply_msg_, false); + render_frame_host_->Send(reply_msg_); + } +} + +void PrintManager::DelayedFrameDispatchHelper::SendCompleted() { + DCHECK(reply_msg_); + + PrintHostMsg_DidPrintDocument::WriteReplyParams(reply_msg_, true); + render_frame_host_->Send(reply_msg_); + + // This wraps up the one allowed reply for the message. + reply_msg_ = nullptr; +} + PrintManager::PrintManager(content::WebContents* contents) : content::WebContentsObserver(contents) {} @@ -34,16 +68,8 @@ bool PrintManager::OnMessageReceived( const IPC::Message& message, content::RenderFrameHost* render_frame_host) { - bool handled = true; - IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(PrintManager, message, render_frame_host) - IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintDocument, OnDidPrintDocument) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - if (handled) - return true; - - handled = true; FrameDispatchHelper helper = {this, render_frame_host}; + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PrintManager, message) IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount, OnDidGetPrintedPagesCount) @@ -54,6 +80,8 @@ FrameDispatchHelper::OnGetDefaultPrintSettings) IPC_MESSAGE_FORWARD_DELAY_REPLY(PrintHostMsg_ScriptedPrint, &helper, FrameDispatchHelper::OnScriptedPrint) + IPC_MESSAGE_FORWARD_DELAY_REPLY(PrintHostMsg_DidPrintDocument, &helper, + FrameDispatchHelper::OnDidPrintDocument); IPC_MESSAGE_HANDLER(PrintHostMsg_PrintingFailed, OnPrintingFailed) IPC_MESSAGE_UNHANDLED(handled = false)
diff --git a/components/printing/browser/print_manager.h b/components/printing/browser/print_manager.h index c414e0d..bf3b0516 100644 --- a/components/printing/browser/print_manager.h +++ b/components/printing/browser/print_manager.h
@@ -5,6 +5,8 @@ #ifndef COMPONENTS_PRINTING_BROWSER_PRINT_MANAGER_H_ #define COMPONENTS_PRINTING_BROWSER_PRINT_MANAGER_H_ +#include <memory> + #include "base/macros.h" #include "build/build_config.h" #include "content/public/browser/web_contents_observer.h" @@ -13,6 +15,10 @@ #include "base/callback.h" #endif +namespace IPC { +class Message; +} + struct PrintHostMsg_DidPrintDocument_Params; struct PrintHostMsg_ScriptedPrint_Params; @@ -42,11 +48,34 @@ // IPC handling support struct FrameDispatchHelper; + // IPC message PrintHostMsg_DidPrintDocument can require handling in other + // processes beyond the rendering process running OnMessageReceived(), + // requiring that the renderer needs to wait. + class DelayedFrameDispatchHelper { + public: + DelayedFrameDispatchHelper(content::RenderFrameHost* render_frame_host, + IPC::Message* reply_msg); + DelayedFrameDispatchHelper(const DelayedFrameDispatchHelper&) = delete; + ~DelayedFrameDispatchHelper(); + DelayedFrameDispatchHelper& operator=(const DelayedFrameDispatchHelper&) = + delete; + + // SendCompleted() can be called at most once, since it provides the success + // reply for a message. A failure reply for the message is automatically + // sent if this is never called. + void SendCompleted(); + + private: + content::RenderFrameHost* const render_frame_host_; + IPC::Message* reply_msg_; + }; + // IPC handlers virtual void OnDidGetPrintedPagesCount(int cookie, int number_pages); virtual void OnDidPrintDocument( content::RenderFrameHost* render_frame_host, - const PrintHostMsg_DidPrintDocument_Params& params) = 0; + const PrintHostMsg_DidPrintDocument_Params& params, + std::unique_ptr<DelayedFrameDispatchHelper> helper) = 0; virtual void OnGetDefaultPrintSettings( content::RenderFrameHost* render_frame_host, IPC::Message* reply_msg) = 0;
diff --git a/components/printing/common/print_messages.h b/components/printing/common/print_messages.h index 1802034..a134a00 100644 --- a/components/printing/common/print_messages.h +++ b/components/printing/common/print_messages.h
@@ -412,9 +412,12 @@ // Sends back to the browser the rendered document that was requested by a // PrintMsg_PrintPages message or from scripted printing. The memory handle in -// this message is already valid in the browser process. -IPC_MESSAGE_ROUTED1(PrintHostMsg_DidPrintDocument, - PrintHostMsg_DidPrintDocument_Params /* page content */) +// this message is already valid in the browser process. Waits until the +// document is complete ready before replying. +IPC_SYNC_MESSAGE_ROUTED1_1(PrintHostMsg_DidPrintDocument, + PrintHostMsg_DidPrintDocument_Params + /* page content */, + bool /* completed */) // Sends back to the browser the rendered subframe content that was // requested by a PrintMsg_PrintFrameContent message.
diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc index 1a65567..a7780f1 100644 --- a/components/printing/renderer/print_render_frame_helper.cc +++ b/components/printing/renderer/print_render_frame_helper.cc
@@ -1825,8 +1825,10 @@ #if defined(OS_WIN) page_params.physical_offsets = printer_printable_area_.origin(); #endif - Send(new PrintHostMsg_DidPrintDocument(routing_id(), page_params)); - return true; + bool completed = false; + Send( + new PrintHostMsg_DidPrintDocument(routing_id(), page_params, &completed)); + return completed; } void PrintRenderFrameHelper::FinishFramePrinting() {
diff --git a/components/printing/test/print_mock_render_thread.cc b/components/printing/test/print_mock_render_thread.cc index b7c6b5c..dba264f 100644 --- a/components/printing/test/print_mock_render_thread.cc +++ b/components/printing/test/print_mock_render_thread.cc
@@ -59,7 +59,8 @@ IPC_MESSAGE_HANDLER(PrintHostMsg_UpdatePrintSettings, OnUpdatePrintSettings) IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount, OnDidGetPrintedPagesCount) - IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintDocument, OnDidPrintDocument) + IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_DidPrintDocument, + OnDidPrintDocument) #if BUILDFLAG(ENABLE_PRINT_PREVIEW) IPC_MESSAGE_HANDLER(PrintHostMsg_DidStartPreview, OnDidStartPreview) IPC_MESSAGE_HANDLER(PrintHostMsg_DidPreviewPage, OnDidPreviewPage) @@ -93,8 +94,11 @@ } void PrintMockRenderThread::OnDidPrintDocument( - const PrintHostMsg_DidPrintDocument_Params& params) { + const PrintHostMsg_DidPrintDocument_Params& params, + IPC::Message* reply_msg) { printer_->PrintPage(params); + PrintHostMsg_DidPrintDocument::WriteReplyParams(reply_msg, true); + Send(reply_msg); } #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
diff --git a/components/printing/test/print_mock_render_thread.h b/components/printing/test/print_mock_render_thread.h index c6dd0b9..695da05 100644 --- a/components/printing/test/print_mock_render_thread.h +++ b/components/printing/test/print_mock_render_thread.h
@@ -76,7 +76,8 @@ PrintMsg_PrintPages_Params* settings); void OnDidGetPrintedPagesCount(int cookie, int number_pages); - void OnDidPrintDocument(const PrintHostMsg_DidPrintDocument_Params& params); + void OnDidPrintDocument(const PrintHostMsg_DidPrintDocument_Params& params, + IPC::Message* reply_msg); #if BUILDFLAG(ENABLE_PRINT_PREVIEW) void OnDidStartPreview(const PrintHostMsg_DidStartPreview_Params& params, const PrintHostMsg_PreviewIds& ids);
diff --git a/components/proxy_config/pref_proxy_config_tracker_impl_unittest.cc b/components/proxy_config/pref_proxy_config_tracker_impl_unittest.cc index 735464d8..b0ba9da 100644 --- a/components/proxy_config/pref_proxy_config_tracker_impl_unittest.cc +++ b/components/proxy_config/pref_proxy_config_tracker_impl_unittest.cc
@@ -104,7 +104,7 @@ proxy_config_service_.reset(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestingPrefServiceSimple> pref_service_; TestProxyConfigService* delegate_service_; // weak std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
diff --git a/components/rappor/log_uploader_unittest.cc b/components/rappor/log_uploader_unittest.cc index f8a53754..1fdc1db 100644 --- a/components/rappor/log_uploader_unittest.cc +++ b/components/rappor/log_uploader_unittest.cc
@@ -65,12 +65,11 @@ class LogUploaderTest : public testing::Test { public: LogUploaderTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} protected: // Required for base::ThreadTaskRunnerHandle::Get(). - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; private:
diff --git a/components/reading_list/core/reading_list_store_unittest.cc b/components/reading_list/core/reading_list_store_unittest.cc index 9dfcbc5..b26acd3 100644 --- a/components/reading_list/core/reading_list_store_unittest.cc +++ b/components/reading_list/core/reading_list_store_unittest.cc
@@ -143,7 +143,7 @@ } // In memory model type store needs to be able to post tasks. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; testing::NiceMock<syncer::MockModelTypeChangeProcessor> processor_; std::unique_ptr<syncer::ModelTypeStore> store_;
diff --git a/components/rlz/rlz_tracker_unittest.cc b/components/rlz/rlz_tracker_unittest.cc index f8c99f6..fd4865c 100644 --- a/components/rlz/rlz_tracker_unittest.cc +++ b/components/rlz/rlz_tracker_unittest.cc
@@ -260,7 +260,7 @@ void ExpectRlzPingSent(bool expected); void ExpectReactivationRlzPingSent(bool expected); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestRLZTrackerDelegate* delegate_; std::unique_ptr<TestRLZTracker> tracker_; RlzLibTestNoMachineStateHelper m_rlz_test_helper_;
diff --git a/components/safe_browsing/db/allowlist_checker_client_unittest.cc b/components/safe_browsing/db/allowlist_checker_client_unittest.cc index 37e27371..2729824d9 100644 --- a/components/safe_browsing/db/allowlist_checker_client_unittest.cc +++ b/components/safe_browsing/db/allowlist_checker_client_unittest.cc
@@ -50,8 +50,7 @@ class AllowlistCheckerClientTest : public testing::Test { public: AllowlistCheckerClientTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), target_url_("https://example.test") {} void SetUp() override {
diff --git a/components/safe_browsing/password_protection/password_protection_request.cc b/components/safe_browsing/password_protection/password_protection_request.cc index 2490a4a..50f01d40 100644 --- a/components/safe_browsing/password_protection/password_protection_request.cc +++ b/components/safe_browsing/password_protection/password_protection_request.cc
@@ -145,10 +145,15 @@ void PasswordProtectionRequest::OnWhitelistCheckDone(bool match_whitelist) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (match_whitelist) + if (match_whitelist) { Finish(RequestOutcome::MATCHED_WHITELIST, nullptr); - else + } else { + // In case the request to Safe Browsing takes too long, + // we set a timer to cancel that request and return an "unspecified verdict" + // so that the navigation isn't blocked indefinitely. + StartTimeout(); CheckCachedVerdicts(); + } } void PasswordProtectionRequest::CheckCachedVerdicts() { @@ -361,8 +366,6 @@ return; } - // In case the request take too long, we set a timer to cancel this request. - StartTimeout(); net::NetworkTrafficAnnotationTag traffic_annotation = net::DefineNetworkTrafficAnnotation("password_protection_request", R"( semantics { @@ -485,7 +488,6 @@ response->verdict_type()); } } - password_protection_service_->RequestFinished(this, outcome, std::move(response)); } @@ -495,8 +497,9 @@ url_loader_.reset(); // If request is canceled because |password_protection_service_| is shutting // down, ignore all these deferred navigations. - if (!timed_out) + if (!timed_out) { throttles_.clear(); + } Finish(timed_out ? RequestOutcome::TIMEDOUT : RequestOutcome::CANCELED, nullptr);
diff --git a/components/safe_browsing/password_protection/password_protection_request.h b/components/safe_browsing/password_protection/password_protection_request.h index 7f288c3..b211c65 100644 --- a/components/safe_browsing/password_protection/password_protection_request.h +++ b/components/safe_browsing/password_protection/password_protection_request.h
@@ -129,6 +129,7 @@ friend struct content::BrowserThread::DeleteOnThread< content::BrowserThread::UI>; friend class base::DeleteHelper<PasswordProtectionRequest>; + friend class PasswordProtectionServiceTest; friend class ChromePasswordProtectionServiceTest; virtual ~PasswordProtectionRequest();
diff --git a/components/safe_browsing/password_protection/password_protection_service_unittest.cc b/components/safe_browsing/password_protection/password_protection_service_unittest.cc index 7e602b2..f6275dd 100644 --- a/components/safe_browsing/password_protection/password_protection_service_unittest.cc +++ b/components/safe_browsing/password_protection/password_protection_service_unittest.cc
@@ -21,6 +21,7 @@ #include "components/safe_browsing/features.h" #include "components/safe_browsing/password_protection/metrics_util.h" #include "components/safe_browsing/password_protection/mock_password_protection_service.h" +#include "components/safe_browsing/password_protection/password_protection_navigation_throttle.h" #include "components/safe_browsing/password_protection/password_protection_request.h" #include "components/safe_browsing/proto/csd.pb.h" #include "components/safe_browsing/verdict_cache_manager.h" @@ -190,6 +191,21 @@ DISALLOW_COPY_AND_ASSIGN(TestPasswordProtectionService); }; +class MockPasswordProtectionNavigationThrottle + : public PasswordProtectionNavigationThrottle { + public: + MockPasswordProtectionNavigationThrottle( + content::NavigationHandle* navigation_handle, + scoped_refptr<PasswordProtectionRequest> request, + bool is_warning_showing) + : PasswordProtectionNavigationThrottle(navigation_handle, + request, + is_warning_showing) {} + + private: + DISALLOW_COPY_AND_ASSIGN(MockPasswordProtectionNavigationThrottle); +}; + class PasswordProtectionServiceTest : public ::testing::TestWithParam<bool> { public: PasswordProtectionServiceTest() {} @@ -333,6 +349,10 @@ EXPECT_EQ(should_report_content_size, request.has_content_area_width()); } + size_t GetNumberOfNavigationThrottles() { + return request_ ? request_->throttles_.size() : 0u; + } + protected: // |thread_bundle_| is needed here because this test involves both UI and IO // threads. @@ -1263,6 +1283,28 @@ ->has_dom_features()); } +TEST_P(PasswordProtectionServiceTest, TestRequestCancelOnTimeout) { + content::WebContents* web_contents = GetWebContents(); + InitializeAndStartPasswordOnFocusRequest( + true /* match whitelist */, 10000 /* timeout in ms */, web_contents); + auto throttle = std::make_unique<MockPasswordProtectionNavigationThrottle>( + nullptr, request_, false); + EXPECT_EQ(1U, GetNumberOfNavigationThrottles()); + request_->Cancel(true /* timeout */); + EXPECT_EQ(1U, GetNumberOfNavigationThrottles()); +} + +TEST_P(PasswordProtectionServiceTest, TestRequestCancelNotOnTimeout) { + content::WebContents* web_contents = GetWebContents(); + InitializeAndStartPasswordOnFocusRequest( + true /* match whitelist */, 10000 /* timeout in ms */, web_contents); + auto throttle = std::make_unique<MockPasswordProtectionNavigationThrottle>( + nullptr, request_, false); + EXPECT_EQ(1U, GetNumberOfNavigationThrottles()); + request_->Cancel(false /* timeout */); + EXPECT_EQ(0U, GetNumberOfNavigationThrottles()); +} + INSTANTIATE_TEST_SUITE_P(Regular, PasswordProtectionServiceTest, ::testing::Values(false));
diff --git a/components/safe_browsing/renderer/websocket_sb_handshake_throttle_unittest.cc b/components/safe_browsing/renderer/websocket_sb_handshake_throttle_unittest.cc index 00d5952..56ee3b4 100644 --- a/components/safe_browsing/renderer/websocket_sb_handshake_throttle_unittest.cc +++ b/components/safe_browsing/renderer/websocket_sb_handshake_throttle_unittest.cc
@@ -109,7 +109,7 @@ safe_browsing_ptr_.get(), MSG_ROUTING_NONE); } - base::test::ScopedTaskEnvironment message_loop_; + base::test::TaskEnvironment message_loop_; FakeSafeBrowsing safe_browsing_; mojo::Binding<mojom::SafeBrowsing> mojo_binding_; mojom::SafeBrowsingPtr safe_browsing_ptr_;
diff --git a/components/safe_search_api/safe_search/safe_search_url_checker_client_unittest.cc b/components/safe_search_api/safe_search/safe_search_url_checker_client_unittest.cc index d42e3f06..f7344a6 100644 --- a/components/safe_search_api/safe_search/safe_search_url_checker_client_unittest.cc +++ b/components/safe_search_api/safe_search/safe_search_url_checker_client_unittest.cc
@@ -109,7 +109,7 @@ } size_t next_url_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; std::unique_ptr<SafeSearchURLCheckerClient> checker_;
diff --git a/components/search_provider_logos/logo_service_impl_unittest.cc b/components/search_provider_logos/logo_service_impl_unittest.cc index 9e797f3..5072e2e 100644 --- a/components/search_provider_logos/logo_service_impl_unittest.cc +++ b/components/search_provider_logos/logo_service_impl_unittest.cc
@@ -418,7 +418,7 @@ bool use_gray_background() const { return use_gray_background_; } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TemplateURLService template_url_service_; base::SimpleTestClock test_clock_; NiceMock<MockLogoCache>* logo_cache_;
diff --git a/components/security_interstitials_strings.grdp b/components/security_interstitials_strings.grdp index 7819c5ad..3583a4f4 100644 --- a/components/security_interstitials_strings.grdp +++ b/components/security_interstitials_strings.grdp
@@ -78,10 +78,10 @@ Continue </message> <message name="IDS_LOOKALIKE_URL_SHOW_DETAILS" desc="Button text. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL. This button expands the explanation to reveal additional details."> - Advanced + Details </message> <message name="IDS_LOOKALIKE_URL_HIDE_DETAILS" desc="Button text. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL. This button hides additional details."> - Close advanced + Hide details </message> <message name="IDS_LOOKALIKE_URL_FINAL_PARAGRAPH" desc="Final paragraph of an error message clarifying what the buttons do. Context: the error page that's shown when the requested URL might be trying to trick the user since it looks like a more popular URL."> Clicking Continue will take you to the more common site <a href="#" id="dont-proceed-link3"><ph name="DOMAIN">$1<ex>example.com</ex></ph></a>.
diff --git a/components/security_interstitials_strings_grdp/IDS_LOOKALIKE_URL_HIDE_DETAILS.png.sha1 b/components/security_interstitials_strings_grdp/IDS_LOOKALIKE_URL_HIDE_DETAILS.png.sha1 index 7067144..396ab92 100644 --- a/components/security_interstitials_strings_grdp/IDS_LOOKALIKE_URL_HIDE_DETAILS.png.sha1 +++ b/components/security_interstitials_strings_grdp/IDS_LOOKALIKE_URL_HIDE_DETAILS.png.sha1
@@ -1 +1 @@ -ceaa8e7cb8069659b8893df6f00218c83fe517ed \ No newline at end of file +fb5f55f88faf660ea83d210f659a32ba74ba48fb \ No newline at end of file
diff --git a/components/security_interstitials_strings_grdp/IDS_LOOKALIKE_URL_SHOW_DETAILS.png.sha1 b/components/security_interstitials_strings_grdp/IDS_LOOKALIKE_URL_SHOW_DETAILS.png.sha1 index d05953a..06090a1 100644 --- a/components/security_interstitials_strings_grdp/IDS_LOOKALIKE_URL_SHOW_DETAILS.png.sha1 +++ b/components/security_interstitials_strings_grdp/IDS_LOOKALIKE_URL_SHOW_DETAILS.png.sha1
@@ -1 +1 @@ -08aa6eaf98a7ce2e4bb020d4dd4641e56ac8a58e \ No newline at end of file +269cc52136ae3794106e94ce671f321162997ef8 \ No newline at end of file
diff --git a/components/send_tab_to_self/send_tab_to_self_bridge_unittest.cc b/components/send_tab_to_self/send_tab_to_self_bridge_unittest.cc index 3f3ffee..421e1e2 100644 --- a/components/send_tab_to_self/send_tab_to_self_bridge_unittest.cc +++ b/components/send_tab_to_self/send_tab_to_self_bridge_unittest.cc
@@ -195,7 +195,7 @@ base::SimpleTestClock clock_; // In memory model type store needs to be able to post tasks. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<syncer::ModelTypeStore> store_;
diff --git a/components/services/filesystem/directory_impl_unittest.cc b/components/services/filesystem/directory_impl_unittest.cc index 0b8d9ad..73b463ec 100644 --- a/components/services/filesystem/directory_impl_unittest.cc +++ b/components/services/filesystem/directory_impl_unittest.cc
@@ -29,7 +29,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DirectoryTestHelper test_helper_; DISALLOW_COPY_AND_ASSIGN(DirectoryImplTest);
diff --git a/components/services/filesystem/file_impl_unittest.cc b/components/services/filesystem/file_impl_unittest.cc index 7a3e90c..32a93845 100644 --- a/components/services/filesystem/file_impl_unittest.cc +++ b/components/services/filesystem/file_impl_unittest.cc
@@ -27,7 +27,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DirectoryTestHelper test_helper_; DISALLOW_COPY_AND_ASSIGN(FileImplTest);
diff --git a/components/services/font/font_loader_unittest.cc b/components/services/font/font_loader_unittest.cc index 1deaa3e..cf7f1c5 100644 --- a/components/services/font/font_loader_unittest.cc +++ b/components/services/font/font_loader_unittest.cc
@@ -78,7 +78,7 @@ FontLoader* font_loader() { return &font_loader_; } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; FontLoader font_loader_{ConnectToBackgroundFontService()}; DISALLOW_COPY_AND_ASSIGN(FontLoaderTest);
diff --git a/components/services/leveldb/leveldb_service_unittest.cc b/components/services/leveldb/leveldb_service_unittest.cc index 3450430c..ad97bef8 100644 --- a/components/services/leveldb/leveldb_service_unittest.cc +++ b/components/services/leveldb/leveldb_service_unittest.cc
@@ -183,7 +183,7 @@ mojo::Remote<mojom::LevelDBService>& leveldb() { return leveldb_remote_; } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::test::ScopedFeatureList feature_list_; filesystem::DirectoryTestHelper directory_helper_; LevelDBServiceImpl leveldb_service_;
diff --git a/components/services/leveldb/remote_iterator_unittest.cc b/components/services/leveldb/remote_iterator_unittest.cc index c7f7e1f2..1071596 100644 --- a/components/services/leveldb/remote_iterator_unittest.cc +++ b/components/services/leveldb/remote_iterator_unittest.cc
@@ -81,7 +81,7 @@ mojom::LevelDBDatabaseAssociatedPtr& database() { return database_; } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; LevelDBServiceImpl leveldb_service_; mojo::Remote<mojom::LevelDBService> leveldb_remote_; mojo::Receiver<mojom::LevelDBService> leveldb_receiver_;
diff --git a/components/services/pdf_compositor/pdf_compositor_impl_unittest.cc b/components/services/pdf_compositor/pdf_compositor_impl_unittest.cc index 9cfad06..72179d2a 100644 --- a/components/services/pdf_compositor/pdf_compositor_impl_unittest.cc +++ b/components/services/pdf_compositor/pdf_compositor_impl_unittest.cc
@@ -44,8 +44,7 @@ class PdfCompositorImplTest : public testing::Test { public: PdfCompositorImplTest() - : task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), run_loop_(std::make_unique<base::RunLoop>()), is_ready_(false) {} @@ -77,7 +76,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; bool is_ready_; };
diff --git a/components/services/quarantine/quarantine_service_unittest.cc b/components/services/quarantine/quarantine_service_unittest.cc index 469bd7e..bfe76daa 100644 --- a/components/services/quarantine/quarantine_service_unittest.cc +++ b/components/services/quarantine/quarantine_service_unittest.cc
@@ -38,7 +38,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; mojo::Remote<mojom::Quarantine> quarantine_; mojom::QuarantineFileResult result_;
diff --git a/components/services/unzip/public/cpp/unzip_unittest.cc b/components/services/unzip/public/cpp/unzip_unittest.cc index 8880bcd..17c07bb 100644 --- a/components/services/unzip/public/cpp/unzip_unittest.cc +++ b/components/services/unzip/public/cpp/unzip_unittest.cc
@@ -104,7 +104,7 @@ unzip_dir_ = temp_dir_.GetPath(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; base::FilePath unzip_dir_;
diff --git a/components/signin/core/browser/account_investigator_unittest.cc b/components/signin/core/browser/account_investigator_unittest.cc index ebcd10f..796e5b7 100644 --- a/components/signin/core/browser/account_investigator_unittest.cc +++ b/components/signin/core/browser/account_investigator_unittest.cc
@@ -133,7 +133,7 @@ private: // Timer needs a message loop. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable prefs_; network::TestURLLoaderFactory test_url_loader_factory_; signin::IdentityTestEnvironment identity_test_env_;
diff --git a/components/signin/core/browser/account_reconcilor_unittest.cc b/components/signin/core/browser/account_reconcilor_unittest.cc index b046244..ac1a655 100644 --- a/components/signin/core/browser/account_reconcilor_unittest.cc +++ b/components/signin/core/browser/account_reconcilor_unittest.cc
@@ -236,9 +236,7 @@ return &identity_test_env_; } - base::test::ScopedTaskEnvironment* task_environment() { - return &task_environment_; - } + base::test::TaskEnvironment* task_environment() { return &task_environment_; } TestSigninClient* test_signin_client() { return &test_signin_client_; } base::HistogramTester* histogram_tester() { return &histogram_tester_; } @@ -276,7 +274,7 @@ network::TestURLLoaderFactory test_url_loader_factory_; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; signin::AccountConsistencyMethod account_consistency_; bool dice_migration_completed_ = false; sync_preferences::TestingPrefServiceSyncable pref_service_; @@ -341,8 +339,7 @@ signin::AccountConsistencyMethod::kMirror)); AccountReconcilorTest::AccountReconcilorTest() - : task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), account_consistency_(signin::AccountConsistencyMethod::kDisabled), test_signin_client_(&pref_service_, &test_url_loader_factory_), identity_test_env_(/*test_url_loader_factory=*/nullptr,
diff --git a/components/signin/core/browser/consistency_cookie_manager_unittest.cc b/components/signin/core/browser/consistency_cookie_manager_unittest.cc index 5023f2c..9ad9444 100644 --- a/components/signin/core/browser/consistency_cookie_manager_unittest.cc +++ b/components/signin/core/browser/consistency_cookie_manager_unittest.cc
@@ -100,7 +100,7 @@ private: base::test::ScopedFeatureList scoped_feature_list_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable pref_service_; // Owned by signin_client_.
diff --git a/components/signin/core/browser/signin_error_controller_unittest.cc b/components/signin/core/browser/signin_error_controller_unittest.cc index bcb736d..2673173d 100644 --- a/components/signin/core/browser/signin_error_controller_unittest.cc +++ b/components/signin/core/browser/signin_error_controller_unittest.cc
@@ -35,7 +35,7 @@ MockSigninErrorControllerObserver observer; EXPECT_CALL(observer, OnErrorChanged()).Times(0); - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; signin::IdentityTestEnvironment identity_test_env; SigninErrorController error_controller( SigninErrorController::AccountMode::ANY_ACCOUNT, @@ -83,7 +83,7 @@ } TEST(SigninErrorControllerTest, AccountTransitionAnyAccount) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; signin::IdentityTestEnvironment identity_test_env; CoreAccountId test_account_id = @@ -114,7 +114,7 @@ // ChromeOS. #if !defined(OS_CHROMEOS) TEST(SigninErrorControllerTest, AccountTransitionPrimaryAccount) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; signin::IdentityTestEnvironment identity_test_env; signin::PrimaryAccountMutator* primary_account_mutator = identity_test_env.identity_manager()->GetPrimaryAccountMutator(); @@ -179,7 +179,7 @@ // Verify that SigninErrorController handles errors properly. TEST(SigninErrorControllerTest, AuthStatusEnumerateAllErrors) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; signin::IdentityTestEnvironment identity_test_env; CoreAccountId test_account_id = @@ -226,7 +226,7 @@ // Verify that existing error is not replaced by new error. TEST(SigninErrorControllerTest, AuthStatusChange) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; signin::IdentityTestEnvironment identity_test_env; CoreAccountId test_account_id = @@ -282,7 +282,7 @@ TEST(SigninErrorControllerTest, PrimaryAccountErrorsArePreferredToSecondaryAccountErrors) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; signin::IdentityTestEnvironment identity_test_env; AccountInfo primary_account_info = @@ -329,7 +329,7 @@ } TEST(SigninErrorControllerTest, PrimaryAccountErrorsAreSticky) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; signin::IdentityTestEnvironment identity_test_env; AccountInfo primary_account_info =
diff --git a/components/signin/core/browser/signin_header_helper_unittest.cc b/components/signin/core/browser/signin_header_helper_unittest.cc index c36fd26..0d5476e 100644 --- a/components/signin/core/browser/signin_header_helper_unittest.cc +++ b/components/signin/core/browser/signin_header_helper_unittest.cc
@@ -112,7 +112,7 @@ } #endif - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; bool sync_enabled_ = false; std::string device_id_ = kTestDeviceId;
diff --git a/components/signin/core/browser/signin_investigator_unittest.cc b/components/signin/core/browser/signin_investigator_unittest.cc index 31df9131..2548070 100644 --- a/components/signin/core/browser/signin_investigator_unittest.cc +++ b/components/signin/core/browser/signin_investigator_unittest.cc
@@ -33,7 +33,7 @@ PrefService* GetPrefs() override { return &prefs_; } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable prefs_; signin::IdentityTestEnvironment identity_test_env_; };
diff --git a/components/signin/internal/identity_manager/account_tracker_service_unittest.cc b/components/signin/internal/identity_manager/account_tracker_service_unittest.cc index e4f0d258..99d30f4a 100644 --- a/components/signin/internal/identity_manager/account_tracker_service_unittest.cc +++ b/components/signin/internal/identity_manager/account_tracker_service_unittest.cc
@@ -319,7 +319,7 @@ void ReturnFetchResults(net::HttpStatusCode response_code, const std::string& response_string); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: void CreateAccountTracker(base::FilePath path, bool network_enabled) { @@ -407,7 +407,7 @@ AccountKey account_key) { GetTestURLLoaderFactory()->AddResponse( AccountKeyToPictureURLWithSize(account_key), "image data"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void AccountTrackerServiceTest::ReturnAccountImageFetchFailure( @@ -415,7 +415,7 @@ GetTestURLLoaderFactory()->AddResponse( AccountKeyToPictureURLWithSize(account_key), std::string(), net::HTTP_BAD_REQUEST); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(AccountTrackerServiceTest, Basic) {} @@ -682,7 +682,7 @@ AccountKeyToEmail(kAccountKeyBeta)), })); // Wait until all account images are loaded. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(CheckAccountTrackerEvents({ TrackingEvent(UPDATED, AccountKeyToAccountId(kAccountKeyAlpha), AccountKeyToGaiaId(kAccountKeyAlpha),
diff --git a/components/signin/internal/identity_manager/gaia_cookie_manager_service_unittest.cc b/components/signin/internal/identity_manager/gaia_cookie_manager_service_unittest.cc index 410107a2..0df78ae 100644 --- a/components/signin/internal/identity_manager/gaia_cookie_manager_service_unittest.cc +++ b/components/signin/internal/identity_manager/gaia_cookie_manager_service_unittest.cc
@@ -228,7 +228,7 @@ const CoreAccountId account_id3_; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; GoogleServiceAuthError no_error_; GoogleServiceAuthError error_; GoogleServiceAuthError canceled_;
diff --git a/components/signin/internal/identity_manager/mutable_profile_oauth2_token_service_delegate_unittest.cc b/components/signin/internal/identity_manager/mutable_profile_oauth2_token_service_delegate_unittest.cc index 3c3b4e04..12f55b8 100644 --- a/components/signin/internal/identity_manager/mutable_profile_oauth2_token_service_delegate_unittest.cc +++ b/components/signin/internal/identity_manager/mutable_profile_oauth2_token_service_delegate_unittest.cc
@@ -84,9 +84,9 @@ public WebDataServiceConsumer { public: MutableProfileOAuth2TokenServiceDelegateTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::ASYNC), + : task_environment_( + base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::ThreadPoolExecutionMode::ASYNC), access_token_success_count_(0), access_token_failure_count_(0), access_token_failure_(GoogleServiceAuthError::NONE), @@ -248,7 +248,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestSigninClient> client_; std::unique_ptr<MutableProfileOAuth2TokenServiceDelegate> oauth2_service_delegate_;
diff --git a/components/signin/internal/identity_manager/oauth_multilogin_helper_unittest.cc b/components/signin/internal/identity_manager/oauth_multilogin_helper_unittest.cc index 9ad5f88..3e22e071 100644 --- a/components/signin/internal/identity_manager/oauth_multilogin_helper_unittest.cc +++ b/components/signin/internal/identity_manager/oauth_multilogin_helper_unittest.cc
@@ -217,7 +217,7 @@ result_ = result; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; bool callback_called_ = false; SetAccountsInCookieResult result_;
diff --git a/components/signin/internal/identity_manager/oauth_multilogin_token_fetcher_unittest.cc b/components/signin/internal/identity_manager/oauth_multilogin_token_fetcher_unittest.cc index ebeb12b..fe9cbf0 100644 --- a/components/signin/internal/identity_manager/oauth_multilogin_token_fetcher_unittest.cc +++ b/components/signin/internal/identity_manager/oauth_multilogin_token_fetcher_unittest.cc
@@ -73,7 +73,7 @@ error_ = error; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; bool success_callback_called_ = false; bool failure_callback_called_ = false;
diff --git a/components/signin/internal/identity_manager/primary_account_manager_unittest.cc b/components/signin/internal/identity_manager/primary_account_manager_unittest.cc index 8549cd8..97ce38b9 100644 --- a/components/signin/internal/identity_manager/primary_account_manager_unittest.cc +++ b/components/signin/internal/identity_manager/primary_account_manager_unittest.cc
@@ -130,7 +130,7 @@ void GoogleSignedOut(const AccountInfo& account_info) { num_signouts_++; } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable user_prefs_; TestingPrefServiceSimple local_state_; TestSigninClient test_signin_client_;
diff --git a/components/signin/internal/identity_manager/primary_account_policy_manager_impl_unittest.cc b/components/signin/internal/identity_manager/primary_account_policy_manager_impl_unittest.cc index 282eab2e..92ad0b6 100644 --- a/components/signin/internal/identity_manager/primary_account_policy_manager_impl_unittest.cc +++ b/components/signin/internal/identity_manager/primary_account_policy_manager_impl_unittest.cc
@@ -43,7 +43,7 @@ test_signin_client_.Shutdown(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable user_prefs_; TestingPrefServiceSimple local_state_; TestSigninClient test_signin_client_;
diff --git a/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_chromeos_unittest.cc b/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_chromeos_unittest.cc index fe4be52..aeb13ba 100644 --- a/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_chromeos_unittest.cc +++ b/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_chromeos_unittest.cc
@@ -207,7 +207,7 @@ GetValidTokenResponse("token", 3600)); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir tmp_dir_; AccountInfo account_info_;
diff --git a/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_ios_unittest.mm b/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_ios_unittest.mm index 0092a3f8..0111d81 100644 --- a/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_ios_unittest.mm +++ b/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_ios_unittest.mm
@@ -105,7 +105,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::FakeURLFetcherFactory factory_; TestingPrefServiceSimple prefs_; TestSigninClient client_;
diff --git a/components/signin/internal/identity_manager/profile_oauth2_token_service_unittest.cc b/components/signin/internal/identity_manager/profile_oauth2_token_service_unittest.cc index ff8055e..cfea25e 100644 --- a/components/signin/internal/identity_manager/profile_oauth2_token_service_unittest.cc +++ b/components/signin/internal/identity_manager/profile_oauth2_token_service_unittest.cc
@@ -116,9 +116,9 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType:: - IO}; // net:: stuff needs IO message loop. + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; // net:: stuff needs IO + // message loop. network::TestURLLoaderFactory* test_url_loader_factory_ = nullptr; FakeProfileOAuth2TokenServiceDelegate* delegate_ptr_ = nullptr; // Not owned. std::unique_ptr<ProfileOAuth2TokenService> oauth2_service_;
diff --git a/components/signin/internal/identity_manager/ubertoken_fetcher_impl_unittest.cc b/components/signin/internal/identity_manager/ubertoken_fetcher_impl_unittest.cc index f4e7d91..b0b0797 100644 --- a/components/signin/internal/identity_manager/ubertoken_fetcher_impl_unittest.cc +++ b/components/signin/internal/identity_manager/ubertoken_fetcher_impl_unittest.cc
@@ -51,8 +51,7 @@ class UbertokenFetcherImplTest : public testing::Test { public: UbertokenFetcherImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), token_service_(&pref_service_), test_shared_loader_factory_( base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( @@ -65,7 +64,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestingPrefServiceSimple pref_service_; FakeProfileOAuth2TokenService token_service_; network::TestURLLoaderFactory url_loader_factory_;
diff --git a/components/signin/ios/browser/wait_for_network_callback_helper_unittest.cc b/components/signin/ios/browser/wait_for_network_callback_helper_unittest.cc index 7fb8e7cc..b0e7b607 100644 --- a/components/signin/ios/browser/wait_for_network_callback_helper_unittest.cc +++ b/components/signin/ios/browser/wait_for_network_callback_helper_unittest.cc
@@ -21,7 +21,7 @@ WaitForNetworkCallbackHelperTest() : num_callbacks_invoked_(0) {} int num_callbacks_invoked_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<net::test::MockNetworkChangeNotifier> network_change_notifier_ = net::test::MockNetworkChangeNotifier::Create(); WaitForNetworkCallbackHelper callback_helper_; @@ -51,6 +51,6 @@ net::NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI); network_change_notifier_->NotifyObserversOfConnectionTypeChangeForTests( net::NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(2, num_callbacks_invoked_); }
diff --git a/components/signin/public/identity_manager/access_token_fetcher_unittest.cc b/components/signin/public/identity_manager/access_token_fetcher_unittest.cc index 2de2b66..ef29317 100644 --- a/components/signin/public/identity_manager/access_token_fetcher_unittest.cc +++ b/components/signin/public/identity_manager/access_token_fetcher_unittest.cc
@@ -117,7 +117,7 @@ std::move(on_access_token_request_callback_).Run(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestingPrefServiceSyncable pref_service_; TestSigninClient signin_client_; FakeProfileOAuth2TokenService token_service_;
diff --git a/components/signin/public/identity_manager/accounts_cookie_mutator_unittest.cc b/components/signin/public/identity_manager/accounts_cookie_mutator_unittest.cc index add100d3..fda8017b 100644 --- a/components/signin/public/identity_manager/accounts_cookie_mutator_unittest.cc +++ b/components/signin/public/identity_manager/accounts_cookie_mutator_unittest.cc
@@ -137,7 +137,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable prefs_; TestSigninClient test_signin_client_; IdentityTestEnvironment identity_test_env_;
diff --git a/components/signin/public/identity_manager/accounts_mutator_unittest.cc b/components/signin/public/identity_manager/accounts_mutator_unittest.cc index 8db42ec0..d06ea9a8 100644 --- a/components/signin/public/identity_manager/accounts_mutator_unittest.cc +++ b/components/signin/public/identity_manager/accounts_mutator_unittest.cc
@@ -110,7 +110,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable prefs_; network::TestURLLoaderFactory test_url_loader_factory_; IdentityTestEnvironment identity_test_env_;
diff --git a/components/signin/public/identity_manager/diagnostics_provider_unittest.cc b/components/signin/public/identity_manager/diagnostics_provider_unittest.cc index 87fb50f..b9be3e54 100644 --- a/components/signin/public/identity_manager/diagnostics_provider_unittest.cc +++ b/components/signin/public/identity_manager/diagnostics_provider_unittest.cc
@@ -29,7 +29,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: signin::IdentityTestEnvironment identity_test_env_;
diff --git a/components/signin/public/identity_manager/identity_manager_unittest.cc b/components/signin/public/identity_manager/identity_manager_unittest.cc index 844efef..86a95ce 100644 --- a/components/signin/public/identity_manager/identity_manager_unittest.cc +++ b/components/signin/public/identity_manager/identity_manager_unittest.cc
@@ -403,7 +403,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable pref_service_; network::TestURLLoaderFactory test_url_loader_factory_; TestSigninClient signin_client_;
diff --git a/components/signin/public/identity_manager/identity_test_environment.cc b/components/signin/public/identity_manager/identity_test_environment.cc index 08026c7a..6906841 100644 --- a/components/signin/public/identity_manager/identity_test_environment.cc +++ b/components/signin/public/identity_manager/identity_test_environment.cc
@@ -127,7 +127,7 @@ "environment. " "If your test has an existing one, move it to be initialized before " "IdentityTestEnvironment. Otherwise, use " - "base::test::ScopedTaskEnvironment."; + "base::test::TaskEnvironment."; test_identity_manager_observer_ = std::make_unique<TestIdentityManagerObserver>(this->identity_manager()); this->identity_manager()->AddDiagnosticsObserver(this);
diff --git a/components/signin/public/identity_manager/identity_test_environment.h b/components/signin/public/identity_manager/identity_test_environment.h index 76aeeff..ab6184e 100644 --- a/components/signin/public/identity_manager/identity_test_environment.h +++ b/components/signin/public/identity_manager/identity_test_environment.h
@@ -39,7 +39,7 @@ // not available; call MakePrimaryAccountAvailable() as needed. // NOTE: IdentityTestEnvironment requires that tests have a properly set up // task environment. If your test doesn't already have one, use a -// base::test::ScopedTaskEnvironment instance variable to fulfill this +// base::test::TaskEnvironment instance variable to fulfill this // requirement. class IdentityTestEnvironment : public IdentityManager::DiagnosticsObserver { public:
diff --git a/components/signin/public/identity_manager/identity_test_environment_unittest.cc b/components/signin/public/identity_manager/identity_test_environment_unittest.cc index 9c03209a..cf310db 100644 --- a/components/signin/public/identity_manager/identity_test_environment_unittest.cc +++ b/components/signin/public/identity_manager/identity_test_environment_unittest.cc
@@ -14,17 +14,14 @@ class IdentityTestEnvironmentTest : public testing::Test { public: IdentityTestEnvironmentTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) {} + : task_environment_( + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} - ~IdentityTestEnvironmentTest() override { - scoped_task_environment_.RunUntilIdle(); - } + ~IdentityTestEnvironmentTest() override { task_environment_.RunUntilIdle(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(IdentityTestEnvironmentTest); };
diff --git a/components/signin/public/identity_manager/primary_account_access_token_fetcher_unittest.cc b/components/signin/public/identity_manager/primary_account_access_token_fetcher_unittest.cc index b0136c69c..a6f62f6b1 100644 --- a/components/signin/public/identity_manager/primary_account_access_token_fetcher_unittest.cc +++ b/components/signin/public/identity_manager/primary_account_access_token_fetcher_unittest.cc
@@ -77,7 +77,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; IdentityTestEnvironment identity_test_env_; AccessTokenInfo access_token_info_; };
diff --git a/components/signin/public/identity_manager/primary_account_mutator_unittest.cc b/components/signin/public/identity_manager/primary_account_mutator_unittest.cc index a18d03c2..e85615c 100644 --- a/components/signin/public/identity_manager/primary_account_mutator_unittest.cc +++ b/components/signin/public/identity_manager/primary_account_mutator_unittest.cc
@@ -100,7 +100,7 @@ signin::PrimaryAccountMutator::ClearAccountsAction account_action, RemoveAccountExpectation account_expectation, AuthExpectation auth_expection = AuthExpectation::kAuthNormal) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; signin::IdentityTestEnvironment environment( /*test_url_loader_factory=*/nullptr, /*pref_service=*/nullptr, account_consistency_method); @@ -215,7 +215,7 @@ // Checks that setting the primary account works. TEST_F(PrimaryAccountMutatorTest, SetPrimaryAccount) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; signin::IdentityTestEnvironment environment; signin::IdentityManager* identity_manager = environment.identity_manager(); @@ -247,7 +247,7 @@ // Checks that setting the primary account fails if the account is not known by // the identity service. TEST_F(PrimaryAccountMutatorTest, SetPrimaryAccount_NoAccount) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; signin::IdentityTestEnvironment environment; signin::IdentityManager* identity_manager = environment.identity_manager(); @@ -265,7 +265,7 @@ // Checks that setting the primary account fails if the account is unknown. TEST_F(PrimaryAccountMutatorTest, SetPrimaryAccount_UnknownAccount) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; signin::IdentityTestEnvironment environment; signin::IdentityManager* identity_manager = environment.identity_manager(); @@ -287,7 +287,7 @@ // Checks that trying to set the primary account fails when there is already a // primary account. TEST_F(PrimaryAccountMutatorTest, SetPrimaryAccount_AlreadyHasPrimaryAccount) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; signin::IdentityTestEnvironment environment; signin::IdentityManager* identity_manager = environment.identity_manager(); @@ -320,7 +320,7 @@ // account is not allowed. TEST_F(PrimaryAccountMutatorTest, SetPrimaryAccount_SettingPrimaryAccountForbidden) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; sync_preferences::TestingPrefServiceSyncable pref_service; signin::IdentityTestEnvironment environment( @@ -354,7 +354,7 @@ // support clearing the primary account. #if !defined(OS_CHROMEOS) TEST_F(PrimaryAccountMutatorTest, ClearPrimaryAccount_NotSignedIn) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; signin::IdentityTestEnvironment environment; signin::IdentityManager* identity_manager = environment.identity_manager(); @@ -385,7 +385,7 @@ } TEST_F(PrimaryAccountMutatorTest, ClearPrimaryAccount_Default) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; signin::IdentityTestEnvironment environment; signin::IdentityManager* identity_manager = environment.identity_manager();
diff --git a/components/spellcheck/browser/spellcheck_host_metrics_unittest.cc b/components/spellcheck/browser/spellcheck_host_metrics_unittest.cc index 9d030076..4779ec69 100644 --- a/components/spellcheck/browser/spellcheck_host_metrics_unittest.cc +++ b/components/spellcheck/browser/spellcheck_host_metrics_unittest.cc
@@ -27,7 +27,7 @@ void RecordWordCountsForTesting() { metrics_->RecordWordCounts(); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<SpellCheckHostMetrics> metrics_; };
diff --git a/components/spellcheck/browser/spellcheck_platform_mac_unittest.cc b/components/spellcheck/browser/spellcheck_platform_mac_unittest.cc index 155c206..8c403bf 100644 --- a/components/spellcheck/browser/spellcheck_platform_mac_unittest.cc +++ b/components/spellcheck/browser/spellcheck_platform_mac_unittest.cc
@@ -49,8 +49,8 @@ base::Unretained(this))); } - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; spellcheck_platform::ScopedEnglishLanguageForTest scoped_language_; };
diff --git a/components/spellcheck/browser/spellcheck_platform_win_unittest.cc b/components/spellcheck/browser/spellcheck_platform_win_unittest.cc index cd71ff6c5..ef543a2 100644 --- a/components/spellcheck/browser/spellcheck_platform_win_unittest.cc +++ b/components/spellcheck/browser/spellcheck_platform_win_unittest.cc
@@ -57,8 +57,8 @@ std::vector<SpellCheckResult> spell_check_results_; base::OnceClosure quit_; - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; }; TEST_F(SpellcheckPlatformWinTest, SpellCheckSuggestions_EN_US) {
diff --git a/components/spellcheck/renderer/empty_local_interface_provider.h b/components/spellcheck/renderer/empty_local_interface_provider.h index 9fe12c4d..d861c9fe 100644 --- a/components/spellcheck/renderer/empty_local_interface_provider.h +++ b/components/spellcheck/renderer/empty_local_interface_provider.h
@@ -10,7 +10,7 @@ namespace spellcheck { // A dummy LocalInterfaceProvider that doesn't bind any remote application. -// May require a base::test::ScopedTaskEnvironment if GetInterface() is expected +// May require a base::test::TaskEnvironment if GetInterface() is expected // to be called. class EmptyLocalInterfaceProvider : public service_manager::LocalInterfaceProvider {
diff --git a/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc b/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc index 62bbdac..b89fc1a 100644 --- a/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc +++ b/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc
@@ -114,7 +114,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; spellcheck::EmptyLocalInterfaceProvider embedder_provider_; // Owned by |provider_|.
diff --git a/components/spellcheck/renderer/spellcheck_unittest.cc b/components/spellcheck/renderer/spellcheck_unittest.cc index 8e0a05a..259487ad 100644 --- a/components/spellcheck/renderer/spellcheck_unittest.cc +++ b/components/spellcheck/renderer/spellcheck_unittest.cc
@@ -130,7 +130,7 @@ private: spellcheck::EmptyLocalInterfaceProvider embedder_provider_; std::unique_ptr<SpellCheck> spell_check_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; struct MockTextCheckingResult {
diff --git a/components/ssl_errors/error_classification_unittest.cc b/components/ssl_errors/error_classification_unittest.cc index 6161d19..8072724 100644 --- a/components/ssl_errors/error_classification_unittest.cc +++ b/components/ssl_errors/error_classification_unittest.cc
@@ -363,8 +363,8 @@ // Tests that all possible NetworkClockState histogram values are recorded // appropriately. TEST_F(SSLErrorClassificationTest, NetworkClockStateHistogram) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); scoped_refptr<network::TestSharedURLLoaderFactory> shared_url_loader_factory = base::MakeRefCounted<network::TestSharedURLLoaderFactory>();
diff --git a/components/storage_monitor/storage_monitor_linux_unittest.cc b/components/storage_monitor/storage_monitor_linux_unittest.cc index 2b475bf..d2f3dee 100644 --- a/components/storage_monitor/storage_monitor_linux_unittest.cc +++ b/components/storage_monitor/storage_monitor_linux_unittest.cc
@@ -188,13 +188,13 @@ monitor_->AddObserver(mock_storage_observer_.get()); monitor_->Init(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void TearDown() override { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); monitor_->RemoveObserver(mock_storage_observer_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Linux storage monitor must be destroyed on the UI thread, so do it here. monitor_.reset(); @@ -309,7 +309,7 @@ ASSERT_EQ(1, endmntent(file)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockRemovableStorageObserver> mock_storage_observer_;
diff --git a/components/storage_monitor/storage_monitor_unittest.cc b/components/storage_monitor/storage_monitor_unittest.cc index 3bf96fb7..b4a8ab3 100644 --- a/components/storage_monitor/storage_monitor_unittest.cc +++ b/components/storage_monitor/storage_monitor_unittest.cc
@@ -24,7 +24,7 @@ namespace storage_monitor { TEST(StorageMonitorTest, TestInitialize) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestStorageMonitor::Destroy(); TestStorageMonitor monitor; EXPECT_FALSE(monitor.init_called()); @@ -39,7 +39,7 @@ TEST(StorageMonitorTest, DeviceAttachDetachNotifications) { TestStorageMonitor::Destroy(); - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; const std::string kDeviceId1 = "dcim:UUID:FFF0-0001"; const std::string kDeviceId2 = "dcim:UUID:FFF0-0002"; MockRemovableStorageObserver observer1; @@ -82,7 +82,7 @@ TEST(StorageMonitorTest, GetAllAvailableStoragesEmpty) { TestStorageMonitor::Destroy(); - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestStorageMonitor monitor; std::vector<StorageInfo> devices = monitor.GetAllAvailableStorages(); EXPECT_EQ(0U, devices.size()); @@ -90,7 +90,7 @@ TEST(StorageMonitorTest, GetAllAvailableStorageAttachDetach) { TestStorageMonitor::Destroy(); - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestStorageMonitor monitor; const std::string kDeviceId1 = "dcim:UUID:FFF0-0042"; const base::FilePath kDevicePath1(FILE_PATH_LITERAL("/testfoo"));
diff --git a/components/subresource_filter/content/browser/async_document_subresource_filter_unittest.cc b/components/subresource_filter/content/browser/async_document_subresource_filter_unittest.cc index 91d4fe7..6dbd3c21 100644 --- a/components/subresource_filter/content/browser/async_document_subresource_filter_unittest.cc +++ b/components/subresource_filter/content/browser/async_document_subresource_filter_unittest.cc
@@ -77,7 +77,7 @@ // Note: ADSF assumes a task runner is associated with the current thread. // Instantiate a MessageLoop on the current thread and use base::RunLoop to // handle the replies ADSF tasks generate. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::TestSimpleTaskRunner> blocking_task_runner_ = new base::TestSimpleTaskRunner;
diff --git a/components/subresource_filter/content/browser/ruleset_service_unittest.cc b/components/subresource_filter/content/browser/ruleset_service_unittest.cc index 1d4a284..1be4fea5 100644 --- a/components/subresource_filter/content/browser/ruleset_service_unittest.cc +++ b/components/subresource_filter/content/browser/ruleset_service_unittest.cc
@@ -359,7 +359,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir scoped_temp_dir_; scoped_refptr<base::TestSimpleTaskRunner> blocking_task_runner_;
diff --git a/components/suggestions/suggestions_service_impl_unittest.cc b/components/suggestions/suggestions_service_impl_unittest.cc index 459ee07..0a373ac 100644 --- a/components/suggestions/suggestions_service_impl_unittest.cc +++ b/components/suggestions/suggestions_service_impl_unittest.cc
@@ -134,7 +134,7 @@ url_loader_factory()), base::WrapUnique(test_suggestions_store_), base::WrapUnique(mock_blacklist_store_), - scoped_task_environment_.GetMockTickClock()); + task_environment_.GetMockTickClock()); } GURL GetCurrentlyQueriedUrl() { @@ -171,7 +171,7 @@ bool rv = url_loader_factory()->SimulateResponseForPendingRequest( url, network::URLLoaderCompletionStatus(net_error), network::CreateResourceResponseHead(response_code), response_body); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); return rv; } @@ -193,8 +193,8 @@ return &url_loader_factory_; } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; private: signin::IdentityTestEnvironment identity_test_env_; @@ -224,7 +224,7 @@ EXPECT_CALL(callback, Run(_)); // Wait for the eventual network request. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(GetCurrentlyQueriedUrl().is_valid()); EXPECT_EQ(GetCurrentlyQueriedUrl().path(), kSuggestionsUrlPath); ASSERT_TRUE(RespondToFetchWithProfile(CreateSuggestionsProfile())); @@ -247,7 +247,7 @@ ->OnStateChanged(sync_service()); // Wait for eventual (but unexpected) network requests. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(suggestions_service()->HasPendingRequestForTesting()); } @@ -263,7 +263,7 @@ ->OnStateChanged(sync_service()); // Wait for eventual (but unexpected) network requests. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(suggestions_service()->HasPendingRequestForTesting()); SuggestionsProfile empty_suggestions; @@ -283,7 +283,7 @@ ->OnStateChanged(sync_service()); // Wait for eventual (but unexpected) network requests. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(suggestions_service()->HasPendingRequestForTesting()); } @@ -297,7 +297,7 @@ static_cast<SyncServiceObserver*>(suggestions_service()) ->OnStateChanged(sync_service()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_FALSE(suggestions_service()->HasPendingRequestForTesting()); // Sync getting enabled should not result in a fetch. @@ -307,7 +307,7 @@ ->OnStateChanged(sync_service()); // Wait for eventual (but unexpected) network requests. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(suggestions_service()->HasPendingRequestForTesting()); } @@ -326,7 +326,7 @@ suggestions_service()->FetchSuggestionsData(); // Wait for eventual (but unexpected) network requests. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(suggestions_service()->HasPendingRequestForTesting()); // |suggestions_store()| should still contain the default values. @@ -355,7 +355,7 @@ suggestions_service()->FetchSuggestionsData(); // Wait for eventual (but unexpected) network requests. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(suggestions_service()->HasPendingRequestForTesting()); } @@ -376,7 +376,7 @@ GoogleServiceAuthError::State::INVALID_GAIA_CREDENTIALS)); // Wait for eventual (but unexpected) network requests. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(suggestions_service()->HasPendingRequestForTesting()); } @@ -387,7 +387,7 @@ suggestions_service()->FetchSuggestionsData(); // Wait for the eventual network request. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(RespondToSuggestionsFetch("irrelevant", net::HTTP_OK, net::ERR_INVALID_RESPONSE)); } @@ -403,7 +403,7 @@ suggestions_service()->FetchSuggestionsData(); // Wait for the eventual network request. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(RespondToSuggestionsFetch("irrelevant", net::HTTP_BAD_REQUEST)); SuggestionsProfile empty_suggestions; @@ -433,14 +433,14 @@ // Wait on the upload task, the blacklist request and the next blacklist // scheduling task. - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_EQ(GetCurrentlyQueriedUrl().path(), kBlacklistUrlPath); // The blacklist fetch needs to contain a valid profile or the favicon will // not be set. ASSERT_TRUE(RespondToBlacklistFetch( CreateSuggestionsProfile().SerializeAsString(), net::HTTP_OK)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); SuggestionsProfile suggestions; suggestions_store()->LoadSuggestions(&suggestions); @@ -483,7 +483,7 @@ EXPECT_TRUE(suggestions_service()->BlacklistURL(GURL(kBlacklistedUrl))); // Wait for the first scheduling receiving a failing response. - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_TRUE(GetCurrentlyQueriedUrl().is_valid()); EXPECT_EQ(GetCurrentlyQueriedUrl().path(), kBlacklistUrlPath); ASSERT_TRUE(RespondToBlacklistFetch("irrelevant", net::HTTP_OK, @@ -503,7 +503,7 @@ .WillOnce(Return(true)); // Wait for the second scheduling followed by a successful response. - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_TRUE(suggestions_service()->HasPendingRequestForTesting()); ASSERT_TRUE(GetCurrentlyQueriedUrl().is_valid()); EXPECT_EQ(GetCurrentlyQueriedUrl().path(), kBlacklistUrlPath); @@ -562,7 +562,7 @@ suggestions_service()->ClearBlacklist(); // Wait for the eventual network request. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(suggestions_service()->HasPendingRequestForTesting()); EXPECT_EQ(GetCurrentlyQueriedUrl().path(), kBlacklistClearUrlPath); } @@ -628,13 +628,13 @@ // Delay unchanged on success. suggestions_service()->FetchSuggestionsData(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(RespondToFetchWithProfile(CreateSuggestionsProfile())); EXPECT_EQ(initial_delay, suggestions_service()->BlacklistDelayForTesting()); // Delay increases on failure. suggestions_service()->FetchSuggestionsData(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(RespondToSuggestionsFetch("irrelevant", net::HTTP_BAD_REQUEST)); base::TimeDelta delay_after_fail = suggestions_service()->BlacklistDelayForTesting(); @@ -643,15 +643,15 @@ // Success resets future delays, but the current horizon remains. Since no // time has passed, the actual current delay stays the same. suggestions_service()->FetchSuggestionsData(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(RespondToFetchWithProfile(CreateSuggestionsProfile())); EXPECT_EQ(delay_after_fail, suggestions_service()->BlacklistDelayForTesting()); // After the current horizon has passed, we're back at the initial delay. - scoped_task_environment_.FastForwardBy(delay_after_fail); + task_environment_.FastForwardBy(delay_after_fail); suggestions_service()->FetchSuggestionsData(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(RespondToFetchWithProfile(CreateSuggestionsProfile())); EXPECT_EQ(initial_delay, suggestions_service()->BlacklistDelayForTesting()); } @@ -663,7 +663,7 @@ suggestions_service()->FetchSuggestionsData(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Creates one suggestion without timestamp and adds a second with timestamp. SuggestionsProfile profile = CreateSuggestionsProfile(); ChromeSuggestion* suggestion = profile.add_suggestions();
diff --git a/components/sync/base/bind_to_task_runner_unittest.cc b/components/sync/base/bind_to_task_runner_unittest.cc index 5151fd1..5e94c96 100644 --- a/components/sync/base/bind_to_task_runner_unittest.cc +++ b/components/sync/base/bind_to_task_runner_unittest.cc
@@ -47,7 +47,7 @@ // on the message loop, not during the original Run. class BindToTaskRunnerTest : public ::testing::Test { protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(BindToTaskRunnerTest, Closure) {
diff --git a/components/sync/base/cancelation_signal_unittest.cc b/components/sync/base/cancelation_signal_unittest.cc index 04d95694..6b87bdc4 100644 --- a/components/sync/base/cancelation_signal_unittest.cc +++ b/components/sync/base/cancelation_signal_unittest.cc
@@ -112,7 +112,7 @@ bool VerifyTaskNotStarted(); private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; CancelationSignal signal_; base::WaitableEvent task_start_event_;
diff --git a/components/sync/base/sync_prefs_unittest.cc b/components/sync/base/sync_prefs_unittest.cc index e704bf9..c319d38 100644 --- a/components/sync/base/sync_prefs_unittest.cc +++ b/components/sync/base/sync_prefs_unittest.cc
@@ -48,7 +48,7 @@ pref_service_.Set(prefs::kSyncDemographics, dict); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable pref_service_; std::unique_ptr<SyncPrefs> sync_prefs_; }; @@ -290,7 +290,7 @@ SyncPrefs::RegisterProfilePrefs(pref_service_.registry()); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable pref_service_; };
diff --git a/components/sync/base/weak_handle_unittest.cc b/components/sync/base/weak_handle_unittest.cc index 6a069cc..0d85771 100644 --- a/components/sync/base/weak_handle_unittest.cc +++ b/components/sync/base/weak_handle_unittest.cc
@@ -63,7 +63,7 @@ h.Call(from_here, &Base::Test); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(WeakHandleTest, Uninitialized) {
diff --git a/components/sync/driver/async_directory_type_controller_unittest.cc b/components/sync/driver/async_directory_type_controller_unittest.cc index fa8109a..7fbf063f 100644 --- a/components/sync/driver/async_directory_type_controller_unittest.cc +++ b/components/sync/driver/async_directory_type_controller_unittest.cc
@@ -175,8 +175,7 @@ class SyncAsyncDirectoryTypeControllerTest : public testing::Test { public: SyncAsyncDirectoryTypeControllerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), backend_thread_("dbthread") {} void SetUp() override { @@ -250,7 +249,7 @@ static void SignalDone(WaitableEvent* done) { done->Signal(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::Thread backend_thread_; StartCallbackMock start_callback_;
diff --git a/components/sync/driver/backend_migrator_unittest.cc b/components/sync/driver/backend_migrator_unittest.cc index 53ba320..993127a 100644 --- a/components/sync/driver/backend_migrator_unittest.cc +++ b/components/sync/driver/backend_migrator_unittest.cc
@@ -87,7 +87,7 @@ BackendMigrator* migrator() { return migrator_.get(); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; ModelTypeSet preferred_types_; NiceMock<DataTypeManagerMock> manager_; NiceMock<base::MockCallback<base::RepeatingClosure>> reconfigure_callback_;
diff --git a/components/sync/driver/data_type_controller.h b/components/sync/driver/data_type_controller.h index c7339084..3146b7ef 100644 --- a/components/sync/driver/data_type_controller.h +++ b/components/sync/driver/data_type_controller.h
@@ -63,6 +63,20 @@ MAX_CONFIGURE_RESULT }; + // Returned from RegisterWithBackend. + enum RegisterWithBackendResult { + // Used by non-USS data types which don't use RegisterWithBackend, and by + // USS types when RegisterWithBackend is called on an already-registered + // type. + // TODO(crbug.com/923287): Update the above comment once there are only USS + // data types (or get rid of this entry entirely if possible). + REGISTRATION_IGNORED, + // Indicates that the initial download for this type is already complete. + TYPE_ALREADY_DOWNLOADED, + // Indicates that the initial download for this type still needs to be done. + TYPE_NOT_YET_DOWNLOADED, + }; + using StartCallback = base::OnceCallback< void(ConfigureResult, const SyncMergeResult&, const SyncMergeResult&)>; @@ -114,13 +128,10 @@ const ModelLoadCallback& model_load_callback) = 0; // Registers with sync backend if needed. This function is called by - // DataTypeManager before downloading initial data. Non-blocking types need to - // pass activation context containing progress marker to sync backend and use - // |set_downloaded| to inform the manager whether their initial sync is done. - // TODO(treib): Make this synchronous and possibly merge with - // ActivateManuallyForNigori(). - virtual void RegisterWithBackend( - base::OnceCallback<void(bool)> set_downloaded, + // DataTypeManager before downloading initial data. For non-blocking (USS) + // types, returns whether the initial download for this type is already + // complete. + virtual RegisterWithBackendResult RegisterWithBackend( ModelTypeConfigurer* configurer) = 0; // Will start a potentially asynchronous operation to perform the
diff --git a/components/sync/driver/data_type_manager_impl.cc b/components/sync/driver/data_type_manager_impl.cc index aa4ac89..1fee0960 100644 --- a/components/sync/driver/data_type_manager_impl.cc +++ b/components/sync/driver/data_type_manager_impl.cc
@@ -205,12 +205,16 @@ // successfully. Such types shouldn't be in an error state at the same // time. DCHECK(!data_type_status_table_.GetFailedTypes().Has(dtc->type())); - dtc->RegisterWithBackend( - base::Bind(&DataTypeManagerImpl::SetTypeDownloaded, - base::Unretained(this), dtc->type()), - configurer_); - // This assumes SetTypeDownloaded() is called synchronously, which is - // the case. + switch (dtc->RegisterWithBackend(configurer_)) { + case DataTypeController::REGISTRATION_IGNORED: + break; + case DataTypeController::TYPE_ALREADY_DOWNLOADED: + downloaded_types_.Put(type); + break; + case DataTypeController::TYPE_NOT_YET_DOWNLOADED: + downloaded_types_.Remove(type); + break; + } if (force_redownload_types_.Has(type)) { downloaded_types_.Remove(type); } @@ -921,12 +925,4 @@ data_type_status_table_.GetFailedTypes()); } -void DataTypeManagerImpl::SetTypeDownloaded(ModelType type, bool downloaded) { - if (downloaded) { - downloaded_types_.Put(type); - } else { - downloaded_types_.Remove(type); - } -} - } // namespace syncer
diff --git a/components/sync/driver/data_type_manager_impl.h b/components/sync/driver/data_type_manager_impl.h index 705abeee..0009624 100644 --- a/components/sync/driver/data_type_manager_impl.h +++ b/components/sync/driver/data_type_manager_impl.h
@@ -184,9 +184,6 @@ // Returns the currently enabled types. ModelTypeSet GetEnabledTypes() const; - // Adds or removes |type| from |downloaded_types_| based on |downloaded|. - void SetTypeDownloaded(ModelType type, bool downloaded); - ModelTypeConfigurer* configurer_; // Map of all data type controllers that are available for sync.
diff --git a/components/sync/driver/data_type_manager_impl_unittest.cc b/components/sync/driver/data_type_manager_impl_unittest.cc index 165a8f7..38cc946 100644 --- a/components/sync/driver/data_type_manager_impl_unittest.cc +++ b/components/sync/driver/data_type_manager_impl_unittest.cc
@@ -331,8 +331,8 @@ return configurer_.last_params(); } - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; DataTypeController::TypeMap controllers_; FakeModelTypeConfigurer configurer_; FakeDataTypeManagerObserver observer_;
diff --git a/components/sync/driver/directory_data_type_controller.cc b/components/sync/driver/directory_data_type_controller.cc index ae12bf1..ed5031e 100644 --- a/components/sync/driver/directory_data_type_controller.cc +++ b/components/sync/driver/directory_data_type_controller.cc
@@ -40,9 +40,11 @@ configurer->RegisterDirectoryDataType(type(), model_safe_group_); } -void DirectoryDataTypeController::RegisterWithBackend( - base::OnceCallback<void(bool)> set_downloaded, - ModelTypeConfigurer* configurer) {} +DataTypeController::RegisterWithBackendResult +DirectoryDataTypeController::RegisterWithBackend( + ModelTypeConfigurer* configurer) { + return REGISTRATION_IGNORED; +} void DirectoryDataTypeController::ActivateDataType( ModelTypeConfigurer* configurer) {
diff --git a/components/sync/driver/directory_data_type_controller.h b/components/sync/driver/directory_data_type_controller.h index 31875c73..ab83cb4 100644 --- a/components/sync/driver/directory_data_type_controller.h +++ b/components/sync/driver/directory_data_type_controller.h
@@ -31,8 +31,8 @@ // Directory based data types register with backend before LoadModels in // BeforeLoadModels. No need to do anything in RegisterWithBackend. - void RegisterWithBackend(base::OnceCallback<void(bool)> set_downloaded, - ModelTypeConfigurer* configurer) override; + RegisterWithBackendResult RegisterWithBackend( + ModelTypeConfigurer* configurer) override; // Directory specific implementation of ActivateDataType with the // type specific ChangeProcessor and ModelSafeGroup.
diff --git a/components/sync/driver/fake_data_type_controller.cc b/components/sync/driver/fake_data_type_controller.cc index 09f5d071..f881d11 100644 --- a/components/sync/driver/fake_data_type_controller.cc +++ b/components/sync/driver/fake_data_type_controller.cc
@@ -55,10 +55,10 @@ } } -void FakeDataTypeController::RegisterWithBackend( - base::OnceCallback<void(bool)> set_downloaded, - ModelTypeConfigurer* configurer) { +DataTypeController::RegisterWithBackendResult +FakeDataTypeController::RegisterWithBackend(ModelTypeConfigurer* configurer) { ++register_with_backend_call_count_; + return REGISTRATION_IGNORED; } // MODEL_LOADED -> MODEL_STARTING.
diff --git a/components/sync/driver/fake_data_type_controller.h b/components/sync/driver/fake_data_type_controller.h index 7a7d7d5..cd5cfc4 100644 --- a/components/sync/driver/fake_data_type_controller.h +++ b/components/sync/driver/fake_data_type_controller.h
@@ -31,8 +31,8 @@ bool ShouldLoadModelBeforeConfigure() const override; void LoadModels(const ConfigureContext& configure_context, const ModelLoadCallback& model_load_callback) override; - void RegisterWithBackend(base::OnceCallback<void(bool)> set_downloaded, - ModelTypeConfigurer* configurer) override; + RegisterWithBackendResult RegisterWithBackend( + ModelTypeConfigurer* configurer) override; void StartAssociating(StartCallback start_callback) override; void Stop(ShutdownReason shutdown_reason) override; ChangeProcessor* GetChangeProcessor() const override;
diff --git a/components/sync/driver/frontend_data_type_controller_unittest.cc b/components/sync/driver/frontend_data_type_controller_unittest.cc index cd7062b9..beb4bbb6 100644 --- a/components/sync/driver/frontend_data_type_controller_unittest.cc +++ b/components/sync/driver/frontend_data_type_controller_unittest.cc
@@ -138,7 +138,7 @@ void PumpLoop() { base::RunLoop().RunUntilIdle(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; ModelAssociatorMock* model_associator_; ChangeProcessorMock* change_processor_; std::unique_ptr<ModelAssociatorMock> model_associator_deleter_;
diff --git a/components/sync/driver/generic_change_processor_unittest.cc b/components/sync/driver/generic_change_processor_unittest.cc index 9726db3..920a017b 100644 --- a/components/sync/driver/generic_change_processor_unittest.cc +++ b/components/sync/driver/generic_change_processor_unittest.cc
@@ -39,8 +39,7 @@ static const ModelType kType = PREFERENCES; SyncGenericChangeProcessorTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), syncable_service_ptr_factory_(&fake_syncable_service_) {} void SetUp() override { @@ -101,7 +100,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<SyncMergeResult> sync_merge_result_; std::unique_ptr<base::WeakPtrFactory<SyncMergeResult>>
diff --git a/components/sync/driver/glue/sync_engine_impl_unittest.cc b/components/sync/driver/glue/sync_engine_impl_unittest.cc index 302d8a7..8b05c81 100644 --- a/components/sync/driver/glue/sync_engine_impl_unittest.cc +++ b/components/sync/driver/glue/sync_engine_impl_unittest.cc
@@ -291,7 +291,7 @@ run_loop.Run(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; sync_preferences::TestingPrefServiceSyncable pref_service_; base::Thread sync_thread_;
diff --git a/components/sync/driver/model_association_manager_unittest.cc b/components/sync/driver/model_association_manager_unittest.cc index e5397ff..0e16fe8 100644 --- a/components/sync/driver/model_association_manager_unittest.cc +++ b/components/sync/driver/model_association_manager_unittest.cc
@@ -54,8 +54,8 @@ SyncModelAssociationManagerTest() {} protected: - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; MockModelAssociationManagerDelegate delegate_; DataTypeController::TypeMap controllers_; };
diff --git a/components/sync/driver/model_type_controller.cc b/components/sync/driver/model_type_controller.cc index 0b917a86..04caaec 100644 --- a/components/sync/driver/model_type_controller.cc +++ b/components/sync/driver/model_type_controller.cc
@@ -114,23 +114,22 @@ void ModelTypeController::BeforeLoadModels(ModelTypeConfigurer* configurer) {} -void ModelTypeController::RegisterWithBackend( - base::OnceCallback<void(bool)> set_downloaded, - ModelTypeConfigurer* configurer) { +DataTypeController::RegisterWithBackendResult +ModelTypeController::RegisterWithBackend(ModelTypeConfigurer* configurer) { DCHECK(CalledOnValidThread()); if (activated_) - return; + return REGISTRATION_IGNORED; DCHECK(configurer); DCHECK(activation_response_); DCHECK_EQ(MODEL_LOADED, state_); - // Inform the DataTypeManager whether our initial download is complete. - std::move(set_downloaded) - .Run(activation_response_->model_type_state.initial_sync_done()); + bool initial_sync_done = + activation_response_->model_type_state.initial_sync_done(); // Pass activation context to ModelTypeRegistry, where ModelTypeWorker gets // created and connected with the delegate (processor). configurer->ActivateNonBlockingDataType(type(), std::move(activation_response_)); activated_ = true; + return initial_sync_done ? TYPE_ALREADY_DOWNLOADED : TYPE_NOT_YET_DOWNLOADED; } void ModelTypeController::StartAssociating(StartCallback start_callback) {
diff --git a/components/sync/driver/model_type_controller.h b/components/sync/driver/model_type_controller.h index 6dd17a1a..8787373 100644 --- a/components/sync/driver/model_type_controller.h +++ b/components/sync/driver/model_type_controller.h
@@ -49,8 +49,8 @@ void BeforeLoadModels(ModelTypeConfigurer* configurer) override; void LoadModels(const ConfigureContext& configure_context, const ModelLoadCallback& model_load_callback) override; - void RegisterWithBackend(base::OnceCallback<void(bool)> set_downloaded, - ModelTypeConfigurer* configurer) override; + RegisterWithBackendResult RegisterWithBackend( + ModelTypeConfigurer* configurer) override; void StartAssociating(StartCallback start_callback) override; void ActivateDataType(ModelTypeConfigurer* configurer) override; void DeactivateDataType(ModelTypeConfigurer* configurer) override;
diff --git a/components/sync/driver/model_type_controller_unittest.cc b/components/sync/driver/model_type_controller_unittest.cc index e25f098d..a5665a1 100644 --- a/components/sync/driver/model_type_controller_unittest.cc +++ b/components/sync/driver/model_type_controller_unittest.cc
@@ -192,9 +192,10 @@ } void RegisterWithBackend(bool expect_downloaded) { - base::MockCallback<base::RepeatingCallback<void(bool)>> callback; - EXPECT_CALL(callback, Run(expect_downloaded)); - controller_.RegisterWithBackend(callback.Get(), &configurer_); + auto result = expect_downloaded + ? DataTypeController::TYPE_ALREADY_DOWNLOADED + : DataTypeController::TYPE_NOT_YET_DOWNLOADED; + EXPECT_EQ(result, controller_.RegisterWithBackend(&configurer_)); // ModelTypeProcessorProxy does posting of tasks. base::RunLoop().RunUntilIdle(); } @@ -223,7 +224,7 @@ TestModelTypeController* controller() { return &controller_; } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; NiceMock<MockDelegate> mock_delegate_; TestModelTypeConfigurer configurer_; TestModelTypeProcessor processor_; @@ -557,7 +558,7 @@ // Tests that StorageOption is honored when the controller has been constructed // with two delegates. TEST(ModelTypeControllerWithMultiDelegateTest, ToggleStorageOption) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; NiceMock<MockDelegate> delegate_on_disk; NiceMock<MockDelegate> delegate_in_memory;
diff --git a/components/sync/driver/profile_sync_service_startup_unittest.cc b/components/sync/driver/profile_sync_service_startup_unittest.cc index 8d2e1bc..40e28587 100644 --- a/components/sync/driver/profile_sync_service_startup_unittest.cc +++ b/components/sync/driver/profile_sync_service_startup_unittest.cc
@@ -59,8 +59,7 @@ class ProfileSyncServiceStartupTest : public testing::Test { public: ProfileSyncServiceStartupTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), sync_prefs_(profile_sync_service_bundle_.pref_service()) { profile_sync_service_bundle_.identity_test_env() ->SetAutomaticIssueOfAccessTokens(true); @@ -138,11 +137,11 @@ } void FastForwardUntilNoTasksRemain() { - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ProfileSyncServiceBundle profile_sync_service_bundle_; SyncPrefs sync_prefs_; std::unique_ptr<ProfileSyncService> sync_service_;
diff --git a/components/sync/driver/profile_sync_service_unittest.cc b/components/sync/driver/profile_sync_service_unittest.cc index 3776749..3f53f7b 100644 --- a/components/sync/driver/profile_sync_service_unittest.cc +++ b/components/sync/driver/profile_sync_service_unittest.cc
@@ -316,7 +316,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ProfileSyncServiceBundle profile_sync_service_bundle_; std::unique_ptr<ProfileSyncService> service_; };
diff --git a/components/sync/driver/shared_change_processor_unittest.cc b/components/sync/driver/shared_change_processor_unittest.cc index b131731..75ad7320 100644 --- a/components/sync/driver/shared_change_processor_unittest.cc +++ b/components/sync/driver/shared_change_processor_unittest.cc
@@ -119,7 +119,7 @@ did_connect_ = true; } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::Thread model_thread_; TestUserShare test_user_share_;
diff --git a/components/sync/driver/startup_controller_unittest.cc b/components/sync/driver/startup_controller_unittest.cc index 996ab84..c0c0ea6 100644 --- a/components/sync/driver/startup_controller_unittest.cc +++ b/components/sync/driver/startup_controller_unittest.cc
@@ -68,7 +68,7 @@ ModelTypeSet preferred_types_; bool should_start_; bool started_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<StartupController> controller_; };
diff --git a/components/sync/driver/sync_auth_manager_unittest.cc b/components/sync/driver/sync_auth_manager_unittest.cc index 2d80450..a5f2e8c 100644 --- a/components/sync/driver/sync_auth_manager_unittest.cc +++ b/components/sync/driver/sync_auth_manager_unittest.cc
@@ -55,7 +55,7 @@ signin::IdentityTestEnvironment* identity_env() { return &identity_env_; } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; signin::IdentityTestEnvironment identity_env_; };
diff --git a/components/sync/driver/sync_driver_switches.cc b/components/sync/driver/sync_driver_switches.cc index a536ef5..54b7123 100644 --- a/components/sync/driver/sync_driver_switches.cc +++ b/components/sync/driver/sync_driver_switches.cc
@@ -71,7 +71,7 @@ // Enable USS implementation of Bookmarks datatype. const base::Feature kSyncUSSBookmarks{"SyncUSSBookmarks", - base::FEATURE_ENABLED_BY_DEFAULT}; + base::FEATURE_DISABLED_BY_DEFAULT}; // Enable USS implementation of Passwords datatype. const base::Feature kSyncUSSPasswords{"SyncUSSPasswords",
diff --git a/components/sync/driver/sync_session_durations_metrics_recorder_unittest.cc b/components/sync/driver/sync_session_durations_metrics_recorder_unittest.cc index 1734766..f29366d 100644 --- a/components/sync/driver/sync_session_durations_metrics_recorder_unittest.cc +++ b/components/sync/driver/sync_session_durations_metrics_recorder_unittest.cc
@@ -70,7 +70,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; signin::IdentityTestEnvironment identity_test_env_; TestSyncService sync_service_;
diff --git a/components/sync/driver/sync_stopped_reporter_unittest.cc b/components/sync/driver/sync_stopped_reporter_unittest.cc index 4b8103c..1f92867 100644 --- a/components/sync/driver/sync_stopped_reporter_unittest.cc +++ b/components/sync/driver/sync_stopped_reporter_unittest.cc
@@ -75,7 +75,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; SyncStoppedReporter::Result request_result_;
diff --git a/components/sync/engine/net/http_bridge_unittest.cc b/components/sync/engine/net/http_bridge_unittest.cc index cf840a3..d591fcfc 100644 --- a/components/sync/engine/net/http_bridge_unittest.cc +++ b/components/sync/engine/net/http_bridge_unittest.cc
@@ -108,7 +108,7 @@ HttpBridge* bridge_for_race_test_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Separate thread for IO used by the HttpBridge. base::Thread io_thread_; };
diff --git a/components/sync/engine/sequenced_model_worker_unittest.cc b/components/sync/engine/sequenced_model_worker_unittest.cc index fb1946a..ab4df359 100644 --- a/components/sync/engine/sequenced_model_worker_unittest.cc +++ b/components/sync/engine/sequenced_model_worker_unittest.cc
@@ -66,7 +66,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; bool did_do_work_; scoped_refptr<base::SequencedTaskRunner> task_runner_; scoped_refptr<SequencedModelWorker> worker_;
diff --git a/components/sync/engine/sync_backend_registrar_unittest.cc b/components/sync/engine/sync_backend_registrar_unittest.cc index c51b4acef..97fe941 100644 --- a/components/sync/engine/sync_backend_registrar_unittest.cc +++ b/components/sync/engine/sync_backend_registrar_unittest.cc
@@ -105,7 +105,7 @@ } } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::Thread db_thread_; base::Thread sync_thread_;
diff --git a/components/sync/engine/ui_model_worker_unittest.cc b/components/sync/engine/ui_model_worker_unittest.cc index 825553e..f752a43 100644 --- a/components/sync/engine/ui_model_worker_unittest.cc +++ b/components/sync/engine/ui_model_worker_unittest.cc
@@ -56,8 +56,8 @@ } protected: - std::unique_ptr<base::test::ScopedTaskEnvironment> task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>(); + std::unique_ptr<base::test::TaskEnvironment> task_environment_ = + std::make_unique<base::test::TaskEnvironment>(); base::Thread sync_thread_; scoped_refptr<UIModelWorker> worker_; };
diff --git a/components/sync/engine_impl/apply_control_data_updates_unittest.cc b/components/sync/engine_impl/apply_control_data_updates_unittest.cc index c9abe18f..bc17fdb 100644 --- a/components/sync/engine_impl/apply_control_data_updates_unittest.cc +++ b/components/sync/engine_impl/apply_control_data_updates_unittest.cc
@@ -61,7 +61,7 @@ private: // Needed for directory init. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestDirectorySetterUpper dir_maker_; DISALLOW_COPY_AND_ASSIGN(ApplyControlDataUpdatesTest);
diff --git a/components/sync/engine_impl/directory_commit_contribution_unittest.cc b/components/sync/engine_impl/directory_commit_contribution_unittest.cc index 91664701..4b18b23 100644 --- a/components/sync/engine_impl/directory_commit_contribution_unittest.cc +++ b/components/sync/engine_impl/directory_commit_contribution_unittest.cc
@@ -93,7 +93,7 @@ private: // Neeed to initialize the directory. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestDirectorySetterUpper dir_maker_; };
diff --git a/components/sync/engine_impl/directory_update_handler_unittest.cc b/components/sync/engine_impl/directory_update_handler_unittest.cc index d6b5e62..a1c5893 100644 --- a/components/sync/engine_impl/directory_update_handler_unittest.cc +++ b/components/sync/engine_impl/directory_update_handler_unittest.cc
@@ -89,7 +89,7 @@ private: // Needed to initialize the directory. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestDirectorySetterUpper dir_maker_; scoped_refptr<FakeModelWorker> ui_worker_; }; @@ -543,7 +543,7 @@ private: // Needed to initialize the directory. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestDirectorySetterUpper dir_maker_; std::unique_ptr<TestEntryFactory> entry_factory_;
diff --git a/components/sync/engine_impl/js_mutation_event_observer_unittest.cc b/components/sync/engine_impl/js_mutation_event_observer_unittest.cc index 49f2424..640c6e0 100644 --- a/components/sync/engine_impl/js_mutation_event_observer_unittest.cc +++ b/components/sync/engine_impl/js_mutation_event_observer_unittest.cc
@@ -31,7 +31,7 @@ private: // This must be destroyed after the member variables below in order // for WeakHandles to be destroyed properly. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; protected: StrictMock<MockJsEventHandler> mock_js_event_handler_;
diff --git a/components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc b/components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc index 6104cea..c3c74c1 100644 --- a/components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc +++ b/components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc
@@ -36,7 +36,7 @@ private: // This must be destroyed after the member variables below in order // for WeakHandles to be destroyed properly. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; protected: StrictMock<MockJsEventHandler> mock_js_event_handler_;
diff --git a/components/sync/engine_impl/js_sync_manager_observer_unittest.cc b/components/sync/engine_impl/js_sync_manager_observer_unittest.cc index 2db7a91..56a82f5 100644 --- a/components/sync/engine_impl/js_sync_manager_observer_unittest.cc +++ b/components/sync/engine_impl/js_sync_manager_observer_unittest.cc
@@ -34,7 +34,7 @@ private: // This must be destroyed after the member variables below in order // for WeakHandles to be destroyed properly. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; protected: StrictMock<MockJsEventHandler> mock_js_event_handler_;
diff --git a/components/sync/engine_impl/model_type_registry_unittest.cc b/components/sync/engine_impl/model_type_registry_unittest.cc index 8c3e93d2..c8a217d 100644 --- a/components/sync/engine_impl/model_type_registry_unittest.cc +++ b/components/sync/engine_impl/model_type_registry_unittest.cc
@@ -103,7 +103,7 @@ return test_user_share_.user_share()->directory.get(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestUserShare test_user_share_; CancelationSignal cancelation_signal_;
diff --git a/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc b/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc index 98aa16de..88a3e6e 100644 --- a/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc +++ b/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc
@@ -582,7 +582,7 @@ std::unique_ptr<SyncEncryptionHandlerImpl> encryption_handler_; StrictMock<SyncEncryptionHandlerObserverMock> observer_; TestIdFactory ids_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::test::ScopedFeatureList feature_list_; base::RepeatingCallback<std::string()> fake_random_salt_generator_; };
diff --git a/components/sync/engine_impl/sync_manager_impl_unittest.cc b/components/sync/engine_impl/sync_manager_impl_unittest.cc index ae712c2c..32a2ca7 100644 --- a/components/sync/engine_impl/sync_manager_impl_unittest.cc +++ b/components/sync/engine_impl/sync_manager_impl_unittest.cc
@@ -252,7 +252,7 @@ PassphraseType GetPassphraseType(BaseTransaction* trans); private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestUserShare test_user_share_; }; @@ -1160,7 +1160,7 @@ private: // Needed by |sync_manager_|. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Needed by |sync_manager_|. base::ScopedTempDir temp_dir_; // Sync Id's for the roots of the enabled datatypes.
diff --git a/components/sync/engine_impl/sync_scheduler_impl_unittest.cc b/components/sync/engine_impl/sync_scheduler_impl_unittest.cc index 82ca0fa..a1fcd75 100644 --- a/components/sync/engine_impl/sync_scheduler_impl_unittest.cc +++ b/components/sync/engine_impl/sync_scheduler_impl_unittest.cc
@@ -96,8 +96,8 @@ public: SyncSchedulerImplTest() : task_environment_( - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::ASYNC, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + base::test::TaskEnvironment::ThreadPoolExecutionMode::ASYNC, + base::test::TaskEnvironment::TimeSource::MOCK_TIME), syncer_(nullptr), delay_(nullptr) {} @@ -304,7 +304,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; private: static const base::TickClock* tick_clock_;
diff --git a/components/sync/engine_impl/syncer_proto_util_unittest.cc b/components/sync/engine_impl/syncer_proto_util_unittest.cc index 41a9a9f..1d0b02c 100644 --- a/components/sync/engine_impl/syncer_proto_util_unittest.cc +++ b/components/sync/engine_impl/syncer_proto_util_unittest.cc
@@ -140,7 +140,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestDirectorySetterUpper dir_maker_; std::unique_ptr<SyncCycleContext> context_; };
diff --git a/components/sync/engine_impl/syncer_unittest.cc b/components/sync/engine_impl/syncer_unittest.cc index 2307002..0415464 100644 --- a/components/sync/engine_impl/syncer_unittest.cc +++ b/components/sync/engine_impl/syncer_unittest.cc
@@ -519,7 +519,7 @@ ASSERT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; // Some ids to aid tests. Only the root one's value is specific. The rest // are named for test clarity.
diff --git a/components/sync/engine_impl/syncer_util_unittest.cc b/components/sync/engine_impl/syncer_util_unittest.cc index fd8747f..7c937f8c 100644 --- a/components/sync/engine_impl/syncer_util_unittest.cc +++ b/components/sync/engine_impl/syncer_util_unittest.cc
@@ -66,7 +66,7 @@ sync_pb::SyncEntity update; UniquePosition test_position; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestDirectorySetterUpper dir_maker_; std::unique_ptr<TestEntryFactory> entry_factory_; };
diff --git a/components/sync/engine_impl/uss_migrator_unittest.cc b/components/sync/engine_impl/uss_migrator_unittest.cc index d3913f92..9a8cd8da 100644 --- a/components/sync/engine_impl/uss_migrator_unittest.cc +++ b/components/sync/engine_impl/uss_migrator_unittest.cc
@@ -103,7 +103,7 @@ private: syncable::Directory* directory() { return user_share()->directory.get(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestUserShare test_user_share_; CancelationSignal cancelation_signal_; std::unique_ptr<TestEntryFactory> entry_factory_;
diff --git a/components/sync/js/sync_js_controller_unittest.cc b/components/sync/js/sync_js_controller_unittest.cc index a96c92d5..dffa14f2e 100644 --- a/components/sync/js/sync_js_controller_unittest.cc +++ b/components/sync/js/sync_js_controller_unittest.cc
@@ -25,7 +25,7 @@ void PumpLoop() { base::RunLoop().RunUntilIdle(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(SyncJsControllerTest, Events) {
diff --git a/components/sync/model/sync_change_unittest.cc b/components/sync/model/sync_change_unittest.cc index b90c5364..dca84f9b 100644 --- a/components/sync/model/sync_change_unittest.cc +++ b/components/sync/model/sync_change_unittest.cc
@@ -23,7 +23,7 @@ class SyncChangeTest : public testing::Test { private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(SyncChangeTest, LocalDelete) {
diff --git a/components/sync/model/sync_data_unittest.cc b/components/sync/model/sync_data_unittest.cc index 6dda1848..a1127d3 100644 --- a/components/sync/model/sync_data_unittest.cc +++ b/components/sync/model/sync_data_unittest.cc
@@ -27,7 +27,7 @@ class SyncDataTest : public testing::Test { protected: SyncDataTest() = default; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; sync_pb::EntitySpecifics specifics; };
diff --git a/components/sync/model_impl/client_tag_based_model_type_processor_unittest.cc b/components/sync/model_impl/client_tag_based_model_type_processor_unittest.cc index 242d9571..4cc77a9 100644 --- a/components/sync/model_impl/client_tag_based_model_type_processor_unittest.cc +++ b/components/sync/model_impl/client_tag_based_model_type_processor_unittest.cc
@@ -373,7 +373,7 @@ // This sets SequencedTaskRunnerHandle on the current thread, which the type // processor will pick up as the sync task runner. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; // The current mock queue, which is owned by |type_processor()|. MockModelTypeWorker* worker_;
diff --git a/components/sync/model_impl/model_type_store_impl_unittest.cc b/components/sync/model_impl/model_type_store_impl_unittest.cc index 69a6ef8..97a494f 100644 --- a/components/sync/model_impl/model_type_store_impl_unittest.cc +++ b/components/sync/model_impl/model_type_store_impl_unittest.cc
@@ -176,7 +176,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<ModelTypeStore> store_; }; @@ -322,7 +322,7 @@ // Test that stores for different types that share the same backend don't // interfere with each other's records. TEST(ModelTypeStoreImplWithTwoStoreTest, TwoStoresWithSharedBackend) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<ModelTypeStore> store_1 = ModelTypeStoreTestUtil::CreateInMemoryStoreForTest(AUTOFILL); @@ -361,7 +361,7 @@ // Test that records that DeleteAllDataAndMetadata() does not delete data from // another store when the backend is shared. TEST(ModelTypeStoreImplWithTwoStoreTest, DeleteAllWithSharedBackend) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<ModelTypeStore> store_1 = ModelTypeStoreTestUtil::CreateInMemoryStoreForTest(AUTOFILL);
diff --git a/components/sync/model_impl/syncable_service_based_bridge_unittest.cc b/components/sync/model_impl/syncable_service_based_bridge_unittest.cc index 155e582..e22b4b1 100644 --- a/components/sync/model_impl/syncable_service_based_bridge_unittest.cc +++ b/components/sync/model_impl/syncable_service_based_bridge_unittest.cc
@@ -159,7 +159,7 @@ const std::string kClientTagHash = GenerateSyncableHash(kModelType, kClientTag); - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; testing::NiceMock<MockSyncableService> syncable_service_; testing::NiceMock<MockModelTypeChangeProcessor> mock_processor_; base::MockCallback<ModelErrorHandler> mock_error_handler_; @@ -526,7 +526,7 @@ ShouldDropIfCommitted) { const std::string kClientTagHash = "clienttaghash1"; - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<ModelTypeStore> store = ModelTypeStoreTestUtil::CreateInMemoryStoreForTest(); SyncableServiceBasedBridge::InMemoryStore in_memory_store; @@ -561,7 +561,7 @@ ShouldNotDropIfUnsynced) { const std::string kClientTagHash = "clienttaghash1"; - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<ModelTypeStore> store = ModelTypeStoreTestUtil::CreateInMemoryStoreForTest(); SyncableServiceBasedBridge::InMemoryStore in_memory_store;
diff --git a/components/sync/syncable/directory_backing_store_unittest.cc b/components/sync/syncable/directory_backing_store_unittest.cc index 0afd728..6d39c0f0 100644 --- a/components/sync/syncable/directory_backing_store_unittest.cc +++ b/components/sync/syncable/directory_backing_store_unittest.cc
@@ -115,7 +115,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; };
diff --git a/components/sync/syncable/directory_unittest.h b/components/sync/syncable/directory_unittest.h index 4227950..7cf91a0c 100644 --- a/components/sync/syncable/directory_unittest.h +++ b/components/sync/syncable/directory_unittest.h
@@ -94,7 +94,7 @@ int64_t server_version, bool is_del); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<Directory> dir_; NullDirectoryChangeDelegate delegate_; FakeEncryptor encryptor_;
diff --git a/components/sync/syncable/syncable_unittest.cc b/components/sync/syncable/syncable_unittest.cc index 55c0da9..608c10c 100644 --- a/components/sync/syncable/syncable_unittest.cc +++ b/components/sync/syncable/syncable_unittest.cc
@@ -136,7 +136,7 @@ #define MAYBE_FailInitialWrite FailInitialWrite #endif TEST(OnDiskSyncableDirectory, MAYBE_FailInitialWrite) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; FakeEncryptor encryptor; TestUnrecoverableErrorHandler handler; base::ScopedTempDir temp_dir; @@ -526,7 +526,7 @@ void TearDown() override {} protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; FakeEncryptor encryptor_; TestUnrecoverableErrorHandler handler_;
diff --git a/components/sync_bookmarks/bookmark_data_type_controller_unittest.cc b/components/sync_bookmarks/bookmark_data_type_controller_unittest.cc index b89dbfc..82caf9e 100644 --- a/components/sync_bookmarks/bookmark_data_type_controller_unittest.cc +++ b/components/sync_bookmarks/bookmark_data_type_controller_unittest.cc
@@ -125,7 +125,7 @@ history_service_->NotifyHistoryServiceLoaded(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; testing::NiceMock<syncer::SyncApiComponentFactoryMock> components_factory_; std::unique_ptr<BookmarkModel> bookmark_model_; std::unique_ptr<HistoryMock> history_service_;
diff --git a/components/sync_bookmarks/bookmark_model_type_processor.cc b/components/sync_bookmarks/bookmark_model_type_processor.cc index 52726c6..6816537a 100644 --- a/components/sync_bookmarks/bookmark_model_type_processor.cc +++ b/components/sync_bookmarks/bookmark_model_type_processor.cc
@@ -4,6 +4,7 @@ #include "components/sync_bookmarks/bookmark_model_type_processor.h" +#include <map> #include <utility> #include "base/bind.h" @@ -31,6 +32,7 @@ #include "components/sync_bookmarks/bookmark_remote_updates_handler.h" #include "components/sync_bookmarks/bookmark_specifics_conversions.h" #include "components/undo/bookmark_undo_utils.h" +#include "ui/base/models/tree_node_iterator.h" namespace sync_bookmarks { @@ -141,6 +143,24 @@ return ""; } +// Returns a map from id to node for all nodes in |model|. +std::map<int64_t, const bookmarks::BookmarkNode*> BuildIdToBookmarkNodeMap( + const bookmarks::BookmarkModel* model) { + std::map<int64_t, const bookmarks::BookmarkNode*> id_to_bookmark_node_map; + + // The TreeNodeIterator used below doesn't include the node itself, and hence + // add the root node separately. + id_to_bookmark_node_map[model->root_node()->id()] = model->root_node(); + + ui::TreeNodeIterator<const bookmarks::BookmarkNode> iterator( + model->root_node()); + while (iterator.has_next()) { + const bookmarks::BookmarkNode* node = iterator.Next(); + id_to_bookmark_node_map[node->id()] = node; + } + return id_to_bookmark_node_map; +} + } // namespace BookmarkModelTypeProcessor::BookmarkModelTypeProcessor( @@ -324,15 +344,14 @@ if (model_metadata.model_type_state().initial_sync_done() && SyncedBookmarkTracker::BookmarkModelMatchesMetadata(model, model_metadata)) { + std::map<int64_t, const bookmarks::BookmarkNode*> id_to_bookmark_node_map = + BuildIdToBookmarkNodeMap(bookmark_model_); std::vector<NodeMetadataPair> nodes_metadata; for (sync_pb::BookmarkMetadata& bookmark_metadata : *model_metadata.mutable_bookmarks_metadata()) { - // TODO(crbug.com/516866): Replace with a more efficient way to retrieve - // all nodes and store in a map keyed by id instead of doing a lookup for - // every id. const bookmarks::BookmarkNode* node = nullptr; if (!bookmark_metadata.metadata().is_deleted()) { - node = GetBookmarkNodeByID(bookmark_model_, bookmark_metadata.id()); + node = id_to_bookmark_node_map[bookmark_metadata.id()]; DCHECK(node); } auto metadata = std::make_unique<sync_pb::EntityMetadata>();
diff --git a/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc b/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc index 59c3faf..2218df1 100644 --- a/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc +++ b/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc
@@ -169,7 +169,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; NiceMock<base::MockCallback<base::RepeatingClosure>> schedule_save_closure_; BookmarkUndoService bookmark_undo_service_; NiceMock<favicon::MockFaviconService> favicon_service_;
diff --git a/components/sync_device_info/device_info_sync_bridge_unittest.cc b/components/sync_device_info/device_info_sync_bridge_unittest.cc index f8f8ad36..89003a4 100644 --- a/components/sync_device_info/device_info_sync_bridge_unittest.cc +++ b/components/sync_device_info/device_info_sync_bridge_unittest.cc
@@ -399,7 +399,7 @@ int change_count_ = 0; // In memory model type store needs to be able to post tasks. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; testing::NiceMock<MockModelTypeChangeProcessor> mock_processor_;
diff --git a/components/sync_sessions/favicon_cache_unittest.cc b/components/sync_sessions/favicon_cache_unittest.cc index 0a46b39..564eafb 100644 --- a/components/sync_sessions/favicon_cache_unittest.cc +++ b/components/sync_sessions/favicon_cache_unittest.cc
@@ -299,10 +299,10 @@ const std::string& icon_bytes, base::Time last_visit_time = base::Time::Now()); - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; testing::NiceMock<favicon::MockFaviconService> mock_favicon_service_; FaviconCache cache_; @@ -313,8 +313,7 @@ }; SyncFaviconCacheTest::SyncFaviconCacheTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), cache_(&mock_favicon_service_, nullptr, kMaxSyncFavicons), sync_processor_(new TestChangeProcessor), sync_processor_wrapper_(new syncer::SyncChangeProcessorWrapperForTest(
diff --git a/components/sync_sessions/lost_navigations_recorder_unittest.cc b/components/sync_sessions/lost_navigations_recorder_unittest.cc index f3efa70..89c6d91b 100644 --- a/components/sync_sessions/lost_navigations_recorder_unittest.cc +++ b/components/sync_sessions/lost_navigations_recorder_unittest.cc
@@ -121,7 +121,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; int _id; LostNavigationsRecorder recorder_; syncer::TestDirectorySetterUpper dir_maker_;
diff --git a/components/sync_sessions/proxy_tabs_data_type_controller.cc b/components/sync_sessions/proxy_tabs_data_type_controller.cc index ca6743ed..cea10db7 100644 --- a/components/sync_sessions/proxy_tabs_data_type_controller.cc +++ b/components/sync_sessions/proxy_tabs_data_type_controller.cc
@@ -46,9 +46,11 @@ model_load_callback.Run(type(), syncer::SyncError()); } -void ProxyTabsDataTypeController::RegisterWithBackend( - base::OnceCallback<void(bool)> set_downloaded, - syncer::ModelTypeConfigurer* configurer) {} +syncer::DataTypeController::RegisterWithBackendResult +ProxyTabsDataTypeController::RegisterWithBackend( + syncer::ModelTypeConfigurer* configurer) { + return REGISTRATION_IGNORED; +} void ProxyTabsDataTypeController::StartAssociating( StartCallback start_callback) {
diff --git a/components/sync_sessions/proxy_tabs_data_type_controller.h b/components/sync_sessions/proxy_tabs_data_type_controller.h index 9d31df7..b5ae7c6 100644 --- a/components/sync_sessions/proxy_tabs_data_type_controller.h +++ b/components/sync_sessions/proxy_tabs_data_type_controller.h
@@ -28,8 +28,8 @@ void BeforeLoadModels(syncer::ModelTypeConfigurer* configurer) override; void LoadModels(const syncer::ConfigureContext& configure_context, const ModelLoadCallback& model_load_callback) override; - void RegisterWithBackend(base::OnceCallback<void(bool)> set_downloaded, - syncer::ModelTypeConfigurer* configurer) override; + RegisterWithBackendResult RegisterWithBackend( + syncer::ModelTypeConfigurer* configurer) override; void StartAssociating(StartCallback start_callback) override; void Stop(syncer::ShutdownReason shutdown_reason, StopCallback callback) override;
diff --git a/components/sync_sessions/session_store_unittest.cc b/components/sync_sessions/session_store_unittest.cc index 3cc21fa4..a11929d 100644 --- a/components/sync_sessions/session_store_unittest.cc +++ b/components/sync_sessions/session_store_unittest.cc
@@ -175,7 +175,7 @@ ~SessionStoreOpenTest() override {} - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestingPrefServiceSimple pref_service_; SessionSyncPrefs session_sync_prefs_; std::unique_ptr<MockSyncSessionsClient> mock_sync_sessions_client_;
diff --git a/components/sync_sessions/session_sync_bridge_unittest.cc b/components/sync_sessions/session_sync_bridge_unittest.cc index f4ced44..6308226 100644 --- a/components/sync_sessions/session_sync_bridge_unittest.cc +++ b/components/sync_sessions/session_sync_bridge_unittest.cc
@@ -322,7 +322,7 @@ syncer::ModelTypeStore* underlying_store() { return store_.get(); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; const std::unique_ptr<syncer::ModelTypeStore> store_; // Dependencies.
diff --git a/components/sync_user_events/user_event_service_impl_unittest.cc b/components/sync_user_events/user_event_service_impl_unittest.cc index a0ca689..47d42ac 100644 --- a/components/sync_user_events/user_event_service_impl_unittest.cc +++ b/components/sync_user_events/user_event_service_impl_unittest.cc
@@ -78,7 +78,7 @@ MockModelTypeChangeProcessor* mock_processor() { return &mock_processor_; } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; syncer::TestSyncService sync_service_; testing::NiceMock<MockModelTypeChangeProcessor> mock_processor_; TestGlobalIdMapper mapper_;
diff --git a/components/sync_user_events/user_event_sync_bridge_unittest.cc b/components/sync_user_events/user_event_sync_bridge_unittest.cc index ed11221..ccaa0c0 100644 --- a/components/sync_user_events/user_event_sync_bridge_unittest.cc +++ b/components/sync_user_events/user_event_sync_bridge_unittest.cc
@@ -185,7 +185,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; testing::NiceMock<MockModelTypeChangeProcessor> mock_processor_; TestGlobalIdMapper test_global_id_mapper_; std::unique_ptr<UserEventSyncBridge> bridge_;
diff --git a/components/test/data/payments/has_enrolled_instrument.js b/components/test/data/payments/has_enrolled_instrument.js index 2bdb53c..5dfc165 100644 --- a/components/test/data/payments/has_enrolled_instrument.js +++ b/components/test/data/payments/has_enrolled_instrument.js
@@ -8,14 +8,20 @@ * Checks the hasEnrolledInstrument() value for 'basic-card' with the given * options. * @param {PaymentOptions} options - The payment options to use. - * @return {Promise<boolean>} The value of hasEnrolledInstrument(). + * @return {Promise<boolean|string>} The boolean value of + * hasEnrolledInstrument() or the error message string. */ -function hasEnrolledInstrument(options) { // eslint-disable-line no-unused-vars - return new PaymentRequest( - [{supportedMethods: 'basic-card'}], { - total: - {label: 'Total', amount: {currency: 'USD', value: '0.01'}}, - }, - options) - .hasEnrolledInstrument(); +async function hasEnrolledInstrument(options) { // eslint-disable-line no-unused-vars,max-len + try { + const result = + await new PaymentRequest( + [{supportedMethods: 'basic-card'}], { + total: {label: 'Total', amount: {currency: 'USD', value: '0.01'}}, + }, + options) + .hasEnrolledInstrument(); + return result; + } catch (e) { + return e.toString(); + } }
diff --git a/components/timers/alarm_timer_unittest.cc b/components/timers/alarm_timer_unittest.cc index 166144e..6e45727 100644 --- a/components/timers/alarm_timer_unittest.cc +++ b/components/timers/alarm_timer_unittest.cc
@@ -97,8 +97,8 @@ // that timers work properly in all configurations. TEST(AlarmTimerTest, SimpleAlarmTimer) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); base::RunLoop run_loop; bool did_run = false; @@ -112,8 +112,8 @@ } TEST(AlarmTimerTest, SimpleAlarmTimer_Cancel) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); bool did_run_a = false; AlarmTimerTester* a = @@ -140,8 +140,8 @@ // If underlying timer does not handle this properly, we will crash or fail // in full page heap environment. TEST(AlarmTimerTest, SelfDeletingAlarmTimer) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); base::RunLoop run_loop; bool did_run = false; @@ -155,8 +155,8 @@ } TEST(AlarmTimerTest, AlarmTimerZeroDelay) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); base::RunLoop run_loop; bool did_run = false; @@ -170,8 +170,8 @@ } TEST(AlarmTimerTest, AlarmTimerZeroDelay_Cancel) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); bool did_run_a = false; AlarmTimerTester* a = @@ -202,8 +202,8 @@ // if debug heap checking is enabled. bool did_run = false; { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); AlarmTimerTester a(&did_run, kTenMilliseconds, base::OnceClosure()); AlarmTimerTester b(&did_run, kTenMilliseconds, base::OnceClosure()); @@ -223,8 +223,8 @@ } TEST(AlarmTimerTest, NonRepeatIsRunning) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); auto timer = SimpleAlarmTimer::CreateForTesting(); EXPECT_FALSE(timer->IsRunning()); @@ -244,8 +244,8 @@ } TEST(AlarmTimerTest, RetainNonRepeatIsRunning) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); auto timer = SimpleAlarmTimer::CreateForTesting(); EXPECT_FALSE(timer->IsRunning()); @@ -290,8 +290,8 @@ TEST(AlarmTimerTest, ContinuationStopStart) { ClearAllCallbackHappened(); - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); auto timer = SimpleAlarmTimer::CreateForTesting(); timer->Start(FROM_HERE, base::TimeDelta::FromMilliseconds(10), @@ -311,8 +311,8 @@ TEST(AlarmTimerTest, ContinuationReset) { ClearAllCallbackHappened(); - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); base::RunLoop run_loop; auto timer = SimpleAlarmTimer::CreateForTesting(); @@ -328,8 +328,8 @@ // Verify that no crash occurs if a timer is deleted while its callback is // running. TEST(AlarmTimerTest, DeleteTimerWhileCallbackIsRunning) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); base::RunLoop run_loop; @@ -347,8 +347,8 @@ // Verify that no crash occurs if a zero-delay timer is deleted while its // callback is running. TEST(AlarmTimerTest, DeleteTimerWhileCallbackIsRunningZeroDelay) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); base::RunLoop run_loop; // Will be deleted by the callback.
diff --git a/components/tracing/child/background_tracing_agent_impl_unittest.cc b/components/tracing/child/background_tracing_agent_impl_unittest.cc index a32cb57..bbb6920 100644 --- a/components/tracing/child/background_tracing_agent_impl_unittest.cc +++ b/components/tracing/child/background_tracing_agent_impl_unittest.cc
@@ -68,7 +68,7 @@ BackgroundTracingAgentClientRecorder* recorder() const { return recorder_; } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; mojo::Remote<tracing::mojom::BackgroundTracingAgentProvider> provider_; mojo::Remote<tracing::mojom::BackgroundTracingAgent> agent_; mojo::UniqueReceiverSet<tracing::mojom::BackgroundTracingAgentProvider>
diff --git a/components/tracing/test/trace_event_perftest.cc b/components/tracing/test/trace_event_perftest.cc index 684a8d2..bc2a7c71 100644 --- a/components/tracing/test/trace_event_perftest.cc +++ b/components/tracing/test/trace_event_perftest.cc
@@ -90,7 +90,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; }; TEST_F(TraceEventPerfTest, Submit_10000_TRACE_EVENT0) {
diff --git a/components/translate/core/browser/translate_language_list_unittest.cc b/components/translate/core/browser/translate_language_list_unittest.cc index 2383276..acea5af 100644 --- a/components/translate/core/browser/translate_language_list_unittest.cc +++ b/components/translate/core/browser/translate_language_list_unittest.cc
@@ -31,7 +31,7 @@ "\"tl\":{\"en\":\"English\",\"ja\":\"Japanese\"}" "}"); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; network::TestURLLoaderFactory test_url_loader_factory; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory = base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( @@ -115,7 +115,7 @@ // list when translate is enabled by policy. TEST(TranslateLanguageListTest, GetSupportedLanguagesFetch) { // Set up fake network environment. - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; network::TestURLLoaderFactory test_url_loader_factory; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory = base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( @@ -168,7 +168,7 @@ // policy. TEST(TranslateLanguageListTest, GetSupportedLanguagesNoFetch) { // Set up fake network environment. - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; network::TestURLLoaderFactory test_url_loader_factory; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory = base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>(
diff --git a/components/translate/core/browser/translate_ranker_impl_unittest.cc b/components/translate/core/browser/translate_ranker_impl_unittest.cc index 1ab9980..3f0dd81 100644 --- a/components/translate/core/browser/translate_ranker_impl_unittest.cc +++ b/components/translate/core/browser/translate_ranker_impl_unittest.cc
@@ -79,7 +79,7 @@ private: // Sets up the task scheduling/task-runner environment for each test. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ukm::TestAutoSetUkmRecorder test_ukm_recorder_;
diff --git a/components/translate/core/browser/translate_script_unittest.cc b/components/translate/core/browser/translate_script_unittest.cc index 1ef1e10..7bdadd0 100644 --- a/components/translate/core/browser/translate_script_unittest.cc +++ b/components/translate/core/browser/translate_script_unittest.cc
@@ -55,7 +55,7 @@ const std::string& GetData() { return script_->data(); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } network::TestURLLoaderFactory* GetTestURLLoaderFactory() { return &test_url_loader_factory_; @@ -67,7 +67,7 @@ } // Sets up the task scheduling/task-runner environment for each test. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // The translate script. std::unique_ptr<TranslateScript> script_;
diff --git a/components/ui_devtools/css_agent_unittest.cc b/components/ui_devtools/css_agent_unittest.cc index fbbbedb1..acbbf5e9 100644 --- a/components/ui_devtools/css_agent_unittest.cc +++ b/components/ui_devtools/css_agent_unittest.cc
@@ -89,7 +89,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; using StyleArray = protocol::Array<protocol::CSS::CSSStyle>; std::pair<bool, std::unique_ptr<StyleArray>>
diff --git a/components/ui_devtools/devtools_server_unittest.cc b/components/ui_devtools/devtools_server_unittest.cc index e75b267..3f5a6067 100644 --- a/components/ui_devtools/devtools_server_unittest.cc +++ b/components/ui_devtools/devtools_server_unittest.cc
@@ -32,8 +32,8 @@ static constexpr int fake_port = 80; base::CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableUiDevTools); - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); network::mojom::NetworkServicePtr network_service_ptr; network::mojom::NetworkServiceRequest network_service_request =
diff --git a/components/ukm/app_source_url_recorder_test.cc b/components/ukm/app_source_url_recorder_test.cc index 444dedd4..0aba6eb 100644 --- a/components/ukm/app_source_url_recorder_test.cc +++ b/components/ukm/app_source_url_recorder_test.cc
@@ -29,7 +29,7 @@ } base::test::ScopedFeatureList scoped_feature_list_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestAutoSetUkmRecorder test_ukm_recorder_; };
diff --git a/components/ukm/content/source_url_recorder_browsertest.cc b/components/ukm/content/source_url_recorder_browsertest.cc index e61b3b2c..72969135 100644 --- a/components/ukm/content/source_url_recorder_browsertest.cc +++ b/components/ukm/content/source_url_recorder_browsertest.cc
@@ -94,7 +94,7 @@ GURL url = embedded_test_server()->GetURL("/title1.html"); content::NavigationHandleObserver observer(shell()->web_contents(), url); - content::NavigateToURL(shell(), url); + EXPECT_TRUE(content::NavigateToURL(shell(), url)); EXPECT_TRUE(observer.has_committed()); const ukm::UkmSource* source = GetSourceForNavigationId(observer.navigation_id()); @@ -130,7 +130,7 @@ main_url); content::NavigationHandleObserver subframe_observer(shell()->web_contents(), subframe_url); - content::NavigateToURL(shell(), main_url); + EXPECT_TRUE(content::NavigateToURL(shell(), main_url)); EXPECT_TRUE(main_observer.has_committed()); EXPECT_TRUE(main_observer.is_main_frame()); EXPECT_TRUE(subframe_observer.has_committed()); @@ -165,7 +165,7 @@ IgnoreDownload) { GURL url(embedded_test_server()->GetURL("/download-test1.lib")); content::NavigationHandleObserver observer(shell()->web_contents(), url); - content::NavigateToURL(shell(), url); + EXPECT_TRUE(content::NavigateToURLAndExpectNoCommit(shell(), url)); EXPECT_FALSE(observer.has_committed()); EXPECT_TRUE(observer.is_download()); EXPECT_EQ(nullptr, GetSourceForNavigationId(observer.navigation_id()));
diff --git a/components/ukm/ukm_service.cc b/components/ukm/ukm_service.cc index 581cbf7..66025adc 100644 --- a/components/ukm/ukm_service.cc +++ b/components/ukm/ukm_service.cc
@@ -78,8 +78,13 @@ bool restrict_to_whitelist_entries) : pref_service_(pref_service), restrict_to_whitelist_entries_(restrict_to_whitelist_entries), + client_id_(0), + session_id_(0), + report_count_(0), client_(client), - reporting_service_(client, pref_service) { + reporting_service_(client, pref_service), + initialize_started_(false), + initialize_complete_(false) { DCHECK(pref_service_); DCHECK(client_); DVLOG(1) << "UkmService::Constructor"; @@ -126,7 +131,6 @@ if (reporting_service_.reporting_active()) return; - log_creation_time_ = base::TimeTicks::Now(); metrics_providers_.OnRecordingEnabled(); if (!initialize_started_) @@ -256,8 +260,8 @@ metrics::MetricsLog::RecordCoreSystemProfile(client_, report.mutable_system_profile()); - metrics_providers_.ProvideSystemProfileMetricsWithLogCreationTime( - log_creation_time_, report.mutable_system_profile()); + metrics_providers_.ProvideSystemProfileMetrics( + report.mutable_system_profile()); std::string serialized_log; report.SerializeToString(&serialized_log);
diff --git a/components/ukm/ukm_service.h b/components/ukm/ukm_service.h index a510c285..067aac6 100644 --- a/components/ukm/ukm_service.h +++ b/components/ukm/ukm_service.h
@@ -128,13 +128,13 @@ bool restrict_to_whitelist_entries_; // The UKM client id stored in prefs. - uint64_t client_id_ = 0; + uint64_t client_id_; // The UKM session id stored in prefs. - int32_t session_id_ = 0; + int32_t session_id_; // The number of reports generated this session. - int32_t report_count_ = 0; + int32_t report_count_; // Used to interact with the embedder. Weak pointer; must outlive |this| // instance. @@ -149,13 +149,11 @@ // The scheduler for determining when uploads should happen. std::unique_ptr<metrics::MetricsRotationScheduler> scheduler_; - base::TimeTicks log_creation_time_; - - bool initialize_started_ = false; - bool initialize_complete_ = false; - SEQUENCE_CHECKER(sequence_checker_); + bool initialize_started_; + bool initialize_complete_; + // Weak pointers factory used to post task on different threads. All weak // pointers managed by this factory have the same lifetime as UkmService. base::WeakPtrFactory<UkmService> self_ptr_factory_{this};
diff --git a/components/unified_consent/unified_consent_service_unittest.cc b/components/unified_consent/unified_consent_service_unittest.cc index 1ff55483..33082bc 100644 --- a/components/unified_consent/unified_consent_service_unittest.cc +++ b/components/unified_consent/unified_consent_service_unittest.cc
@@ -89,7 +89,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable pref_service_; signin::IdentityTestEnvironment identity_test_environment_; TestSyncService sync_service_;
diff --git a/components/update_client/component_patcher_unittest.cc b/components/update_client/component_patcher_unittest.cc index 016401f..78b1cc8 100644 --- a/components/update_client/component_patcher_unittest.cc +++ b/components/update_client/component_patcher_unittest.cc
@@ -64,8 +64,7 @@ namespace update_client { ComponentPatcherOperationTest::ComponentPatcherOperationTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { EXPECT_TRUE(unpack_dir_.CreateUniqueTempDir()); EXPECT_TRUE(input_dir_.CreateUniqueTempDir()); EXPECT_TRUE(installed_dir_.CreateUniqueTempDir()); @@ -94,7 +93,7 @@ op->Run(command_args.get(), input_dir_.GetPath(), unpack_dir_.GetPath(), nullptr, base::BindOnce(&TestCallback::Set, base::Unretained(&callback))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(true, callback.called_); EXPECT_EQ(UnpackerError::kNone, callback.error_); @@ -122,7 +121,7 @@ op->Run(command_args.get(), input_dir_.GetPath(), unpack_dir_.GetPath(), installer_.get(), base::BindOnce(&TestCallback::Set, base::Unretained(&callback))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(true, callback.called_); EXPECT_EQ(UnpackerError::kNone, callback.error_); @@ -159,7 +158,7 @@ op->Run(command_args.get(), input_dir_.GetPath(), unpack_dir_.GetPath(), installer_.get(), base::BindOnce(&TestCallback::Set, base::Unretained(&callback))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(true, callback.called_); EXPECT_EQ(UnpackerError::kNone, callback.error_); @@ -197,7 +196,7 @@ op->Run(command_args.get(), input_dir_.GetPath(), unpack_dir_.GetPath(), installer_.get(), base::BindOnce(&TestCallback::Set, base::Unretained(&callback))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(true, callback.called_); EXPECT_EQ(UnpackerError::kNone, callback.error_);
diff --git a/components/update_client/component_patcher_unittest.h b/components/update_client/component_patcher_unittest.h index bf5168c3..419bc23 100644 --- a/components/update_client/component_patcher_unittest.h +++ b/components/update_client/component_patcher_unittest.h
@@ -29,7 +29,7 @@ ~ComponentPatcherOperationTest() override; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir input_dir_; base::ScopedTempDir installed_dir_; base::ScopedTempDir unpack_dir_;
diff --git a/components/update_client/component_unpacker_unittest.cc b/components/update_client/component_unpacker_unittest.cc index 617abcb..8a0315c 100644 --- a/components/update_client/component_unpacker_unittest.cc +++ b/components/update_client/component_unpacker_unittest.cc
@@ -78,7 +78,7 @@ protected: void RunThreads(); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_ = base::ThreadTaskRunnerHandle::Get(); base::RunLoop runloop_;
diff --git a/components/update_client/crx_downloader_unittest.cc b/components/update_client/crx_downloader_unittest.cc index 03c90026..40bbd3bb4 100644 --- a/components/update_client/crx_downloader_unittest.cc +++ b/components/update_client/crx_downloader_unittest.cc
@@ -91,7 +91,7 @@ static const int kExpectedContext = 0xaabb; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_url_loader_factory_; base::OnceClosure quit_closure_; @@ -109,8 +109,7 @@ crx_context_(0), num_download_complete_calls_(0), num_progress_calls_(0), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + task_environment_(base::test::TaskEnvironment::MainThreadType::IO), test_shared_url_loader_factory_( base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( &test_url_loader_factory_)) {} @@ -186,7 +185,7 @@ } void CrxDownloaderTest::RunThreadsUntilIdle() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::RunLoop().RunUntilIdle(); }
diff --git a/components/update_client/ping_manager_unittest.cc b/components/update_client/ping_manager_unittest.cc index 60d078c..ef4cc49 100644 --- a/components/update_client/ping_manager_unittest.cc +++ b/components/update_client/ping_manager_unittest.cc
@@ -58,13 +58,12 @@ std::string response_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::OnceClosure quit_closure_; }; PingManagerTest::PingManagerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { config_ = base::MakeRefCounted<TestConfigurator>(); } @@ -75,7 +74,7 @@ void PingManagerTest::TearDown() { // Run the threads until they are idle to allow the clean up // of the network interceptors on the IO thread. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ping_manager_ = nullptr; }
diff --git a/components/update_client/request_sender_unittest.cc b/components/update_client/request_sender_unittest.cc index e1e16d8..c27a5f0 100644 --- a/components/update_client/request_sender_unittest.cc +++ b/components/update_client/request_sender_unittest.cc
@@ -57,7 +57,7 @@ void Quit(); void RunThreads(); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<TestConfigurator> config_; std::unique_ptr<RequestSender> request_sender_; @@ -76,8 +76,7 @@ INSTANTIATE_TEST_SUITE_P(IsForeground, RequestSenderTest, ::testing::Bool()); RequestSenderTest::RequestSenderTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} RequestSenderTest::~RequestSenderTest() {} @@ -101,7 +100,7 @@ // Run the threads until they are idle to allow the clean up // of the network interceptors on the IO thread. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); config_ = nullptr; }
diff --git a/components/update_client/update_checker_unittest.cc b/components/update_client/update_checker_unittest.cc index b7f2540f..c3da136 100644 --- a/components/update_client/update_checker_unittest.cc +++ b/components/update_client/update_checker_unittest.cc
@@ -151,7 +151,7 @@ private: scoped_refptr<UpdateContext> MakeMockUpdateContext() const; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::OnceClosure quit_closure_; DISALLOW_COPY_AND_ASSIGN(UpdateCheckerTest); @@ -161,8 +161,7 @@ INSTANTIATE_TEST_SUITE_P(Parameterized, UpdateCheckerTest, testing::Bool()); UpdateCheckerTest::UpdateCheckerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} UpdateCheckerTest::~UpdateCheckerTest() { } @@ -199,7 +198,7 @@ // The PostInterceptor requires the message loop to run to destruct correctly. // TODO(sorin): This is fragile and should be fixed. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void UpdateCheckerTest::RunThreads() {
diff --git a/components/update_client/update_client_unittest.cc b/components/update_client/update_client_unittest.cc index cf5f69c..d60fe54 100644 --- a/components/update_client/update_client_unittest.cc +++ b/components/update_client/update_client_unittest.cc
@@ -177,7 +177,7 @@ private: static constexpr int kNumWorkerThreads_ = 2; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop runloop_; scoped_refptr<update_client::TestConfigurator> config_ = @@ -201,7 +201,7 @@ void UpdateClientTest::RunThreads() { runloop_.Run(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } base::FilePath UpdateClientTest::TestFilePath(const char* file) {
diff --git a/components/upload_list/text_log_upload_list_unittest.cc b/components/upload_list/text_log_upload_list_unittest.cc index ec03b3b8..34effc35 100644 --- a/components/upload_list/text_log_upload_list_unittest.cc +++ b/components/upload_list/text_log_upload_list_unittest.cc
@@ -44,7 +44,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; DISALLOW_COPY_AND_ASSIGN(TextLogUploadListTest);
diff --git a/components/url_formatter/elide_url_unittest.cc b/components/url_formatter/elide_url_unittest.cc index 90b919f..d7b5f58 100644 --- a/components/url_formatter/elide_url_unittest.cc +++ b/components/url_formatter/elide_url_unittest.cc
@@ -266,8 +266,8 @@ TEST(TextEliderTest, TestElisionSpecialCases) { #if defined(OS_WIN) // Needed to bypass DCHECK in GetFallbackFont. - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); #endif const std::string kEllipsisStr(gfx::kEllipsis); const std::vector<Testcase> testcases = {
diff --git a/components/variations/child_process_field_trial_syncer_unittest.cc b/components/variations/child_process_field_trial_syncer_unittest.cc index 2dffaa0..399b925 100644 --- a/components/variations/child_process_field_trial_syncer_unittest.cc +++ b/components/variations/child_process_field_trial_syncer_unittest.cc
@@ -53,7 +53,7 @@ } // namespace TEST(ChildProcessFieldTrialSyncerTest, FieldTrialState) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; base::FieldTrialList field_trial_list(nullptr); // We don't use the descriptor here anyways so it's ok to pass -1. base::FieldTrialList::CreateTrialsFromCommandLine(
diff --git a/components/variations/service/variations_service_unittest.cc b/components/variations/service/variations_service_unittest.cc index a253b9b..65750a8 100644 --- a/components/variations/service/variations_service_unittest.cc +++ b/components/variations/service/variations_service_unittest.cc
@@ -336,7 +336,7 @@ network::TestNetworkConnectionTracker* network_tracker_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<metrics::TestEnabledStateProvider> enabled_state_provider_; std::unique_ptr<metrics::MetricsStateManager> metrics_state_manager_;
diff --git a/components/variations/synthetic_trial_registry_unittest.cc b/components/variations/synthetic_trial_registry_unittest.cc index 0ab9374..2d8b27f 100644 --- a/components/variations/synthetic_trial_registry_unittest.cc +++ b/components/variations/synthetic_trial_registry_unittest.cc
@@ -47,7 +47,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::FieldTrialList field_trial_list_;
diff --git a/components/variations/variations_crash_keys_unittest.cc b/components/variations/variations_crash_keys_unittest.cc index 633f2cd..0184a31 100644 --- a/components/variations/variations_crash_keys_unittest.cc +++ b/components/variations/variations_crash_keys_unittest.cc
@@ -42,7 +42,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::FieldTrialList field_trial_list_;
diff --git a/components/variations/variations_http_header_provider_unittest.cc b/components/variations/variations_http_header_provider_unittest.cc index 6e7823d..5a2c792 100644 --- a/components/variations/variations_http_header_provider_unittest.cc +++ b/components/variations/variations_http_header_provider_unittest.cc
@@ -61,7 +61,7 @@ }; TEST_F(VariationsHttpHeaderProviderTest, ForceVariationIds_Valid) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; VariationsHttpHeaderProvider provider; // Valid experiment ids. @@ -80,7 +80,7 @@ } TEST_F(VariationsHttpHeaderProviderTest, ForceVariationIds_ValidCommandLine) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; VariationsHttpHeaderProvider provider; // Valid experiment ids. @@ -99,7 +99,7 @@ } TEST_F(VariationsHttpHeaderProviderTest, ForceVariationIds_Invalid) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; VariationsHttpHeaderProvider provider; // Invalid experiment ids. @@ -122,7 +122,7 @@ } TEST_F(VariationsHttpHeaderProviderTest, OnFieldTrialGroupFinalized) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; base::FieldTrialList field_trial_list(nullptr); VariationsHttpHeaderProvider provider; provider.InitVariationIDsCacheIfNeeded(); @@ -171,7 +171,7 @@ } TEST_F(VariationsHttpHeaderProviderTest, GetVariationsString) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; base::FieldTrialList field_trial_list(nullptr); CreateTrialAndAssociateId("t1", "g1", GOOGLE_WEB_PROPERTIES, 123); @@ -185,7 +185,7 @@ } TEST_F(VariationsHttpHeaderProviderTest, GetVariationsVector) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; base::FieldTrialList field_trial_list(nullptr); CreateTrialAndAssociateId("t1", "g1", GOOGLE_WEB_PROPERTIES, 121);
diff --git a/components/variations/variations_id_collection_unittest.cc b/components/variations/variations_id_collection_unittest.cc index 2c4f4bb..72810f6 100644 --- a/components/variations/variations_id_collection_unittest.cc +++ b/components/variations/variations_id_collection_unittest.cc
@@ -74,7 +74,7 @@ VariationsIdCollection* collection() { return collection_.get(); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::FieldTrialList field_trial_list_; std::unique_ptr<VariationsIdCollection> collection_; std::vector<VariationID> new_ids_;
diff --git a/components/variations/variations_request_scheduler_mobile_unittest.cc b/components/variations/variations_request_scheduler_mobile_unittest.cc index 0598816..91b3f56 100644 --- a/components/variations/variations_request_scheduler_mobile_unittest.cc +++ b/components/variations/variations_request_scheduler_mobile_unittest.cc
@@ -49,7 +49,7 @@ } TEST(VariationsRequestSchedulerMobileTest, OnAppEnterForegroundNoRun) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestingPrefServiceSimple prefs; @@ -76,7 +76,7 @@ } TEST(VariationsRequestSchedulerMobileTest, OnAppEnterForegroundRun) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestingPrefServiceSimple prefs; @@ -102,7 +102,7 @@ } TEST(VariationsRequestSchedulerMobileTest, OnAppEnterForegroundOnStartup) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestingPrefServiceSimple prefs;
diff --git a/components/variations/variations_request_scheduler_unittest.cc b/components/variations/variations_request_scheduler_unittest.cc index f751e793..a3b2b0f 100644 --- a/components/variations/variations_request_scheduler_unittest.cc +++ b/components/variations/variations_request_scheduler_unittest.cc
@@ -12,7 +12,7 @@ namespace variations { TEST(VariationsRequestSchedulerTest, ScheduleFetchShortly) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; const base::Closure task = base::DoNothing(); VariationsRequestScheduler scheduler(task);
diff --git a/components/viz/common/gl_helper_benchmark.cc b/components/viz/common/gl_helper_benchmark.cc index 5e91c36b..03e4404 100644 --- a/components/viz/common/gl_helper_benchmark.cc +++ b/components/viz/common/gl_helper_benchmark.cc
@@ -118,7 +118,7 @@ base::CloseFile(f); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<gpu::GLInProcessContext> context_; gpu::gles2::GLES2Interface* gl_; std::unique_ptr<GLHelper> helper_;
diff --git a/components/web_resource/resource_request_allowed_notifier_unittest.cc b/components/web_resource/resource_request_allowed_notifier_unittest.cc index 58578123..42b1e90 100644 --- a/components/web_resource/resource_request_allowed_notifier_unittest.cc +++ b/components/web_resource/resource_request_allowed_notifier_unittest.cc
@@ -119,8 +119,8 @@ } private: - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; TestRequestAllowedNotifier resource_request_allowed_notifier_; TestingPrefServiceSimple prefs_; TestEulaAcceptedNotifier* eula_notifier_; // Weak, owned by RRAN.
diff --git a/components/web_resource/web_resource_service_unittest.cc b/components/web_resource/web_resource_service_unittest.cc index cfb127c..4a07151 100644 --- a/components/web_resource/web_resource_service_unittest.cc +++ b/components/web_resource/web_resource_service_unittest.cc
@@ -144,7 +144,7 @@ void CallStartFetch() { test_web_resource_service_->StartFetch(); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; std::unique_ptr<TestingPrefServiceSimple> local_state_;
diff --git a/content/browser/accessibility/accessibility_auralinux_browsertest.cc b/content/browser/accessibility/accessibility_auralinux_browsertest.cc index c2a4e060..f34d2da 100644 --- a/content/browser/accessibility/accessibility_auralinux_browsertest.cc +++ b/content/browser/accessibility/accessibility_auralinux_browsertest.cc
@@ -836,6 +836,13 @@ IN_PROC_BROWSER_TEST_F( AccessibilityAuraLinuxBrowserTest, MAYBE_TestSetCaretSetsSequentialFocusNavigationStartingPoint) { + auto is_focused = [](AtkObject* object) { + AtkStateSet* state_set = atk_object_ref_state_set(object); + bool result = atk_state_set_contains_state(state_set, ATK_STATE_FOCUSED); + g_object_unref(state_set); + return result; + }; + LoadInitialAccessibilityTreeFromHtml( R"HTML(<!DOCTYPE html> <html> @@ -848,7 +855,7 @@ 4 <a href="http://google.com">5</a> 6 - <a href="http://google.com">7</a> + <a href="http://google.com"><div>7</div></a> 8 </div> </body> @@ -858,12 +865,9 @@ AtkObject* document = GetRendererAccessible(); ASSERT_TRUE(ATK_IS_COMPONENT(document)); - AtkObject* parent_div = atk_object_ref_accessible_child(document, 0); - EXPECT_NE(parent_div, nullptr); - - AtkObject* child_2 = atk_object_ref_accessible_child(parent_div, 2); - AtkObject* child_3 = atk_object_ref_accessible_child(parent_div, 3); - AtkObject* child_7 = atk_object_ref_accessible_child(parent_div, 7); + AtkObject* child_2 = atk_object_ref_accessible_child(document, 2); + AtkObject* child_3 = atk_object_ref_accessible_child(document, 3); + AtkObject* child_7 = atk_object_ref_accessible_child(document, 7); EXPECT_NE(child_2, nullptr); EXPECT_NE(child_3, nullptr); EXPECT_NE(child_7, nullptr); @@ -886,15 +890,12 @@ SimulateKeyPress(shell()->web_contents(), ui::DomKey::TAB, ui::DomCode::TAB, ui::VKEY_TAB, false, false, false, false); waiter->WaitForNotification(); + ASSERT_TRUE(is_focused(child_3)); - AtkStateSet* state_set = atk_object_ref_state_set(child_3); - ASSERT_TRUE(atk_state_set_contains_state(state_set, ATK_STATE_FOCUSED)); - g_object_unref(state_set); - - // Now we repeat a similar test, but this time setting the caret offset - // on the parent node. In this case, the sequential navigation starting - // point should move to the appropriate child. - atk_text_set_caret_offset(ATK_TEXT(parent_div), 13); + // Now we repeat a similar test, but this time setting the caret offset on + // the document. In this case, the sequential navigation starting point + // should move to the appropriate child. + atk_text_set_caret_offset(ATK_TEXT(document), 13); SimulateKeyPress(shell()->web_contents(), ui::DomKey::TAB, ui::DomCode::TAB, ui::VKEY_TAB, false, false, false, false); waiter->WaitForNotification(); @@ -903,9 +904,7 @@ ui::VKEY_TAB, false, false, false, false); waiter->WaitForNotification(); - state_set = atk_object_ref_state_set(child_7); - ASSERT_TRUE(atk_state_set_contains_state(state_set, ATK_STATE_FOCUSED)); - g_object_unref(state_set); + ASSERT_TRUE(is_focused(child_7)); // Now test setting the caret in a node that can accept focus. That // node should actually receive focus. @@ -913,14 +912,21 @@ SimulateKeyPress(shell()->web_contents(), ui::DomKey::TAB, ui::DomCode::TAB, ui::VKEY_TAB, false, false, false, false); waiter->WaitForNotification(); - state_set = atk_object_ref_state_set(child_3); - ASSERT_TRUE(atk_state_set_contains_state(state_set, ATK_STATE_FOCUSED)); - g_object_unref(state_set); + ASSERT_TRUE(is_focused(child_3)); + AtkObject* link_section = atk_object_ref_accessible_child(child_7, 0); + EXPECT_NE(link_section, nullptr); + AtkObject* link_text = atk_object_ref_accessible_child(link_section, 0); + EXPECT_NE(link_text, nullptr); + atk_text_set_caret_offset(ATK_TEXT(link_text), 0); + waiter->WaitForNotification(); + ASSERT_TRUE(is_focused(child_7)); + + g_object_unref(link_section); + g_object_unref(link_text); g_object_unref(child_2); g_object_unref(child_3); g_object_unref(child_7); - g_object_unref(parent_div); } IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
diff --git a/content/browser/accessibility/browser_accessibility_unittest.cc b/content/browser/accessibility/browser_accessibility_unittest.cc index bc38af9..17bbb5a 100644 --- a/content/browser/accessibility/browser_accessibility_unittest.cc +++ b/content/browser/accessibility/browser_accessibility_unittest.cc
@@ -42,7 +42,7 @@ private: void SetUp() override; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityTest); };
diff --git a/content/browser/accessibility/one_shot_accessibility_tree_search_unittest.cc b/content/browser/accessibility/one_shot_accessibility_tree_search_unittest.cc index 1469a517..73e56a3b 100644 --- a/content/browser/accessibility/one_shot_accessibility_tree_search_unittest.cc +++ b/content/browser/accessibility/one_shot_accessibility_tree_search_unittest.cc
@@ -54,7 +54,7 @@ protected: void SetUp() override; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<BrowserAccessibilityManager> tree_;
diff --git a/content/browser/android/content_url_loader_factory.cc b/content/browser/android/content_url_loader_factory.cc index 26dd7ef..01b2eda 100644 --- a/content/browser/android/content_url_loader_factory.cc +++ b/content/browser/android/content_url_loader_factory.cc
@@ -159,7 +159,7 @@ // Set the mimetype of the response. GetMimeType(request, path, &head.mime_type); - if (!head.mime_type.empty() && head.headers) { + if (!head.mime_type.empty()) { head.headers = base::MakeRefCounted<net::HttpResponseHeaders>(""); head.headers->AddHeader( base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentType,
diff --git a/content/browser/appcache/appcache_disk_cache_unittest.cc b/content/browser/appcache/appcache_disk_cache_unittest.cc index b13c4a5..c347a39 100644 --- a/content/browser/appcache/appcache_disk_cache_unittest.cc +++ b/content/browser/appcache/appcache_disk_cache_unittest.cc
@@ -29,18 +29,18 @@ &AppCacheDiskCacheTest::OnComplete, base::Unretained(this)); } - void TearDown() override { scoped_task_environment_.RunUntilIdle(); } + void TearDown() override { task_environment_.RunUntilIdle(); } void FlushCacheTasks() { disk_cache::FlushCacheThreadForTesting(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void OnComplete(int err) { completion_results_.push_back(err); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir directory_; net::CompletionRepeatingCallback completion_callback_; std::vector<int> completion_results_;
diff --git a/content/browser/appcache/appcache_fuzzer.cc b/content/browser/appcache/appcache_fuzzer.cc index b3bf7cbe..cd0078c 100644 --- a/content/browser/appcache/appcache_fuzzer.cc +++ b/content/browser/appcache/appcache_fuzzer.cc
@@ -32,7 +32,7 @@ Env() : thread_bundle((base::CommandLine::Init(0, nullptr), TestTimeouts::Initialize(), - base::test::ScopedTaskEnvironment::MainThreadType::IO)) { + base::test::TaskEnvironment::MainThreadType::IO)) { logging::SetMinLogLevel(logging::LOG_FATAL); mojo::core::Init(); test_content_client = std::make_unique<TestContentClient>();
diff --git a/content/browser/appcache/appcache_group_unittest.cc b/content/browser/appcache/appcache_group_unittest.cc index 5b4e1f0..99f30e4 100644 --- a/content/browser/appcache/appcache_group_unittest.cc +++ b/content/browser/appcache/appcache_group_unittest.cc
@@ -102,7 +102,7 @@ class AppCacheGroupTest : public testing::Test { private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(AppCacheGroupTest, AddRemoveCache) {
diff --git a/content/browser/appcache/appcache_host_unittest.cc b/content/browser/appcache/appcache_host_unittest.cc index 7961969..3d0d299 100644 --- a/content/browser/appcache/appcache_host_unittest.cc +++ b/content/browser/appcache/appcache_host_unittest.cc
@@ -158,7 +158,7 @@ void SwapCacheCallback(bool result) { last_swap_result_ = result; } - TestBrowserThreadBundle scoped_task_environment_; + TestBrowserThreadBundle task_environment_; RenderViewHostTestEnabler rvh_enabler_; TestBrowserContext browser_context_; std::unique_ptr<TestWebContents> web_contents_;
diff --git a/content/browser/appcache/appcache_response_unittest.cc b/content/browser/appcache/appcache_response_unittest.cc index b274837..6ce294a 100644 --- a/content/browser/appcache/appcache_response_unittest.cc +++ b/content/browser/appcache/appcache_response_unittest.cc
@@ -70,8 +70,7 @@ } static void SetUpTestCase() { - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>(); + task_environment_ = std::make_unique<base::test::TaskEnvironment>(); io_thread_ = std::make_unique<base::Thread>("AppCacheResponseTest Thread"); base::Thread::Options options(base::MessagePumpType::IO, 0); io_thread_->StartWithOptions(options); @@ -79,7 +78,7 @@ static void TearDownTestCase() { io_thread_.reset(); - scoped_task_environment_.reset(); + task_environment_.reset(); } AppCacheResponseTest() {} @@ -798,14 +797,13 @@ bool write_callback_was_called_; static std::unique_ptr<base::Thread> io_thread_; - static std::unique_ptr<base::test::ScopedTaskEnvironment> - scoped_task_environment_; + static std::unique_ptr<base::test::TaskEnvironment> task_environment_; }; // static std::unique_ptr<base::Thread> AppCacheResponseTest::io_thread_; -std::unique_ptr<base::test::ScopedTaskEnvironment> - AppCacheResponseTest::scoped_task_environment_; +std::unique_ptr<base::test::TaskEnvironment> + AppCacheResponseTest::task_environment_; TEST_F(AppCacheResponseTest, ReadNonExistentResponse) { RunTestOnIOThread(&AppCacheResponseTest::ReadNonExistentResponse);
diff --git a/content/browser/appcache/appcache_storage_impl_unittest.cc b/content/browser/appcache/appcache_storage_impl_unittest.cc index f2477d9..a4fc3b07 100644 --- a/content/browser/appcache/appcache_storage_impl_unittest.cc +++ b/content/browser/appcache/appcache_storage_impl_unittest.cc
@@ -1777,7 +1777,7 @@ } // Data members -------------------------------------------------- - TestBrowserThreadBundle scoped_task_environment_; + TestBrowserThreadBundle task_environment_; base::OnceClosure test_finished_cb_; base::stack<base::OnceClosure> task_stack_;
diff --git a/content/browser/appcache/appcache_unittest.cc b/content/browser/appcache/appcache_unittest.cc index fa4e6b7..7c03406 100644 --- a/content/browser/appcache/appcache_unittest.cc +++ b/content/browser/appcache/appcache_unittest.cc
@@ -22,7 +22,7 @@ namespace content { class AppCacheTest : public testing::Test { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(AppCacheTest, CleanupUnusedCache) {
diff --git a/content/browser/appcache/chrome_appcache_service_unittest.cc b/content/browser/appcache/chrome_appcache_service_unittest.cc index 072f6d6a..af262beb 100644 --- a/content/browser/appcache/chrome_appcache_service_unittest.cc +++ b/content/browser/appcache/chrome_appcache_service_unittest.cc
@@ -43,7 +43,7 @@ class ChromeAppCacheServiceTest : public testing::Test { public: ChromeAppCacheServiceTest() - : thread_bundle_(base::test::ScopedTaskEnvironment::MainThreadType::IO), + : thread_bundle_(base::test::TaskEnvironment::MainThreadType::IO), kProtectedManifestURL(kProtectedManifest), kNormalManifestURL(kNormalManifest), kSessionOnlyManifestURL(kSessionOnlyManifest) {}
diff --git a/content/browser/appcache/mock_appcache_storage_unittest.cc b/content/browser/appcache/mock_appcache_storage_unittest.cc index 1c04a5c..94494c2 100644 --- a/content/browser/appcache/mock_appcache_storage_unittest.cc +++ b/content/browser/appcache/mock_appcache_storage_unittest.cc
@@ -85,7 +85,7 @@ }; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(MockAppCacheStorageTest, LoadCache_Miss) {
diff --git a/content/browser/background_fetch/background_fetch_registration_notifier_unittest.cc b/content/browser/background_fetch/background_fetch_registration_notifier_unittest.cc index a4e2e48..6a668d58 100644 --- a/content/browser/background_fetch/background_fetch_registration_notifier_unittest.cc +++ b/content/browser/background_fetch/background_fetch_registration_notifier_unittest.cc
@@ -127,12 +127,12 @@ void Notify(const std::string& unique_id, blink::mojom::BackgroundFetchRegistrationDataPtr registration) { notifier_->Notify(unique_id, *registration); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void NotifyRecordsUnavailable(const std::string& unique_id) { notifier_->NotifyRecordsUnavailable(unique_id); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void NotifyRequestCompleted(const std::string& unique_id, @@ -140,16 +140,16 @@ blink::mojom::FetchAPIResponsePtr response) { notifier_->NotifyRequestCompleted(unique_id, std::move(request), std::move(response)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void AddObservedUrl(const std::string& unique_id, const GURL& url) { notifier_->AddObservedUrl(unique_id, url); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<BackgroundFetchRegistrationNotifier> notifier_;
diff --git a/content/browser/background_fetch/storage/image_helpers_unittest.cc b/content/browser/background_fetch/storage/image_helpers_unittest.cc index 31ce889..67863d9 100644 --- a/content/browser/background_fetch/storage/image_helpers_unittest.cc +++ b/content/browser/background_fetch/storage/image_helpers_unittest.cc
@@ -49,7 +49,7 @@ } TEST(BackgroundFetchImageHelpers, SerializeRoundTrip) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; SkBitmap icon; icon.allocN32Pixels(42, 42);
diff --git a/content/browser/browser_thread_unittest.cc b/content/browser/browser_thread_unittest.cc index d54d723..ec522af3 100644 --- a/content/browser/browser_thread_unittest.cc +++ b/content/browser/browser_thread_unittest.cc
@@ -153,7 +153,7 @@ std::unique_ptr<BrowserProcessSubThread> ui_thread_; std::unique_ptr<BrowserProcessSubThread> io_thread_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Must be set before Release() to verify the deletion is intentional. Will be // run from the next call to Release(). mutable so it can be consumed from // Release(). @@ -298,12 +298,11 @@ class BrowserThreadWithCustomSchedulerTest : public testing::Test { private: - class ScopedTaskEnvironmentWithCustomScheduler - : public base::test::ScopedTaskEnvironment { + class TaskEnvironmentWithCustomScheduler + : public base::test::TaskEnvironment { public: - ScopedTaskEnvironmentWithCustomScheduler() - : base::test::ScopedTaskEnvironment( - SubclassCreatesDefaultTaskRunner{}) { + TaskEnvironmentWithCustomScheduler() + : base::test::TaskEnvironment(SubclassCreatesDefaultTaskRunner{}) { std::unique_ptr<BrowserUIThreadScheduler> browser_ui_thread_scheduler = BrowserUIThreadScheduler::CreateForTesting(sequence_manager(), GetTimeDomain()); @@ -319,7 +318,7 @@ ui_thread_->RegisterAsBrowserThread(); } - ~ScopedTaskEnvironmentWithCustomScheduler() override { + ~TaskEnvironmentWithCustomScheduler() override { ui_thread_.reset(); BrowserThreadImpl::ResetGlobalsForTesting(BrowserThread::IO); BrowserTaskExecutor::ResetForTesting(); @@ -333,7 +332,7 @@ using QueueType = BrowserTaskQueues::QueueType; protected: - ScopedTaskEnvironmentWithCustomScheduler scoped_task_environment_; + TaskEnvironmentWithCustomScheduler task_environment_; }; TEST_F(BrowserThreadWithCustomSchedulerTest, PostBestEffortTask) { @@ -348,7 +347,7 @@ best_effort_task.Get()); EXPECT_CALL(regular_task, Run); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); testing::Mock::VerifyAndClearExpectations(®ular_task);
diff --git a/content/browser/byte_stream_unittest.cc b/content/browser/byte_stream_unittest.cc index 0d617d3..6fdce48 100644 --- a/content/browser/byte_stream_unittest.cc +++ b/content/browser/byte_stream_unittest.cc
@@ -91,7 +91,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; private: int producing_seed_key_;
diff --git a/content/browser/child_process_task_port_provider_mac_unittest.cc b/content/browser/child_process_task_port_provider_mac_unittest.cc index 00e10f5..c243503dc 100644 --- a/content/browser/child_process_task_port_provider_mac_unittest.cc +++ b/content/browser/child_process_task_port_provider_mac_unittest.cc
@@ -121,7 +121,7 @@ } } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; ChildProcessTaskPortProvider provider_; base::WaitableEvent event_; std::vector<base::ProcessHandle> received_processes_;
diff --git a/content/browser/code_cache/generated_code_cache_unittest.cc b/content/browser/code_cache/generated_code_cache_unittest.cc index 04e0ad9..9a5fead 100644 --- a/content/browser/code_cache/generated_code_cache_unittest.cc +++ b/content/browser/code_cache/generated_code_cache_unittest.cc
@@ -30,7 +30,7 @@ void TearDown() override { disk_cache::FlushCacheThreadForTesting(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // This function initializes the cache and waits till the transaction is @@ -43,7 +43,7 @@ GURL url(kInitialUrl); GURL origin_lock = GURL(kInitialOrigin); WriteToCache(url, origin_lock, kInitialData, base::Time::Now()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // This function initializes the cache and reopens it. When this function @@ -91,7 +91,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<GeneratedCodeCache> generated_code_cache_; base::ScopedTempDir cache_dir_; std::string received_data_; @@ -114,9 +114,9 @@ std::string data = "SerializedCodeForScript"; base::Time response_time = base::Time::Now(); WriteToCache(url, origin_lock, data, response_time); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); FetchFromCache(url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); EXPECT_EQ(data, received_data_); @@ -129,7 +129,7 @@ InitializeCache(GeneratedCodeCache::CodeCacheType::kJavaScript); FetchFromCache(url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); EXPECT_EQ(kInitialData, received_data_); @@ -143,9 +143,9 @@ std::string data = "SerializedCodeForScript"; base::Time response_time = base::Time::Now(); WriteToCache(new_url, origin_lock, data, response_time); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); FetchFromCache(new_url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); EXPECT_EQ(data, received_data_); @@ -159,7 +159,7 @@ InitializeCache(GeneratedCodeCache::CodeCacheType::kJavaScript); DeleteFromCache(url, origin_lock); FetchFromCache(url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); ASSERT_TRUE(received_null_); @@ -172,9 +172,9 @@ InitializeCache(GeneratedCodeCache::CodeCacheType::kJavaScript); base::Time response_time = base::Time::Now(); WriteToCache(url, origin_lock, std::string(), response_time); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); FetchFromCache(url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); ASSERT_TRUE(received_null_); @@ -189,9 +189,9 @@ base::Time response_time = base::Time::Now(); std::string too_big_data(kMaxSizeInBytes * 8, 0); WriteToCache(url, origin_lock, too_big_data, response_time); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); FetchFromCache(url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Fetch should return empty data, with invalid response time. ASSERT_TRUE(received_); @@ -205,7 +205,7 @@ InitializeCacheAndReOpen(GeneratedCodeCache::CodeCacheType::kJavaScript); FetchFromCache(url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); EXPECT_EQ(kInitialData, received_data_); @@ -219,9 +219,9 @@ std::string data = "SerializedCodeForScript"; base::Time response_time = base::Time::Now(); WriteToCache(new_url, origin_lock, data, response_time); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); FetchFromCache(new_url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); EXPECT_EQ(data, received_data_); @@ -235,7 +235,7 @@ InitializeCacheAndReOpen(GeneratedCodeCache::CodeCacheType::kJavaScript); DeleteFromCache(url, origin_lock); FetchFromCache(url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); ASSERT_TRUE(received_null_); @@ -249,9 +249,9 @@ std::string new_data = "SerializedCodeForScriptOverwrite"; base::Time response_time = base::Time::Now(); WriteToCache(url, origin_lock, new_data, response_time); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); FetchFromCache(url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); EXPECT_EQ(new_data, received_data_); @@ -262,7 +262,7 @@ InitializeCache(GeneratedCodeCache::CodeCacheType::kJavaScript); GURL new_origin_lock = GURL("http://not-example.com"); FetchFromCache(GURL(kInitialUrl), new_origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); ASSERT_TRUE(received_null_); @@ -279,15 +279,15 @@ std::string data_second_resource = "SerializedCodeForSecondResource"; WriteToCache(second_url, origin_lock, data_second_resource, base::Time()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); FetchFromCache(url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); EXPECT_EQ(data_first_resource, received_data_); FetchFromCache(second_url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); EXPECT_EQ(data_second_resource, received_data_); } @@ -303,15 +303,15 @@ std::string data_origin1 = "SerializedCodeForSecondOrigin"; WriteToCache(url, origin_lock1, data_origin1, base::Time()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); FetchFromCache(url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); EXPECT_EQ(data_origin, received_data_); FetchFromCache(url, origin_lock1); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); EXPECT_EQ(data_origin1, received_data_); } @@ -323,10 +323,10 @@ InitializeCache(GeneratedCodeCache::CodeCacheType::kJavaScript); std::string data = "SerializedCodeForEmptyOrigin"; WriteToCache(url, origin_lock, data, base::Time()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); FetchFromCache(url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); EXPECT_EQ(data, received_data_); } @@ -339,19 +339,19 @@ InitializeCache(GeneratedCodeCache::CodeCacheType::kJavaScript); std::string empty_origin_data = "SerializedCodeForEmptyOrigin"; WriteToCache(url, empty_origin_lock, empty_origin_data, base::Time()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::string valid_origin_data = "SerializedCodeForValidOrigin"; WriteToCache(url, origin_lock, valid_origin_data, base::Time()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); FetchFromCache(url, empty_origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); EXPECT_EQ(empty_origin_data, received_data_); FetchFromCache(url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); EXPECT_EQ(valid_origin_data, received_data_); } @@ -362,7 +362,7 @@ InitializeCache(GeneratedCodeCache::CodeCacheType::kWebAssembly); FetchFromCache(url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(received_); EXPECT_EQ(kInitialData, received_data_); @@ -376,7 +376,7 @@ cache_path_.clear(); InitializeCacheAndReOpen(GeneratedCodeCache::CodeCacheType::kJavaScript); FetchFromCache(url, origin_lock); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // We should still receive a callback. ASSERT_TRUE(received_);
diff --git a/content/browser/compositor/reflector_impl_unittest.cc b/content/browser/compositor/reflector_impl_unittest.cc index e548c2e..72091ed 100644 --- a/content/browser/compositor/reflector_impl_unittest.cc +++ b/content/browser/compositor/reflector_impl_unittest.cc
@@ -203,7 +203,7 @@ std::unique_ptr<ui::TestContextFactories> context_factories_; scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; std::unique_ptr<viz::SyntheticBeginFrameSource> begin_frame_source_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; std::unique_ptr<ui::Compositor> compositor_; std::unique_ptr<ui::Layer> root_layer_;
diff --git a/content/browser/devtools/devtools_video_consumer_unittest.cc b/content/browser/devtools/devtools_video_consumer_unittest.cc index 801eea2..579857b 100644 --- a/content/browser/devtools/devtools_video_consumer_unittest.cc +++ b/content/browser/devtools/devtools_video_consumer_unittest.cc
@@ -233,7 +233,7 @@ weak_factory_.GetWeakPtr())); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::WeakPtrFactory<DevToolsVideoConsumerTest> weak_factory_{this}; };
diff --git a/content/browser/dom_storage/dom_storage_context_wrapper_unittest.cc b/content/browser/dom_storage/dom_storage_context_wrapper_unittest.cc index 79852de3..a795b549 100644 --- a/content/browser/dom_storage/dom_storage_context_wrapper_unittest.cc +++ b/content/browser/dom_storage/dom_storage_context_wrapper_unittest.cc
@@ -47,7 +47,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::TestSimpleTaskRunner> fake_mojo_task_runner_; scoped_refptr<MockSpecialStoragePolicy> storage_policy_; scoped_refptr<DOMStorageContextWrapper> context_;
diff --git a/content/browser/dom_storage/session_storage_metadata_unittest.cc b/content/browser/dom_storage/session_storage_metadata_unittest.cc index 39b4b62..cab81c3 100644 --- a/content/browser/dom_storage/session_storage_metadata_unittest.cc +++ b/content/browser/dom_storage/session_storage_metadata_unittest.cc
@@ -125,7 +125,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::string test_namespace1_id_; std::string test_namespace2_id_; std::string test_namespace3_id_; @@ -388,7 +388,7 @@ leveldb::DB* db() { return old_ss_database_->db(); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_path_; std::string test_namespace1_id_; std::string test_namespace2_id_;
diff --git a/content/browser/fileapi/file_system_operation_runner_unittest.cc b/content/browser/fileapi/file_system_operation_runner_unittest.cc index e32aafb..77b3a6c 100644 --- a/content/browser/fileapi/file_system_operation_runner_unittest.cc +++ b/content/browser/fileapi/file_system_operation_runner_unittest.cc
@@ -87,7 +87,7 @@ private: base::ScopedTempDir base_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<FileSystemContext> file_system_context_; DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunnerTest);
diff --git a/content/browser/frame_host/render_frame_message_filter_browsertest.cc b/content/browser/frame_host/render_frame_message_filter_browsertest.cc index 318f9b81..5cf74934 100644 --- a/content/browser/frame_host/render_frame_message_filter_browsertest.cc +++ b/content/browser/frame_host/render_frame_message_filter_browsertest.cc
@@ -302,18 +302,20 @@ void SetCookieFromString(const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, const std::string& cookie, SetCookieFromStringCallback callback) override { GetForwardingInterface()->SetCookieFromString( - URLToUse(url), std::move(site_for_cookies), std::move(cookie), + URLToUse(url), site_for_cookies, top_frame_origin, std::move(cookie), std::move(callback)); } void GetCookiesString(const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, GetCookiesStringCallback callback) override { GetForwardingInterface()->GetCookiesString( - URLToUse(url), std::move(site_for_cookies), std::move(callback)); + URLToUse(url), site_for_cookies, top_frame_origin, std::move(callback)); } private:
diff --git a/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc b/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc index 6dac8e9..e585b3b 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc +++ b/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc
@@ -103,7 +103,7 @@ void TestBlockingDomainFrom3DAPIs(gpu::DomainGuilt guilt_level); void TestUnblockingDomainFrom3DAPIs(gpu::DomainGuilt guilt_level); - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; // We use new method instead of GetInstance() method because we want
diff --git a/content/browser/indexed_db/indexed_db_active_blob_registry_unittest.cc b/content/browser/indexed_db/indexed_db_active_blob_registry_unittest.cc index 7f93fda..c79c49d 100644 --- a/content/browser/indexed_db/indexed_db_active_blob_registry_unittest.cc +++ b/content/browser/indexed_db/indexed_db_active_blob_registry_unittest.cc
@@ -114,7 +114,7 @@ IndexedDBActiveBlobRegistry* registry() const { return registry_.get(); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::TestSimpleTaskRunner> task_runner_; std::unique_ptr<RegistryTestMockFactory> factory_; std::unique_ptr<MockIDBBackingStore> backing_store_;
diff --git a/content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc b/content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc index 739f8870..a87ad30 100644 --- a/content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc +++ b/content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc
@@ -33,7 +33,7 @@ namespace { TEST(IndexedDBIOErrorTest, CleanUpTest) { - base::test::ScopedTaskEnvironment task_env; + base::test::TaskEnvironment task_env; const url::Origin origin = url::Origin::Create(GURL("http://localhost:81")); base::ScopedTempDir temp_directory; ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); @@ -57,7 +57,7 @@ } TEST(IndexedDBNonRecoverableIOErrorTest, NuancedCleanupTest) { - base::test::ScopedTaskEnvironment task_env; + base::test::TaskEnvironment task_env; const url::Origin origin = url::Origin::Create(GURL("http://localhost:81")); base::ScopedTempDir temp_directory; ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
diff --git a/content/browser/indexed_db/indexed_db_factory_unittest.cc b/content/browser/indexed_db/indexed_db_factory_unittest.cc index 79561f9559..f55b06c 100644 --- a/content/browser/indexed_db/indexed_db_factory_unittest.cc +++ b/content/browser/indexed_db/indexed_db_factory_unittest.cc
@@ -207,7 +207,7 @@ public: IndexedDBFactoryTestWithMockTime() : IndexedDBFactoryTest(std::make_unique<TestBrowserThreadBundle>( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME)) {} + base::test::TaskEnvironment::TimeSource::MOCK_TIME)) {} private: DISALLOW_COPY_AND_ASSIGN(IndexedDBFactoryTestWithMockTime);
diff --git a/content/browser/indexed_db/indexed_db_pre_close_task_queue_unittest.cc b/content/browser/indexed_db/indexed_db_pre_close_task_queue_unittest.cc index ca21f71..c78d9501 100644 --- a/content/browser/indexed_db/indexed_db_pre_close_task_queue_unittest.cc +++ b/content/browser/indexed_db/indexed_db_pre_close_task_queue_unittest.cc
@@ -77,7 +77,7 @@ protected: std::vector<IndexedDBDatabaseMetadata> metadata_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(IndexedDBPreCloseTaskQueueTest, NoTasks) { @@ -121,7 +121,7 @@ // Expect calls are posted as tasks. EXPECT_CALL(*task, RunRound()).WillOnce(testing::Return(true)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(metadata_called); EXPECT_TRUE(done_called); @@ -164,7 +164,7 @@ EXPECT_FALSE(queue.done()); EXPECT_CALL(*task, RunRound()).WillOnce(testing::Return(true)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(metadata_called); EXPECT_TRUE(done_called); @@ -247,7 +247,7 @@ queue.StopForNewConnection(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(metadata_called); EXPECT_TRUE(done_called); @@ -287,7 +287,7 @@ queue.StopForNewConnection(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(metadata_called); EXPECT_TRUE(done_called); @@ -331,7 +331,7 @@ queue.StopForNewConnection(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(metadata_called); EXPECT_TRUE(done_called); @@ -376,7 +376,7 @@ fake_timer->Fire(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(metadata_called); EXPECT_TRUE(done_called); @@ -405,7 +405,7 @@ queue.Start(base::BindOnce(&MetadataFetcher, &metadata_called, leveldb::Status::IOError(""), &metadata_)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(metadata_called); EXPECT_TRUE(done_called);
diff --git a/content/browser/indexed_db/leveldb/transactional_leveldb_unittest.cc b/content/browser/indexed_db/leveldb/transactional_leveldb_unittest.cc index 1692da7c..e6f5248 100644 --- a/content/browser/indexed_db/leveldb/transactional_leveldb_unittest.cc +++ b/content/browser/indexed_db/leveldb/transactional_leveldb_unittest.cc
@@ -79,7 +79,7 @@ return leveldb::Status::OK(); } - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; std::unique_ptr<DisjointRangeLockManager> lock_manager_; std::unique_ptr<TransactionalLevelDBDatabase> leveldb_database_; };
diff --git a/content/browser/indexed_db/scopes/disjoint_range_lock_manager_unittest.cc b/content/browser/indexed_db/scopes/disjoint_range_lock_manager_unittest.cc index 8e72d73..11a0e0a7 100644 --- a/content/browser/indexed_db/scopes/disjoint_range_lock_manager_unittest.cc +++ b/content/browser/indexed_db/scopes/disjoint_range_lock_manager_unittest.cc
@@ -35,7 +35,7 @@ ~DisjointRangeLockManagerTest() override = default; private: - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; }; TEST_F(DisjointRangeLockManagerTest, BasicAcquisition) {
diff --git a/content/browser/indexed_db/scopes/leveldb_scopes_test_utils.h b/content/browser/indexed_db/scopes/leveldb_scopes_test_utils.h index 3bc5f82..53b9c4d6 100644 --- a/content/browser/indexed_db/scopes/leveldb_scopes_test_utils.h +++ b/content/browser/indexed_db/scopes/leveldb_scopes_test_utils.h
@@ -95,7 +95,7 @@ protected: base::ScopedAllowBaseSyncPrimitivesForTesting allow_; - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; base::ScopedTempDir temp_directory_; const std::string simple_lock_begin_ = "0000000001";
diff --git a/content/browser/loader/data_pipe_to_source_stream_unittest.cc b/content/browser/loader/data_pipe_to_source_stream_unittest.cc index 97a0bf9..8b09b289 100644 --- a/content/browser/loader/data_pipe_to_source_stream_unittest.cc +++ b/content/browser/loader/data_pipe_to_source_stream_unittest.cc
@@ -110,7 +110,7 @@ void CloseAdapter() { adapter_ = nullptr; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<net::IOBufferWithSize> output_buffer_; std::unique_ptr<DataPipeToSourceStream> adapter_; mojo::ScopedDataPipeProducerHandle producer_end_;
diff --git a/content/browser/loader/source_stream_to_data_pipe_unittest.cc b/content/browser/loader/source_stream_to_data_pipe_unittest.cc index 6214612..a83dc08 100644 --- a/content/browser/loader/source_stream_to_data_pipe_unittest.cc +++ b/content/browser/loader/source_stream_to_data_pipe_unittest.cc
@@ -102,13 +102,13 @@ mojo::DataPipeConsumerHandle consumer_end() { return consumer_end_.get(); } void CloseConsumerHandle() { consumer_end_.reset(); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } base::Optional<int> CallbackResult() { return callback_result_; } private: void FinishedReading(int result) { callback_result_ = result; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::MockSourceStream* source_; std::unique_ptr<SourceStreamToDataPipe> adapter_; mojo::ScopedDataPipeConsumerHandle consumer_end_;
diff --git a/content/browser/media/android/media_resource_getter_impl.cc b/content/browser/media/android/media_resource_getter_impl.cc index 9abb72cd..1428d7d5 100644 --- a/content/browser/media/android/media_resource_getter_impl.cc +++ b/content/browser/media/android/media_resource_getter_impl.cc
@@ -23,6 +23,7 @@ #include "net/http/http_auth.h" #include "services/network/public/mojom/restricted_cookie_manager.mojom.h" #include "url/gurl.h" +#include "url/origin.h" namespace content { @@ -146,8 +147,11 @@ browser_context_, url, render_process_id_, render_frame_id_); network::mojom::RestrictedCookieManager* cookie_manager_ptr = cookie_manager.get(); + // TODO(crbug.com/988398): Same check as in mojo_renderer_service.cc. Is this + // correct? + DCHECK(!site_for_cookies.is_empty()); cookie_manager_ptr->GetCookiesString( - url, site_for_cookies, + url, site_for_cookies, url::Origin::Create(site_for_cookies), base::BindOnce(&ReturnResultOnUIThreadAndClosePipe, std::move(cookie_manager), std::move(callback))); }
diff --git a/content/browser/media/audio_output_stream_broker_unittest.cc b/content/browser/media/audio_output_stream_broker_unittest.cc index 3fde99b..ba35dbe74 100644 --- a/content/browser/media/audio_output_stream_broker_unittest.cc +++ b/content/browser/media/audio_output_stream_broker_unittest.cc
@@ -152,7 +152,7 @@ void RunUntilIdle() { env.RunUntilIdle(); } - base::test::ScopedTaskEnvironment env; + base::test::TaskEnvironment env; base::UnguessableToken group; MockDeleterCallback deleter; StrictMock<MockAudioOutputStreamProviderClient> provider_client; @@ -164,7 +164,7 @@ } // namespace TEST(AudioOutputStreamBrokerTest, StoresProcessAndFrameId) { - base::test::ScopedTaskEnvironment env; + base::test::TaskEnvironment env; MockDeleterCallback deleter; StrictMock<MockAudioOutputStreamProviderClient> provider_client;
diff --git a/content/browser/media/capture/lame_capture_overlay_chromeos_unittest.cc b/content/browser/media/capture/lame_capture_overlay_chromeos_unittest.cc index 4af85e5..c7c37366 100644 --- a/content/browser/media/capture/lame_capture_overlay_chromeos_unittest.cc +++ b/content/browser/media/capture/lame_capture_overlay_chromeos_unittest.cc
@@ -64,7 +64,7 @@ } private: - base::test::ScopedTaskEnvironment env_; + base::test::TaskEnvironment env_; }; TEST_F(LameCaptureOverlayChromeOSTest, UnsetImageNotRenderedOnFrame) {
diff --git a/content/browser/media/system_media_controls_notifier_unittest.cc b/content/browser/media/system_media_controls_notifier_unittest.cc index b3e39184..34b4a0a42 100644 --- a/content/browser/media/system_media_controls_notifier_unittest.cc +++ b/content/browser/media/system_media_controls_notifier_unittest.cc
@@ -26,8 +26,7 @@ class SystemMediaControlsNotifierTest : public testing::Test { public: SystemMediaControlsNotifierTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~SystemMediaControlsNotifierTest() override = default; void SetUp() override { @@ -89,7 +88,7 @@ base::OneShotTimer& hide_smtc_timer() { return notifier_->hide_smtc_timer_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<SystemMediaControlsNotifier> notifier_; system_media_controls::testing::MockSystemMediaControlsService mock_system_media_controls_service_;
diff --git a/content/browser/memory/swap_metrics_driver_impl_unittest.cc b/content/browser/memory/swap_metrics_driver_impl_unittest.cc index a0fb69de..cce8a33 100644 --- a/content/browser/memory/swap_metrics_driver_impl_unittest.cc +++ b/content/browser/memory/swap_metrics_driver_impl_unittest.cc
@@ -119,7 +119,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(TestSwapMetricsDriver, ExpectedMetricCounts) {
diff --git a/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc b/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc index 8930983..be51d67 100644 --- a/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc +++ b/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc
@@ -35,8 +35,7 @@ class NativeFileSystemFileHandleImplTest : public testing::Test { public: NativeFileSystemFileHandleImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { scoped_feature_list_.InitAndEnableFeature( blink::features::kNativeFileSystemAPI); } @@ -97,7 +96,7 @@ const url::Origin test_src_origin_ = url::Origin::Create(test_src_url_); base::test::ScopedFeatureList scoped_feature_list_; - TestBrowserThreadBundle scoped_task_environment_; + TestBrowserThreadBundle task_environment_; base::ScopedTempDir dir_; scoped_refptr<storage::FileSystemContext> file_system_context_;
diff --git a/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc b/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc index a5b8254e..2a96d80 100644 --- a/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc +++ b/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc
@@ -35,8 +35,7 @@ class NativeFileSystemFileWriterImplTest : public testing::Test { public: NativeFileSystemFileWriterImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { scoped_feature_list_.InitAndEnableFeature( blink::features::kNativeFileSystemAPI); } @@ -210,7 +209,7 @@ const GURL kTestURL = GURL("https://example.com/test"); const url::Origin kTestOrigin = url::Origin::Create(kTestURL); base::test::ScopedFeatureList scoped_feature_list_; - TestBrowserThreadBundle scoped_task_environment_; + TestBrowserThreadBundle task_environment_; base::ScopedTempDir dir_; scoped_refptr<storage::FileSystemContext> file_system_context_;
diff --git a/content/browser/native_file_system/native_file_system_handle_base_unittest.cc b/content/browser/native_file_system/native_file_system_handle_base_unittest.cc index 7e6e5e02..13c37de6 100644 --- a/content/browser/native_file_system/native_file_system_handle_base_unittest.cc +++ b/content/browser/native_file_system/native_file_system_handle_base_unittest.cc
@@ -44,8 +44,7 @@ class NativeFileSystemHandleBaseTest : public testing::Test { public: NativeFileSystemHandleBaseTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { scoped_feature_list_.InitAndEnableFeature( blink::features::kNativeFileSystemAPI); } @@ -67,7 +66,7 @@ const GURL kTestURL = GURL("https://example.com/test"); const url::Origin kTestOrigin = url::Origin::Create(kTestURL); base::test::ScopedFeatureList scoped_feature_list_; - TestBrowserThreadBundle scoped_task_environment_; + TestBrowserThreadBundle task_environment_; base::ScopedTempDir dir_; scoped_refptr<storage::FileSystemContext> file_system_context_;
diff --git a/content/browser/native_file_system/native_file_system_manager_impl_unittest.cc b/content/browser/native_file_system/native_file_system_manager_impl_unittest.cc index 0a9a7ad..1a4a244 100644 --- a/content/browser/native_file_system/native_file_system_manager_impl_unittest.cc +++ b/content/browser/native_file_system/native_file_system_manager_impl_unittest.cc
@@ -28,8 +28,7 @@ class NativeFileSystemManagerImplTest : public testing::Test { public: NativeFileSystemManagerImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { scoped_feature_list_.InitAndEnableFeature( blink::features::kNativeFileSystemAPI); } @@ -71,7 +70,7 @@ kTestOrigin, kTestURL, kProcessId, kFrameId}; base::test::ScopedFeatureList scoped_feature_list_; - TestBrowserThreadBundle scoped_task_environment_; + TestBrowserThreadBundle task_environment_; base::ScopedTempDir dir_; scoped_refptr<storage::FileSystemContext> file_system_context_;
diff --git a/content/browser/network_service_client_unittest.cc b/content/browser/network_service_client_unittest.cc index 9e6284ae..8de73b2 100644 --- a/content/browser/network_service_client_unittest.cc +++ b/content/browser/network_service_client_unittest.cc
@@ -80,7 +80,7 @@ } protected: - TestBrowserThreadBundle scoped_task_environment_; + TestBrowserThreadBundle task_environment_; TestBrowserContext browser_context_; network::mojom::NetworkServiceClientPtr client_ptr_; NetworkServiceClient client_; @@ -91,7 +91,7 @@ UploadResponse response; client_.OnFileUploadRequested(kRendererProcessId, true, {}, std::move(response.callback)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(net::OK, response.error_code); EXPECT_EQ(0U, response.opened_files.size()); } @@ -104,7 +104,7 @@ UploadResponse response; client_.OnFileUploadRequested(kRendererProcessId, true, {path}, std::move(response.callback)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(net::OK, response.error_code); ASSERT_EQ(1U, response.opened_files.size()); EXPECT_TRUE(response.opened_files[0].async()); @@ -118,7 +118,7 @@ UploadResponse response; client_.OnFileUploadRequested(kRendererProcessId, false, {path}, std::move(response.callback)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(net::OK, response.error_code); ASSERT_EQ(1U, response.opened_files.size()); EXPECT_FALSE(response.opened_files[0].async()); @@ -142,7 +142,7 @@ UploadResponse response; client_.OnFileUploadRequested(kRendererProcessId, false, {content_path}, std::move(response.callback)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(net::OK, response.error_code); ASSERT_EQ(1U, response.opened_files.size()); EXPECT_FALSE(response.opened_files[0].async()); @@ -163,7 +163,7 @@ UploadResponse response; client_.OnFileUploadRequested(kRendererProcessId, false, {path1, path2}, std::move(response.callback)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(net::OK, response.error_code); ASSERT_EQ(2U, response.opened_files.size()); ValidateFileContents(response.opened_files[0], kFileContent1); @@ -177,7 +177,7 @@ UploadResponse response; client_.OnFileUploadRequested(kRendererProcessId, false, {path}, std::move(response.callback)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(net::ERR_ACCESS_DENIED, response.error_code); EXPECT_EQ(0U, response.opened_files.size()); } @@ -192,7 +192,7 @@ UploadResponse response; client_.OnFileUploadRequested(kRendererProcessId, false, {path1, path2}, std::move(response.callback)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(net::ERR_ACCESS_DENIED, response.error_code); EXPECT_EQ(0U, response.opened_files.size()); } @@ -207,7 +207,7 @@ UploadResponse response; client_.OnFileUploadRequested(kRendererProcessId, false, {path1, path2}, std::move(response.callback)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(net::ERR_FILE_NOT_FOUND, response.error_code); EXPECT_EQ(0U, response.opened_files.size()); } @@ -220,7 +220,7 @@ UploadResponse response; client_.OnFileUploadRequested(kBrowserProcessId, false, {path}, std::move(response.callback)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(net::OK, response.error_code); ASSERT_EQ(1U, response.opened_files.size()); ValidateFileContents(response.opened_files[0], kFileContent1);
diff --git a/content/browser/notifications/notification_event_dispatcher_impl_unittest.cc b/content/browser/notifications/notification_event_dispatcher_impl_unittest.cc index cca73db..443b7256 100644 --- a/content/browser/notifications/notification_event_dispatcher_impl_unittest.cc +++ b/content/browser/notifications/notification_event_dispatcher_impl_unittest.cc
@@ -83,10 +83,10 @@ ~NotificationEventDispatcherImplTest() override { delete dispatcher_; } // Waits until the task runner managing the Mojo connection has finished. - void WaitForMojoTasksToComplete() { scoped_task_environment_.RunUntilIdle(); } + void WaitForMojoTasksToComplete() { task_environment_.RunUntilIdle(); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Using a raw pointer because NotificationEventDispatcherImpl is a singleton // with private constructor and destructor, so unique_ptr is not an option.
diff --git a/content/browser/notifications/platform_notification_context_trigger_unittest.cc b/content/browser/notifications/platform_notification_context_trigger_unittest.cc index 6c684a2..a3b18cb 100644 --- a/content/browser/notifications/platform_notification_context_trigger_unittest.cc +++ b/content/browser/notifications/platform_notification_context_trigger_unittest.cc
@@ -52,9 +52,8 @@ class PlatformNotificationContextTriggerTest : public ::testing::Test { public: PlatformNotificationContextTriggerTest() - : thread_bundle_( - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : thread_bundle_(base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::TimeSource::MOCK_TIME), notification_browser_client_(&browser_context_), success_(false) { SetBrowserClientForTesting(¬ification_browser_client_);
diff --git a/content/browser/renderer_host/dwrite_font_lookup_table_builder_win_unittest.cc b/content/browser/renderer_host/dwrite_font_lookup_table_builder_win_unittest.cc index 3a176aa..8a54657b 100644 --- a/content/browser/renderer_host/dwrite_font_lookup_table_builder_win_unittest.cc +++ b/content/browser/renderer_host/dwrite_font_lookup_table_builder_win_unittest.cc
@@ -72,7 +72,7 @@ protected: base::test::ScopedFeatureList feature_list_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DWriteFontLookupTableBuilder* font_lookup_table_builder_; base::ScopedTempDir scoped_temp_dir_; }; @@ -97,7 +97,7 @@ TestMatchFonts(); test_callback_executed = true; })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(test_callback_executed); } @@ -123,7 +123,7 @@ font_lookup_table_builder_->ResumeFromHangForTesting(); test_callback_executed = true; })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(test_callback_executed); } @@ -150,7 +150,7 @@ })); ASSERT_FALSE(font_lookup_table_builder_->FontUniqueNameTableReady()); font_lookup_table_builder_->ResumeFromHangForTesting(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(test_callback_executed); } @@ -166,7 +166,7 @@ [&test_callback_executed](base::ReadOnlySharedMemoryRegion) { test_callback_executed = true; })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(test_callback_executed); } } @@ -205,7 +205,7 @@ ASSERT_TRUE(cache_file.SetLength(cache_file.GetLength() * 2)); test_callback_executed = true; })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(test_callback_executed); // Reload the cache file. @@ -221,7 +221,7 @@ test_callback_executed = true; })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(test_callback_executed); // Ensure that the table is still valid even though persisting has failed
diff --git a/content/browser/renderer_host/dwrite_font_proxy_impl_win_unittest.cc b/content/browser/renderer_host/dwrite_font_proxy_impl_win_unittest.cc index 587d8c8..06e9bc1d 100644 --- a/content/browser/renderer_host/dwrite_font_proxy_impl_win_unittest.cc +++ b/content/browser/renderer_host/dwrite_font_proxy_impl_win_unittest.cc
@@ -69,7 +69,7 @@ return lookup_mode == blink::mojom::UniqueFontLookupMode::kSingleLookups; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; blink::mojom::DWriteFontProxyPtr dwrite_font_proxy_; DWriteFontProxyImpl impl_; mojo::Binding<blink::mojom::DWriteFontProxy> binding_; @@ -307,7 +307,7 @@ bool lookup_table_results_were_tested = false; dwrite_font_proxy().GetUniqueNameLookupTable(base::BindOnce( &TestWhenLookupTableReady, &lookup_table_results_were_tested)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(lookup_table_results_were_tested); }
diff --git a/content/browser/renderer_host/embedded_frame_sink_provider_impl_unittest.cc b/content/browser/renderer_host/embedded_frame_sink_provider_impl_unittest.cc index 7ca46308..a1361da7 100644 --- a/content/browser/renderer_host/embedded_frame_sink_provider_impl_unittest.cc +++ b/content/browser/renderer_host/embedded_frame_sink_provider_impl_unittest.cc
@@ -152,7 +152,7 @@ private: // A MessageLoop is required for mojo bindings which are used to // connect to graphics services. - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; viz::ServerSharedBitmapManager shared_bitmap_manager_; viz::FakeHostFrameSinkClient host_frame_sink_client_; std::unique_ptr<viz::HostFrameSinkManager> host_frame_sink_manager_;
diff --git a/content/browser/renderer_host/input/fling_controller_unittest.cc b/content/browser/renderer_host/input/fling_controller_unittest.cc index 48e4d87..25b8515 100644 --- a/content/browser/renderer_host/input/fling_controller_unittest.cc +++ b/content/browser/renderer_host/input/fling_controller_unittest.cc
@@ -39,8 +39,7 @@ // testing::Test FlingControllerTest() : needs_begin_frame_for_fling_progress_(GetParam()), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~FlingControllerTest() override {} @@ -179,7 +178,7 @@ // behavior in FlingController::ProcessGestureFlingStart. See // https://crrev.com/c/1181521. bool needs_begin_frame_for_fling_progress_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(FlingControllerTest); };
diff --git a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc index ff22573..009b353 100644 --- a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc +++ b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc
@@ -39,8 +39,7 @@ public FlingControllerSchedulerClient { public: GestureEventQueueTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), acked_gesture_event_count_(0), sent_gesture_event_count_(0) {} @@ -221,7 +220,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<GestureEventQueue> queue_; size_t acked_gesture_event_count_; size_t sent_gesture_event_count_;
diff --git a/content/browser/renderer_host/input/input_router_impl.cc b/content/browser/renderer_host/input/input_router_impl.cc index cb7287df..e9615f0 100644 --- a/content/browser/renderer_host/input/input_router_impl.cc +++ b/content/browser/renderer_host/input/input_router_impl.cc
@@ -664,9 +664,8 @@ if (overscroll) DidOverscroll(overscroll.value()); - wheel_event_queue_.ProcessMouseWheelAck(source, state, event.latency); - touchpad_pinch_event_queue_.ProcessMouseWheelAck(source, state, - event.latency); + wheel_event_queue_.ProcessMouseWheelAck(source, state, event); + touchpad_pinch_event_queue_.ProcessMouseWheelAck(source, state, event); } void InputRouterImpl::OnHasTouchEventHandlers(bool has_handlers) {
diff --git a/content/browser/renderer_host/input/input_router_impl_unittest.cc b/content/browser/renderer_host/input/input_router_impl_unittest.cc index f4f8f329c..70d16bb 100644 --- a/content/browser/renderer_host/input/input_router_impl_unittest.cc +++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc
@@ -205,8 +205,7 @@ class InputRouterImplTestBase : public testing::Test { public: InputRouterImplTestBase() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~InputRouterImplTestBase() override {} @@ -499,7 +498,7 @@ std::unique_ptr<MockInputDispositionHandler> disposition_handler_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; SyntheticWebTouchEvent touch_event_; };
diff --git a/content/browser/renderer_host/input/mouse_wheel_event_queue.cc b/content/browser/renderer_host/input/mouse_wheel_event_queue.cc index 05e2d2bf..f42f9a8 100644 --- a/content/browser/renderer_host/input/mouse_wheel_event_queue.cc +++ b/content/browser/renderer_host/input/mouse_wheel_event_queue.cc
@@ -5,7 +5,6 @@ #include "content/browser/renderer_host/input/mouse_wheel_event_queue.h" #include "base/metrics/histogram_macros.h" -#include "base/trace_event/trace_event.h" #include "build/build_config.h" #include "content/common/input/input_event_dispatch_type.h" #include "content/common/input/web_mouse_wheel_event_traits.h" @@ -20,23 +19,6 @@ namespace content { -// This class represents a single queued mouse wheel event. Its main use -// is that it is reported via trace events. -class QueuedWebMouseWheelEvent : public MouseWheelEventWithLatencyInfo { - public: - QueuedWebMouseWheelEvent(const MouseWheelEventWithLatencyInfo& original_event) - : MouseWheelEventWithLatencyInfo(original_event) { - TRACE_EVENT_ASYNC_BEGIN0("input", "MouseWheelEventQueue::QueueEvent", this); - } - - ~QueuedWebMouseWheelEvent() { - TRACE_EVENT_ASYNC_END0("input", "MouseWheelEventQueue::QueueEvent", this); - } - - private: - DISALLOW_COPY_AND_ASSIGN(QueuedWebMouseWheelEvent); -}; - MouseWheelEventQueue::MouseWheelEventQueue(MouseWheelEventQueueClient* client) : client_(client), send_wheel_events_async_(false), @@ -125,12 +107,21 @@ void MouseWheelEventQueue::ProcessMouseWheelAck( InputEventAckSource ack_source, InputEventAckState ack_result, - const LatencyInfo& latency_info) { + const MouseWheelEventWithLatencyInfo& ack_event) { TRACE_EVENT0("input", "MouseWheelEventQueue::ProcessMouseWheelAck"); if (!event_sent_for_gesture_ack_) return; - event_sent_for_gesture_ack_->latency.AddNewLatencyFrom(latency_info); + // |ack_event.event| should be the same as + // |event_sent_for_gesture_ack_->event|. If they aren't, then don't continue + // processing the ack. The two events can potentially be different because + // TouchpadPinchEventQueue also dispatches wheel events, and any wheel event + // ack that is received is sent to both *EventQueue::ProcessMouseWheelAck + // methods. + if (ack_event.event != event_sent_for_gesture_ack_->event) + return; + + event_sent_for_gesture_ack_->latency.AddNewLatencyFrom(ack_event.latency); client_->OnMouseWheelEventAck(*event_sent_for_gesture_ack_, ack_source, ack_result);
diff --git a/content/browser/renderer_host/input/mouse_wheel_event_queue.h b/content/browser/renderer_host/input/mouse_wheel_event_queue.h index ebcc46d7..bfd14734 100644 --- a/content/browser/renderer_host/input/mouse_wheel_event_queue.h +++ b/content/browser/renderer_host/input/mouse_wheel_event_queue.h
@@ -9,6 +9,7 @@ #include "base/containers/circular_deque.h" #include "base/time/time.h" +#include "base/trace_event/trace_event.h" #include "content/browser/renderer_host/event_with_latency_info.h" #include "content/common/content_export.h" #include "content/public/common/input_event_ack_source.h" @@ -17,7 +18,22 @@ namespace content { -class QueuedWebMouseWheelEvent; +// This class represents a single queued mouse wheel event. Its main use +// is that it is reported via trace events. +class QueuedWebMouseWheelEvent : public MouseWheelEventWithLatencyInfo { + public: + QueuedWebMouseWheelEvent(const MouseWheelEventWithLatencyInfo& original_event) + : MouseWheelEventWithLatencyInfo(original_event) { + TRACE_EVENT_ASYNC_BEGIN0("input", "MouseWheelEventQueue::QueueEvent", this); + } + + ~QueuedWebMouseWheelEvent() { + TRACE_EVENT_ASYNC_END0("input", "MouseWheelEventQueue::QueueEvent", this); + } + + private: + DISALLOW_COPY_AND_ASSIGN(QueuedWebMouseWheelEvent); +}; // Interface with which MouseWheelEventQueue can forward mouse wheel events, // and dispatch mouse wheel event responses. @@ -57,7 +73,7 @@ // renderer. void ProcessMouseWheelAck(InputEventAckSource ack_source, InputEventAckState ack_result, - const ui::LatencyInfo& latency_info); + const MouseWheelEventWithLatencyInfo& ack_event); // When GestureScrollBegin is received, and it is a different source // than mouse wheels terminate the current GestureScroll if there is one. @@ -74,6 +90,10 @@ return event_sent_for_gesture_ack_ != nullptr; } + blink::WebMouseWheelEvent get_wheel_event_awaiting_ack_for_testing() { + return event_sent_for_gesture_ack_->event; + } + private: void TryForwardNextEventToRenderer(); void SendScrollEnd(blink::WebGestureEvent update_event, bool synthetic);
diff --git a/content/browser/renderer_host/input/mouse_wheel_event_queue_unittest.cc b/content/browser/renderer_host/input/mouse_wheel_event_queue_unittest.cc index 38cdfa1..dfdc5153 100644 --- a/content/browser/renderer_host/input/mouse_wheel_event_queue_unittest.cc +++ b/content/browser/renderer_host/input/mouse_wheel_event_queue_unittest.cc
@@ -145,8 +145,7 @@ public MouseWheelEventQueueClient { public: MouseWheelEventQueueTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), acked_event_count_(0), last_acked_event_state_(INPUT_EVENT_ACK_STATE_UNKNOWN) { queue_.reset(new MouseWheelEventQueue(this)); @@ -222,8 +221,10 @@ } void SendMouseWheelEventAck(InputEventAckState ack_result) { + const MouseWheelEventWithLatencyInfo mouse_event_with_latency_info( + queue_->get_wheel_event_awaiting_ack_for_testing(), ui::LatencyInfo()); queue_->ProcessMouseWheelAck(InputEventAckSource::COMPOSITOR_THREAD, - ack_result, ui::LatencyInfo()); + ack_result, mouse_event_with_latency_info); } void SendMouseWheel(float x, float y, @@ -374,7 +375,7 @@ EXPECT_EQ(1U, GetAndResetSentEventCount()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MouseWheelEventQueue> queue_; std::vector<std::unique_ptr<WebInputEvent>> sent_events_; size_t acked_event_count_;
diff --git a/content/browser/renderer_host/input/passthrough_touch_event_queue_unittest.cc b/content/browser/renderer_host/input/passthrough_touch_event_queue_unittest.cc index 631defe..b9142ba 100644 --- a/content/browser/renderer_host/input/passthrough_touch_event_queue_unittest.cc +++ b/content/browser/renderer_host/input/passthrough_touch_event_queue_unittest.cc
@@ -47,8 +47,7 @@ public PassthroughTouchEventQueueClient { public: PassthroughTouchEventQueueTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), acked_event_count_(0), last_acked_event_state_(INPUT_EVENT_ACK_STATE_UNKNOWN), slop_length_dips_(0) {} @@ -341,7 +340,7 @@ queue_->OnHasTouchEventHandlers(true); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<PassthroughTouchEventQueue> queue_; size_t acked_event_count_; WebTouchEvent last_acked_event_;
diff --git a/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc b/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc index 1854a27..697b4a0f 100644 --- a/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc +++ b/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc
@@ -810,7 +810,7 @@ base::TimeDelta GetTotalTime() const { return time_ - start_time_; } - base::test::ScopedTaskEnvironment env_; + base::test::TaskEnvironment env_; MockSyntheticGestureTarget* target_; DummySyntheticGestureControllerDelegate delegate_; std::unique_ptr<SyntheticGestureController> controller_;
diff --git a/content/browser/renderer_host/input/touch_emulator_unittest.cc b/content/browser/renderer_host/input/touch_emulator_unittest.cc index b95f1aa1..115b943 100644 --- a/content/browser/renderer_host/input/touch_emulator_unittest.cc +++ b/content/browser/renderer_host/input/touch_emulator_unittest.cc
@@ -32,8 +32,7 @@ public TouchEmulatorClient { public: TouchEmulatorTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), last_event_time_(base::TimeTicks::Now()), event_time_delta_(base::TimeDelta::FromMilliseconds(100)), shift_pressed_(false), @@ -254,7 +253,7 @@ float GetCursorScaleFactor() { return cursor_.info().image_scale_factor; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TouchEmulator> emulator_; std::vector<WebInputEvent::Type> forwarded_events_; base::TimeTicks last_event_time_;
diff --git a/content/browser/renderer_host/input/touchpad_pinch_event_queue.cc b/content/browser/renderer_host/input/touchpad_pinch_event_queue.cc index ed62b51..c19f5d8 100644 --- a/content/browser/renderer_host/input/touchpad_pinch_event_queue.cc +++ b/content/browser/renderer_host/input/touchpad_pinch_event_queue.cc
@@ -126,21 +126,30 @@ void TouchpadPinchEventQueue::ProcessMouseWheelAck( InputEventAckSource ack_source, InputEventAckState ack_result, - const ui::LatencyInfo& latency_info) { + const MouseWheelEventWithLatencyInfo& ack_event) { TRACE_EVENT0("input", "TouchpadPinchEventQueue::ProcessMouseWheelAck"); if (!pinch_event_awaiting_ack_) return; + // |ack_event.event| should be the same as the wheel_event_awaiting_ack_. If + // they aren't, then don't continue processing the ack. The two events can + // potentially be different because MouseWheelEventQueue also dispatches wheel + // events, and any wheel event ack that is received is sent to both + // *EventQueue::ProcessMouseWheelAck methods. + if (wheel_event_awaiting_ack_ != ack_event.event) + return; + if (pinch_event_awaiting_ack_->event.GetType() == blink::WebInputEvent::kGesturePinchUpdate && !first_event_prevented_.has_value()) first_event_prevented_ = (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED); - pinch_event_awaiting_ack_->latency.AddNewLatencyFrom(latency_info); + pinch_event_awaiting_ack_->latency.AddNewLatencyFrom(ack_event.latency); client_->OnGestureEventForPinchAck(*pinch_event_awaiting_ack_, ack_source, ack_result); pinch_event_awaiting_ack_.reset(); + wheel_event_awaiting_ack_.reset(); TryForwardNextEventToRenderer(); } @@ -192,10 +201,10 @@ } } + wheel_event_awaiting_ack_ = CreateSyntheticWheelFromTouchpadPinchEvent( + pinch_event_awaiting_ack_->event, phase, cancelable); const MouseWheelEventWithLatencyInfo synthetic_wheel( - CreateSyntheticWheelFromTouchpadPinchEvent( - pinch_event_awaiting_ack_->event, phase, cancelable), - pinch_event_awaiting_ack_->latency); + wheel_event_awaiting_ack_.value(), pinch_event_awaiting_ack_->latency); client_->SendMouseWheelEventForPinchImmediately(synthetic_wheel); }
diff --git a/content/browser/renderer_host/input/touchpad_pinch_event_queue.h b/content/browser/renderer_host/input/touchpad_pinch_event_queue.h index 4fbbb71..60553907 100644 --- a/content/browser/renderer_host/input/touchpad_pinch_event_queue.h +++ b/content/browser/renderer_host/input/touchpad_pinch_event_queue.h
@@ -15,10 +15,6 @@ #include "content/public/common/input_event_ack_state.h" #include "third_party/blink/public/platform/web_input_event.h" -namespace ui { -class LatencyInfo; -} // namespace ui - namespace content { class QueuedTouchpadPinchEvent; @@ -57,10 +53,14 @@ // by the renderer. void ProcessMouseWheelAck(InputEventAckSource ack_source, InputEventAckState ack_result, - const ui::LatencyInfo& latency_info); + const MouseWheelEventWithLatencyInfo& ack_event); bool has_pending() const WARN_UNUSED_RESULT; + blink::WebMouseWheelEvent get_wheel_event_awaiting_ack_for_testing() { + return wheel_event_awaiting_ack_.value(); + } + private: void TryForwardNextEventToRenderer(); @@ -69,6 +69,7 @@ base::circular_deque<std::unique_ptr<QueuedTouchpadPinchEvent>> pinch_queue_; std::unique_ptr<QueuedTouchpadPinchEvent> pinch_event_awaiting_ack_; + base::Optional<blink::WebMouseWheelEvent> wheel_event_awaiting_ack_; base::Optional<bool> first_event_prevented_; DISALLOW_COPY_AND_ASSIGN(TouchpadPinchEventQueue);
diff --git a/content/browser/renderer_host/input/touchpad_pinch_event_queue_unittest.cc b/content/browser/renderer_host/input/touchpad_pinch_event_queue_unittest.cc index 80313c99..6c656eb0 100644 --- a/content/browser/renderer_host/input/touchpad_pinch_event_queue_unittest.cc +++ b/content/browser/renderer_host/input/touchpad_pinch_event_queue_unittest.cc
@@ -103,7 +103,10 @@ void SendWheelEventAck(InputEventAckSource ack_source, InputEventAckState ack_result) { - queue_->ProcessMouseWheelAck(ack_source, ack_result, ui::LatencyInfo()); + const MouseWheelEventWithLatencyInfo mouse_event_with_latency_info( + queue_->get_wheel_event_awaiting_ack_for_testing(), ui::LatencyInfo()); + queue_->ProcessMouseWheelAck(ack_source, ack_result, + mouse_event_with_latency_info); } base::test::ScopedFeatureList scoped_feature_list_; @@ -611,4 +614,53 @@ INPUT_EVENT_ACK_STATE_CONSUMED); } +// Ensure that ACKs are only processed when they match the event that is +// currently awaiting an ACK. +TEST_P(TouchpadPinchEventQueueTest, IgnoreNonMatchingEvents) { + ::testing::InSequence sequence; + EXPECT_CALL(mock_client_, + OnGestureEventForPinchAck( + EventHasType(blink::WebInputEvent::kGesturePinchBegin), + InputEventAckSource::BROWSER, INPUT_EVENT_ACK_STATE_IGNORED)); + EXPECT_CALL(mock_client_, + SendMouseWheelEventForPinchImmediately( + ::testing::AllOf(EventHasCtrlModifier(), EventIsBlocking()))); + EXPECT_CALL( + mock_client_, + OnGestureEventForPinchAck( + EventHasType(blink::WebInputEvent::kGesturePinchUpdate), + InputEventAckSource::MAIN_THREAD, INPUT_EVENT_ACK_STATE_CONSUMED)); + + EXPECT_CALL(mock_client_, + SendMouseWheelEventForPinchImmediately(::testing::AllOf( + EventHasCtrlModifier(), ::testing::Not(EventIsBlocking())))); + + EXPECT_CALL(mock_client_, + OnGestureEventForPinchAck( + EventHasType(blink::WebInputEvent::kGesturePinchEnd), + InputEventAckSource::BROWSER, INPUT_EVENT_ACK_STATE_IGNORED)); + + QueuePinchBegin(); + QueuePinchUpdate(1.23, false); + QueuePinchEnd(); + + // Create a fake end event to give to ProcessMouseWheelAck to confirm that + // it correctly filters this event out and doesn't start processing the ack. + blink::WebMouseWheelEvent fake_end_event( + blink::WebInputEvent::kMouseWheel, blink::WebInputEvent::kControlKey, + blink::WebInputEvent::GetStaticTimeStampForTests()); + fake_end_event.dispatch_type = blink::WebMouseWheelEvent::kBlocking; + fake_end_event.phase = blink::WebMouseWheelEvent::kPhaseEnded; + const MouseWheelEventWithLatencyInfo fake_end_event_with_latency_info( + fake_end_event, ui::LatencyInfo()); + queue_->ProcessMouseWheelAck(InputEventAckSource::MAIN_THREAD, + INPUT_EVENT_ACK_STATE_NOT_CONSUMED, + fake_end_event_with_latency_info); + + SendWheelEventAck(InputEventAckSource::MAIN_THREAD, + INPUT_EVENT_ACK_STATE_CONSUMED); + SendWheelEventAck(InputEventAckSource::BROWSER, + INPUT_EVENT_ACK_STATE_IGNORED); +} + } // namespace content
diff --git a/content/browser/renderer_host/media/audio_input_stream_handle_unittest.cc b/content/browser/renderer_host/media/audio_input_stream_handle_unittest.cc index 533a6d25..9966f64e 100644 --- a/content/browser/renderer_host/media/audio_input_stream_handle_unittest.cc +++ b/content/browser/renderer_host/media/audio_input_stream_handle_unittest.cc
@@ -122,7 +122,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; StrictMock<MockRendererAudioInputStreamFactoryClient> client_; mojom::RendererAudioInputStreamFactoryClientPtr client_ptr_; mojo::Binding<mojom::RendererAudioInputStreamFactoryClient> client_binding_;
diff --git a/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc b/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc index bcc0bb0..365716c 100644 --- a/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc
@@ -93,7 +93,7 @@ new Buffer(pool_, std::move(buffer_handle), buffer_id)); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; int expected_dropped_id_; scoped_refptr<media::VideoCaptureBufferPool> pool_;
diff --git a/content/browser/renderer_host/pepper/quota_reservation_unittest.cc b/content/browser/renderer_host/pepper/quota_reservation_unittest.cc index 36729eb20..8d613cdc 100644 --- a/content/browser/renderer_host/pepper/quota_reservation_unittest.cc +++ b/content/browser/renderer_host/pepper/quota_reservation_unittest.cc
@@ -121,7 +121,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir work_dir_; std::unique_ptr<storage::QuotaReservationManager> reservation_manager_;
diff --git a/content/browser/renderer_host/render_widget_host_browsertest.cc b/content/browser/renderer_host/render_widget_host_browsertest.cc index 3e30e5b..2ed6978 100644 --- a/content/browser/renderer_host/render_widget_host_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_browsertest.cc
@@ -223,8 +223,15 @@ } #endif // !defined(OS_ANDROID) +// Todo(crbug.com/994353): The test is flaky(crash/timeout) on MSAN, TSAN, and +// DEBUG builds. +#if (!defined(NDEBUG) || defined(THREAD_SANITIZER) || defined(MEMORY_SANITIZER)) +#define MAYBE_TouchEmulator DISABLED_TouchEmulator +#else +#define MAYBE_TouchEmulator TouchEmulator +#endif IN_PROC_BROWSER_TEST_F(RenderWidgetHostTouchEmulatorBrowserTest, - TouchEmulator) { + MAYBE_TouchEmulator) { host()->GetTouchEmulator()->Enable( TouchEmulator::Mode::kEmulatingTouchFromMouse, ui::GestureProviderConfigType::GENERIC_MOBILE);
diff --git a/content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm index 3fc406e..58ac8c7 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm
@@ -104,7 +104,7 @@ void TearDown() override { ImageTransportFactory::Terminate(); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; class RenderWidgetHostViewMacEditCommandHelperWithTaskEnvTest
diff --git a/content/browser/renderer_host/render_widget_targeter.cc b/content/browser/renderer_host/render_widget_targeter.cc index e992e45..1cdeba1 100644 --- a/content/browser/renderer_host/render_widget_targeter.cc +++ b/content/browser/renderer_host/render_widget_targeter.cc
@@ -5,8 +5,6 @@ #include "content/browser/renderer_host/render_widget_targeter.h" #include "base/bind.h" -#include "base/debug/crash_logging.h" -#include "base/debug/dump_without_crashing.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/rand_util.h" @@ -14,11 +12,8 @@ #include "components/viz/host/host_frame_sink_manager.h" #include "content/browser/compositor/surface_utils.h" #include "content/browser/renderer_host/input/one_shot_timeout_monitor.h" -#include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" -#include "content/browser/scoped_active_url.h" -#include "content/public/browser/render_frame_host.h" #include "content/public/browser/site_isolation_policy.h" #include "third_party/blink/public/platform/web_input_event.h" #include "ui/events/blink/blink_event_util.h" @@ -45,33 +40,6 @@ constexpr const char kTracingCategory[] = "input,latency"; -// This function helps with debugging the reasons of viz hit testing mismatch. -void DumpWithoutCrashing(RenderWidgetHostViewBase* root_view, - RenderWidgetHostViewBase* target, - const base::Optional<gfx::PointF>& target_location) { - RenderViewHostImpl* rvh = - RenderViewHostImpl::From(root_view->GetRenderWidgetHost()); - if (!rvh || !rvh->GetMainFrame()) - return; - ScopedActiveURL scoped_active_url(rvh); - - static auto* crash_key = base::debug::AllocateCrashKeyString( - "vizhittest-mismatch-v2-coordinate", base::debug::CrashKeySize::Size32); - const std::string global_coordinate = - target->TransformPointToRootCoordSpaceF(target_location.value()) - .ToString(); - base::debug::SetCrashKeyString(crash_key, global_coordinate); - - crash_key = base::debug::AllocateCrashKeyString( - "vizhittest-mismatch-v2-viewport-size", - base::debug::CrashKeySize::Size32); - const std::string viewport_size = - root_view->GetVisibleViewportSize().ToString(); - base::debug::SetCrashKeyString(crash_key, viewport_size); - - base::debug::DumpWithoutCrashing(); -} - } // namespace class TracingUmaTracker { @@ -515,8 +483,6 @@ static const char* kResultsMatchHistogramName = "Event.VizHitTestSurfaceLayer.ResultsMatch"; HitTestResultsMatch bucket = GetHitTestResultsMatchBucket(target, request); - if (bucket == HitTestResultsMatch::kDoNotMatch) - DumpWithoutCrashing(request->GetRootView(), target, target_location); UMA_HISTOGRAM_ENUMERATION(kResultsMatchHistogramName, bucket, HitTestResultsMatch::kMaxValue); FlushEventQueue(true);
diff --git a/content/browser/scheduler/browser_task_executor_unittest.cc b/content/browser/scheduler/browser_task_executor_unittest.cc index 347d384..53330d7 100644 --- a/content/browser/scheduler/browser_task_executor_unittest.cc +++ b/content/browser/scheduler/browser_task_executor_unittest.cc
@@ -40,8 +40,8 @@ class BrowserTaskExecutorTest : public testing::Test { private: TestBrowserThreadBundle thread_bundle_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; }; using StrictMockTask = @@ -163,14 +163,14 @@ class BrowserTaskExecutorWithCustomSchedulerTest : public testing::Test { private: - class ScopedTaskEnvironmentWithCustomScheduler - : public base::test::ScopedTaskEnvironment { + class TaskEnvironmentWithCustomScheduler + : public base::test::TaskEnvironment { public: - ScopedTaskEnvironmentWithCustomScheduler() - : base::test::ScopedTaskEnvironment( + TaskEnvironmentWithCustomScheduler() + : base::test::TaskEnvironment( SubclassCreatesDefaultTaskRunner{}, - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) { + base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::TimeSource::MOCK_TIME) { std::unique_ptr<BrowserUIThreadScheduler> browser_ui_thread_scheduler = BrowserUIThreadScheduler::CreateForTesting(sequence_manager(), GetTimeDomain()); @@ -191,7 +191,7 @@ } protected: - ScopedTaskEnvironmentWithCustomScheduler scoped_task_environment_; + TaskEnvironmentWithCustomScheduler task_environment_; }; TEST_F(BrowserTaskExecutorWithCustomSchedulerTest, @@ -213,7 +213,7 @@ EXPECT_CALL(user_visible, Run); EXPECT_CALL(user_blocking, Run); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(BrowserTaskExecutorWithCustomSchedulerTest, @@ -232,12 +232,11 @@ base::PostTask(FROM_HERE, {BrowserThread::UI, base::TaskPriority::BEST_EFFORT}, best_effort.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); BrowserTaskExecutor::EnableAllQueues(); EXPECT_CALL(best_effort, Run).Times(4); - scoped_task_environment_.FastForwardBy( - base::TimeDelta::FromMilliseconds(100)); + task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(100)); } } // namespace content
diff --git a/content/browser/scheduler/responsiveness/jank_monitor_unittest.cc b/content/browser/scheduler/responsiveness/jank_monitor_unittest.cc index a9d80f5..2556773 100644 --- a/content/browser/scheduler/responsiveness/jank_monitor_unittest.cc +++ b/content/browser/scheduler/responsiveness/jank_monitor_unittest.cc
@@ -91,7 +91,7 @@ public: JankMonitorTest() : test_browser_thread_bundle_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~JankMonitorTest() override {} void SetUp() override {
diff --git a/content/browser/scheduler/responsiveness/metric_source_unittest.cc b/content/browser/scheduler/responsiveness/metric_source_unittest.cc index 15a36a9..aebccea 100644 --- a/content/browser/scheduler/responsiveness/metric_source_unittest.cc +++ b/content/browser/scheduler/responsiveness/metric_source_unittest.cc
@@ -95,7 +95,7 @@ public: ResponsivenessMetricSourceTest() : test_browser_thread_bundle_( - base::test::ScopedTaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::MainThreadType::UI, content::TestBrowserThreadBundle::REAL_IO_THREAD) {} void SetUp() override { test_browser_thread_bundle_.RunIOThreadUntilIdle(); }
diff --git a/content/browser/screenlock_monitor/screenlock_monitor_unittest.cc b/content/browser/screenlock_monitor/screenlock_monitor_unittest.cc index 7e69c4e..223e0eca 100644 --- a/content/browser/screenlock_monitor/screenlock_monitor_unittest.cc +++ b/content/browser/screenlock_monitor/screenlock_monitor_unittest.cc
@@ -61,7 +61,7 @@ std::unique_ptr<ScreenlockMonitor> screenlock_monitor_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(ScreenlockMonitorTest); }; @@ -86,4 +86,4 @@ EXPECT_FALSE(observers[index].IsScreenLocked()); } -} // namespace content \ No newline at end of file +} // namespace content
diff --git a/content/browser/shareable_file_reference_unittest.cc b/content/browser/shareable_file_reference_unittest.cc index d2ec24e..cc6ab04c 100644 --- a/content/browser/shareable_file_reference_unittest.cc +++ b/content/browser/shareable_file_reference_unittest.cc
@@ -17,7 +17,7 @@ namespace content { TEST(ShareableFileReferenceTest, TestReferences) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; scoped_refptr<base::SingleThreadTaskRunner> task_runner = base::ThreadTaskRunnerHandle::Get(); base::ScopedTempDir temp_dir;
diff --git a/content/browser/site_per_process_hit_test_browsertest.cc b/content/browser/site_per_process_hit_test_browsertest.cc index 8475477c..91104de 100644 --- a/content/browser/site_per_process_hit_test_browsertest.cc +++ b/content/browser/site_per_process_hit_test_browsertest.cc
@@ -6338,6 +6338,14 @@ } } +#if defined(OS_LINUX) +// Test is flaky. See https://crbug.com/995285 +#define MAYBE_RenderWidgetUserActivationStateTest \ + DISABLED_RenderWidgetUserActivationStateTest +#else +#define MAYBE_RenderWidgetUserActivationStateTest \ + RenderWidgetUserActivationStateTest +#endif IN_PROC_BROWSER_TEST_P(SitePerProcessHitTestBrowserTest, RenderWidgetUserActivationStateTest) { base::test::ScopedFeatureList scoped_feature_list_;
diff --git a/content/browser/speech/speech_recognition_engine_unittest.cc b/content/browser/speech/speech_recognition_engine_unittest.cc index a4062a1c..5c9cc20 100644 --- a/content/browser/speech/speech_recognition_engine_unittest.cc +++ b/content/browser/speech/speech_recognition_engine_unittest.cc
@@ -100,7 +100,7 @@ std::string ConsumeChunkedUploadData(); void CloseMockDownstream(DownstreamError error); - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory url_loader_factory_; mojo::ScopedDataPipeProducerHandle downstream_data_pipe_;
diff --git a/content/browser/web_package/bundled_exchanges_reader_unittest.cc b/content/browser/web_package/bundled_exchanges_reader_unittest.cc index 8b91e5c..1389fd5 100644 --- a/content/browser/web_package/bundled_exchanges_reader_unittest.cc +++ b/content/browser/web_package/bundled_exchanges_reader_unittest.cc
@@ -58,7 +58,7 @@ const std::string& GetBody() const { return body_; } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockBundledExchangesReaderFactory> reader_factory_; std::unique_ptr<BundledExchangesReader> reader_; const GURL primary_url_ = GURL("https://test.example.org/");
diff --git a/content/browser/web_package/bundled_exchanges_url_loader_factory_unittest.cc b/content/browser/web_package/bundled_exchanges_url_loader_factory_unittest.cc index e6ce18c..d7a3eb1 100644 --- a/content/browser/web_package/bundled_exchanges_url_loader_factory_unittest.cc +++ b/content/browser/web_package/bundled_exchanges_url_loader_factory_unittest.cc
@@ -146,7 +146,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockBundledExchangesReaderFactory> mock_factory_; std::unique_ptr<BundledExchangesURLLoaderFactory> loader_factory_; BundledExchangesReader* reader_;
diff --git a/content/browser/web_package/signed_exchange_cert_fetcher_unittest.cc b/content/browser/web_package/signed_exchange_cert_fetcher_unittest.cc index 9e9633b..dc958116 100644 --- a/content/browser/web_package/signed_exchange_cert_fetcher_unittest.cc +++ b/content/browser/web_package/signed_exchange_cert_fetcher_unittest.cc
@@ -201,7 +201,7 @@ return ImportTestCert()->CalculateChainFingerprint256(); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } std::unique_ptr<SignedExchangeCertFetcher> CreateFetcherAndStart( const GURL& url, @@ -245,7 +245,7 @@ URLLoaderFactoryForMockLoader mock_loader_factory_; std::vector<std::unique_ptr<blink::URLLoaderThrottle>> throttles_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: DISALLOW_COPY_AND_ASSIGN(SignedExchangeCertFetcherTest);
diff --git a/content/browser/web_package/signed_exchange_loader_unittest.cc b/content/browser/web_package/signed_exchange_loader_unittest.cc index f8ff0c0..cbf4170 100644 --- a/content/browser/web_package/signed_exchange_loader_unittest.cc +++ b/content/browser/web_package/signed_exchange_loader_unittest.cc
@@ -137,7 +137,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::test::ScopedFeatureList feature_list_; MockValidityPingURLLoaderFactory ping_loader_factory_;
diff --git a/content/browser/web_package/signed_exchange_prefetch_metric_recorder_unittest.cc b/content/browser/web_package/signed_exchange_prefetch_metric_recorder_unittest.cc index f8679483..bb57a80 100644 --- a/content/browser/web_package/signed_exchange_prefetch_metric_recorder_unittest.cc +++ b/content/browser/web_package/signed_exchange_prefetch_metric_recorder_unittest.cc
@@ -15,8 +15,7 @@ class SignedExchangePrefetchMetricRecorderTest : public ::testing::Test { public: SignedExchangePrefetchMetricRecorderTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void SetUp() override { metric_recorder_ = @@ -27,11 +26,11 @@ void FastForwardBy(const base::TimeDelta fast_forward_delta) { test_clock_.Advance(fast_forward_delta); test_tick_clock_.Advance(fast_forward_delta); - scoped_task_environment_.FastForwardBy(fast_forward_delta); + task_environment_.FastForwardBy(fast_forward_delta); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const base::HistogramTester histogram_tester_; base::SimpleTestClock test_clock_; base::SimpleTestTickClock test_tick_clock_;
diff --git a/content/browser/worker_host/mock_shared_worker.cc b/content/browser/worker_host/mock_shared_worker.cc index 98c6099..7bc32b8 100644 --- a/content/browser/worker_host/mock_shared_worker.cc +++ b/content/browser/worker_host/mock_shared_worker.cc
@@ -22,8 +22,9 @@ } // namespace -MockSharedWorker::MockSharedWorker(blink::mojom::SharedWorkerRequest request) - : binding_(this, std::move(request)) {} +MockSharedWorker::MockSharedWorker( + mojo::PendingReceiver<blink::mojom::SharedWorker> receiver) + : receiver_(this, std::move(receiver)) {} MockSharedWorker::~MockSharedWorker() = default; @@ -73,7 +74,7 @@ blink::mojom::ContentSecurityPolicyType expected_content_security_policy_type, mojo::Remote<blink::mojom::SharedWorkerHost>* host, - blink::mojom::SharedWorkerRequest* request) { + mojo::PendingReceiver<blink::mojom::SharedWorker>* receiver) { std::unique_ptr<CreateParams> create_params = std::move(create_params_); if (!create_params) return false; @@ -87,7 +88,7 @@ if (!create_params->interface_provider) return false; host->Bind(std::move(create_params->host)); - *request = std::move(create_params->request); + *receiver = std::move(create_params->receiver); return true; } @@ -108,7 +109,7 @@ subresource_loader_factories, blink::mojom::ControllerServiceWorkerInfoPtr controller_info, mojo::PendingRemote<blink::mojom::SharedWorkerHost> host, - blink::mojom::SharedWorkerRequest request, + mojo::PendingReceiver<blink::mojom::SharedWorker> receiver, service_manager::mojom::InterfaceProviderPtr interface_provider, mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker> browser_interface_broker) { @@ -118,7 +119,7 @@ create_params_->pause_on_start = pause_on_start; create_params_->content_settings = std::move(content_settings); create_params_->host = std::move(host); - create_params_->request = std::move(request); + create_params_->receiver = std::move(receiver); create_params_->interface_provider = std::move(interface_provider); }
diff --git a/content/browser/worker_host/mock_shared_worker.h b/content/browser/worker_host/mock_shared_worker.h index 0e5d7c5..7c0ffcd9 100644 --- a/content/browser/worker_host/mock_shared_worker.h +++ b/content/browser/worker_host/mock_shared_worker.h
@@ -36,7 +36,8 @@ class MockSharedWorker : public blink::mojom::SharedWorker { public: - explicit MockSharedWorker(blink::mojom::SharedWorkerRequest request); + explicit MockSharedWorker( + mojo::PendingReceiver<blink::mojom::SharedWorker> receiver); ~MockSharedWorker() override; bool CheckReceivedConnect(int* connection_request_id, @@ -50,7 +51,7 @@ mojo::ScopedMessagePipeHandle port) override; void Terminate() override; - mojo::Binding<blink::mojom::SharedWorker> binding_; + mojo::Receiver<blink::mojom::SharedWorker> receiver_; std::queue<std::pair<int, blink::MessagePortChannel>> connect_received_; bool terminate_received_ = false; @@ -69,7 +70,7 @@ blink::mojom::ContentSecurityPolicyType expected_content_security_policy_type, mojo::Remote<blink::mojom::SharedWorkerHost>* host, - blink::mojom::SharedWorkerRequest* request); + mojo::PendingReceiver<blink::mojom::SharedWorker>* receiver); private: // blink::mojom::SharedWorkerFactory methods: @@ -90,7 +91,7 @@ subresource_loader_factories, blink::mojom::ControllerServiceWorkerInfoPtr controller_info, mojo::PendingRemote<blink::mojom::SharedWorkerHost> host, - blink::mojom::SharedWorkerRequest request, + mojo::PendingReceiver<blink::mojom::SharedWorker> receiver, service_manager::mojom::InterfaceProviderPtr interface_provider, mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker> browser_interface_broker) override; @@ -103,7 +104,7 @@ mojo::PendingRemote<blink::mojom::WorkerContentSettingsProxy> content_settings; mojo::PendingRemote<blink::mojom::SharedWorkerHost> host; - blink::mojom::SharedWorkerRequest request; + mojo::PendingReceiver<blink::mojom::SharedWorker> receiver; service_manager::mojom::InterfaceProviderPtr interface_provider; };
diff --git a/content/browser/worker_host/shared_worker_host.cc b/content/browser/worker_host/shared_worker_host.cc index cb71a54..14aecd56 100644 --- a/content/browser/worker_host/shared_worker_host.cc +++ b/content/browser/worker_host/shared_worker_host.cc
@@ -84,10 +84,10 @@ worker_process_id_(worker_process_id), next_connection_request_id_(1), interface_provider_binding_(this) { - // Set up the worker interface request. This is needed first in either + // Set up the worker pending receiver. This is needed first in either // AddClient() or Start(). AddClient() can sometimes be called before Start() // when two clients call new SharedWorker() at around the same time. - worker_request_ = mojo::MakeRequest(&worker_); + worker_receiver_ = worker_.BindNewPipeAndPassReceiver(); // Keep the renderer process alive that will be hosting the shared worker. auto* worker_process_host = RenderProcessHost::FromID(worker_process_id_); @@ -218,7 +218,7 @@ : base::nullopt, std::move(main_script_load_params), std::move(subresource_loader_factories), std::move(controller), - receiver_.BindNewPipeAndPassRemote(), std::move(worker_request_), + receiver_.BindNewPipeAndPassRemote(), std::move(worker_receiver_), std::move(interface_provider), std::move(browser_interface_broker)); // |service_worker_remote_object| is an associated interface ptr, so calls @@ -236,7 +236,7 @@ } // Monitor the lifetime of the worker. - worker_.set_connection_error_handler(base::BindOnce( + worker_.set_disconnect_handler(base::BindOnce( &SharedWorkerHost::OnWorkerConnectionLost, weak_factory_.GetWeakPtr())); }
diff --git a/content/browser/worker_host/shared_worker_host.h b/content/browser/worker_host/shared_worker_host.h index c358394..68f246b 100644 --- a/content/browser/worker_host/shared_worker_host.h +++ b/content/browser/worker_host/shared_worker_host.h
@@ -21,6 +21,7 @@ #include "content/public/browser/global_routing_id.h" #include "content/public/browser/render_process_host.h" #include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" @@ -185,8 +186,8 @@ SharedWorkerInstance instance_; ClientList clients_; - blink::mojom::SharedWorkerRequest worker_request_; - blink::mojom::SharedWorkerPtr worker_; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver_; + mojo::Remote<blink::mojom::SharedWorker> worker_; const int worker_process_id_; int next_connection_request_id_;
diff --git a/content/browser/worker_host/shared_worker_host_unittest.cc b/content/browser/worker_host/shared_worker_host_unittest.cc index 861b81e..62caa9c 100644 --- a/content/browser/worker_host/shared_worker_host_unittest.cc +++ b/content/browser/worker_host/shared_worker_host_unittest.cc
@@ -161,13 +161,13 @@ // The factory should have gotten the CreateSharedWorker message. mojo::Remote<blink::mojom::SharedWorkerHost> worker_host; - blink::mojom::SharedWorkerRequest worker_request; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver; EXPECT_TRUE(factory_impl.CheckReceivedCreateSharedWorker( host->instance().url(), host->instance().name(), host->instance().content_security_policy_type(), &worker_host, - &worker_request)); + &worker_receiver)); { - MockSharedWorker worker(std::move(worker_request)); + MockSharedWorker worker(std::move(worker_receiver)); base::RunLoop().RunUntilIdle(); // The worker and client should have gotten initial messages. @@ -273,12 +273,12 @@ { mojo::Remote<blink::mojom::SharedWorkerHost> worker_host; - blink::mojom::SharedWorkerRequest worker_request; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver; EXPECT_TRUE(factory_impl.CheckReceivedCreateSharedWorker( host->instance().url(), host->instance().name(), host->instance().content_security_policy_type(), &worker_host, - &worker_request)); - MockSharedWorker worker(std::move(worker_request)); + &worker_receiver)); + MockSharedWorker worker(std::move(worker_receiver)); // Terminate after starting. host->TerminateWorker(); @@ -317,12 +317,12 @@ { mojo::Remote<blink::mojom::SharedWorkerHost> worker_host; - blink::mojom::SharedWorkerRequest worker_request; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver; EXPECT_TRUE(factory_impl.CheckReceivedCreateSharedWorker( host->instance().url(), host->instance().name(), host->instance().content_security_policy_type(), &worker_host, - &worker_request)); - MockSharedWorker worker(std::move(worker_request)); + &worker_receiver)); + MockSharedWorker worker(std::move(worker_receiver)); // Simulate the worker calling OnContextClosed(). worker_host->OnContextClosed();
diff --git a/content/browser/worker_host/shared_worker_service_impl_unittest.cc b/content/browser/worker_host/shared_worker_service_impl_unittest.cc index 7724be841..350a247 100644 --- a/content/browser/worker_host/shared_worker_service_impl_unittest.cc +++ b/content/browser/worker_host/shared_worker_service_impl_unittest.cc
@@ -26,6 +26,7 @@ #include "content/test/test_render_frame_host.h" #include "content/test/test_render_view_host.h" #include "content/test/test_web_contents.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/test_support/test_utils.h" #include "services/network/public/cpp/features.h" @@ -222,11 +223,11 @@ base::RunLoop().RunUntilIdle(); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host; - blink::mojom::SharedWorkerRequest worker_request; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver; EXPECT_TRUE(factory.CheckReceivedCreateSharedWorker( kUrl, "name", blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host, &worker_request)); - MockSharedWorker worker(std::move(worker_request)); + &worker_host, &worker_receiver)); + MockSharedWorker worker(std::move(worker_receiver)); base::RunLoop().RunUntilIdle(); int connection_request_id; @@ -310,11 +311,11 @@ base::RunLoop().RunUntilIdle(); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host; - blink::mojom::SharedWorkerRequest worker_request; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver; EXPECT_TRUE(factory.CheckReceivedCreateSharedWorker( kUrl, "name", blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host, &worker_request)); - MockSharedWorker worker(std::move(worker_request)); + &worker_host, &worker_receiver)); + MockSharedWorker worker(std::move(worker_receiver)); base::RunLoop().RunUntilIdle(); int connection_request_id0; @@ -464,11 +465,11 @@ base::RunLoop().RunUntilIdle(); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host; - blink::mojom::SharedWorkerRequest worker_request; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver; EXPECT_TRUE(factory.CheckReceivedCreateSharedWorker( kUrl, kName, blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host, &worker_request)); - MockSharedWorker worker(std::move(worker_request)); + &worker_host, &worker_receiver)); + MockSharedWorker worker(std::move(worker_receiver)); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(worker.CheckReceivedConnect(nullptr, nullptr)); @@ -539,11 +540,11 @@ base::RunLoop().RunUntilIdle(); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host0; - blink::mojom::SharedWorkerRequest worker_request0; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver0; EXPECT_TRUE(factory0.CheckReceivedCreateSharedWorker( kUrl0, kName, blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host0, &worker_request0)); - MockSharedWorker worker0(std::move(worker_request0)); + &worker_host0, &worker_receiver0)); + MockSharedWorker worker0(std::move(worker_receiver0)); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(worker0.CheckReceivedConnect(nullptr, nullptr)); @@ -564,11 +565,11 @@ base::RunLoop().RunUntilIdle(); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host1; - blink::mojom::SharedWorkerRequest worker_request1; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver1; EXPECT_TRUE(factory1.CheckReceivedCreateSharedWorker( kUrl1, kName, blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host1, &worker_request1)); - MockSharedWorker worker1(std::move(worker_request1)); + &worker_host1, &worker_receiver1)); + MockSharedWorker worker1(std::move(worker_receiver1)); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(worker1.CheckReceivedConnect(nullptr, nullptr)); @@ -626,11 +627,11 @@ base::RunLoop().RunUntilIdle(); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host0; - blink::mojom::SharedWorkerRequest worker_request0; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver0; EXPECT_TRUE(factory0.CheckReceivedCreateSharedWorker( kUrl, kName0, blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host0, &worker_request0)); - MockSharedWorker worker0(std::move(worker_request0)); + &worker_host0, &worker_receiver0)); + MockSharedWorker worker0(std::move(worker_receiver0)); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(worker0.CheckReceivedConnect(nullptr, nullptr)); @@ -651,11 +652,11 @@ base::RunLoop().RunUntilIdle(); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host1; - blink::mojom::SharedWorkerRequest worker_request1; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver1; EXPECT_TRUE(factory1.CheckReceivedCreateSharedWorker( kUrl, kName1, blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host1, &worker_request1)); - MockSharedWorker worker1(std::move(worker_request1)); + &worker_host1, &worker_receiver1)); + MockSharedWorker worker1(std::move(worker_receiver1)); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(worker1.CheckReceivedConnect(nullptr, nullptr)); @@ -723,11 +724,11 @@ base::RunLoop().RunUntilIdle(); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host; - blink::mojom::SharedWorkerRequest worker_request; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver; EXPECT_TRUE(factory.CheckReceivedCreateSharedWorker( kUrl, kName, blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host, &worker_request)); - MockSharedWorker worker(std::move(worker_request)); + &worker_host, &worker_receiver)); + MockSharedWorker worker(std::move(worker_receiver)); base::RunLoop().RunUntilIdle(); @@ -802,18 +803,18 @@ base::RunLoop().RunUntilIdle(); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host0; - blink::mojom::SharedWorkerRequest worker_request0; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver0; EXPECT_TRUE(factory0.CheckReceivedCreateSharedWorker( kUrl0, kName, blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host0, &worker_request0)); - MockSharedWorker worker0(std::move(worker_request0)); + &worker_host0, &worker_receiver0)); + MockSharedWorker worker0(std::move(worker_receiver0)); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host1; - blink::mojom::SharedWorkerRequest worker_request1; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver1; EXPECT_TRUE(factory1.CheckReceivedCreateSharedWorker( kUrl1, kName, blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host1, &worker_request1)); - MockSharedWorker worker1(std::move(worker_request1)); + &worker_host1, &worker_receiver1)); + MockSharedWorker worker1(std::move(worker_receiver1)); base::RunLoop().RunUntilIdle(); @@ -893,18 +894,18 @@ base::RunLoop().RunUntilIdle(); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host0; - blink::mojom::SharedWorkerRequest worker_request0; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver0; EXPECT_TRUE(factory0.CheckReceivedCreateSharedWorker( kUrl, kName0, blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host0, &worker_request0)); - MockSharedWorker worker0(std::move(worker_request0)); + &worker_host0, &worker_receiver0)); + MockSharedWorker worker0(std::move(worker_receiver0)); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host1; - blink::mojom::SharedWorkerRequest worker_request1; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver1; EXPECT_TRUE(factory1.CheckReceivedCreateSharedWorker( kUrl, kName1, blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host1, &worker_request1)); - MockSharedWorker worker1(std::move(worker_request1)); + &worker_host1, &worker_receiver1)); + MockSharedWorker worker1(std::move(worker_receiver1)); base::RunLoop().RunUntilIdle(); @@ -981,11 +982,11 @@ base::RunLoop().RunUntilIdle(); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host0; - blink::mojom::SharedWorkerRequest worker_request0; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver0; EXPECT_TRUE(factory0.CheckReceivedCreateSharedWorker( kUrl, kName, blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host0, &worker_request0)); - MockSharedWorker worker0(std::move(worker_request0)); + &worker_host0, &worker_receiver0)); + MockSharedWorker worker0(std::move(worker_receiver0)); base::RunLoop().RunUntilIdle(); @@ -1013,11 +1014,11 @@ base::RunLoop().RunUntilIdle(); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host1; - blink::mojom::SharedWorkerRequest worker_request1; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver1; EXPECT_TRUE(factory1.CheckReceivedCreateSharedWorker( kUrl, kName, blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host1, &worker_request1)); - MockSharedWorker worker1(std::move(worker_request1)); + &worker_host1, &worker_receiver1)); + MockSharedWorker worker1(std::move(worker_receiver1)); base::RunLoop().RunUntilIdle(); @@ -1110,11 +1111,11 @@ base::RunLoop().RunUntilIdle(); mojo::Remote<blink::mojom::SharedWorkerHost> worker_host1; - blink::mojom::SharedWorkerRequest worker_request1; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver1; EXPECT_TRUE(factory1.CheckReceivedCreateSharedWorker( kUrl, kName, blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host1, &worker_request1)); - MockSharedWorker worker1(std::move(worker_request1)); + &worker_host1, &worker_receiver1)); + MockSharedWorker worker1(std::move(worker_receiver1)); base::RunLoop().RunUntilIdle(); @@ -1186,11 +1187,11 @@ // Expect a create shared worker. mojo::Remote<blink::mojom::SharedWorkerHost> worker_host; - blink::mojom::SharedWorkerRequest worker_request; + mojo::PendingReceiver<blink::mojom::SharedWorker> worker_receiver; EXPECT_TRUE(factory.CheckReceivedCreateSharedWorker( kURL, kName, blink::mojom::ContentSecurityPolicyType::kReport, - &worker_host, &worker_request)); - MockSharedWorker worker(std::move(worker_request)); + &worker_host, &worker_receiver)); + MockSharedWorker worker(std::move(worker_receiver)); base::RunLoop().RunUntilIdle(); // Expect one connect for the first client.
diff --git a/content/child/dwrite_font_proxy/dwrite_font_proxy_win_unittest.cc b/content/child/dwrite_font_proxy/dwrite_font_proxy_win_unittest.cc index dbac949..ada1c27 100644 --- a/content/child/dwrite_font_proxy/dwrite_font_proxy_win_unittest.cc +++ b/content/child/dwrite_font_proxy/dwrite_font_proxy_win_unittest.cc
@@ -67,7 +67,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<FakeFontCollection> fake_collection_; mswr::ComPtr<DWriteFontCollectionProxy> collection_;
diff --git a/content/child/dwrite_font_proxy/font_fallback_win.cc b/content/child/dwrite_font_proxy/font_fallback_win.cc index 75b3110..2a7899a 100644 --- a/content/child/dwrite_font_proxy/font_fallback_win.cc +++ b/content/child/dwrite_font_proxy/font_fallback_win.cc
@@ -220,6 +220,13 @@ Microsoft::WRL::ComPtr<IDWriteFontFamily> family, const wchar_t* base_family_name, const wchar_t* locale) { + // Note: If the requested locale does not disambiguate Han ideographs, caching + // by locale may prime the cache with one CJK font for the first request, + // which may be unsuitable for the next request. For example: While specifying + // an ambiguous locale, requesting certain Chinese characters first, DWrite + // will give us a simplified Chinese font, then requesting a Korean character + // later may return a Chinese font for the Korean character. This is prevented + // on the Blink side by passing a disambiguating locale. std::list<mswr::ComPtr<IDWriteFontFamily>>& family_list = fallback_family_cache_[MakeCacheKey(base_family_name, locale)]; family_list.push_front(std::move(family));
diff --git a/content/child/dwrite_font_proxy/font_fallback_win_unittest.cc b/content/child/dwrite_font_proxy/font_fallback_win_unittest.cc index 56e4f00d..98a32711 100644 --- a/content/child/dwrite_font_proxy/font_fallback_win_unittest.cc +++ b/content/child/dwrite_font_proxy/font_fallback_win_unittest.cc
@@ -49,7 +49,7 @@ fake_collection_->CreatePtr()); } - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<FakeFontCollection> fake_collection_; mswr::ComPtr<IDWriteFactory> factory_; mswr::ComPtr<DWriteFontCollectionProxy> collection_;
diff --git a/content/child/font_warmup_win_unittest.cc b/content/child/font_warmup_win_unittest.cc index 00564b9..8d48a0c 100644 --- a/content/child/font_warmup_win_unittest.cc +++ b/content/child/font_warmup_win_unittest.cc
@@ -74,7 +74,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<FakeFontCollection> fake_collection_; mswr::ComPtr<DWriteFontCollectionProxy> collection_;
diff --git a/content/common/font_list_unittest.cc b/content/common/font_list_unittest.cc index 7f626783..4be3da54 100644 --- a/content/common/font_list_unittest.cc +++ b/content/common/font_list_unittest.cc
@@ -38,7 +38,7 @@ #if !defined(OS_ANDROID) && !defined(OS_FUCHSIA) // GetFontList is not implemented on Android and Fuchsia. TEST(FontList, GetFontList) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; content::GetFontListTaskRunner()->PostTask( FROM_HERE, base::BindOnce([] { @@ -56,7 +56,7 @@ EXPECT_TRUE(HasFontWithName(*fonts, "Arial", "Arial")); #endif })); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } #endif // !defined(OS_ANDROID) && !defined(OS_FUCHSIA)
diff --git a/content/common/mime_sniffing_throttle_unittest.cc b/content/common/mime_sniffing_throttle_unittest.cc index 9b255a8..78a7908 100644 --- a/content/common/mime_sniffing_throttle_unittest.cc +++ b/content/common/mime_sniffing_throttle_unittest.cc
@@ -187,12 +187,12 @@ class MimeSniffingThrottleTest : public testing::Test { protected: // Be the first member so it is destroyed last. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(MimeSniffingThrottleTest, NoMimeTypeWithSniffableScheme) { auto throttle = std::make_unique<MimeSniffingThrottle>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); auto delegate = std::make_unique<MockDelegate>(); throttle->set_delegate(delegate.get()); @@ -206,7 +206,7 @@ TEST_F(MimeSniffingThrottleTest, SniffableMimeTypeWithSniffableScheme) { auto throttle = std::make_unique<MimeSniffingThrottle>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); auto delegate = std::make_unique<MockDelegate>(); throttle->set_delegate(delegate.get()); @@ -221,7 +221,7 @@ TEST_F(MimeSniffingThrottleTest, NotSniffableMimeTypeWithSniffableScheme) { auto throttle = std::make_unique<MimeSniffingThrottle>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); auto delegate = std::make_unique<MockDelegate>(); throttle->set_delegate(delegate.get()); @@ -236,7 +236,7 @@ TEST_F(MimeSniffingThrottleTest, NoMimeTypeWithNotSniffableScheme) { auto throttle = std::make_unique<MimeSniffingThrottle>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); auto delegate = std::make_unique<MockDelegate>(); throttle->set_delegate(delegate.get()); @@ -250,7 +250,7 @@ TEST_F(MimeSniffingThrottleTest, SniffableMimeTypeWithNotSniffableScheme) { auto throttle = std::make_unique<MimeSniffingThrottle>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); auto delegate = std::make_unique<MockDelegate>(); throttle->set_delegate(delegate.get()); @@ -265,7 +265,7 @@ TEST_F(MimeSniffingThrottleTest, NotSniffableMimeTypeWithNotSniffableScheme) { auto throttle = std::make_unique<MimeSniffingThrottle>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); auto delegate = std::make_unique<MockDelegate>(); throttle->set_delegate(delegate.get()); @@ -280,7 +280,7 @@ TEST_F(MimeSniffingThrottleTest, SniffableButAlreadySniffed) { auto throttle = std::make_unique<MimeSniffingThrottle>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); auto delegate = std::make_unique<MockDelegate>(); throttle->set_delegate(delegate.get()); @@ -296,7 +296,7 @@ TEST_F(MimeSniffingThrottleTest, NoBody) { auto throttle = std::make_unique<MimeSniffingThrottle>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); auto delegate = std::make_unique<MockDelegate>(); throttle->set_delegate(delegate.get()); @@ -320,7 +320,7 @@ TEST_F(MimeSniffingThrottleTest, EmptyBody) { auto throttle = std::make_unique<MimeSniffingThrottle>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); auto delegate = std::make_unique<MockDelegate>(); throttle->set_delegate(delegate.get()); @@ -348,7 +348,7 @@ TEST_F(MimeSniffingThrottleTest, Body_PlainText) { auto throttle = std::make_unique<MimeSniffingThrottle>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); auto delegate = std::make_unique<MockDelegate>(); throttle->set_delegate(delegate.get()); @@ -372,7 +372,7 @@ TEST_F(MimeSniffingThrottleTest, Body_Docx) { auto throttle = std::make_unique<MimeSniffingThrottle>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); auto delegate = std::make_unique<MockDelegate>(); throttle->set_delegate(delegate.get()); @@ -396,7 +396,7 @@ TEST_F(MimeSniffingThrottleTest, Body_PNG) { auto throttle = std::make_unique<MimeSniffingThrottle>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); auto delegate = std::make_unique<MockDelegate>(); throttle->set_delegate(delegate.get()); @@ -420,7 +420,7 @@ TEST_F(MimeSniffingThrottleTest, Body_LongPlainText) { auto throttle = std::make_unique<MimeSniffingThrottle>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); auto delegate = std::make_unique<MockDelegate>(); throttle->set_delegate(delegate.get()); @@ -445,11 +445,11 @@ // body. After this, MimeSniffingURLLoader is waiting to push the body to the // destination data pipe since the pipe should be full until it's read. delegate->LoadResponseBody(long_body); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Send OnComplete() to the MimeSniffingURLLoader. delegate->CompleteResponse(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // MimeSniffingURLLoader should not send OnComplete() to the destination // client until it finished writing all the data. EXPECT_FALSE( @@ -458,11 +458,11 @@ // Read the half of the body. This unblocks MimeSniffingURLLoader to push the // rest of the body to the data pipe. uint32_t read_bytes = delegate->ReadResponseBody(long_body.size() / 2); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Read the rest of the body. read_bytes += delegate->ReadResponseBody(long_body.size() / 2); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); delegate->destination_loader_client()->RunUntilComplete(); // Check if all data has been read. @@ -476,7 +476,7 @@ TEST_F(MimeSniffingThrottleTest, Abort_NoBodyPipe) { auto throttle = std::make_unique<MimeSniffingThrottle>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); auto delegate = std::make_unique<MockDelegate>(); throttle->set_delegate(delegate.get()); @@ -491,18 +491,18 @@ std::string body = "This should be long enough to complete sniffing."; body.resize(1024, 'a'); delegate->LoadResponseBody(body); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Release a pipe for the body on the receiver side. delegate->destination_loader_client()->response_body_release(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Send the body after the pipe is closed. The the loader aborts. delegate->LoadResponseBody("This is a text."); // Calling OnComplete should not crash. delegate->CompleteResponse(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } // namespace content
diff --git a/content/common/service_manager/service_manager_connection_impl_unittest.cc b/content/common/service_manager/service_manager_connection_impl_unittest.cc index f037b6b2..084e3c9a9 100644 --- a/content/common/service_manager/service_manager_connection_impl_unittest.cc +++ b/content/common/service_manager/service_manager_connection_impl_unittest.cc
@@ -23,7 +23,7 @@ } // namespace TEST(ServiceManagerConnectionImplTest, ServiceLaunchThreading) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; base::Thread io_thread("ServiceManagerConnectionImplTest IO Thread"); io_thread.Start(); service_manager::mojom::ServicePtr service;
diff --git a/content/common/tab_switch_time_recorder_unittest.cc b/content/common/tab_switch_time_recorder_unittest.cc index ce628fd..dda6ec4e 100644 --- a/content/common/tab_switch_time_recorder_unittest.cc +++ b/content/common/tab_switch_time_recorder_unittest.cc
@@ -101,8 +101,8 @@ histogram_tester_.ExpectBucketCount(histogram_name, value, count); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; TabSwitchTimeRecorder tab_switch_time_recorder_; base::HistogramTester histogram_tester_; }; @@ -281,7 +281,7 @@ /* destination_is_frozen */ false}, start1); - scoped_task_environment_.FastForwardBy(kDuration); + task_environment_.FastForwardBy(kDuration); tab_switch_time_recorder_.TabWasHidden(); ExpectHistogramsEmptyExcept({kResultWithSavedFramesHistogram, @@ -337,7 +337,7 @@ /* destination_is_frozen */ false}, start1); - scoped_task_environment_.FastForwardBy(kDuration); + task_environment_.FastForwardBy(kDuration); tab_switch_time_recorder_.TabWasHidden(); ExpectHistogramsEmptyExcept(
diff --git a/content/common/throttling_url_loader_unittest.cc b/content/common/throttling_url_loader_unittest.cc index ce96d13..f3bf9cd 100644 --- a/content/common/throttling_url_loader_unittest.cc +++ b/content/common/throttling_url_loader_unittest.cc
@@ -372,7 +372,7 @@ void ResetThrottleRawPointer() { throttle_ = nullptr; } // Be the first member so it is destroyed last. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<ThrottlingURLLoader> loader_; std::vector<std::unique_ptr<blink::URLLoaderThrottle>> throttles_; @@ -1211,7 +1211,7 @@ // The throttle should stay alive and destroyed later. EXPECT_NE(nullptr, throttle_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(nullptr, throttle_); } @@ -1263,7 +1263,7 @@ // The throttle should stay alive and destroyed later. EXPECT_NE(nullptr, throttle_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(nullptr, throttle_); }
diff --git a/content/public/test/render_view_test.h b/content/public/test/render_view_test.h index 3f4ceb9..1090d32 100644 --- a/content/public/test/render_view_test.h +++ b/content/public/test/render_view_test.h
@@ -204,7 +204,7 @@ // Install a fake URL loader factory for the RenderFrameImpl. void CreateFakeWebURLLoaderFactory(); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<CompositorDependencies> compositor_deps_; std::unique_ptr<MockRenderProcess> mock_process_;
diff --git a/content/public/test/test_renderer_host.cc b/content/public/test/test_renderer_host.cc index 94a6dff3..1499086 100644 --- a/content/public/test/test_renderer_host.cc +++ b/content/public/test/test_renderer_host.cc
@@ -116,7 +116,7 @@ // means tests must ensure any MessageLoop they make is created before // the RenderViewHostTestEnabler. if (!base::MessageLoopCurrent::Get()) - task_environment_ = std::make_unique<base::test::ScopedTaskEnvironment>(); + task_environment_ = std::make_unique<base::test::TaskEnvironment>(); #if !defined(OS_ANDROID) ImageTransportFactory::SetFactory( std::make_unique<TestImageTransportFactory>());
diff --git a/content/public/test/test_renderer_host.h b/content/public/test/test_renderer_host.h index a3115cb8..be7a8089 100644 --- a/content/public/test/test_renderer_host.h +++ b/content/public/test/test_renderer_host.h
@@ -153,7 +153,7 @@ #if defined(OS_ANDROID) std::unique_ptr<display::Screen> screen_; #endif - std::unique_ptr<base::test::ScopedTaskEnvironment> task_environment_; + std::unique_ptr<base::test::TaskEnvironment> task_environment_; std::unique_ptr<MockRenderProcessHostFactory> rph_factory_; std::unique_ptr<TestRenderViewHostFactory> rvh_factory_; std::unique_ptr<TestRenderFrameHostFactory> rfh_factory_;
diff --git a/content/renderer/accessibility/render_accessibility_impl_browsertest.cc b/content/renderer/accessibility/render_accessibility_impl_browsertest.cc index 35dab50..b97b5b8 100644 --- a/content/renderer/accessibility/render_accessibility_impl_browsertest.cc +++ b/content/renderer/accessibility/render_accessibility_impl_browsertest.cc
@@ -697,7 +697,7 @@ // Every time we call a method on a Mojo interface, a message is posted to the // current task queue. We need to ask the queue to drain itself before we // check test expectations. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(mock_annotator().image_ids_, ElementsAre("test1.jpg")); ASSERT_EQ(1u, mock_annotator().image_processors_.size()); @@ -718,7 +718,7 @@ // already visible one. render_accessibility().MarkWebAXObjectDirty(root_obj, true /* subtree */); render_accessibility().SendPendingAccessibilityEvents(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(mock_annotator().image_ids_, ElementsAre("test1.jpg", "test1.jpg", "test2.jpg")); @@ -741,7 +741,7 @@ // Every time we call a method on a Mojo interface, a message is posted to the // current task queue. We need to ask the queue to drain itself before we // check test expectations. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(mock_annotator().image_ids_, ElementsAre("test1.jpg")); ASSERT_EQ(1u, mock_annotator().image_processors_.size()); @@ -755,7 +755,7 @@ // This should update the annotations of all images on the page. render_accessibility().MarkWebAXObjectDirty(root_obj, true /* subtree */); render_accessibility().SendPendingAccessibilityEvents(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(mock_annotator().image_ids_, ElementsAre("test1.jpg", "test1.jpg")); @@ -772,7 +772,7 @@ // now updated image src. render_accessibility().MarkWebAXObjectDirty(root_obj, true /* subtree */); render_accessibility().SendPendingAccessibilityEvents(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(mock_annotator().image_ids_, ElementsAre("test1.jpg", "test1.jpg", "test2.jpg"));
diff --git a/content/renderer/android/OWNERS b/content/renderer/android/OWNERS index cdc947e..5ae9412 100644 --- a/content/renderer/android/OWNERS +++ b/content/renderer/android/OWNERS
@@ -1,6 +1,3 @@ -qinmin@chromium.org -tedchoc@chromium.org -yfriedman@chromium.org +file://content/renderer/input/OWNERS -per-file synchronous_*.h=boliu@chromium.org -per-file synchronous_*.cc=boliu@chromium.org +boliu@chromium.org
diff --git a/content/renderer/compositor/layer_tree_view_unittest.cc b/content/renderer/compositor/layer_tree_view_unittest.cc index 9542682..3a550dd 100644 --- a/content/renderer/compositor/layer_tree_view_unittest.cc +++ b/content/renderer/compositor/layer_tree_view_unittest.cc
@@ -256,7 +256,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; cc::TestTaskGraphRunner test_task_graph_runner_; blink::scheduler::WebFakeThreadScheduler fake_thread_scheduler_; FakeLayerTreeViewDelegate layer_tree_view_delegate_; @@ -331,7 +331,7 @@ // Test that LayerTreeView does not retry FrameSink request while // invisible. - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; cc::TestTaskGraphRunner test_task_graph_runner; blink::scheduler::WebFakeThreadScheduler fake_thread_scheduler;
diff --git a/content/renderer/input/main_thread_event_queue_unittest.cc b/content/renderer/input/main_thread_event_queue_unittest.cc index 98077a42..dd18134 100644 --- a/content/renderer/input/main_thread_event_queue_unittest.cc +++ b/content/renderer/input/main_thread_event_queue_unittest.cc
@@ -28,10 +28,6 @@ using blink::WebTouchEvent; namespace blink { -bool operator==(const WebMouseWheelEvent& lhs, const WebMouseWheelEvent& rhs) { - return memcmp(&lhs, &rhs, lhs.size()) == 0; -} - bool operator==(const WebTouchEvent& lhs, const WebTouchEvent& rhs) { return memcmp(&lhs, &rhs, lhs.size()) == 0; }
diff --git a/content/renderer/loader/navigation_body_loader_unittest.cc b/content/renderer/loader/navigation_body_loader_unittest.cc index f15dcc3..03b9eb4 100644 --- a/content/renderer/loader/navigation_body_loader_unittest.cc +++ b/content/renderer/loader/navigation_body_loader_unittest.cc
@@ -151,7 +151,7 @@ } } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; static const MojoWriteDataFlags kNone = MOJO_WRITE_DATA_FLAG_NONE; network::mojom::URLLoaderClientPtr client_ptr_; std::unique_ptr<blink::WebNavigationBodyLoader> loader_;
diff --git a/content/renderer/loader/resource_dispatcher_unittest.cc b/content/renderer/loader/resource_dispatcher_unittest.cc index 5460d348..37521395 100644 --- a/content/renderer/loader/resource_dispatcher_unittest.cc +++ b/content/renderer/loader/resource_dispatcher_unittest.cc
@@ -158,7 +158,7 @@ std::vector<std::pair<network::mojom::URLLoaderRequest, network::mojom::URLLoaderClientPtr>> loader_and_clients_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<ResourceDispatcher> dispatcher_; };
diff --git a/content/renderer/loader/url_loader_client_impl_unittest.cc b/content/renderer/loader/url_loader_client_impl_unittest.cc index d7dbe6a..2279efd 100644 --- a/content/renderer/loader/url_loader_client_impl_unittest.cc +++ b/content/renderer/loader/url_loader_client_impl_unittest.cc
@@ -98,7 +98,7 @@ return options; } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<ResourceDispatcher> dispatcher_; TestRequestPeer::Context request_peer_context_; int request_id_ = 0;
diff --git a/content/renderer/loader/web_url_loader_impl_unittest.cc b/content/renderer/loader/web_url_loader_impl_unittest.cc index 8254e3e..344f8d9 100644 --- a/content/renderer/loader/web_url_loader_impl_unittest.cc +++ b/content/renderer/loader/web_url_loader_impl_unittest.cc
@@ -388,7 +388,7 @@ RequestPeer* peer() { return dispatcher()->peer(); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestResourceDispatcher dispatcher_; mojo::ScopedDataPipeProducerHandle body_handle_; std::unique_ptr<TestWebURLLoaderClient> client_;
diff --git a/content/renderer/media/android/stream_texture_wrapper_impl_unittest.cc b/content/renderer/media/android/stream_texture_wrapper_impl_unittest.cc index 34abfbb..924b3578 100644 --- a/content/renderer/media/android/stream_texture_wrapper_impl_unittest.cc +++ b/content/renderer/media/android/stream_texture_wrapper_impl_unittest.cc
@@ -18,7 +18,7 @@ StreamTextureWrapperImplTest() {} // Necessary, or else GetSingleThreadTaskRunnerForTesting() fails. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: DISALLOW_COPY_AND_ASSIGN(StreamTextureWrapperImplTest);
diff --git a/content/renderer/media/audio/audio_output_ipc_factory_unittest.cc b/content/renderer/media/audio/audio_output_ipc_factory_unittest.cc index e260eef..3dca749 100644 --- a/content/renderer/media/audio/audio_output_ipc_factory_unittest.cc +++ b/content/renderer/media/audio/audio_output_ipc_factory_unittest.cc
@@ -102,7 +102,7 @@ TEST_F(AudioOutputIPCFactoryTest, CallFactoryFromIOThread) { // This test makes sure that AudioOutputIPCFactory correctly binds the // RendererAudioOutputStreamFactoryPtr to the IO thread. - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; auto io_thread = MakeIOThread(); @@ -140,7 +140,7 @@ TEST_F(AudioOutputIPCFactoryTest, SeveralFactories) { // This test simulates having several frames being created and destructed. - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; auto io_thread = MakeIOThread(); const int n_factories = 5; @@ -200,7 +200,7 @@ TEST_F(AudioOutputIPCFactoryTest, RegisterDeregisterBackToBack_Deregisters) { // This test makes sure that calling Register... followed by Deregister... // correctly sequences the registration before the deregistration. - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; auto io_thread = MakeIOThread(); FakeRemoteFactory remote_factory;
diff --git a/content/renderer/media/audio/audio_renderer_mixer_manager_unittest.cc b/content/renderer/media/audio/audio_renderer_mixer_manager_unittest.cc index 5b583ff..f26870b 100644 --- a/content/renderer/media/audio/audio_renderer_mixer_manager_unittest.cc +++ b/content/renderer/media/audio/audio_renderer_mixer_manager_unittest.cc
@@ -137,7 +137,7 @@ return nullptr; } - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; std::unique_ptr<AudioRendererMixerManager> manager_; scoped_refptr<media::MockAudioRendererSink> mock_sink_;
diff --git a/content/renderer/media/audio/audio_renderer_sink_cache_unittest.cc b/content/renderer/media/audio/audio_renderer_sink_cache_unittest.cc index c5409d7..7a68fca1 100644 --- a/content/renderer/media/audio/audio_renderer_sink_cache_unittest.cc +++ b/content/renderer/media/audio/audio_renderer_sink_cache_unittest.cc
@@ -32,9 +32,8 @@ class AudioRendererSinkCacheTest : public testing::Test { public: AudioRendererSinkCacheTest() - : task_env_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED), + : task_env_(base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED), cache_(std::make_unique<AudioRendererSinkCacheImpl>( task_env_.GetMainThreadTaskRunner(), base::BindRepeating(&AudioRendererSinkCacheTest::CreateSink, @@ -88,7 +87,7 @@ void DropSinksForFrame(int frame_id) { cache_->DropSinksForFrame(frame_id); } - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; std::unique_ptr<AudioRendererSinkCacheImpl> cache_; private:
diff --git a/content/renderer/media/audio/mojo_audio_input_ipc_unittest.cc b/content/renderer/media/audio/mojo_audio_input_ipc_unittest.cc index 7b16104..0abb6541 100644 --- a/content/renderer/media/audio/mojo_audio_input_ipc_unittest.cc +++ b/content/renderer/media/audio/mojo_audio_input_ipc_unittest.cc
@@ -135,8 +135,8 @@ } // namespace TEST(MojoAudioInputIPC, OnStreamCreated_Propagates) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); StrictMock<MockStream> stream; StrictMock<MockDelegate> delegate; FakeStreamCreator creator(&stream, false); @@ -156,8 +156,8 @@ } TEST(MojoAudioInputIPC, FactoryDisconnected_SendsError) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); StrictMock<MockDelegate> delegate; const std::unique_ptr<media::AudioInputIPC> ipc = @@ -181,8 +181,8 @@ } TEST(MojoAudioInputIPC, OnStreamCreated_PropagatesInitiallyMuted) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); StrictMock<MockStream> stream; StrictMock<MockDelegate> delegate; FakeStreamCreator creator(&stream, true); @@ -202,8 +202,8 @@ } TEST(MojoAudioInputIPC, IsReusable) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); StrictMock<MockStream> stream; StrictMock<MockDelegate> delegate; FakeStreamCreator creator(&stream, false); @@ -228,8 +228,8 @@ } TEST(MojoAudioInputIPC, IsReusableAfterError) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); StrictMock<MockStream> stream; StrictMock<MockDelegate> delegate; FakeStreamCreator creator(&stream, false); @@ -259,8 +259,8 @@ } TEST(MojoAudioInputIPC, Record_Records) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); StrictMock<MockStream> stream; StrictMock<MockDelegate> delegate; FakeStreamCreator creator(&stream, false); @@ -283,8 +283,8 @@ } TEST(MojoAudioInputIPC, SetVolume_SetsVolume) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); StrictMock<MockStream> stream; StrictMock<MockDelegate> delegate; FakeStreamCreator creator(&stream, false); @@ -307,8 +307,8 @@ } TEST(MojoAudioInputIPC, SetOutputDeviceForAec_AssociatesInputAndOutputForAec) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); StrictMock<MockStream> stream; StrictMock<MockDelegate> delegate; FakeStreamCreator creator(&stream, false);
diff --git a/content/renderer/media/audio/mojo_audio_output_ipc_unittest.cc b/content/renderer/media/audio/mojo_audio_output_ipc_unittest.cc index f151d22..9f07ba5 100644 --- a/content/renderer/media/audio/mojo_audio_output_ipc_unittest.cc +++ b/content/renderer/media/audio/mojo_audio_output_ipc_unittest.cc
@@ -204,8 +204,8 @@ } // namespace TEST(MojoAudioOutputIPC, AuthorizeWithoutFactory_CallsAuthorizedWithError) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); const base::UnguessableToken session_id = base::UnguessableToken::Create(); StrictMock<MockDelegate> delegate; @@ -227,8 +227,8 @@ TEST(MojoAudioOutputIPC, CreateWithoutAuthorizationWithoutFactory_CallsAuthorizedWithError) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); StrictMock<MockDelegate> delegate; std::unique_ptr<media::AudioOutputIPC> ipc = @@ -245,8 +245,8 @@ } TEST(MojoAudioOutputIPC, DeviceAuthorized_Propagates) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); const base::UnguessableToken session_id = base::UnguessableToken::Create(); TestRemoteFactory stream_factory; StrictMock<MockDelegate> delegate; @@ -270,8 +270,8 @@ } TEST(MojoAudioOutputIPC, OnDeviceCreated_Propagates) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); const base::UnguessableToken session_id = base::UnguessableToken::Create(); TestRemoteFactory stream_factory; StrictMock<MockStream> stream; @@ -299,8 +299,8 @@ TEST(MojoAudioOutputIPC, CreateWithoutAuthorization_RequestsAuthorizationFirst) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestRemoteFactory stream_factory; StrictMock<MockStream> stream; StrictMock<MockDelegate> delegate; @@ -328,8 +328,8 @@ } TEST(MojoAudioOutputIPC, IsReusable) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); const base::UnguessableToken session_id = base::UnguessableToken::Create(); TestRemoteFactory stream_factory; StrictMock<MockStream> stream; @@ -361,8 +361,8 @@ } TEST(MojoAudioOutputIPC, IsReusableAfterError) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); const base::UnguessableToken session_id = base::UnguessableToken::Create(); TestRemoteFactory stream_factory; StrictMock<MockStream> stream; @@ -416,8 +416,8 @@ } TEST(MojoAudioOutputIPC, DeviceNotAuthorized_Propagates) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); const base::UnguessableToken session_id = base::UnguessableToken::Create(); TestRemoteFactory stream_factory; StrictMock<MockDelegate> delegate; @@ -449,8 +449,8 @@ // The authorization IPC message might be aborted by the remote end // disconnecting. In this case, the MojoAudioOutputIPC object must still // send a notification to unblock the AudioOutputIPCDelegate. - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); const base::UnguessableToken session_id = base::UnguessableToken::Create(); TestRemoteFactory stream_factory; StrictMock<MockDelegate> delegate; @@ -481,8 +481,8 @@ // This test makes sure that the MojoAudioOutputIPC doesn't callback for // authorization when the factory disconnects if it already got a callback // for authorization. - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); const base::UnguessableToken session_id = base::UnguessableToken::Create(); TestRemoteFactory stream_factory; stream_factory.PrepareProviderForAuthorization( @@ -509,8 +509,8 @@ } TEST(MojoAudioOutputIPC, AuthorizeNoClose_DCHECKs) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestRemoteFactory stream_factory; const base::UnguessableToken session_id = base::UnguessableToken::Create(); StrictMock<MockDelegate> delegate; @@ -531,8 +531,8 @@ } TEST(MojoAudioOutputIPC, CreateNoClose_DCHECKs) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestRemoteFactory stream_factory; StrictMock<MockDelegate> delegate; StrictMock<MockStream> stream; @@ -555,8 +555,8 @@ } TEST(MojoAudioOutputIPC, Play_Plays) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestRemoteFactory stream_factory; const base::UnguessableToken session_id = base::UnguessableToken::Create(); StrictMock<MockStream> stream; @@ -585,8 +585,8 @@ } TEST(MojoAudioOutputIPC, Pause_Pauses) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestRemoteFactory stream_factory; const base::UnguessableToken session_id = base::UnguessableToken::Create(); StrictMock<MockStream> stream; @@ -615,8 +615,8 @@ } TEST(MojoAudioOutputIPC, SetVolume_SetsVolume) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestRemoteFactory stream_factory; const base::UnguessableToken session_id = base::UnguessableToken::Create(); StrictMock<MockStream> stream;
diff --git a/content/renderer/media/batching_media_log_unittest.cc b/content/renderer/media/batching_media_log_unittest.cc index 2b36faa..8513616d 100644 --- a/content/renderer/media/batching_media_log_unittest.cc +++ b/content/renderer/media/batching_media_log_unittest.cc
@@ -64,7 +64,7 @@ } int add_events_count_ = 0; std::vector<media::MediaLogEvent> events_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; MockRenderThread render_thread_; base::SimpleTestTickClock tick_clock_; scoped_refptr<base::TestMockTimeTaskRunner> task_runner_;
diff --git a/content/renderer/media/renderer_webaudiodevice_impl_unittest.cc b/content/renderer/media/renderer_webaudiodevice_impl_unittest.cc index b20ccd4..a5294eca 100644 --- a/content/renderer/media/renderer_webaudiodevice_impl_unittest.cc +++ b/content/renderer/media/renderer_webaudiodevice_impl_unittest.cc
@@ -120,7 +120,7 @@ void TearDown() override { webaudio_device_.reset(); } std::unique_ptr<RendererWebAudioDeviceImpl> webaudio_device_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(RendererWebAudioDeviceImplTest, ChannelLayout) {
diff --git a/content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc b/content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc index b66700e0..996cf85 100644 --- a/content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc +++ b/content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc
@@ -48,8 +48,7 @@ : public ::testing::Test { public: MediaStreamRemoteVideoSourceTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), child_process_(new ChildProcess()), mock_factory_(new MockPeerConnectionDependencyFactory()), webrtc_video_track_(MockWebRtcVideoTrack::Create("test")), @@ -150,7 +149,7 @@ ++number_of_failed_track_starts_; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<ChildProcess> child_process_; std::unique_ptr<MockPeerConnectionDependencyFactory> mock_factory_; scoped_refptr<webrtc::VideoTrackInterface> webrtc_video_track_;
diff --git a/content/renderer/media/webrtc/media_stream_track_metrics_unittest.cc b/content/renderer/media/webrtc/media_stream_track_metrics_unittest.cc index ad902987..10d41c3 100644 --- a/content/renderer/media/webrtc/media_stream_track_metrics_unittest.cc +++ b/content/renderer/media/webrtc/media_stream_track_metrics_unittest.cc
@@ -85,8 +85,7 @@ class MediaStreamTrackMetricsTest : public testing::Test { public: MediaStreamTrackMetricsTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), signaling_thread_("signaling_thread") {} void SetUp() override { @@ -151,7 +150,7 @@ std::unique_ptr<MockMediaStreamTrackMetrics> metrics_; scoped_refptr<MediaStreamInterface> stream_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::Thread signaling_thread_; };
diff --git a/content/renderer/media/webrtc/media_stream_video_webrtc_sink_unittest.cc b/content/renderer/media/webrtc/media_stream_video_webrtc_sink_unittest.cc index c2eafa7..ab6ae78 100644 --- a/content/renderer/media/webrtc/media_stream_video_webrtc_sink_unittest.cc +++ b/content/renderer/media/webrtc/media_stream_video_webrtc_sink_unittest.cc
@@ -18,8 +18,7 @@ class MediaStreamVideoWebRtcSinkTest : public ::testing::Test { public: MediaStreamVideoWebRtcSinkTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetVideoTrack() { registry_.Init(); @@ -50,9 +49,9 @@ private: blink::MockMediaStreamRegistry registry_; // A ChildProcess is needed to fool the Tracks and Sources into believing they - // are on the right threads. A ScopedTaskEnvironment must be instantiated + // are on the right threads. A TaskEnvironment must be instantiated // before ChildProcess to prevent it from leaking a ThreadPool. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const ChildProcess child_process_; };
diff --git a/content/renderer/media/webrtc/peer_connection_dependency_factory_unittest.cc b/content/renderer/media/webrtc/peer_connection_dependency_factory_unittest.cc index 6f896e9..a42a97f 100644 --- a/content/renderer/media/webrtc/peer_connection_dependency_factory_unittest.cc +++ b/content/renderer/media/webrtc/peer_connection_dependency_factory_unittest.cc
@@ -18,7 +18,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockPeerConnectionDependencyFactory> dependency_factory_; };
diff --git a/content/renderer/media/webrtc/peer_connection_tracker_unittest.cc b/content/renderer/media/webrtc/peer_connection_tracker_unittest.cc index 1eaed4c..5816e0f 100644 --- a/content/renderer/media/webrtc/peer_connection_tracker_unittest.cc +++ b/content/renderer/media/webrtc/peer_connection_tracker_unittest.cc
@@ -173,7 +173,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockPeerConnectionTrackerHost> mock_host_; std::unique_ptr<PeerConnectionTracker> tracker_; std::unique_ptr<MockSendTargetThread> target_thread_;
diff --git a/content/renderer/media/webrtc/rtc_peer_connection_handler_unittest.cc b/content/renderer/media/webrtc/rtc_peer_connection_handler_unittest.cc index 67fa606..e0a3b2ff 100644 --- a/content/renderer/media/webrtc/rtc_peer_connection_handler_unittest.cc +++ b/content/renderer/media/webrtc/rtc_peer_connection_handler_unittest.cc
@@ -593,9 +593,9 @@ } public: - // The ScopedTaskEnvironment prevents the ChildProcess from leaking a + // The TaskEnvironment prevents the ChildProcess from leaking a // ThreadPool. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ChildProcess child_process_; std::unique_ptr<WebRtcAudioDeviceTestingPlatformSupport> webrtc_audio_device_platform_support_;
diff --git a/content/renderer/media/webrtc/rtc_rtp_receiver_unittest.cc b/content/renderer/media/webrtc/rtc_rtp_receiver_unittest.cc index 98241921..897e31d 100644 --- a/content/renderer/media/webrtc/rtc_rtp_receiver_unittest.cc +++ b/content/renderer/media/webrtc/rtc_rtp_receiver_unittest.cc
@@ -100,8 +100,8 @@ // Code under test expects to be run in a process with an initialized // ChildProcess, which requires ThreadPool, and a main-thread MessageLoop, - // which the ScopedTaskEnvironment also provides. - base::test::ScopedTaskEnvironment task_environment_; + // which the TaskEnvironment also provides. + base::test::TaskEnvironment task_environment_; ChildProcess child_process_; std::unique_ptr<MockPeerConnectionDependencyFactory> dependency_factory_;
diff --git a/content/renderer/media/webrtc/rtc_rtp_sender_unittest.cc b/content/renderer/media/webrtc/rtc_rtp_sender_unittest.cc index 6bc1068..2a573fe 100644 --- a/content/renderer/media/webrtc/rtc_rtp_sender_unittest.cc +++ b/content/renderer/media/webrtc/rtc_rtp_sender_unittest.cc
@@ -141,8 +141,8 @@ // Code under test expects to be run in a process with an initialized // ChildProcess, which requires ThreadPool, and a main-thread MessageLoop, - // which the ScopedTaskEnvironment also provides. - base::test::ScopedTaskEnvironment task_environment_; + // which the TaskEnvironment also provides. + base::test::TaskEnvironment task_environment_; ChildProcess child_process_; std::unique_ptr<MockPeerConnectionDependencyFactory> dependency_factory_;
diff --git a/content/renderer/media/webrtc/rtc_rtp_transceiver_unittest.cc b/content/renderer/media/webrtc/rtc_rtp_transceiver_unittest.cc index 15577e8..fba7469 100644 --- a/content/renderer/media/webrtc/rtc_rtp_transceiver_unittest.cc +++ b/content/renderer/media/webrtc/rtc_rtp_transceiver_unittest.cc
@@ -175,7 +175,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; protected: std::unique_ptr<MockPeerConnectionDependencyFactory> dependency_factory_;
diff --git a/content/renderer/media/webrtc/rtc_video_decoder_adapter_unittest.cc b/content/renderer/media/webrtc/rtc_video_decoder_adapter_unittest.cc index d84e092..c3adcac 100644 --- a/content/renderer/media/webrtc/rtc_video_decoder_adapter_unittest.cc +++ b/content/renderer/media/webrtc/rtc_video_decoder_adapter_unittest.cc
@@ -233,7 +233,7 @@ sdp_format_ = sdp_format; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::Thread media_thread_; // Owned by |rtc_video_decoder_adapter_|.
diff --git a/content/renderer/media/webrtc/task_queue_factory_unittest.cc b/content/renderer/media/webrtc/task_queue_factory_unittest.cc index b65c017a..b28cfb9 100644 --- a/content/renderer/media/webrtc/task_queue_factory_unittest.cc +++ b/content/renderer/media/webrtc/task_queue_factory_unittest.cc
@@ -24,7 +24,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<webrtc::TaskQueueFactory> factory_; };
diff --git a/content/renderer/media/webrtc/transceiver_state_surfacer_unittest.cc b/content/renderer/media/webrtc/transceiver_state_surfacer_unittest.cc index 1b97d981..879dd59 100644 --- a/content/renderer/media/webrtc/transceiver_state_surfacer_unittest.cc +++ b/content/renderer/media/webrtc/transceiver_state_surfacer_unittest.cc
@@ -270,7 +270,7 @@ run_loop->Quit(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; protected: scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
diff --git a/content/renderer/media/webrtc/webrtc_audio_renderer_unittest.cc b/content/renderer/media/webrtc/webrtc_audio_renderer_unittest.cc index 1df32284..e581de5 100644 --- a/content/renderer/media/webrtc/webrtc_audio_renderer_unittest.cc +++ b/content/renderer/media/webrtc/webrtc_audio_renderer_unittest.cc
@@ -184,8 +184,8 @@ audio_device_factory_platform_; const base::Optional<base::UnguessableToken> kAudioProcessingId = base::UnguessableToken::Create(); - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; scoped_refptr<media::MockAudioRendererSink> mock_sink_; std::unique_ptr<MockAudioRendererSource> source_; blink::WebMediaStream stream_;
diff --git a/content/renderer/media/webrtc/webrtc_media_stream_track_adapter_map_unittest.cc b/content/renderer/media/webrtc/webrtc_media_stream_track_adapter_map_unittest.cc index 7991921..878062d 100644 --- a/content/renderer/media/webrtc/webrtc_media_stream_track_adapter_map_unittest.cc +++ b/content/renderer/media/webrtc/webrtc_media_stream_track_adapter_map_unittest.cc
@@ -107,9 +107,9 @@ } protected: - // The ScopedTaskEnvironment prevents the ChildProcess from leaking a + // The TaskEnvironment prevents the ChildProcess from leaking a // ThreadPool. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ChildProcess child_process_; std::unique_ptr<MockPeerConnectionDependencyFactory> dependency_factory_;
diff --git a/content/renderer/media/webrtc/webrtc_media_stream_track_adapter_unittest.cc b/content/renderer/media/webrtc/webrtc_media_stream_track_adapter_unittest.cc index 0b4f4dc38..e85d136 100644 --- a/content/renderer/media/webrtc/webrtc_media_stream_track_adapter_unittest.cc +++ b/content/renderer/media/webrtc/webrtc_media_stream_track_adapter_unittest.cc
@@ -113,9 +113,9 @@ } protected: - // The ScopedTaskEnvironment prevents the ChildProcess from leaking a + // The TaskEnvironment prevents the ChildProcess from leaking a // ThreadPool. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ChildProcess child_process_; std::unique_ptr<MockPeerConnectionDependencyFactory> dependency_factory_;
diff --git a/content/renderer/media/webrtc/webrtc_set_description_observer_unittest.cc b/content/renderer/media/webrtc/webrtc_set_description_observer_unittest.cc index 9034235..5375560 100644 --- a/content/renderer/media/webrtc/webrtc_set_description_observer_unittest.cc +++ b/content/renderer/media/webrtc/webrtc_set_description_observer_unittest.cc
@@ -361,9 +361,9 @@ } protected: - // The ScopedTaskEnvironment prevents the ChildProcess from leaking a + // The TaskEnvironment prevents the ChildProcess from leaking a // ThreadPool. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ChildProcess child_process_; scoped_refptr<webrtc::MockPeerConnectionInterface> pc_;
diff --git a/content/renderer/pepper/pepper_broker_unittest.cc b/content/renderer/pepper/pepper_broker_unittest.cc index af2f082..8f222db2 100644 --- a/content/renderer/pepper/pepper_broker_unittest.cc +++ b/content/renderer/pepper/pepper_broker_unittest.cc
@@ -19,9 +19,8 @@ class PepperBrokerTest : public ::testing::Test { protected: PepperBrokerTest() - : task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} - base::test::ScopedTaskEnvironment task_environment_; + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} + base::test::TaskEnvironment task_environment_; // We need a render process for ppapi::proxy::ProxyChannel to work. MockRenderProcess mock_process_; };
diff --git a/content/renderer/pepper/pepper_device_enumeration_host_helper_unittest.cc b/content/renderer/pepper/pepper_device_enumeration_host_helper_unittest.cc index f040b60..c2ba0a4 100644 --- a/content/renderer/pepper/pepper_device_enumeration_host_helper_unittest.cc +++ b/content/renderer/pepper/pepper_device_enumeration_host_helper_unittest.cc
@@ -146,7 +146,7 @@ ppapi::host::PpapiHost ppapi_host_; ppapi::host::ResourceHost resource_host_; PepperDeviceEnumerationHostHelper device_enumeration_; - base::test::ScopedTaskEnvironment + base::test::TaskEnvironment task_environment_; // required for async calls to work. private:
diff --git a/content/renderer/pepper/pepper_graphics_2d_host_unittest.cc b/content/renderer/pepper/pepper_graphics_2d_host_unittest.cc index 340dbc5..b491ff5 100644 --- a/content/renderer/pepper/pepper_graphics_2d_host_unittest.cc +++ b/content/renderer/pepper/pepper_graphics_2d_host_unittest.cc
@@ -82,7 +82,7 @@ private: ppapi::ViewData renderer_view_data_; std::unique_ptr<PepperGraphics2DHost> host_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; MockRendererPpapiHost renderer_ppapi_host_; ppapi::TestGlobals test_globals_; };
diff --git a/content/renderer/pepper/plugin_instance_throttler_impl_unittest.cc b/content/renderer/pepper/plugin_instance_throttler_impl_unittest.cc index 65dea55..20bab6e 100644 --- a/content/renderer/pepper/plugin_instance_throttler_impl_unittest.cc +++ b/content/renderer/pepper/plugin_instance_throttler_impl_unittest.cc
@@ -83,7 +83,7 @@ int change_callback_calls_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(PluginInstanceThrottlerImplTest, ThrottleAndUnthrottleByClick) {
diff --git a/content/renderer/pepper/v8_var_converter_unittest.cc b/content/renderer/pepper/v8_var_converter_unittest.cc index 5fe799bd..a0818c4 100644 --- a/content/renderer/pepper/v8_var_converter_unittest.cc +++ b/content/renderer/pepper/v8_var_converter_unittest.cc
@@ -239,7 +239,7 @@ std::unique_ptr<V8VarConverter> converter_; private: - base::test::ScopedTaskEnvironment + base::test::TaskEnvironment task_environment_; // Required to receive callbacks. TestGlobals globals_;
diff --git a/content/renderer/queue_message_swap_promise_unittest.cc b/content/renderer/queue_message_swap_promise_unittest.cc index 878d37e..30abdaa 100644 --- a/content/renderer/queue_message_swap_promise_unittest.cc +++ b/content/renderer/queue_message_swap_promise_unittest.cc
@@ -138,7 +138,7 @@ void VisualStateSwapPromiseDidNotSwap( cc::SwapPromise::DidNotSwapReason reason); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; scoped_refptr<TestSyncMessageFilter> sync_message_filter_; std::vector<IPC::Message> messages_;
diff --git a/content/renderer/render_frame_metadata_observer_impl_unittest.cc b/content/renderer/render_frame_metadata_observer_impl_unittest.cc index c569d77..7425127 100644 --- a/content/renderer/render_frame_metadata_observer_impl_unittest.cc +++ b/content/renderer/render_frame_metadata_observer_impl_unittest.cc
@@ -75,11 +75,11 @@ void TearDown() override { observer_impl_.reset(); client_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<testing::NiceMock<MockRenderFrameMetadataObserverClient>> client_; std::unique_ptr<RenderFrameMetadataObserverImpl> observer_impl_;
diff --git a/content/renderer/render_widget_unittest.cc b/content/renderer/render_widget_unittest.cc index ec78fba..6293b7e 100644 --- a/content/renderer/render_widget_unittest.cc +++ b/content/renderer/render_widget_unittest.cc
@@ -284,7 +284,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: MockRenderProcess render_process_; @@ -512,7 +512,7 @@ FakeCompositorDependencies compositor_deps_; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: MockRenderProcess render_process_;
diff --git a/content/renderer/service_worker/service_worker_provider_context_unittest.cc b/content/renderer/service_worker/service_worker_provider_context_unittest.cc index 072b43a..b4a29637 100644 --- a/content/renderer/service_worker/service_worker_provider_context_unittest.cc +++ b/content/renderer/service_worker/service_worker_provider_context_unittest.cc
@@ -292,7 +292,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; FakeURLLoaderFactory fake_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> loader_factory_;
diff --git a/content/renderer/v8_value_converter_impl_unittest.cc b/content/renderer/v8_value_converter_impl_unittest.cc index 694f5bf..4fbb9bf64 100644 --- a/content/renderer/v8_value_converter_impl_unittest.cc +++ b/content/renderer/v8_value_converter_impl_unittest.cc
@@ -240,7 +240,7 @@ .As<T>(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; v8::Isolate* isolate_;
diff --git a/content/renderer/worker/embedded_shared_worker_stub.cc b/content/renderer/worker/embedded_shared_worker_stub.cc index a211e44..891e854 100644 --- a/content/renderer/worker/embedded_shared_worker_stub.cc +++ b/content/renderer/worker/embedded_shared_worker_stub.cc
@@ -55,11 +55,11 @@ subresource_loader_factory_bundle_info, blink::mojom::ControllerServiceWorkerInfoPtr controller_info, mojo::PendingRemote<blink::mojom::SharedWorkerHost> host, - blink::mojom::SharedWorkerRequest request, + mojo::PendingReceiver<blink::mojom::SharedWorker> receiver, service_manager::mojom::InterfaceProviderPtr interface_provider, mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker> browser_interface_broker) - : binding_(this, std::move(request)), + : receiver_(this, std::move(receiver)), host_(std::move(host)), url_(info->url), renderer_preferences_(renderer_preferences), @@ -120,7 +120,7 @@ browser_interface_broker.PassPipe(), pause_on_start); // If the host drops its connection, then self-destruct. - binding_.set_connection_error_handler(base::BindOnce( + receiver_.set_disconnect_handler(base::BindOnce( &EmbeddedSharedWorkerStub::Terminate, base::Unretained(this))); }
diff --git a/content/renderer/worker/embedded_shared_worker_stub.h b/content/renderer/worker/embedded_shared_worker_stub.h index 0675103..bb69f20 100644 --- a/content/renderer/worker/embedded_shared_worker_stub.h +++ b/content/renderer/worker/embedded_shared_worker_stub.h
@@ -12,8 +12,9 @@ #include "base/unguessable_token.h" #include "content/renderer/service_worker/service_worker_provider_context.h" #include "ipc/ipc_listener.h" -#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" +#include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" #include "services/service_manager/public/mojom/interface_provider.mojom.h" @@ -74,7 +75,7 @@ subresource_loader_factory_bundle_info, blink::mojom::ControllerServiceWorkerInfoPtr controller_info, mojo::PendingRemote<blink::mojom::SharedWorkerHost> host, - blink::mojom::SharedWorkerRequest request, + mojo::PendingReceiver<blink::mojom::SharedWorker> receiver, service_manager::mojom::InterfaceProviderPtr interface_provider, mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker> browser_interface_broker); @@ -102,7 +103,7 @@ mojo::ScopedMessagePipeHandle port) override; void Terminate() override; - mojo::Binding<blink::mojom::SharedWorker> binding_; + mojo::Receiver<blink::mojom::SharedWorker> receiver_; mojo::Remote<blink::mojom::SharedWorkerHost> host_; bool running_ = false; GURL url_;
diff --git a/content/renderer/worker/shared_worker_factory_impl.cc b/content/renderer/worker/shared_worker_factory_impl.cc index 55312f6..8a6e49c 100644 --- a/content/renderer/worker/shared_worker_factory_impl.cc +++ b/content/renderer/worker/shared_worker_factory_impl.cc
@@ -45,7 +45,7 @@ subresource_loader_factories, blink::mojom::ControllerServiceWorkerInfoPtr controller_info, mojo::PendingRemote<blink::mojom::SharedWorkerHost> host, - blink::mojom::SharedWorkerRequest request, + mojo::PendingReceiver<blink::mojom::SharedWorker> receiver, service_manager::mojom::InterfaceProviderPtr interface_provider, mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker> browser_interface_broker) { @@ -57,7 +57,7 @@ appcache_host_id.value_or(base::UnguessableToken()), std::move(main_script_load_params), std::move(subresource_loader_factories), std::move(controller_info), - std::move(host), std::move(request), std::move(interface_provider), + std::move(host), std::move(receiver), std::move(interface_provider), std::move(browser_interface_broker)); }
diff --git a/content/renderer/worker/shared_worker_factory_impl.h b/content/renderer/worker/shared_worker_factory_impl.h index 929e874e..ddee682f 100644 --- a/content/renderer/worker/shared_worker_factory_impl.h +++ b/content/renderer/worker/shared_worker_factory_impl.h
@@ -49,7 +49,7 @@ subresource_loader_factories, blink::mojom::ControllerServiceWorkerInfoPtr controller_info, mojo::PendingRemote<blink::mojom::SharedWorkerHost> host, - blink::mojom::SharedWorkerRequest request, + mojo::PendingReceiver<blink::mojom::SharedWorker> receiver, service_manager::mojom::InterfaceProviderPtr interface_provider, mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker> browser_interface_broker) override;
diff --git a/content/renderer/worker/worker_thread_registry_unittest.cc b/content/renderer/worker/worker_thread_registry_unittest.cc index ba3438da..4c8794d 100644 --- a/content/renderer/worker/worker_thread_registry_unittest.cc +++ b/content/renderer/worker/worker_thread_registry_unittest.cc
@@ -20,7 +20,7 @@ WorkerThreadRegistry task_runner_; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; class MockObserver : public WorkerThread::Observer {
diff --git a/content/test/data/browsing_data/site_data.html b/content/test/data/browsing_data/site_data.html index 5e798c828..0a2a8883 100644 --- a/content/test/data/browsing_data/site_data.html +++ b/content/test/data/browsing_data/site_data.html
@@ -74,7 +74,7 @@ function openFile_(name, options, callback, error) { window.webkitRequestFileSystem(TEMPORARY, 1024, function (fs) { fs.root.getFile(name, options, callback, error); - }); + }, error); } function setFileSystem() { @@ -113,6 +113,7 @@ open.result.close(); success_(); } + open.onerror = failure_; } function hasIndexedDb() { @@ -122,6 +123,7 @@ open.result.close(); domAutomationController.send(hasStore); } + open.onerror = failure_; } function setHistory() {
diff --git a/content/test/ppapi_unittest.h b/content/test/ppapi_unittest.h index 6884402..4a01c15a 100644 --- a/content/test/ppapi_unittest.h +++ b/content/test/ppapi_unittest.h
@@ -37,10 +37,10 @@ void SetViewSize(int width, int height) const; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; - // Note: module must be declared right after |scoped_task_environment_| since - // we want it to get destroyed just before |scoped_task_environment_|. + // Note: module must be declared right after |task_environment_| since + // we want it to get destroyed just before |task_environment_|. scoped_refptr<PluginModule> module_; scoped_refptr<PepperPluginInstanceImpl> instance_;
diff --git a/content/test/proxy_service_mojo_unittest.cc b/content/test/proxy_service_mojo_unittest.cc index 9086db1..b5d5577 100644 --- a/content/test/proxy_service_mojo_unittest.cc +++ b/content/test/proxy_service_mojo_unittest.cc
@@ -129,7 +129,7 @@ &mock_host_resolver_, &net_log_, &network_delegate_); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; content::TestMojoProxyResolverFactory test_mojo_proxy_resolver_factory_; TestNetworkDelegate network_delegate_; net::MockHostResolver mock_host_resolver_;
diff --git a/content/test/test_blink_web_unit_test_support.h b/content/test/test_blink_web_unit_test_support.h index befb33e7..7ba8700 100644 --- a/content/test/test_blink_web_unit_test_support.h +++ b/content/test/test_blink_web_unit_test_support.h
@@ -33,11 +33,11 @@ // Create a mock version of scheduling infrastructure, which just forwards // all calls to the default task runner. // All non-blink users (content_unittests etc) should call this method. - // Each test has to create base::test::ScopedTaskEnvironment manually. + // Each test has to create base::test::TaskEnvironment manually. kMockScheduler, // Initialize blink platform with the real scheduler. // Should be used only by webkit_unit_tests. - // Tests don't have to create base::test::ScopedTaskEnvironment, but should + // Tests don't have to create base::test::TaskEnvironment, but should // be careful not to leak any tasks to the other tests. kRealScheduler, };
diff --git a/content/test/url_request_context_builder_mojo_unittest.cc b/content/test/url_request_context_builder_mojo_unittest.cc index 843f67c1..29d9f9c 100644 --- a/content/test/url_request_context_builder_mojo_unittest.cc +++ b/content/test/url_request_context_builder_mojo_unittest.cc
@@ -48,14 +48,13 @@ class URLRequestContextBuilderMojoTest : public PlatformTest { protected: URLRequestContextBuilderMojoTest() - : task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { test_server_.RegisterRequestHandler(base::Bind(&HandlePacRequest)); test_server_.AddDefaultHandlers( base::FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestMojoProxyResolverFactory test_mojo_proxy_resolver_factory_; net::EmbeddedTestServer test_server_; network::URLRequestContextBuilderMojo builder_;
diff --git a/dbus/bus_unittest.cc b/dbus/bus_unittest.cc index f24678b9..29ac9b2d 100644 --- a/dbus/bus_unittest.cc +++ b/dbus/bus_unittest.cc
@@ -130,7 +130,7 @@ } TEST(BusTest, RemoveObjectProxy) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Start the D-Bus thread. base::Thread::Options thread_options; @@ -318,8 +318,8 @@ } TEST(BusTest, ListenForServiceOwnerChange) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); RunLoopWithExpectedCount run_loop_state;
diff --git a/dbus/end_to_end_async_unittest.cc b/dbus/end_to_end_async_unittest.cc index 2cf07b47..c25c183 100644 --- a/dbus/end_to_end_async_unittest.cc +++ b/dbus/end_to_end_async_unittest.cc
@@ -256,7 +256,7 @@ run_loop_->Run(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; std::vector<std::string> response_strings_; std::vector<std::string> error_names_; @@ -443,7 +443,7 @@ // We shouldn't receive any responses. Wait for a while just to make sure. run_loop_.reset(new base::RunLoop); - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop_->QuitClosure(), TestTimeouts::tiny_timeout()); run_loop_->Run(); EXPECT_TRUE(response_strings_.empty()); @@ -545,7 +545,7 @@ object_proxy_->CallMethod(&method_call, timeout_ms, base::DoNothing()); // Post a delayed task to quit the RunLoop. run_loop_.reset(new base::RunLoop); - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop_->QuitClosure(), TestTimeouts::tiny_timeout()); run_loop_->Run(); // We cannot tell if the empty callback is called, but at least we can
diff --git a/dbus/mock_unittest.cc b/dbus/mock_unittest.cc index 548bf970..8d05b29 100644 --- a/dbus/mock_unittest.cc +++ b/dbus/mock_unittest.cc
@@ -83,7 +83,7 @@ protected: std::string response_string_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; scoped_refptr<MockBus> mock_bus_; scoped_refptr<MockObjectProxy> mock_proxy_; @@ -123,7 +123,7 @@ ObjectProxy::ResponseCallback* response_callback) { std::unique_ptr<Response> response = CreateMockProxyResponse(method_call, timeout_ms); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&MockTest::RunResponseCallback, base::Unretained(this), std::move(*response_callback), std::move(response)));
diff --git a/dbus/object_manager_unittest.cc b/dbus/object_manager_unittest.cc index 37080e57..e8122cb 100644 --- a/dbus/object_manager_unittest.cc +++ b/dbus/object_manager_unittest.cc
@@ -206,7 +206,7 @@ WaitForMethodCallback(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; std::unique_ptr<base::Thread> dbus_thread_; scoped_refptr<Bus> bus_; @@ -406,7 +406,7 @@ // after setting up the match rule for PropertiesChanged. We should process // the PropertiesChanged event right after that. If we don't receive it within // 2 seconds, then fail the test. - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, base::BindOnce(&ObjectManagerTest::PropertiesChangedTestTimeout, base::Unretained(this)),
diff --git a/dbus/object_proxy_unittest.cc b/dbus/object_proxy_unittest.cc index 4ae25f3..3bc8d9f 100644 --- a/dbus/object_proxy_unittest.cc +++ b/dbus/object_proxy_unittest.cc
@@ -27,8 +27,8 @@ void TearDown() override { bus_->ShutdownAndBlock(); } - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; scoped_refptr<Bus> bus_; };
diff --git a/dbus/property_unittest.cc b/dbus/property_unittest.cc index 5e9f496..6c6df90 100644 --- a/dbus/property_unittest.cc +++ b/dbus/property_unittest.cc
@@ -159,7 +159,7 @@ } } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; std::unique_ptr<base::Thread> dbus_thread_; scoped_refptr<Bus> bus_;
diff --git a/dbus/signal_sender_verification_unittest.cc b/dbus/signal_sender_verification_unittest.cc index c2998d8..4a0ecd85 100644 --- a/dbus/signal_sender_verification_unittest.cc +++ b/dbus/signal_sender_verification_unittest.cc
@@ -116,7 +116,7 @@ void OnOwnership(bool expected, bool success) { ASSERT_EQ(expected, success); // PostTask to quit the RunLoop as this is called from D-Bus thread. - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&SignalSenderVerificationTest::OnOwnershipInternal, base::Unretained(this))); @@ -167,7 +167,7 @@ base::ThreadRestrictions::SetIOAllowed(false); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; std::unique_ptr<base::Thread> dbus_thread_; scoped_refptr<Bus> bus_;
diff --git a/device/bluetooth/bluetooth_adapter_mac_unittest.mm b/device/bluetooth/bluetooth_adapter_mac_unittest.mm index 61208af..c8dba08 100644 --- a/device/bluetooth/bluetooth_adapter_mac_unittest.mm +++ b/device/bluetooth/bluetooth_adapter_mac_unittest.mm
@@ -134,7 +134,7 @@ temp_dir_.GetPath().AppendASCII(kTestPropertyListFileName); } - void TearDown() override { scoped_task_environment_.RunUntilIdle(); } + void TearDown() override { task_environment_.RunUntilIdle(); } // Helper methods for setup and access to BluetoothAdapterMacTest's members. void PollAdapter() { adapter_mac_->PollAdapter(); } @@ -214,7 +214,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::TestSimpleTaskRunner> ui_task_runner_; scoped_refptr<BluetoothAdapter> adapter_; BluetoothAdapterMac* adapter_mac_;
diff --git a/device/bluetooth/bluetooth_adapter_unittest.cc b/device/bluetooth/bluetooth_adapter_unittest.cc index 46664bc5f..29ac7cc 100644 --- a/device/bluetooth/bluetooth_adapter_unittest.cc +++ b/device/bluetooth/bluetooth_adapter_unittest.cc
@@ -319,7 +319,7 @@ protected: scoped_refptr<TestBluetoothAdapter> adapter_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(BluetoothAdapterTest, NoDefaultPairingDelegate) { @@ -1104,14 +1104,14 @@ // Check if power can be turned off. adapter_->SetPowered(false, GetCallback(Call::EXPECTED), GetErrorCallback(Call::NOT_EXPECTED)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(adapter_->IsPowered()); EXPECT_EQ(1, observer.powered_changed_count()); // Check if power can be turned on again. adapter_->SetPowered(true, GetCallback(Call::EXPECTED), GetErrorCallback(Call::NOT_EXPECTED)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(adapter_->IsPowered()); EXPECT_EQ(2, observer.powered_changed_count()); } @@ -1148,7 +1148,7 @@ GetErrorCallback(Call::NOT_EXPECTED)); adapter_->SetPowered(false, GetCallback(Call::NOT_EXPECTED), GetErrorCallback(Call::EXPECTED)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(adapter_->IsPowered()); EXPECT_EQ(1, observer.powered_changed_count()); @@ -1158,7 +1158,7 @@ GetErrorCallback(Call::NOT_EXPECTED)); adapter_->SetPowered(true, GetCallback(Call::NOT_EXPECTED), GetErrorCallback(Call::EXPECTED)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(adapter_->IsPowered()); EXPECT_EQ(2, observer.powered_changed_count()); } @@ -1195,7 +1195,7 @@ GetErrorCallback(Call::NOT_EXPECTED)); }), GetErrorCallback(Call::NOT_EXPECTED)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(adapter_->IsPowered()); EXPECT_EQ(2, observer.powered_changed_count()); } @@ -1228,7 +1228,7 @@ // Turn power off. adapter_->SetPowered(false, GetCallback(Call::EXPECTED), GetErrorCallback(Call::NOT_EXPECTED)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(adapter_->IsPowered()); EXPECT_EQ(1, observer.powered_changed_count()); @@ -1239,7 +1239,7 @@ GetErrorCallback(Call::NOT_EXPECTED)); }), GetErrorCallback(Call::NOT_EXPECTED)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(adapter_->IsPowered()); EXPECT_EQ(3, observer.powered_changed_count()); } @@ -1292,7 +1292,7 @@ adapter_ = nullptr; // Empty the message loop to make sure posted callbacks get run. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(error_callback_called); } @@ -1312,7 +1312,7 @@ // Turn off adapter. adapter_->SetPowered(false, GetCallback(Call::EXPECTED), GetErrorCallback(Call::NOT_EXPECTED)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_FALSE(adapter_->IsPowered()); EXPECT_EQ(1, observer.powered_changed_count()); @@ -1322,7 +1322,7 @@ // Turn on adapter. adapter_->SetPowered(true, GetCallback(Call::EXPECTED), GetErrorCallback(Call::NOT_EXPECTED)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(adapter_->IsPowered()); EXPECT_EQ(2, observer.powered_changed_count());
diff --git a/device/bluetooth/bluez/bluetooth_adapter_profile_bluez_unittest.cc b/device/bluetooth/bluez/bluetooth_adapter_profile_bluez_unittest.cc index b799ffd..51b7fe4 100644 --- a/device/bluetooth/bluez/bluetooth_adapter_profile_bluez_unittest.cc +++ b/device/bluetooth/bluez/bluetooth_adapter_profile_bluez_unittest.cc
@@ -148,7 +148,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<BluetoothAdapter> adapter_;
diff --git a/device/bluetooth/bluez/bluetooth_bluez_unittest.cc b/device/bluetooth/bluez/bluetooth_bluez_unittest.cc index 4efd523..442d5c1 100644 --- a/device/bluetooth/bluez/bluetooth_bluez_unittest.cc +++ b/device/bluetooth/bluez/bluetooth_bluez_unittest.cc
@@ -273,7 +273,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; bluez::FakeBluetoothAdapterClient* fake_bluetooth_adapter_client_; bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_; scoped_refptr<BluetoothAdapter> adapter_;
diff --git a/device/bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc b/device/bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc index 078ea5a..beabb38 100644 --- a/device/bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc +++ b/device/bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc
@@ -287,7 +287,7 @@ base::RunLoop::QuitCurrentWhenIdleDeprecated(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_; bluez::FakeBluetoothGattServiceClient* fake_bluetooth_gatt_service_client_;
diff --git a/device/bluetooth/bluez/bluetooth_socket_bluez_unittest.cc b/device/bluetooth/bluez/bluetooth_socket_bluez_unittest.cc index d210a27..2873b1e8 100644 --- a/device/bluetooth/bluez/bluetooth_socket_bluez_unittest.cc +++ b/device/bluetooth/bluez/bluetooth_socket_bluez_unittest.cc
@@ -165,7 +165,7 @@ void ImmediateSuccessCallback() { ++success_callback_count_; } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<BluetoothAdapter> adapter_;
diff --git a/device/bluetooth/cast/bluetooth_adapter_cast_unittest.cc b/device/bluetooth/cast/bluetooth_adapter_cast_unittest.cc index 7802a72..0b628e9 100644 --- a/device/bluetooth/cast/bluetooth_adapter_cast_unittest.cc +++ b/device/bluetooth/cast/bluetooth_adapter_cast_unittest.cc
@@ -20,7 +20,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterCastTest); };
diff --git a/device/bluetooth/chromeos/bluetooth_utils_unittest.cc b/device/bluetooth/chromeos/bluetooth_utils_unittest.cc index e906d4d..5d5144d5 100644 --- a/device/bluetooth/chromeos/bluetooth_utils_unittest.cc +++ b/device/bluetooth/chromeos/bluetooth_utils_unittest.cc
@@ -83,7 +83,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<MockBluetoothAdapter> adapter_ = base::MakeRefCounted<testing::NiceMock<MockBluetoothAdapter>>(); base::test::ScopedFeatureList feature_list_;
diff --git a/device/bluetooth/device_unittest.cc b/device/bluetooth/device_unittest.cc index b8a0f83..ad1cc299 100644 --- a/device/bluetooth/device_unittest.cc +++ b/device/bluetooth/device_unittest.cc
@@ -173,7 +173,7 @@ scoped_refptr<NiceMockBluetoothAdapter> adapter_; NiceMockBluetoothDevice device_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojom::DevicePtr proxy_; mojo::StrongBindingPtr<mojom::Device> binding_ptr_;
diff --git a/device/bluetooth/test/bluetooth_test.h b/device/bluetooth/test/bluetooth_test.h index 8c476bc..f534c89 100644 --- a/device/bluetooth/test/bluetooth_test.h +++ b/device/bluetooth/test/bluetooth_test.h
@@ -648,9 +648,9 @@ // |device_ordinal|. LowEnergyDeviceData GetLowEnergyDeviceData(int device_ordinal) const; - // A ScopedTaskEnvironment is required by some implementations that will + // A TaskEnvironment is required by some implementations that will // PostTasks and by base::RunLoop().RunUntilIdle() use in this fixture. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<BluetoothAdapter> adapter_; std::vector<scoped_refptr<BluetoothAdvertisement>> advertisements_;
diff --git a/device/bluetooth/test/bluetooth_test_android.cc b/device/bluetooth/test/bluetooth_test_android.cc index d801af69..4cd02d8 100644 --- a/device/bluetooth/test/bluetooth_test_android.cc +++ b/device/bluetooth/test/bluetooth_test_android.cc
@@ -69,7 +69,7 @@ // use it across threads. |RunJavaRunnable| will acquire a new JNIEnv before // running the Runnable. runnable_ref.Reset(env, runnable); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&RunJavaRunnable, runnable_ref)); }
diff --git a/device/bluetooth/test/bluetooth_test_cast.cc b/device/bluetooth/test/bluetooth_test_cast.cc index bbe9bc20..c10b883 100644 --- a/device/bluetooth/test/bluetooth_test_cast.cc +++ b/device/bluetooth/test/bluetooth_test_cast.cc
@@ -165,7 +165,7 @@ // Update the adapter with the ScanResult. le_scan_manager_.observer_->OnNewScanResult(result); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } // namespace device
diff --git a/device/bluetooth/test/bluetooth_test_mac.mm b/device/bluetooth/test/bluetooth_test_mac.mm index 0f3fd0a..3032966 100644 --- a/device/bluetooth/test/bluetooth_test_mac.mm +++ b/device/bluetooth/test/bluetooth_test_mac.mm
@@ -115,7 +115,7 @@ void BluetoothTestMac::InitWithoutDefaultAdapter() { adapter_mac_ = BluetoothAdapterMac::CreateAdapterForTest( - "", "", scoped_task_environment_.GetMainThreadTaskRunner()) + "", "", task_environment_.GetMainThreadTaskRunner()) .get(); adapter_ = adapter_mac_; @@ -129,7 +129,7 @@ void BluetoothTestMac::InitWithFakeAdapter() { adapter_mac_ = BluetoothAdapterMac::CreateAdapterForTest( kTestAdapterName, kTestAdapterAddress, - scoped_task_environment_.GetMainThreadTaskRunner()) + task_environment_.GetMainThreadTaskRunner()) .get(); adapter_ = adapter_mac_;
diff --git a/device/fido/bio/enrollment_handler_unittest.cc b/device/fido/bio/enrollment_handler_unittest.cc index 9d79882..0985ef6 100644 --- a/device/fido/bio/enrollment_handler_unittest.cc +++ b/device/fido/bio/enrollment_handler_unittest.cc
@@ -69,7 +69,7 @@ uint8_t remaining_samples_; bool sampling_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; test::TestCallbackReceiver<> ready_callback_; test::ValueCallbackReceiver<FidoReturnCode> error_callback_; test::VirtualFidoDeviceFactory virtual_device_factory_;
diff --git a/device/fido/ble/fido_ble_connection_unittest.cc b/device/fido/ble/fido_ble_connection_unittest.cc index 937930e4..78a67333 100644 --- a/device/fido/ble/fido_ble_connection_unittest.cc +++ b/device/fido/ble/fido_ble_connection_unittest.cc
@@ -391,7 +391,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<MockBluetoothAdapter> adapter_ = base::MakeRefCounted<NiceMockBluetoothAdapter>();
diff --git a/device/fido/ble/fido_ble_device_unittest.cc b/device/fido/ble/fido_ble_device_unittest.cc index 3381a2a5..5ab1bcc54 100644 --- a/device/fido/ble/fido_ble_device_unittest.cc +++ b/device/fido/ble/fido_ble_device_unittest.cc
@@ -101,8 +101,8 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; private: scoped_refptr<MockBluetoothAdapter> adapter_ = @@ -124,7 +124,7 @@ EXPECT_CALL(*connection(), WriteControlPointPtr(_, _)) .WillOnce(Invoke([this](const auto& data, auto* cb) { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*cb), false)); })); @@ -140,7 +140,7 @@ ConnectWithLength(kControlPointLength); EXPECT_CALL(*connection(), WriteControlPointPtr(_, _)) .WillOnce(Invoke([this](const auto& data, auto* cb) { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*cb), true)); })); @@ -156,7 +156,7 @@ ConnectWithLength(kControlPointLength); EXPECT_CALL(*connection(), WriteControlPointPtr(_, _)) .WillOnce(Invoke([this](const auto& data, auto* cb) { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*cb), true)); })); @@ -179,10 +179,10 @@ EXPECT_CALL(*connection(), WriteControlPointPtr(_, _)) .WillOnce(Invoke([this](const auto& data, auto* cb) { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*cb), true)); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(connection()->read_callback(), data)); })); @@ -208,7 +208,7 @@ EXPECT_CALL(*connection(), WriteControlPointPtr(_, _)) .InSequence(sequence) .WillOnce(testing::WithArg<1>(Invoke([this](auto* cb) { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*cb), true)); }))); EXPECT_CALL(*connection(), WriteControlPointPtr(_, _)) @@ -336,10 +336,10 @@ EXPECT_CALL(*connection(), WriteControlPointPtr(_, _)) .WillOnce(::testing::WithArg<1>( Invoke([this, kBleInvalidCommandError](auto* cb) { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(*cb), true)); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(connection()->read_callback(), fido_parsing_utils::Materialize( kBleInvalidCommandError))); @@ -358,7 +358,7 @@ TestDeviceCallbackReceiver callback_receiver; device()->SendPing(std::vector<uint8_t>(), callback_receiver.callback()); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_EQ(FidoDevice::State::kDeviceError, device()->state_for_testing()); EXPECT_TRUE(callback_receiver.was_called()); EXPECT_FALSE(callback_receiver.value());
diff --git a/device/fido/ble/fido_ble_discovery_unittest.cc b/device/fido/ble/fido_ble_discovery_unittest.cc index 676d8e8..e401196 100644 --- a/device/fido/ble/fido_ble_discovery_unittest.cc +++ b/device/fido/ble/fido_ble_discovery_unittest.cc
@@ -122,8 +122,8 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; private: scoped_refptr<MockBluetoothAdapter> adapter_; @@ -138,7 +138,7 @@ EXPECT_CALL(*adapter(), SetPowered).Times(0); EXPECT_CALL(*observer(), DiscoveryStarted(discovery(), false)); discovery()->Start(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } TEST_F(FidoBleDiscoveryTest, FidoBleDiscoveryResumeScanningAfterPoweredOn) { @@ -159,7 +159,7 @@ device::UMABluetoothDiscoverySessionOutcome::SUCCESS); })); discovery()->Start(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); adapter()->NotifyAdapterPoweredChanged(true); } @@ -335,7 +335,7 @@ EXPECT_CALL(*observer(), AuthenticatorIdChanged(discovery(), kAuthenticatorId, kAuthenticatorChangedId)); discovery()->Start(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); adapter()->NotifyDeviceChanged(mock_device.get()); ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(mock_device.get())); @@ -359,7 +359,7 @@ const auto device_id = FidoBleDevice::GetIdForAddress(kDeviceAddress); discovery()->Start(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ::testing::InSequence sequence; EXPECT_CALL(*observer(), @@ -382,7 +382,7 @@ const auto device_id = FidoBleDevice::GetIdForAddress(kDeviceAddress); discovery()->Start(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ::testing::InSequence sequence; EXPECT_CALL(*observer(), @@ -414,13 +414,13 @@ EXPECT_CALL(*observer(), AuthenticatorPairingModeChanged(discovery(), device_id, false)); - scoped_task_environment_.GetMainThreadTaskRunner().get()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner().get()->PostDelayedTask( FROM_HERE, base::BindLambdaForTesting([&, this] { adapter()->NotifyDeviceChanged(mock_device.get()); }), base::TimeDelta::FromSeconds(4)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } // Verify that if a device changes its address and the new address collides @@ -439,7 +439,7 @@ discovery(), IdMatches(kDeviceChangedAddress))); discovery()->Start(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); adapter()->NotifyDeviceChanged(mock_device.get()); ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(mock_device.get()));
diff --git a/device/fido/ble/fido_ble_transaction_unittest.cc b/device/fido/ble/fido_ble_transaction_unittest.cc index a4b3efc8..3dc6ac4 100644 --- a/device/fido/ble/fido_ble_transaction_unittest.cc +++ b/device/fido/ble/fido_ble_transaction_unittest.cc
@@ -55,9 +55,7 @@ class FidoBleTransactionTest : public ::testing::Test { public: - base::test::ScopedTaskEnvironment& scoped_task_environment() { - return scoped_task_environment_; - } + base::test::TaskEnvironment& task_environment() { return task_environment_; } MockFidoBleConnection& connection() { return connection_; } FidoBleTransaction& transaction() { return *transaction_; } @@ -67,7 +65,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<BluetoothAdapter> adapter_ = base::MakeRefCounted<::testing::NiceMock<MockBluetoothAdapter>>(); @@ -124,7 +122,7 @@ for (auto&& byte_fragment : ToByteFragments(frame)) transaction().OnResponseFragment(std::move(byte_fragment)); - scoped_task_environment().RunUntilIdle(); + task_environment().RunUntilIdle(); EXPECT_FALSE(receiver.was_called()); std::move(delayed_write_callback).Run(true); @@ -156,7 +154,7 @@ for (auto&& byte_fragment : ToByteFragments(frame)) transaction().OnResponseFragment(std::move(byte_fragment)); - scoped_task_environment().RunUntilIdle(); + task_environment().RunUntilIdle(); EXPECT_FALSE(receiver.was_called()); std::move(delayed_write_callback).Run(true); @@ -195,7 +193,7 @@ for (auto&& byte_fragment : ToByteFragments(tup_needed_frame)) transaction().OnResponseFragment(std::move(byte_fragment)); - scoped_task_environment().RunUntilIdle(); + task_environment().RunUntilIdle(); EXPECT_FALSE(receiver.was_called()); FidoBleFrame processing_frame( @@ -204,7 +202,7 @@ for (auto&& byte_fragment : ToByteFragments(processing_frame)) transaction().OnResponseFragment(std::move(byte_fragment)); - scoped_task_environment().RunUntilIdle(); + task_environment().RunUntilIdle(); EXPECT_FALSE(receiver.was_called()); for (auto&& byte_fragment : ToByteFragments(frame))
diff --git a/device/fido/ble_adapter_manager_unittest.cc b/device/fido/ble_adapter_manager_unittest.cc index a6b61424..ed8ec86a 100644 --- a/device/fido/ble_adapter_manager_unittest.cc +++ b/device/fido/ble_adapter_manager_unittest.cc
@@ -134,7 +134,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<MockBluetoothAdapter> adapter_ = base::MakeRefCounted<::testing::NiceMock<MockBluetoothAdapter>>(); std::unique_ptr<MockObserver> mock_observer_ = @@ -162,7 +162,7 @@ EXPECT_CALL(*observer(), OnTransportAvailabilityEnumerated(_)) .WillOnce(::testing::SaveArg<0>(&data)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(data.is_ble_powered); EXPECT_FALSE(data.can_power_on_ble_adapter); @@ -177,7 +177,7 @@ EXPECT_CALL(*observer(), OnTransportAvailabilityEnumerated(_)) .WillOnce(::testing::SaveArg<0>(&data)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(data.is_ble_powered); EXPECT_FALSE(data.can_power_on_ble_adapter); @@ -192,14 +192,14 @@ EXPECT_CALL(*observer(), OnTransportAvailabilityEnumerated(_)) .WillOnce(::testing::SaveArg<0>(&data)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(data.is_ble_powered); EXPECT_TRUE(data.can_power_on_ble_adapter); } TEST_F(FidoBleAdapterManagerTest, SetBluetoothPowerOn) { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); auto& power_manager = fake_request_handler_->get_bluetooth_adapter_manager_for_testing(); ::testing::InSequence s; @@ -227,7 +227,7 @@ })); EXPECT_CALL(*mock_bluetooth_device, SetPinCode(kTestPinCode)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); auto& adapter_manager = fake_request_handler_->get_bluetooth_adapter_manager_for_testing(); test::TestCallbackReceiver<> callback_receiver; @@ -251,7 +251,7 @@ .WillRepeatedly(::testing::Return(adapter()->GetConstMockDevices())); EXPECT_CALL(*mock_bluetooth_device, Pair).Times(0); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); auto& power_manager = fake_request_handler_->get_bluetooth_adapter_manager_for_testing(); test::TestCallbackReceiver<> callback_receiver; @@ -278,7 +278,7 @@ success_callback.Run(); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); auto& adapter_manager = fake_request_handler_->get_bluetooth_adapter_manager_for_testing(); test::TestCallbackReceiver<> callback_receiver;
diff --git a/device/fido/cable/fido_cable_device_unittest.cc b/device/fido/cable/fido_cable_device_unittest.cc index 84ab404..581f1f87 100644 --- a/device/fido/cable/fido_cable_device_unittest.cc +++ b/device/fido/cable/fido_cable_device_unittest.cc
@@ -154,7 +154,7 @@ FakeCableAuthenticator* authenticator() { return &authenticator_; } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: scoped_refptr<MockBluetoothAdapter> adapter_ =
diff --git a/device/fido/cable/fido_cable_discovery_unittest.cc b/device/fido/cable/fido_cable_discovery_unittest.cc index d2bff02..e886ea4 100644 --- a/device/fido/cable/fido_cable_discovery_unittest.cc +++ b/device/fido/cable/fido_cable_discovery_unittest.cc
@@ -315,7 +315,7 @@ return std::make_unique<FakeFidoCableDiscovery>(std::move(discovery_data)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Tests regular successful discovery flow for Cable device. @@ -334,7 +334,7 @@ BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter); cable_discovery->Start(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Tests successful discovery flow for Apple Cable device. @@ -353,7 +353,7 @@ BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter); cable_discovery->Start(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Tests a scenario where upon broadcasting advertisement and scanning, client @@ -374,7 +374,7 @@ BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter); cable_discovery->Start(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Windows currently does not support multiple EIDs, so the following tests are @@ -413,7 +413,7 @@ BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter); cable_discovery->Start(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Tests a scenario where only one of the two client EID's are advertised @@ -446,7 +446,7 @@ BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter); cable_discovery->Start(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Test the scenario when all advertisement for client EID's fails. @@ -478,7 +478,7 @@ BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter); cable_discovery->Start(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(cable_discovery->advertisements_.empty()); } #endif // !defined(OS_WIN) @@ -499,7 +499,7 @@ BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter); cable_discovery->Start(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1u, cable_discovery->advertisements_.size()); cable_discovery.reset();
diff --git a/device/fido/cable/fido_cable_handshake_handler_unittest.cc b/device/fido/cable/fido_cable_handshake_handler_unittest.cc index 0811338..bfe3243 100644 --- a/device/fido/cable/fido_cable_handshake_handler_unittest.cc +++ b/device/fido/cable/fido_cable_handshake_handler_unittest.cc
@@ -288,7 +288,7 @@ TestDeviceCallbackReceiver& callback_receiver() { return callback_receiver_; } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: scoped_refptr<MockBluetoothAdapter> adapter_ =
diff --git a/device/fido/credential_management_handler_unittest.cc b/device/fido/credential_management_handler_unittest.cc index 1d2db36..5793573 100644 --- a/device/fido/credential_management_handler_unittest.cc +++ b/device/fido/credential_management_handler_unittest.cc
@@ -55,7 +55,7 @@ std::move(provide_pin).Run(kPIN); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; test::TestCallbackReceiver<> ready_callback_; test::StatusAndValuesCallbackReceiver<
diff --git a/device/fido/fake_fido_discovery_unittest.cc b/device/fido/fake_fido_discovery_unittest.cc index eeb502c..8dc10c1 100644 --- a/device/fido/fake_fido_discovery_unittest.cc +++ b/device/fido/fake_fido_discovery_unittest.cc
@@ -30,7 +30,7 @@ protected: FakeFidoDiscoveryFactory fake_fido_discovery_factory_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: DISALLOW_COPY_AND_ASSIGN(FakeFidoDiscoveryTest);
diff --git a/device/fido/fido_device_discovery_unittest.cc b/device/fido/fido_device_discovery_unittest.cc index f4d092bb..1437119a 100644 --- a/device/fido/fido_device_discovery_unittest.cc +++ b/device/fido/fido_device_discovery_unittest.cc
@@ -59,7 +59,7 @@ } TEST(FidoDiscoveryTest, TestNotificationsOnSuccessfulStart) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ConcreteFidoDiscovery discovery(FidoTransportProtocol::kBluetoothLowEnergy); MockFidoDiscoveryObserver observer; @@ -70,7 +70,7 @@ EXPECT_CALL(discovery, StartInternal()); discovery.Start(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(discovery.is_start_requested()); EXPECT_FALSE(discovery.is_running()); @@ -84,14 +84,14 @@ } TEST(FidoDiscoveryTest, TestNotificationsOnFailedStart) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ConcreteFidoDiscovery discovery(FidoTransportProtocol::kBluetoothLowEnergy); MockFidoDiscoveryObserver observer; discovery.set_observer(&observer); discovery.Start(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_CALL(observer, DiscoveryStarted(&discovery, false)); discovery.NotifyDiscoveryStarted(false); @@ -101,7 +101,7 @@ } TEST(FidoDiscoveryTest, TestAddRemoveDevices) { - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ConcreteFidoDiscovery discovery(FidoTransportProtocol::kBluetoothLowEnergy); MockFidoDiscoveryObserver observer; discovery.set_observer(&observer);
diff --git a/device/fido/fido_request_handler_unittest.cc b/device/fido/fido_request_handler_unittest.cc index ebbd7b6..ce1eb391 100644 --- a/device/fido/fido_request_handler_unittest.cc +++ b/device/fido/fido_request_handler_unittest.cc
@@ -355,8 +355,8 @@ FakeHandlerCallbackReceiver& callback() { return cb_; } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; test::FakeFidoDiscoveryFactory fake_discovery_factory_; scoped_refptr<::testing::NiceMock<MockBluetoothAdapter>> mock_adapter_; test::FakeFidoDiscovery* discovery_; @@ -412,7 +412,7 @@ discovery()->AddDevice(std::move(device0)); discovery()->AddDevice(std::move(device1)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); request_handler.reset(); } @@ -483,7 +483,7 @@ discovery()->AddDevice(std::move(device0)); discovery()->AddDevice(std::move(device1)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); callback().WaitForCallback(); EXPECT_TRUE(request_handler->is_complete()); EXPECT_EQ(FidoReturnCode::kSuccess, callback().status()); @@ -542,7 +542,7 @@ discovery()->AddDevice(std::move(device1)); discovery()->AddDevice(std::move(device2)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); callback().WaitForCallback(); EXPECT_TRUE(request_handler->is_complete()); EXPECT_EQ(FidoReturnCode::kUserConsentButCredentialNotRecognized, @@ -582,7 +582,7 @@ discovery()->AddDevice(std::move(device0)); platform_discovery->AddDevice(std::move(device1)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); callback().WaitForCallback(); EXPECT_TRUE(request_handler->is_complete()); EXPECT_EQ(FidoReturnCode::kUserConsentDenied, callback().status()); @@ -608,7 +608,7 @@ discovery()->AddDevice(std::move(device0)); discovery()->AddDevice(std::move(device1)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); callback().WaitForCallback(); EXPECT_TRUE(request_handler->is_complete()); EXPECT_EQ(FidoReturnCode::kUserConsentDenied, callback().status()); @@ -688,7 +688,7 @@ TestObserver observer; auto request_handler = CreateFakeHandler(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); request_handler->set_observer(&observer); observer.WaitForAndExpectAvailableTransportsAre( @@ -724,7 +724,7 @@ {FidoTransportProtocol::kUsbHumanInterfaceDevice}, &fake_discovery_factory_); request_handler.set_observer(&observer); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); auto transport_availability_info = observer.WaitForTransportAvailabilityInfo();
diff --git a/device/fido/get_assertion_handler_unittest.cc b/device/fido/get_assertion_handler_unittest.cc index dbd2d1e..d9fa37f 100644 --- a/device/fido/get_assertion_handler_unittest.cc +++ b/device/fido/get_assertion_handler_unittest.cc
@@ -121,7 +121,7 @@ if (base::Contains(transports, Transport::kInternal)) platform_discovery()->WaitForCallToStartAndSimulateSuccess(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_FALSE(get_assertion_callback().was_called()); if (!base::Contains(transports, Transport::kUsbHumanInterfaceDevice)) @@ -164,8 +164,8 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; std::unique_ptr<test::FakeFidoDiscoveryFactory> fake_discovery_factory_ = std::make_unique<test::FakeFidoDiscoveryFactory>(); test::FakeFidoDiscovery* discovery_; @@ -220,7 +220,7 @@ test_data::kApduEncodedNoErrorSignResponse); discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_EQ(FidoReturnCode::kSuccess, get_assertion_callback().status()); EXPECT_TRUE(get_assertion_callback().value<0>()); EXPECT_TRUE(request_handler->is_complete()); @@ -243,7 +243,7 @@ discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_EQ(FidoReturnCode::kUserConsentButCredentialNotRecognized, get_assertion_callback().status()); } @@ -266,7 +266,7 @@ test_data::kApduEncodedNoErrorRegisterResponse); discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_EQ(FidoReturnCode::kUserConsentButCredentialNotRecognized, get_assertion_callback().status()); } @@ -379,7 +379,7 @@ test_data::kTestGetAssertionResponseWithTruncatedAndInvalidUTF8); discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_FALSE(get_assertion_callback().was_called()); } @@ -694,7 +694,7 @@ discovery()->WaitForCallToStartAndSimulateSuccess(); discovery()->AddDevice(std::move(other_device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_TRUE(get_assertion_callback().was_called()); EXPECT_EQ(FidoReturnCode::kUserConsentDenied, get_assertion_callback().status()); @@ -713,7 +713,7 @@ discovery()->WaitForCallToStartAndSimulateSuccess(); discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_TRUE(get_assertion_callback().was_called()); EXPECT_EQ(FidoReturnCode::kUserConsentDenied, get_assertion_callback().status()); @@ -731,7 +731,7 @@ discovery()->WaitForCallToStartAndSimulateSuccess(); discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_TRUE(get_assertion_callback().was_called()); EXPECT_EQ(FidoReturnCode::kUserConsentDenied, get_assertion_callback().status()); @@ -783,8 +783,8 @@ // filtered to only contain items compatible with the transport actually used to // talk to the authenticator. TEST(GetAssertionRequestHandlerTest, IncorrectTransportType) { - base::test::ScopedTaskEnvironment scoped_task_environment{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; #if defined(OS_WIN) device::ScopedFakeWinWebAuthnApi win_webauthn_api_ = device::ScopedFakeWinWebAuthnApi::MakeUnavailable(); @@ -814,7 +814,7 @@ {FidoTransportProtocol::kUsbHumanInterfaceDevice}), std::move(request), cb.callback()); - scoped_task_environment.FastForwardUntilNoTasksRemain(); + task_environment.FastForwardUntilNoTasksRemain(); EXPECT_FALSE(cb.was_called()); } @@ -863,7 +863,7 @@ // FidoDeviceAuthenticator or a WinNativeCrossPlatformAuthenticator, depending // on API availability. TEST(GetAssertionRequestHandlerWinTest, TestWinUsbDiscovery) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; ScopedFakeWinWebAuthnApi scoped_fake_win_webauthn_api; for (const bool enable_api : {false, true}) { SCOPED_TRACE(::testing::Message() << "enable_api=" << enable_api); @@ -889,7 +889,7 @@ observer.set_controls_dispatch(true); handler->set_observer(&observer); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); ASSERT_FALSE(cb.was_called()); EXPECT_EQ(handler->AuthenticatorsForTesting().size(), 1u);
diff --git a/device/fido/get_assertion_task_unittest.cc b/device/fido/get_assertion_task_unittest.cc index 422eb77..200dfec6 100644 --- a/device/fido/get_assertion_task_unittest.cc +++ b/device/fido/get_assertion_task_unittest.cc
@@ -45,7 +45,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestGetAssertionTaskCallbackReceiver cb_; };
diff --git a/device/fido/hid/fido_hid_device_unittest.cc b/device/fido/hid/fido_hid_device_unittest.cc index f0369f9..f4a4fa4 100644 --- a/device/fido/hid/fido_hid_device_unittest.cc +++ b/device/fido/hid/fido_hid_device_unittest.cc
@@ -195,8 +195,8 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; device::mojom::HidManagerPtr hid_manager_; std::unique_ptr<FakeFidoHidManager> fake_hid_manager_; }; @@ -333,7 +333,7 @@ .WillOnce(Invoke([&](device::mojom::HidConnection::ReadCallback* cb) { auto almost_time_out = kDeviceTimeout - base::TimeDelta::FromMicroseconds(1); - scoped_task_environment_.FastForwardBy(almost_time_out); + task_environment_.FastForwardBy(almost_time_out); std::move(*cb).Run(true, 0, CreateMockResponseWithChannelId( @@ -380,7 +380,7 @@ // Repeated Read() invocation due to keep alive message. The callback // is invoked only after 3 seconds, which should cause device to timeout. .WillOnce(Invoke([&](device::mojom::HidConnection::ReadCallback* cb) { - scoped_task_environment_.FastForwardBy(kDeviceTimeout); + task_environment_.FastForwardBy(kDeviceTimeout); std::move(*cb).Run(true, 0, CreateMockResponseWithChannelId( mock_connection->connection_channel_id(), @@ -450,7 +450,7 @@ &FidoHidDevice::Cancel, device->weak_factory_.GetWeakPtr(), token); base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, std::move(cancel_callback), delay_before_cancel); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } TEST_F(FidoHidDeviceTest, TestCancelWhileWriting) { @@ -685,7 +685,7 @@ device::test::TestCallbackReceiver<> get_info_callback; device->DiscoverSupportedProtocolAndDeviceInfo(get_info_callback.callback()); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_FALSE(get_info_callback.was_called()); EXPECT_EQ(FidoDevice::State::kDeviceError, device->state_for_testing()); } @@ -729,7 +729,7 @@ device::test::TestCallbackReceiver<> get_info_callback; device->DiscoverSupportedProtocolAndDeviceInfo(get_info_callback.callback()); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_TRUE(get_info_callback.was_called()); } @@ -775,7 +775,7 @@ device::test::TestCallbackReceiver<> callback_receiver; device->TryWink(callback_receiver.callback()); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_TRUE(callback_receiver.was_called()); } @@ -829,7 +829,7 @@ device::test::TestCallbackReceiver<> callback_receiver; device->TryWink(callback_receiver.callback()); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_TRUE(callback_receiver.was_called()); }
diff --git a/device/fido/hid/fido_hid_discovery_unittest.cc b/device/fido/hid/fido_hid_discovery_unittest.cc index 4b2a46a..a11f31e2 100644 --- a/device/fido/hid/fido_hid_discovery_unittest.cc +++ b/device/fido/hid/fido_hid_discovery_unittest.cc
@@ -42,7 +42,7 @@ class FidoHidDiscoveryTest : public ::testing::Test { protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ScopedFakeFidoHidManager fake_hid_manager_; }; @@ -59,12 +59,12 @@ // Devices initially known to the service before discovery started should be // reported as KNOWN. EXPECT_CALL(observer, AuthenticatorAdded(&discovery, IdMatches("known"))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Devices added during the discovery should be reported as ADDED. EXPECT_CALL(observer, AuthenticatorAdded(&discovery, IdMatches("added"))); fake_hid_manager_.AddFidoHidDevice("added"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Added non-U2F devices should not be reported at all. EXPECT_CALL(observer, AuthenticatorAdded(_, _)).Times(0); @@ -73,14 +73,14 @@ // Removed non-U2F devices should not be reported at all. EXPECT_CALL(observer, AuthenticatorRemoved(_, _)).Times(0); fake_hid_manager_.RemoveDevice("other"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Removed U2F devices should be reported as REMOVED. EXPECT_CALL(observer, AuthenticatorRemoved(&discovery, IdMatches("known"))); EXPECT_CALL(observer, AuthenticatorRemoved(&discovery, IdMatches("added"))); fake_hid_manager_.RemoveDevice("known"); fake_hid_manager_.RemoveDevice("added"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } // namespace device
diff --git a/device/fido/mac/browsing_data_deletion_unittest.mm b/device/fido/mac/browsing_data_deletion_unittest.mm index 02abcc9..3835772b 100644 --- a/device/fido/mac/browsing_data_deletion_unittest.mm +++ b/device/fido/mac/browsing_data_deletion_unittest.mm
@@ -160,7 +160,7 @@ .CountCredentials(base::Time(), base::Time::Max()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TouchIdAuthenticator> authenticator_; };
diff --git a/device/fido/mac/get_assertion_operation_unittest_mac.mm b/device/fido/mac/get_assertion_operation_unittest_mac.mm index be3cb5c..ea4abe5 100644 --- a/device/fido/mac/get_assertion_operation_unittest_mac.mm +++ b/device/fido/mac/get_assertion_operation_unittest_mac.mm
@@ -61,7 +61,7 @@ // keychain-access-group entitlement. TEST(GetAssertionOperationTest, DISABLED_TestRun) API_AVAILABLE(macos(10.12.2)) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; ASSERT_TRUE(MakeCredential()); TestCallbackReceiver<CtapDeviceResponseCode,
diff --git a/device/fido/mac/make_credential_operation_unittest_mac.mm b/device/fido/mac/make_credential_operation_unittest_mac.mm index d389007..95dd97e 100644 --- a/device/fido/mac/make_credential_operation_unittest_mac.mm +++ b/device/fido/mac/make_credential_operation_unittest_mac.mm
@@ -44,7 +44,7 @@ // keychain-access-group entitlement. TEST(MakeCredentialOperationTest, DISABLED_TestRun) API_AVAILABLE(macosx(10.12.2)) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; TestCallbackReceiver<CtapDeviceResponseCode, base::Optional<AuthenticatorMakeCredentialResponse>> callback_receiver;
diff --git a/device/fido/make_credential_handler_unittest.cc b/device/fido/make_credential_handler_unittest.cc index 68572c5..3dbb475 100644 --- a/device/fido/make_credential_handler_unittest.cc +++ b/device/fido/make_credential_handler_unittest.cc
@@ -108,7 +108,7 @@ if (base::Contains(transports, Transport::kNearFieldCommunication)) nfc_discovery()->WaitForCallToStartAndSimulateSuccess(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_FALSE(callback().was_called()); if (!base::Contains(transports, Transport::kUsbHumanInterfaceDevice)) @@ -138,8 +138,8 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; std::unique_ptr<test::FakeFidoDiscoveryFactory> fake_discovery_factory_ = std::make_unique<test::FakeFidoDiscoveryFactory>(); test::FakeFidoDiscovery* discovery_; @@ -210,7 +210,7 @@ test_data::kApduEncodedNoErrorRegisterResponse); discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_EQ(FidoReturnCode::kAuthenticatorMissingUserVerification, callback().status()); } @@ -229,7 +229,7 @@ test_data::kApduEncodedNoErrorRegisterResponse); discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_EQ(FidoReturnCode::kAuthenticatorMissingResidentKeys, callback().status()); } @@ -250,7 +250,7 @@ test_data::kTestMakeCredentialResponse); discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_EQ(FidoReturnCode::kAuthenticatorMissingUserVerification, callback().status()); } @@ -310,7 +310,7 @@ discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_EQ(FidoReturnCode::kAuthenticatorMissingResidentKeys, callback().status()); } @@ -501,7 +501,7 @@ test_data::kTestGetInfoResponsePlatformDevice); discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_FALSE(callback().was_called()); } @@ -526,7 +526,7 @@ /*require_resident_key=*/true, UserVerificationRequirement::kRequired)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_FALSE(callback().was_called()); } @@ -562,7 +562,7 @@ test_data::kTestMakeCredentialResponseWithIncorrectRpIdHash); discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_FALSE(callback().was_called()); } @@ -587,7 +587,7 @@ discovery()->AddDevice(std::make_unique<VirtualCtap2Device>( std::move(state), std::move(config))); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); callback().WaitForCallback(); EXPECT_EQ(FidoReturnCode::kSuccess, callback().status()); } @@ -606,7 +606,7 @@ discovery()->WaitForCallToStartAndSimulateSuccess(); discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_EQ(FidoReturnCode::kAuthenticatorMissingResidentKeys, callback().status()); } @@ -631,7 +631,7 @@ /*require_resident_key=*/false, UserVerificationRequirement::kPreferred)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_TRUE(callback().was_called()); EXPECT_EQ(FidoReturnCode::kUserConsentDenied, callback().status()); } @@ -654,7 +654,7 @@ discovery()->WaitForCallToStartAndSimulateSuccess(); discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_TRUE(callback().was_called()); EXPECT_EQ(FidoReturnCode::kUserConsentDenied, callback().status()); } @@ -676,7 +676,7 @@ discovery()->WaitForCallToStartAndSimulateSuccess(); discovery()->AddDevice(std::move(device)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_TRUE(callback().was_called()); EXPECT_EQ(FidoReturnCode::kUserConsentDenied, callback().status()); }
diff --git a/device/fido/make_credential_task_unittest.cc b/device/fido/make_credential_task_unittest.cc index ec10daa..cd44a2391 100644 --- a/device/fido/make_credential_task_unittest.cc +++ b/device/fido/make_credential_task_unittest.cc
@@ -62,7 +62,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestMakeCredentialTaskCallback callback_receiver_; };
diff --git a/device/fido/test_callback_receiver.h b/device/fido/test_callback_receiver.h index 6678357..a957830 100644 --- a/device/fido/test_callback_receiver.h +++ b/device/fido/test_callback_receiver.h
@@ -23,7 +23,7 @@ // signature `void(CallbackArgs...)` can be invoked on. // // Example usage: -// base::test::ScopedTaskEnvironment task_environment; +// base::test::TaskEnvironment task_environment; // TestCallbackReceiver<int> callback_receiver; // // // Manufacture the base::OnceCallback whose invovcation will be received
diff --git a/device/fido/test_callback_receiver_unittest.cc b/device/fido/test_callback_receiver_unittest.cc index 4197776..e22e561 100644 --- a/device/fido/test_callback_receiver_unittest.cc +++ b/device/fido/test_callback_receiver_unittest.cc
@@ -42,7 +42,7 @@ } // namespace TEST(TestCallbackReceiver, BasicClosure) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestCallbackReceiver<> closure_receiver; auto closure = closure_receiver.callback(); @@ -60,7 +60,7 @@ } TEST(TestCallbackReceiver, BasicCopyableArgument) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestCallbackReceiver<int> callback_receiver; auto callback = callback_receiver.callback(); @@ -78,7 +78,7 @@ } TEST(TestCallbackReceiver, MoveOnlyArgumentIsMoved) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestCallbackReceiver<std::unique_ptr<int>> callback_receiver; auto callback = callback_receiver.callback(); @@ -92,7 +92,7 @@ } TEST(TestCallbackReceiver, ReferenceArgumentIsCopied) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestCallbackReceiver<MoveResets&> callback_receiver; MoveResets passed_in_value = true; @@ -119,7 +119,7 @@ TEST(TestCallbackReceiver, StatusAndValue) { enum class TestStatus { NOT_OK, OK }; - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; StatusAndValueCallbackReceiver<TestStatus, std::unique_ptr<int>> callback_receiver; @@ -135,7 +135,7 @@ } TEST(TestCallbackReceiver, WaitForCallback) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestCallbackReceiver<> closure_receiver; auto closure = closure_receiver.callback(); @@ -152,7 +152,7 @@ } TEST(TestCallbackReceiver, WaitForCallbackAfterCallback) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestCallbackReceiver<> closure_receiver; auto closure = closure_receiver.callback();
diff --git a/device/fido/u2f_register_operation_unittest.cc b/device/fido/u2f_register_operation_unittest.cc index 5e299d13..2450a5a 100644 --- a/device/fido/u2f_register_operation_unittest.cc +++ b/device/fido/u2f_register_operation_unittest.cc
@@ -66,7 +66,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestRegisterCallback register_callback_receiver_; };
diff --git a/device/fido/u2f_sign_operation_unittest.cc b/device/fido/u2f_sign_operation_unittest.cc index 6b814f2..2bbf063 100644 --- a/device/fido/u2f_sign_operation_unittest.cc +++ b/device/fido/u2f_sign_operation_unittest.cc
@@ -50,7 +50,7 @@ TestSignCallback& sign_callback_receiver() { return sign_callback_receiver_; } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestSignCallback sign_callback_receiver_; };
diff --git a/device/gamepad/abstract_haptic_gamepad_unittest.cc b/device/gamepad/abstract_haptic_gamepad_unittest.cc index 1522e9d..9f32536 100644 --- a/device/gamepad/abstract_haptic_gamepad_unittest.cc +++ b/device/gamepad/abstract_haptic_gamepad_unittest.cc
@@ -105,8 +105,8 @@ mojom::GamepadHapticsResult first_callback_result_; mojom::GamepadHapticsResult second_callback_result_; std::unique_ptr<FakeHapticGamepad> gamepad_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; DISALLOW_COPY_AND_ASSIGN(AbstractHapticGamepadTest); }; @@ -123,15 +123,15 @@ base::Unretained(this))); // Run the queued task to start the effect. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1, gamepad_->set_vibration_count_); EXPECT_EQ(0, gamepad_->set_zero_vibration_count_); EXPECT_EQ(0, first_callback_count_); - EXPECT_TRUE(scoped_task_environment_.NextTaskIsDelayed()); + EXPECT_TRUE(task_environment_.NextTaskIsDelayed()); // Finish the effect. - scoped_task_environment_.FastForwardBy(kPendingTaskDuration); + task_environment_.FastForwardBy(kPendingTaskDuration); // SetZeroVibration is not called. Typically, the renderer would issue a call // to SetZeroVibration once the callback receives a success result. @@ -140,7 +140,7 @@ EXPECT_EQ(1, first_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultComplete, first_callback_result_); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } TEST_F(AbstractHapticGamepadTest, ResetVibrationTest) { @@ -152,14 +152,14 @@ base::Unretained(this))); // Run the queued task to reset vibration. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, gamepad_->set_vibration_count_); EXPECT_EQ(1, gamepad_->set_zero_vibration_count_); EXPECT_EQ(1, first_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultComplete, first_callback_result_); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } TEST_F(AbstractHapticGamepadTest, UnsupportedEffectTypeTest) { @@ -175,7 +175,7 @@ base::Unretained(this))); // Run the queued task to start the effect. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // An unsupported effect should return a "not-supported" result without // calling SetVibration or SetZeroVibration. @@ -184,7 +184,7 @@ EXPECT_EQ(1, first_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultNotSupported, first_callback_result_); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } TEST_F(AbstractHapticGamepadTest, StartDelayTest) { @@ -200,30 +200,30 @@ base::Unretained(this))); // Run the queued task to start the effect. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, gamepad_->set_vibration_count_); EXPECT_EQ(1, gamepad_->set_zero_vibration_count_); EXPECT_EQ(0, first_callback_count_); - EXPECT_TRUE(scoped_task_environment_.NextTaskIsDelayed()); + EXPECT_TRUE(task_environment_.NextTaskIsDelayed()); // Start vibration. - scoped_task_environment_.FastForwardBy(kPendingTaskDuration); + task_environment_.FastForwardBy(kPendingTaskDuration); EXPECT_EQ(1, gamepad_->set_vibration_count_); EXPECT_EQ(1, gamepad_->set_zero_vibration_count_); EXPECT_EQ(0, first_callback_count_); - EXPECT_TRUE(scoped_task_environment_.NextTaskIsDelayed()); + EXPECT_TRUE(task_environment_.NextTaskIsDelayed()); // Finish the effect. - scoped_task_environment_.FastForwardBy(kPendingTaskDuration); + task_environment_.FastForwardBy(kPendingTaskDuration); EXPECT_EQ(1, gamepad_->set_vibration_count_); EXPECT_EQ(1, gamepad_->set_zero_vibration_count_); EXPECT_EQ(1, first_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultComplete, first_callback_result_); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } TEST_F(AbstractHapticGamepadTest, ZeroStartDelayPreemptionTest) { @@ -248,7 +248,7 @@ base::Unretained(this))); // Run the queued task to start the effect. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // The first effect should have already returned with a "preempted" result. // The second effect should have started vibration. @@ -258,10 +258,10 @@ EXPECT_EQ(0, second_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultPreempted, first_callback_result_); - EXPECT_TRUE(scoped_task_environment_.NextTaskIsDelayed()); + EXPECT_TRUE(task_environment_.NextTaskIsDelayed()); // Finish the effect. - scoped_task_environment_.FastForwardBy(kPendingTaskDuration); + task_environment_.FastForwardBy(kPendingTaskDuration); // Now the second effect should have returned with a "complete" result. EXPECT_EQ(1, gamepad_->set_vibration_count_); @@ -270,7 +270,7 @@ EXPECT_EQ(1, second_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultComplete, second_callback_result_); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } TEST_F(AbstractHapticGamepadTest, NonZeroStartDelayPreemptionTest) { @@ -295,7 +295,7 @@ base::Unretained(this))); // Run the queued tasks. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // The first effect should have already returned with a "preempted" result. // Because the second effect has a non-zero |start_delay|, it will call @@ -306,19 +306,19 @@ EXPECT_EQ(0, second_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultPreempted, first_callback_result_); - EXPECT_TRUE(scoped_task_environment_.NextTaskIsDelayed()); + EXPECT_TRUE(task_environment_.NextTaskIsDelayed()); // Start vibration. - scoped_task_environment_.FastForwardBy(kPendingTaskDuration); + task_environment_.FastForwardBy(kPendingTaskDuration); EXPECT_EQ(1, gamepad_->set_vibration_count_); EXPECT_EQ(1, gamepad_->set_zero_vibration_count_); EXPECT_EQ(1, first_callback_count_); EXPECT_EQ(0, second_callback_count_); - EXPECT_TRUE(scoped_task_environment_.NextTaskIsDelayed()); + EXPECT_TRUE(task_environment_.NextTaskIsDelayed()); // Finish the effect. - scoped_task_environment_.FastForwardBy(kPendingTaskDuration); + task_environment_.FastForwardBy(kPendingTaskDuration); EXPECT_EQ(1, gamepad_->set_vibration_count_); EXPECT_EQ(1, gamepad_->set_zero_vibration_count_); @@ -328,7 +328,7 @@ first_callback_result_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultComplete, second_callback_result_); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } TEST_F(AbstractHapticGamepadTest, ResetVibrationPreemptionTest) { @@ -349,7 +349,7 @@ PostResetVibration(base::BindOnce(&AbstractHapticGamepadTest::SecondCallback, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, gamepad_->set_vibration_count_); EXPECT_EQ(1, gamepad_->set_zero_vibration_count_); @@ -359,7 +359,7 @@ first_callback_result_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultComplete, second_callback_result_); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } } // namespace
diff --git a/device/gamepad/gamepad_service_unittest.cc b/device/gamepad/gamepad_service_unittest.cc index a2a72fc7..e62faec 100644 --- a/device/gamepad/gamepad_service_unittest.cc +++ b/device/gamepad/gamepad_service_unittest.cc
@@ -81,7 +81,7 @@ void SetUp() override; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; device::MockGamepadDataFetcher* fetcher_; GamepadService* service_; std::unique_ptr<ConnectionListener> connection_listener_;
diff --git a/device/gamepad/gamepad_test_helpers.h b/device/gamepad/gamepad_test_helpers.h index 05cf09f..71bc02a 100644 --- a/device/gamepad/gamepad_test_helpers.h +++ b/device/gamepad/gamepad_test_helpers.h
@@ -60,7 +60,7 @@ private: // This must be constructed before the system monitor. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(GamepadTestHelper); };
diff --git a/device/gamepad/hid_haptic_gamepad_base_unittest.cc b/device/gamepad/hid_haptic_gamepad_base_unittest.cc index 35dade8..e42fb81 100644 --- a/device/gamepad/hid_haptic_gamepad_base_unittest.cc +++ b/device/gamepad/hid_haptic_gamepad_base_unittest.cc
@@ -129,8 +129,8 @@ mojom::GamepadHapticsResult first_callback_result_; mojom::GamepadHapticsResult second_callback_result_; std::unique_ptr<FakeHidHapticGamepad> gamepad_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; DISALLOW_COPY_AND_ASSIGN(HidHapticGamepadBaseTest); }; @@ -144,22 +144,22 @@ base::Unretained(this))); // Run the queued task and start vibration. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(gamepad_->output_reports_, testing::ElementsAre(start_vibration_output_report_)); EXPECT_EQ(0, first_callback_count_); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); // Finish the effect. - scoped_task_environment_.FastForwardBy(kPendingTaskDuration); + task_environment_.FastForwardBy(kPendingTaskDuration); EXPECT_THAT(gamepad_->output_reports_, testing::ElementsAre(start_vibration_output_report_)); EXPECT_EQ(1, first_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultComplete, first_callback_result_); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } TEST_F(HidHapticGamepadBaseTest, ResetVibrationTest) { @@ -170,14 +170,14 @@ base::Unretained(this))); // Run the queued task and reset vibration. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(gamepad_->output_reports_, testing::ElementsAre(stop_vibration_output_report_)); EXPECT_EQ(1, first_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultComplete, first_callback_result_); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } TEST_F(HidHapticGamepadBaseTest, ZeroVibrationTest) { @@ -189,22 +189,22 @@ base::Unretained(this))); // Run the queued task. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(gamepad_->output_reports_, testing::ElementsAre(stop_vibration_output_report_)); EXPECT_EQ(0, first_callback_count_); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); // Finish the effect. - scoped_task_environment_.FastForwardBy(kPendingTaskDuration); + task_environment_.FastForwardBy(kPendingTaskDuration); EXPECT_THAT(gamepad_->output_reports_, testing::ElementsAre(stop_vibration_output_report_)); EXPECT_EQ(1, first_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultComplete, first_callback_result_); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } TEST_F(HidHapticGamepadBaseTest, StartDelayTest) { @@ -217,24 +217,24 @@ base::Unretained(this))); // Stop vibration for the delay period. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(gamepad_->output_reports_, testing::ElementsAre(stop_vibration_output_report_)); EXPECT_EQ(0, first_callback_count_); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); // Start vibration. - scoped_task_environment_.FastForwardBy(kPendingTaskDuration); + task_environment_.FastForwardBy(kPendingTaskDuration); EXPECT_THAT(gamepad_->output_reports_, testing::ElementsAre(stop_vibration_output_report_, start_vibration_output_report_)); EXPECT_EQ(0, first_callback_count_); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); // Finish the effect. - scoped_task_environment_.FastForwardBy(kPendingTaskDuration); + task_environment_.FastForwardBy(kPendingTaskDuration); EXPECT_THAT(gamepad_->output_reports_, testing::ElementsAre(stop_vibration_output_report_, @@ -242,7 +242,7 @@ EXPECT_EQ(1, first_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultComplete, first_callback_result_); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } TEST_F(HidHapticGamepadBaseTest, ZeroStartDelayPreemptionTest) { @@ -262,7 +262,7 @@ base::Unretained(this))); // Execute the pending tasks. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // The first effect should have already returned with a "preempted" result // without issuing a report. The second effect has started vibration. @@ -272,10 +272,10 @@ EXPECT_EQ(0, second_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultPreempted, first_callback_result_); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); // Finish the effect. - scoped_task_environment_.FastForwardBy(kPendingTaskDuration); + task_environment_.FastForwardBy(kPendingTaskDuration); EXPECT_THAT(gamepad_->output_reports_, testing::ElementsAre(start_vibration_output_report_)); @@ -283,7 +283,7 @@ EXPECT_EQ(1, second_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultComplete, second_callback_result_); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } TEST_F(HidHapticGamepadBaseTest, NonZeroStartDelayPreemptionTest) { @@ -303,7 +303,7 @@ base::Unretained(this))); // Execute the pending tasks. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // The first effect should have already returned with a "preempted" result. // Because the second effect has a non-zero |start_delay| and is preempting @@ -315,20 +315,20 @@ EXPECT_EQ(0, second_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultPreempted, first_callback_result_); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); // Start vibration. - scoped_task_environment_.FastForwardBy(kPendingTaskDuration); + task_environment_.FastForwardBy(kPendingTaskDuration); EXPECT_THAT(gamepad_->output_reports_, testing::ElementsAre(stop_vibration_output_report_, start_vibration_output_report_)); EXPECT_EQ(1, first_callback_count_); EXPECT_EQ(0, second_callback_count_); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); // Finish the effect. - scoped_task_environment_.FastForwardBy(kPendingTaskDuration); + task_environment_.FastForwardBy(kPendingTaskDuration); EXPECT_THAT(gamepad_->output_reports_, testing::ElementsAre(stop_vibration_output_report_, @@ -337,7 +337,7 @@ EXPECT_EQ(1, second_callback_count_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultComplete, second_callback_result_); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } TEST_F(HidHapticGamepadBaseTest, ResetVibrationPreemptionTest) { @@ -356,7 +356,7 @@ base::Unretained(this))); // Execute the pending tasks. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(gamepad_->output_reports_, testing::ElementsAre(stop_vibration_output_report_)); @@ -366,7 +366,7 @@ first_callback_result_); EXPECT_EQ(mojom::GamepadHapticsResult::GamepadHapticsResultComplete, second_callback_result_); - EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u); } } // namespace
diff --git a/device/gamepad/public/cpp/gamepad_mojom_traits_unittest.cc b/device/gamepad/public/cpp/gamepad_mojom_traits_unittest.cc index 07e6947..a101475 100644 --- a/device/gamepad/public/cpp/gamepad_mojom_traits_unittest.cc +++ b/device/gamepad/public/cpp/gamepad_mojom_traits_unittest.cc
@@ -163,7 +163,7 @@ GamepadStructTraitsTest() {} private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(GamepadStructTraitsTest); };
diff --git a/device/vr/orientation/orientation_device_provider_unittest.cc b/device/vr/orientation/orientation_device_provider_unittest.cc index 93a48e9..1078ea8 100644 --- a/device/vr/orientation/orientation_device_provider_unittest.cc +++ b/device/vr/orientation/orientation_device_provider_unittest.cc
@@ -53,19 +53,19 @@ provider_ = std::make_unique<VROrientationDeviceProvider>(connector_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void TearDown() override {} void InitializeDevice(mojom::SensorInitParamsPtr params) { // Be sure GetSensor goes through so the callback is set. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_sensor_provider_->CallCallback(std::move(params)); // Allow the callback call to go through. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } mojom::SensorInitParamsPtr FakeInitParams() { @@ -133,7 +133,7 @@ } // Needed for MakeRequest to work. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<VROrientationDeviceProvider> provider_;
diff --git a/device/vr/orientation/orientation_device_unittest.cc b/device/vr/orientation/orientation_device_unittest.cc index addaead2..52a85787d 100644 --- a/device/vr/orientation/orientation_device_unittest.cc +++ b/device/vr/orientation/orientation_device_unittest.cc
@@ -96,7 +96,7 @@ scoped_screen_override_ = std::make_unique<ScopedScreenOverride>(fake_screen_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void TearDown() override { shared_buffer_handle_.reset(); } @@ -118,10 +118,10 @@ // Complete the creation of device_ by letting the GetSensor function go // through. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_sensor_provider_->CallCallback(std::move(params)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Ensure that the callback is called. loop.Run(); @@ -145,7 +145,7 @@ }, loop.QuitClosure(), std::move(callback))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Ensure the pose request callback runs. loop.Run(); @@ -225,7 +225,7 @@ } // Needed for MakeRequest to work. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<VROrientationDevice> device_; std::unique_ptr<FakeSensorProvider> fake_sensor_provider_; @@ -250,7 +250,7 @@ device_ = std::make_unique<VROrientationDevice>(&sensor_provider_ptr_, base::BindOnce([]() {})); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(device_->IsAvailable()); }
diff --git a/device/vr/vr_device_base_unittest.cc b/device/vr/vr_device_base_unittest.cc index d1e3697..670a280 100644 --- a/device/vr/vr_device_base_unittest.cc +++ b/device/vr/vr_device_base_unittest.cc
@@ -107,7 +107,7 @@ return display_info; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(VRDeviceTest); };
diff --git a/docs/flag_expiry.md b/docs/flag_expiry.md index 6b01898..889eefb 100644 --- a/docs/flag_expiry.md +++ b/docs/flag_expiry.md
@@ -30,7 +30,7 @@ After each milestone's branch point: 1. The flags team chooses a set of flags to begin expiring, from the list - produced by `tools/flags/list-flags.py --expired-by $MSTONE`. In the steady + produced by `tools/flags/list_flags.py --expired-by $MSTONE`. In the steady state, when there is not a big backlog of flags to remove, this set will be the entire list of flags that are `expired-by $MSTONE`. 2. The flags team hides the flags in this set by default from `chrome://flags`,
diff --git a/docs/threading_and_tasks.md b/docs/threading_and_tasks.md index 73817d6..c48b624 100644 --- a/docs/threading_and_tasks.md +++ b/docs/threading_and_tasks.md
@@ -629,17 +629,17 @@ `base::SequencedTaskRunnerHandle` or a function in [`base/task/post_task.h`](https://cs.chromium.org/chromium/src/base/task/post_task.h), instantiate a -[`base::test::ScopedTaskEnvironment`](https://cs.chromium.org/chromium/src/base/test/scoped_task_environment.h) +[`base::test::TaskEnvironment`](https://cs.chromium.org/chromium/src/base/test/scoped_task_environment.h) for the scope of the test. If you need BrowserThreads, use `content::TestBrowserThreadBundle` instead of -`base::test::ScopedTaskEnvironment`. +`base::test::TaskEnvironment`. -Tests can run the `base::test::ScopedTaskEnvironment`'s message pump using a +Tests can run the `base::test::TaskEnvironment`'s message pump using a `base::RunLoop`, which can be made to run until `Quit()` (explicitly or via `RunLoop::QuitClosure()`), or to `RunUntilIdle()` ready-to-run tasks and immediately return. -ScopedTaskEnvironment configures RunLoop::Run() to LOG(FATAL) if it hasn't been +TaskEnvironment configures RunLoop::Run() to LOG(FATAL) if it hasn't been explicitly quit after TestTimeouts::action_timeout(). This is preferable to having the test hang if the code under test fails to trigger the RunLoop to quit. The timeout can be overridden with ScopedRunTimeoutForTest. @@ -649,7 +649,7 @@ public: // ... protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST(MyTest, MyTest) { @@ -691,7 +691,7 @@ // This runs the (Thread|Sequenced)TaskRunnerHandle queue until both the // (Thread|Sequenced)TaskRunnerHandle queue and the TaskSchedule queue are // empty: - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // E, H, I have been executed. } ``` @@ -742,7 +742,7 @@ directly from [`base/task/post_task.h`](https://cs.chromium.org/chromium/src/base/task/post_task.h). -As mentioned above, `base::test::ScopedTaskEnvironment` allows unit tests to +As mentioned above, `base::test::TaskEnvironment` allows unit tests to control tasks posted from underlying TaskRunners. In rare cases where a test needs to more precisely control task ordering: dependency injection of TaskRunners can be useful. For such cases the preferred approach is the
diff --git a/docs/threading_and_tasks_faq.md b/docs/threading_and_tasks_faq.md index c500b38..65c1a27 100644 --- a/docs/threading_and_tasks_faq.md +++ b/docs/threading_and_tasks_faq.md
@@ -178,8 +178,8 @@ `TestBrowserThreadBundle::RunUntilIdle()` to wait until all tasks have run. If the test doesn't use `BrowserThread::UI/IO`, instantiate a -`base::test::ScopedTaskEnvironment` for the scope of the test. Call -`base::test::ScopedTaskEnvironment::RunUntilIdle()` to wait until all tasks have +`base::test::TaskEnvironment` for the scope of the test. Call +`base::test::TaskEnvironment::RunUntilIdle()` to wait until all tasks have run. In both cases, you can run tasks until a condition is met. A test that waits for
diff --git a/extensions/browser/api/document_scan/document_scan_interface_chromeos_unittest.cc b/extensions/browser/api/document_scan/document_scan_interface_chromeos_unittest.cc index 57aff6c6..7e0ae8f7 100644 --- a/extensions/browser/api/document_scan/document_scan_interface_chromeos_unittest.cc +++ b/extensions/browser/api/document_scan/document_scan_interface_chromeos_unittest.cc
@@ -35,7 +35,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DocumentScanInterfaceChromeos scan_interface_; };
diff --git a/extensions/browser/api/socket/mojo_data_pump_unittest.cc b/extensions/browser/api/socket/mojo_data_pump_unittest.cc index 5ee5ea9..36a5a7f 100644 --- a/extensions/browser/api/socket/mojo_data_pump_unittest.cc +++ b/extensions/browser/api/socket/mojo_data_pump_unittest.cc
@@ -20,7 +20,7 @@ // Tests that if |MojoDataPump::receive_stream_| is not ready, MojoDataPump will // wait and not error out. TEST(MojoDataPumpTest, ReceiveStreamNotReady) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; mojo::DataPipe receive_pipe; mojo::DataPipe send_pipe; auto pump = @@ -63,7 +63,7 @@ // Tests that if |MojoDataPump::receive_stream_| is closed, an error is // propagated. TEST(MojoDataPumpTest, ReceiveStreamClosed) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; mojo::DataPipe receive_pipe; mojo::DataPipe send_pipe; auto pump = @@ -88,7 +88,7 @@ // Tests that if |MojoDataPump::send_stream_| is closed, Write() will fail. TEST(MojoDataPumpTest, SendStreamClosed) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; mojo::DataPipe receive_pipe; mojo::DataPipe send_pipe; auto pump =
diff --git a/extensions/browser/file_reader_unittest.cc b/extensions/browser/file_reader_unittest.cc index b839f5c8..b5a5317 100644 --- a/extensions/browser/file_reader_unittest.cc +++ b/extensions/browser/file_reader_unittest.cc
@@ -23,7 +23,7 @@ FileReaderTest() {} private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(FileReaderTest); };
diff --git a/extensions/browser/preload_check_group_unittest.cc b/extensions/browser/preload_check_group_unittest.cc index c0810f99..5b26727 100644 --- a/extensions/browser/preload_check_group_unittest.cc +++ b/extensions/browser/preload_check_group_unittest.cc
@@ -51,7 +51,7 @@ private: // Required for the asynchronous tests. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Tests multiple succeeding checks.
diff --git a/extensions/common/api/_permission_features.json b/extensions/common/api/_permission_features.json index 222459a..96ddfe10 100644 --- a/extensions/common/api/_permission_features.json +++ b/extensions/common/api/_permission_features.json
@@ -667,6 +667,20 @@ "E24F1786D842E91E74C27929B0B3715A4689A473", // CryptoToken "A28C9619C4C41306FA5236FB4D94DA812F504DE8" // CryptoToken (dev) ] + }, + // TODO(995294, hendrich) Remove this whitelisting once a WebUSB solution is + // ready to go (target M79/M80). + { + "channel": "dev", + "extension_types": ["login_screen_extension", "extension"], + "location": "policy", + "platforms": ["chromeos"], + "whitelist": [ + "E219EE36A3B40612FD2A8CD6937B03EF0C97D3FE", // Imprivata (login screen) + "4DBFC1C52D6660DD90791976DF7FEF7B3D360509", // Imprivata (login screen) DEV + "A24DE1B21A67E25FB62AC8491642038FE25DA75B", // Imprivata (in session) + "6B25164FFE2BADB5F1DBBD301CC022170267022D" // Imprivata (in session) DEV + ] } ], "usbDevices": [ @@ -687,6 +701,20 @@ "4839A26B29CD1BD021B2E126EF6D28C9CB84018B", // http://crbug.com/710541 "8F44FBB4474CCDF23450B166C9E83E85BD03AE24" // http://crbug.com/710541 ] + }, + // TODO(995294, hendrich) Remove this whitelisting once a WebUSB solution is + // ready to go (target M79/M80). + { + "channel": "dev", + "extension_types": ["login_screen_extension", "extension"], + "location": "policy", + "platforms": ["chromeos"], + "whitelist": [ + "E219EE36A3B40612FD2A8CD6937B03EF0C97D3FE", // Imprivata (login screen) + "4DBFC1C52D6660DD90791976DF7FEF7B3D360509", // Imprivata (login screen) DEV + "A24DE1B21A67E25FB62AC8491642038FE25DA75B", // Imprivata (in session) + "6B25164FFE2BADB5F1DBBD301CC022170267022D" // Imprivata (in session) DEV + ] } ], "videoCapture": [
diff --git a/extensions/renderer/bindings/api_binding_test.h b/extensions/renderer/bindings/api_binding_test.h index 6333565..6182c52 100644 --- a/extensions/renderer/bindings/api_binding_test.h +++ b/extensions/renderer/bindings/api_binding_test.h
@@ -78,7 +78,7 @@ v8::Isolate* isolate(); private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<gin::IsolateHolder> isolate_holder_; std::unique_ptr<gin::ContextHolder> main_context_holder_;
diff --git a/extensions/renderer/extension_throttle_simulation_unittest.cc b/extensions/renderer/extension_throttle_simulation_unittest.cc index c6e8411..a1c0ced 100644 --- a/extensions/renderer/extension_throttle_simulation_unittest.cc +++ b/extensions/renderer/extension_throttle_simulation_unittest.cc
@@ -507,8 +507,8 @@ } TEST(URLRequestThrottlerSimulation, HelpsInAttack) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); Server unprotected_server(30, 1.0); RequesterResults unprotected_attacker_results; RequesterResults unprotected_client_results; @@ -588,8 +588,8 @@ } TEST(URLRequestThrottlerSimulation, PerceivedDowntimeRatio) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); struct Stats { // Expected interval that we expect the ratio of downtime when anti-DDoS // is enabled and downtime when anti-DDoS is not enabled to fall within.
diff --git a/extensions/renderer/gc_callback_unittest.cc b/extensions/renderer/gc_callback_unittest.cc index f92c7e6e..6710a88c 100644 --- a/extensions/renderer/gc_callback_unittest.cc +++ b/extensions/renderer/gc_callback_unittest.cc
@@ -112,7 +112,7 @@ RequestGarbageCollection(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ScopedWebFrame web_frame_; // (this will construct the v8::Isolate) // ExtensionsRendererClient is a dependency of ScriptContextSet.
diff --git a/extensions/renderer/module_system_test.h b/extensions/renderer/module_system_test.h index d236782..bf9596e 100644 --- a/extensions/renderer/module_system_test.h +++ b/extensions/renderer/module_system_test.h
@@ -121,7 +121,7 @@ void RunResolvedPromises(); private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; v8::Isolate* isolate_;
diff --git a/extensions/renderer/script_context_set_unittest.cc b/extensions/renderer/script_context_set_unittest.cc index a88d5e11..3668ad79 100644 --- a/extensions/renderer/script_context_set_unittest.cc +++ b/extensions/renderer/script_context_set_unittest.cc
@@ -21,7 +21,7 @@ namespace extensions { TEST(ScriptContextSetTest, Lifecycle) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; ScopedWebFrame web_frame; // Used by ScriptContextSet::Register(). TestExtensionsRendererClient extensions_renderer_client;
diff --git a/fuchsia/base/agent_impl_unittests.cc b/fuchsia/base/agent_impl_unittests.cc index 6e0e4c5..7da75c7 100644 --- a/fuchsia/base/agent_impl_unittests.cc +++ b/fuchsia/base/agent_impl_unittests.cc
@@ -100,9 +100,9 @@ return nullptr; } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<base::fuchsia::ServiceDirectory> services_; std::unique_ptr<base::fuchsia::ServiceDirectoryClient> services_client_;
diff --git a/fuchsia/engine/browser/cookie_manager_impl_unittest.cc b/fuchsia/engine/browser/cookie_manager_impl_unittest.cc index 1a7e5a9c..2771beca 100644 --- a/fuchsia/engine/browser/cookie_manager_impl_unittest.cc +++ b/fuchsia/engine/browser/cookie_manager_impl_unittest.cc
@@ -47,7 +47,7 @@ public: CookieManagerImplTest() : task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + base::test::TaskEnvironment::MainThreadType::IO), network_service_(network::NetworkService::CreateForTesting()), cookie_manager_( base::BindRepeating(&CookieManagerImplTest::GetNetworkContext, @@ -124,7 +124,7 @@ mojo::MakeRequest(&mojo_cookie_manager_)); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<network::NetworkService> network_service_; network::mojom::NetworkContextPtr network_context_;
diff --git a/fuchsia/engine/context_provider_impl_unittest.cc b/fuchsia/engine/context_provider_impl_unittest.cc index f9821e9..6ad01ab1 100644 --- a/fuchsia/engine/context_provider_impl_unittest.cc +++ b/fuchsia/engine/context_provider_impl_unittest.cc
@@ -46,9 +46,9 @@ constexpr char kTitle[] = "Palindrome"; MULTIPROCESS_TEST_MAIN(SpawnContextServer) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, + base::test::TaskEnvironment::MainThreadType::IO); base::FilePath data_dir; CHECK(base::PathService::Get(base::DIR_APP_DATA, &data_dir)); @@ -179,9 +179,9 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<ContextProviderImpl> provider_; fuchsia::web::ContextProviderPtr provider_ptr_; fidl::BindingSet<fuchsia::web::ContextProvider> bindings_;
diff --git a/fuchsia/engine/web_engine_debug_integration_test.cc b/fuchsia/engine/web_engine_debug_integration_test.cc index c7df69d..97fbb23 100644 --- a/fuchsia/engine/web_engine_debug_integration_test.cc +++ b/fuchsia/engine/web_engine_debug_integration_test.cc
@@ -94,9 +94,9 @@ fuchsia::web::ContextError::REMOTE_DEBUGGING_PORT_NOT_OPENED); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, + base::test::TaskEnvironment::MainThreadType::IO}; TestDebugListener dev_tools_listener_; fidl::Binding<fuchsia::web::DevToolsListener> dev_tools_listener_binding_;
diff --git a/fuchsia/engine/web_engine_integration_test.cc b/fuchsia/engine/web_engine_integration_test.cc index d2aa6b1..ad208702 100644 --- a/fuchsia/engine/web_engine_integration_test.cc +++ b/fuchsia/engine/web_engine_integration_test.cc
@@ -33,8 +33,7 @@ class WebEngineIntegrationTest : public testing::Test { public: WebEngineIntegrationTest() - : task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} ~WebEngineIntegrationTest() override = default; void SetUp() override { @@ -106,7 +105,7 @@ } protected: - const base::test::ScopedTaskEnvironment task_environment_; + const base::test::TaskEnvironment task_environment_; fuchsia::web::ContextProviderPtr web_context_provider_;
diff --git a/fuchsia/http/http_service_unittest.cc b/fuchsia/http/http_service_unittest.cc index 5f584f1b..0928538f 100644 --- a/fuchsia/http/http_service_unittest.cc +++ b/fuchsia/http/http_service_unittest.cc
@@ -31,8 +31,7 @@ class HttpServiceTest : public ::testing::Test { public: HttpServiceTest() - : task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), binding_(&http_service_server_) { // Initialize the test server. test_server_.AddDefaultHandlers( @@ -41,7 +40,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; void SetUp() override { ASSERT_TRUE(test_server_.Start());
diff --git a/fuchsia/mojom/fidl_interface_request_mojom_traits_unittest.cc b/fuchsia/mojom/fidl_interface_request_mojom_traits_unittest.cc index 0be77cf..ce1a4e2 100644 --- a/fuchsia/mojom/fidl_interface_request_mojom_traits_unittest.cc +++ b/fuchsia/mojom/fidl_interface_request_mojom_traits_unittest.cc
@@ -15,9 +15,9 @@ using base::fuchsia::testfidl::TestInterfacePtr; TEST(InterfaceRequestStructTraitsTest, Serialization) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, + base::test::TaskEnvironment::MainThreadType::IO); TestInterfacePtr test_ptr; fidl::InterfaceRequest<TestInterface> input_request = test_ptr.NewRequest(); fidl::InterfaceRequest<TestInterface> output_request;
diff --git a/fuchsia/runners/cast/cast_runner_integration_test.cc b/fuchsia/runners/cast/cast_runner_integration_test.cc index a6e7770..f0b8250 100644 --- a/fuchsia/runners/cast/cast_runner_integration_test.cc +++ b/fuchsia/runners/cast/cast_runner_integration_test.cc
@@ -254,9 +254,9 @@ } const base::RunLoop::ScopedRunTimeoutForTest run_timeout_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, + base::test::TaskEnvironment::MainThreadType::IO}; net::EmbeddedTestServer test_server_; // Returns fake Cast application information to the CastRunner.
diff --git a/fuchsia/runners/web/web_runner_smoke_test.cc b/fuchsia/runners/web/web_runner_smoke_test.cc index 11442c4..adac172 100644 --- a/fuchsia/runners/web/web_runner_smoke_test.cc +++ b/fuchsia/runners/web/web_runner_smoke_test.cc
@@ -85,9 +85,9 @@ bool test_html_requested_ = false; bool test_image_requested_ = false; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<base::fuchsia::ServiceDirectory> service_directory_; std::unique_ptr<base::fuchsia::ServiceProviderImpl> service_provider_;
diff --git a/gin/shell_runner_unittest.cc b/gin/shell_runner_unittest.cc index 9e277e2..a2218d9 100644 --- a/gin/shell_runner_unittest.cc +++ b/gin/shell_runner_unittest.cc
@@ -25,7 +25,7 @@ namespace gin { TEST(RunnerTest, Run) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; std::string source = "this.result = 'PASS';\n"; #ifdef V8_USE_EXTERNAL_STARTUP_DATA
diff --git a/gin/test/v8_test.cc b/gin/test/v8_test.cc index e19e660..72d6af0 100644 --- a/gin/test/v8_test.cc +++ b/gin/test/v8_test.cc
@@ -16,8 +16,7 @@ namespace gin { V8Test::V8Test() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} V8Test::~V8Test() = default;
diff --git a/gin/test/v8_test.h b/gin/test/v8_test.h index 52c04dd..5a7a689 100644 --- a/gin/test/v8_test.h +++ b/gin/test/v8_test.h
@@ -30,7 +30,7 @@ protected: // This is used during SetUp() to initialize instance_. virtual std::unique_ptr<IsolateHolder> CreateIsolateHolder() const; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<IsolateHolder> instance_; v8::Persistent<v8::Context> context_;
diff --git a/gin/v8_platform.cc b/gin/v8_platform.cc index 45c79286..2c1bc65 100644 --- a/gin/v8_platform.cc +++ b/gin/v8_platform.cc
@@ -8,6 +8,7 @@ #include "base/allocator/partition_allocator/address_space_randomization.h" #include "base/allocator/partition_allocator/page_allocator.h" +#include "base/allocator/partition_allocator/random.h" #include "base/bind.h" #include "base/bit_cast.h" #include "base/bits.h"
diff --git a/google_apis/drive/base_requests_server_unittest.cc b/google_apis/drive/base_requests_server_unittest.cc index 9794e0c..4f6b34a 100644 --- a/google_apis/drive/base_requests_server_unittest.cc +++ b/google_apis/drive/base_requests_server_unittest.cc
@@ -70,7 +70,7 @@ request_sender_ = std::make_unique<RequestSender>( std::make_unique<DummyAuthService>(), test_shared_loader_factory_, - scoped_task_environment_.GetMainThreadTaskRunner(), kTestUserAgent, + task_environment_.GetMainThreadTaskRunner(), kTestUserAgent, TRAFFIC_ANNOTATION_FOR_TESTS); ASSERT_TRUE(test_server_.InitializeAndListen()); @@ -86,8 +86,8 @@ return temp_dir_.GetPath().Append(file_name); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; net::EmbeddedTestServer test_server_; std::unique_ptr<RequestSender> request_sender_; std::unique_ptr<network::mojom::NetworkService> network_service_;
diff --git a/google_apis/drive/base_requests_unittest.cc b/google_apis/drive/base_requests_unittest.cc index 2ff0eb9e..f78d2ea8 100644 --- a/google_apis/drive/base_requests_unittest.cc +++ b/google_apis/drive/base_requests_unittest.cc
@@ -142,11 +142,11 @@ } void SetUp() override { - sender_.reset(new RequestSender( - std::make_unique<DummyAuthService>(), test_shared_loader_factory_, - scoped_task_environment_.GetMainThreadTaskRunner(), - std::string(), /* custom user agent */ - TRAFFIC_ANNOTATION_FOR_TESTS)); + sender_.reset(new RequestSender(std::make_unique<DummyAuthService>(), + test_shared_loader_factory_, + task_environment_.GetMainThreadTaskRunner(), + std::string(), /* custom user agent */ + TRAFFIC_ANNOTATION_FOR_TESTS)); test_server_.RegisterRequestHandler( base::Bind(&BaseRequestsTest::HandleRequest, base::Unretained(this))); @@ -157,7 +157,7 @@ // Deleting the sender here will delete all request objects. sender_.reset(); // Wait for any DeleteSoon tasks to run. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } std::unique_ptr<net::test_server::HttpResponse> HandleRequest( @@ -170,8 +170,8 @@ return std::move(response); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<network::mojom::NetworkService> network_service_; std::unique_ptr<network::mojom::NetworkServiceClient> network_service_client_; network::mojom::NetworkContextPtr network_context_;
diff --git a/google_apis/drive/drive_api_requests_unittest.cc b/google_apis/drive/drive_api_requests_unittest.cc index 30c0b960..4dee98ef 100644 --- a/google_apis/drive/drive_api_requests_unittest.cc +++ b/google_apis/drive/drive_api_requests_unittest.cc
@@ -154,7 +154,7 @@ void SetUp() override { request_sender_ = std::make_unique<RequestSender>( std::make_unique<DummyAuthService>(), test_shared_loader_factory_, - scoped_task_environment_.GetMainThreadTaskRunner(), kTestUserAgent, + task_environment_.GetMainThreadTaskRunner(), kTestUserAgent, TRAFFIC_ANNOTATION_FOR_TESTS); ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); @@ -212,8 +212,8 @@ testing_properties_.push_back(public_property); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; net::EmbeddedTestServer test_server_; std::unique_ptr<RequestSender> request_sender_; std::unique_ptr<DriveApiUrlGenerator> url_generator_;
diff --git a/google_apis/drive/files_list_request_runner_unittest.cc b/google_apis/drive/files_list_request_runner_unittest.cc index 50d14ce..4b24138 100644 --- a/google_apis/drive/files_list_request_runner_unittest.cc +++ b/google_apis/drive/files_list_request_runner_unittest.cc
@@ -101,7 +101,7 @@ void SetUp() override { request_sender_ = std::make_unique<RequestSender>( std::make_unique<DummyAuthService>(), test_shared_loader_factory_, - scoped_task_environment_.GetMainThreadTaskRunner(), kTestUserAgent, + task_environment_.GetMainThreadTaskRunner(), kTestUserAgent, TRAFFIC_ANNOTATION_FOR_TESTS); test_server_.RegisterRequestHandler( @@ -149,8 +149,8 @@ return std::move(fake_server_response_); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<RequestSender> request_sender_; net::EmbeddedTestServer test_server_; std::unique_ptr<FilesListRequestRunner> runner_;
diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc index e20bb74c..88a5ad6 100644 --- a/google_apis/gaia/gaia_auth_fetcher.cc +++ b/google_apis/gaia/gaia_auth_fetcher.cc
@@ -269,6 +269,12 @@ DCHECK_EQ(GaiaUrls::GetInstance()->gaia_url(), gaia_gurl.GetOrigin()) << gaia_gurl; resource_request->site_for_cookies = GaiaUrls::GetInstance()->gaia_url(); + url::Origin origin = + url::Origin::Create(GaiaUrls::GetInstance()->gaia_url()); + resource_request->trusted_params = + network::ResourceRequest::TrustedParams(); + resource_request->trusted_params->network_isolation_key = + net::NetworkIsolationKey(origin, origin); } if (!body.empty())
diff --git a/google_apis/gaia/gaia_auth_fetcher_unittest.cc b/google_apis/gaia/gaia_auth_fetcher_unittest.cc index b0163e7..c417b23 100644 --- a/google_apis/gaia/gaia_auth_fetcher_unittest.cc +++ b/google_apis/gaia/gaia_auth_fetcher_unittest.cc
@@ -71,8 +71,7 @@ GaiaUrls::GetInstance()->oauth1_login_url().Resolve( "?source=&issueuberauth=1")), oauth_login_gurl_(GaiaUrls::GetInstance()->oauth1_login_url()), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + task_environment_(base::test::TaskEnvironment::MainThreadType::UI), test_shared_loader_factory_( base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( &test_url_loader_factory_)) { @@ -123,7 +122,7 @@ return test_shared_loader_factory_; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; std::vector<network::ResourceRequest> received_requests_;
diff --git a/google_apis/gaia/gaia_oauth_client_unittest.cc b/google_apis/gaia/gaia_oauth_client_unittest.cc index 9a543bd..5e1e81e 100644 --- a/google_apis/gaia/gaia_oauth_client_unittest.cc +++ b/google_apis/gaia/gaia_oauth_client_unittest.cc
@@ -168,8 +168,7 @@ class GaiaOAuthClientTest : public testing::Test { protected: GaiaOAuthClientTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void SetUp() override { client_info_.client_id = "test_client_id"; @@ -187,11 +186,11 @@ // TestURLLoaderFactory to its clients via mojo pipes. In addition, // some retries may have back off, so may need to advance (mock) time // for them to finish, too. - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory url_loader_factory_; OAuthClientInfo client_info_; @@ -284,8 +283,7 @@ injector.set_max_failure_count(21); injector.set_results(kDummyGetTokensResult); - base::TimeTicks start = - scoped_task_environment_.GetMockTickClock()->NowTicks(); + base::TimeTicks start = task_environment_.GetMockTickClock()->NowTicks(); GaiaOAuthClient auth(GetSharedURLLoaderFactory()); auth.GetTokensFromAuthCode(client_info_, "auth_code", -1, &delegate); @@ -299,7 +297,7 @@ // 0.6 * 700ms * 1.4^(20-2) ~ 179s // // ... so the whole thing should take at least 307s - EXPECT_GE(scoped_task_environment_.GetMockTickClock()->NowTicks() - start, + EXPECT_GE(task_environment_.GetMockTickClock()->NowTicks() - start, base::TimeDelta::FromSeconds(307)); }
diff --git a/google_apis/gaia/oauth2_access_token_fetcher_impl_unittest.cc b/google_apis/gaia/oauth2_access_token_fetcher_impl_unittest.cc index 848ce5e..55c02323 100644 --- a/google_apis/gaia/oauth2_access_token_fetcher_impl_unittest.cc +++ b/google_apis/gaia/oauth2_access_token_fetcher_impl_unittest.cc
@@ -115,7 +115,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockOAuth2AccessTokenConsumer consumer_; URLLoaderFactoryInterceptor url_loader_factory_interceptor_; network::TestURLLoaderFactory url_loader_factory_;
diff --git a/google_apis/gaia/oauth2_access_token_manager_unittest.cc b/google_apis/gaia/oauth2_access_token_manager_unittest.cc index 16d3974..f446d620 100644 --- a/google_apis/gaia/oauth2_access_token_manager_unittest.cc +++ b/google_apis/gaia/oauth2_access_token_manager_unittest.cc
@@ -298,7 +298,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; CoreAccountId account_id_; network::TestURLLoaderFactory test_url_loader_factory_; FakeOAuth2AccessTokenManagerDelegate delegate_;
diff --git a/google_apis/gaia/oauth2_api_call_flow_unittest.cc b/google_apis/gaia/oauth2_api_call_flow_unittest.cc index 1a9ba79..d93001e 100644 --- a/google_apis/gaia/oauth2_api_call_flow_unittest.cc +++ b/google_apis/gaia/oauth2_api_call_flow_unittest.cc
@@ -100,7 +100,7 @@ AddFetchResult(url, succeeds, status, std::string()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> shared_factory_; StrictMock<MockApiCallFlow> flow_;
diff --git a/google_apis/gcm/base/socket_stream_unittest.cc b/google_apis/gcm/base/socket_stream_unittest.cc index 0c700007..83f859ab 100644 --- a/google_apis/gcm/base/socket_stream_unittest.cc +++ b/google_apis/gcm/base/socket_stream_unittest.cc
@@ -79,7 +79,7 @@ void ResetInputStream(); void ResetOutputStream(); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // SocketStreams and their data providers. ReadList mock_reads_; @@ -103,8 +103,7 @@ }; GCMSocketStreamTest::GCMSocketStreamTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), network_change_notifier_(net::NetworkChangeNotifier::CreateMock()), network_service_(network::NetworkService::CreateForTesting()), url_request_context_(true /* delay_initialization */) {
diff --git a/google_apis/gcm/engine/account_mapping.h b/google_apis/gcm/engine/account_mapping.h index bfd25a7..b64425b 100644 --- a/google_apis/gcm/engine/account_mapping.h +++ b/google_apis/gcm/engine/account_mapping.h
@@ -8,6 +8,7 @@ #include <string> #include "base/time/time.h" +#include "google_apis/gaia/core_account_id.h" #include "google_apis/gcm/base/gcm_export.h" namespace gcm { @@ -37,8 +38,8 @@ // |status| is infered. bool ParseFromString(const std::string& value); - // Gaia ID of the account. (Acts as key for persistence.) - std::string account_id; + // Account Id of the account. (Acts as key for persistence.) + CoreAccountId account_id; // Email address of the tracked account. std::string email; // OAuth2 access token used to authenticate mappings (not persisted).
diff --git a/google_apis/gcm/engine/connection_factory_impl_unittest.cc b/google_apis/gcm/engine/connection_factory_impl_unittest.cc index 22e09f9..6ea68c5f 100644 --- a/google_apis/gcm/engine/connection_factory_impl_unittest.cc +++ b/google_apis/gcm/engine/connection_factory_impl_unittest.cc
@@ -301,7 +301,7 @@ std::unique_ptr<network::TestNetworkConnectionTracker> network_connection_tracker_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestConnectionFactoryImpl factory_; std::unique_ptr<base::RunLoop> run_loop_; @@ -315,8 +315,7 @@ ConnectionFactoryImplTest::ConnectionFactoryImplTest() : network_connection_tracker_( network::TestNetworkConnectionTracker::CreateInstance()), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + task_environment_(base::test::TaskEnvironment::MainThreadType::IO), factory_(base::BindRepeating( &ConnectionFactoryImplTest::GetProxyResolvingSocketFactory, base::Unretained(this)),
diff --git a/google_apis/gcm/engine/connection_handler_impl_unittest.cc b/google_apis/gcm/engine/connection_handler_impl_unittest.cc index 0977480..cd6b73f 100644 --- a/google_apis/gcm/engine/connection_handler_impl_unittest.cc +++ b/google_apis/gcm/engine/connection_handler_impl_unittest.cc
@@ -190,7 +190,7 @@ int last_error_; net::AddressList address_list_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_; std::unique_ptr<network::NetworkService> network_service_; @@ -205,8 +205,7 @@ GCMConnectionHandlerImplTest::GCMConnectionHandlerImplTest() : last_error_(0), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + task_environment_(base::test::TaskEnvironment::MainThreadType::IO), network_change_notifier_(net::NetworkChangeNotifier::CreateMock()), network_service_(network::NetworkService::CreateForTesting()), url_request_context_(true /* delay_initialization */) {
diff --git a/google_apis/gcm/engine/gcm_request_test_base.cc b/google_apis/gcm/engine/gcm_request_test_base.cc index 327ad97..2bd18a59 100644 --- a/google_apis/gcm/engine/gcm_request_test_base.cc +++ b/google_apis/gcm/engine/gcm_request_test_base.cc
@@ -129,7 +129,7 @@ int next_retry_delay_ms = kDefaultBackoffPolicy.initial_delay_ms; next_retry_delay_ms *= pow(kDefaultBackoffPolicy.multiply_factor, retry_count_); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( base::TimeDelta::FromMilliseconds(next_retry_delay_ms)); }
diff --git a/google_apis/gcm/engine/gcm_request_test_base.h b/google_apis/gcm/engine/gcm_request_test_base.h index a076e4d..251ee8c 100644 --- a/google_apis/gcm/engine/gcm_request_test_base.h +++ b/google_apis/gcm/engine/gcm_request_test_base.h
@@ -61,8 +61,8 @@ // Fast forward the timer used in the test to retry the request immediately. void FastForwardToTriggerNextRetry(); - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> shared_factory_;
diff --git a/google_apis/gcm/engine/mcs_client_unittest.cc b/google_apis/gcm/engine/mcs_client_unittest.cc index 39c7fd1..13bbdda 100644 --- a/google_apis/gcm/engine/mcs_client_unittest.cc +++ b/google_apis/gcm/engine/mcs_client_unittest.cc
@@ -173,7 +173,7 @@ base::SimpleTestClock clock_; base::ScopedTempDir temp_directory_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; std::unique_ptr<GCMStore> gcm_store_; @@ -209,10 +209,9 @@ } void MCSClientTest::BuildMCSClient() { - gcm_store_.reset( - new GCMStoreImpl(temp_directory_.GetPath(), - scoped_task_environment_.GetMainThreadTaskRunner(), - base::WrapUnique<Encryptor>(new FakeEncryptor))); + gcm_store_.reset(new GCMStoreImpl( + temp_directory_.GetPath(), task_environment_.GetMainThreadTaskRunner(), + base::WrapUnique<Encryptor>(new FakeEncryptor))); mcs_client_.reset( new TestMCSClient(&clock_, &connection_factory_, gcm_store_.get(), base::ThreadTaskRunnerHandle::Get(), &recorder_));
diff --git a/gpu/command_buffer/client/cmd_buffer_helper_test.cc b/gpu/command_buffer/client/cmd_buffer_helper_test.cc index 23e9fa3..9289511 100644 --- a/gpu/command_buffer/client/cmd_buffer_helper_test.cc +++ b/gpu/command_buffer/client/cmd_buffer_helper_test.cc
@@ -202,7 +202,7 @@ std::vector<std::unique_ptr<CommandBufferEntry[]>> test_command_args_; unsigned int test_command_next_id_; Sequence sequence_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Checks immediate_entry_count_ changes based on RingBuffer state.
diff --git a/gpu/command_buffer/client/fenced_allocator_test.cc b/gpu/command_buffer/client/fenced_allocator_test.cc index a5f7cd1..bcaf9d2 100644 --- a/gpu/command_buffer/client/fenced_allocator_test.cc +++ b/gpu/command_buffer/client/fenced_allocator_test.cc
@@ -58,7 +58,7 @@ std::unique_ptr<CommandBufferDirect> command_buffer_; std::unique_ptr<AsyncAPIMock> api_mock_; std::unique_ptr<CommandBufferHelper> helper_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; #ifndef _MSC_VER
diff --git a/gpu/command_buffer/client/mapped_memory_unittest.cc b/gpu/command_buffer/client/mapped_memory_unittest.cc index 1a574fc..0f3a0a67 100644 --- a/gpu/command_buffer/client/mapped_memory_unittest.cc +++ b/gpu/command_buffer/client/mapped_memory_unittest.cc
@@ -55,7 +55,7 @@ std::unique_ptr<CommandBufferDirectLocked> command_buffer_; std::unique_ptr<AsyncAPIMock> api_mock_; std::unique_ptr<CommandBufferHelper> helper_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; #ifndef _MSC_VER
diff --git a/gpu/command_buffer/client/ring_buffer_test.cc b/gpu/command_buffer/client/ring_buffer_test.cc index f7c0b6e..6cfdb87 100644 --- a/gpu/command_buffer/client/ring_buffer_test.cc +++ b/gpu/command_buffer/client/ring_buffer_test.cc
@@ -85,7 +85,7 @@ std::unique_ptr<int8_t[]> buffer_; int8_t* buffer_start_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; #ifndef _MSC_VER
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h index 74ace1d..1a6af3c 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
@@ -804,7 +804,7 @@ SharedImageManager shared_image_manager_; scoped_refptr<ContextGroup> group_; MockGLStates gl_states_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockCopyTextureResourceManager* copy_texture_manager_; // not owned MockCopyTexImageResourceManager* copy_tex_image_blitter_; // not owned
diff --git a/gpu/command_buffer/service/gpu_service_test.h b/gpu/command_buffer/service/gpu_service_test.h index 8cf3a83..7fe4aa2 100644 --- a/gpu/command_buffer/service/gpu_service_test.h +++ b/gpu/command_buffer/service/gpu_service_test.h
@@ -42,7 +42,7 @@ bool ran_teardown_; scoped_refptr<gl::GLContextStub> context_; scoped_refptr<gl::GLSurfaceStub> surface_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; } // namespace gles2
diff --git a/gpu/command_buffer/service/raster_decoder_unittest_base.h b/gpu/command_buffer/service/raster_decoder_unittest_base.h index 042994e3..226b2e7 100644 --- a/gpu/command_buffer/service/raster_decoder_unittest_base.h +++ b/gpu/command_buffer/service/raster_decoder_unittest_base.h
@@ -235,7 +235,7 @@ MemoryTypeTracker memory_tracker_; std::vector<std::unique_ptr<SharedImageRepresentationFactoryRef>> shared_images_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; gles2::MockCopyTextureResourceManager* copy_texture_manager_; // not owned GLuint next_fake_texture_client_id_ = 271828; };
diff --git a/gpu/command_buffer/tests/gl_tests_main.cc b/gpu/command_buffer/tests/gl_tests_main.cc index c152dc7..2fbba5d 100644 --- a/gpu/command_buffer/tests/gl_tests_main.cc +++ b/gpu/command_buffer/tests/gl_tests_main.cc
@@ -36,16 +36,15 @@ base::TestSuite::Initialize(); base::FeatureList::InitializeInstance(std::string(), std::string()); - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + task_environment_ = std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::MainThreadType::UI); #if defined(USE_OZONE) // Make Ozone run in single-process mode. ui::OzonePlatform::InitParams params; params.single_process = true; params.using_mojo = true; - // This initialization must be done after ScopedTaskEnvironment has + // This initialization must be done after TaskEnvironment has // initialized the UI thread. ui::OzonePlatform::InitializeForUI(params); ui::OzonePlatform::InitializeForGPU(params); @@ -56,7 +55,7 @@ } private: - std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_; + std::unique_ptr<base::test::TaskEnvironment> task_environment_; }; } // namespace
diff --git a/gpu/ipc/common/android/image_reader_gl_owner_unittest.cc b/gpu/ipc/common/android/image_reader_gl_owner_unittest.cc index f13ce719..4b5641d1a 100644 --- a/gpu/ipc/common/android/image_reader_gl_owner_unittest.cc +++ b/gpu/ipc/common/android/image_reader_gl_owner_unittest.cc
@@ -79,7 +79,7 @@ scoped_refptr<gl::GLContext> context_; scoped_refptr<gl::GLShareGroup> share_group_; scoped_refptr<gl::GLSurface> surface_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(ImageReaderGLOwnerTest, ImageReaderObjectCreation) {
diff --git a/gpu/ipc/common/android/surface_texture_gl_owner_unittest.cc b/gpu/ipc/common/android/surface_texture_gl_owner_unittest.cc index ed91bd1..189b06a 100644 --- a/gpu/ipc/common/android/surface_texture_gl_owner_unittest.cc +++ b/gpu/ipc/common/android/surface_texture_gl_owner_unittest.cc
@@ -74,7 +74,7 @@ scoped_refptr<gl::GLContext> context_; scoped_refptr<gl::GLShareGroup> share_group_; scoped_refptr<gl::GLSurface> surface_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(SurfaceTextureGLOwnerTest, OwnerReturnsServiceId) {
diff --git a/gpu/ipc/common/mojom_traits_unittest.cc b/gpu/ipc/common/mojom_traits_unittest.cc index a1fa2b6..ca39a30c 100644 --- a/gpu/ipc/common/mojom_traits_unittest.cc +++ b/gpu/ipc/common/mojom_traits_unittest.cc
@@ -82,7 +82,7 @@ std::move(callback).Run(prefs); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::BindingSet<TraitsTestService> traits_test_bindings_; DISALLOW_COPY_AND_ASSIGN(StructTraitsTest);
diff --git a/gpu/ipc/host/shader_disk_cache_unittest.cc b/gpu/ipc/host/shader_disk_cache_unittest.cc index ea35670d..417ad71 100644 --- a/gpu/ipc/host/shader_disk_cache_unittest.cc +++ b/gpu/ipc/host/shader_disk_cache_unittest.cc
@@ -40,13 +40,13 @@ void TearDown() override { factory_.RemoveCacheInfo(kDefaultClientId); - // Run all pending tasks before destroying ScopedTaskEnvironment. Otherwise, + // Run all pending tasks before destroying TaskEnvironment. Otherwise, // SimpleEntryImpl instances bound to pending tasks are destroyed in an // incorrect state (see |state_| DCHECK in ~SimpleEntryImpl). - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; ShaderCacheFactory factory_;
diff --git a/headless/lib/browser/headless_print_manager.cc b/headless/lib/browser/headless_print_manager.cc index d717f27..1bcba2f 100644 --- a/headless/lib/browser/headless_print_manager.cc +++ b/headless/lib/browser/headless_print_manager.cc
@@ -267,7 +267,8 @@ void HeadlessPrintManager::OnDidPrintDocument( content::RenderFrameHost* render_frame_host, - const PrintHostMsg_DidPrintDocument_Params& params) { + const PrintHostMsg_DidPrintDocument_Params& params, + std::unique_ptr<DelayedFrameDispatchHelper> helper) { auto& content = params.content; if (!content.metafile_data_region.IsValid()) { ReleaseJob(INVALID_MEMORY_HANDLE); @@ -279,6 +280,7 @@ return; } data_ = std::string(static_cast<const char*>(map.memory()), map.size()); + helper->SendCompleted(); ReleaseJob(PRINT_SUCCESS); }
diff --git a/headless/lib/browser/headless_print_manager.h b/headless/lib/browser/headless_print_manager.h index b8fb490..bdd5fae 100644 --- a/headless/lib/browser/headless_print_manager.h +++ b/headless/lib/browser/headless_print_manager.h
@@ -100,7 +100,8 @@ // printing::PrintManager: void OnDidPrintDocument( content::RenderFrameHost* render_frame_host, - const PrintHostMsg_DidPrintDocument_Params& params) override; + const PrintHostMsg_DidPrintDocument_Params& params, + std::unique_ptr<DelayedFrameDispatchHelper> helper) override; void OnGetDefaultPrintSettings(content::RenderFrameHost* render_frame_host, IPC::Message* reply_msg) override; void OnPrintingFailed(int cookie) override;
diff --git a/ios/chrome/app/application_delegate/memory_warning_helper_unittest.mm b/ios/chrome/app/application_delegate/memory_warning_helper_unittest.mm index aa065bf..393e8ea 100644 --- a/ios/chrome/app/application_delegate/memory_warning_helper_unittest.mm +++ b/ios/chrome/app/application_delegate/memory_warning_helper_unittest.mm
@@ -52,8 +52,8 @@ void RunMessageLoop() { run_loop_.Run(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY}; base::RunLoop run_loop_; base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level_; std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_;
diff --git a/ios/chrome/app/spotlight/spotlight_manager_unittest.mm b/ios/chrome/app/spotlight/spotlight_manager_unittest.mm index cd0a4e31..9adda7e 100644 --- a/ios/chrome/app/spotlight/spotlight_manager_unittest.mm +++ b/ios/chrome/app/spotlight/spotlight_manager_unittest.mm
@@ -87,7 +87,7 @@ ~SpotlightManagerTest() override { [bookmarksSpotlightManager_ shutdown]; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; testing::StrictMock<favicon::MockFaviconService> mock_favicon_service_; std::unique_ptr<favicon::LargeIconServiceImpl> large_icon_service_; base::CancelableTaskTracker cancelable_task_tracker_;
diff --git a/ios/chrome/app/strings/ios_strings.grd b/ios/chrome/app/strings/ios_strings.grd index 0e84580..7f8fe91f 100644 --- a/ios/chrome/app/strings/ios_strings.grd +++ b/ios/chrome/app/strings/ios_strings.grd
@@ -1250,13 +1250,13 @@ <message name="IDS_IOS_QR_SCANNER_MULTIPLE_FOREGROUND_APPS_ALERT_TITLE" desc="Title of a modal dialog shown when the user tries to open the QR scanner in a Split View mode. [Length: 40em] [iOS only]" meaning="Title of a Split View error dialog in QR Scanner."> Split View </message> - <message name="IDS_IOS_QR_SCANNER_TORCH_BUTTON_ACCESSIBILITY_LABEL" desc="Accessibility label for the button to turn torch on and off in the QR Scanner. The current state of the button is communicated using the accessibility value. [Length: unlimited] [iOS only]"> + <message name="IDS_IOS_SCANNER_TORCH_BUTTON_ACCESSIBILITY_LABEL" desc="Accessibility label for the button to turn torch on and off in the scanner. The current state of the button is communicated using the accessibility value. [Length: unlimited] [iOS only]"> Torch </message> - <message name="IDS_IOS_QR_SCANNER_TORCH_OFF_ACCESSIBILITY_VALUE" desc="Accessiblity value of the button to turn torch on in the QR Scanner. The button communicates that the torch is current off. [Length: unlimited] [iOS only]"> + <message name="IDS_IOS_SCANNER_TORCH_OFF_ACCESSIBILITY_VALUE" desc="Accessiblity value of the button to turn torch on in the scanner. The button communicates that the torch is current off. [Length: unlimited] [iOS only]"> Off </message> - <message name="IDS_IOS_QR_SCANNER_TORCH_ON_ACCESSIBILITY_VALUE" desc="Accessibility value of the button to turn torch off in the QR Scanner. The button communicates that the torch is currently on. [Length: unlimited] [iOS only]"> + <message name="IDS_IOS_SCANNER_TORCH_ON_ACCESSIBILITY_VALUE" desc="Accessibility value of the button to turn torch off in the scanner. The button communicates that the torch is currently on. [Length: unlimited] [iOS only]"> On </message> <message name="IDS_IOS_QR_SCANNER_VIEWPORT_CAPTION" desc="Message displayed below the QR scanner viewport instructing the user to position the scanned QR or bar code inside the viewport. [Length: unlimited] [iOS only]">
diff --git a/ios/chrome/browser/app_launcher/app_launcher_tab_helper_unittest.mm b/ios/chrome/browser/app_launcher/app_launcher_tab_helper_unittest.mm index 21e0a57c..a34a8573 100644 --- a/ios/chrome/browser/app_launcher/app_launcher_tab_helper_unittest.mm +++ b/ios/chrome/browser/app_launcher/app_launcher_tab_helper_unittest.mm
@@ -184,7 +184,7 @@ return entry->IsRead() == expected_read_status; } - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; web::TestWebState web_state_; FakeNavigationManager* navigation_manager_ = nullptr;
diff --git a/ios/chrome/browser/autofill/BUILD.gn b/ios/chrome/browser/autofill/BUILD.gn index 7f34983..5db55e6 100644 --- a/ios/chrome/browser/autofill/BUILD.gn +++ b/ios/chrome/browser/autofill/BUILD.gn
@@ -11,11 +11,6 @@ "autocomplete_history_manager_factory.h", "autofill_profile_validator_factory.cc", "autofill_profile_validator_factory.h", - "form_input_accessory_consumer.h", - "form_input_accessory_view.h", - "form_input_accessory_view.mm", - "form_input_accessory_view_controller.h", - "form_input_accessory_view_controller.mm", "form_input_suggestions_provider.h", "form_suggestion_controller.h", "form_suggestion_controller.mm", @@ -159,6 +154,7 @@ "//ios/chrome/browser/infobars", "//ios/chrome/browser/ssl", "//ios/chrome/browser/ui/autofill", + "//ios/chrome/browser/ui/autofill/form_input_accessory", "//ios/chrome/browser/ui/coordinators:chrome_coordinators", "//ios/chrome/browser/ui/settings:test_support", "//ios/chrome/browser/ui/util",
diff --git a/ios/chrome/browser/autofill/autofill_controller_unittest.mm b/ios/chrome/browser/autofill/autofill_controller_unittest.mm index aee602c..0919cae 100644 --- a/ios/chrome/browser/autofill/autofill_controller_unittest.mm +++ b/ios/chrome/browser/autofill/autofill_controller_unittest.mm
@@ -35,7 +35,7 @@ #include "ios/chrome/browser/infobars/infobar_manager_impl.h" #include "ios/chrome/browser/ssl/ios_security_state_tab_helper.h" #import "ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.h" -#import "ios/chrome/browser/ui/autofill/form_input_accessory_mediator.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.h" #include "ios/chrome/browser/ui/settings/personal_data_manager_finished_profile_tasks_waiter.h" #include "ios/chrome/browser/web/chrome_web_client.h" #import "ios/chrome/browser/web/chrome_web_test.h"
diff --git a/ios/chrome/browser/autofill/form_suggestion_controller.mm b/ios/chrome/browser/autofill/form_suggestion_controller.mm index 7c6e8d1..21b5e14 100644 --- a/ios/chrome/browser/autofill/form_suggestion_controller.mm +++ b/ios/chrome/browser/autofill/form_suggestion_controller.mm
@@ -14,7 +14,6 @@ #import "components/autofill/ios/browser/form_suggestion.h" #import "components/autofill/ios/browser/form_suggestion_provider.h" #include "components/autofill/ios/form_util/form_activity_params.h" -#import "ios/chrome/browser/autofill/form_input_accessory_view_controller.h" #import "ios/chrome/browser/autofill/form_input_navigator.h" #import "ios/chrome/browser/autofill/form_input_suggestions_provider.h" #import "ios/chrome/browser/autofill/form_suggestion_view.h"
diff --git a/ios/chrome/browser/autofill/form_suggestion_controller_unittest.mm b/ios/chrome/browser/autofill/form_suggestion_controller_unittest.mm index 3681889..0914891 100644 --- a/ios/chrome/browser/autofill/form_suggestion_controller_unittest.mm +++ b/ios/chrome/browser/autofill/form_suggestion_controller_unittest.mm
@@ -15,9 +15,9 @@ #import "components/autofill/ios/form_util/form_activity_observer_bridge.h" #include "components/autofill/ios/form_util/form_activity_params.h" #include "components/autofill/ios/form_util/test_form_activity_tab_helper.h" -#import "ios/chrome/browser/autofill/form_input_accessory_consumer.h" #import "ios/chrome/browser/autofill/form_suggestion_view.h" -#import "ios/chrome/browser/ui/autofill/form_input_accessory_mediator.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_consumer.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.h" #include "ios/chrome/browser/ui/util/ui_util.h" #import "ios/web/public/navigation/navigation_manager.h" #include "ios/web/public/test/fakes/fake_web_frame.h"
diff --git a/ios/chrome/browser/autofill/manual_fill/passwords_fetcher_unittest.mm b/ios/chrome/browser/autofill/manual_fill/passwords_fetcher_unittest.mm index d3c93d75..6d52d74 100644 --- a/ios/chrome/browser/autofill/manual_fill/passwords_fetcher_unittest.mm +++ b/ios/chrome/browser/autofill/manual_fill/passwords_fetcher_unittest.mm
@@ -129,7 +129,7 @@ GetPasswordStore()->AddLogin(*std::move(form)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; };
diff --git a/ios/chrome/browser/download/download_directory_util_unittest.mm b/ios/chrome/browser/download/download_directory_util_unittest.mm index ec6ad90..7df07d48 100644 --- a/ios/chrome/browser/download/download_directory_util_unittest.mm +++ b/ios/chrome/browser/download/download_directory_util_unittest.mm
@@ -22,7 +22,7 @@ // Tests that DeleteDownloadsDirectory() actually deletes the directory. TEST_F(DownloadDirectoryTest, Deletion) { - base::test::ScopedTaskEnvironment envoronment; + base::test::TaskEnvironment envoronment; // Create a new file in downloads directory. base::FilePath dir;
diff --git a/ios/chrome/browser/history/history_tab_helper_unittest.mm b/ios/chrome/browser/history/history_tab_helper_unittest.mm index e242e90..fc1da2d 100644 --- a/ios/chrome/browser/history/history_tab_helper_unittest.mm +++ b/ios/chrome/browser/history/history_tab_helper_unittest.mm
@@ -66,7 +66,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; web::TestWebState web_state_; base::CancelableTaskTracker tracker_;
diff --git a/ios/chrome/browser/infobars/infobar_badge_tab_helper_unittest.mm b/ios/chrome/browser/infobars/infobar_badge_tab_helper_unittest.mm index 1b72d55..6bcc799 100644 --- a/ios/chrome/browser/infobars/infobar_badge_tab_helper_unittest.mm +++ b/ios/chrome/browser/infobars/infobar_badge_tab_helper_unittest.mm
@@ -195,7 +195,7 @@ return InfoBarManagerImpl::FromWebState(&web_state_); } - base::test::ScopedTaskEnvironment environment_; + base::test::TaskEnvironment environment_; InfobarBadgeTabHelperTestDelegate* infobar_badge_tab_delegate_; std::unique_ptr<ios::ChromeBrowserState> browser_state_; FakeInfobarContainerCoordinator* infobar_container_coordinator_;
diff --git a/ios/chrome/browser/ios_chrome_field_trials.cc b/ios/chrome/browser/ios_chrome_field_trials.cc index 3ba4cd26..d2afe96 100644 --- a/ios/chrome/browser/ios_chrome_field_trials.cc +++ b/ios/chrome/browser/ios_chrome_field_trials.cc
@@ -4,6 +4,18 @@ #include "ios/chrome/browser/ios_chrome_field_trials.h" +#include "base/path_service.h" +#include "components/metrics/persistent_histograms.h" +#include "ios/chrome/browser/chrome_paths.h" + +void IOSChromeFieldTrials::SetupFieldTrials() { + // Persistent histograms must be enabled as soon as possible. + base::FilePath user_data_dir; + if (base::PathService::Get(ios::DIR_USER_DATA, &user_data_dir)) { + InstantiatePersistentHistograms(user_data_dir); + } +} + void IOSChromeFieldTrials::SetupFeatureControllingFieldTrials( bool has_seed, base::FeatureList* feature_list) {
diff --git a/ios/chrome/browser/ios_chrome_field_trials.h b/ios/chrome/browser/ios_chrome_field_trials.h index 68c2b05b..25c35fa 100644 --- a/ios/chrome/browser/ios_chrome_field_trials.h +++ b/ios/chrome/browser/ios_chrome_field_trials.h
@@ -16,7 +16,7 @@ ~IOSChromeFieldTrials() override {} // variations::PlatformFieldTrials: - void SetupFieldTrials() override {} + void SetupFieldTrials() override; void SetupFeatureControllingFieldTrials( bool has_seed, base::FeatureList* feature_list) override;
diff --git a/ios/chrome/browser/json_parser/in_process_json_parser_unittest.cc b/ios/chrome/browser/json_parser/in_process_json_parser_unittest.cc index 5331f846..fa6f80fc 100644 --- a/ios/chrome/browser/json_parser/in_process_json_parser_unittest.cc +++ b/ios/chrome/browser/json_parser/in_process_json_parser_unittest.cc
@@ -11,7 +11,7 @@ #include "testing/gtest/include/gtest/gtest.h" TEST(InProcessJsonParserTest, TestSuccess) { - base::test::ScopedTaskEnvironment environment; + base::test::TaskEnvironment environment; base::RunLoop run_loop; InProcessJsonParser::Parse( @@ -34,7 +34,7 @@ } TEST(InProcessJsonParserTest, TestFailure) { - base::test::ScopedTaskEnvironment environment; + base::test::TaskEnvironment environment; base::RunLoop run_loop; InProcessJsonParser::Parse(
diff --git a/ios/chrome/browser/metrics/BUILD.gn b/ios/chrome/browser/metrics/BUILD.gn index a9dc481..a653b10 100644 --- a/ios/chrome/browser/metrics/BUILD.gn +++ b/ios/chrome/browser/metrics/BUILD.gn
@@ -121,6 +121,7 @@ sources = [ "chrome_browser_state_client_unittest.mm", "ios_chrome_metrics_service_accessor_unittest.cc", + "ios_chrome_metrics_service_client_unittest.mm", "ios_chrome_stability_metrics_provider_unittest.mm", "mobile_session_shutdown_metrics_provider_unittest.mm", "previous_session_info_unittest.mm",
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.h b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.h index 17994e1..cfe55369 100644 --- a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.h +++ b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.h
@@ -15,6 +15,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/threading/thread_checker.h" +#include "components/metrics/file_metrics_provider.h" #include "components/metrics/metrics_log_uploader.h" #include "components/metrics/metrics_service_client.h" #include "components/omnibox/browser/omnibox_event_global_tracker.h" @@ -95,6 +96,10 @@ metrics::EnableMetricsDefault GetMetricsReportingDefaultState() override; + // Determine what to do with a file based on filename. Visible for testing. + static metrics::FileMetricsProvider::FilterAction FilterBrowserMetricsFiles( + const base::FilePath& path); + private: explicit IOSChromeMetricsServiceClient( metrics::MetricsStateManager* state_manager);
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.mm b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.mm index 06afc1a9..618a85b 100644 --- a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.mm +++ b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.mm
@@ -17,6 +17,7 @@ #include "base/files/file_util.h" #include "base/logging.h" #include "base/metrics/histogram_macros.h" +#include "base/metrics/persistent_histogram_allocator.h" #include "base/path_service.h" #include "base/process/process_metrics.h" #include "base/rand_util.h" @@ -33,6 +34,7 @@ #include "components/metrics/metrics_pref_names.h" #include "components/metrics/metrics_reporting_default_state.h" #include "components/metrics/metrics_service.h" +#include "components/metrics/metrics_state_manager.h" #include "components/metrics/net/cellular_logic_helper.h" #include "components/metrics/net/net_metrics_log_uploader.h" #include "components/metrics/net/network_metrics_provider.h" @@ -75,28 +77,49 @@ namespace { +// Maximum amount of local storage for storing persistent histograms. +const int kMaxHistogramStorageKiB = 50 << 10; // 50 MiB + void GetNetworkConnectionTrackerAsync( base::OnceCallback<void(network::NetworkConnectionTracker*)> callback) { std::move(callback).Run( GetApplicationContext()->GetNetworkConnectionTracker()); } -void CleanupBrowserMetricsDataFiles() { +std::unique_ptr<metrics::FileMetricsProvider> CreateFileMetricsProvider( + bool metrics_reporting_enabled) { + // Create an object to monitor files of metrics and include them in reports. + std::unique_ptr<metrics::FileMetricsProvider> file_metrics_provider( + new metrics::FileMetricsProvider( + GetApplicationContext()->GetLocalState())); + base::FilePath user_data_dir; - if (!base::PathService::Get(ios::DIR_USER_DATA, &user_data_dir)) - return; - base::FilePath browser_metrics_upload_dir = - user_data_dir.AppendASCII(kBrowserMetricsName); - if (base::IsDirectoryEmpty(browser_metrics_upload_dir)) - return; - // Delete accumulated metrics files due to http://crbug/992946 - base::PostTask( - FROM_HERE, - {base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT, - base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, - base::BindOnce(base::IgnoreResult(&base::DeleteFile), - std::move(browser_metrics_upload_dir), - /*recursive=*/true)); + if (base::PathService::Get(ios::DIR_USER_DATA, &user_data_dir)) { + base::FilePath browser_metrics_upload_dir = + user_data_dir.AppendASCII(kBrowserMetricsName); + if (metrics_reporting_enabled) { + metrics::FileMetricsProvider::Params browser_metrics_params( + browser_metrics_upload_dir, + metrics::FileMetricsProvider::SOURCE_HISTOGRAMS_ATOMIC_DIR, + metrics::FileMetricsProvider::ASSOCIATE_INTERNAL_PROFILE, + kBrowserMetricsName); + browser_metrics_params.max_dir_kib = kMaxHistogramStorageKiB; + browser_metrics_params.filter = base::BindRepeating( + &IOSChromeMetricsServiceClient::FilterBrowserMetricsFiles); + file_metrics_provider->RegisterSource(browser_metrics_params); + } else { + // When metrics reporting is not enabled, any existing files should be + // deleted in order to preserve user privacy. + base::PostTask(FROM_HERE, + {base::ThreadPool(), base::MayBlock(), + base::TaskPriority::BEST_EFFORT, + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, + base::BindOnce(base::IgnoreResult(&base::DeleteFile), + std::move(browser_metrics_upload_dir), + /*recursive=*/true)); + } + } + return file_metrics_provider; } } // namespace @@ -132,6 +155,7 @@ PrefRegistrySimple* registry) { metrics::MetricsService::RegisterPrefs(registry); metrics::StabilityMetricsHelper::RegisterPrefs(registry); + metrics::FileMetricsProvider::RegisterPrefs(registry, kBrowserMetricsName); metrics::RegisterMetricsReportingStatePrefs(registry); ukm::UkmService::RegisterPrefs(registry); } @@ -239,6 +263,12 @@ std::move(stability_metrics_provider)); } + // NOTE: metrics_state_manager_->IsMetricsReportingEnabled() returns false + // during local testing. To test locally, modify + // MetricsServiceAccessor::IsMetricsReportingEnabled() to return true. + metrics_service_->RegisterMetricsProvider(CreateFileMetricsProvider( + metrics_state_manager_->IsMetricsReportingEnabled())); + metrics_service_->RegisterMetricsProvider( std::make_unique<metrics::ScreenInfoMetricsProvider>()); @@ -266,10 +296,6 @@ metrics_service_->RegisterMetricsProvider( std::make_unique<metrics::DemographicMetricsProvider>( std::make_unique<metrics::ChromeBrowserStateClient>())); - - // TODO(crbug.com/992946): This is an interim fix to stop logging of - // persistent histograms and delete any accumulated metrics files. - CleanupBrowserMetricsDataFiles(); } void IOSChromeMetricsServiceClient::CollectFinalHistograms() { @@ -337,6 +363,23 @@ metrics_service_->OnApplicationNotIdle(); } +// static +metrics::FileMetricsProvider::FilterAction +IOSChromeMetricsServiceClient::FilterBrowserMetricsFiles( + const base::FilePath& path) { + // Do not process the file if it corresponds to the current process id. + base::ProcessId pid; + bool parse_success = base::GlobalHistogramAllocator::ParseFilePath( + path, nullptr, nullptr, &pid); + if (!parse_success) + return metrics::FileMetricsProvider::FILTER_PROCESS_FILE; + if (pid == base::GetCurrentProcId()) + return metrics::FileMetricsProvider::FILTER_ACTIVE_THIS_PID; + // No need to test whether |pid| is a different active process. This isn't + // applicable to iOS because there cannot be two copies of Chrome running. + return metrics::FileMetricsProvider::FILTER_PROCESS_FILE; +} + metrics::EnableMetricsDefault IOSChromeMetricsServiceClient::GetMetricsReportingDefaultState() { return metrics::GetMetricsReportingDefaultState(
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client_unittest.mm b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client_unittest.mm new file mode 100644 index 0000000..97dcac14 --- /dev/null +++ b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client_unittest.mm
@@ -0,0 +1,100 @@ +// Copyright 2019 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/metrics/ios_chrome_metrics_service_client.h" + +#include "base/metrics/persistent_histogram_allocator.h" +#include "components/metrics/client_info.h" +#include "components/metrics/metrics_service.h" +#include "components/metrics/metrics_state_manager.h" +#include "components/metrics/test_enabled_state_provider.h" +#include "components/prefs/testing_pref_service.h" +#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" +#include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h" +#include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager.h" +#include "ios/web/public/test/test_web_thread_bundle.h" +#include "testing/platform_test.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +class IOSChromeMetricsServiceClientTest : public PlatformTest { + public: + IOSChromeMetricsServiceClientTest() + : scoped_browser_state_manager_( + std::make_unique<TestChromeBrowserStateManager>(base::FilePath())), + browser_state_(TestChromeBrowserState::Builder().Build()), + enabled_state_provider_(/*consent=*/false, /*enabled=*/false) {} + + void SetUp() override { + PlatformTest::SetUp(); + metrics::MetricsService::RegisterPrefs(prefs_.registry()); + metrics_state_manager_ = metrics::MetricsStateManager::Create( + &prefs_, &enabled_state_provider_, base::string16(), + base::BindRepeating( + &IOSChromeMetricsServiceClientTest::FakeStoreClientInfoBackup, + base::Unretained(this)), + base::BindRepeating( + &IOSChromeMetricsServiceClientTest::LoadFakeClientInfoBackup, + base::Unretained(this))); + } + + protected: + void FakeStoreClientInfoBackup(const metrics::ClientInfo& client_info) {} + + std::unique_ptr<metrics::ClientInfo> LoadFakeClientInfoBackup() { + return std::make_unique<metrics::ClientInfo>(); + } + + web::TestWebThreadBundle thread_bundle_; + IOSChromeScopedTestingChromeBrowserStateManager scoped_browser_state_manager_; + std::unique_ptr<ios::ChromeBrowserState> browser_state_; + metrics::TestEnabledStateProvider enabled_state_provider_; + TestingPrefServiceSimple prefs_; + std::unique_ptr<metrics::MetricsStateManager> metrics_state_manager_; + + private: + DISALLOW_COPY_AND_ASSIGN(IOSChromeMetricsServiceClientTest); +}; + +namespace { + +TEST_F(IOSChromeMetricsServiceClientTest, FilterFiles) { + base::ProcessId my_pid = base::GetCurrentProcId(); + base::FilePath active_dir(FILE_PATH_LITERAL("foo")); + base::FilePath upload_dir(FILE_PATH_LITERAL("bar")); + base::FilePath upload_path; + base::GlobalHistogramAllocator::ConstructFilePathsForUploadDir( + active_dir, upload_dir, "TestMetrics", &upload_path, nullptr, nullptr); + EXPECT_EQ( + metrics::FileMetricsProvider::FILTER_ACTIVE_THIS_PID, + IOSChromeMetricsServiceClient::FilterBrowserMetricsFiles(upload_path)); + EXPECT_EQ(metrics::FileMetricsProvider::FILTER_PROCESS_FILE, + IOSChromeMetricsServiceClient::FilterBrowserMetricsFiles( + base::GlobalHistogramAllocator::ConstructFilePathForUploadDir( + upload_dir, "Test", base::Time::Now(), (my_pid + 10)))); +} + +} // namespace + +// This is not in anonymous namespace so this test can be a friend class of +// MetricsService for accessing protected ivars. +TEST_F(IOSChromeMetricsServiceClientTest, TestRegisterMetricsServiceProviders) { + // This is the metrics provider added in MetricsService constructor. + // StabilityMetricsProvider, FieldTrialsProvider and + // MetricsStateMetricsProvider. + size_t expected_providers = 3; + + // This is the number of metrics providers that are registered inside + // IOSChromeMetricsServiceClient::Initialize(). + expected_providers += 12; + + std::unique_ptr<IOSChromeMetricsServiceClient> chrome_metrics_service_client = + IOSChromeMetricsServiceClient::Create(metrics_state_manager_.get()); + EXPECT_EQ(expected_providers, + chrome_metrics_service_client->GetMetricsService() + ->delegating_provider_.GetProviders() + .size()); +}
diff --git a/ios/chrome/browser/metrics/tab_usage_recorder_unittest.mm b/ios/chrome/browser/metrics/tab_usage_recorder_unittest.mm index 3b8f531..d8a5a2c1 100644 --- a/ios/chrome/browser/metrics/tab_usage_recorder_unittest.mm +++ b/ios/chrome/browser/metrics/tab_usage_recorder_unittest.mm
@@ -89,7 +89,7 @@ tab_usage_recorder_.termination_timestamps_.push_back(time); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; FakeWebStateListDelegate web_state_list_delegate_; WebStateList web_state_list_; base::HistogramTester histogram_tester_;
diff --git a/ios/chrome/browser/net/ios_chrome_network_delegate.cc b/ios/chrome/browser/net/ios_chrome_network_delegate.cc index 46dcec9..27961ce 100644 --- a/ios/chrome/browser/net/ios_chrome_network_delegate.cc +++ b/ios/chrome/browser/net/ios_chrome_network_delegate.cc
@@ -124,12 +124,14 @@ bool IOSChromeNetworkDelegate::OnForcePrivacyMode( const GURL& url, - const GURL& site_for_cookies) const { + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const { // Null during tests, or when we're running in the system context. if (!cookie_settings_.get()) return false; - return !cookie_settings_->IsCookieAccessAllowed(url, site_for_cookies); + return !cookie_settings_->IsCookieAccessAllowed(url, site_for_cookies, + top_frame_origin); } bool IOSChromeNetworkDelegate::
diff --git a/ios/chrome/browser/net/ios_chrome_network_delegate.h b/ios/chrome/browser/net/ios_chrome_network_delegate.h index 1cf028e..90632ea 100644 --- a/ios/chrome/browser/net/ios_chrome_network_delegate.h +++ b/ios/chrome/browser/net/ios_chrome_network_delegate.h
@@ -63,8 +63,10 @@ bool OnCanAccessFile(const net::URLRequest& request, const base::FilePath& original_path, const base::FilePath& absolute_path) const override; - bool OnForcePrivacyMode(const GURL& url, - const GURL& site_for_cookies) const override; + bool OnForcePrivacyMode( + const GURL& url, + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const override; bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( const net::URLRequest& request, const GURL& target_url,
diff --git a/ios/chrome/browser/net/retryable_url_fetcher_unittest.mm b/ios/chrome/browser/net/retryable_url_fetcher_unittest.mm index 54c1e91..3f1b3eb 100644 --- a/ios/chrome/browser/net/retryable_url_fetcher_unittest.mm +++ b/ios/chrome/browser/net/retryable_url_fetcher_unittest.mm
@@ -79,7 +79,7 @@ test_delegate_ = [[TestRetryableURLFetcherDelegate alloc] init]; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_url_loader_factory_; @@ -98,7 +98,7 @@ url, base::SysNSStringToUTF8(kFakeResponseString), net::HTTP_OK); [retryableFetcher startFetch]; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, [test_delegate_ responsesProcessed]); } @@ -114,7 +114,7 @@ test_url_loader_factory_.AddResponse(url, "", net::HTTP_NOT_FOUND); [retryableFetcher startFetch]; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0U, [test_delegate_ responsesProcessed]); } @@ -132,7 +132,7 @@ [failing_delegate setResponsesProcessed:0U]; [retryableFetcher startFetch]; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Verify that a response has been received, even if the failing delegate // received a nil in processSuccessResponse to indicate the failure.
diff --git a/ios/chrome/browser/passwords/BUILD.gn b/ios/chrome/browser/passwords/BUILD.gn index 343e71d..a6974e8 100644 --- a/ios/chrome/browser/passwords/BUILD.gn +++ b/ios/chrome/browser/passwords/BUILD.gn
@@ -187,7 +187,7 @@ "//ios/chrome/browser/browser_state:test_support", "//ios/chrome/browser/passwords/test", "//ios/chrome/browser/ssl", - "//ios/chrome/browser/ui/autofill:autofill", + "//ios/chrome/browser/ui/autofill/form_input_accessory", "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/web:test_support", "//ios/chrome/browser/web:web_internal",
diff --git a/ios/chrome/browser/passwords/password_controller_unittest.mm b/ios/chrome/browser/passwords/password_controller_unittest.mm index 4c99462..79c1c54 100644 --- a/ios/chrome/browser/passwords/password_controller_unittest.mm +++ b/ios/chrome/browser/passwords/password_controller_unittest.mm
@@ -35,7 +35,7 @@ #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #import "ios/chrome/browser/passwords/password_form_filler.h" #include "ios/chrome/browser/passwords/password_manager_features.h" -#import "ios/chrome/browser/ui/autofill/form_input_accessory_mediator.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.h" #include "ios/chrome/browser/web/chrome_web_client.h" #import "ios/chrome/browser/web/chrome_web_test.h" #include "ios/web/public/js_messaging/web_frame.h" @@ -1128,7 +1128,7 @@ // The test case below does not need the heavy fixture from above, but it // needs to use MockWebState. TEST_F(PasswordControllerTestSimple, SaveOnNonHTMLLandingPage) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestChromeBrowserState::Builder builder; std::unique_ptr<TestChromeBrowserState> browser_state(builder.Build()); MockWebState web_state;
diff --git a/ios/chrome/browser/payments/ios_payment_instrument_finder_unittest.mm b/ios/chrome/browser/payments/ios_payment_instrument_finder_unittest.mm index 36905ede..5fa4dc82 100644 --- a/ios/chrome/browser/payments/ios_payment_instrument_finder_unittest.mm +++ b/ios/chrome/browser/payments/ios_payment_instrument_finder_unittest.mm
@@ -40,8 +40,7 @@ class PaymentRequestIOSPaymentInstrumentFinderTest : public PlatformTest { public: PaymentRequestIOSPaymentInstrumentFinderTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), shared_factory_( base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( &test_url_loader_factory_)), @@ -156,7 +155,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> shared_factory_;
diff --git a/ios/chrome/browser/payments/ios_payment_instrument_launcher_unittest.mm b/ios/chrome/browser/payments/ios_payment_instrument_launcher_unittest.mm index d343ea6..def5302 100644 --- a/ios/chrome/browser/payments/ios_payment_instrument_launcher_unittest.mm +++ b/ios/chrome/browser/payments/ios_payment_instrument_launcher_unittest.mm
@@ -91,7 +91,7 @@ launcher.payment_request_id_ = "some-payment-request-id"; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; autofill::TestPersonalDataManager test_personal_data_manager_; web::TestWebState web_state_;
diff --git a/ios/chrome/browser/payments/payment_request_unittest.mm b/ios/chrome/browser/payments/payment_request_unittest.mm index 61fe4aa..60080dd 100644 --- a/ios/chrome/browser/payments/payment_request_unittest.mm +++ b/ios/chrome/browser/payments/payment_request_unittest.mm
@@ -103,7 +103,7 @@ return options; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; autofill::TestPersonalDataManager test_personal_data_manager_; web::TestWebState web_state_;
diff --git a/ios/chrome/browser/payments/payment_response_helper_unittest.mm b/ios/chrome/browser/payments/payment_response_helper_unittest.mm index 8cd7f317a..a058d69d 100644 --- a/ios/chrome/browser/payments/payment_response_helper_unittest.mm +++ b/ios/chrome/browser/payments/payment_response_helper_unittest.mm
@@ -94,7 +94,7 @@ TestPaymentRequest* payment_request() { return payment_request_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_evironment_; + base::test::TaskEnvironment scoped_task_evironment_; autofill::AutofillProfile profile_; autofill::CreditCard credit_card_;
diff --git a/ios/chrome/browser/reading_list/url_downloader_unittest.mm b/ios/chrome/browser/reading_list/url_downloader_unittest.mm index 42e66bcd..13fbea9f 100644 --- a/ios/chrome/browser/reading_list/url_downloader_unittest.mm +++ b/ios/chrome/browser/reading_list/url_downloader_unittest.mm
@@ -165,7 +165,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::WeakWrapperSharedURLLoaderFactory>
diff --git a/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util_unittest.mm b/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util_unittest.mm index 54182dc9..1b4e6206 100644 --- a/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util_unittest.mm +++ b/ios/chrome/browser/send_tab_to_self/send_tab_to_self_util_unittest.mm
@@ -66,7 +66,7 @@ protected: base::test::ScopedFeatureList scoped_feature_list_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: std::unique_ptr<ios::ChromeBrowserState> browser_state_; @@ -82,7 +82,7 @@ } TEST_F(SendTabToSelfUtilTest, AreFlagsEnabled) { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); scoped_feature_list_.InitWithFeatures( {switches::kSyncSendTabToSelf, kSendTabToSelfShowSendingUI}, {}); @@ -91,7 +91,7 @@ } TEST_F(SendTabToSelfUtilTest, AreFlagsDisabled) { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); scoped_feature_list_.InitWithFeatures( {}, {switches::kSyncSendTabToSelf, kSendTabToSelfShowSendingUI}); @@ -100,7 +100,7 @@ } TEST_F(SendTabToSelfUtilTest, IsReceivingEnabled) { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); scoped_feature_list_.InitWithFeatures({switches::kSyncSendTabToSelf}, {kSendTabToSelfShowSendingUI}); @@ -109,7 +109,7 @@ } TEST_F(SendTabToSelfUtilTest, IsOnlySendingEnabled) { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); scoped_feature_list_.InitWithFeatures({kSendTabToSelfShowSendingUI}, {switches::kSyncSendTabToSelf});
diff --git a/ios/chrome/browser/sessions/session_service_ios_unittest.mm b/ios/chrome/browser/sessions/session_service_ios_unittest.mm index 99a51de..0212ee9 100644 --- a/ios/chrome/browser/sessions/session_service_ios_unittest.mm +++ b/ios/chrome/browser/sessions/session_service_ios_unittest.mm
@@ -96,7 +96,7 @@ private: base::ScopedTempDir scoped_temp_directory_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; SessionServiceIOS* session_service_; NSString* directory_;
diff --git a/ios/chrome/browser/ui/activity_services/chrome_activity_item_thumbnail_generator_unittest.mm b/ios/chrome/browser/ui/activity_services/chrome_activity_item_thumbnail_generator_unittest.mm index 6289d8e..ccff551b2 100644 --- a/ios/chrome/browser/ui/activity_services/chrome_activity_item_thumbnail_generator_unittest.mm +++ b/ios/chrome/browser/ui/activity_services/chrome_activity_item_thumbnail_generator_unittest.mm
@@ -39,7 +39,7 @@ } FakeSnapshotGeneratorDelegate* delegate_ = nil; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; web::TestWebState test_web_state_; };
diff --git a/ios/chrome/browser/ui/autofill/BUILD.gn b/ios/chrome/browser/ui/autofill/BUILD.gn index 40a36d8..f1722e0 100644 --- a/ios/chrome/browser/ui/autofill/BUILD.gn +++ b/ios/chrome/browser/ui/autofill/BUILD.gn
@@ -9,10 +9,6 @@ "autofill_ui_type_util.mm", "chrome_autofill_client_ios.h", "chrome_autofill_client_ios.mm", - "form_input_accessory_coordinator.h", - "form_input_accessory_coordinator.mm", - "form_input_accessory_mediator.h", - "form_input_accessory_mediator.mm", ] deps = [ ":autofill_ui", @@ -46,6 +42,7 @@ "//ios/chrome/browser/sync", "//ios/chrome/browser/translate:translate", "//ios/chrome/browser/ui/autofill/cells", + "//ios/chrome/browser/ui/autofill/form_input_accessory", "//ios/chrome/browser/ui/autofill/manual_fill:manual_fill", "//ios/chrome/browser/ui/autofill/manual_fill:manual_fill_ui", "//ios/chrome/browser/ui/collection_view/cells",
diff --git a/ios/chrome/browser/ui/autofill/form_input_accessory/BUILD.gn b/ios/chrome/browser/ui/autofill/form_input_accessory/BUILD.gn new file mode 100644 index 0000000..ee08ee20 --- /dev/null +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/BUILD.gn
@@ -0,0 +1,46 @@ +# Copyright 2016 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("form_input_accessory") { + configs += [ "//build/config/compiler:enable_arc" ] + sources = [ + "form_input_accessory_consumer.h", + "form_input_accessory_coordinator.h", + "form_input_accessory_coordinator.mm", + "form_input_accessory_mediator.h", + "form_input_accessory_mediator.mm", + "form_input_accessory_view.h", + "form_input_accessory_view.mm", + "form_input_accessory_view_controller.h", + "form_input_accessory_view_controller.mm", + ] + deps = [ + "//base", + "//components/autofill/core/browser", + "//components/autofill/ios/browser", + "//components/autofill/ios/form_util", + "//components/keyed_service/core", + "//components/password_manager/core/browser", + "//ios/chrome/app/strings:ios_strings_grit", + "//ios/chrome/browser/autofill:autofill", + "//ios/chrome/browser/autofill:autofill_shared", + "//ios/chrome/browser/autofill/manual_fill", + "//ios/chrome/browser/browser_state", + "//ios/chrome/browser/passwords", + "//ios/chrome/browser/ui/autofill/manual_fill", + "//ios/chrome/browser/ui/autofill/manual_fill:manual_fill_ui", + "//ios/chrome/browser/ui/coordinators:chrome_coordinators", + "//ios/chrome/browser/ui/image_util", + "//ios/chrome/browser/ui/util", + "//ios/chrome/browser/web_state_list", + "//ios/chrome/common/colors", + "//ios/chrome/common/ui_util", + "//ios/web/common", + "//ios/web/public", + "//ios/web/public/deprecated", + "//ios/web/public/js_messaging", + "//ui/base", + ] + libs = [ "UIKit.framework" ] +}
diff --git a/ios/chrome/browser/ui/autofill/form_input_accessory/OWNERS b/ios/chrome/browser/ui/autofill/form_input_accessory/OWNERS new file mode 100644 index 0000000..939814b --- /dev/null +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/OWNERS
@@ -0,0 +1,5 @@ +javierrobles@chromium.org +olivierrobin@chromium.org + +# TEAM: ios-directory-owners@chromium.org +# OS: iOS
diff --git a/ios/chrome/browser/autofill/form_input_accessory_consumer.h b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_consumer.h similarity index 86% rename from ios/chrome/browser/autofill/form_input_accessory_consumer.h rename to ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_consumer.h index 230484cd..87913ea 100644 --- a/ios/chrome/browser/autofill/form_input_accessory_consumer.h +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_consumer.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_AUTOFILL_FORM_INPUT_ACCESSORY_CONSUMER_H_ -#define IOS_CHROME_BROWSER_AUTOFILL_FORM_INPUT_ACCESSORY_CONSUMER_H_ +#ifndef IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_CONSUMER_H_ +#define IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_CONSUMER_H_ #import <Foundation/Foundation.h> @@ -13,7 +13,7 @@ @protocol FormInputAccessoryViewDelegate; @protocol FormSuggestionClient; -@protocol FormInputAccessoryConsumer<NSObject> +@protocol FormInputAccessoryConsumer <NSObject> // Delegate used for form navigation. @property(nonatomic, weak) id<FormInputAccessoryViewDelegate> @@ -63,4 +63,4 @@ @end -#endif // IOS_CHROME_BROWSER_AUTOFILL_FORM_INPUT_ACCESSORY_CONSUMER_H_ +#endif // IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_CONSUMER_H_
diff --git a/ios/chrome/browser/ui/autofill/form_input_accessory_coordinator.h b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_coordinator.h similarity index 81% rename from ios/chrome/browser/ui/autofill/form_input_accessory_coordinator.h rename to ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_coordinator.h index 39374fc..146f2a2 100644 --- a/ios/chrome/browser/ui/autofill/form_input_accessory_coordinator.h +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_coordinator.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_AUTOFILL_FORM_INPUT_ACCESSORY_COORDINATOR_H_ -#define IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_COORDINATOR_H_ +#ifndef IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_COORDINATOR_H_ +#define IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_COORDINATOR_H_ #import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h" @@ -12,7 +12,7 @@ class WebStateList; // Delegate for the coordinator actions. -@protocol FormInputAccessoryCoordinatorDelegate<NSObject> +@protocol FormInputAccessoryCoordinatorDelegate <NSObject> // Opens the passwords settings. - (void)openPasswordSettings; @@ -48,4 +48,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_COORDINATOR_H_ +#endif // IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_COORDINATOR_H_
diff --git a/ios/chrome/browser/ui/autofill/form_input_accessory_coordinator.mm b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_coordinator.mm similarity index 96% rename from ios/chrome/browser/ui/autofill/form_input_accessory_coordinator.mm rename to ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_coordinator.mm index 0e2a5d1..7e406cc 100644 --- a/ios/chrome/browser/ui/autofill/form_input_accessory_coordinator.mm +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_coordinator.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/autofill/form_input_accessory_coordinator.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_coordinator.h" #include <vector> @@ -12,11 +12,11 @@ #include "components/autofill/core/common/autofill_features.h" #import "components/autofill/ios/browser/js_suggestion_manager.h" #include "components/keyed_service/core/service_access_type.h" -#import "ios/chrome/browser/autofill/form_input_accessory_view_controller.h" #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" -#import "ios/chrome/browser/ui/autofill/form_input_accessory_mediator.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view_controller.h" #import "ios/chrome/browser/ui/autofill/manual_fill/address_coordinator.h" #import "ios/chrome/browser/ui/autofill/manual_fill/card_coordinator.h" #import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_accessory_view_controller.h"
diff --git a/ios/chrome/browser/ui/autofill/form_input_accessory_mediator.h b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.h similarity index 90% rename from ios/chrome/browser/ui/autofill/form_input_accessory_mediator.h rename to ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.h index 5ae423e..259468c 100644 --- a/ios/chrome/browser/ui/autofill/form_input_accessory_mediator.h +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.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_AUTOFILL_FORM_INPUT_ACCESSORY_MEDIATOR_H_ -#define IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_MEDIATOR_H_ +#ifndef IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_MEDIATOR_H_ +#define IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_MEDIATOR_H_ #import <Foundation/Foundation.h> @@ -82,4 +82,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_MEDIATOR_H_ +#endif // IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_MEDIATOR_H_
diff --git a/ios/chrome/browser/ui/autofill/form_input_accessory_mediator.mm b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.mm similarity index 97% rename from ios/chrome/browser/ui/autofill/form_input_accessory_mediator.mm rename to ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.mm index d9ae075..36d162e 100644 --- a/ios/chrome/browser/ui/autofill/form_input_accessory_mediator.mm +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.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/autofill/form_input_accessory_mediator.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.h" #include "base/ios/block_types.h" #include "base/mac/foundation_util.h" @@ -14,14 +14,14 @@ #import "components/autofill/ios/browser/personal_data_manager_observer_bridge.h" #import "components/autofill/ios/form_util/form_activity_observer_bridge.h" #include "components/autofill/ios/form_util/form_activity_params.h" -#import "ios/chrome/browser/autofill/form_input_accessory_consumer.h" -#import "ios/chrome/browser/autofill/form_input_accessory_view.h" #import "ios/chrome/browser/autofill/form_input_accessory_view_handler.h" #import "ios/chrome/browser/autofill/form_input_suggestions_provider.h" #import "ios/chrome/browser/autofill/form_suggestion_tab_helper.h" #import "ios/chrome/browser/autofill/form_suggestion_view.h" #import "ios/chrome/browser/autofill/manual_fill/passwords_fetcher.h" #import "ios/chrome/browser/passwords/password_generation_utils.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_consumer.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view.h" #import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h" #import "ios/chrome/browser/ui/util/keyboard_observer_helper.h" #include "ios/chrome/browser/ui/util/ui_util.h" @@ -425,8 +425,8 @@ } // Updates the accessory mediator with the passed web state, its JS suggestion -// manager and the registered provider. If NULL is passed it will instead clear -// those properties in the mediator. +// manager and the registered provider. If nullptr is passed it will instead +// clear those properties in the mediator. - (void)updateWithNewWebState:(web::WebState*)webState { [self detachFromWebState]; if (webState) { @@ -449,7 +449,7 @@ } _formInputAccessoryHandler.JSSuggestionManager = self.JSSuggestionManager; } else { - self.webState = NULL; + self.webState = nullptr; self.JSSuggestionManager = nil; self.provider = nil; }
diff --git a/ios/chrome/browser/autofill/form_input_accessory_view.h b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view.h similarity index 82% rename from ios/chrome/browser/autofill/form_input_accessory_view.h rename to ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view.h index 0715466..88849197 100644 --- a/ios/chrome/browser/autofill/form_input_accessory_view.h +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_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_AUTOFILL_FORM_INPUT_ACCESSORY_VIEW_H_ -#define IOS_CHROME_BROWSER_AUTOFILL_FORM_INPUT_ACCESSORY_VIEW_H_ +#ifndef IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_VIEW_H_ +#define IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_VIEW_H_ #import <UIKit/UIKit.h> @@ -20,7 +20,7 @@ // Subview of the accessory view for web forms. Shows a custom view with form // navigation controls above the keyboard. Enables input clicks by way of the // playInputClick method. -@interface FormInputAccessoryView : UIView<UIInputViewAudioFeedback> +@interface FormInputAccessoryView : UIView <UIInputViewAudioFeedback> // The previous button if the view was set up with a navigation delegate. Nil // otherwise. @@ -45,4 +45,4 @@ @end -#endif // IOS_CHROME_BROWSER_AUTOFILL_FORM_INPUT_ACCESSORY_VIEW_H_ +#endif // IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_VIEW_H_
diff --git a/ios/chrome/browser/autofill/form_input_accessory_view.mm b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view.mm similarity index 61% rename from ios/chrome/browser/autofill/form_input_accessory_view.mm rename to ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view.mm index 1cb6fd5c..3b00d61 100644 --- a/ios/chrome/browser/autofill/form_input_accessory_view.mm +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view.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/autofill/form_input_accessory_view.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view.h" #import <QuartzCore/QuartzCore.h> @@ -175,44 +175,43 @@ if (base::i18n::IsRTL()) { gradientView.transform = CGAffineTransformMakeRotation(M_PI); } - [self insertSubview:gradientView belowSubview:trailingView]; + [self insertSubview:gradientView belowSubview:trailingView]; - UIView* topGrayLine = [[UIView alloc] init]; - topGrayLine.backgroundColor = UIColor.cr_systemGray2Color; - topGrayLine.translatesAutoresizingMaskIntoConstraints = NO; - [self addSubview:topGrayLine]; + UIView* topGrayLine = [[UIView alloc] init]; + topGrayLine.backgroundColor = UIColor.cr_systemGray2Color; + topGrayLine.translatesAutoresizingMaskIntoConstraints = NO; + [self addSubview:topGrayLine]; - UIView* bottomGrayLine = [[UIView alloc] init]; - bottomGrayLine.backgroundColor = UIColor.cr_systemGray2Color; - bottomGrayLine.translatesAutoresizingMaskIntoConstraints = NO; - [self addSubview:bottomGrayLine]; + UIView* bottomGrayLine = [[UIView alloc] init]; + bottomGrayLine.backgroundColor = UIColor.cr_systemGray2Color; + bottomGrayLine.translatesAutoresizingMaskIntoConstraints = NO; + [self addSubview:bottomGrayLine]; - [NSLayoutConstraint activateConstraints:@[ - [topGrayLine.topAnchor constraintEqualToAnchor:self.topAnchor], - [topGrayLine.leadingAnchor constraintEqualToAnchor:self.leadingAnchor], - [topGrayLine.trailingAnchor constraintEqualToAnchor:self.trailingAnchor], - [topGrayLine.heightAnchor - constraintEqualToConstant:ManualFillSeparatorHeight], + [NSLayoutConstraint activateConstraints:@[ + [topGrayLine.topAnchor constraintEqualToAnchor:self.topAnchor], + [topGrayLine.leadingAnchor constraintEqualToAnchor:self.leadingAnchor], + [topGrayLine.trailingAnchor constraintEqualToAnchor:self.trailingAnchor], + [topGrayLine.heightAnchor + constraintEqualToConstant:ManualFillSeparatorHeight], - [bottomGrayLine.bottomAnchor constraintEqualToAnchor:self.bottomAnchor], - [bottomGrayLine.leadingAnchor constraintEqualToAnchor:self.leadingAnchor], - [bottomGrayLine.trailingAnchor - constraintEqualToAnchor:self.trailingAnchor], - [bottomGrayLine.heightAnchor - constraintEqualToConstant:ManualFillSeparatorHeight], + [bottomGrayLine.bottomAnchor constraintEqualToAnchor:self.bottomAnchor], + [bottomGrayLine.leadingAnchor constraintEqualToAnchor:self.leadingAnchor], + [bottomGrayLine.trailingAnchor constraintEqualToAnchor:self.trailingAnchor], + [bottomGrayLine.heightAnchor + constraintEqualToConstant:ManualFillSeparatorHeight], - [gradientView.topAnchor constraintEqualToAnchor:trailingView.topAnchor], - [gradientView.bottomAnchor - constraintEqualToAnchor:trailingView.bottomAnchor], - [gradientView.widthAnchor - constraintEqualToConstant:ManualFillGradientWidth], - [gradientView.trailingAnchor - constraintEqualToAnchor:trailingView.leadingAnchor - constant:ManualFillGradientMargin], + [gradientView.topAnchor constraintEqualToAnchor:trailingView.topAnchor], + [gradientView.bottomAnchor + constraintEqualToAnchor:trailingView.bottomAnchor], + [gradientView.widthAnchor + constraintEqualToConstant:ManualFillGradientWidth], + [gradientView.trailingAnchor + constraintEqualToAnchor:trailingView.leadingAnchor + constant:ManualFillGradientMargin], - [leadingViewContainer.trailingAnchor - constraintEqualToAnchor:trailingView.leadingAnchor], - ]]; + [leadingViewContainer.trailingAnchor + constraintEqualToAnchor:trailingView.leadingAnchor], + ]]; } UIImage* ButtonImage(NSString* name) { @@ -222,47 +221,47 @@ // Returns a view that shows navigation buttons. - (UIView*)viewForNavigationButtons { - UIButton* previousButton = [UIButton buttonWithType:UIButtonTypeSystem]; - [previousButton setImage:[UIImage imageNamed:@"mf_arrow_up"] - forState:UIControlStateNormal]; - [previousButton addTarget:self - action:@selector(previousButtonTapped) - forControlEvents:UIControlEventTouchUpInside]; - previousButton.enabled = NO; - NSString* previousButtonAccessibilityLabel = - l10n_util::GetNSString(IDS_IOS_AUTOFILL_ACCNAME_PREVIOUS_FIELD); - [previousButton setAccessibilityLabel:previousButtonAccessibilityLabel]; + UIButton* previousButton = [UIButton buttonWithType:UIButtonTypeSystem]; + [previousButton setImage:[UIImage imageNamed:@"mf_arrow_up"] + forState:UIControlStateNormal]; + [previousButton addTarget:self + action:@selector(previousButtonTapped) + forControlEvents:UIControlEventTouchUpInside]; + previousButton.enabled = NO; + NSString* previousButtonAccessibilityLabel = + l10n_util::GetNSString(IDS_IOS_AUTOFILL_ACCNAME_PREVIOUS_FIELD); + [previousButton setAccessibilityLabel:previousButtonAccessibilityLabel]; - UIButton* nextButton = [UIButton buttonWithType:UIButtonTypeSystem]; - [nextButton setImage:[UIImage imageNamed:@"mf_arrow_down"] - forState:UIControlStateNormal]; - [nextButton addTarget:self - action:@selector(nextButtonTapped) - forControlEvents:UIControlEventTouchUpInside]; - nextButton.enabled = NO; - NSString* nextButtonAccessibilityLabel = - l10n_util::GetNSString(IDS_IOS_AUTOFILL_ACCNAME_NEXT_FIELD); - [nextButton setAccessibilityLabel:nextButtonAccessibilityLabel]; + UIButton* nextButton = [UIButton buttonWithType:UIButtonTypeSystem]; + [nextButton setImage:[UIImage imageNamed:@"mf_arrow_down"] + forState:UIControlStateNormal]; + [nextButton addTarget:self + action:@selector(nextButtonTapped) + forControlEvents:UIControlEventTouchUpInside]; + nextButton.enabled = NO; + NSString* nextButtonAccessibilityLabel = + l10n_util::GetNSString(IDS_IOS_AUTOFILL_ACCNAME_NEXT_FIELD); + [nextButton setAccessibilityLabel:nextButtonAccessibilityLabel]; - UIButton* closeButton = [UIButton buttonWithType:UIButtonTypeSystem]; - NSString* title = l10n_util::GetNSString(IDS_IOS_AUTOFILL_INPUT_BAR_DONE); - [closeButton setTitle:title forState:UIControlStateNormal]; - [closeButton addTarget:self - action:@selector(closeButtonTapped) - forControlEvents:UIControlEventTouchUpInside]; - closeButton.contentEdgeInsets = UIEdgeInsetsMake( - 0, ManualFillCloseButtonLeftInset, 0, ManualFillCloseButtonRightInset); - NSString* closeButtonAccessibilityLabel = - l10n_util::GetNSString(IDS_IOS_AUTOFILL_ACCNAME_HIDE_KEYBOARD); - [closeButton setAccessibilityLabel:closeButtonAccessibilityLabel]; + UIButton* closeButton = [UIButton buttonWithType:UIButtonTypeSystem]; + NSString* title = l10n_util::GetNSString(IDS_IOS_AUTOFILL_INPUT_BAR_DONE); + [closeButton setTitle:title forState:UIControlStateNormal]; + [closeButton addTarget:self + action:@selector(closeButtonTapped) + forControlEvents:UIControlEventTouchUpInside]; + closeButton.contentEdgeInsets = UIEdgeInsetsMake( + 0, ManualFillCloseButtonLeftInset, 0, ManualFillCloseButtonRightInset); + NSString* closeButtonAccessibilityLabel = + l10n_util::GetNSString(IDS_IOS_AUTOFILL_ACCNAME_HIDE_KEYBOARD); + [closeButton setAccessibilityLabel:closeButtonAccessibilityLabel]; - self.nextButton = nextButton; - self.previousButton = previousButton; + self.nextButton = nextButton; + self.previousButton = previousButton; - UIStackView* navigationView = [[UIStackView alloc] - initWithArrangedSubviews:@[ previousButton, nextButton, closeButton ]]; - navigationView.spacing = ManualFillNavigationItemSpacing; - return navigationView; + UIStackView* navigationView = [[UIStackView alloc] + initWithArrangedSubviews:@[ previousButton, nextButton, closeButton ]]; + navigationView.spacing = ManualFillNavigationItemSpacing; + return navigationView; } @end
diff --git a/ios/chrome/browser/autofill/form_input_accessory_view_controller.h b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view_controller.h similarity index 78% rename from ios/chrome/browser/autofill/form_input_accessory_view_controller.h rename to ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view_controller.h index 8d82d8d..172aba8 100644 --- a/ios/chrome/browser/autofill/form_input_accessory_view_controller.h +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view_controller.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_AUTOFILL_FORM_INPUT_ACCESSORY_VIEW_CONTROLLER_H_ -#define IOS_CHROME_BROWSER_AUTOFILL_FORM_INPUT_ACCESSORY_VIEW_CONTROLLER_H_ +#ifndef IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_VIEW_CONTROLLER_H_ +#define IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_VIEW_CONTROLLER_H_ #import <UIKit/UIKit.h> -#import "ios/chrome/browser/autofill/form_input_accessory_consumer.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_consumer.h" namespace autofill { extern CGFloat const kInputAccessoryHeight; @@ -21,7 +21,7 @@ // accessory view elements. Defaults in paused state and needs to be started by // calling |continueCustomKeyboardView|. @interface FormInputAccessoryViewController - : NSObject<FormInputAccessoryConsumer> + : NSObject <FormInputAccessoryConsumer> // Presents a view above the keyboard. - (void)presentView:(UIView*)view; @@ -52,4 +52,4 @@ @end -#endif // IOS_CHROME_BROWSER_AUTOFILL_FORM_INPUT_ACCESSORY_VIEW_CONTROLLER_H_ +#endif // IOS_CHROME_BROWSER_UI_AUTOFILL_FORM_INPUT_ACCESSORY_FORM_INPUT_ACCESSORY_VIEW_CONTROLLER_H_
diff --git a/ios/chrome/browser/autofill/form_input_accessory_view_controller.mm b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view_controller.mm similarity index 97% rename from ios/chrome/browser/autofill/form_input_accessory_view_controller.mm rename to ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view_controller.mm index b265311..657210f 100644 --- a/ios/chrome/browser/autofill/form_input_accessory_view_controller.mm +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view_controller.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/autofill/form_input_accessory_view_controller.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view_controller.h" #include "base/mac/foundation_util.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" #include "components/autofill/core/common/autofill_features.h" -#import "ios/chrome/browser/autofill/form_input_accessory_view.h" #import "ios/chrome/browser/autofill/form_suggestion_view.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_view.h" #import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_accessory_view_controller.h" #include "ios/chrome/browser/ui/util/ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h" @@ -76,8 +76,8 @@ _paused = YES; _manualFillAccessoryViewControllerDelegate = manualFillAccessoryViewControllerDelegate; - _manualFillAccessoryViewController = - [[ManualFillAccessoryViewController alloc] initWithDelegate:self]; + _manualFillAccessoryViewController = + [[ManualFillAccessoryViewController alloc] initWithDelegate:self]; _suggestionsHaveBeenShown = NO; } @@ -111,7 +111,8 @@ view.translatesAutoresizingMaskIntoConstraints = NO; AddSameConstraints(view, constrainingView); self.keyboardReplacementView = view; - UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, view); + UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, + view); } - (void)unlockManualFallbackView {
diff --git a/ios/chrome/browser/ui/autofill/save_card_infobar_controller.mm b/ios/chrome/browser/ui/autofill/save_card_infobar_controller.mm index 50dc1b59..fe165d4 100644 --- a/ios/chrome/browser/ui/autofill/save_card_infobar_controller.mm +++ b/ios/chrome/browser/ui/autofill/save_card_infobar_controller.mm
@@ -61,7 +61,6 @@ @implementation SaveCardInfoBarController @dynamic infoBarDelegate; -@synthesize infoBarView = _infoBarView; - (instancetype)initWithInfoBarDelegate: (autofill::AutofillSaveCardInfoBarDelegateMobile*)infoBarDelegate {
diff --git a/ios/chrome/browser/ui/autofill/save_card_infobar_view.mm b/ios/chrome/browser/ui/autofill/save_card_infobar_view.mm index d464537..a155704b0d 100644 --- a/ios/chrome/browser/ui/autofill/save_card_infobar_view.mm +++ b/ios/chrome/browser/ui/autofill/save_card_infobar_view.mm
@@ -93,11 +93,6 @@ } // namespace @implementation MessageWithLinks - -@synthesize messageText = _messageText; -@synthesize linkRanges = _linkRanges; -@synthesize linkURLs = _linkURLs; - @end @interface SaveCardInfoBarView () @@ -115,61 +110,13 @@ // animation). @property(nonatomic, assign) CGFloat visibleHeight; -// Creates and adds subviews. -- (void)setupSubviews; - -// Returns the view containing the infobar title. No padding is required on the -// view. If |googlePayIcon| is present, returns a view containing the GooglePay -// icon followed by the title laid out horizontally. -- (UIView*)titleView; - -// Returns the view containing the infobar content. No padding is required on -// the view. -- (UIView*)contentView; - -// Creates and returns an instance of LabelLinkController for |label| and -// |action| which is invoked when links managed by it are tapped. -- (LabelLinkController*)labelLinkControllerWithLabel:(UILabel*)label - action:(ProceduralBlockWithURL) - action; - -// Creates and returns an infobar action button initialized with the given -// title, colors, and action. -- (UIButton*)actionButtonWithTitle:(NSString*)title - palette:(MDCPalette*)palette - titleColor:(UIColor*)titleColor - target:(id)target - action:(SEL)action; - -// Handles tapping the close button. -- (void)didTapClose; - -// Handles tapping the cancel button. -- (void)didTapCancel; - -// Handles tapping the confirm button. -- (void)didTapConfirm; - @end @implementation SaveCardInfoBarView -@synthesize visibleHeight = _visibleHeight; -@synthesize delegate = _delegate; -@synthesize icon = _icon; -@synthesize googlePayIcon = _googlePayIcon; -@synthesize message = _message; -@synthesize closeButtonImage = _closeButtonImage; +// Synthesize description because the existing NSObject description property +// is readonly. @synthesize description = _description; -@synthesize cardIssuerIcon = _cardIssuerIcon; -@synthesize cardLabel = _cardLabel; -@synthesize cardSublabel = _cardSublabel; -@synthesize legalMessages = _legalMessages; -@synthesize cancelButtonTitle = _cancelButtonTitle; -@synthesize confirmButtonTitle = _confirmButtonTitle; -@synthesize messageLinkController = _messageLinkController; -@synthesize legalMessageLinkController = _legalMessageLinkController; -@synthesize bottomAnchorConstraint = _bottomAnchorConstraint; #pragma mark - UIView @@ -223,6 +170,7 @@ #pragma mark - Helper methods +// Creates and adds subviews. - (void)setupSubviews { [self setAccessibilityViewIsModal:YES]; self.backgroundColor = UIColorFromRGB(kInfobarBackgroundColor); @@ -414,6 +362,9 @@ } } +// Returns the view containing the infobar title. No padding is required on the +// view. If |googlePayIcon| is present, returns a view containing the GooglePay +// icon followed by the title laid out horizontally. - (UIView*)titleView { UIView* titleView = [[UIView alloc] initWithFrame:CGRectZero]; titleView.accessibilityIdentifier = kTitleViewAccessibilityIdentifier; @@ -510,6 +461,8 @@ return titleView; } +// Returns the view containing the infobar content. No padding is required on +// the view. - (UIView*)contentView { UIStackView* contentView = [[UIStackView alloc] initWithArrangedSubviews:@[]]; contentView.accessibilityIdentifier = kContentViewAccessibilityIdentifier; @@ -632,6 +585,8 @@ return contentView; } +// Creates and returns an instance of LabelLinkController for |label| and +// |action| which is invoked when links managed by it are tapped. - (LabelLinkController*)labelLinkControllerWithLabel:(UILabel*)label action:(ProceduralBlockWithURL) action { @@ -641,6 +596,8 @@ return labelLinkController; } +// Creates and returns an infobar action button initialized with the given +// title, colors, and action. - (UIButton*)actionButtonWithTitle:(NSString*)title palette:(MDCPalette*)palette titleColor:(UIColor*)titleColor @@ -675,14 +632,17 @@ return button; } +// Handles tapping the close button. - (void)didTapClose { [self.delegate saveCardInfoBarViewDidTapClose:self]; } +// Handles tapping the cancel button. - (void)didTapCancel { [self.delegate saveCardInfoBarViewDidTapCancel:self]; } +// Handles tapping the confirm button. - (void)didTapConfirm { [self.delegate saveCardInfoBarViewDidTapConfirm:self]; }
diff --git a/ios/chrome/browser/ui/browser_view/BUILD.gn b/ios/chrome/browser/ui/browser_view/BUILD.gn index cb91338..9c50e87 100644 --- a/ios/chrome/browser/ui/browser_view/BUILD.gn +++ b/ios/chrome/browser/ui/browser_view/BUILD.gn
@@ -79,6 +79,7 @@ "//ios/chrome/browser/ui/app_launcher", "//ios/chrome/browser/ui/authentication", "//ios/chrome/browser/ui/autofill:autofill", + "//ios/chrome/browser/ui/autofill/form_input_accessory", "//ios/chrome/browser/ui/autofill/manual_fill", "//ios/chrome/browser/ui/autofill/manual_fill:manual_fill_ui", "//ios/chrome/browser/ui/bookmarks",
diff --git a/ios/chrome/browser/ui/browser_view/browser_coordinator.mm b/ios/chrome/browser/ui/browser_view/browser_coordinator.mm index 5b063e9..dddbf73 100644 --- a/ios/chrome/browser/ui/browser_view/browser_coordinator.mm +++ b/ios/chrome/browser/ui/browser_view/browser_coordinator.mm
@@ -19,7 +19,7 @@ #import "ios/chrome/browser/tabs/tab_title_util.h" #import "ios/chrome/browser/ui/alert_coordinator/repost_form_coordinator.h" #import "ios/chrome/browser/ui/app_launcher/app_launcher_coordinator.h" -#import "ios/chrome/browser/ui/autofill/form_input_accessory_coordinator.h" +#import "ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_coordinator.h" #import "ios/chrome/browser/ui/browser_container/browser_container_coordinator.h" #import "ios/chrome/browser/ui/browser_view/browser_view_controller+private.h" #import "ios/chrome/browser/ui/browser_view/browser_view_controller.h"
diff --git a/ios/chrome/browser/ui/download/radial_progress_view.mm b/ios/chrome/browser/ui/download/radial_progress_view.mm index ea631be..0d14013 100644 --- a/ios/chrome/browser/ui/download/radial_progress_view.mm +++ b/ios/chrome/browser/ui/download/radial_progress_view.mm
@@ -7,6 +7,7 @@ #import <QuartzCore/QuartzCore.h> #include "base/mac/foundation_util.h" +#import "ios/chrome/common/colors/UIColor+cr_dynamic_colors.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -23,11 +24,6 @@ @end @implementation RadialProgressView - -@synthesize progress = _progress; -@synthesize lineWidth = _lineWidth; -@synthesize progressTintColor = _progressTintColor; -@synthesize trackTintColor = _trackTintColor; @synthesize progressLayer = _progressLayer; #pragma mark - UIView overrides @@ -47,8 +43,10 @@ - (void)willMoveToSuperview:(UIView*)newSuperview { if (newSuperview && !self.progressLayer.superlayer) { - self.trackLayer.fillColor = [UIColor clearColor].CGColor; - self.trackLayer.strokeColor = self.trackTintColor.CGColor; + self.trackLayer.fillColor = UIColor.clearColor.CGColor; + UIColor* resolvedColor = [self.trackTintColor + cr_resolvedColorWithTraitCollection:self.traitCollection]; + self.trackLayer.strokeColor = resolvedColor.CGColor; self.trackLayer.lineWidth = self.lineWidth; [self.trackLayer addSublayer:self.progressLayer]; @@ -56,6 +54,20 @@ } } +- (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { + [super traitCollectionDidChange:previousTraitCollection]; + + if (@available(iOS 13, *)) { + BOOL differentColorAppearance = [self.traitCollection + hasDifferentColorAppearanceComparedToTraitCollection: + previousTraitCollection]; + if (differentColorAppearance) { + self.trackLayer.strokeColor = self.trackTintColor.CGColor; + self.progressLayer.strokeColor = self.progressTintColor.CGColor; + } + } +} + #pragma mark - Public - (void)setProgress:(float)progress { @@ -99,8 +111,10 @@ - (CAShapeLayer*)progressLayer { if (!_progressLayer) { _progressLayer = [CAShapeLayer layer]; - _progressLayer.fillColor = [UIColor clearColor].CGColor; - _progressLayer.strokeColor = self.progressTintColor.CGColor; + _progressLayer.fillColor = UIColor.clearColor.CGColor; + UIColor* resolvedColor = [self.progressTintColor + cr_resolvedColorWithTraitCollection:self.traitCollection]; + _progressLayer.strokeColor = resolvedColor.CGColor; _progressLayer.lineWidth = self.lineWidth; } return _progressLayer;
diff --git a/ios/chrome/browser/ui/history/BUILD.gn b/ios/chrome/browser/ui/history/BUILD.gn index 164ac521..d605620 100644 --- a/ios/chrome/browser/ui/history/BUILD.gn +++ b/ios/chrome/browser/ui/history/BUILD.gn
@@ -113,6 +113,7 @@ "//ios/chrome/browser/ui/settings", "//ios/chrome/browser/ui/settings/clear_browsing_data", "//ios/chrome/browser/ui/table_view", + "//ios/chrome/browser/ui/table_view:feature_flags", "//ios/chrome/browser/ui/table_view:presentation", "//ios/chrome/browser/url_loading", "//ios/web/public", @@ -159,6 +160,7 @@ "//ios/chrome/browser/ui/authentication/cells", "//ios/chrome/browser/ui/popup_menu:constants", "//ios/chrome/browser/ui/settings", + "//ios/chrome/browser/ui/settings/cells", "//ios/chrome/browser/ui/table_view", "//ios/chrome/browser/ui/table_view:feature_flags", "//ios/chrome/browser/ui/table_view/cells",
diff --git a/ios/chrome/browser/ui/history/history_clear_browsing_data_coordinator.mm b/ios/chrome/browser/ui/history/history_clear_browsing_data_coordinator.mm index b16e811..26fe604 100644 --- a/ios/chrome/browser/ui/history/history_clear_browsing_data_coordinator.mm +++ b/ios/chrome/browser/ui/history/history_clear_browsing_data_coordinator.mm
@@ -11,6 +11,7 @@ #import "ios/chrome/browser/ui/history/public/history_presentation_delegate.h" #import "ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_local_commands.h" #import "ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.h" +#import "ios/chrome/browser/ui/table_view/feature_flags.h" #import "ios/chrome/browser/ui/table_view/table_view_navigation_controller.h" #import "ios/chrome/browser/ui/table_view/table_view_presentation_controller.h" #import "ios/chrome/browser/ui/table_view/table_view_presentation_controller_delegate.h" @@ -57,13 +58,30 @@ [[TableViewNavigationController alloc] initWithTable:self.clearBrowsingDataTableViewController]; self.historyClearBrowsingDataNavigationController.toolbarHidden = YES; - // Stacks on top of history "bubble" for non-compact devices. - self.historyClearBrowsingDataNavigationController.transitioningDelegate = - self; - self.historyClearBrowsingDataNavigationController.modalPresentationStyle = - UIModalPresentationCustom; - self.historyClearBrowsingDataNavigationController.modalTransitionStyle = - UIModalTransitionStyleCoverVertical; + + BOOL useCustomPresentation = YES; + if (IsCollectionsCardPresentationStyleEnabled()) { + if (@available(iOS 13, *)) { +#if defined(__IPHONE_13_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0) + [self.historyClearBrowsingDataNavigationController + setModalPresentationStyle:UIModalPresentationFormSheet]; + self.historyClearBrowsingDataNavigationController.presentationController + .delegate = self.clearBrowsingDataTableViewController; + useCustomPresentation = NO; +#endif + } + } + + if (useCustomPresentation) { + // Stacks on top of history "bubble" for non-compact devices. + self.historyClearBrowsingDataNavigationController.transitioningDelegate = + self; + self.historyClearBrowsingDataNavigationController.modalPresentationStyle = + UIModalPresentationCustom; + self.historyClearBrowsingDataNavigationController.modalTransitionStyle = + UIModalTransitionStyleCoverVertical; + } + [self.baseViewController presentViewController:self.historyClearBrowsingDataNavigationController animated:YES
diff --git a/ios/chrome/browser/ui/history/history_ui_egtest.mm b/ios/chrome/browser/ui/history/history_ui_egtest.mm index 835bae6a..502cbb2 100644 --- a/ios/chrome/browser/ui/history/history_ui_egtest.mm +++ b/ios/chrome/browser/ui/history/history_ui_egtest.mm
@@ -19,6 +19,7 @@ #import "ios/chrome/browser/ui/authentication/signin_earlgrey_utils.h" #import "ios/chrome/browser/ui/history/history_ui_constants.h" #import "ios/chrome/browser/ui/popup_menu/popup_menu_constants.h" +#import "ios/chrome/browser/ui/settings/cells/clear_browsing_data_constants.h" #import "ios/chrome/browser/ui/settings/settings_table_view_controller.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_url_item.h" #import "ios/chrome/browser/ui/table_view/feature_flags.h" @@ -336,6 +337,42 @@ [ChromeEarlGreyUI assertHistoryHasNoEntries]; } +// Tests clear browsing history. +- (void)testClearBrowsingHistorySwipeDownDismiss { + if (!base::ios::IsRunningOnOrLater(13, 0, 0)) { + EARL_GREY_TEST_SKIPPED(@"Test disabled on iOS 12 and lower."); + } + if (!IsCollectionsCardPresentationStyleEnabled()) { + EARL_GREY_TEST_SKIPPED(@"Test disabled on when feature flag is off."); + } + + [self loadTestURLs]; + [self openHistoryPanel]; + + // Open Clear Browsing Data + [[EarlGrey selectElementWithMatcher:chrome_test_util:: + HistoryClearBrowsingDataButton()] + performAction:grey_tap()]; + + // Check that the TableView is presented. + [[EarlGrey + selectElementWithMatcher: + grey_accessibilityID(kClearBrowsingDataViewAccessibilityIdentifier)] + assertWithMatcher:grey_notNil()]; + + // Swipe TableView down. + [[EarlGrey + selectElementWithMatcher: + grey_accessibilityID(kClearBrowsingDataViewAccessibilityIdentifier)] + performAction:grey_swipeFastInDirection(kGREYDirectionDown)]; + + // Check that the TableView has been dismissed. + [[EarlGrey + selectElementWithMatcher: + grey_accessibilityID(kClearBrowsingDataViewAccessibilityIdentifier)] + assertWithMatcher:grey_nil()]; +} + // Tests display and selection of 'Open in New Tab' in a context menu on a // history entry. - (void)testContextMenuOpenInNewTab {
diff --git a/ios/chrome/browser/ui/infobars/infobar_container_coordinator_unittest.mm b/ios/chrome/browser/ui/infobars/infobar_container_coordinator_unittest.mm index a951007d..b43a860 100644 --- a/ios/chrome/browser/ui/infobars/infobar_container_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/infobars/infobar_container_coordinator_unittest.mm
@@ -184,7 +184,7 @@ web_state_list_->GetActiveWebState()); } - base::test::ScopedTaskEnvironment environment_; + base::test::TaskEnvironment environment_; std::unique_ptr<ios::ChromeBrowserState> browser_state_; InfobarContainerCoordinator* infobar_container_coordinator_; base::test::ScopedFeatureList feature_list_;
diff --git a/ios/chrome/browser/ui/ntp/ntp_tile_saver_unittest.mm b/ios/chrome/browser/ui/ntp/ntp_tile_saver_unittest.mm index a3c75034..d5c00a7 100644 --- a/ios/chrome/browser/ui/ntp/ntp_tile_saver_unittest.mm +++ b/ios/chrome/browser/ui/ntp/ntp_tile_saver_unittest.mm
@@ -160,7 +160,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_evironment_; + base::test::TaskEnvironment scoped_task_evironment_; UIImage* mock_image_; };
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_view_ios_unittest.mm b/ios/chrome/browser/ui/omnibox/omnibox_view_ios_unittest.mm index 8799aef..7392f39 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_view_ios_unittest.mm +++ b/ios/chrome/browser/ui/omnibox/omnibox_view_ios_unittest.mm
@@ -36,7 +36,7 @@ // Mock for the OmniboxTextFieldIOS. id mockOmniboxTextfield_; // Message loop for the main test thread. - base::test::ScopedTaskEnvironment environment_; + base::test::TaskEnvironment environment_; }; TEST_F(OmniboxViewIOSTest, copyAddsTextToPasteboard) {
diff --git a/ios/chrome/browser/ui/open_in/open_in_controller_unittest.mm b/ios/chrome/browser/ui/open_in/open_in_controller_unittest.mm index 09161c0..02468eb 100644 --- a/ios/chrome/browser/ui/open_in/open_in_controller_unittest.mm +++ b/ios/chrome/browser/ui/open_in/open_in_controller_unittest.mm
@@ -73,7 +73,7 @@ pdf_data.length); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_url_loader_factory_; @@ -102,7 +102,7 @@ std::string pdf_str = CreatePdfString(); test_url_loader_factory_.SimulateResponseForPendingRequest( pending_request->request.url.spec(), pdf_str); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); histogram_tester_.ExpectBucketCount(kOpenInDownloadResultHistogram, static_cast<base::HistogramBase::Sample>( OpenInDownloadResult::kSucceeded), @@ -127,7 +127,7 @@ // Only use half the string so the downloaded PDF is corrupted. test_url_loader_factory_.SimulateResponseForPendingRequest( pending_request->request.url.spec(), pdf_str.substr(pdf_str.size() / 2)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); histogram_tester_.ExpectBucketCount( kOpenInDownloadResultHistogram, static_cast<base::HistogramBase::Sample>(OpenInDownloadResult::kFailed),
diff --git a/ios/chrome/browser/ui/qr_scanner/BUILD.gn b/ios/chrome/browser/ui/qr_scanner/BUILD.gn index 15fa2bc..7b838b59 100644 --- a/ios/chrome/browser/ui/qr_scanner/BUILD.gn +++ b/ios/chrome/browser/ui/qr_scanner/BUILD.gn
@@ -7,8 +7,6 @@ sources = [ "camera_controller.h", "camera_controller.mm", - "preview_overlay_view.h", - "preview_overlay_view.mm", "qr_scanner_alerts.h", "qr_scanner_alerts.mm", "qr_scanner_presenting.h", @@ -18,17 +16,14 @@ "qr_scanner_view.mm", "qr_scanner_view_controller.h", "qr_scanner_view_controller.mm", - "video_preview_view.h", - "video_preview_view.mm", ] deps = [ - "resources:qr_scanner_torch_off", - "resources:qr_scanner_torch_on", "//base", "//components/version_info", "//ios/chrome/app/strings", "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/icons", + "//ios/chrome/browser/ui/scanner", "//ios/chrome/browser/ui/util", "//ios/chrome/common:ios_app_bundle_id_prefix_buildflags", "//ios/chrome/common/ui_util",
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.h b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.h index 78877e12c..535cc55 100644 --- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.h +++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.h
@@ -1,72 +1,17 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2019 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_QR_SCANNER_QR_SCANNER_VIEW_H_ #define IOS_CHROME_BROWSER_UI_QR_SCANNER_QR_SCANNER_VIEW_H_ -#import <AVFoundation/AVFoundation.h> -#import <UIKit/UIKit.h> +#import "ios/chrome/browser/ui/scanner/scanner_view.h" -@protocol QRScannerViewDelegate - -// Called when the close button is pressed. -- (void)dismissQRScannerView:(id)sender; -// Called when the torch button is pressed. -- (void)toggleTorch:(id)sender; - -@end - -// The view rendering the QR Scanner UI. The view contains the camera preview, -// a semi-transparent overlay with a transparent viewport, border around the -// viewport, the close and flash controls, and a label instructing the user to -// correctly position the scanned code. -@interface QRScannerView : UIView - -// The delegate which receives button events. -@property(nonatomic, weak) id<QRScannerViewDelegate> delegate; - -- (instancetype)initWithFrame:(CGRect)frame - delegate:(id<QRScannerViewDelegate>)delegate - NS_DESIGNATED_INITIALIZER; - -- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; - -- (instancetype)initWithCoder:(NSCoder*)coder NS_UNAVAILABLE; - -// Returns the displayed preview layer. -- (AVCaptureVideoPreviewLayer*)getPreviewLayer; - -// Returns the viewport size which can be overridden in a subclass. -- (CGSize)viewportSize; - -// Returns scanner caption which can be overridden in a subclass. -- (NSString*)scannerCaption; - -// Sets the state of the torch button to enabled or disabled according to the -// value of |torchIsAvailable|. -- (void)enableTorchButton:(BOOL)torchIsAvailable; - -// Sets the torch button icon to on or off based on the value of |torchIsOn|. -- (void)setTorchButtonTo:(BOOL)torchIsOn; - -// Resets the frame of the preview layer to a CGRect with origin (0, 0) and -// size equal to |size|. -- (void)resetPreviewFrame:(CGSize)size; - -// Rotates the preview layer by |angle|. Used for a transform which prevents the -// preview layer from rotating with the rest of the interface. -- (void)rotatePreviewByAngle:(CGFloat)angle; - -// Rounds the parameters of the preview layer's transform. -- (void)finishPreviewRotation; - -// Returns the rectangle in camera coordinates in which codes should be -// recognized. -- (CGRect)viewportRectOfInterest; - -// Display a flash animation when a result is scanned. -- (void)animateScanningResultWithCompletion:(void (^)(void))completion; +// The view rendering the QR Scanner UI. The view contains the camera +// preview, a semi-transparent overlay with a transparent viewport, border +// around the viewport, the close and flash controls, and a label instructing +// the user to correctly position the QR code or bar code. +@interface QRScannerView : ScannerView @end
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm index c6a530c0..ef5647c7 100644 --- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm +++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm
@@ -1,17 +1,10 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2019 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/qr_scanner/qr_scanner_view.h" -#include "base/logging.h" -#include "base/mac/foundation_util.h" -#include "base/numerics/math_constants.h" -#include "ios/chrome/browser/ui/icons/chrome_icon.h" -#import "ios/chrome/browser/ui/qr_scanner/preview_overlay_view.h" -#import "ios/chrome/browser/ui/qr_scanner/video_preview_view.h" -#include "ios/chrome/browser/ui/util/ui_util.h" -#import "ios/chrome/common/ui_util/constraints_ui_util.h" +#import "ios/chrome/browser/ui/util/ui_util.h" #include "ios/chrome/grit/ios_strings.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util_mac.h" @@ -23,320 +16,21 @@ namespace { // Width and height of the QR scanner viewport. -const CGSize kviewportSizeIPhone = CGSizeMake(250.0, 250.0); -const CGSize kviewportSizeIPad = CGSizeMake(300.0, 300.0); -// Padding of the viewport caption, below the viewport. -const CGFloat kViewportCaptionVerticalPadding = 14.0; -// Padding of the viewport caption from the edges of the superview. -const CGFloat kViewportCaptionHorizontalPadding = 31.0; -// Shadow opacity of the viewport caption. -const CGFloat kViewportCaptionShadowOpacity = 1.0; -// Shadow radius of the viewport caption. -const CGFloat kViewportCaptionShadowRadius = 5.0; +const CGSize kViewportSizeIPhone = CGSizeMake(250, 250); +const CGSize kViewportSizeIPad = CGSizeMake(300, 300); -// Duration of the flash animation played when a code is scanned. -const CGFloat kFlashDuration = 0.5; } // namespace -@interface QRScannerView () { - // A button to toggle the torch. - UIBarButtonItem* _torchButton; - // A view containing the preview layer for camera input. - VideoPreviewView* _previewView; - // A transparent overlay on top of the preview layer. - PreviewOverlayView* _previewOverlay; - // The constraint specifying that the preview overlay should be square. - NSLayoutConstraint* _overlaySquareConstraint; - // The constraint relating the size of the |_previewOverlay| to the width of - // the QRScannerView. - NSLayoutConstraint* _overlayWidthConstraint; - // The constraint relating the size of the |_previewOverlay| to the height of - // te QRScannerView. - NSLayoutConstraint* _overlayHeightConstraint; -} - -@end - @implementation QRScannerView -#pragma mark lifecycle - -- (instancetype)initWithFrame:(CGRect)frame - delegate:(id<QRScannerViewDelegate>)delegate { - self = [super initWithFrame:frame]; - if (!self) { - return nil; - } - DCHECK(delegate); - _delegate = delegate; - [self setupPreviewView]; - [self setupPreviewOverlayView]; - [self addSubviews]; - return self; -} - -#pragma mark UIView - -// TODO(crbug.com/633577): Replace the preview overlay with a UIView which is -// not resized. -- (void)layoutSubviews { - [super layoutSubviews]; - [self setBackgroundColor:[UIColor blackColor]]; - if (CGRectEqualToRect([_previewView bounds], CGRectZero)) { - [_previewView setBounds:self.bounds]; - } - [_previewView setCenter:CGPointMake(CGRectGetMidX(self.bounds), - CGRectGetMidY(self.bounds))]; -} - -#pragma mark public methods - -- (AVCaptureVideoPreviewLayer*)getPreviewLayer { - return [_previewView previewLayer]; -} - -- (void)enableTorchButton:(BOOL)torchIsAvailable { - [_torchButton setEnabled:torchIsAvailable]; - if (!torchIsAvailable) { - [self setTorchButtonTo:NO]; - } -} - -- (void)setTorchButtonTo:(BOOL)torchIsOn { - DCHECK(_torchButton); - UIImage* icon = nil; - NSString* accessibilityValue = nil; - if (torchIsOn) { - icon = [self torchOnIcon]; - accessibilityValue = - l10n_util::GetNSString(IDS_IOS_QR_SCANNER_TORCH_ON_ACCESSIBILITY_VALUE); - } else { - icon = [self torchOffIcon]; - accessibilityValue = l10n_util::GetNSString( - IDS_IOS_QR_SCANNER_TORCH_OFF_ACCESSIBILITY_VALUE); - } - [_torchButton setImage:icon]; - [_torchButton setAccessibilityValue:accessibilityValue]; -} - -- (void)resetPreviewFrame:(CGSize)size { - [_previewView setTransform:CGAffineTransformIdentity]; - [_previewView setFrame:CGRectMake(0, 0, size.width, size.height)]; -} - -- (void)rotatePreviewByAngle:(CGFloat)angle { - [_previewView - setTransform:CGAffineTransformRotate([_previewView transform], angle)]; -} - -- (void)finishPreviewRotation { - CGAffineTransform rotation = [_previewView transform]; - // Check that the current transform is either an identity or a 90, -90, or 180 - // degree rotation. - DCHECK(fabs(atan2f(rotation.b, rotation.a)) < 0.001 || - fabs(fabs(atan2f(rotation.b, rotation.a)) - base::kPiFloat) < 0.001 || - fabs(fabs(atan2f(rotation.b, rotation.a)) - base::kPiFloat / 2) < - 0.001); - rotation.a = round(rotation.a); - rotation.b = round(rotation.b); - rotation.c = round(rotation.c); - rotation.d = round(rotation.d); - [_previewView setTransform:rotation]; -} - -- (CGRect)viewportRectOfInterest { - return [_previewView viewportRectOfInterest]; -} - -- (void)animateScanningResultWithCompletion:(void (^)(void))completion { - UIView* whiteView = [[UIView alloc] init]; - whiteView.frame = self.bounds; - [self addSubview:whiteView]; - whiteView.backgroundColor = [UIColor whiteColor]; - [UIView animateWithDuration:kFlashDuration - animations:^{ - whiteView.alpha = 0.0; - } - completion:^void(BOOL finished) { - [whiteView removeFromSuperview]; - if (completion) { - completion(); - } - }]; -} +#pragma mark - ScannerView - (CGSize)viewportSize { - return IsIPadIdiom() ? kviewportSizeIPad : kviewportSizeIPhone; + return IsIPadIdiom() ? kViewportSizeIPad : kViewportSizeIPhone; } -- (NSString*)scannerCaption { +- (NSString*)caption { return l10n_util::GetNSString(IDS_IOS_QR_SCANNER_VIEWPORT_CAPTION); } -#pragma mark private methods - -// Creates an image with template rendering mode for use in icons. -- (UIImage*)templateImageWithName:(NSString*)name { - UIImage* image = [[UIImage imageNamed:name] - imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; - DCHECK(image); - return image; -} - -// Creates an icon for torch turned on. -- (UIImage*)torchOnIcon { - UIImage* icon = [self templateImageWithName:@"qr_scanner_torch_on"]; - return icon; -} - -// Creates an icon for torch turned off. -- (UIImage*)torchOffIcon { - UIImage* icon = [self templateImageWithName:@"qr_scanner_torch_off"]; - return icon; -} - -// Adds the subviews. -- (void)addSubviews { - UIBarButtonItem* close = - [[UIBarButtonItem alloc] initWithImage:[ChromeIcon closeIcon] - style:UIBarButtonItemStylePlain - target:_delegate - action:@selector(dismissQRScannerView:)]; - close.accessibilityLabel = [[ChromeIcon closeIcon] accessibilityLabel]; - UIBarButtonItem* spacer = [[UIBarButtonItem alloc] - initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace - target:nil - action:nil]; - _torchButton = - [[UIBarButtonItem alloc] initWithImage:[self torchOffIcon] - style:UIBarButtonItemStylePlain - target:_delegate - action:@selector(toggleTorch:)]; - _torchButton.enabled = NO; - _torchButton.accessibilityIdentifier = @"qr_scanner_torch_button"; - _torchButton.accessibilityLabel = l10n_util::GetNSString( - IDS_IOS_QR_SCANNER_TORCH_BUTTON_ACCESSIBILITY_LABEL); - _torchButton.accessibilityValue = - l10n_util::GetNSString(IDS_IOS_QR_SCANNER_TORCH_OFF_ACCESSIBILITY_VALUE); - - UIToolbar* toolbar = [[UIToolbar alloc] init]; - toolbar.items = @[ close, spacer, _torchButton ]; - toolbar.tintColor = UIColor.whiteColor; - [toolbar setBackgroundImage:[[UIImage alloc] init] - forToolbarPosition:UIToolbarPositionAny - barMetrics:UIBarMetricsDefault]; - [toolbar setShadowImage:[[UIImage alloc] init] - forToolbarPosition:UIBarPositionAny]; - - [toolbar setBackgroundColor:[UIColor clearColor]]; - toolbar.translatesAutoresizingMaskIntoConstraints = NO; - [self addSubview:toolbar]; - - AddSameConstraintsToSides(self, toolbar, - LayoutSides::kLeading | LayoutSides::kTrailing); - [toolbar.bottomAnchor - constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor] - .active = YES; - - UILabel* viewportCaption = [[UILabel alloc] init]; - NSString* label = [self scannerCaption]; - [viewportCaption setText:label]; - [viewportCaption - setFont:[UIFont preferredFontForTextStyle:UIFontTextStyleBody]]; - [viewportCaption setAdjustsFontForContentSizeCategory:YES]; - [viewportCaption setNumberOfLines:0]; - [viewportCaption setTextAlignment:NSTextAlignmentCenter]; - [viewportCaption setAccessibilityLabel:label]; - [viewportCaption setAccessibilityIdentifier:@"qr_scanner_viewport_caption"]; - [viewportCaption setTextColor:[UIColor whiteColor]]; - [viewportCaption.layer setShadowColor:[UIColor blackColor].CGColor]; - [viewportCaption.layer setShadowOffset:CGSizeZero]; - [viewportCaption.layer setShadowRadius:kViewportCaptionShadowRadius]; - [viewportCaption.layer setShadowOpacity:kViewportCaptionShadowOpacity]; - [viewportCaption.layer setMasksToBounds:NO]; - [viewportCaption.layer setShouldRasterize:YES]; - - UIScrollView* scrollView = [[UIScrollView alloc] init]; - scrollView.showsVerticalScrollIndicator = NO; - [self addSubview:scrollView]; - [scrollView addSubview:viewportCaption]; - - // Constraints for viewportCaption. - scrollView.translatesAutoresizingMaskIntoConstraints = NO; - viewportCaption.translatesAutoresizingMaskIntoConstraints = NO; - - [NSLayoutConstraint activateConstraints:@[ - [scrollView.topAnchor - constraintEqualToAnchor:self.centerYAnchor - constant:[self viewportSize].height / 2 + - kViewportCaptionVerticalPadding], - [scrollView.bottomAnchor constraintEqualToAnchor:toolbar.topAnchor], - [scrollView.leadingAnchor - constraintEqualToAnchor:self.leadingAnchor - constant:kViewportCaptionHorizontalPadding], - [viewportCaption.leadingAnchor - constraintEqualToAnchor:self.leadingAnchor - constant:kViewportCaptionHorizontalPadding], - [scrollView.trailingAnchor - constraintEqualToAnchor:self.trailingAnchor - constant:-kViewportCaptionHorizontalPadding], - [viewportCaption.trailingAnchor - constraintEqualToAnchor:self.trailingAnchor - constant:-kViewportCaptionHorizontalPadding], - ]]; - AddSameConstraints(scrollView, viewportCaption); -} - -// Adds a preview view to |self| and configures its layout constraints. -- (void)setupPreviewView { - DCHECK(!_previewView); - _previewView = [[VideoPreviewView alloc] initWithFrame:self.frame - viewportSize:[self viewportSize]]; - [self insertSubview:_previewView atIndex:0]; -} - -// Adds a transparent overlay with a viewport border to |self| and configures -// its layout constraints. -- (void)setupPreviewOverlayView { - DCHECK(!_previewOverlay); - _previewOverlay = - [[PreviewOverlayView alloc] initWithFrame:CGRectZero - viewportSize:[self viewportSize]]; - [self addSubview:_previewOverlay]; - - // Add a multiplier of sqrt(2) to the width and height constraints to make - // sure that the overlay covers the whole screen during rotation. - _overlayWidthConstraint = - [NSLayoutConstraint constraintWithItem:_previewOverlay - attribute:NSLayoutAttributeWidth - relatedBy:NSLayoutRelationGreaterThanOrEqual - toItem:self - attribute:NSLayoutAttributeWidth - multiplier:sqrt(2) - constant:0.0]; - - _overlayHeightConstraint = - [NSLayoutConstraint constraintWithItem:_previewOverlay - attribute:NSLayoutAttributeHeight - relatedBy:NSLayoutRelationGreaterThanOrEqual - toItem:self - attribute:NSLayoutAttributeHeight - multiplier:sqrt(2) - constant:0.0]; - - _overlaySquareConstraint = [[_previewOverlay heightAnchor] - constraintEqualToAnchor:[_previewOverlay widthAnchor]]; - - // Constrains the preview overlay to be square, centered, with both width and - // height greater than or equal to the width and height of the QRScannerView. - [_previewOverlay setTranslatesAutoresizingMaskIntoConstraints:NO]; - [NSLayoutConstraint activateConstraints:@[ - [[_previewOverlay centerXAnchor] - constraintEqualToAnchor:[self centerXAnchor]], - [[_previewOverlay centerYAnchor] - constraintEqualToAnchor:[self centerYAnchor]], - _overlaySquareConstraint, _overlayWidthConstraint, _overlayHeightConstraint - ]]; -} - @end
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.h b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.h index 2d9687f..031b9d57 100644 --- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.h +++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.h
@@ -13,10 +13,9 @@ @protocol LoadQueryCommands; @protocol QRScannerPresenting; -// View controller for the QR scanner. Subclass can inherit -// QRScannerViewDelegate. +// View controller for the QR scanner. @interface QRScannerViewController - : UIViewController <CameraControllerDelegate, QRScannerViewDelegate> + : UIViewController <CameraControllerDelegate, ScannerViewDelegate> - (instancetype)initWithPresentationProvider: (id<QRScannerPresenting>)presentationProvider
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.mm b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.mm index 09f0a3b..8fa6bfaa 100644 --- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.mm +++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.mm
@@ -81,7 +81,7 @@ @synthesize queryLoader = _queryLoader; @synthesize presentationProvider = _presentationProvider; -#pragma mark lifecycle +#pragma mark - Lifecycle - (instancetype) initWithPresentationProvider:(id<QRScannerPresenting>)presentationProvider @@ -105,14 +105,14 @@ return nil; } -#pragma mark UIAccessibilityAction +#pragma mark - UIAccessibilityAction - (BOOL)accessibilityPerformEscape { [self dismissForReason:CLOSE_BUTTON withCompletion:nil]; return YES; } -#pragma mark UIViewController +#pragma mark - UIViewController - (void)viewDidLoad { [super viewDidLoad]; @@ -210,7 +210,7 @@ return YES; } -#pragma mark public methods +#pragma mark - Public methods - (UIViewController*)getViewControllerToPresent { DCHECK(_cameraController); @@ -231,7 +231,7 @@ return [[QRScannerView alloc] initWithFrame:self.view.frame delegate:self]; } -#pragma mark private methods +#pragma mark - Private methods - (void)dismissForReason:(DismissalReason)reason withCompletion:(void (^)(void))completion { @@ -276,7 +276,7 @@ [_cameraController setTorchMode:mode]; } -#pragma mark notification handlers +#pragma mark - Notification handlers - (void)handleUIApplicationWillResignActiveNotification { [self setTorchMode:AVCaptureTorchModeOff]; @@ -299,7 +299,7 @@ } } -#pragma mark CameraControllerDelegate +#pragma mark - CameraControllerDelegate - (void)captureSessionIsConnected { [_cameraController setViewport:[_qrScannerView viewportRectOfInterest]]; @@ -367,9 +367,9 @@ } } -#pragma mark QRScannerViewDelegate +#pragma mark - ScannerViewDelegate -- (void)dismissQRScannerView:(id)sender { +- (void)dismissScannerView:(id)sender { [self dismissForReason:CLOSE_BUTTON withCompletion:nil]; }
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm index 5660d97..7ee4088 100644 --- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm +++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm
@@ -80,9 +80,9 @@ // which turns on the torch. id<GREYMatcher> QrScannerTorchOffButton() { return grey_allOf(grey_accessibilityLabel(l10n_util::GetNSString( - IDS_IOS_QR_SCANNER_TORCH_BUTTON_ACCESSIBILITY_LABEL)), + IDS_IOS_SCANNER_TORCH_BUTTON_ACCESSIBILITY_LABEL)), grey_accessibilityValue(l10n_util::GetNSString( - IDS_IOS_QR_SCANNER_TORCH_OFF_ACCESSIBILITY_VALUE)), + IDS_IOS_SCANNER_TORCH_OFF_ACCESSIBILITY_VALUE)), grey_accessibilityTrait(UIAccessibilityTraitButton), nil); } @@ -90,9 +90,9 @@ // which turns off the torch. id<GREYMatcher> QrScannerTorchOnButton() { return grey_allOf(grey_accessibilityLabel(l10n_util::GetNSString( - IDS_IOS_QR_SCANNER_TORCH_BUTTON_ACCESSIBILITY_LABEL)), + IDS_IOS_SCANNER_TORCH_BUTTON_ACCESSIBILITY_LABEL)), grey_accessibilityValue(l10n_util::GetNSString( - IDS_IOS_QR_SCANNER_TORCH_ON_ACCESSIBILITY_VALUE)), + IDS_IOS_SCANNER_TORCH_ON_ACCESSIBILITY_VALUE)), grey_accessibilityTrait(UIAccessibilityTraitButton), nil); }
diff --git a/ios/chrome/browser/ui/qr_scanner/resources/BUILD.gn b/ios/chrome/browser/ui/qr_scanner/resources/BUILD.gn deleted file mode 100644 index dfc5699..0000000 --- a/ios/chrome/browser/ui/qr_scanner/resources/BUILD.gn +++ /dev/null
@@ -1,23 +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. - -import("//build/config/ios/asset_catalog.gni") - -imageset("qr_scanner_torch_off") { - sources = [ - "qr_scanner_torch_off.imageset/Contents.json", - "qr_scanner_torch_off.imageset/torch_off.png", - "qr_scanner_torch_off.imageset/torch_off@2x.png", - "qr_scanner_torch_off.imageset/torch_off@3x.png", - ] -} - -imageset("qr_scanner_torch_on") { - sources = [ - "qr_scanner_torch_on.imageset/Contents.json", - "qr_scanner_torch_on.imageset/torch_on.png", - "qr_scanner_torch_on.imageset/torch_on@2x.png", - "qr_scanner_torch_on.imageset/torch_on@3x.png", - ] -}
diff --git a/ios/chrome/browser/ui/recent_tabs/resources/BUILD.gn b/ios/chrome/browser/ui/recent_tabs/resources/BUILD.gn index e8e0a08f..b6129aa 100644 --- a/ios/chrome/browser/ui/recent_tabs/resources/BUILD.gn +++ b/ios/chrome/browser/ui/recent_tabs/resources/BUILD.gn
@@ -7,8 +7,9 @@ imageset("show_history") { sources = [ "show_history.imageset/Contents.json", - "show_history.imageset/show_history.png", "show_history.imageset/show_history@2x.png", "show_history.imageset/show_history@3x.png", + "show_history.imageset/show_history_dark@2x.png", + "show_history.imageset/show_history_dark@3x.png", ] }
diff --git a/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/Contents.json b/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/Contents.json index 1db3e25..fb5179eb 100644 --- a/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/Contents.json +++ b/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/Contents.json
@@ -1,23 +1,54 @@ { - "images": [ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "1x", + "appearances" : [ { - "idiom": "universal", - "scale": "1x", - "filename": "show_history.png" - }, - { - "idiom": "universal", - "scale": "2x", - "filename": "show_history@2x.png" - }, - { - "idiom": "universal", - "scale": "3x", - "filename": "show_history@3x.png" + "appearance" : "luminosity", + "value" : "dark" } - ], - "info": { - "version": 1, - "author": "xcode" + ] + }, + { + "idiom" : "universal", + "filename" : "show_history@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "show_history_dark@2x.png", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "show_history@3x.png", + "scale" : "3x" + }, + { + "idiom" : "universal", + "filename" : "show_history_dark@3x.png", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "scale" : "3x" } -} + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file
diff --git a/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history.png b/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history.png deleted file mode 100644 index 915840e7..0000000 --- a/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history.png +++ /dev/null Binary files differ
diff --git a/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history@2x.png b/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history@2x.png index 8830c1d..6a9c7512 100644 --- a/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history@2x.png +++ b/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history@3x.png b/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history@3x.png index 6ea710e..56321616 100644 --- a/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history@3x.png +++ b/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history@3x.png Binary files differ
diff --git a/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history_dark@2x.png b/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history_dark@2x.png new file mode 100644 index 0000000..d6838d5 --- /dev/null +++ b/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history_dark@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history_dark@3x.png b/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history_dark@3x.png new file mode 100644 index 0000000..76c63ed06 --- /dev/null +++ b/ios/chrome/browser/ui/recent_tabs/resources/show_history.imageset/show_history_dark@3x.png Binary files differ
diff --git a/ios/chrome/browser/ui/scanner/BUILD.gn b/ios/chrome/browser/ui/scanner/BUILD.gn new file mode 100644 index 0000000..1607d52d --- /dev/null +++ b/ios/chrome/browser/ui/scanner/BUILD.gn
@@ -0,0 +1,33 @@ +# Copyright 2019 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("scanner") { + configs += [ "//build/config/compiler:enable_arc" ] + sources = [ + "preview_overlay_view.h", + "preview_overlay_view.mm", + "scanner_view.h", + "scanner_view.mm", + "video_preview_view.h", + "video_preview_view.mm", + ] + deps = [ + "resources:scanner_torch_off", + "resources:scanner_torch_on", + "//base", + "//components/version_info", + "//ios/chrome/app/strings", + "//ios/chrome/browser/ui/commands", + "//ios/chrome/browser/ui/icons", + "//ios/chrome/browser/ui/util", + "//ios/chrome/common:ios_app_bundle_id_prefix_buildflags", + "//ios/chrome/common/ui_util", + "//ios/third_party/material_components_ios", + "//ui/base", + ] + libs = [ + "AVFoundation.framework", + "UIKit.framework", + ] +}
diff --git a/ios/chrome/browser/ui/scanner/OWNERS b/ios/chrome/browser/ui/scanner/OWNERS new file mode 100644 index 0000000..14cd11c --- /dev/null +++ b/ios/chrome/browser/ui/scanner/OWNERS
@@ -0,0 +1,5 @@ +gambard@chromium.org +javierrobles@chromium.org + +# TEAM: ios-directory-owners@chromium.org +# OS: iOS \ No newline at end of file
diff --git a/ios/chrome/browser/ui/qr_scanner/preview_overlay_view.h b/ios/chrome/browser/ui/scanner/preview_overlay_view.h similarity index 80% rename from ios/chrome/browser/ui/qr_scanner/preview_overlay_view.h rename to ios/chrome/browser/ui/scanner/preview_overlay_view.h index abb1813ac..195922e 100644 --- a/ios/chrome/browser/ui/qr_scanner/preview_overlay_view.h +++ b/ios/chrome/browser/ui/scanner/preview_overlay_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_QR_SCANNER_PREVIEW_OVERLAY_VIEW_H_ -#define IOS_CHROME_BROWSER_UI_QR_SCANNER_PREVIEW_OVERLAY_VIEW_H_ +#ifndef IOS_CHROME_BROWSER_UI_SCANNER_PREVIEW_OVERLAY_VIEW_H_ +#define IOS_CHROME_BROWSER_UI_SCANNER_PREVIEW_OVERLAY_VIEW_H_ #import <UIKit/UIKit.h> @@ -23,4 +23,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_QR_SCANNER_PREVIEW_OVERLAY_VIEW_H_ +#endif // IOS_CHROME_BROWSER_UI_SCANNER_PREVIEW_OVERLAY_VIEW_H_
diff --git a/ios/chrome/browser/ui/qr_scanner/preview_overlay_view.mm b/ios/chrome/browser/ui/scanner/preview_overlay_view.mm similarity index 98% rename from ios/chrome/browser/ui/qr_scanner/preview_overlay_view.mm rename to ios/chrome/browser/ui/scanner/preview_overlay_view.mm index 8f3acd8..bfad635 100644 --- a/ios/chrome/browser/ui/qr_scanner/preview_overlay_view.mm +++ b/ios/chrome/browser/ui/scanner/preview_overlay_view.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/qr_scanner/preview_overlay_view.h" +#import "ios/chrome/browser/ui/scanner/preview_overlay_view.h" #import <AVFoundation/AVFoundation.h>
diff --git a/ios/chrome/browser/ui/scanner/resources/BUILD.gn b/ios/chrome/browser/ui/scanner/resources/BUILD.gn new file mode 100644 index 0000000..061bc473 --- /dev/null +++ b/ios/chrome/browser/ui/scanner/resources/BUILD.gn
@@ -0,0 +1,23 @@ +# 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. + +import("//build/config/ios/asset_catalog.gni") + +imageset("scanner_torch_off") { + sources = [ + "scanner_torch_off.imageset/Contents.json", + "scanner_torch_off.imageset/torch_off.png", + "scanner_torch_off.imageset/torch_off@2x.png", + "scanner_torch_off.imageset/torch_off@3x.png", + ] +} + +imageset("scanner_torch_on") { + sources = [ + "scanner_torch_on.imageset/Contents.json", + "scanner_torch_on.imageset/torch_on.png", + "scanner_torch_on.imageset/torch_on@2x.png", + "scanner_torch_on.imageset/torch_on@3x.png", + ] +}
diff --git a/ios/chrome/browser/ui/qr_scanner/resources/QRScanner.xcassets/Contents.json b/ios/chrome/browser/ui/scanner/resources/QRScanner.xcassets/Contents.json similarity index 100% rename from ios/chrome/browser/ui/qr_scanner/resources/QRScanner.xcassets/Contents.json rename to ios/chrome/browser/ui/scanner/resources/QRScanner.xcassets/Contents.json
diff --git a/ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_off.imageset/Contents.json b/ios/chrome/browser/ui/scanner/resources/scanner_torch_off.imageset/Contents.json similarity index 100% rename from ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_off.imageset/Contents.json rename to ios/chrome/browser/ui/scanner/resources/scanner_torch_off.imageset/Contents.json
diff --git a/ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_off.imageset/torch_off.png b/ios/chrome/browser/ui/scanner/resources/scanner_torch_off.imageset/torch_off.png similarity index 100% rename from ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_off.imageset/torch_off.png rename to ios/chrome/browser/ui/scanner/resources/scanner_torch_off.imageset/torch_off.png Binary files differ
diff --git a/ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_off.imageset/torch_off@2x.png b/ios/chrome/browser/ui/scanner/resources/scanner_torch_off.imageset/torch_off@2x.png similarity index 100% rename from ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_off.imageset/torch_off@2x.png rename to ios/chrome/browser/ui/scanner/resources/scanner_torch_off.imageset/torch_off@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_off.imageset/torch_off@3x.png b/ios/chrome/browser/ui/scanner/resources/scanner_torch_off.imageset/torch_off@3x.png similarity index 100% rename from ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_off.imageset/torch_off@3x.png rename to ios/chrome/browser/ui/scanner/resources/scanner_torch_off.imageset/torch_off@3x.png Binary files differ
diff --git a/ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_on.imageset/Contents.json b/ios/chrome/browser/ui/scanner/resources/scanner_torch_on.imageset/Contents.json similarity index 100% rename from ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_on.imageset/Contents.json rename to ios/chrome/browser/ui/scanner/resources/scanner_torch_on.imageset/Contents.json
diff --git a/ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_on.imageset/torch_on.png b/ios/chrome/browser/ui/scanner/resources/scanner_torch_on.imageset/torch_on.png similarity index 100% rename from ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_on.imageset/torch_on.png rename to ios/chrome/browser/ui/scanner/resources/scanner_torch_on.imageset/torch_on.png Binary files differ
diff --git a/ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_on.imageset/torch_on@2x.png b/ios/chrome/browser/ui/scanner/resources/scanner_torch_on.imageset/torch_on@2x.png similarity index 100% rename from ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_on.imageset/torch_on@2x.png rename to ios/chrome/browser/ui/scanner/resources/scanner_torch_on.imageset/torch_on@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_on.imageset/torch_on@3x.png b/ios/chrome/browser/ui/scanner/resources/scanner_torch_on.imageset/torch_on@3x.png similarity index 100% rename from ios/chrome/browser/ui/qr_scanner/resources/qr_scanner_torch_on.imageset/torch_on@3x.png rename to ios/chrome/browser/ui/scanner/resources/scanner_torch_on.imageset/torch_on@3x.png Binary files differ
diff --git a/ios/chrome/browser/ui/scanner/scanner_view.h b/ios/chrome/browser/ui/scanner/scanner_view.h new file mode 100644 index 0000000..fca281a4 --- /dev/null +++ b/ios/chrome/browser/ui/scanner/scanner_view.h
@@ -0,0 +1,78 @@ +// Copyright 2019 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_SCANNER_SCANNER_VIEW_H_ +#define IOS_CHROME_BROWSER_UI_SCANNER_SCANNER_VIEW_H_ + +#import <AVFoundation/AVFoundation.h> +#import <UIKit/UIKit.h> + +// Delegate manages the Scanner View. +@protocol ScannerViewDelegate + +// Called when the close button is pressed. +- (void)dismissScannerView:(id)sender; + +// Called when the torch button is pressed. +- (void)toggleTorch:(id)sender; + +@end + +// The view rendering the Scanner UI. The view contains the camera preview, +// a semi-transparent overlay with a transparent viewport, border around the +// viewport, the close and flash controls, and a label instructing the user to +// correctly position the scanned code. +@interface ScannerView : UIView + +// The delegate which receives button events. +@property(nonatomic, weak) id<ScannerViewDelegate> delegate; + +// Returns the viewport size. By default this is the size of the window the +// receiver is in, or CGSizeZero if it is not in a window. +@property(nonatomic, readonly) CGSize viewportSize; + +// Returns the scanner caption. By default this caption returns nil +// and can be overridden in the subclass. +@property(nonatomic, readonly) NSString* caption; + +- (instancetype)initWithFrame:(CGRect)frame + delegate:(id<ScannerViewDelegate>)delegate + NS_DESIGNATED_INITIALIZER; + +- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; + +- (instancetype)initWithCoder:(NSCoder*)coder NS_UNAVAILABLE; + +// Returns the displayed preview layer. +- (AVCaptureVideoPreviewLayer*)getPreviewLayer; + +// Sets the state of the torch button to enabled or disabled according to the +// value of |torchIsAvailable|. +- (void)enableTorchButton:(BOOL)torchIsAvailable; + +// Sets the torch button icon to on or off based on the value of |torchIsOn|. +- (void)setTorchButtonTo:(BOOL)torchIsOn; + +// Resets the frame of the preview layer to a CGRect with origin (0, 0) and +// size equal to |size|. +- (void)resetPreviewFrame:(CGSize)size; + +// Rotates the preview layer by |angle|. Used for a transform which prevents the +// preview layer from rotating with the rest of the interface. +- (void)rotatePreviewByAngle:(CGFloat)angle; + +// Rounds the parameters of the preview layer's transform. +- (void)finishPreviewRotation; + +// Returns the rectangle in camera coordinates in which items should be +// recognized. +- (CGRect)viewportRectOfInterest; + +// Displays a flash animation when a result is scanned. |completion| will be +// called when the animation completes. +- (void)animateScanningResultWithCompletion:(void (^)(void))completion; + +@end + +#endif // IOS_CHROME_BROWSER_UI_SCANNER_SCANNER_VIEW_H_
diff --git a/ios/chrome/browser/ui/scanner/scanner_view.mm b/ios/chrome/browser/ui/scanner/scanner_view.mm new file mode 100644 index 0000000..7bfdb33 --- /dev/null +++ b/ios/chrome/browser/ui/scanner/scanner_view.mm
@@ -0,0 +1,345 @@ +// Copyright 2019 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/scanner/scanner_view.h" + +#include "base/logging.h" +#include "base/mac/foundation_util.h" +#include "base/numerics/math_constants.h" +#include "ios/chrome/browser/ui/icons/chrome_icon.h" +#import "ios/chrome/browser/ui/scanner/preview_overlay_view.h" +#import "ios/chrome/browser/ui/scanner/video_preview_view.h" +#include "ios/chrome/browser/ui/util/ui_util.h" +#import "ios/chrome/common/ui_util/constraints_ui_util.h" +#include "ios/chrome/grit/ios_strings.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/base/l10n/l10n_util_mac.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { + +// Padding of the viewport caption, below the viewport. +const CGFloat kViewportCaptionVerticalPadding = 14.0; +// Padding of the viewport caption from the edges of the superview. +const CGFloat kViewportCaptionHorizontalPadding = 31.0; +// Shadow opacity of the viewport caption. +const CGFloat kViewportCaptionShadowOpacity = 1.0; +// Shadow radius of the viewport caption. +const CGFloat kViewportCaptionShadowRadius = 5.0; + +// Duration of the flash animation played when a code is scanned. +const CGFloat kFlashDuration = 0.5; + +} // namespace + +@interface ScannerView () { + // A button to toggle the torch. + UIBarButtonItem* _torchButton; + // A view containing the preview layer for camera input. + VideoPreviewView* _previewView; + // A transparent overlay on top of the preview layer. + PreviewOverlayView* _previewOverlay; + // The constraint specifying that the preview overlay should be square. + NSLayoutConstraint* _overlaySquareConstraint; + // The constraint relating the size of the |_previewOverlay| to the width of + // the ScannerView. + NSLayoutConstraint* _overlayWidthConstraint; + // The constraint relating the size of the |_previewOverlay| to the height of + // te ScannerView. + NSLayoutConstraint* _overlayHeightConstraint; +} + +@end + +@implementation ScannerView + +#pragma mark - lifecycle + +- (instancetype)initWithFrame:(CGRect)frame + delegate:(id<ScannerViewDelegate>)delegate { + self = [super initWithFrame:frame]; + if (!self) { + return nil; + } + DCHECK(delegate); + _delegate = delegate; + return self; +} + +#pragma mark - UIView + +// TODO(crbug.com/633577): Replace the preview overlay with a UIView which is +// not resized. +- (void)layoutSubviews { + [super layoutSubviews]; + [self setBackgroundColor:[UIColor blackColor]]; + if (CGRectEqualToRect([_previewView bounds], CGRectZero)) { + [_previewView setBounds:self.bounds]; + } + [_previewView setCenter:CGPointMake(CGRectGetMidX(self.bounds), + CGRectGetMidY(self.bounds))]; +} + +- (void)willMoveToSuperview:(UIView*)superview { + // Set up subviews if they don't already exist. + if (superview && self.subviews.count == 0) { + [self setupPreviewView]; + [self setupPreviewOverlayView]; + [self addSubviews]; + } +} + +#pragma mark - public methods + +- (AVCaptureVideoPreviewLayer*)getPreviewLayer { + return [_previewView previewLayer]; +} + +- (void)enableTorchButton:(BOOL)torchIsAvailable { + [_torchButton setEnabled:torchIsAvailable]; + if (!torchIsAvailable) { + [self setTorchButtonTo:NO]; + } +} + +- (void)setTorchButtonTo:(BOOL)torchIsOn { + DCHECK(_torchButton); + UIImage* icon = nil; + NSString* accessibilityValue = nil; + if (torchIsOn) { + icon = [self torchOnIcon]; + accessibilityValue = + l10n_util::GetNSString(IDS_IOS_SCANNER_TORCH_ON_ACCESSIBILITY_VALUE); + } else { + icon = [self torchOffIcon]; + accessibilityValue = + l10n_util::GetNSString(IDS_IOS_SCANNER_TORCH_OFF_ACCESSIBILITY_VALUE); + } + [_torchButton setImage:icon]; + [_torchButton setAccessibilityValue:accessibilityValue]; +} + +- (void)resetPreviewFrame:(CGSize)size { + [_previewView setTransform:CGAffineTransformIdentity]; + [_previewView setFrame:CGRectMake(0, 0, size.width, size.height)]; +} + +- (void)rotatePreviewByAngle:(CGFloat)angle { + [_previewView + setTransform:CGAffineTransformRotate([_previewView transform], angle)]; +} + +- (void)finishPreviewRotation { + CGAffineTransform rotation = [_previewView transform]; + // Check that the current transform is either an identity or a 90, -90, or 180 + // degree rotation. + DCHECK(fabs(atan2f(rotation.b, rotation.a)) < 0.001 || + fabs(fabs(atan2f(rotation.b, rotation.a)) - base::kPiFloat) < 0.001 || + fabs(fabs(atan2f(rotation.b, rotation.a)) - base::kPiFloat / 2) < + 0.001); + rotation.a = round(rotation.a); + rotation.b = round(rotation.b); + rotation.c = round(rotation.c); + rotation.d = round(rotation.d); + [_previewView setTransform:rotation]; +} + +- (CGRect)viewportRectOfInterest { + return [_previewView viewportRectOfInterest]; +} + +- (void)animateScanningResultWithCompletion:(void (^)(void))completion { + UIView* whiteView = [[UIView alloc] init]; + whiteView.frame = self.bounds; + [self addSubview:whiteView]; + whiteView.backgroundColor = [UIColor whiteColor]; + [UIView animateWithDuration:kFlashDuration + animations:^{ + whiteView.alpha = 0.0; + } + completion:^void(BOOL finished) { + [whiteView removeFromSuperview]; + if (completion) { + completion(); + } + }]; +} + +- (CGSize)viewportSize { + return self.window.frame.size; +} + +- (NSString*)caption { + return nil; +} + +#pragma mark - private methods + +// Creates an image with template rendering mode for use in icons. +- (UIImage*)templateImageWithName:(NSString*)name { + UIImage* image = [[UIImage imageNamed:name] + imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + DCHECK(image); + return image; +} + +// Creates an icon for torch turned on. +- (UIImage*)torchOnIcon { + UIImage* icon = [self templateImageWithName:@"scanner_torch_on"]; + return icon; +} + +// Creates an icon for torch turned off. +- (UIImage*)torchOffIcon { + UIImage* icon = [self templateImageWithName:@"scanner_torch_off"]; + return icon; +} + +// Adds the subviews. +- (void)addSubviews { + UIBarButtonItem* close = + [[UIBarButtonItem alloc] initWithImage:[ChromeIcon closeIcon] + style:UIBarButtonItemStylePlain + target:_delegate + action:@selector(dismissScannerView:)]; + close.accessibilityLabel = [[ChromeIcon closeIcon] accessibilityLabel]; + UIBarButtonItem* spacer = [[UIBarButtonItem alloc] + initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace + target:nil + action:nil]; + _torchButton = + [[UIBarButtonItem alloc] initWithImage:[self torchOffIcon] + style:UIBarButtonItemStylePlain + target:_delegate + action:@selector(toggleTorch:)]; + _torchButton.enabled = NO; + _torchButton.accessibilityIdentifier = @"scanner_torch_button"; + _torchButton.accessibilityLabel = + l10n_util::GetNSString(IDS_IOS_SCANNER_TORCH_BUTTON_ACCESSIBILITY_LABEL); + _torchButton.accessibilityValue = + l10n_util::GetNSString(IDS_IOS_SCANNER_TORCH_OFF_ACCESSIBILITY_VALUE); + UIToolbar* toolbar = [[UIToolbar alloc] init]; + toolbar.items = @[ close, spacer, _torchButton ]; + toolbar.tintColor = UIColor.whiteColor; + [toolbar setBackgroundImage:[[UIImage alloc] init] + forToolbarPosition:UIToolbarPositionAny + barMetrics:UIBarMetricsDefault]; + [toolbar setShadowImage:[[UIImage alloc] init] + forToolbarPosition:UIBarPositionAny]; + + [toolbar setBackgroundColor:[UIColor clearColor]]; + toolbar.translatesAutoresizingMaskIntoConstraints = NO; + [self addSubview:toolbar]; + + AddSameConstraintsToSides(self, toolbar, + LayoutSides::kLeading | LayoutSides::kTrailing); + [toolbar.bottomAnchor + constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor] + .active = YES; + + UILabel* viewportCaption = [[UILabel alloc] init]; + NSString* label = [self caption]; + [viewportCaption setText:label]; + [viewportCaption + setFont:[UIFont preferredFontForTextStyle:UIFontTextStyleBody]]; + [viewportCaption setAdjustsFontForContentSizeCategory:YES]; + [viewportCaption setNumberOfLines:0]; + [viewportCaption setTextAlignment:NSTextAlignmentCenter]; + [viewportCaption setAccessibilityLabel:label]; + [viewportCaption setAccessibilityIdentifier:@"scanner_viewport_caption"]; + [viewportCaption setTextColor:[UIColor whiteColor]]; + [viewportCaption.layer setShadowColor:[UIColor blackColor].CGColor]; + [viewportCaption.layer setShadowOffset:CGSizeZero]; + [viewportCaption.layer setShadowRadius:kViewportCaptionShadowRadius]; + [viewportCaption.layer setShadowOpacity:kViewportCaptionShadowOpacity]; + [viewportCaption.layer setMasksToBounds:NO]; + [viewportCaption.layer setShouldRasterize:YES]; + + UIScrollView* scrollView = [[UIScrollView alloc] init]; + scrollView.showsVerticalScrollIndicator = NO; + [self addSubview:scrollView]; + [scrollView addSubview:viewportCaption]; + + // Constraints for viewportCaption. + scrollView.translatesAutoresizingMaskIntoConstraints = NO; + viewportCaption.translatesAutoresizingMaskIntoConstraints = NO; + + [NSLayoutConstraint activateConstraints:@[ + [scrollView.topAnchor + constraintEqualToAnchor:self.centerYAnchor + constant:[self viewportSize].height / 2 + + kViewportCaptionVerticalPadding], + [scrollView.bottomAnchor constraintEqualToAnchor:toolbar.topAnchor], + [scrollView.leadingAnchor + constraintEqualToAnchor:self.leadingAnchor + constant:kViewportCaptionHorizontalPadding], + [viewportCaption.leadingAnchor + constraintEqualToAnchor:self.leadingAnchor + constant:kViewportCaptionHorizontalPadding], + [scrollView.trailingAnchor + constraintEqualToAnchor:self.trailingAnchor + constant:-kViewportCaptionHorizontalPadding], + [viewportCaption.trailingAnchor + constraintEqualToAnchor:self.trailingAnchor + constant:-kViewportCaptionHorizontalPadding], + ]]; + AddSameConstraints(scrollView, viewportCaption); +} + +// Adds a preview view to |self| and configures its layout constraints. +- (void)setupPreviewView { + DCHECK(!_previewView); + _previewView = [[VideoPreviewView alloc] initWithFrame:self.frame + viewportSize:[self viewportSize]]; + [self insertSubview:_previewView atIndex:0]; +} + +// Adds a transparent overlay with a viewport border to |self| and configures +// its layout constraints. +- (void)setupPreviewOverlayView { + DCHECK(!_previewOverlay); + _previewOverlay = + [[PreviewOverlayView alloc] initWithFrame:CGRectZero + viewportSize:[self viewportSize]]; + [self addSubview:_previewOverlay]; + + // Add a multiplier of sqrt(2) to the width and height constraints to make + // sure that the overlay covers the whole screen during rotation. + _overlayWidthConstraint = + [NSLayoutConstraint constraintWithItem:_previewOverlay + attribute:NSLayoutAttributeWidth + relatedBy:NSLayoutRelationGreaterThanOrEqual + toItem:self + attribute:NSLayoutAttributeWidth + multiplier:sqrt(2) + constant:0.0]; + + _overlayHeightConstraint = + [NSLayoutConstraint constraintWithItem:_previewOverlay + attribute:NSLayoutAttributeHeight + relatedBy:NSLayoutRelationGreaterThanOrEqual + toItem:self + attribute:NSLayoutAttributeHeight + multiplier:sqrt(2) + constant:0.0]; + + _overlaySquareConstraint = [[_previewOverlay heightAnchor] + constraintEqualToAnchor:[_previewOverlay widthAnchor]]; + + // Constrains the preview overlay to be square, centered, with both width and + // height greater than or equal to the width and height of the ScannerView. + [_previewOverlay setTranslatesAutoresizingMaskIntoConstraints:NO]; + [NSLayoutConstraint activateConstraints:@[ + [[_previewOverlay centerXAnchor] + constraintEqualToAnchor:[self centerXAnchor]], + [[_previewOverlay centerYAnchor] + constraintEqualToAnchor:[self centerYAnchor]], + _overlaySquareConstraint, _overlayWidthConstraint, _overlayHeightConstraint + ]]; +} + +@end
diff --git a/ios/chrome/browser/ui/qr_scanner/video_preview_view.h b/ios/chrome/browser/ui/scanner/video_preview_view.h similarity index 82% rename from ios/chrome/browser/ui/qr_scanner/video_preview_view.h rename to ios/chrome/browser/ui/scanner/video_preview_view.h index c874925..25443f3 100644 --- a/ios/chrome/browser/ui/qr_scanner/video_preview_view.h +++ b/ios/chrome/browser/ui/scanner/video_preview_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_QR_SCANNER_VIDEO_PREVIEW_VIEW_H_ -#define IOS_CHROME_BROWSER_UI_QR_SCANNER_VIDEO_PREVIEW_VIEW_H_ +#ifndef IOS_CHROME_BROWSER_UI_SCANNER_VIDEO_PREVIEW_VIEW_H_ +#define IOS_CHROME_BROWSER_UI_SCANNER_VIDEO_PREVIEW_VIEW_H_ #import <AVFoundation/AVFoundation.h> #import <UIKit/UIKit.h> @@ -29,4 +29,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_QR_SCANNER_VIDEO_PREVIEW_VIEW_H_ +#endif // IOS_CHROME_BROWSER_UI_SCANNER_VIDEO_PREVIEW_VIEW_H_
diff --git a/ios/chrome/browser/ui/qr_scanner/video_preview_view.mm b/ios/chrome/browser/ui/scanner/video_preview_view.mm similarity index 95% rename from ios/chrome/browser/ui/qr_scanner/video_preview_view.mm rename to ios/chrome/browser/ui/scanner/video_preview_view.mm index 4bc45b1..a370604 100644 --- a/ios/chrome/browser/ui/qr_scanner/video_preview_view.mm +++ b/ios/chrome/browser/ui/scanner/video_preview_view.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/qr_scanner/video_preview_view.h" +#import "ios/chrome/browser/ui/scanner/video_preview_view.h" #include "base/logging.h" #include "base/mac/foundation_util.h"
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.h b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.h index c71f96b..af9d71c 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.h
@@ -17,7 +17,7 @@ // TableView for clearing browsing data (including history, // cookies, caches, passwords, and autofill). @interface ClearBrowsingDataTableViewController - : SettingsRootTableViewController + : SettingsRootTableViewController <UIAdaptivePresentationControllerDelegate> // Initializers. |browserState| can't be nil. - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm index 48b3c4b2..3bed095 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm
@@ -425,6 +425,14 @@ [self.alertCoordinator start]; } +#pragma mark - UIAdaptivePresentationControllerDelegate + +- (void)presentationControllerDidDismiss: + (UIPresentationController*)presentationController { + // Call dismiss to clean up state and stop the Coordinator. + [self dismiss]; +} + #pragma mark - Private Helpers - (void)showClearBrowsingDataAlertController:(id)sender {
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/time_range_selector_table_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/clear_browsing_data/time_range_selector_table_view_controller_unittest.mm index b35cb68b..6a302bdf 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/time_range_selector_table_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/time_range_selector_table_view_controller_unittest.mm
@@ -33,8 +33,7 @@ : public ChromeTableViewControllerTest { protected: TimeRangeSelectorTableViewControllerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { ChromeTableViewControllerTest::SetUp(); @@ -66,7 +65,7 @@ EXPECT_EQ(accessory_type, cell.accessoryType); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<PrefService> pref_service_; TimeRangeSelectorTableViewController* time_range_selector_controller_; };
diff --git a/ios/chrome/browser/ui/settings/dataplan_usage_table_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/dataplan_usage_table_view_controller_unittest.mm index 6033ac8a..de74080d 100644 --- a/ios/chrome/browser/ui/settings/dataplan_usage_table_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/dataplan_usage_table_view_controller_unittest.mm
@@ -57,8 +57,8 @@ sync_preferences::PrefServiceMockFactory factory; base::FilePath path("DataplanUsageTableViewControllerTest.pref"); - factory.SetUserPrefsFile( - path, scoped_task_environment_.GetMainThreadTaskRunner().get()); + factory.SetUserPrefsFile(path, + task_environment_.GetMainThreadTaskRunner().get()); return factory.Create(registry.get()); } @@ -71,8 +71,8 @@ EXPECT_EQ(accessory_type, cell.accessoryType); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; std::unique_ptr<PrefService> pref_service_; DataplanUsageTableViewController* dataplanController_; };
diff --git a/ios/chrome/browser/ui/settings/language/language_settings_mediator_unittest.mm b/ios/chrome/browser/ui/settings/language/language_settings_mediator_unittest.mm index 4f74b4c..fb101c36 100644 --- a/ios/chrome/browser/ui/settings/language/language_settings_mediator_unittest.mm +++ b/ios/chrome/browser/ui/settings/language/language_settings_mediator_unittest.mm
@@ -89,8 +89,7 @@ class LanguageSettingsMediatorTest : public PlatformTest { protected: LanguageSettingsMediatorTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) { // Create BrowserState. TestChromeBrowserState::Builder test_cbs_builder; test_cbs_builder.SetPrefService(CreatePrefService()); @@ -135,7 +134,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; std::unique_ptr<translate::TranslatePrefs> translate_prefs_; FakeLanguageSettingsConsumer* consumer_;
diff --git a/ios/chrome/browser/ui/settings/password/password_exporter_unittest.mm b/ios/chrome/browser/ui/settings/password/password_exporter_unittest.mm index 1522c80..594d5b88 100644 --- a/ios/chrome/browser/ui/settings/password/password_exporter_unittest.mm +++ b/ios/chrome/browser/ui/settings/password/password_exporter_unittest.mm
@@ -120,7 +120,7 @@ id password_exporter_delegate_; PasswordExporter* password_exporter_; MockReauthenticationModule* mock_reauthentication_module_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::HistogramTester histogram_tester_; }; @@ -140,7 +140,7 @@ [password_exporter_ startExportFlow:CreatePasswordList()]; // Wait for all asynchronous tasks to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(fake_password_file_writer.writeAttempted); @@ -171,7 +171,7 @@ [password_exporter_ startExportFlow:CreatePasswordList()]; // Wait for all asynchronous tasks to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Use @try/@catch as -reject raises an exception. @try { @@ -208,7 +208,7 @@ [password_exporter_ startExportFlow:CreatePasswordList()]; // Wait for all asynchronous tasks to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Use @try/@catch as -reject raises an exception. @try { @@ -246,7 +246,7 @@ [password_exporter_ startExportFlow:CreatePasswordList()]; // Wait for all asynchronous tasks to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_OCMOCK_VERIFY(password_exporter_delegate_); } @catch (NSException* exception) { // The exception is raised when @@ -261,7 +261,7 @@ // Make sure this test doesn't pass only because file writing hasn't finished // yet. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Serializing passwords has finished, but reauthentication was not // successful, so writing the file was not attempted. @@ -294,7 +294,7 @@ @try { [fake_password_serializer_bridge executeHandler]; // Wait for all asynchronous tasks to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_OCMOCK_VERIFY(password_exporter_delegate_); } @catch (NSException* exception) { // The exception is raised when @@ -321,7 +321,7 @@ [password_exporter_ startExportFlow:CreatePasswordList()]; // Wait for all asynchronous tasks to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); [password_exporter_ cancelExport]; EXPECT_EQ(ExportState::CANCELLING, password_exporter_.exportState); @@ -352,7 +352,7 @@ [password_exporter_ startExportFlow:CreatePasswordList()]; // Wait for all asynchronous tasks to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); [password_exporter_ cancelExport]; EXPECT_EQ(ExportState::CANCELLING, password_exporter_.exportState);
diff --git a/ios/chrome/browser/ui/settings/settings_root_table_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/settings_root_table_view_controller_unittest.mm index 4bf4f39..76d9ad3 100644 --- a/ios/chrome/browser/ui/settings/settings_root_table_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/settings_root_table_view_controller_unittest.mm
@@ -39,7 +39,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; };
diff --git a/ios/chrome/browser/ui/settings/translate_table_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/translate_table_view_controller_unittest.mm index de0270b..b9107118 100644 --- a/ios/chrome/browser/ui/settings/translate_table_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/translate_table_view_controller_unittest.mm
@@ -42,8 +42,7 @@ class TranslateTableViewControllerTest : public ChromeTableViewControllerTest { protected: TranslateTableViewControllerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { ChromeTableViewControllerTest::SetUp(); @@ -67,7 +66,7 @@ return factory.Create(registry.get()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<PrefService> pref_service_; };
diff --git a/ios/chrome/browser/ui/settings/voice_search_table_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/voice_search_table_view_controller_unittest.mm index 41771d7..888e62f6 100644 --- a/ios/chrome/browser/ui/settings/voice_search_table_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/voice_search_table_view_controller_unittest.mm
@@ -34,8 +34,7 @@ : public ChromeTableViewControllerTest { protected: VoiceSearchTableViewControllerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { ChromeTableViewControllerTest::SetUp(); @@ -60,7 +59,7 @@ cellForRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<PrefService> pref_service_; };
diff --git a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view_controller_unittest.mm b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view_controller_unittest.mm index 73acdfd..9514b02 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view_controller_unittest.mm
@@ -41,10 +41,9 @@ class AdaptiveToolbarViewControllerTest : public PlatformTest { protected: AdaptiveToolbarViewControllerTest() - : scopedTaskEnvironment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : TaskEnvironment_(base::test::TaskEnvironment::MainThreadType::UI) {} - base::test::ScopedTaskEnvironment scopedTaskEnvironment_; + base::test::TaskEnvironment TaskEnvironment_; }; TEST_F(AdaptiveToolbarViewControllerTest, DetectForceTouch) {
diff --git a/ios/chrome/browser/url_loading/image_search_param_generator_unittest.mm b/ios/chrome/browser/url_loading/image_search_param_generator_unittest.mm index 07e26460..f4e51b2 100644 --- a/ios/chrome/browser/url_loading/image_search_param_generator_unittest.mm +++ b/ios/chrome/browser/url_loading/image_search_param_generator_unittest.mm
@@ -28,7 +28,7 @@ chrome_browser_state_ = test_cbs_builder.Build(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; };
diff --git a/ios/chrome/browser/web/chrome_web_client_unittest.mm b/ios/chrome/browser/web/chrome_web_client_unittest.mm index b0b5226..4d9fb92 100644 --- a/ios/chrome/browser/web/chrome_web_client_unittest.mm +++ b/ios/chrome/browser/web/chrome_web_client_unittest.mm
@@ -61,7 +61,7 @@ ios::ChromeBrowserState* browser_state() { return browser_state_.get(); } private: - base::test::ScopedTaskEnvironment environment_; + base::test::TaskEnvironment environment_; std::unique_ptr<ios::ChromeBrowserState> browser_state_; DISALLOW_COPY_AND_ASSIGN(ChromeWebClientTest);
diff --git a/ios/chrome/browser/web/sad_tab_tab_helper_unittest.mm b/ios/chrome/browser/web/sad_tab_tab_helper_unittest.mm index ddea3cc..31ef9ee 100644 --- a/ios/chrome/browser/web/sad_tab_tab_helper_unittest.mm +++ b/ios/chrome/browser/web/sad_tab_tab_helper_unittest.mm
@@ -98,7 +98,7 @@ ~SadTabTabHelperTest() override { [application_ stopMocking]; } - base::test::ScopedTaskEnvironment environment_; + base::test::TaskEnvironment environment_; ScopedKeyWindow scoped_key_window_; UIView* web_state_view_; std::unique_ptr<ios::ChromeBrowserState> browser_state_;
diff --git a/ios/chrome/common/colors/BUILD.gn b/ios/chrome/common/colors/BUILD.gn index 5a47443a8..4b72ae82 100644 --- a/ios/chrome/common/colors/BUILD.gn +++ b/ios/chrome/common/colors/BUILD.gn
@@ -6,6 +6,8 @@ source_set("colors") { sources = [ + "UIColor+cr_dynamic_colors.h", + "UIColor+cr_dynamic_colors.mm", "UIColor+cr_semantic_colors.h", "UIColor+cr_semantic_colors.mm", "dynamic_color_util.h",
diff --git a/ios/chrome/common/colors/UIColor+cr_dynamic_colors.h b/ios/chrome/common/colors/UIColor+cr_dynamic_colors.h new file mode 100644 index 0000000..7cac2ce --- /dev/null +++ b/ios/chrome/common/colors/UIColor+cr_dynamic_colors.h
@@ -0,0 +1,21 @@ +// Copyright 2019 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_COMMON_COLORS_UICOLOR_CR_DYNAMIC_COLORS_H_ +#define IOS_CHROME_COMMON_COLORS_UICOLOR_CR_DYNAMIC_COLORS_H_ + +#import <UIKit/UIKit.h> + +// This category provides convenience wrappers for the iOS 13-only functions +// dealing with dynamic colors. It can be removed along with iOS 12. +// TODO (crbug.com/981889): Remove along with iOS 12. +@interface UIColor (CRDynamicColors) + +// iOS 12-compatible version of -resolvedColorWithTraitCollection. +- (UIColor*)cr_resolvedColorWithTraitCollection: + (UITraitCollection*)traitCollection; + +@end + +#endif // IOS_CHROME_COMMON_COLORS_UICOLOR_CR_DYNAMIC_COLORS_H_
diff --git a/ios/chrome/common/colors/UIColor+cr_dynamic_colors.mm b/ios/chrome/common/colors/UIColor+cr_dynamic_colors.mm new file mode 100644 index 0000000..f88f61aa --- /dev/null +++ b/ios/chrome/common/colors/UIColor+cr_dynamic_colors.mm
@@ -0,0 +1,21 @@ +// Copyright 2019 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/common/colors/UIColor+cr_dynamic_colors.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@implementation UIColor (CRDynamicColors) + +- (UIColor*)cr_resolvedColorWithTraitCollection: + (UITraitCollection*)traitCollection { + if (@available(iOS 13, *)) { + return [self resolvedColorWithTraitCollection:traitCollection]; + } + return self; +} + +@end
diff --git a/ios/components/io_thread/ios_io_thread_unittest.mm b/ios/components/io_thread/ios_io_thread_unittest.mm index 3915f21..117e189f 100644 --- a/ios/components/io_thread/ios_io_thread_unittest.mm +++ b/ios/components/io_thread/ios_io_thread_unittest.mm
@@ -46,7 +46,7 @@ web::WebThreadImpl::CreateTaskExecutor(); ui_thread_ = std::make_unique<web::TestWebThread>( - web::WebThread::UI, scoped_task_environment_.GetMainThreadTaskRunner()); + web::WebThread::UI, task_environment_.GetMainThreadTaskRunner()); } ~IOSIOThreadTest() override { @@ -54,7 +54,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; web::ScopedTestingWebClient web_client_; std::unique_ptr<web::TestWebThread> ui_thread_; };
diff --git a/ios/net/cookies/cookie_store_ios_persistent_unittest.mm b/ios/net/cookies/cookie_store_ios_persistent_unittest.mm index 3b0a543..85ea1e7 100644 --- a/ios/net/cookies/cookie_store_ios_persistent_unittest.mm +++ b/ios/net/cookies/cookie_store_ios_persistent_unittest.mm
@@ -53,7 +53,7 @@ static const int enforces_prefixes = true; static const bool enforce_strict_secure = false; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; INSTANTIATE_TYPED_TEST_SUITE_P(PersistentCookieStoreIOS, @@ -110,7 +110,7 @@ const GURL kTestCookieURL; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ScopedTestingCookieStoreIOSClient scoped_cookie_store_ios_client_; scoped_refptr<net::TestPersistentCookieStore> backend_; std::unique_ptr<net::CookieStoreIOS> store_;
diff --git a/ios/net/cookies/cookie_store_ios_unittest.mm b/ios/net/cookies/cookie_store_ios_unittest.mm index 357f3d5..e1c8121 100644 --- a/ios/net/cookies/cookie_store_ios_unittest.mm +++ b/ios/net/cookies/cookie_store_ios_unittest.mm
@@ -69,7 +69,7 @@ static const bool has_exact_change_ordering = false; static const int creation_time_granularity_in_ms = 1000; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; INSTANTIATE_TYPED_TEST_SUITE_P(CookieStoreIOS, @@ -196,7 +196,7 @@ const GURL kTestCookieURLFoo; const GURL kTestCookieURLBarBar; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ScopedTestingCookieStoreIOSClient scoped_cookie_store_ios_client_; scoped_refptr<TestPersistentCookieStore> backend_; // |system_store_| will point to the NSHTTPSystemCookieStore object owned by
diff --git a/ios/net/cookies/ns_http_system_cookie_store_unittest.mm b/ios/net/cookies/ns_http_system_cookie_store_unittest.mm index 5297239..5d7e5c2 100644 --- a/ios/net/cookies/ns_http_system_cookie_store_unittest.mm +++ b/ios/net/cookies/ns_http_system_cookie_store_unittest.mm
@@ -55,7 +55,7 @@ SystemCookieStore* GetCookieStore() { return store_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; ScopedTestingCookieStoreIOSClient scoped_cookie_store_ios_client_; NSHTTPCookieStorage* shared_store_; std::unique_ptr<net::NSHTTPSystemCookieStore> store_;
diff --git a/ios/net/protocol_handler_util_unittest.mm b/ios/net/protocol_handler_util_unittest.mm index fa2d5df..c604ec6 100644 --- a/ios/net/protocol_handler_util_unittest.mm +++ b/ios/net/protocol_handler_util_unittest.mm
@@ -154,7 +154,7 @@ void OnReadCompleted(URLRequest* request, int bytes_read) override {} protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; URLRequestJobFactoryImpl job_factory_; std::unique_ptr<URLRequestContext> request_context_; };
diff --git a/ios/web/browsing_data/browsing_data_remover_unittest.mm b/ios/web/browsing_data/browsing_data_remover_unittest.mm index 1f6c17ed..d174d98 100644 --- a/ios/web/browsing_data/browsing_data_remover_unittest.mm +++ b/ios/web/browsing_data/browsing_data_remover_unittest.mm
@@ -112,7 +112,7 @@ return BrowsingDataRemover::FromBrowserState(&browser_state_); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestBrowserState browser_state_; };
diff --git a/ios/web/navigation/wk_based_navigation_manager_impl.mm b/ios/web/navigation/wk_based_navigation_manager_impl.mm index fbfa06b..c3af25a 100644 --- a/ios/web/navigation/wk_based_navigation_manager_impl.mm +++ b/ios/web/navigation/wk_based_navigation_manager_impl.mm
@@ -795,6 +795,8 @@ } else { last_committed_web_view_item_->SetVirtualURL(virtual_url); } + } else { + last_committed_web_view_item_->SetVirtualURL(document_url); } last_committed_web_view_item_->SetTimestamp( time_smoother_.GetSmoothedTime(base::Time::Now()));
diff --git a/ios/web/public/test/test_web_thread_bundle.h b/ios/web/public/test/test_web_thread_bundle.h index 1dc8ab7..5b95bf9 100644 --- a/ios/web/public/test/test_web_thread_bundle.h +++ b/ios/web/public/test/test_web_thread_bundle.h
@@ -41,7 +41,7 @@ class TestWebThread; -class TestWebThreadBundle : public base::test::ScopedTaskEnvironment { +class TestWebThreadBundle : public base::test::TaskEnvironment { public: // Used to specify the type of MessageLoop that backs the UI thread, and // which of the named WebThreads should be backed by a real
diff --git a/ios/web/test/test_web_thread_bundle.cc b/ios/web/test/test_web_thread_bundle.cc index ea75c8d..b938b9a 100644 --- a/ios/web/test/test_web_thread_bundle.cc +++ b/ios/web/test/test_web_thread_bundle.cc
@@ -13,8 +13,8 @@ namespace web { TestWebThreadBundle::TestWebThreadBundle(int options) - : base::test::ScopedTaskEnvironment( - options == IO_MAINLOOP ? MainThreadType::IO : MainThreadType::UI) { + : base::test::TaskEnvironment(options == IO_MAINLOOP ? MainThreadType::IO + : MainThreadType::UI) { Init(options); }
diff --git a/ios/web/web_view/wk_web_view_util.h b/ios/web/web_view/wk_web_view_util.h index 6bce0a1..4bbe73a 100644 --- a/ios/web/web_view/wk_web_view_util.h +++ b/ios/web/web_view/wk_web_view_util.h
@@ -13,7 +13,7 @@ bool IsSafeBrowsingWarningDisplayedInWebView(WKWebView* web_view); // Returns true if workaround for loading restricted URLs should be applied. -// TODO(crbug.com/954332): Remove this workaround when +// TODO(crbug.com/954332): Remove this workaround when iOS 12 is dropped. // https://bugs.webkit.org/show_bug.cgi?id=196930 is fixed. bool RequiresContentFilterBlockingWorkaround();
diff --git a/ios/web/web_view/wk_web_view_util.mm b/ios/web/web_view/wk_web_view_util.mm index 446d57f5..081d741 100644 --- a/ios/web/web_view/wk_web_view_util.mm +++ b/ios/web/web_view/wk_web_view_util.mm
@@ -37,6 +37,10 @@ if (!GetWebClient()->IsSlimNavigationManagerEnabled()) return false; + // This is fixed in iOS13 beta 7. + if (@available(iOS 13, *)) + return false; + if (@available(iOS 12.2, *)) return true;
diff --git a/ios/web/webui/url_fetcher_block_adapter_unittest.mm b/ios/web/webui/url_fetcher_block_adapter_unittest.mm index 64d77a3..a9830c2 100644 --- a/ios/web/webui/url_fetcher_block_adapter_unittest.mm +++ b/ios/web/webui/url_fetcher_block_adapter_unittest.mm
@@ -28,11 +28,10 @@ class URLFetcherBlockAdapterTest : public PlatformTest { protected: URLFetcherBlockAdapterTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} // Required for base::MessageLoopCurrent::Get(). - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Tests that URLFetcherBlockAdapter calls its completion handler with the
diff --git a/ios/web_view/internal/cwv_download_task_unittest.mm b/ios/web_view/internal/cwv_download_task_unittest.mm index aa5572fa..26b3b9d3 100644 --- a/ios/web_view/internal/cwv_download_task_unittest.mm +++ b/ios/web_view/internal/cwv_download_task_unittest.mm
@@ -45,7 +45,7 @@ protected: std::string valid_local_file_path_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; web::FakeDownloadTask* fake_internal_task_ = nullptr; id<CWVDownloadTaskDelegate> mock_delegate_ = nil; CWVDownloadTask* cwv_task_ = nil; @@ -53,7 +53,7 @@ // Waits until fake_internal_task_->Start() is called. bool WaitUntilTaskStarts() WARN_UNUSED_RESULT { return WaitUntilConditionOrTimeout(kWaitForFileOperationTimeout, ^{ - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); return fake_internal_task_->GetState() == web::DownloadTask::State::kInProgress; }); @@ -67,7 +67,7 @@ error_code = block_error_code; })); return WaitUntilConditionOrTimeout(kWaitForFileOperationTimeout, ^{ - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); return error_code == net::OK; }); } @@ -151,7 +151,7 @@ [cwv_task_ startDownloadToLocalFileAtPath:path]; EXPECT_TRUE(WaitUntilConditionOrTimeout(kWaitForFileOperationTimeout, ^{ - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); return did_finish_called; })); }
diff --git a/ipc/ipc_channel_mojo_unittest.cc b/ipc/ipc_channel_mojo_unittest.cc index abfe788..6ab79d3 100644 --- a/ipc/ipc_channel_mojo_unittest.cc +++ b/ipc/ipc_channel_mojo_unittest.cc
@@ -949,7 +949,7 @@ IPC::ChannelProxy* proxy() { return runner_->proxy(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<ChannelProxyRunner> runner_; };
diff --git a/ipc/ipc_cpu_perftest.cc b/ipc/ipc_cpu_perftest.cc index 4c5d22c..36fba94d 100644 --- a/ipc/ipc_cpu_perftest.cc +++ b/ipc/ipc_cpu_perftest.cc
@@ -394,7 +394,7 @@ }; DEFINE_TEST_CLIENT_WITH_PIPE(PingPongClient, MojoSteadyPingPongTest, h) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; return RunPingPongClient(h); } @@ -402,14 +402,14 @@ // instead of raw IPC::Messages. TEST_F(MojoSteadyPingPongTest, AsyncPingPong) { RunTestClient("PingPongClient", [&](MojoHandle h) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; RunPingPongServer(h, "Mojo_CPU_Async", false); }); } TEST_F(MojoSteadyPingPongTest, SyncPingPong) { RunTestClient("PingPongClient", [&](MojoHandle h) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; RunPingPongServer(h, "Mojo_CPU_Sync", true); }); }
diff --git a/ipc/ipc_mojo_bootstrap_unittest.cc b/ipc/ipc_mojo_bootstrap_unittest.cc index 12e6c1d..8c4b1962 100644 --- a/ipc/ipc_mojo_bootstrap_unittest.cc +++ b/ipc/ipc_mojo_bootstrap_unittest.cc
@@ -107,7 +107,7 @@ }; TEST_F(IPCMojoBootstrapTest, Connect) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; Connection connection( IPC::MojoBootstrap::Create( helper_.StartChild("IPCMojoBootstrapTestClient"), @@ -132,7 +132,7 @@ MULTIPROCESS_TEST_MAIN_WITH_SETUP( IPCMojoBootstrapTestClientTestChildMain, ::mojo::core::test::MultiprocessTestHelper::ChildSetup) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; Connection connection( IPC::MojoBootstrap::Create( std::move(mojo::core::test::MultiprocessTestHelper::primordial_pipe), @@ -153,7 +153,7 @@ } TEST_F(IPCMojoBootstrapTest, ReceiveEmptyMessage) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; Connection connection( IPC::MojoBootstrap::Create( helper_.StartChild("IPCMojoBootstrapTestEmptyMessage"), @@ -180,7 +180,7 @@ MULTIPROCESS_TEST_MAIN_WITH_SETUP( IPCMojoBootstrapTestEmptyMessageTestChildMain, ::mojo::core::test::MultiprocessTestHelper::ChildSetup) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; Connection connection( IPC::MojoBootstrap::Create( std::move(mojo::core::test::MultiprocessTestHelper::primordial_pipe),
diff --git a/ipc/ipc_mojo_perftest.cc b/ipc/ipc_mojo_perftest.cc index e1f2a4a..215a0ff 100644 --- a/ipc/ipc_mojo_perftest.cc +++ b/ipc/ipc_mojo_perftest.cc
@@ -536,7 +536,7 @@ DEFINE_TEST_CLIENT_WITH_PIPE(InterfacePassingClient, MojoInterfacePassingPerfTest, h) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; return RunInterfacePassingClient(h); } @@ -571,7 +571,7 @@ InProcessPerfTest<MojoInterfacePassingPerfTest>; DEFINE_TEST_CLIENT_WITH_PIPE(PingPongClient, MojoInterfacePerfTest, h) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; return RunPingPongClient(h); } @@ -579,7 +579,7 @@ // raw IPC::Messages. TEST_F(MojoInterfacePerfTest, MultiprocessPingPong) { RunTestClient("PingPongClient", [&](MojoHandle h) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; RunPingPongServer(h, "Multiprocess"); }); } @@ -587,21 +587,21 @@ TEST_F(MojoInterfacePerfTest, MultiprocessSyncPing) { sync_ = true; RunTestClient("PingPongClient", [&](MojoHandle h) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; RunPingPongServer(h, "MultiprocessSync"); }); } TEST_F(MojoInterfacePassingPerfTest, MultiprocessInterfacePassing) { RunTestClient("InterfacePassingClient", [&](MojoHandle h) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; RunInterfacePassingServer(h, "InterfacePassing", false /* associated */); }); } TEST_F(MojoInterfacePassingPerfTest, MultiprocessAssociatedInterfacePassing) { RunTestClient("InterfacePassingClient", [&](MojoHandle h) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; RunInterfacePassingServer(h, "AssociatedInterfacePassing", true /* associated*/); }); @@ -618,7 +618,7 @@ FROM_HERE, base::BindOnce(base::IgnoreResult(&RunPingPongClient), client_handle)); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; RunPingPongServer(server_handle, "SingleProcess"); } @@ -626,7 +626,7 @@ MojoHandle server_handle, client_handle; CreateMessagePipe(&server_handle, &client_handle); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; mojo::MessagePipeHandle mp_handle(client_handle); mojo::ScopedMessagePipeHandle scoped_mp(mp_handle); LockThreadAffinity thread_locker(kSharedCore); @@ -650,7 +650,7 @@ FROM_HERE, base::BindOnce(base::IgnoreResult(&RunInterfacePassingClient), client_handle)); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; RunInterfacePassingServer(server_handle, "SingleProcess", false /* associated */); } @@ -666,7 +666,7 @@ FROM_HERE, base::BindOnce(base::IgnoreResult(&RunInterfacePassingClient), client_handle)); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; RunInterfacePassingServer(server_handle, "SingleProcess", true /* associated */); } @@ -675,7 +675,7 @@ MojoHandle server_handle, client_handle; CreateMessagePipe(&server_handle, &client_handle); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; mojo::MessagePipeHandle mp_handle(client_handle); mojo::ScopedMessagePipeHandle scoped_mp(mp_handle); LockThreadAffinity thread_locker(kSharedCore); @@ -690,7 +690,7 @@ MojoHandle server_handle, client_handle; CreateMessagePipe(&server_handle, &client_handle); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; mojo::MessagePipeHandle mp_handle(client_handle); mojo::ScopedMessagePipeHandle scoped_mp(mp_handle); LockThreadAffinity thread_locker(kSharedCore); @@ -729,7 +729,7 @@ } void Ping(const std::string& value) { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&CallbackPerfTest::OnPong, base::Unretained(this), value)); } @@ -836,7 +836,7 @@ private: base::Thread client_thread_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; int message_count_; int count_down_; std::string payload_;
diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc index 6a11e14..c1c2ded 100644 --- a/ipc/ipc_sync_channel_unittest.cc +++ b/ipc/ipc_sync_channel_unittest.cc
@@ -291,7 +291,7 @@ class IPCSyncChannelTest : public testing::Test { private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; //------------------------------------------------------------------------------
diff --git a/ipc/ipc_test_base.h b/ipc/ipc_test_base.h index b8505be3..9c40778 100644 --- a/ipc/ipc_test_base.h +++ b/ipc/ipc_test_base.h
@@ -75,8 +75,8 @@ IPC::Channel* channel() const { return channel_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; mojo::ScopedMessagePipeHandle handle_; std::unique_ptr<IPC::Channel> channel_; };
diff --git a/jingle/glue/fake_ssl_client_socket_unittest.cc b/jingle/glue/fake_ssl_client_socket_unittest.cc index 89ea3fa..bf6c282 100644 --- a/jingle/glue/fake_ssl_client_socket_unittest.cc +++ b/jingle/glue/fake_ssl_client_socket_unittest.cc
@@ -275,7 +275,7 @@ } // MockTCPClientSocket needs a message loop. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::MockClientSocketFactory mock_client_socket_factory_; std::unique_ptr<net::StaticSocketDataProvider> static_socket_data_provider_;
diff --git a/jingle/glue/network_service_async_socket_unittest.cc b/jingle/glue/network_service_async_socket_unittest.cc index a4fe932..2f82c9c 100644 --- a/jingle/glue/network_service_async_socket_unittest.cc +++ b/jingle/glue/network_service_async_socket_unittest.cc
@@ -553,7 +553,7 @@ } // Need a message loop for both the socket and Mojo. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; AsyncSocketDataProvider async_socket_data_provider_; net::SSLSocketDataProvider ssl_socket_data_provider_;
diff --git a/jingle/glue/task_pump_unittest.cc b/jingle/glue/task_pump_unittest.cc index 5b00b856..1e250e9 100644 --- a/jingle/glue/task_pump_unittest.cc +++ b/jingle/glue/task_pump_unittest.cc
@@ -17,7 +17,7 @@ class TaskPumpTest : public testing::Test { private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(TaskPumpTest, Basic) {
diff --git a/jingle/glue/thread_wrapper_unittest.cc b/jingle/glue/thread_wrapper_unittest.cc index 5653e2a9..938064e 100644 --- a/jingle/glue/thread_wrapper_unittest.cc +++ b/jingle/glue/thread_wrapper_unittest.cc
@@ -90,7 +90,7 @@ } // ThreadWrapper destroyes itself when |message_loop_| is destroyed. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; rtc::Thread* thread_; MockMessageHandler handler1_; MockMessageHandler handler2_; @@ -156,7 +156,7 @@ .WillOnce(DeleteMessageData()); base::RunLoop run_loop; - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromMilliseconds(kMaxTestDelay)); run_loop.Run(); @@ -212,7 +212,7 @@ .WillOnce(DeleteMessageData()); base::RunLoop run_loop; - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromMilliseconds(kMaxTestDelay)); run_loop.Run();
diff --git a/jingle/notifier/base/weak_xmpp_client_unittest.cc b/jingle/notifier/base/weak_xmpp_client_unittest.cc index fa8a2b4..9403eb9 100644 --- a/jingle/notifier/base/weak_xmpp_client_unittest.cc +++ b/jingle/notifier/base/weak_xmpp_client_unittest.cc
@@ -61,7 +61,7 @@ } // Needed by TaskPump. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<jingle_glue::TaskPump> task_pump_; MockXmppDelegate mock_xmpp_delegate_;
diff --git a/jingle/notifier/base/xmpp_connection_unittest.cc b/jingle/notifier/base/xmpp_connection_unittest.cc index 77dbffe..5cebd09 100644 --- a/jingle/notifier/base/xmpp_connection_unittest.cc +++ b/jingle/notifier/base/xmpp_connection_unittest.cc
@@ -79,7 +79,7 @@ : mock_pre_xmpp_auth_(new MockPreXmppAuth()), net_config_helper_( base::MakeRefCounted<net::TestURLRequestContextGetter>( - scoped_task_environment_.GetMainThreadTaskRunner())) { + task_environment_.GetMainThreadTaskRunner())) { // GTest death tests by default execute in a fork()ed but not exec()ed // process. On macOS, a CoreFoundation-backed MessageLoop will exit with a // __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__ @@ -95,7 +95,7 @@ } // Needed by XmppConnection. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockXmppConnectionDelegate mock_xmpp_connection_delegate_; std::unique_ptr<MockPreXmppAuth> mock_pre_xmpp_auth_; jingle_glue::NetworkServiceConfigTestUtil net_config_helper_;
diff --git a/jingle/notifier/communicator/single_login_attempt_unittest.cc b/jingle/notifier/communicator/single_login_attempt_unittest.cc index 00d63ff..49ab52c1 100644 --- a/jingle/notifier/communicator/single_login_attempt_unittest.cc +++ b/jingle/notifier/communicator/single_login_attempt_unittest.cc
@@ -111,7 +111,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; jingle_glue::NetworkServiceConfigTestUtil net_config_helper_; const LoginSettings login_settings_;
diff --git a/jingle/notifier/listener/non_blocking_push_client_unittest.cc b/jingle/notifier/listener/non_blocking_push_client_unittest.cc index 1ed9b17..68ea0fb 100644 --- a/jingle/notifier/listener/non_blocking_push_client_unittest.cc +++ b/jingle/notifier/listener/non_blocking_push_client_unittest.cc
@@ -60,7 +60,7 @@ return std::unique_ptr<PushClient>(fake_push_client_); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakePushClientObserver fake_observer_; std::unique_ptr<NonBlockingPushClient> push_client_; // Owned by |push_client_|.
diff --git a/jingle/notifier/listener/push_client_unittest.cc b/jingle/notifier/listener/push_client_unittest.cc index 2cccfc9..ee07e92 100644 --- a/jingle/notifier/listener/push_client_unittest.cc +++ b/jingle/notifier/listener/push_client_unittest.cc
@@ -27,15 +27,15 @@ PushClientTest() : net_config_helper_( base::MakeRefCounted<net::TestURLRequestContextGetter>( - scoped_task_environment_.GetMainThreadTaskRunner())) { + task_environment_.GetMainThreadTaskRunner())) { net_config_helper_.FillInNetworkConfig(¬ifier_options_.network_config); } ~PushClientTest() override {} // The sockets created by the XMPP code expect an IO loop. - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; jingle_glue::NetworkServiceConfigTestUtil net_config_helper_; NotifierOptions notifier_options_; };
diff --git a/jingle/notifier/listener/xmpp_push_client_unittest.cc b/jingle/notifier/listener/xmpp_push_client_unittest.cc index e66f5786..ce023483 100644 --- a/jingle/notifier/listener/xmpp_push_client_unittest.cc +++ b/jingle/notifier/listener/xmpp_push_client_unittest.cc
@@ -38,7 +38,7 @@ XmppPushClientTest() : net_config_helper_( base::MakeRefCounted<net::TestURLRequestContextGetter>( - scoped_task_environment_.GetMainThreadTaskRunner())) { + task_environment_.GetMainThreadTaskRunner())) { net_config_helper_.FillInNetworkConfig(¬ifier_options_.network_config); } @@ -57,8 +57,8 @@ } // The sockets created by the XMPP code expect an IO loop. - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; jingle_glue::NetworkServiceConfigTestUtil net_config_helper_; NotifierOptions notifier_options_;
diff --git a/media/audio/alive_checker_unittest.cc b/media/audio/alive_checker_unittest.cc index ac2bf73..212ee54 100644 --- a/media/audio/alive_checker_unittest.cc +++ b/media/audio/alive_checker_unittest.cc
@@ -159,7 +159,7 @@ } // The test task environment. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // The thread the checker is run on. base::Thread alive_checker_thread_;
diff --git a/media/audio/audio_debug_file_writer_unittest.cc b/media/audio/audio_debug_file_writer_unittest.cc index 4d49869..e777622 100644 --- a/media/audio/audio_debug_file_writer_unittest.cc +++ b/media/audio/audio_debug_file_writer_unittest.cc
@@ -50,10 +50,9 @@ : public testing::TestWithParam<AudioDebugFileWriterTestData> { public: explicit AudioDebugFileWriterTest( - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode execution_mode) - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - execution_mode), + base::test::TaskEnvironment::ThreadPoolExecutionMode execution_mode) + : task_environment_(base::test::TaskEnvironment::MainThreadType::DEFAULT, + execution_mode), params_(AudioParameters::Format::AUDIO_PCM_LINEAR, std::get<0>(GetParam()), std::get<1>(GetParam()), @@ -67,8 +66,7 @@ } AudioDebugFileWriterTest() : AudioDebugFileWriterTest( - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::ASYNC) { - } + base::test::TaskEnvironment::ThreadPoolExecutionMode::ASYNC) {} protected: virtual ~AudioDebugFileWriterTest() = default; @@ -192,7 +190,7 @@ debug_writer_->Stop(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); VerifyRecording(file_path); @@ -206,7 +204,7 @@ protected: // The test task environment. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Writer under test. std::unique_ptr<AudioDebugFileWriter> debug_writer_; @@ -232,8 +230,8 @@ class AudioDebugFileWriterSingleThreadTest : public AudioDebugFileWriterTest { public: AudioDebugFileWriterSingleThreadTest() - : AudioDebugFileWriterTest(base::test::ScopedTaskEnvironment:: - ThreadPoolExecutionMode::QUEUED) {} + : AudioDebugFileWriterTest( + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} }; TEST_P(AudioDebugFileWriterTest, WaveRecordingTest) { @@ -256,7 +254,7 @@ debug_writer_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); VerifyRecording(file_path);
diff --git a/media/audio/audio_debug_recording_helper_unittest.cc b/media/audio/audio_debug_recording_helper_unittest.cc index 9bd581d..816fe3b 100644 --- a/media/audio/audio_debug_recording_helper_unittest.cc +++ b/media/audio/audio_debug_recording_helper_unittest.cc
@@ -112,7 +112,7 @@ const AudioParameters& params, base::OnceClosure on_destruction_closure) { return std::make_unique<AudioDebugRecordingHelperUnderTest>( - params, scoped_task_environment_.GetMainThreadTaskRunner(), + params, task_environment_.GetMainThreadTaskRunner(), std::move(on_destruction_closure)); } @@ -146,7 +146,7 @@ const uint32_t id_ = 1; // The test task environment. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: DISALLOW_COPY_AND_ASSIGN(AudioDebugRecordingHelperTest);
diff --git a/media/audio/audio_debug_recording_manager_unittest.cc b/media/audio/audio_debug_recording_manager_unittest.cc index 014491b5..7f0156ad 100644 --- a/media/audio/audio_debug_recording_manager_unittest.cc +++ b/media/audio/audio_debug_recording_manager_unittest.cc
@@ -114,7 +114,7 @@ class AudioDebugRecordingManagerTest : public ::testing::Test { public: AudioDebugRecordingManagerTest() - : manager_(scoped_task_environment_.GetMainThreadTaskRunner()) {} + : manager_(task_environment_.GetMainThreadTaskRunner()) {} ~AudioDebugRecordingManagerTest() override = default; @@ -127,7 +127,7 @@ protected: // The test task environment. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; AudioDebugRecordingManagerUnderTest manager_;
diff --git a/media/audio/audio_debug_recording_session_impl_unittest.cc b/media/audio/audio_debug_recording_session_impl_unittest.cc index 4706798..4be916a 100644 --- a/media/audio/audio_debug_recording_session_impl_unittest.cc +++ b/media/audio/audio_debug_recording_session_impl_unittest.cc
@@ -125,7 +125,7 @@ CreateDebugRecordingSession(); // Wait for files to be created. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Check that expected files were created. base::FilePath input_recording_filename(GetFileName(kInput, kId));
diff --git a/media/audio/audio_debug_recording_test.h b/media/audio/audio_debug_recording_test.h index 4191b937..6c5aaad 100644 --- a/media/audio/audio_debug_recording_test.h +++ b/media/audio/audio_debug_recording_test.h
@@ -28,7 +28,7 @@ void ShutdownAudioManager(); void InitializeAudioDebugRecordingManager(); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockAudioManager> mock_audio_manager_; MockAudioDebugRecordingManager* mock_debug_recording_manager_;
diff --git a/media/audio/audio_input_controller_unittest.cc b/media/audio/audio_input_controller_unittest.cc index 00a3b5ab..6de9cc8 100644 --- a/media/audio/audio_input_controller_unittest.cc +++ b/media/audio/audio_input_controller_unittest.cc
@@ -144,7 +144,7 @@ run_loop.Run(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Parameterize tests to run AudioInputController either on audio thread // (synchronously), or on a different thread (non-blocking).
diff --git a/media/audio/audio_input_device_unittest.cc b/media/audio/audio_input_device_unittest.cc index 01fa2ad..52549ac 100644 --- a/media/audio/audio_input_device_unittest.cc +++ b/media/audio/audio_input_device_unittest.cc
@@ -117,7 +117,7 @@ shared_memory.region.Duplicate(); ASSERT_TRUE(duplicated_shared_memory_region.IsValid()); - base::test::ScopedTaskEnvironment ste; + base::test::TaskEnvironment ste; MockCaptureCallback callback; MockAudioInputIPC* input_ipc = new MockAudioInputIPC(); scoped_refptr<AudioInputDevice> device(new AudioInputDevice(
diff --git a/media/audio/audio_input_sync_writer_unittest.cc b/media/audio/audio_input_sync_writer_unittest.cc index c887c33..4055ff1 100644 --- a/media/audio/audio_input_sync_writer_unittest.cc +++ b/media/audio/audio_input_sync_writer_unittest.cc
@@ -155,7 +155,7 @@ using MockLogger = base::MockCallback<base::RepeatingCallback<void(const std::string&)>>; - base::test::ScopedTaskEnvironment env_; + base::test::TaskEnvironment env_; MockLogger mock_logger_; std::unique_ptr<AudioInputSyncWriter> writer_; MockCancelableSyncSocket* socket_;
diff --git a/media/audio/audio_low_latency_input_output_unittest.cc b/media/audio/audio_low_latency_input_output_unittest.cc index 4ed02ecc..bd566c1 100644 --- a/media/audio/audio_low_latency_input_output_unittest.cc +++ b/media/audio/audio_low_latency_input_output_unittest.cc
@@ -87,8 +87,8 @@ } private: - base::test::ScopedTaskEnvironment task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; std::unique_ptr<AudioManager> audio_manager_; DISALLOW_COPY_AND_ASSIGN(AudioLowLatencyInputOutputTest);
diff --git a/media/audio/audio_output_device_unittest.cc b/media/audio/audio_output_device_unittest.cc index e837992..7cad3bb 100644 --- a/media/audio/audio_output_device_unittest.cc +++ b/media/audio/audio_output_device_unittest.cc
@@ -109,8 +109,8 @@ MOCK_METHOD1(OnDeviceInfoReceived, void(OutputDeviceInfo)); protected: - base::test::ScopedTaskEnvironment task_env_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_env_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; AudioParameters default_audio_parameters_; StrictMock<MockRenderCallback> callback_; MockAudioOutputIPC* audio_output_ipc_; // owned by audio_device_
diff --git a/media/audio/audio_output_proxy_unittest.cc b/media/audio/audio_output_proxy_unittest.cc index e4ba36f..e84aa7d 100644 --- a/media/audio/audio_output_proxy_unittest.cc +++ b/media/audio/audio_output_proxy_unittest.cc
@@ -488,7 +488,7 @@ proxy->Close(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockAudioManager manager_; std::unique_ptr<AudioOutputDispatcherImpl> dispatcher_impl_; MockAudioSourceCallback callback_; @@ -511,7 +511,7 @@ void OnStart() override { // Let Start() run for a bit. base::RunLoop run_loop; - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromMilliseconds(kStartRunTimeMs)); run_loop.Run(); @@ -824,7 +824,7 @@ // Once all proxies have been closed, AudioOutputResampler will start the // reinitialization timer and execute it after the close delay elapses. base::RunLoop run_loop; - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromMilliseconds(2 * kTestCloseDelayMs)); run_loop.Run();
diff --git a/media/audio/audio_sync_reader_unittest.cc b/media/audio/audio_sync_reader_unittest.cc index f92eaba5..14cd595 100644 --- a/media/audio/audio_sync_reader_unittest.cc +++ b/media/audio/audio_sync_reader_unittest.cc
@@ -49,7 +49,7 @@ ~AudioSyncReaderBitstreamTest() override {} private: - base::test::ScopedTaskEnvironment env_; + base::test::TaskEnvironment env_; }; TEST_P(AudioSyncReaderBitstreamTest, BitstreamBufferOverflow_DoesNotWriteOOB) {
diff --git a/media/audio/audio_system_impl_unittest.cc b/media/audio/audio_system_impl_unittest.cc index cf85ff0..d5c2671 100644 --- a/media/audio/audio_system_impl_unittest.cc +++ b/media/audio/audio_system_impl_unittest.cc
@@ -35,7 +35,7 @@ MockAudioManager* audio_manager() { return audio_manager_.get(); } AudioSystem* audio_system() { return audio_system_.get(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockAudioManager> audio_manager_; std::unique_ptr<AudioSystem> audio_system_; // AudioSystemTester tester_;
diff --git a/media/audio/audio_thread_hang_monitor_unittest.cc b/media/audio/audio_thread_hang_monitor_unittest.cc index ac5b3de6..65bccf9 100644 --- a/media/audio/audio_thread_hang_monitor_unittest.cc +++ b/media/audio/audio_thread_hang_monitor_unittest.cc
@@ -38,13 +38,13 @@ class AudioThreadHangMonitorTest : public Test { public: AudioThreadHangMonitorTest() - : task_env_(base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_env_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), histograms_(), audio_thread_("Audio thread"), hang_monitor_({nullptr, base::OnTaskRunnerDeleter(nullptr)}) { CHECK(audio_thread_.Start()); // We must inject the main thread task runner as the hang monitor task - // runner since ScopedTaskEnvironment::FastForwardBy only works for the main + // runner since TaskEnvironment::FastForwardBy only works for the main // thread. hang_monitor_ = AudioThreadHangMonitor::Create( HangAction::kDoNothing, base::nullopt, task_env_.GetMockTickClock(), @@ -87,7 +87,7 @@ MOCK_METHOD0(HangActionTerminate, void()); base::WaitableEvent event_; - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; base::HistogramTester histograms_; base::Thread audio_thread_; AudioThreadHangMonitor::Ptr hang_monitor_;
diff --git a/media/audio/mac/audio_device_listener_mac_unittest.cc b/media/audio/mac/audio_device_listener_mac_unittest.cc index b222c593..93aa77c 100644 --- a/media/audio/mac/audio_device_listener_mac_unittest.cc +++ b/media/audio/mac/audio_device_listener_mac_unittest.cc
@@ -25,7 +25,7 @@ AudioDeviceListenerMacTest() { // It's important to create the device listener from the message loop in // order to ensure we don't end up with unbalanced TaskObserver calls. - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&AudioDeviceListenerMacTest::CreateDeviceListener, base::Unretained(this))); @@ -35,7 +35,7 @@ virtual ~AudioDeviceListenerMacTest() { // It's important to destroy the device listener from the message loop in // order to ensure we don't end up with unbalanced TaskObserver calls. - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&AudioDeviceListenerMacTest::DestroyDeviceListener, base::Unretained(this))); @@ -98,7 +98,7 @@ MOCK_METHOD0(OnDeviceChange, void()); protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<AudioDeviceListenerMac> device_listener_; DISALLOW_COPY_AND_ASSIGN(AudioDeviceListenerMacTest);
diff --git a/media/audio/mac/audio_low_latency_input_mac_unittest.cc b/media/audio/mac/audio_low_latency_input_mac_unittest.cc index 6f46b9f..3707bf14 100644 --- a/media/audio/mac/audio_low_latency_input_mac_unittest.cc +++ b/media/audio/mac/audio_low_latency_input_mac_unittest.cc
@@ -113,8 +113,7 @@ class MacAudioInputTest : public testing::Test { protected: MacAudioInputTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), audio_manager_(AudioManager::CreateForTesting( std::make_unique<TestAudioThread>())) { // Wait for the AudioManager to finish any initialization on the audio loop. @@ -159,7 +158,7 @@ void OnLogMessage(const std::string& message) { log_message_ = message; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<AudioManager> audio_manager_; std::string log_message_; }; @@ -219,7 +218,7 @@ EXPECT_CALL(sink, OnData(NotNull(), _, _)) .Times(AtLeast(10)) .WillRepeatedly(CheckCountAndPostQuitTask( - &count, 10, scoped_task_environment_.GetMainThreadTaskRunner(), + &count, 10, task_environment_.GetMainThreadTaskRunner(), run_loop.QuitClosure())); ais->Start(&sink); run_loop.Run(); @@ -255,7 +254,7 @@ EXPECT_CALL(sink, OnData(NotNull(), _, _)) .Times(AtLeast(10)) .WillRepeatedly(CheckCountAndPostQuitTask( - &count, 10, scoped_task_environment_.GetMainThreadTaskRunner(), + &count, 10, task_environment_.GetMainThreadTaskRunner(), run_loop.QuitClosure())); ais->Start(&sink); run_loop.Run();
diff --git a/media/audio/power_observer_helper_unittest.cc b/media/audio/power_observer_helper_unittest.cc index 5a1f0b4..4eafcbb 100644 --- a/media/audio/power_observer_helper_unittest.cc +++ b/media/audio/power_observer_helper_unittest.cc
@@ -102,7 +102,7 @@ } // The test task environment. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // The thread the helper is run on. base::Thread power_observer_helper_thread_;
diff --git a/media/audio/win/audio_low_latency_input_win_unittest.cc b/media/audio/win/audio_low_latency_input_win_unittest.cc index 3f8b8fca..6b5248c 100644 --- a/media/audio/win/audio_low_latency_input_win_unittest.cc +++ b/media/audio/win/audio_low_latency_input_win_unittest.cc
@@ -268,7 +268,7 @@ ~WinAudioInputTest() override { audio_manager_->Shutdown(); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<AudioManager> audio_manager_; }; @@ -414,7 +414,7 @@ EXPECT_CALL(sink, OnData(NotNull(), _, _)) .Times(AtLeast(10)) .WillRepeatedly(CheckCountAndPostQuitTask( - &count, 10, scoped_task_environment_.GetMainThreadTaskRunner(), + &count, 10, task_environment_.GetMainThreadTaskRunner(), run_loop.QuitWhenIdleClosure())); ais->Start(&sink); run_loop.Run(); @@ -439,7 +439,7 @@ EXPECT_CALL(sink, OnData(NotNull(), _, _)) .Times(AtLeast(10)) .WillRepeatedly(CheckCountAndPostQuitTask( - &count, 10, scoped_task_environment_.GetMainThreadTaskRunner(), + &count, 10, task_environment_.GetMainThreadTaskRunner(), run_loop.QuitWhenIdleClosure())); ais->Start(&sink); run_loop.Run(); @@ -460,7 +460,7 @@ EXPECT_CALL(sink, OnData(NotNull(), _, _)) .Times(AtLeast(10)) .WillRepeatedly(CheckCountAndPostQuitTask( - &count, 10, scoped_task_environment_.GetMainThreadTaskRunner(), + &count, 10, task_environment_.GetMainThreadTaskRunner(), run_loop.QuitWhenIdleClosure())); ais->Start(&sink); run_loop.Run();
diff --git a/media/audio/win/audio_output_win_unittest.cc b/media/audio/win/audio_output_win_unittest.cc index 07c7973..ef2fc6e 100644 --- a/media/audio/win/audio_output_win_unittest.cc +++ b/media/audio/win/audio_output_win_unittest.cc
@@ -164,7 +164,7 @@ ~WinAudioTest() override { audio_manager_->Shutdown(); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<AudioManager> audio_manager_; std::unique_ptr<AudioDeviceInfoAccessorForTests> audio_manager_device_info_; };
diff --git a/media/base/android/media_drm_bridge_unittest.cc b/media/base/android/media_drm_bridge_unittest.cc index 1083e5e..d19ddb0 100644 --- a/media/base/android/media_drm_bridge_unittest.cc +++ b/media/base/android/media_drm_bridge_unittest.cc
@@ -116,7 +116,7 @@ return std::make_unique<ProvisionFetcherWrapper>(this); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(MediaDrmBridgeTest, IsKeySystemSupported_Widevine) {
diff --git a/media/base/android/media_player_bridge_unittest.cc b/media/base/android/media_player_bridge_unittest.cc index 3766892d..7a513c4b 100644 --- a/media/base/android/media_player_bridge_unittest.cc +++ b/media/base/android/media_player_bridge_unittest.cc
@@ -46,7 +46,7 @@ void SimulatePlaybackCompleted() { bridge_.OnPlaybackComplete(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; StrictMock<MockMediaPlayerBridgeClient> client_; MediaPlayerBridge bridge_;
diff --git a/media/base/android/media_service_throttler_unittest.cc b/media/base/android/media_service_throttler_unittest.cc index 5b6f5f9..c65ad7b 100644 --- a/media/base/android/media_service_throttler_unittest.cc +++ b/media/base/android/media_service_throttler_unittest.cc
@@ -60,7 +60,7 @@ scoped_refptr<FakeSingleThreadTaskRunner> test_task_runner_; // Necessary, or else base::ThreadTaskRunnerHandle::Get() fails. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: DISALLOW_COPY_AND_ASSIGN(MediaServiceThrottlerTest);
diff --git a/media/base/audio_renderer_mixer_input_unittest.cc b/media/base/audio_renderer_mixer_input_unittest.cc index e1606f9..a98d4681 100644 --- a/media/base/audio_renderer_mixer_input_unittest.cc +++ b/media/base/audio_renderer_mixer_input_unittest.cc
@@ -53,7 +53,7 @@ mixer_input_ = new AudioRendererMixerInput(this, kRenderFrameId, device_id, AudioLatency::LATENCY_PLAYBACK); mixer_input_->GetOutputDeviceInfoAsync(base::DoNothing()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } AudioRendererMixer* GetMixer(int owner_id, @@ -109,7 +109,7 @@ protected: ~AudioRendererMixerInputTest() override = default; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; AudioParameters audio_parameters_; std::unique_ptr<AudioRendererMixer> mixers_[2]; scoped_refptr<AudioRendererMixerInput> mixer_input_; @@ -166,7 +166,7 @@ mixer_input_->Stop(); mixer_input_->GetOutputDeviceInfoAsync(base::DoNothing()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); mixer_input_->Start(); mixer_input_->Stop(); } @@ -178,7 +178,7 @@ mixer_input_->Stop(); mixer_input_->GetOutputDeviceInfoAsync(base::DoNothing()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); mixer_input_->Initialize(audio_parameters_, fake_callback_.get()); mixer_input_->Stop(); } @@ -363,7 +363,7 @@ EXPECT_CALL(*this, OnDeviceInfoReceived(_)) .WillOnce(testing::SaveArg<0>(&info)); EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_OK)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(kExpectedStatus, info.device_status()); EXPECT_EQ(kDefaultDeviceId, info.device_id()); } @@ -394,7 +394,7 @@ constexpr auto kExpectedStatus = OUTPUT_DEVICE_STATUS_OK; EXPECT_CALL(*this, OnDeviceInfoReceived(_)) .WillOnce(testing::SaveArg<0>(&info)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(kExpectedStatus, info.device_status()); EXPECT_EQ(kAnotherDeviceId, info.device_id()); } @@ -426,7 +426,7 @@ constexpr auto kExpectedStatus = OUTPUT_DEVICE_STATUS_OK; EXPECT_CALL(*this, OnDeviceInfoReceived(_)) .WillOnce(testing::SaveArg<0>(&info)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(kExpectedStatus, info.device_status()); EXPECT_EQ(kDefaultDeviceId, info.device_id()); }
diff --git a/media/base/audio_renderer_mixer_unittest.cc b/media/base/audio_renderer_mixer_unittest.cc index 6cb998e..4866def 100644 --- a/media/base/audio_renderer_mixer_unittest.cc +++ b/media/base/audio_renderer_mixer_unittest.cc
@@ -351,7 +351,7 @@ protected: virtual ~AudioRendererMixerTest() = default; - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; scoped_refptr<MockAudioRendererSink> sink_; std::unique_ptr<AudioRendererMixer> mixer_; AudioRendererSink::RenderCallback* mixer_callback_;
diff --git a/media/base/bind_to_current_loop_unittest.cc b/media/base/bind_to_current_loop_unittest.cc index 1a750bb..d826ae19 100644 --- a/media/base/bind_to_current_loop_unittest.cc +++ b/media/base/bind_to_current_loop_unittest.cc
@@ -61,7 +61,7 @@ // on the message loop, not during the original Run. class BindToCurrentLoopTest : public ::testing::Test { protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(BindToCurrentLoopTest, RepeatingClosure) {
diff --git a/media/base/callback_registry_unittest.cc b/media/base/callback_registry_unittest.cc index 6c1ff1e..202511d4 100644 --- a/media/base/callback_registry_unittest.cc +++ b/media/base/callback_registry_unittest.cc
@@ -20,7 +20,7 @@ class CallbackRegistryTest : public testing::Test { protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(CallbackRegistryTest, RegisterWithNoParam) { @@ -32,7 +32,7 @@ EXPECT_CALL(callback, Run()); registry.Notify(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CallbackRegistryTest, RegisterWithOneParam) { @@ -44,7 +44,7 @@ EXPECT_CALL(callback, Run(1)); registry.Notify(1); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CallbackRegistryTest, RegisterWithTwoParams) { @@ -56,7 +56,7 @@ EXPECT_CALL(callback, Run(1, 2)); registry.Notify(1, 2); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CallbackRegistryTest, RegisterWithMoveOnlyParam) { @@ -69,7 +69,7 @@ EXPECT_CALL(callback, Run(_)); registry.Notify(std::make_unique<int>(1)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CallbackRegistryTest, RegisterWithPointerParam) { @@ -81,7 +81,7 @@ EXPECT_CALL(callback, Run(IsNull())); registry.Notify(nullptr); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CallbackRegistryTest, RegisterWithReferenceParam) { @@ -94,7 +94,7 @@ int i = 1; EXPECT_CALL(callback, Run(i)); registry.Notify(i); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CallbackRegistryTest, RegisterAfterNotify) { @@ -106,7 +106,7 @@ EXPECT_CALL(callback_1, Run()); registry.Notify(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::MockCallback<base::RepeatingClosure> callback_2; auto registration_2 = registry.Register(callback_2.Get()); @@ -115,7 +115,7 @@ EXPECT_CALL(callback_1, Run()); EXPECT_CALL(callback_2, Run()); registry.Notify(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CallbackRegistryTest, EmptyRegistry) { @@ -136,16 +136,16 @@ EXPECT_CALL(callback_1, Run()); EXPECT_CALL(callback_2, Run()); registry.Notify(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); registration_1.reset(); EXPECT_CALL(callback_2, Run()); registry.Notify(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); registration_2.reset(); registry.Notify(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(CallbackRegistryTest, RegisterDuringNotification) { @@ -162,13 +162,13 @@ registration_2 = registry.Register(callback_2.Get()); })); registry.Notify(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(registration_2); EXPECT_CALL(callback_1, Run()); EXPECT_CALL(callback_2, Run()); registry.Notify(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } // namespace
diff --git a/media/base/fake_audio_worker_unittest.cc b/media/base/fake_audio_worker_unittest.cc index 11569f08..6cffce0e 100644 --- a/media/base/fake_audio_worker_unittest.cc +++ b/media/base/fake_audio_worker_unittest.cc
@@ -34,8 +34,7 @@ public: FakeAudioWorkerTest() : params_(AudioParameters::AUDIO_FAKE, CHANNEL_LAYOUT_STEREO, 44100, 128), - fake_worker_(scoped_task_environment_.GetMainThreadTaskRunner(), - params_) { + fake_worker_(task_environment_.GetMainThreadTaskRunner(), params_) { time_between_callbacks_ = base::TimeDelta::FromMicroseconds( params_.frames_per_buffer() * base::Time::kMicrosecondsPerSecond / static_cast<float>(params_.sample_rate())); @@ -84,12 +83,12 @@ } scoped_refptr<base::SingleThreadTaskRunner> TaskRunner() { - return scoped_task_environment_.GetMainThreadTaskRunner(); + return task_environment_.GetMainThreadTaskRunner(); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; AudioParameters params_; FakeAudioWorker fake_worker_; base::TimeDelta time_between_callbacks_; @@ -111,10 +110,10 @@ // PostTaskAndReply because we want to end_test after run_on_audio_thread is // finished. This is because RunOnAudioThread may post other tasks which // should run before we end_test. - scoped_task_environment_.GetMainThreadTaskRunner()->PostTaskAndReply( + task_environment_.GetMainThreadTaskRunner()->PostTaskAndReply( FROM_HERE, std::move(run_on_audio_thread), std::move(end_test)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_THAT(callbacks_, SizeIs(1)); } @@ -125,7 +124,7 @@ FROM_HERE, base::BindOnce(&FakeAudioWorkerTest::TimeCallbacksOnAudioThread, base::Unretained(this), kTestCallbacks)); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_THAT(callbacks_, SizeIs(Eq(kTestCallbacks))); @@ -156,13 +155,13 @@ // Issuing a Stop() / Start() in the middle of the callback period should not // trigger a callback. - scoped_task_environment_.FastForwardBy(time_between_callbacks_ / 2); + task_environment_.FastForwardBy(time_between_callbacks_ / 2); EXPECT_THAT(callbacks_, SizeIs(1)); TaskRunner()->PostTask( FROM_HERE, base::BindOnce(&FakeAudioWorkerTest::StopStartOnAudioThread, base::Unretained(this))); - scoped_task_environment_.FastForwardBy(time_between_callbacks_); + task_environment_.FastForwardBy(time_between_callbacks_); // We expect 3 callbacks: First Start(), Second Start(), and one for the // period. If the first callback was not cancelled, we would get 4 callbacks, // two on the first period. @@ -171,7 +170,7 @@ base::BindOnce(&FakeAudioWorkerTest::EndTest, base::Unretained(this))); // EndTest() will ensure the proper number of callbacks have occurred. - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_THAT(callbacks_, SizeIs(3)); }
diff --git a/media/base/fake_demuxer_stream_unittest.cc b/media/base/fake_demuxer_stream_unittest.cc index b9a077a..ccd3d10 100644 --- a/media/base/fake_demuxer_stream_unittest.cc +++ b/media/base/fake_demuxer_stream_unittest.cc
@@ -180,7 +180,7 @@ ReadAllBuffers(num_configs, num_buffers_in_one_config); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakeDemuxerStream> stream_; DemuxerStream::Status status_;
diff --git a/media/base/fallback_video_decoder_unittest.cc b/media/base/fallback_video_decoder_unittest.cc index e168be02..edb35a5 100644 --- a/media/base/fallback_video_decoder_unittest.cc +++ b/media/base/fallback_video_decoder_unittest.cc
@@ -72,7 +72,7 @@ bool PreferredShouldSucceed() { return GetParam(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; StrictMock<MockVideoDecoder>* backup_decoder_; StrictMock<MockVideoDecoder>* preferred_decoder_;
diff --git a/media/base/media_url_demuxer_unittest.cc b/media/base/media_url_demuxer_unittest.cc index 56a8bb0..6021a7f3 100644 --- a/media/base/media_url_demuxer_unittest.cc +++ b/media/base/media_url_demuxer_unittest.cc
@@ -42,7 +42,7 @@ std::unique_ptr<Demuxer> demuxer_; // Necessary, or else base::ThreadTaskRunnerHandle::Get() fails. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: DISALLOW_COPY_AND_ASSIGN(MediaUrlDemuxerTest);
diff --git a/media/base/null_video_sink_unittest.cc b/media/base/null_video_sink_unittest.cc index ce91e58..903767a7 100644 --- a/media/base/null_video_sink_unittest.cc +++ b/media/base/null_video_sink_unittest.cc
@@ -37,7 +37,7 @@ std::unique_ptr<NullVideoSink> new_sink(new NullVideoSink( clockless, interval, base::Bind(&NullVideoSinkTest::FrameReceived, base::Unretained(this)), - scoped_task_environment_.GetMainThreadTaskRunner())); + task_environment_.GetMainThreadTaskRunner())); new_sink->set_tick_clock_for_testing(&tick_clock_); return new_sink; } @@ -62,7 +62,7 @@ MOCK_METHOD1(FrameReceived, void(scoped_refptr<VideoFrame>)); protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::SimpleTestTickClock tick_clock_; DISALLOW_COPY_AND_ASSIGN(NullVideoSinkTest);
diff --git a/media/base/pipeline_impl_unittest.cc b/media/base/pipeline_impl_unittest.cc index bb015f5..6a12b93 100644 --- a/media/base/pipeline_impl_unittest.cc +++ b/media/base/pipeline_impl_unittest.cc
@@ -103,10 +103,9 @@ }; PipelineImplTest() - : pipeline_( - new PipelineImpl(scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner(), - &media_log_)), + : pipeline_(new PipelineImpl(task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), + &media_log_)), demuxer_(new StrictMock<MockDemuxer>()), demuxer_host_(nullptr), scoped_renderer_(new StrictMock<MockRenderer>()), @@ -329,7 +328,7 @@ // Fixture members. StrictMock<CallbackHelper> callbacks_; base::SimpleTestTickClock test_tick_clock_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NullMediaLog media_log_; std::unique_ptr<PipelineImpl> pipeline_; @@ -718,10 +717,9 @@ // Invoked function OnError. This asserts that the pipeline does not enqueue // non-teardown related tasks while tearing down. -static void TestNoCallsAfterError( - PipelineImpl* pipeline, - base::test::ScopedTaskEnvironment* task_environment, - PipelineStatus /* status */) { +static void TestNoCallsAfterError(PipelineImpl* pipeline, + base::test::TaskEnvironment* task_environment, + PipelineStatus /* status */) { CHECK(pipeline); CHECK(task_environment); @@ -746,8 +744,8 @@ StartPipelineAndExpect(PIPELINE_OK); // Trigger additional requests on the pipeline during tear down from error. - base::Callback<void(PipelineStatus)> cb = base::Bind( - &TestNoCallsAfterError, pipeline_.get(), &scoped_task_environment_); + base::Callback<void(PipelineStatus)> cb = + base::Bind(&TestNoCallsAfterError, pipeline_.get(), &task_environment_); ON_CALL(callbacks_, OnError(_)).WillByDefault(Invoke(CreateFunctor(cb))); base::TimeDelta seek_time = base::TimeDelta::FromSeconds(5);
diff --git a/media/base/serial_runner_unittest.cc b/media/base/serial_runner_unittest.cc index 354f8f8..fad28779 100644 --- a/media/base/serial_runner_unittest.cc +++ b/media/base/serial_runner_unittest.cc
@@ -24,7 +24,7 @@ ~SerialRunnerTest() override = default; void RunSerialRunner() { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&SerialRunnerTest::StartRunnerInternal, base::Unretained(this), bound_fns_)); base::RunLoop().RunUntilIdle(); @@ -119,7 +119,7 @@ void CancelSerialRunner(const PipelineStatusCB& status_cb) { // Tasks run by |runner_| shouldn't reset it, hence we post a task to do so. - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&SerialRunnerTest::ResetSerialRunner, base::Unretained(this))); status_cb.Run(PIPELINE_OK); @@ -129,7 +129,7 @@ runner_.reset(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; SerialRunner::Queue bound_fns_; std::unique_ptr<SerialRunner> runner_;
diff --git a/media/base/text_renderer_unittest.cc b/media/base/text_renderer_unittest.cc index dd0df32..126bfc6 100644 --- a/media/base/text_renderer_unittest.cc +++ b/media/base/text_renderer_unittest.cc
@@ -55,7 +55,7 @@ DCHECK(!text_renderer_); text_renderer_.reset(new TextRenderer( - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), base::Bind(&TextRendererTest::OnAddTextTrack, base::Unretained(this)))); text_renderer_->Initialize( base::Bind(&TextRendererTest::OnEnd, base::Unretained(this))); @@ -190,7 +190,7 @@ MOCK_METHOD0(OnPause, void()); MOCK_METHOD0(OnFlush, void()); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; typedef std::vector<std::unique_ptr<FakeTextTrackStream>> TextTrackStreams; TextTrackStreams text_track_streams_; @@ -206,7 +206,7 @@ TEST_F(TextRendererTest, CreateTextRendererNoInit) { text_renderer_.reset(new TextRenderer( - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), base::Bind(&TextRendererTest::OnAddTextTrack, base::Unretained(this)))); text_renderer_.reset(); }
diff --git a/media/base/user_input_monitor_unittest.cc b/media/base/user_input_monitor_unittest.cc index f174daff..e7ac3a7 100644 --- a/media/base/user_input_monitor_unittest.cc +++ b/media/base/user_input_monitor_unittest.cc
@@ -21,11 +21,11 @@ TEST(UserInputMonitorTest, CreatePlatformSpecific) { #if defined(OS_LINUX) - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); #else - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); #endif // defined(OS_LINUX) std::unique_ptr<UserInputMonitor> monitor = UserInputMonitor::Create( @@ -43,11 +43,11 @@ TEST(UserInputMonitorTest, CreatePlatformSpecificWithMapping) { #if defined(OS_LINUX) - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); #else - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); #endif // defined(OS_LINUX) std::unique_ptr<UserInputMonitor> monitor = UserInputMonitor::Create(
diff --git a/media/base/video_thumbnail_decoder_unittest.cc b/media/base/video_thumbnail_decoder_unittest.cc index c36cfe4..789f858 100644 --- a/media/base/video_thumbnail_decoder_unittest.cc +++ b/media/base/video_thumbnail_decoder_unittest.cc
@@ -69,7 +69,7 @@ frame_ = std::move(frame); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockVideoDecoder* mock_video_decoder_; std::unique_ptr<VideoThumbnailDecoder> thumbnail_decoder_;
diff --git a/media/blink/run_all_unittests.cc b/media/blink/run_all_unittests.cc index 1e61f7d4c..b54d456 100644 --- a/media/blink/run_all_unittests.cc +++ b/media/blink/run_all_unittests.cc
@@ -34,7 +34,7 @@ #endif // defined(V8_USE_EXTERNAL_STARTUP_DATA) // We must use a custom blink::Platform that ensures the main thread scheduler -// knows about the ScopedTaskEnvironment. +// knows about the TaskEnvironment. class BlinkPlatformWithTaskEnvironment : public blink::Platform { public: BlinkPlatformWithTaskEnvironment() @@ -51,7 +51,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<blink::scheduler::WebThreadScheduler> main_thread_scheduler_; DISALLOW_COPY_AND_ASSIGN(BlinkPlatformWithTaskEnvironment);
diff --git a/media/blink/webmediaplayer_impl_unittest.cc b/media/blink/webmediaplayer_impl_unittest.cc index eaa6dae..43ba3b5 100644 --- a/media/blink/webmediaplayer_impl_unittest.cc +++ b/media/blink/webmediaplayer_impl_unittest.cc
@@ -659,7 +659,7 @@ // This runs until we reach the |ready_state_|. Attempting to wait for ready // states < kReadyStateHaveCurrentData in non-startup-suspend test cases is // unreliable due to asynchronous execution of tasks on the - // base::test:ScopedTaskEnvironment. + // base::test:TaskEnvironment. void LoadAndWaitForReadyState(std::string data_file, blink::WebMediaPlayer::ReadyState ready_state) { Load(data_file); @@ -839,7 +839,7 @@ // This runs until we reach the have current data state. Attempting to wait // for states < kReadyStateHaveCurrentData is unreliable due to asynchronous - // execution of tasks on the base::test:ScopedTaskEnvironment. + // execution of tasks on the base::test:TaskEnvironment. while (wmpi_->GetReadyState() < blink::WebMediaPlayer::kReadyStateHaveCurrentData) { base::RunLoop loop;
diff --git a/media/capabilities/in_memory_video_decode_stats_db_unittest.cc b/media/capabilities/in_memory_video_decode_stats_db_unittest.cc index 33be8b42..05c880a40 100644 --- a/media/capabilities/in_memory_video_decode_stats_db_unittest.cc +++ b/media/capabilities/in_memory_video_decode_stats_db_unittest.cc
@@ -86,7 +86,7 @@ in_memory_db_->Initialize(base::BindOnce(&InMemoryDBTestBase::InitializeCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } MOCK_METHOD1(InitializeCB, void(bool success)); @@ -101,7 +101,7 @@ using VideoDescKey = media::VideoDecodeStatsDB::VideoDescKey; using DecodeStatsEntry = media::VideoDecodeStatsDB::DecodeStatsEntry; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockSeedDB> seed_db_; std::unique_ptr<MockDBProvider> db_provider_; std::unique_ptr<InMemoryVideoDecodeStatsDBImpl> in_memory_db_; @@ -122,7 +122,7 @@ kTestKey(), base::BindOnce(&InMemoryDBTestBase::GetDecodeStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(SeededInMemoryDBTest, ReadExpectingEmpty) { @@ -141,7 +141,7 @@ kTestKey(), base::BindOnce(&InMemoryDBTestBase::GetDecodeStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(SeededInMemoryDBTest, ReadExpectingSeedData) { @@ -163,7 +163,7 @@ kTestKey(), base::BindOnce(&InMemoryDBTestBase::GetDecodeStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ::testing::Mock::VerifyAndClear(this); // Verify a second GetDecodeStats() call with the same key does not trigger a @@ -174,7 +174,7 @@ kTestKey(), base::BindOnce(&InMemoryDBTestBase::GetDecodeStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(SeededInMemoryDBTest, AppendReadAndClear) { @@ -202,7 +202,7 @@ base::BindOnce(&InMemoryDBTestBase::AppendDecodeStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ::testing::Mock::VerifyAndClear(this); // Seed DB should not be queried again for this key. @@ -214,7 +214,7 @@ kTestKey(), base::BindOnce(&InMemoryDBTestBase::GetDecodeStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ::testing::Mock::VerifyAndClear(this); // Append the same seed entry again to triple the stats. Additional appends @@ -236,7 +236,7 @@ in_memory_db_->ClearStats(base::BindOnce(&InMemoryDBTestBase::ClearStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ::testing::Mock::VerifyAndClear(this); // With in-memory stats now gone, GetDecodeStats(kTestKey()) should again @@ -247,7 +247,7 @@ kTestKey(), base::BindOnce(&InMemoryDBTestBase::GetDecodeStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(SeedlessInMemoryDBTest, AppendReadAndClear) { @@ -269,7 +269,7 @@ kTestKey(), base::BindOnce(&InMemoryDBTestBase::GetDecodeStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ::testing::Mock::VerifyAndClear(this); // Append same stats again to test summation. @@ -285,7 +285,7 @@ kTestKey(), base::BindOnce(&InMemoryDBTestBase::GetDecodeStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ::testing::Mock::VerifyAndClear(this); // Now destroy the in-memory stats... @@ -293,7 +293,7 @@ in_memory_db_->ClearStats(base::BindOnce(&InMemoryDBTestBase::ClearStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ::testing::Mock::VerifyAndClear(this); // Verify DB now empty for this key. @@ -302,7 +302,7 @@ kTestKey(), base::BindOnce(&InMemoryDBTestBase::GetDecodeStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(SeededInMemoryDBTest, ProvidedNullSeedDB) { @@ -316,7 +316,7 @@ in_memory_db_->Initialize(base::BindOnce(&InMemoryDBTestBase::InitializeCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ::testing::Mock::VerifyAndClear(this); // Writes still succeed. @@ -333,7 +333,7 @@ kTestKey(), base::BindOnce(&InMemoryDBTestBase::GetDecodeStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(SeededInMemoryDBTest, SeedReadFailureOnGettingStats) { @@ -354,7 +354,7 @@ kTestKey(), base::BindOnce(&InMemoryDBTestBase::GetDecodeStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(SeededInMemoryDBTest, SeedReadFailureOnAppendingingStats) { @@ -377,7 +377,7 @@ base::BindOnce(&InMemoryDBTestBase::AppendDecodeStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ::testing::Mock::VerifyAndClear(this); // Reading the appended data works without issue and does not trigger new @@ -388,7 +388,7 @@ kTestKey(), base::BindOnce(&InMemoryDBTestBase::GetDecodeStatsCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(SeededInMemoryDBTest, SeedDBTearDownRace) {
diff --git a/media/capabilities/video_decode_stats_db_impl_unittest.cc b/media/capabilities/video_decode_stats_db_impl_unittest.cc index 003ba18d8..88ccb33c 100644 --- a/media/capabilities/video_decode_stats_db_impl_unittest.cc +++ b/media/capabilities/video_decode_stats_db_impl_unittest.cc
@@ -157,7 +157,7 @@ MOCK_METHOD0(MockClearStatsCb, void()); protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const VideoDescKey kStatsKeyVp9; const VideoDescKey kStatsKeyAvc;
diff --git a/media/capture/video/chromeos/camera_device_delegate_unittest.cc b/media/capture/video/chromeos/camera_device_delegate_unittest.cc index 8085aab5..6b5e6b5 100644 --- a/media/capture/video/chromeos/camera_device_delegate_unittest.cc +++ b/media/capture/video/chromeos/camera_device_delegate_unittest.cc
@@ -462,7 +462,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<CameraHalDelegate> camera_hal_delegate_; std::unique_ptr<CameraDeviceDelegate> camera_device_delegate_;
diff --git a/media/capture/video/chromeos/camera_hal_delegate_unittest.cc b/media/capture/video/chromeos/camera_hal_delegate_unittest.cc index 7c38d0ac..32c0dad 100644 --- a/media/capture/video/chromeos/camera_hal_delegate_unittest.cc +++ b/media/capture/video/chromeos/camera_hal_delegate_unittest.cc
@@ -59,7 +59,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<CameraHalDelegate> camera_hal_delegate_; testing::StrictMock<unittest_internal::MockCameraModule> mock_camera_module_; testing::StrictMock<unittest_internal::MockVendorTagOps> mock_vendor_tag_ops_;
diff --git a/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc b/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc index e3ec27c..5e3bfae0 100644 --- a/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc +++ b/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc
@@ -122,7 +122,7 @@ CameraHalDispatcherImpl* dispatcher_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; DISALLOW_COPY_AND_ASSIGN(CameraHalDispatcherImplTest); };
diff --git a/media/capture/video/chromeos/request_manager_unittest.cc b/media/capture/video/chromeos/request_manager_unittest.cc index 560e3ce..0d84420 100644 --- a/media/capture/video/chromeos/request_manager_unittest.cc +++ b/media/capture/video/chromeos/request_manager_unittest.cc
@@ -280,7 +280,7 @@ private: std::unique_ptr<base::RunLoop> run_loop_; bool quit_; - base::test::ScopedTaskEnvironment scoped_test_environment_; + base::test::TaskEnvironment scoped_test_environment_; }; // A basic sanity test to capture one frame with the capture loop.
diff --git a/media/capture/video/fake_video_capture_device_unittest.cc b/media/capture/video/fake_video_capture_device_unittest.cc index f79012e4..4a3c5a6 100644 --- a/media/capture/video/fake_video_capture_device_unittest.cc +++ b/media/capture/video/fake_video_capture_device_unittest.cc
@@ -202,7 +202,7 @@ const VideoCaptureFormat& last_format() const { return last_format_; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<VideoCaptureDeviceDescriptors> descriptors_; std::unique_ptr<base::RunLoop> run_loop_; std::unique_ptr<MockVideoCaptureDeviceClient> client_;
diff --git a/media/capture/video/file_video_capture_device_unittest.cc b/media/capture/video/file_video_capture_device_unittest.cc index c32d147..6bb89f0f 100644 --- a/media/capture/video/file_video_capture_device_unittest.cc +++ b/media/capture/video/file_video_capture_device_unittest.cc
@@ -67,7 +67,7 @@ MockImageCaptureClient image_capture_client_; std::unique_ptr<VideoCaptureDevice> device_; VideoCaptureFormat last_format_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(FileVideoCaptureDeviceTest, GetPhotoState) {
diff --git a/media/capture/video/linux/v4l2_capture_delegate_unittest.cc b/media/capture/video/linux/v4l2_capture_delegate_unittest.cc index 23ad2c0..79edc7bf 100644 --- a/media/capture/video/linux/v4l2_capture_delegate_unittest.cc +++ b/media/capture/video/linux/v4l2_capture_delegate_unittest.cc
@@ -186,7 +186,7 @@ 0)) {} ~V4L2CaptureDelegateTest() override = default; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; VideoCaptureDeviceDescriptor device_descriptor_; scoped_refptr<V4L2CaptureDevice> v4l2_; std::unique_ptr<V4L2CaptureDelegate> delegate_;
diff --git a/media/capture/video/linux/video_capture_device_factory_linux_unittest.cc b/media/capture/video/linux/video_capture_device_factory_linux_unittest.cc index eecb165..483040599 100644 --- a/media/capture/video/linux/video_capture_device_factory_linux_unittest.cc +++ b/media/capture/video/linux/video_capture_device_factory_linux_unittest.cc
@@ -82,7 +82,7 @@ std::move(fake_device_provider)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeV4L2Impl* fake_v4l2_; DescriptorDeviceProvider* fake_device_provider_; std::unique_ptr<VideoCaptureDeviceFactoryLinux> factory_;
diff --git a/media/capture/video/mac/video_capture_device_factory_mac_unittest.mm b/media/capture/video/mac/video_capture_device_factory_mac_unittest.mm index ca95f53..3ad52f9e 100644 --- a/media/capture/video/mac/video_capture_device_factory_mac_unittest.mm +++ b/media/capture/video/mac/video_capture_device_factory_mac_unittest.mm
@@ -17,8 +17,8 @@ // required, because on MacOS the capture code must run on a CFRunLoop // enabled message loop. void RunTestCase(base::OnceClosure test_case) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); base::RunLoop run_loop; base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(
diff --git a/media/capture/video/video_capture_device_unittest.cc b/media/capture/video/video_capture_device_unittest.cc index 72a28aa..5a6ddd7 100644 --- a/media/capture/video/video_capture_device_unittest.cc +++ b/media/capture/video/video_capture_device_unittest.cc
@@ -250,8 +250,7 @@ #if defined(OS_MACOSX) // Video capture code on MacOSX must run on a CFRunLoop enabled thread // for interaction with AVFoundation. - scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + task_environment_(base::test::TaskEnvironment::MainThreadType::UI), #endif device_descriptors_(new VideoCaptureDeviceDescriptors()), main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), @@ -462,7 +461,7 @@ #if defined(OS_WIN) base::win::ScopedCOMInitializer initialize_com_; #endif - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<VideoCaptureDeviceDescriptors> device_descriptors_; std::unique_ptr<base::RunLoop> run_loop_; scoped_refptr<base::TaskRunner> main_thread_task_runner_;
diff --git a/media/cast/net/udp_packet_pipe_unittest.cc b/media/cast/net/udp_packet_pipe_unittest.cc index 1bdae8a..68a15dd3 100644 --- a/media/cast/net/udp_packet_pipe_unittest.cc +++ b/media/cast/net/udp_packet_pipe_unittest.cc
@@ -39,7 +39,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<UdpPacketPipeWriter> writer_; std::unique_ptr<UdpPacketPipeReader> reader_; base::circular_deque<std::unique_ptr<Packet>> packets_read_; @@ -59,7 +59,7 @@ EXPECT_CALL(done_callback, Run()).Times(1); writer_->Write(new base::RefCountedData<Packet>(packet1), done_callback.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // |packet2| can not be completely written in the data pipe due to capacity // limit. @@ -67,7 +67,7 @@ EXPECT_CALL(done_callback2, Run()).Times(0); writer_->Write(new base::RefCountedData<Packet>(packet2), done_callback2.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); testing::Mock::VerifyAndClearExpectations(&done_callback2); EXPECT_TRUE(packets_read_.empty()); @@ -75,7 +75,7 @@ EXPECT_CALL(done_callback2, Run()).Times(1); reader_->Read( base::BindOnce(&UdpPacketPipeTest::OnPacketRead, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1u, packets_read_.size()); EXPECT_EQ(0, std::memcmp(packet1.data(), packets_read_.front()->data(), packet1.size())); @@ -84,7 +84,7 @@ // Reads |packet2| from the pipe. reader_->Read( base::BindOnce(&UdpPacketPipeTest::OnPacketRead, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1u, packets_read_.size()); EXPECT_EQ(0, std::memcmp(packet2.data(), packets_read_.front()->data(), packet2.size()));
diff --git a/media/cast/net/udp_transport_unittest.cc b/media/cast/net/udp_transport_unittest.cc index 50775a4..b3ce0e5 100644 --- a/media/cast/net/udp_transport_unittest.cc +++ b/media/cast/net/udp_transport_unittest.cc
@@ -71,18 +71,17 @@ class UdpTransportImplTest : public ::testing::Test { public: UdpTransportImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { net::IPEndPoint free_local_port1 = test::GetFreeLocalPort(); net::IPEndPoint free_local_port2 = test::GetFreeLocalPort(); send_transport_ = std::make_unique<UdpTransportImpl>( - scoped_task_environment_.GetMainThreadTaskRunner(), free_local_port1, + task_environment_.GetMainThreadTaskRunner(), free_local_port1, free_local_port2, base::BindRepeating(&UpdateCastTransportStatus)); send_transport_->SetSendBufferSize(65536); recv_transport_ = std::make_unique<UdpTransportImpl>( - scoped_task_environment_.GetMainThreadTaskRunner(), free_local_port2, + task_environment_.GetMainThreadTaskRunner(), free_local_port2, free_local_port1, base::BindRepeating(&UpdateCastTransportStatus)); recv_transport_->SetSendBufferSize(65536); } @@ -90,7 +89,7 @@ ~UdpTransportImplTest() override = default; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<UdpTransportImpl> send_transport_;
diff --git a/media/cast/sender/h264_vt_encoder_unittest.cc b/media/cast/sender/h264_vt_encoder_unittest.cc index db064be..d902b45f 100644 --- a/media/cast/sender/h264_vt_encoder_unittest.cc +++ b/media/cast/sender/h264_vt_encoder_unittest.cc
@@ -215,9 +215,9 @@ std::unique_ptr<TestPowerSource>(power_source_)); cast_environment_ = new CastEnvironment( - &clock_, scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner()); + &clock_, task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner()); encoder_.reset(new H264VideoToolboxEncoder( cast_environment_, video_sender_config_, base::Bind(&SaveOperationalStatus, &operational_status_))); @@ -253,7 +253,7 @@ static FrameSenderConfig video_sender_config_; base::SimpleTestTickClock clock_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<CastEnvironment> cast_environment_; std::unique_ptr<VideoEncoder> encoder_; OperationalStatus operational_status_;
diff --git a/media/cast/test/end2end_unittest.cc b/media/cast/test/end2end_unittest.cc index bf67267..e2b20fec 100644 --- a/media/cast/test/end2end_unittest.cc +++ b/media/cast/test/end2end_unittest.cc
@@ -879,7 +879,7 @@ std::vector<std::pair<base::TimeTicks, base::TimeTicks> > video_ticks_; // |transport_sender_| has a RepeatingTimer which needs a MessageLoop. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; namespace {
diff --git a/media/cast/test/utility/tap_proxy.cc b/media/cast/test/utility/tap_proxy.cc index c1f50c7..5350caaf 100644 --- a/media/cast/test/utility/tap_proxy.cc +++ b/media/cast/test/utility/tap_proxy.cc
@@ -304,8 +304,8 @@ int fd1 = tun_alloc(argv[1], IFF_TAP); int fd2 = tun_alloc(argv[2], IFF_TAP); - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); last_printout = base::TimeTicks::Now(); media::cast::test::QueueManager qm1(fd1, fd2, std::move(in_pipe)); media::cast::test::QueueManager qm2(fd2, fd1, std::move(out_pipe));
diff --git a/media/cdm/aes_decryptor_unittest.cc b/media/cdm/aes_decryptor_unittest.cc index 0664e40..9169d544 100644 --- a/media/cdm/aes_decryptor_unittest.cc +++ b/media/cdm/aes_decryptor_unittest.cc
@@ -493,7 +493,7 @@ } // Must be the first member to be initialized first and destroyed last. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; StrictMock<MockCdmClient> cdm_client_; scoped_refptr<ContentDecryptionModule> cdm_;
diff --git a/media/cdm/cdm_adapter_unittest.cc b/media/cdm/cdm_adapter_unittest.cc index 39f4b7e..eb3f451 100644 --- a/media/cdm/cdm_adapter_unittest.cc +++ b/media/cdm/cdm_adapter_unittest.cc
@@ -177,7 +177,7 @@ } } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } StrictMock<MockCdmClient> cdm_client_; StrictMock<MockCdmAuxiliaryHelper>* cdm_helper_ = nullptr; @@ -185,7 +185,7 @@ // Keep track of the loaded CDM. scoped_refptr<ContentDecryptionModule> cdm_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: DISALLOW_COPY_AND_ASSIGN(CdmAdapterTestBase);
diff --git a/media/device_monitors/system_message_window_win_unittest.cc b/media/device_monitors/system_message_window_win_unittest.cc index a9eee37..57de00a 100644 --- a/media/device_monitors/system_message_window_win_unittest.cc +++ b/media/device_monitors/system_message_window_win_unittest.cc
@@ -29,8 +29,8 @@ } // Run single threaded to not require explicit COM initialization - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY}; base::SystemMonitor system_monitor_; base::MockDevicesChangedObserver observer_; SystemMessageWindowWin window_;
diff --git a/media/filters/android/video_frame_extractor_unittest.cc b/media/filters/android/video_frame_extractor_unittest.cc index a0a3e72..8efbb143 100644 --- a/media/filters/android/video_frame_extractor_unittest.cc +++ b/media/filters/android/video_frame_extractor_unittest.cc
@@ -65,7 +65,7 @@ const base::FilePath& temp_dir() const { return temp_dir_.GetPath(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; std::unique_ptr<FileDataSource> data_source_; std::unique_ptr<VideoFrameExtractor> extractor_;
diff --git a/media/filters/aom_video_decoder_unittest.cc b/media/filters/aom_video_decoder_unittest.cc index 27498ac..5a19671 100644 --- a/media/filters/aom_video_decoder_unittest.cc +++ b/media/filters/aom_video_decoder_unittest.cc
@@ -164,7 +164,7 @@ testing::StrictMock<MockMediaLog> media_log_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<AomVideoDecoder> decoder_; scoped_refptr<DecoderBuffer> i_frame_buffer_;
diff --git a/media/filters/audio_decoder_stream_unittest.cc b/media/filters/audio_decoder_stream_unittest.cc index d64bb1d..6b3abffe 100644 --- a/media/filters/audio_decoder_stream_unittest.cc +++ b/media/filters/audio_decoder_stream_unittest.cc
@@ -113,7 +113,7 @@ std::move(closure).Run(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; NullMediaLog media_log_; testing::NiceMock<MockDemuxerStream> demuxer_stream_{DemuxerStream::AUDIO}; AudioDecoderStream audio_decoder_stream_;
diff --git a/media/filters/audio_decoder_unittest.cc b/media/filters/audio_decoder_unittest.cc index b5435e7..9ec8764c 100644 --- a/media/filters/audio_decoder_unittest.cc +++ b/media/filters/audio_decoder_unittest.cc
@@ -134,12 +134,12 @@ switch (decoder_type_) { case FFMPEG: decoder_.reset(new FFmpegAudioDecoder( - scoped_task_environment_.GetMainThreadTaskRunner(), &media_log_)); + task_environment_.GetMainThreadTaskRunner(), &media_log_)); break; #if defined(OS_ANDROID) case MEDIA_CODEC: decoder_.reset(new MediaCodecAudioDecoder( - scoped_task_environment_.GetMainThreadTaskRunner())); + task_environment_.GetMainThreadTaskRunner())); break; #endif } @@ -393,7 +393,7 @@ // that the decoder can be reinitialized with different parameters. TestParams params_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NullMediaLog media_log_; scoped_refptr<DecoderBuffer> data_;
diff --git a/media/filters/chunk_demuxer_unittest.cc b/media/filters/chunk_demuxer_unittest.cc index 9f36319..96d996a 100644 --- a/media/filters/chunk_demuxer_unittest.cc +++ b/media/filters/chunk_demuxer_unittest.cc
@@ -1247,7 +1247,7 @@ return true; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; StrictMock<MockMediaLog> media_log_; @@ -4415,7 +4415,7 @@ void DisableAndEnableDemuxerTracks( ChunkDemuxer* demuxer, - base::test::ScopedTaskEnvironment* scoped_task_environment) { + base::test::TaskEnvironment* task_environment) { base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, base::WaitableEvent::InitialState::NOT_SIGNALED); std::vector<MediaTrack::Id> audio_tracks; @@ -4447,7 +4447,7 @@ base::BindOnce(QuitLoop, base::Passed(enable_audio.QuitClosure()))); enable_audio.Run(); - scoped_task_environment->RunUntilIdle(); + task_environment->RunUntilIdle(); } } @@ -4461,16 +4461,16 @@ EXPECT_NE(nullptr, video_stream); // Verify stream status changes without pending read. - DisableAndEnableDemuxerTracks(demuxer_.get(), &scoped_task_environment_); + DisableAndEnableDemuxerTracks(demuxer_.get(), &task_environment_); // Verify stream status changes with pending read. bool read_done = false; audio_stream->Read(base::Bind(&OnReadDone_EOSExpected, &read_done)); - DisableAndEnableDemuxerTracks(demuxer_.get(), &scoped_task_environment_); + DisableAndEnableDemuxerTracks(demuxer_.get(), &task_environment_); EXPECT_TRUE(read_done); read_done = false; video_stream->Read(base::Bind(&OnReadDone_EOSExpected, &read_done)); - DisableAndEnableDemuxerTracks(demuxer_.get(), &scoped_task_environment_); + DisableAndEnableDemuxerTracks(demuxer_.get(), &task_environment_); EXPECT_TRUE(read_done); }
diff --git a/media/filters/dav1d_video_decoder_unittest.cc b/media/filters/dav1d_video_decoder_unittest.cc index 27eb02a..3660e88 100644 --- a/media/filters/dav1d_video_decoder_unittest.cc +++ b/media/filters/dav1d_video_decoder_unittest.cc
@@ -172,7 +172,7 @@ testing::StrictMock<MockMediaLog> media_log_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<Dav1dVideoDecoder> decoder_; scoped_refptr<DecoderBuffer> i_frame_buffer_;
diff --git a/media/filters/decoder_selector_unittest.cc b/media/filters/decoder_selector_unittest.cc index a0ae269..4004d0ed 100644 --- a/media/filters/decoder_selector_unittest.cc +++ b/media/filters/decoder_selector_unittest.cc
@@ -201,7 +201,7 @@ if (use_decrypting_decoder_) { decoders.push_back( std::make_unique<typename TypeParam::DecryptingDecoder>( - scoped_task_environment_.GetMainThreadTaskRunner(), &media_log_)); + task_environment_.GetMainThreadTaskRunner(), &media_log_)); } #endif // !defined(OS_ANDROID) @@ -246,7 +246,7 @@ void CreateDecoderSelector() { decoder_selector_ = std::make_unique<DecoderSelector<TypeParam::kStreamType>>( - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), base::BindRepeating(&Self::CreateDecoders, base::Unretained(this)), &media_log_); decoder_selector_->Initialize( @@ -289,9 +289,9 @@ RunUntilIdle(); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NullMediaLog media_log_; std::unique_ptr<StreamTraits> traits_;
diff --git a/media/filters/decrypting_audio_decoder_unittest.cc b/media/filters/decrypting_audio_decoder_unittest.cc index e1d52e6..87515ad 100644 --- a/media/filters/decrypting_audio_decoder_unittest.cc +++ b/media/filters/decrypting_audio_decoder_unittest.cc
@@ -57,7 +57,7 @@ public: DecryptingAudioDecoderTest() : decoder_(new DecryptingAudioDecoder( - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), &media_log_)), cdm_context_(new StrictMock<MockCdmContext>()), decryptor_(new StrictMock<MockDecryptor>()), @@ -244,7 +244,7 @@ MOCK_METHOD1(OnWaiting, void(WaitingReason)); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NullMediaLog media_log_; std::unique_ptr<DecryptingAudioDecoder> decoder_; std::unique_ptr<StrictMock<MockCdmContext>> cdm_context_;
diff --git a/media/filters/decrypting_demuxer_stream_unittest.cc b/media/filters/decrypting_demuxer_stream_unittest.cc index ad1468ea..876fd6a 100644 --- a/media/filters/decrypting_demuxer_stream_unittest.cc +++ b/media/filters/decrypting_demuxer_stream_unittest.cc
@@ -69,7 +69,7 @@ public: DecryptingDemuxerStreamTest() : demuxer_stream_(new DecryptingDemuxerStream( - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), &media_log_, base::Bind(&DecryptingDemuxerStreamTest::OnWaiting, base::Unretained(this)))), @@ -264,7 +264,7 @@ void(DemuxerStream::Status, scoped_refptr<DecoderBuffer>)); MOCK_METHOD1(OnWaiting, void(WaitingReason)); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; StrictMock<MockMediaLog> media_log_; std::unique_ptr<DecryptingDemuxerStream> demuxer_stream_; std::unique_ptr<StrictMock<MockCdmContext>> cdm_context_;
diff --git a/media/filters/decrypting_media_resource_unittest.cc b/media/filters/decrypting_media_resource_unittest.cc index 7823115..6ff50c4 100644 --- a/media/filters/decrypting_media_resource_unittest.cc +++ b/media/filters/decrypting_media_resource_unittest.cc
@@ -69,7 +69,7 @@ decrypting_media_resource_ = std::make_unique<DecryptingMediaResource>( &demuxer_, &cdm_context_, &null_media_log_, - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); } ~DecryptingMediaResourceTest() { @@ -108,7 +108,7 @@ void(DemuxerStream::Status, scoped_refptr<DecoderBuffer>)); protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::MockCallback<DecryptingMediaResource::InitCB> decrypting_media_resource_init_cb_; base::MockCallback<WaitingCB> waiting_cb_; @@ -132,7 +132,7 @@ decrypting_media_resource_->Initialize( decrypting_media_resource_init_cb_.Get(), waiting_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ( decrypting_media_resource_->DecryptingDemuxerStreamCountForTesting(), 2); @@ -147,7 +147,7 @@ decrypting_media_resource_->Initialize( decrypting_media_resource_init_cb_.Get(), waiting_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // When using an AesDecryptor we preemptively wrap our streams with a // DecryptingDemuxerStream, regardless of encryption. With this in mind, we @@ -168,7 +168,7 @@ decrypting_media_resource_->Initialize( decrypting_media_resource_init_cb_.Get(), waiting_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ( decrypting_media_resource_->DecryptingDemuxerStreamCountForTesting(), 2); @@ -190,7 +190,7 @@ decrypting_media_resource_->Initialize( decrypting_media_resource_init_cb_.Get(), waiting_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(DecryptingMediaResourceTest, @@ -205,7 +205,7 @@ decrypting_media_resource_->Initialize( decrypting_media_resource_init_cb_.Get(), waiting_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(DecryptingMediaResourceTest, WaitingCallback) { @@ -223,7 +223,7 @@ decrypting_media_resource_init_cb_.Get(), waiting_cb_.Get()); decrypting_media_resource_->GetAllStreams().front()->Read(base::BindRepeating( &DecryptingMediaResourceTest::BufferReady, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } // namespace media
diff --git a/media/filters/decrypting_video_decoder_unittest.cc b/media/filters/decrypting_video_decoder_unittest.cc index bebba2a..7b8170e 100644 --- a/media/filters/decrypting_video_decoder_unittest.cc +++ b/media/filters/decrypting_video_decoder_unittest.cc
@@ -51,7 +51,7 @@ public: DecryptingVideoDecoderTest() : decoder_(new DecryptingVideoDecoder( - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), &media_log_)), cdm_context_(new StrictMock<MockCdmContext>()), decryptor_(new StrictMock<MockDecryptor>()), @@ -221,7 +221,7 @@ MOCK_METHOD1(OnWaiting, void(WaitingReason)); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NullMediaLog media_log_; std::unique_ptr<DecryptingVideoDecoder> decoder_; std::unique_ptr<StrictMock<MockCdmContext>> cdm_context_;
diff --git a/media/filters/demuxer_perftest.cc b/media/filters/demuxer_perftest.cc index e5eb6df..5436d5b 100644 --- a/media/filters/demuxer_perftest.cc +++ b/media/filters/demuxer_perftest.cc
@@ -176,7 +176,7 @@ NullMediaLog media_log_; for (int i = 0; i < kBenchmarkIterations; ++i) { // Setup. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DemuxerHostImpl demuxer_host; FileDataSource data_source; ASSERT_TRUE(data_source.Initialize(file_path));
diff --git a/media/filters/fake_video_decoder_unittest.cc b/media/filters/fake_video_decoder_unittest.cc index a1a729d..07b5ecb1 100644 --- a/media/filters/fake_video_decoder_unittest.cc +++ b/media/filters/fake_video_decoder_unittest.cc
@@ -221,7 +221,7 @@ DCHECK(!is_reset_pending_); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; VideoDecoderConfig current_config_; std::unique_ptr<FakeVideoDecoder> decoder_;
diff --git a/media/filters/ffmpeg_demuxer_unittest.cc b/media/filters/ffmpeg_demuxer_unittest.cc index b0033da..765e3b7 100644 --- a/media/filters/ffmpeg_demuxer_unittest.cc +++ b/media/filters/ffmpeg_demuxer_unittest.cc
@@ -117,7 +117,7 @@ if (demuxer_) demuxer_->Stop(); demuxer_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); data_source_.reset(); } @@ -268,7 +268,7 @@ // Fixture members. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // TODO(wolenetz): Consider expanding MediaLog verification coverage here // using StrictMock<MockMediaLog> for all FFmpegDemuxerTests. See @@ -487,12 +487,12 @@ audio->Read(NewReadCB(FROM_HERE, 29, 0, true, DemuxerStream::kAborted)); demuxer_->AbortPendingReads(); base::RunLoop().Run(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Additional reads should also be aborted (until a Seek()). audio->Read(NewReadCB(FROM_HERE, 29, 0, true, DemuxerStream::kAborted)); base::RunLoop().Run(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Ensure blocking thread has completed outstanding work. demuxer_->Stop(); @@ -516,7 +516,7 @@ audio->Read(NewReadCB(FROM_HERE, 27, 3000, true)); base::RunLoop().Run(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(166866, demuxer_->GetMemoryUsage()); } @@ -534,7 +534,7 @@ video->Read(NewReadCB(FROM_HERE, 1057, 33000, false)); base::RunLoop().Run(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(148778, demuxer_->GetMemoryUsage()); } @@ -1066,7 +1066,7 @@ // Attempt the read... audio->Read(callback.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ; // Don't let the test call Stop() again. @@ -1696,7 +1696,7 @@ void DisableAndEnableDemuxerTracks( FFmpegDemuxer* demuxer, - base::test::ScopedTaskEnvironment* scoped_task_environment) { + base::test::TaskEnvironment* task_environment) { base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, base::WaitableEvent::InitialState::NOT_SIGNALED); std::vector<MediaTrack::Id> audio_tracks; @@ -1728,7 +1728,7 @@ base::BindOnce(QuitLoop, base::Passed(enable_audio.QuitClosure()))); enable_audio.Run(); - scoped_task_environment->RunUntilIdle(); + task_environment->RunUntilIdle(); } void OnReadDoneExpectEos(DemuxerStream::Status status, @@ -1749,7 +1749,7 @@ EXPECT_NE(nullptr, video_stream); // Verify stream status notifications delivery without pending read first. - DisableAndEnableDemuxerTracks(demuxer_.get(), &scoped_task_environment_); + DisableAndEnableDemuxerTracks(demuxer_.get(), &task_environment_); // Verify that stream notifications are delivered properly when stream status // changes with a pending read. Call FlushBuffers before reading, to ensure @@ -1761,7 +1761,7 @@ audio_stream->Read(base::Bind(&OnReadDoneExpectEos)); video_stream->Read(base::Bind(&OnReadDoneExpectEos)); - DisableAndEnableDemuxerTracks(demuxer_.get(), &scoped_task_environment_); + DisableAndEnableDemuxerTracks(demuxer_.get(), &task_environment_); } TEST_F(FFmpegDemuxerTest, MultitrackMemoryUsage) { @@ -1776,7 +1776,7 @@ // shouldn't be too high. audio->Read(NewReadCB(FROM_HERE, 304, 0, true)); base::RunLoop().Run(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(22134, demuxer_->GetMemoryUsage()); // Now enable all demuxer streams in the file and perform another read, this @@ -1788,7 +1788,7 @@ audio->Read(NewReadCB(FROM_HERE, 166, 21000, true)); base::RunLoop().Run(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // With newly enabled demuxer streams the amount of memory used by the demuxer // is much higher. EXPECT_EQ(156011, demuxer_->GetMemoryUsage());
diff --git a/media/filters/ffmpeg_video_decoder_unittest.cc b/media/filters/ffmpeg_video_decoder_unittest.cc index f806b697..40e88ec 100644 --- a/media/filters/ffmpeg_video_decoder_unittest.cc +++ b/media/filters/ffmpeg_video_decoder_unittest.cc
@@ -200,7 +200,7 @@ StrictMock<MockMediaLog> media_log_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FFmpegVideoDecoder> decoder_; // Various buffers for testing.
diff --git a/media/filters/frame_processor_unittest.cc b/media/filters/frame_processor_unittest.cc index 3afe81a..c9d74fd 100644 --- a/media/filters/frame_processor_unittest.cc +++ b/media/filters/frame_processor_unittest.cc
@@ -298,7 +298,7 @@ stream->StartReturningData(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; StrictMock<MockMediaLog> media_log_; StrictMock<FrameProcessorTestCallbackHelper> callbacks_;
diff --git a/media/filters/fuchsia/fuchsia_video_decoder_unittest.cc b/media/filters/fuchsia/fuchsia_video_decoder_unittest.cc index 5eae26f..21e9ce3 100644 --- a/media/filters/fuchsia/fuchsia_video_decoder_unittest.cc +++ b/media/filters/fuchsia/fuchsia_video_decoder_unittest.cc
@@ -73,9 +73,9 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<VideoDecoder> decoder_; std::list<scoped_refptr<VideoFrame>> output_frames_;
diff --git a/media/filters/offloading_video_decoder_unittest.cc b/media/filters/offloading_video_decoder_unittest.cc index 86e0fe0..e249a6e 100644 --- a/media/filters/offloading_video_decoder_unittest.cc +++ b/media/filters/offloading_video_decoder_unittest.cc
@@ -66,9 +66,9 @@ class OffloadingVideoDecoderTest : public testing::Test { public: OffloadingVideoDecoderTest() - : task_env_(base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) {} + : task_env_( + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} void CreateWrapper(int offload_width, VideoCodec codec) { decoder_ = new testing::StrictMock<MockOffloadableVideoDecoder>(); @@ -187,7 +187,7 @@ MOCK_METHOD1(DecodeDone, void(DecodeStatus)); MOCK_METHOD0(ResetDone, void(void)); - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; std::unique_ptr<OffloadingVideoDecoder> offloading_decoder_; testing::StrictMock<MockOffloadableVideoDecoder>* decoder_ = nullptr; // Owned by |offloading_decoder_|.
diff --git a/media/filters/pipeline_controller_unittest.cc b/media/filters/pipeline_controller_unittest.cc index dcbb3af..e932d1f 100644 --- a/media/filters/pipeline_controller_unittest.cc +++ b/media/filters/pipeline_controller_unittest.cc
@@ -158,7 +158,7 @@ void OnAudioDecoderChange(const PipelineDecoderInfo& info) override {} void OnVideoDecoderChange(const PipelineDecoderInfo& info) override {} - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NiceMock<MockDemuxer> demuxer_; StrictMock<MockPipeline>* pipeline_;
diff --git a/media/filters/video_decoder_stream_unittest.cc b/media/filters/video_decoder_stream_unittest.cc index 1c4e99c..58f6fb4027 100644 --- a/media/filters/video_decoder_stream_unittest.cc +++ b/media/filters/video_decoder_stream_unittest.cc
@@ -85,7 +85,7 @@ has_no_key_(false) { video_decoder_stream_.reset(new VideoDecoderStream( std::make_unique<VideoDecoderStream::StreamTraits>(&media_log_), - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), base::BindRepeating(&VideoDecoderStreamTest::CreateVideoDecodersForTest, base::Unretained(this)), &media_log_)); @@ -139,7 +139,7 @@ void PrepareFrame(scoped_refptr<VideoFrame> frame, VideoDecoderStream::OutputReadyCB output_ready_cb) { // Simulate some delay in return of the output. - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(std::move(output_ready_cb), std::move(frame))); } @@ -167,7 +167,7 @@ // Note this is _not_ inserted into |decoders_| below, so we don't need to // adjust the indices used below to compensate. decoders.push_back(std::make_unique<DecryptingVideoDecoder>( - scoped_task_environment_.GetMainThreadTaskRunner(), &media_log_)); + task_environment_.GetMainThreadTaskRunner(), &media_log_)); #endif for (int i = 0; i < 3; ++i) { @@ -463,7 +463,7 @@ SatisfyPendingCallback(DECODER_REINIT); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; StrictMock<MockMediaLog> media_log_; std::unique_ptr<VideoDecoderStream> video_decoder_stream_;
diff --git a/media/filters/vpx_video_decoder_unittest.cc b/media/filters/vpx_video_decoder_unittest.cc index befb24e..87fe071 100644 --- a/media/filters/vpx_video_decoder_unittest.cc +++ b/media/filters/vpx_video_decoder_unittest.cc
@@ -162,7 +162,7 @@ MOCK_METHOD1(DecodeDone, void(DecodeStatus)); - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; std::unique_ptr<VideoDecoder> decoder_; scoped_refptr<DecoderBuffer> i_frame_buffer_;
diff --git a/media/gpu/android/codec_allocator_unittest.cc b/media/gpu/android/codec_allocator_unittest.cc index d57e7b43..721b368 100644 --- a/media/gpu/android/codec_allocator_unittest.cc +++ b/media/gpu/android/codec_allocator_unittest.cc
@@ -72,8 +72,8 @@ std::unique_ptr<MediaCodecBridge> codec) { // This should always be called on the main thread, despite whatever thread // the allocator happens to be running on. - ASSERT_TRUE(scoped_task_environment_.GetMainThreadTaskRunner() - ->BelongsToCurrentThread()); + ASSERT_TRUE( + task_environment_.GetMainThreadTaskRunner()->BelongsToCurrentThread()); last_created_codec_.reset( reinterpret_cast<MockMediaCodecBridge*>(codec.release())); @@ -85,8 +85,8 @@ void OnCodecReleasedInternal(base::OnceClosure quit_closure) { // This should always be called on the main thread, despite whatever thread // the allocator happens to be running on. - ASSERT_TRUE(scoped_task_environment_.GetMainThreadTaskRunner() - ->BelongsToCurrentThread()); + ASSERT_TRUE( + task_environment_.GetMainThreadTaskRunner()->BelongsToCurrentThread()); OnCodecReleased(); std::move(quit_closure).Run(); } @@ -110,7 +110,7 @@ protected: // So that we can get the thread's task runner. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::Thread allocator_thread_; @@ -265,7 +265,7 @@ // QuitClosure may run before the initial release processes, so RunUntilIdle // here such that hung status is cleared. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Running the loop should clear hung status. ASSERT_FALSE(IsPrimaryTaskRunnerLikelyHung()); @@ -294,7 +294,7 @@ // QuitClosure may run before the initial release processes, so RunUntilIdle // here such that hung status is cleared. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Running the loop should clear hung status. ASSERT_FALSE(IsPrimaryTaskRunnerLikelyHung()); @@ -341,7 +341,7 @@ // QuitClosure may run before the initial release processes, so RunUntilIdle // here such that hung status is cleared. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Running the loop should clear hung status. ASSERT_FALSE(IsPrimaryTaskRunnerLikelyHung());
diff --git a/media/gpu/android/codec_image_group_unittest.cc b/media/gpu/android/codec_image_group_unittest.cc index 788ed2b..79777b1 100644 --- a/media/gpu/android/codec_image_group_unittest.cc +++ b/media/gpu/android/codec_image_group_unittest.cc
@@ -79,7 +79,7 @@ // Handy method to check that CodecImage destruction is relayed properly. MOCK_METHOD1(OnCodecImageDestroyed, void(CodecImage*)); - base::test::ScopedTaskEnvironment env_; + base::test::TaskEnvironment env_; // Our thread is the mcvd thread. This is the task runner for the gpu thread. scoped_refptr<base::TestSimpleTaskRunner> gpu_task_runner_;
diff --git a/media/gpu/android/codec_image_unittest.cc b/media/gpu/android/codec_image_unittest.cc index 69aae32..ae05be6a 100644 --- a/media/gpu/android/codec_image_unittest.cc +++ b/media/gpu/android/codec_image_unittest.cc
@@ -98,7 +98,7 @@ virtual bool BindsTextureOnUpdate() { return true; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NiceMock<MockMediaCodecBridge>* codec_; std::unique_ptr<CodecWrapper> wrapper_; scoped_refptr<NiceMock<MockCodecBufferWaitCoordinator>>
diff --git a/media/gpu/android/codec_wrapper_unittest.cc b/media/gpu/android/codec_wrapper_unittest.cc index 2abcd6c..317b126 100644 --- a/media/gpu/android/codec_wrapper_unittest.cc +++ b/media/gpu/android/codec_wrapper_unittest.cc
@@ -66,7 +66,7 @@ } // So that we can get the thread's task runner. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; NiceMock<MockMediaCodecBridge>* codec_; std::unique_ptr<CodecWrapper> wrapper_;
diff --git a/media/gpu/android/media_codec_video_decoder_unittest.cc b/media/gpu/android/media_codec_video_decoder_unittest.cc index 573e4ff..0f9c58fc 100644 --- a/media/gpu/android/media_codec_video_decoder_unittest.cc +++ b/media/gpu/android/media_codec_video_decoder_unittest.cc
@@ -278,7 +278,7 @@ protected: const VideoCodec codec_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::android::ScopedJavaGlobalRef<jobject> java_surface_; scoped_refptr<DecoderBuffer> fake_decoder_buffer_; std::unique_ptr<MockDeviceInfo> device_info_;
diff --git a/media/gpu/android/texture_pool_unittest.cc b/media/gpu/android/texture_pool_unittest.cc index cc21988f..07f244f8 100644 --- a/media/gpu/android/texture_pool_unittest.cc +++ b/media/gpu/android/texture_pool_unittest.cc
@@ -55,7 +55,7 @@ return texture_weak; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
diff --git a/media/gpu/android/video_frame_factory_impl_unittest.cc b/media/gpu/android/video_frame_factory_impl_unittest.cc index e7748b77..cf52861 100644 --- a/media/gpu/android/video_frame_factory_impl_unittest.cc +++ b/media/gpu/android/video_frame_factory_impl_unittest.cc
@@ -114,7 +114,7 @@ base::RunLoop().RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; std::unique_ptr<VideoFrameFactoryImpl> impl_;
diff --git a/media/gpu/ipc/service/picture_buffer_manager_unittest.cc b/media/gpu/ipc/service/picture_buffer_manager_unittest.cc index 2d3e284..1d162b67 100644 --- a/media/gpu/ipc/service/picture_buffer_manager_unittest.cc +++ b/media/gpu/ipc/service/picture_buffer_manager_unittest.cc
@@ -71,7 +71,7 @@ return sync_token; } - base::test::ScopedTaskEnvironment environment_; + base::test::TaskEnvironment environment_; uint64_t next_release_count_ = 1; testing::StrictMock<
diff --git a/media/gpu/ipc/service/vda_video_decoder_unittest.cc b/media/gpu/ipc/service/vda_video_decoder_unittest.cc index a7ba09d6..79b10ad5 100644 --- a/media/gpu/ipc/service/vda_video_decoder_unittest.cc +++ b/media/gpu/ipc/service/vda_video_decoder_unittest.cc
@@ -288,7 +288,7 @@ return std::move(owned_vda_); } - base::test::ScopedTaskEnvironment environment_; + base::test::TaskEnvironment environment_; base::Thread gpu_thread_; testing::NiceMock<MockMediaLog> media_log_;
diff --git a/media/gpu/linux/platform_video_frame_pool_unittest.cc b/media/gpu/linux/platform_video_frame_pool_unittest.cc index f01b489..e3ecf41 100644 --- a/media/gpu/linux/platform_video_frame_pool_unittest.cc +++ b/media/gpu/linux/platform_video_frame_pool_unittest.cc
@@ -54,8 +54,7 @@ using DmabufId = PlatformVideoFramePool::DmabufId; PlatformVideoFramePoolTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) { + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) { pool_.reset(new PlatformVideoFramePool( base::BindRepeating(&CreateDmabufVideoFrame), &test_clock_)); pool_->set_parent_task_runner(base::ThreadTaskRunnerHandle::Get()); @@ -90,7 +89,7 @@ DmabufId GetDmabufId(const VideoFrame& frame) { return &(frame.DmabufFds()); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::SimpleTestTickClock test_clock_; std::unique_ptr<PlatformVideoFramePool, std::default_delete<DmabufVideoFramePool>> @@ -114,7 +113,7 @@ // Clear frame reference to return the frame to the pool. frame = nullptr; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Verify that the next frame from the pool uses the same memory. scoped_refptr<VideoFrame> new_frame = GetFrame(20); @@ -129,18 +128,18 @@ DmabufId id2 = GetDmabufId(*frame2); frame1 = nullptr; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); frame1 = GetFrame(30); EXPECT_EQ(id1, GetDmabufId(*frame1)); frame2 = nullptr; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); frame2 = GetFrame(40); EXPECT_EQ(id2, GetDmabufId(*frame2)); frame1 = nullptr; frame2 = nullptr; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); CheckPoolSize(2u); } @@ -152,7 +151,7 @@ // Clear frame references to return the frames to the pool. frame_a = nullptr; frame_b = nullptr; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Verify that both frames are in the pool. CheckPoolSize(2u); @@ -173,16 +172,16 @@ // Drop frame and verify that resources are still available for reuse. frame_1 = nullptr; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); CheckPoolSize(1u); // Advance clock far enough to hit stale timer; ensure only frame_1 has its // resources released. base::TimeDelta time_forward = base::TimeDelta::FromMinutes(1); test_clock_.Advance(time_forward); - scoped_task_environment_.FastForwardBy(time_forward); + task_environment_.FastForwardBy(time_forward); frame_2 = nullptr; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); CheckPoolSize(1u); }
diff --git a/media/gpu/test/video_test_environment.cc b/media/gpu/test/video_test_environment.cc index a0f20df..1c17ab7 100644 --- a/media/gpu/test/video_test_environment.cc +++ b/media/gpu/test/video_test_environment.cc
@@ -46,8 +46,8 @@ // thread and allow posting tasks to other threads. This is required for video // tests to function correctly. TestTimeouts::Initialize(); - task_environment_ = std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + task_environment_ = std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::MainThreadType::UI); // Perform all static initialization that is required when running video // decoders in a test environment.
diff --git a/media/gpu/test/video_test_environment.h b/media/gpu/test/video_test_environment.h index 76838d7..2756a39 100644 --- a/media/gpu/test/video_test_environment.h +++ b/media/gpu/test/video_test_environment.h
@@ -21,7 +21,7 @@ namespace base { namespace test { -class ScopedTaskEnvironment; +class TaskEnvironment; } // namespace test } // namespace base @@ -48,7 +48,7 @@ // An exit manager is required to run callbacks on shutdown. base::AtExitManager at_exit_manager; - std::unique_ptr<base::test::ScopedTaskEnvironment> task_environment_; + std::unique_ptr<base::test::TaskEnvironment> task_environment_; #if defined(USE_OZONE) std::unique_ptr<ui::OzoneGpuTestHelper> gpu_helper_;
diff --git a/media/gpu/vaapi/vaapi_image_decode_accelerator_worker_unittest.cc b/media/gpu/vaapi/vaapi_image_decode_accelerator_worker_unittest.cc index d9af91e0..28b1b67 100644 --- a/media/gpu/vaapi/vaapi_image_decode_accelerator_worker_unittest.cc +++ b/media/gpu/vaapi/vaapi_image_decode_accelerator_worker_unittest.cc
@@ -159,7 +159,7 @@ void(std::unique_ptr<gpu::ImageDecodeAcceleratorWorker::DecodeResult>)); protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<VaapiImageDecodeAcceleratorWorker> worker_; DISALLOW_COPY_AND_ASSIGN(VaapiImageDecodeAcceleratorWorkerTest); @@ -224,7 +224,7 @@ std::move(webp_encoded_data), kVisibleSize, base::BindOnce(&VaapiImageDecodeAcceleratorWorkerTest::OnDecodeCompleted, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(VaapiImageDecodeAcceleratorWorkerTest, ImageDecodeFails) { @@ -266,7 +266,7 @@ std::move(webp_encoded_data), kVisibleSize, base::BindOnce(&VaapiImageDecodeAcceleratorWorkerTest::OnDecodeCompleted, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(VaapiImageDecodeAcceleratorWorkerTest, UnknownImageDecodeFails) { @@ -276,7 +276,7 @@ std::move(encoded_data), kVisibleSize, base::BindOnce(&VaapiImageDecodeAcceleratorWorkerTest::OnDecodeCompleted, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } // namespace media
diff --git a/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc b/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc index 397f7e2..28e062c4 100644 --- a/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc +++ b/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc
@@ -363,7 +363,7 @@ MOCK_METHOD0(NotifyResetDone, void()); MOCK_METHOD1(NotifyError, void(VideoDecodeAccelerator::Error)); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // The class under test and a worker thread for it. VaapiVideoDecodeAccelerator vda_;
diff --git a/media/gpu/video_decode_accelerator_unittest.cc b/media/gpu/video_decode_accelerator_unittest.cc index 614be10..ddcbbc4c 100644 --- a/media/gpu/video_decode_accelerator_unittest.cc +++ b/media/gpu/video_decode_accelerator_unittest.cc
@@ -1714,12 +1714,10 @@ // which uses COM. We need the thread to be a UI thread. // On Ozone, the backend initializes the event system using a UI // thread. - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + task_environment_ = std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::MainThreadType::UI); #else - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>(); + task_environment_ = std::make_unique<base::test::TaskEnvironment>(); #endif // OS_WIN || OS_CHROMEOS media::g_env = @@ -1742,11 +1740,11 @@ } void Shutdown() override { - scoped_task_environment_.reset(); + task_environment_.reset(); base::TestSuite::Shutdown(); } - std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_; + std::unique_ptr<base::test::TaskEnvironment> task_environment_; }; } // namespace
diff --git a/media/gpu/video_encode_accelerator_unittest.cc b/media/gpu/video_encode_accelerator_unittest.cc index 9a829e77..98d6b64c 100644 --- a/media/gpu/video_encode_accelerator_unittest.cc +++ b/media/gpu/video_encode_accelerator_unittest.cc
@@ -3076,12 +3076,10 @@ base::TestSuite::Initialize(); #if defined(OS_CHROMEOS) - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + task_environment_ = std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::MainThreadType::UI); #else - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>(); + task_environment_ = std::make_unique<base::test::TaskEnvironment>(); #endif media::g_env = reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( @@ -3106,12 +3104,12 @@ } void Shutdown() override { - scoped_task_environment_.reset(); + task_environment_.reset(); base::TestSuite::Shutdown(); } private: - std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_; + std::unique_ptr<base::test::TaskEnvironment> task_environment_; }; } // namespace
diff --git a/media/gpu/windows/d3d11_cdm_proxy_unittest.cc b/media/gpu/windows/d3d11_cdm_proxy_unittest.cc index 374f9a9..efda4038 100644 --- a/media/gpu/windows/d3d11_cdm_proxy_unittest.cc +++ b/media/gpu/windows/d3d11_cdm_proxy_unittest.cc
@@ -297,7 +297,7 @@ const UINT kPrivateOutputSize = 40; // ObjectWatcher uses SequencedTaskRunnerHandle. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Verifies that if device creation fails, then the call fails.
diff --git a/media/gpu/windows/d3d11_video_decoder_unittest.cc b/media/gpu/windows/d3d11_video_decoder_unittest.cc index 8803fda..ed003d8 100644 --- a/media/gpu/windows/d3d11_video_decoder_unittest.cc +++ b/media/gpu/windows/d3d11_video_decoder_unittest.cc
@@ -229,7 +229,7 @@ MOCK_METHOD1(MockInitCB, void(bool)); - base::test::ScopedTaskEnvironment env_; + base::test::TaskEnvironment env_; scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_;
diff --git a/media/learning/impl/distribution_reporter_unittest.cc b/media/learning/impl/distribution_reporter_unittest.cc index 55f1f4a..ecdac1c 100644 --- a/media/learning/impl/distribution_reporter_unittest.cc +++ b/media/learning/impl/distribution_reporter_unittest.cc
@@ -25,7 +25,7 @@ task_.target_description.ordering = LearningTask::Ordering::kNumeric; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<ukm::TestAutoSetUkmRecorder> ukm_recorder_;
diff --git a/media/learning/impl/extra_trees_trainer_unittest.cc b/media/learning/impl/extra_trees_trainer_unittest.cc index d9e1897..f926957 100644 --- a/media/learning/impl/extra_trees_trainer_unittest.cc +++ b/media/learning/impl/extra_trees_trainer_unittest.cc
@@ -38,11 +38,11 @@ [](std::unique_ptr<Model>* model_out, std::unique_ptr<Model> model) { *model_out = std::move(model); }, &model)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); return model; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestRandomNumberGenerator rng_; ExtraTreesTrainer trainer_;
diff --git a/media/learning/impl/learning_fuzzertest.cc b/media/learning/impl/learning_fuzzertest.cc index cfff3d4..e46de5b 100644 --- a/media/learning/impl/learning_fuzzertest.cc +++ b/media/learning/impl/learning_fuzzertest.cc
@@ -40,7 +40,7 @@ } extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FuzzedDataProvider provider(data, size); LearningTask task; @@ -67,7 +67,7 @@ controller.CompleteObservation( id, ObservationCompletion(TargetValue(ConsumeDouble(&provider)), ConsumeDouble(&provider))); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } return 0;
diff --git a/media/learning/impl/learning_session_impl_unittest.cc b/media/learning/impl/learning_session_impl_unittest.cc index d69ec98..bad8353 100644 --- a/media/learning/impl/learning_session_impl_unittest.cc +++ b/media/learning/impl/learning_session_impl_unittest.cc
@@ -104,10 +104,10 @@ // To prevent a memory leak, reset the session. This will post destruction // of other objects, so RunUntilIdle(). session_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::SequencedTaskRunner> task_runner_; @@ -125,13 +125,13 @@ EXPECT_EQ(task_runners_.size(), 0u); session_->RegisterTask(task_0_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(task_controllers_.size(), 1u); EXPECT_EQ(task_runners_.size(), 1u); EXPECT_EQ(task_runners_[0], task_runner_.get()); session_->RegisterTask(task_1_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(task_controllers_.size(), 2u); EXPECT_EQ(task_runners_.size(), 2u); EXPECT_EQ(task_runners_[1], task_runner_.get()); @@ -160,7 +160,7 @@ ltc_1->CompleteObservation( id, ObservationCompletion(example_1.target_value, example_1.weight)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(task_controllers_[0]->example_, example_0); EXPECT_EQ(task_controllers_[1]->example_, example_1); } @@ -174,7 +174,7 @@ // Destroy the session. |controller| should still be usable, though it won't // forward requests anymore. session_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Should not crash. controller->BeginObservation(base::UnguessableToken::Create(), @@ -186,7 +186,7 @@ bool flag = false; session_->RegisterTask( task_0_, base::SequenceBound<FakeFeatureProvider>(task_runner_, &flag)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Registering the task should create a FakeLearningTaskController, which will // call AddFeatures on the fake FeatureProvider. EXPECT_TRUE(flag); @@ -197,18 +197,18 @@ std::unique_ptr<LearningTaskController> controller = session_->GetController(task_0_.name); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Start an observation and verify that it starts. base::UnguessableToken id = base::UnguessableToken::Create(); controller->BeginObservation(id, FeatureVector()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(task_controllers_[0]->id_, id); EXPECT_NE(task_controllers_[0]->cancelled_id_, id); // Should result in cancelling the observation. controller.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(task_controllers_[0]->cancelled_id_, id); }
diff --git a/media/learning/impl/learning_task_controller_helper_unittest.cc b/media/learning/impl/learning_task_controller_helper_unittest.cc index 606c7a7..0427537 100644 --- a/media/learning/impl/learning_task_controller_helper_unittest.cc +++ b/media/learning/impl/learning_task_controller_helper_unittest.cc
@@ -51,7 +51,7 @@ // To prevent a memory leak, reset the helper. This will post destruction // of other objects, so RunUntilIdle(). helper_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void CreateClient(bool include_fp) { @@ -60,7 +60,7 @@ if (include_fp) { sb_fp = base::SequenceBound<FakeFeatureProvider>(task_runner_, &fp_features_, &fp_cb_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // TODO(liberato): make sure this works without a fp. @@ -82,7 +82,7 @@ return helper_->pending_example_count_for_testing(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::SequencedTaskRunner> task_runner_; @@ -126,7 +126,7 @@ helper_->BeginObservation(id_, example_.features); EXPECT_EQ(pending_example_count(), 1u); helper_->CancelObservation(id_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(most_recent_example_); EXPECT_EQ(pending_example_count(), 0u); } @@ -136,7 +136,7 @@ CreateClient(true); helper_->BeginObservation(id_, example_.features); EXPECT_EQ(pending_example_count(), 1u); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // The feature provider should know about the example. EXPECT_EQ(fp_features_, example_.features); @@ -149,7 +149,7 @@ // Add the features, and verify that they arrive at the AddExampleCB. example_.features[0] = FeatureValue(456); std::move(fp_cb_).Run(example_.features); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(pending_example_count(), 0u); EXPECT_TRUE(most_recent_example_); EXPECT_EQ(*most_recent_example_, example_); @@ -161,7 +161,7 @@ CreateClient(true); helper_->BeginObservation(id_, example_.features); EXPECT_EQ(pending_example_count(), 1u); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // The feature provider should know about the example. EXPECT_EQ(fp_features_, example_.features); @@ -174,7 +174,7 @@ // example was sent to us. example_.features[0] = FeatureValue(456); std::move(fp_cb_).Run(example_.features); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(pending_example_count(), 0u); EXPECT_FALSE(most_recent_example_); } @@ -184,7 +184,7 @@ CreateClient(true); helper_->BeginObservation(id_, example_.features); EXPECT_EQ(pending_example_count(), 1u); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // The feature provider should know about the example. EXPECT_EQ(fp_features_, example_.features); EXPECT_EQ(pending_example_count(), 1u); @@ -192,7 +192,7 @@ // Add the features, and verify that the example isn't sent yet. example_.features[0] = FeatureValue(456); std::move(fp_cb_).Run(example_.features); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(most_recent_example_); EXPECT_EQ(pending_example_count(), 1u); @@ -210,7 +210,7 @@ CreateClient(true); helper_->BeginObservation(id_, example_.features); EXPECT_EQ(pending_example_count(), 1u); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // The feature provider should know about the example. EXPECT_EQ(fp_features_, example_.features); EXPECT_EQ(pending_example_count(), 1u); @@ -220,14 +220,14 @@ // callback yet; we might send a TargetValue. example_.features[0] = FeatureValue(456); std::move(fp_cb_).Run(example_.features); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(most_recent_example_); EXPECT_EQ(pending_example_count(), 1u); // Cancel the observation, and verify that the pending example has been // removed, and no example was sent to us. helper_->CancelObservation(id_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(most_recent_example_); EXPECT_EQ(pending_example_count(), 0u); }
diff --git a/media/learning/impl/learning_task_controller_impl_unittest.cc b/media/learning/impl/learning_task_controller_impl_unittest.cc index 9daec3ae..29c196bf 100644 --- a/media/learning/impl/learning_task_controller_impl_unittest.cc +++ b/media/learning/impl/learning_task_controller_impl_unittest.cc
@@ -112,7 +112,7 @@ // To prevent a memory leak, reset the controller. This may post // destruction of other objects, so RunUntilIdle(). controller_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void CreateController(SequenceBoundFeatureProvider feature_provider = @@ -137,7 +137,7 @@ id, ObservationCompletion(example.target_value, example.weight)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Number of models that we trained. int num_models_ = 0; @@ -208,7 +208,7 @@ example.features.push_back(FeatureValue(123)); example.weight = 321u; AddExample(example); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(trainer_raw_->training_data()[0].features[0], FeatureValue(124)); EXPECT_EQ(trainer_raw_->training_data()[0].weight, example.weight); }
diff --git a/media/learning/impl/lookup_table_trainer_unittest.cc b/media/learning/impl/lookup_table_trainer_unittest.cc index 4761874..94cd79a9 100644 --- a/media/learning/impl/lookup_table_trainer_unittest.cc +++ b/media/learning/impl/lookup_table_trainer_unittest.cc
@@ -23,11 +23,11 @@ [](std::unique_ptr<Model>* model_out, std::unique_ptr<Model> model) { *model_out = std::move(model); }, &model)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); return model; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; LookupTableTrainer trainer_; LearningTask task_;
diff --git a/media/learning/impl/random_tree_trainer_unittest.cc b/media/learning/impl/random_tree_trainer_unittest.cc index f9face03..ac7dd32 100644 --- a/media/learning/impl/random_tree_trainer_unittest.cc +++ b/media/learning/impl/random_tree_trainer_unittest.cc
@@ -38,11 +38,11 @@ [](std::unique_ptr<Model>* model_out, std::unique_ptr<Model> model) { *model_out = std::move(model); }, &model)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); return model; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestRandomNumberGenerator rng_; RandomTreeTrainer trainer_;
diff --git a/media/learning/mojo/mojo_learning_task_controller_service_unittest.cc b/media/learning/mojo/mojo_learning_task_controller_service_unittest.cc index 99e8a391..c338fef 100644 --- a/media/learning/mojo/mojo_learning_task_controller_service_unittest.cc +++ b/media/learning/mojo/mojo_learning_task_controller_service_unittest.cc
@@ -72,7 +72,7 @@ LearningTask task_; // Mojo stuff. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeLearningTaskController* controller_raw_ = nullptr;
diff --git a/media/learning/mojo/public/cpp/mojo_learning_task_controller_unittest.cc b/media/learning/mojo/public/cpp/mojo_learning_task_controller_unittest.cc index 546aae1..44fd87f 100644 --- a/media/learning/mojo/public/cpp/mojo_learning_task_controller_unittest.cc +++ b/media/learning/mojo/public/cpp/mojo_learning_task_controller_unittest.cc
@@ -70,7 +70,7 @@ } // Mojo stuff. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeMojoLearningTaskController fake_learning_controller_; mojo::Binding<mojom::LearningTaskController> learning_controller_binding_; @@ -83,7 +83,7 @@ base::UnguessableToken id = base::UnguessableToken::Create(); FeatureVector features = {FeatureValue(123), FeatureValue(456)}; learning_controller_->BeginObservation(id, features); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(id, fake_learning_controller_.begin_args_.id_); EXPECT_EQ(features, fake_learning_controller_.begin_args_.features_); } @@ -92,7 +92,7 @@ base::UnguessableToken id = base::UnguessableToken::Create(); ObservationCompletion completion(TargetValue(1234)); learning_controller_->CompleteObservation(id, completion); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(id, fake_learning_controller_.complete_args_.id_); EXPECT_EQ(completion.target_value, fake_learning_controller_.complete_args_.completion_.target_value); @@ -101,7 +101,7 @@ TEST_F(MojoLearningTaskControllerTest, Cancel) { base::UnguessableToken id = base::UnguessableToken::Create(); learning_controller_->CancelObservation(id); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(id, fake_learning_controller_.cancel_args_.id_); }
diff --git a/media/midi/midi_manager_unittest.cc b/media/midi/midi_manager_unittest.cc index d4bd314..eef9d48 100644 --- a/media/midi/midi_manager_unittest.cc +++ b/media/midi/midi_manager_unittest.cc
@@ -221,7 +221,7 @@ base::WeakPtr<FakeMidiManagerFactory> factory() { return factory_; } private: - base::test::ScopedTaskEnvironment env_; + base::test::TaskEnvironment env_; base::WeakPtr<FakeMidiManagerFactory> factory_; std::unique_ptr<MidiService> service_; @@ -354,7 +354,7 @@ // SystemMonitor is needed on Windows. base::SystemMonitor system_monitor; - base::test::ScopedTaskEnvironment env_; + base::test::TaskEnvironment env_; std::unique_ptr<FakeMidiManagerClient> client_; std::unique_ptr<MidiService> service_;
diff --git a/media/mojo/clients/mojo_android_overlay_unittest.cc b/media/mojo/clients/mojo_android_overlay_unittest.cc index 744f401f7..5eab2ed7 100644 --- a/media/mojo/clients/mojo_android_overlay_unittest.cc +++ b/media/mojo/clients/mojo_android_overlay_unittest.cc
@@ -155,7 +155,7 @@ } // Mojo stuff. - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // The mock provider that |overlay_client_| will talk to. // |interface_provider_| will bind it.
diff --git a/media/mojo/clients/mojo_audio_decoder_unittest.cc b/media/mojo/clients/mojo_audio_decoder_unittest.cc index 2aa1fd3..5c7848f 100644 --- a/media/mojo/clients/mojo_audio_decoder_unittest.cc +++ b/media/mojo/clients/mojo_audio_decoder_unittest.cc
@@ -66,7 +66,7 @@ base::Unretained(this), base::Passed(mojo::MakeRequest(&remote_audio_decoder)))); mojo_audio_decoder_.reset( - new MojoAudioDecoder(scoped_task_environment_.GetMainThreadTaskRunner(), + new MojoAudioDecoder(task_environment_.GetMainThreadTaskRunner(), std::move(remote_audio_decoder))); } @@ -219,7 +219,7 @@ RunLoop(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; // The MojoAudioDecoder that we are testing.
diff --git a/media/mojo/clients/mojo_video_encode_accelerator_unittest.cc b/media/mojo/clients/mojo_video_encode_accelerator_unittest.cc index 43abea79..3c6c391 100644 --- a/media/mojo/clients/mojo_video_encode_accelerator_unittest.cc +++ b/media/mojo/clients/mojo_video_encode_accelerator_unittest.cc
@@ -172,7 +172,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // This member holds on to the mock implementation of the "service" side. mojo::StrongBindingPtr<mojom::VideoEncodeAccelerator> mojo_vea_binding_;
diff --git a/media/mojo/common/mojo_data_pipe_read_write_unittest.cc b/media/mojo/common/mojo_data_pipe_read_write_unittest.cc index d0abf64..3c23314 100644 --- a/media/mojo/common/mojo_data_pipe_read_write_unittest.cc +++ b/media/mojo/common/mojo_data_pipe_read_write_unittest.cc
@@ -67,7 +67,7 @@ } // namespace TEST(MojoDataPipeReadWriteTest, Normal) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; std::string kData = "hello, world"; MojoDataPipeReadWrite pipe_read_write_; pipe_read_write_.WriteAndRead(reinterpret_cast<const uint8_t*>(kData.data()), @@ -75,7 +75,7 @@ } TEST(MojoDataPipeReadWriteTest, SequentialReading) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; std::string kData1 = "hello, world"; std::string kData2 = "Bye!"; MojoDataPipeReadWrite pipe_read_write_; @@ -86,7 +86,7 @@ } TEST(MojoDataPipeReadWriteTest, LongerThanCapacity) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; std::string kData = "hello, world, hello, world, hello, world"; MojoDataPipeReadWrite pipe_read_write_(10); pipe_read_write_.WriteAndRead(reinterpret_cast<const uint8_t*>(kData.data()), @@ -94,7 +94,7 @@ } TEST(MojoDataPipeReadWriteTest, DiscardDataInPipe) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; std::string kData1 = "to be discarded"; std::string kData2 = "hello, world, hello, world, hello, world"; MojoDataPipeReadWrite pipe_read_write_(10);
diff --git a/media/mojo/common/mojo_decoder_buffer_converter_unittest.cc b/media/mojo/common/mojo_decoder_buffer_converter_unittest.cc index db659da..84c33a6a 100644 --- a/media/mojo/common/mojo_decoder_buffer_converter_unittest.cc +++ b/media/mojo/common/mojo_decoder_buffer_converter_unittest.cc
@@ -59,7 +59,7 @@ } // namespace TEST(MojoDecoderBufferConverterTest, ConvertDecoderBuffer_Normal) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; const uint8_t kData[] = "hello, world"; const uint8_t kSideData[] = "sideshow bob"; const size_t kDataSize = base::size(kData); @@ -79,7 +79,7 @@ } TEST(MojoDecoderBufferConverterTest, ConvertDecoderBuffer_EOS) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; scoped_refptr<DecoderBuffer> buffer(DecoderBuffer::CreateEOSBuffer()); MojoDecoderBufferConverter converter; @@ -89,7 +89,7 @@ // TODO(xhwang): Investigate whether we can get rid of zero-byte-buffer. // See http://crbug.com/663438 TEST(MojoDecoderBufferConverterTest, ConvertDecoderBuffer_ZeroByteBuffer) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0)); MojoDecoderBufferConverter converter; @@ -97,7 +97,7 @@ } TEST(MojoDecoderBufferConverterTest, ConvertDecoderBuffer_KeyFrame) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; const uint8_t kData[] = "hello, world"; const size_t kDataSize = base::size(kData); @@ -111,7 +111,7 @@ } TEST(MojoDecoderBufferConverterTest, ConvertDecoderBuffer_EncryptedBuffer) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; const uint8_t kData[] = "hello, world"; const size_t kDataSize = base::size(kData); const char kKeyId[] = "00112233445566778899aabbccddeeff"; @@ -150,7 +150,7 @@ // This test verifies that a DecoderBuffer larger than data-pipe capacity // can be transmitted properly. TEST(MojoDecoderBufferConverterTest, Chunked) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; const uint8_t kData[] = "Lorem ipsum dolor sit amet, consectetur cras amet"; const size_t kDataSize = base::size(kData); scoped_refptr<DecoderBuffer> buffer = @@ -163,7 +163,7 @@ // This test verifies that MojoDecoderBufferReader::ReadCB is called with a // NULL DecoderBuffer if data pipe is closed during transmission. TEST(MojoDecoderBufferConverterTest, WriterSidePipeError) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; const uint8_t kData[] = "Lorem ipsum dolor sit amet, consectetur cras amet"; const size_t kDataSize = base::size(kData); scoped_refptr<DecoderBuffer> media_buffer = @@ -191,7 +191,7 @@ // This test verifies that MojoDecoderBuffer supports concurrent writes and // reads. TEST(MojoDecoderBufferConverterTest, ConcurrentDecoderBuffers) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; // Prevent all of the buffers from fitting at once to exercise the chunking @@ -237,7 +237,7 @@ } TEST(MojoDecoderBufferConverterTest, FlushWithoutRead) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; base::MockCallback<base::OnceClosure> mock_flush_cb; @@ -250,7 +250,7 @@ } TEST(MojoDecoderBufferConverterTest, FlushAfterRead) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; const uint8_t kData[] = "Lorem ipsum dolor sit amet, consectetur cras amet"; @@ -271,7 +271,7 @@ } TEST(MojoDecoderBufferConverterTest, FlushBeforeRead) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; const uint8_t kData[] = "Lorem ipsum dolor sit amet, consectetur cras amet"; @@ -299,7 +299,7 @@ } TEST(MojoDecoderBufferConverterTest, FlushBeforeChunkedRead) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; const uint8_t kData[] = "Lorem ipsum dolor sit amet, consectetur cras amet"; @@ -328,7 +328,7 @@ } TEST(MojoDecoderBufferConverterTest, FlushDuringChunkedRead) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; const uint8_t kData[] = "Lorem ipsum dolor sit amet, consectetur cras amet"; @@ -357,7 +357,7 @@ } TEST(MojoDecoderBufferConverterTest, FlushDuringConcurrentReads) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; // Prevent all of the buffers from fitting at once to exercise the chunking
diff --git a/media/mojo/mojom/video_frame_mojom_traits_unittest.cc b/media/mojo/mojom/video_frame_mojom_traits_unittest.cc index c3d1ba2..fbb2d0a9 100644 --- a/media/mojo/mojom/video_frame_mojom_traits_unittest.cc +++ b/media/mojo/mojom/video_frame_mojom_traits_unittest.cc
@@ -53,7 +53,7 @@ std::move(callback).Run(f); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::BindingSet<TraitsTestService> traits_test_bindings_; DISALLOW_COPY_AND_ASSIGN(VideoFrameStructTraitsTest);
diff --git a/media/mojo/services/cdm_service_unittest.cc b/media/mojo/services/cdm_service_unittest.cc index cae4028..d1fd1382 100644 --- a/media/mojo/services/cdm_service_unittest.cc +++ b/media/mojo/services/cdm_service_unittest.cc
@@ -127,7 +127,7 @@ CdmService* cdm_service() { return service_.get(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; mojom::CdmServicePtr cdm_service_ptr_; mojom::CdmFactoryPtr cdm_factory_ptr_; mojom::ContentDecryptionModulePtr cdm_ptr_; @@ -207,8 +207,8 @@ } // Same as DestroyCdmFactory test, but do not disable delayed service release. -// TODO(xhwang): Use ScopedTaskEnvironment::TimeSource::MOCK_TIME and -// ScopedTaskEnvironment::FastForwardBy() so we don't have to really wait for +// TODO(xhwang): Use TaskEnvironment::TimeSource::MOCK_TIME and +// TaskEnvironment::FastForwardBy() so we don't have to really wait for // the delay in the test. But currently FastForwardBy() doesn't support delayed // task yet. TEST_F(CdmServiceTest, DestroyCdmFactory_DelayedServiceRelease) {
diff --git a/media/mojo/services/deferred_destroy_strong_binding_set_unittest.cc b/media/mojo/services/deferred_destroy_strong_binding_set_unittest.cc index 7794340..303c127 100644 --- a/media/mojo/services/deferred_destroy_strong_binding_set_unittest.cc +++ b/media/mojo/services/deferred_destroy_strong_binding_set_unittest.cc
@@ -59,7 +59,7 @@ ~DeferredDestroyStrongBindingSetTest() override = default; protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(DeferredDestroyStrongBindingSetTest, Destructor) {
diff --git a/media/mojo/services/media_service_unittest.cc b/media/mojo/services/media_service_unittest.cc index 4ebc31b..bd0a6a4 100644 --- a/media/mojo/services/media_service_unittest.cc +++ b/media/mojo/services/media_service_unittest.cc
@@ -276,7 +276,7 @@ MOCK_METHOD0(MediaServiceConnectionClosed, void()); protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestServiceManager test_service_manager_; service_manager::TestService test_service_;
diff --git a/media/mojo/services/mojo_audio_input_stream_unittest.cc b/media/mojo/services/mojo_audio_input_stream_unittest.cc index 4241233..4ae5864 100644 --- a/media/mojo/services/mojo_audio_input_stream_unittest.cc +++ b/media/mojo/services/mojo_audio_input_stream_unittest.cc
@@ -172,7 +172,7 @@ .WillOnce(SaveArg<0>(&delegate_event_handler_)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::CancelableSyncSocket local_; std::unique_ptr<TestCancelableSyncSocket> foreign_socket_; base::ReadOnlySharedMemoryRegion mem_;
diff --git a/media/mojo/services/mojo_audio_output_stream_provider_unittest.cc b/media/mojo/services/mojo_audio_output_stream_provider_unittest.cc index 3c70c07..43eb4e4 100644 --- a/media/mojo/services/mojo_audio_output_stream_provider_unittest.cc +++ b/media/mojo/services/mojo_audio_output_stream_provider_unittest.cc
@@ -68,7 +68,7 @@ } // namespace TEST(MojoAudioOutputStreamProviderTest, AcquireTwice_BadMessage) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; bool got_bad_message = false; mojo::core::SetDefaultProcessErrorCallback( base::BindRepeating([](bool* got_bad_message, @@ -104,7 +104,7 @@ TEST(MojoAudioOutputStreamProviderTest, Bitstream_BadMessageOnNonAndoirdPlatforms) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; bool got_bad_message = false; mojo::core::SetDefaultProcessErrorCallback( base::BindRepeating([](bool* got_bad_message,
diff --git a/media/mojo/services/mojo_audio_output_stream_unittest.cc b/media/mojo/services/mojo_audio_output_stream_unittest.cc index 8f76539..d40179b 100644 --- a/media/mojo/services/mojo_audio_output_stream_unittest.cc +++ b/media/mojo/services/mojo_audio_output_stream_unittest.cc
@@ -171,7 +171,7 @@ .WillOnce(SaveArg<0>(&delegate_event_handler_)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::CancelableSyncSocket local_; std::unique_ptr<TestCancelableSyncSocket> foreign_socket_; base::UnsafeSharedMemoryRegion mem_;
diff --git a/media/mojo/services/mojo_cdm_file_io_unittest.cc b/media/mojo/services/mojo_cdm_file_io_unittest.cc index b1145a3b..310353b7 100644 --- a/media/mojo/services/mojo_cdm_file_io_unittest.cc +++ b/media/mojo/services/mojo_cdm_file_io_unittest.cc
@@ -91,7 +91,7 @@ void ReportFileReadSize(int file_size_bytes) override {} - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MojoCdmFileIO> file_io_; std::unique_ptr<MockFileIOClient> client_; mojom::CdmStoragePtr cdm_storage_ptr_;
diff --git a/media/mojo/services/mojo_cdm_helper_unittest.cc b/media/mojo/services/mojo_cdm_helper_unittest.cc index 52914a0..7f960f7 100644 --- a/media/mojo/services/mojo_cdm_helper_unittest.cc +++ b/media/mojo/services/mojo_cdm_helper_unittest.cc
@@ -94,7 +94,7 @@ MojoCdmHelperTest() : helper_(&test_interface_provider_) {} ~MojoCdmHelperTest() override = default; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestInterfaceProvider test_interface_provider_; MockFileIOClient file_io_client_; MojoCdmHelper helper_;
diff --git a/media/mojo/services/mojo_video_encode_accelerator_service_unittest.cc b/media/mojo/services/mojo_video_encode_accelerator_service_unittest.cc index 35071bc..cf9f338 100644 --- a/media/mojo/services/mojo_video_encode_accelerator_service_unittest.cc +++ b/media/mojo/services/mojo_video_encode_accelerator_service_unittest.cc
@@ -120,7 +120,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::StrongBindingPtr<mojom::VideoEncodeAcceleratorClient> mojo_vea_binding_;
diff --git a/media/mojo/services/video_decode_perf_history_unittest.cc b/media/mojo/services/video_decode_perf_history_unittest.cc index 0e9c4f6..973ab39 100644 --- a/media/mojo/services/video_decode_perf_history_unittest.cc +++ b/media/mojo/services/video_decode_perf_history_unittest.cc
@@ -341,7 +341,7 @@ static constexpr double kMinPowerEfficientDecodedFramePercent = VideoDecodePerfHistory::kMinPowerEfficientDecodedFramePercent; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<ukm::TestAutoSetUkmRecorder> test_recorder_; @@ -432,7 +432,7 @@ GetFakeDB()->CompleteInitialize(true); // Allow initialize-deferred API calls to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } @@ -531,7 +531,7 @@ GetFakeDB()->CompleteInitialize(true); // Allow initialize-deferred API calls to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } @@ -559,7 +559,7 @@ GetFakeDB()->CompleteInitialize(false); // Allow initialize-deferred API calls to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } @@ -618,7 +618,7 @@ GetFakeDB()->CompleteInitialize(true); // Allow initialize-deferred API calls to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } @@ -645,14 +645,14 @@ base::BindOnce(&VideoDecodePerfHistoryTest::MockGetVideoDecodeStatsDBCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Complete successful deferred DB initialization (see comment at top of test) if (params.defer_initialize) { GetFakeDB()->CompleteInitialize(true); // Allow initialize-deferred API calls to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } @@ -675,14 +675,14 @@ base::BindOnce(&VideoDecodePerfHistoryTest::MockGetVideoDecodeStatsDBCB, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Complete failed deferred DB initialization (see comment at top of test) if (params.defer_initialize) { GetFakeDB()->CompleteInitialize(false); // Allow initialize-deferred API calls to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } @@ -734,7 +734,7 @@ GetFakeDB()->CompleteInitialize(true); // Allow initialize-deferred API calls to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } @@ -786,7 +786,7 @@ GetFakeDB()->CompleteInitialize(true); // Allow initialize-deferred API calls to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } @@ -901,7 +901,7 @@ GetFakeDB()->CompleteInitialize(true); // Allow initialize-deferred API calls to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } @@ -1021,7 +1021,7 @@ GetFakeDB()->CompleteInitialize(true); // Allow initialize-deferred API calls to complete. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } }
diff --git a/media/mojo/services/watch_time_recorder_unittest.cc b/media/mojo/services/watch_time_recorder_unittest.cc index 5428599..e1d1602 100644 --- a/media/mojo/services/watch_time_recorder_unittest.cc +++ b/media/mojo/services/watch_time_recorder_unittest.cc
@@ -160,7 +160,7 @@ MOCK_METHOD0(GetCurrentMediaTime, base::TimeDelta()); protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojom::MediaMetricsProviderPtr provider_; std::unique_ptr<base::HistogramTester> histogram_tester_; std::unique_ptr<ukm::TestAutoSetUkmRecorder> test_recorder_;
diff --git a/media/mojo/test/mojo_video_decoder_integration_test.cc b/media/mojo/test/mojo_video_decoder_integration_test.cc index 56d2d256..45f0d82a 100644 --- a/media/mojo/test/mojo_video_decoder_integration_test.cc +++ b/media/mojo/test/mojo_video_decoder_integration_test.cc
@@ -203,7 +203,7 @@ } protected: - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } void SetWriterCapacity(uint32_t capacity) { writer_capacity_ = capacity; } @@ -324,7 +324,7 @@ return std::unique_ptr<VideoDecoder>(decoder_.get()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Capacity that will be used for the MojoDecoderBufferWriter. uint32_t writer_capacity_ = 0;
diff --git a/media/mojo/test/mojo_video_encode_accelerator_integration_test.cc b/media/mojo/test/mojo_video_encode_accelerator_integration_test.cc index 3c679e5..b6c8ed3 100644 --- a/media/mojo/test/mojo_video_encode_accelerator_integration_test.cc +++ b/media/mojo/test/mojo_video_encode_accelerator_integration_test.cc
@@ -108,7 +108,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // This member holds on to the implementation of the "service" side. mojo::StrongBindingPtr<mojom::VideoEncodeAccelerator> mojo_vea_binding_;
diff --git a/media/remoting/courier_renderer_unittest.cc b/media/remoting/courier_renderer_unittest.cc index 9887c904..c81da06 100644 --- a/media/remoting/courier_renderer_unittest.cc +++ b/media/remoting/courier_renderer_unittest.cc
@@ -389,7 +389,7 @@ RunPendingTasks(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<RendererController> controller_; std::unique_ptr<RendererClientImpl> render_client_; std::unique_ptr<FakeMediaResource> media_resource_;
diff --git a/media/renderers/audio_renderer_impl_unittest.cc b/media/renderers/audio_renderer_impl_unittest.cc index 2849580f..813ea377 100644 --- a/media/renderers/audio_renderer_impl_unittest.cc +++ b/media/renderers/audio_renderer_impl_unittest.cc
@@ -507,7 +507,7 @@ // Fixture members. AudioParameters hardware_params_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; const scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; NullMediaLog media_log_; std::unique_ptr<AudioRendererImpl> renderer_;
diff --git a/media/renderers/decrypting_renderer_unittest.cc b/media/renderers/decrypting_renderer_unittest.cc index 728371c..e784d4f 100644 --- a/media/renderers/decrypting_renderer_unittest.cc +++ b/media/renderers/decrypting_renderer_unittest.cc
@@ -38,7 +38,7 @@ renderer_ = renderer.get(); decrypting_renderer_ = std::make_unique<DecryptingRenderer>( std::move(renderer), &null_media_log_, - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); EXPECT_CALL(cdm_context_, GetDecryptor()) .WillRepeatedly(Return(&decryptor_)); @@ -85,7 +85,7 @@ } bool use_aes_decryptor_ = false; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::MockCallback<CdmAttachedCB> set_cdm_cb_; base::MockCallback<PipelineStatusCB> renderer_init_cb_; NullMediaLog null_media_log_; @@ -108,7 +108,7 @@ decrypting_renderer_->Initialize(&media_resource_, &renderer_client_, renderer_init_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(decrypting_renderer_->HasDecryptingMediaResourceForTesting()); } @@ -126,7 +126,7 @@ decrypting_renderer_->SetCdm(&cdm_context_, set_cdm_cb_.Get()); decrypting_renderer_->Initialize(&media_resource_, &renderer_client_, renderer_init_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(decrypting_renderer_->HasDecryptingMediaResourceForTesting()); } @@ -144,7 +144,7 @@ decrypting_renderer_->Initialize(&media_resource_, &renderer_client_, renderer_init_cb_.Get()); decrypting_renderer_->SetCdm(&cdm_context_, set_cdm_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(decrypting_renderer_->HasDecryptingMediaResourceForTesting()); } @@ -155,7 +155,7 @@ decrypting_renderer_->Initialize(&media_resource_, &renderer_client_, renderer_init_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(decrypting_renderer_->HasDecryptingMediaResourceForTesting()); } @@ -173,7 +173,7 @@ decrypting_renderer_->Initialize(&media_resource_, &renderer_client_, renderer_init_cb_.Get()); decrypting_renderer_->SetCdm(&cdm_context_, set_cdm_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(decrypting_renderer_->HasDecryptingMediaResourceForTesting()); } @@ -191,7 +191,7 @@ decrypting_renderer_->Initialize(&media_resource_, &renderer_client_, renderer_init_cb_.Get()); decrypting_renderer_->SetCdm(&cdm_context_, set_cdm_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(decrypting_renderer_->HasDecryptingMediaResourceForTesting()); } @@ -209,7 +209,7 @@ decrypting_renderer_->SetCdm(&cdm_context_, set_cdm_cb_.Get()); decrypting_renderer_->Initialize(&media_resource_, &renderer_client_, renderer_init_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(decrypting_renderer_->HasDecryptingMediaResourceForTesting()); } @@ -227,7 +227,7 @@ decrypting_renderer_->SetCdm(&cdm_context_, set_cdm_cb_.Get()); decrypting_renderer_->Initialize(&media_resource_, &renderer_client_, renderer_init_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(decrypting_renderer_->HasDecryptingMediaResourceForTesting()); } @@ -245,7 +245,7 @@ decrypting_renderer_->Initialize(&media_resource_, &renderer_client_, renderer_init_cb_.Get()); decrypting_renderer_->SetCdm(&cdm_context_, set_cdm_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(decrypting_renderer_->HasDecryptingMediaResourceForTesting()); } @@ -259,7 +259,7 @@ decrypting_renderer_->Initialize(&media_resource_, &renderer_client_, renderer_init_cb_.Get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Cause a PIPELINE_ERROR_INITIALIZATION_FAILED error to be passed as a // parameter to the initialization callback.
diff --git a/media/renderers/paint_canvas_video_renderer_unittest.cc b/media/renderers/paint_canvas_video_renderer_unittest.cc index e94736c..286bac7 100644 --- a/media/renderers/paint_canvas_video_renderer_unittest.cc +++ b/media/renderers/paint_canvas_video_renderer_unittest.cc
@@ -384,7 +384,7 @@ SkBitmap bitmap_; cc::SkiaPaintCanvas target_canvas_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(PaintCanvasVideoRendererTest); };
diff --git a/media/renderers/renderer_impl_unittest.cc b/media/renderers/renderer_impl_unittest.cc index 30b46649..705dd19b 100644 --- a/media/renderers/renderer_impl_unittest.cc +++ b/media/renderers/renderer_impl_unittest.cc
@@ -82,7 +82,7 @@ video_renderer_(new StrictMock<MockVideoRenderer>()), audio_renderer_(new StrictMock<MockAudioRenderer>()), renderer_impl_( - new RendererImpl(scoped_task_environment_.GetMainThreadTaskRunner(), + new RendererImpl(task_environment_.GetMainThreadTaskRunner(), std::unique_ptr<AudioRenderer>(audio_renderer_), std::unique_ptr<VideoRenderer>(video_renderer_))), cdm_context_(new StrictMock<MockCdmContext>()), @@ -346,7 +346,7 @@ } // Fixture members. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; StrictMock<CallbackHelper> callbacks_; base::SimpleTestTickClock test_tick_clock_;
diff --git a/media/renderers/video_renderer_impl_unittest.cc b/media/renderers/video_renderer_impl_unittest.cc index 3caab78..b09b6eee 100644 --- a/media/renderers/video_renderer_impl_unittest.cc +++ b/media/renderers/video_renderer_impl_unittest.cc
@@ -304,7 +304,7 @@ MOCK_METHOD0(OnSimulateDecodeDelay, base::TimeDelta(void)); protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; NullMediaLog media_log_; // Fixture members.
diff --git a/media/renderers/video_resource_updater_unittest.cc b/media/renderers/video_resource_updater_unittest.cc index 8e4edf88..f2cfd41 100644 --- a/media/renderers/video_resource_updater_unittest.cc +++ b/media/renderers/video_resource_updater_unittest.cc
@@ -245,7 +245,7 @@ // VideoResourceUpdater registers as a MemoryDumpProvider, which requires // a TaskRunner. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; UploadCounterGLES2Interface* gl_; scoped_refptr<viz::TestContextProvider> context_provider_; FakeSharedBitmapReporter shared_bitmap_reporter_;
diff --git a/media/test/pipeline_integration_fuzzertest.cc b/media/test/pipeline_integration_fuzzertest.cc index 04b1c44..367e96e84 100644 --- a/media/test/pipeline_integration_fuzzertest.cc +++ b/media/test/pipeline_integration_fuzzertest.cc
@@ -227,7 +227,7 @@ Environment() { base::CommandLine::Init(0, nullptr); - // |test| instances uses ScopedTaskEnvironment, which needs TestTimeouts. + // |test| instances uses TaskEnvironment, which needs TestTimeouts. TestTimeouts::Initialize(); media::InitializeMediaLibrary();
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc index be371b36b..4ba43f1 100644 --- a/media/test/pipeline_integration_test.cc +++ b/media/test/pipeline_integration_test.cc
@@ -1627,7 +1627,7 @@ source.RemoveRange(base::TimeDelta::FromMilliseconds(1000), base::TimeDelta::FromMilliseconds(k320WebMFileDurationMs)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); buffered_ranges = pipeline_->GetBufferedTimeRanges(); EXPECT_EQ(1u, buffered_ranges.size()); @@ -1662,7 +1662,7 @@ // reached (the data will be evicted from the front of the buffered range). source.EvictCodedFrames(media_time, file->data_size()); source.AppendAtTime(media_time, file->data(), file->data_size()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); buffered_ranges = pipeline_->GetBufferedTimeRanges(); } while (buffered_ranges.size() == 1 &&
diff --git a/media/test/pipeline_integration_test_base.cc b/media/test/pipeline_integration_test_base.cc index 109e4b6..654720f 100644 --- a/media/test/pipeline_integration_test_base.cc +++ b/media/test/pipeline_integration_test_base.cc
@@ -133,10 +133,9 @@ webaudio_attached_(false), mono_output_(false), fuzzing_(false), - pipeline_( - new PipelineImpl(scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner(), - &media_log_)), + pipeline_(new PipelineImpl(task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), + &media_log_)), ended_(false), pipeline_status_(PIPELINE_OK), last_video_frame_format_(PIXEL_FORMAT_UNKNOWN), @@ -229,7 +228,7 @@ base::RunLoop run_loop; RunUntilQuitOrEndedOrError(&run_loop); } else { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } return pipeline_status_; } @@ -417,7 +416,7 @@ return; } - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, base::BindOnce(&PipelineIntegrationTestBase::QuitAfterCurrentTimeTask, base::Unretained(this), quit_time, @@ -432,7 +431,7 @@ DCHECK(wait_time <= pipeline_->GetMediaDuration()); base::RunLoop run_loop; - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, base::BindOnce(&PipelineIntegrationTestBase::QuitAfterCurrentTimeTask, base::Unretained(this), wait_time, @@ -450,7 +449,7 @@ #if BUILDFLAG(ENABLE_FFMPEG) demuxer_ = std::unique_ptr<Demuxer>(new FFmpegDemuxer( - scoped_task_environment_.GetMainThreadTaskRunner(), data_source_.get(), + task_environment_.GetMainThreadTaskRunner(), data_source_.get(), base::BindRepeating( &PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB, base::Unretained(this)), @@ -468,11 +467,11 @@ clockless_playback_, base::TimeDelta::FromSecondsD(1.0 / 60), base::Bind(&PipelineIntegrationTestBase::OnVideoFramePaint, base::Unretained(this)), - scoped_task_environment_.GetMainThreadTaskRunner())); + task_environment_.GetMainThreadTaskRunner())); // Disable frame dropping if hashing is enabled. std::unique_ptr<VideoRenderer> video_renderer(new VideoRendererImpl( - scoped_task_environment_.GetMainThreadTaskRunner(), video_sink_.get(), + task_environment_.GetMainThreadTaskRunner(), video_sink_.get(), base::Bind(&CreateVideoDecodersForTest, &media_log_, prepend_video_decoders_cb), false, &media_log_, nullptr)); @@ -481,7 +480,7 @@ DCHECK(!mono_output_) << " NullAudioSink doesn't specify output parameters"; audio_sink_ = - new NullAudioSink(scoped_task_environment_.GetMainThreadTaskRunner()); + new NullAudioSink(task_environment_.GetMainThreadTaskRunner()); } else { ChannelLayout output_layout = mono_output_ ? CHANNEL_LAYOUT_MONO : CHANNEL_LAYOUT_STEREO; @@ -501,12 +500,12 @@ } std::unique_ptr<AudioRenderer> audio_renderer(new AudioRendererImpl( - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), (clockless_playback_) ? static_cast<AudioRendererSink*>(clockless_audio_sink_.get()) : audio_sink_.get(), base::Bind(&CreateAudioDecodersForTest, &media_log_, - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), prepend_audio_decoders_cb), &media_log_)); if (hashing_enabled_) { @@ -520,7 +519,7 @@ ->SetPlayDelayCBForTesting(std::move(audio_play_delay_cb_)); std::unique_ptr<RendererImpl> renderer_impl( - new RendererImpl(scoped_task_environment_.GetMainThreadTaskRunner(), + new RendererImpl(task_environment_.GetMainThreadTaskRunner(), std::move(audio_renderer), std::move(video_renderer))); // Prevent non-deterministic buffering state callbacks from firing (e.g., slow @@ -673,7 +672,7 @@ run_loop->Run(); on_ended_closure_ = base::OnceClosure(); on_error_closure_ = base::OnceClosure(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void PipelineIntegrationTestBase::RunUntilQuitOrEndedOrError(
diff --git a/media/test/pipeline_integration_test_base.h b/media/test/pipeline_integration_test_base.h index 1b43eb4e..f514cec3 100644 --- a/media/test/pipeline_integration_test_base.h +++ b/media/test/pipeline_integration_test_base.h
@@ -151,7 +151,7 @@ protected: NiceMock<MockMediaLog> media_log_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::MD5Context md5_context_; bool hashing_enabled_; bool clockless_playback_; @@ -249,7 +249,7 @@ private: // Runs |run_loop| until it is explicitly Quit() by some part of the calling // test fixture or when an error occurs (by setting |on_error_closure_|). The - // |scoped_task_environment_| is RunUntilIdle() after the RunLoop finishes + // |task_environment_| is RunUntilIdle() after the RunLoop finishes // running, before returning to the caller. void RunUntilQuitOrError(base::RunLoop* run_loop);
diff --git a/media/webrtc/audio_processor_unittest.cc b/media/webrtc/audio_processor_unittest.cc index 31d5d1e..bf244d9f 100644 --- a/media/webrtc/audio_processor_unittest.cc +++ b/media/webrtc/audio_processor_unittest.cc
@@ -152,7 +152,7 @@ return settings; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; media::AudioParameters params_; };
diff --git a/mojo/core/data_pipe_unittest.cc b/mojo/core/data_pipe_unittest.cc index a4675079..c034dc7 100644 --- a/mojo/core/data_pipe_unittest.cc +++ b/mojo/core/data_pipe_unittest.cc
@@ -1986,7 +1986,7 @@ EXPECT_EQ(MOJO_RESULT_OK, WaitForSignals(consumers[0], MOJO_HANDLE_SIGNAL_PEER_CLOSED)); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Wait on producer 1 and consumer 1 using SimpleWatchers. {
diff --git a/mojo/core/invitation_unittest.cc b/mojo/core/invitation_unittest.cc index 674a4fe8..9cb4245 100644 --- a/mojo/core/invitation_unittest.cc +++ b/mojo/core/invitation_unittest.cc
@@ -66,7 +66,7 @@ base::StringPiece isolated_invitation_name); private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(InvitationTest); };
diff --git a/mojo/core/multiprocess_message_pipe_unittest.cc b/mojo/core/multiprocess_message_pipe_unittest.cc index 60332c07..1df06fe 100644 --- a/mojo/core/multiprocess_message_pipe_unittest.cc +++ b/mojo/core/multiprocess_message_pipe_unittest.cc
@@ -1274,7 +1274,7 @@ EXPECT_EQ(MOJO_RESULT_OK, WaitForSignals(handles[0], MOJO_HANDLE_SIGNAL_PEER_CLOSED)); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Wait on handle 1 using a SimpleWatcher. {
diff --git a/mojo/core/ports/ports_unittest.cc b/mojo/core/ports/ports_unittest.cc index 40c278b..fbacc61 100644 --- a/mojo/core/ports/ports_unittest.cc +++ b/mojo/core/ports/ports_unittest.cc
@@ -423,7 +423,7 @@ } } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Acquired before any operation which makes a Node busy, and before testing // if all nodes are idle.
diff --git a/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc b/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc index 5387831..58684fa0 100644 --- a/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc +++ b/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
@@ -137,7 +137,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; scoped_refptr<base::SequencedTaskRunner> main_runner_; };
diff --git a/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc b/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc index fb7f778..098f2098 100644 --- a/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc +++ b/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc
@@ -197,7 +197,7 @@ impl_.reset(new ImplType(std::move(receiver), receiver_task_runner_)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<TestTaskRunner> receiver_task_runner_; scoped_refptr<TestTaskRunner> remote_task_runner_; @@ -235,7 +235,7 @@ void QuitTaskRunner() { connection_receiver_task_runner_->Quit(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<TestTaskRunner> connection_receiver_task_runner_; scoped_refptr<TestTaskRunner> connection_remote_task_runner_; scoped_refptr<TestTaskRunner> sender_receiver_task_runner_;
diff --git a/mojo/public/cpp/bindings/tests/bindings_perftest.cc b/mojo/public/cpp/bindings/tests/bindings_perftest.cc index be70f08e..e6f2c917 100644 --- a/mojo/public/cpp/bindings/tests/bindings_perftest.cc +++ b/mojo/public/cpp/bindings/tests/bindings_perftest.cc
@@ -93,7 +93,7 @@ MojoBindingsPerftest() = default; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(MojoBindingsPerftest, InProcessPingPong) {
diff --git a/mojo/public/cpp/bindings/tests/bindings_test_base.h b/mojo/public/cpp/bindings/tests/bindings_test_base.h index 32ddca1..9b03605 100644 --- a/mojo/public/cpp/bindings/tests/bindings_test_base.h +++ b/mojo/public/cpp/bindings/tests/bindings_test_base.h
@@ -35,7 +35,7 @@ static void SetupSerializationBehavior(BindingsTestSerializationMode mode); private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; } // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/connection_group_unittest.cc b/mojo/public/cpp/bindings/tests/connection_group_unittest.cc index fcba7cf..77a66201 100644 --- a/mojo/public/cpp/bindings/tests/connection_group_unittest.cc +++ b/mojo/public/cpp/bindings/tests/connection_group_unittest.cc
@@ -24,7 +24,7 @@ ConnectionGroupTest() = default; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(ConnectionGroupTest); };
diff --git a/mojo/public/cpp/bindings/tests/connector_unittest.cc b/mojo/public/cpp/bindings/tests/connector_unittest.cc index b4e4438..b34367ec 100644 --- a/mojo/public/cpp/bindings/tests/connector_unittest.cc +++ b/mojo/public/cpp/bindings/tests/connector_unittest.cc
@@ -109,7 +109,7 @@ ScopedMessagePipeHandle handle1_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(ConnectorTest, Basic) {
diff --git a/mojo/public/cpp/bindings/tests/data_view_unittest.cc b/mojo/public/cpp/bindings/tests/data_view_unittest.cc index 99c860f..e908440 100644 --- a/mojo/public/cpp/bindings/tests/data_view_unittest.cc +++ b/mojo/public/cpp/bindings/tests/data_view_unittest.cc
@@ -23,7 +23,7 @@ class DataViewTest : public testing::Test { private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; struct DataViewHolder {
diff --git a/mojo/public/cpp/bindings/tests/e2e_perftest.cc b/mojo/public/cpp/bindings/tests/e2e_perftest.cc index 7c7d600..84505328 100644 --- a/mojo/public/cpp/bindings/tests/e2e_perftest.cc +++ b/mojo/public/cpp/bindings/tests/e2e_perftest.cc
@@ -130,7 +130,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: void RunTests(MojoHandle client_mp, const std::string& test_name) { @@ -175,8 +175,8 @@ base::BindOnce( &CreateAndRunService, std::move(receiver), base::BindOnce(base::IgnoreResult(&base::TaskRunner::PostTask), - scoped_task_environment_.GetMainThreadTaskRunner(), - FROM_HERE, run_loop.QuitClosure()))); + task_environment_.GetMainThreadTaskRunner(), FROM_HERE, + run_loop.QuitClosure()))); run_loop.Run(); } @@ -185,9 +185,8 @@ MojoHandle client_mp, service_mp; CreateMessagePipe(&client_mp, &service_mp); WriteMessageWithHandles(mp, "hello", &service_mp, 1); - RunTestOnTaskRunner( - scoped_task_environment_.GetMainThreadTaskRunner().get(), client_mp, - "MultiProcessEchoMainThread"); + RunTestOnTaskRunner(task_environment_.GetMainThreadTaskRunner().get(), + client_mp, "MultiProcessEchoMainThread"); }); }
diff --git a/mojo/public/cpp/bindings/tests/lazy_serialization_unittest.cc b/mojo/public/cpp/bindings/tests/lazy_serialization_unittest.cc index 424e47d23..9a47e79 100644 --- a/mojo/public/cpp/bindings/tests/lazy_serialization_unittest.cc +++ b/mojo/public/cpp/bindings/tests/lazy_serialization_unittest.cc
@@ -22,7 +22,7 @@ ~LazySerializationTest() override = default; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(LazySerializationTest); };
diff --git a/mojo/public/cpp/bindings/tests/multiplex_router_unittest.cc b/mojo/public/cpp/bindings/tests/multiplex_router_unittest.cc index 7da9906..d4cc81d 100644 --- a/mojo/public/cpp/bindings/tests/multiplex_router_unittest.cc +++ b/mojo/public/cpp/bindings/tests/multiplex_router_unittest.cc
@@ -61,7 +61,7 @@ ScopedInterfaceEndpointHandle endpoint1_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(MultiplexRouterTest, BasicRequestResponse) {
diff --git a/mojo/public/cpp/bindings/tests/new_endpoint_types_unittest.cc b/mojo/public/cpp/bindings/tests/new_endpoint_types_unittest.cc index d421da9c..a293e16 100644 --- a/mojo/public/cpp/bindings/tests/new_endpoint_types_unittest.cc +++ b/mojo/public/cpp/bindings/tests/new_endpoint_types_unittest.cc
@@ -179,7 +179,7 @@ // demonstrate look & feel as well as to ensure basic completeness and // correctness. - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; // A Remote<T> exposes a callable T interface which sends messages to a remote // implementation of T. Here we create a new unbound Remote which will control @@ -263,7 +263,7 @@ } TEST(NewEndpointTypesTest, AssociatedTypes) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; mojo::Remote<mojom::AssociatedPingerHost> host; AssociatedPingerHostImpl host_impl(host.BindNewPipeAndPassReceiver());
diff --git a/mojo/public/cpp/bindings/tests/pickle_unittest.cc b/mojo/public/cpp/bindings/tests/pickle_unittest.cc index d3015d2..6c4b753 100644 --- a/mojo/public/cpp/bindings/tests/pickle_unittest.cc +++ b/mojo/public/cpp/bindings/tests/pickle_unittest.cc
@@ -191,7 +191,7 @@ }; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ChromiumPicklePasserImpl chromium_service_; ReceiverSet<PicklePasser> chromium_receivers_; BlinkPicklePasserImpl blink_service_;
diff --git a/mojo/public/cpp/bindings/tests/receiver_callback_unittest.cc b/mojo/public/cpp/bindings/tests/receiver_callback_unittest.cc index 5a4200e..ff0260cb 100644 --- a/mojo/public/cpp/bindings/tests/receiver_callback_unittest.cc +++ b/mojo/public/cpp/bindings/tests/receiver_callback_unittest.cc
@@ -109,7 +109,7 @@ void PumpMessages() { base::RunLoop().RunUntilIdle(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Tests that the Remote and the Receiver can communicate with each other
diff --git a/mojo/public/cpp/bindings/tests/remote_unittest.cc b/mojo/public/cpp/bindings/tests/remote_unittest.cc index 41ad249..0f80ebe2 100644 --- a/mojo/public/cpp/bindings/tests/remote_unittest.cc +++ b/mojo/public/cpp/bindings/tests/remote_unittest.cc
@@ -502,7 +502,7 @@ }; TEST(StrongConnectorTest, Math) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; bool disconnected = false; bool destroyed = false; @@ -578,7 +578,7 @@ }; TEST(WeakConnectorTest, Math) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; bool disconnected = false; bool destroyed = false;
diff --git a/mojo/public/cpp/bindings/tests/service_factory_unittest.cc b/mojo/public/cpp/bindings/tests/service_factory_unittest.cc index 98f4e37..bd0c5915 100644 --- a/mojo/public/cpp/bindings/tests/service_factory_unittest.cc +++ b/mojo/public/cpp/bindings/tests/service_factory_unittest.cc
@@ -25,7 +25,7 @@ ServiceFactoryTest() = default; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(ServiceFactoryTest); };
diff --git a/mojo/public/cpp/bindings/tests/struct_traits_unittest.cc b/mojo/public/cpp/bindings/tests/struct_traits_unittest.cc index 2ae29a9..3de4a01 100644 --- a/mojo/public/cpp/bindings/tests/struct_traits_unittest.cc +++ b/mojo/public/cpp/bindings/tests/struct_traits_unittest.cc
@@ -188,7 +188,7 @@ std::move(callback).Run(std::move(u)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ChromiumRectServiceImpl chromium_service_; ReceiverSet<RectService> chromium_receivers_;
diff --git a/mojo/public/cpp/bindings/tests/sync_method_unittest.cc b/mojo/public/cpp/bindings/tests/sync_method_unittest.cc index cea8f73d..ad2f16e 100644 --- a/mojo/public/cpp/bindings/tests/sync_method_unittest.cc +++ b/mojo/public/cpp/bindings/tests/sync_method_unittest.cc
@@ -295,7 +295,7 @@ ~SyncMethodTest() override = default; protected: - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; }; template <typename TypeParam> @@ -409,7 +409,7 @@ // so gtest can instantiate copies for each |TypeParam|. template <typename TypeParam> class SequencedTaskRunnerTestLauncher : public testing::Test { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; }; // Similar to SyncMethodCommonTest, but the test body runs on a
diff --git a/mojo/public/cpp/bindings/tests/test_helpers_unittest.cc b/mojo/public/cpp/bindings/tests/test_helpers_unittest.cc index 8cbdaaf..17dcc458 100644 --- a/mojo/public/cpp/bindings/tests/test_helpers_unittest.cc +++ b/mojo/public/cpp/bindings/tests/test_helpers_unittest.cc
@@ -21,7 +21,7 @@ ~TestHelperTest() override = default; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(TestHelperTest); };
diff --git a/mojo/public/cpp/bindings/tests/union_unittest.cc b/mojo/public/cpp/bindings/tests/union_unittest.cc index 9d5406f..d11ee8e 100644 --- a/mojo/public/cpp/bindings/tests/union_unittest.cc +++ b/mojo/public/cpp/bindings/tests/union_unittest.cc
@@ -1148,7 +1148,7 @@ }; TEST(UnionTest, InterfaceInUnion) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; SmallCacheImpl impl(run_loop.QuitClosure()); Remote<SmallCache> remote; @@ -1164,7 +1164,7 @@ } TEST(UnionTest, InterfaceInUnionFactoryFunction) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; SmallCacheImpl impl(run_loop.QuitClosure()); Remote<SmallCache> remote; @@ -1178,7 +1178,7 @@ } TEST(UnionTest, InterfaceInUnionSerialization) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; SmallCacheImpl impl(run_loop.QuitClosure()); Remote<SmallCache> remote; @@ -1215,7 +1215,7 @@ }; TEST(UnionTest, UnionInInterface) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; UnionInterfaceImpl impl; Remote<UnionInterface> remote; Receiver<UnionInterface> receiver(&impl, remote.BindNewPipeAndPassReceiver());
diff --git a/mojo/public/cpp/bindings/tests/validation_unittest.cc b/mojo/public/cpp/bindings/tests/validation_unittest.cc index 4809df9..f59a335 100644 --- a/mojo/public/cpp/bindings/tests/validation_unittest.cc +++ b/mojo/public/cpp/bindings/tests/validation_unittest.cc
@@ -220,7 +220,7 @@ ValidationTest() {} protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; class ValidationIntegrationTest : public ValidationTest {
diff --git a/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc b/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc index 770b8c85..8a78dce2 100644 --- a/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc +++ b/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc
@@ -59,7 +59,7 @@ WTFTypesTest() {} private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; WTF::Vector<WTF::String> ConstructStringArray() {
diff --git a/mojo/public/cpp/system/tests/data_pipe_drainer_unittest.cc b/mojo/public/cpp/system/tests/data_pipe_drainer_unittest.cc index b1f97d79..c35d50f 100644 --- a/mojo/public/cpp/system/tests/data_pipe_drainer_unittest.cc +++ b/mojo/public/cpp/system/tests/data_pipe_drainer_unittest.cc
@@ -37,7 +37,7 @@ void OnDataComplete() override { completion_callback_.Run(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::string data_; std::unique_ptr<DataPipeDrainer> drainer_;
diff --git a/mojo/public/cpp/system/tests/data_pipe_producer_unittest.cc b/mojo/public/cpp/system/tests/data_pipe_producer_unittest.cc index 79a883b..74028b9 100644 --- a/mojo/public/cpp/system/tests/data_pipe_producer_unittest.cc +++ b/mojo/public/cpp/system/tests/data_pipe_producer_unittest.cc
@@ -132,7 +132,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; int tmp_file_id_ = 0;
diff --git a/mojo/public/cpp/system/tests/handle_signal_tracker_unittest.cc b/mojo/public/cpp/system/tests/handle_signal_tracker_unittest.cc index 6e0f1b8..bbdd343 100644 --- a/mojo/public/cpp/system/tests/handle_signal_tracker_unittest.cc +++ b/mojo/public/cpp/system/tests/handle_signal_tracker_unittest.cc
@@ -33,7 +33,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(HandleSignalTrackerTest); };
diff --git a/mojo/public/cpp/system/tests/invitation_unittest.cc b/mojo/public/cpp/system/tests/invitation_unittest.cc index 138751d..93f12f5 100644 --- a/mojo/public/cpp/system/tests/invitation_unittest.cc +++ b/mojo/public/cpp/system/tests/invitation_unittest.cc
@@ -172,7 +172,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::Process child_process_; DISALLOW_COPY_AND_ASSIGN(InvitationCppTest); @@ -264,7 +264,7 @@ } TEST(InvitationCppTest_NoParam, SendIsolatedInvitationWithDuplicateName) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; PlatformChannel channel1; PlatformChannel channel2; const char kConnectionName[] = "foo";
diff --git a/mojo/public/cpp/system/tests/scope_to_message_pipe_unittest.cc b/mojo/public/cpp/system/tests/scope_to_message_pipe_unittest.cc index 562ef221..160b93d 100644 --- a/mojo/public/cpp/system/tests/scope_to_message_pipe_unittest.cc +++ b/mojo/public/cpp/system/tests/scope_to_message_pipe_unittest.cc
@@ -34,7 +34,7 @@ ~ScopeToMessagePipeTest() override = default; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(ScopeToMessagePipeTest); };
diff --git a/mojo/public/cpp/system/tests/simple_watcher_unittest.cc b/mojo/public/cpp/system/tests/simple_watcher_unittest.cc index c2e0fed2..b624b9e 100644 --- a/mojo/public/cpp/system/tests/simple_watcher_unittest.cc +++ b/mojo/public/cpp/system/tests/simple_watcher_unittest.cc
@@ -40,7 +40,7 @@ ~SimpleWatcherTest() override {} private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(SimpleWatcherTest); };
diff --git a/mojo/public/cpp/system/tests/string_data_source_unittest.cc b/mojo/public/cpp/system/tests/string_data_source_unittest.cc index c18e92cb..be0603a0 100644 --- a/mojo/public/cpp/system/tests/string_data_source_unittest.cc +++ b/mojo/public/cpp/system/tests/string_data_source_unittest.cc
@@ -126,7 +126,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(StringDataSourceTest); };
diff --git a/net/BUILD.gn b/net/BUILD.gn index 97080e6..d3a292c 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -1168,7 +1168,6 @@ "spdy/platform/impl/spdy_mem_slice_impl.cc", "spdy/platform/impl/spdy_mem_slice_impl.h", "spdy/platform/impl/spdy_ptr_util_impl.h", - "spdy/platform/impl/spdy_string_impl.h", "spdy/platform/impl/spdy_string_piece_impl.h", "spdy/platform/impl/spdy_string_utils_impl.cc", "spdy/platform/impl/spdy_string_utils_impl.h", @@ -1538,6 +1537,8 @@ "third_party/quiche/src/quic/core/qpack/qpack_encoder_stream_sender.h", "third_party/quiche/src/quic/core/qpack/qpack_header_table.cc", "third_party/quiche/src/quic/core/qpack/qpack_header_table.h", + "third_party/quiche/src/quic/core/qpack/qpack_index_conversions.cc", + "third_party/quiche/src/quic/core/qpack/qpack_index_conversions.h", "third_party/quiche/src/quic/core/qpack/qpack_instruction_decoder.cc", "third_party/quiche/src/quic/core/qpack/qpack_instruction_decoder.h", "third_party/quiche/src/quic/core/qpack/qpack_instruction_encoder.cc", @@ -1776,7 +1777,6 @@ "third_party/quiche/src/spdy/platform/api/spdy_map_util.h", "third_party/quiche/src/spdy/platform/api/spdy_mem_slice.h", "third_party/quiche/src/spdy/platform/api/spdy_ptr_util.h", - "third_party/quiche/src/spdy/platform/api/spdy_string.h", "third_party/quiche/src/spdy/platform/api/spdy_string_piece.h", "third_party/quiche/src/spdy/platform/api/spdy_string_utils.h", "third_party/quiche/src/spdy/platform/api/spdy_unsafe_arena.h", @@ -5542,6 +5542,7 @@ "third_party/quiche/src/quic/core/qpack/qpack_encoder_stream_sender_test.cc", "third_party/quiche/src/quic/core/qpack/qpack_encoder_test.cc", "third_party/quiche/src/quic/core/qpack/qpack_header_table_test.cc", + "third_party/quiche/src/quic/core/qpack/qpack_index_conversions_test.cc", "third_party/quiche/src/quic/core/qpack/qpack_instruction_decoder_test.cc", "third_party/quiche/src/quic/core/qpack/qpack_instruction_encoder_test.cc", "third_party/quiche/src/quic/core/qpack/qpack_receive_stream_test.cc",
diff --git a/net/android/http_auth_negotiate_android_unittest.cc b/net/android/http_auth_negotiate_android_unittest.cc index e88265d0..0c9ed30 100644 --- a/net/android/http_auth_negotiate_android_unittest.cc +++ b/net/android/http_auth_negotiate_android_unittest.cc
@@ -18,7 +18,7 @@ namespace android { TEST(HttpAuthNegotiateAndroidTest, GenerateAuthToken) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; DummySpnegoAuthenticator::EnsureTestAccountExists();
diff --git a/net/android/network_change_notifier_android.cc b/net/android/network_change_notifier_android.cc index 89812539..4cf89f9 100644 --- a/net/android/network_change_notifier_android.cc +++ b/net/android/network_change_notifier_android.cc
@@ -209,7 +209,7 @@ // Ensure |blocking_thread_objects_| lives on // |blocking_thread_runner_| to prevent races where // NetworkChangeNotifierAndroid outlives - // ScopedTaskEnvironment. https://crbug.com/938126 + // TaskEnvironment. https://crbug.com/938126 base::OnTaskRunnerDeleter(blocking_thread_runner_)), force_network_handles_supported_for_testing_(false) { CHECK_EQ(NetId::INVALID, NetworkChangeNotifier::kInvalidNetworkHandle)
diff --git a/net/android/network_change_notifier_android_unittest.cc b/net/android/network_change_notifier_android_unittest.cc index 6ae9d7d..225c20b 100644 --- a/net/android/network_change_notifier_android_unittest.cc +++ b/net/android/network_change_notifier_android_unittest.cc
@@ -153,8 +153,7 @@ } // namespace -class BaseNetworkChangeNotifierAndroidTest - : public TestWithScopedTaskEnvironment { +class BaseNetworkChangeNotifierAndroidTest : public TestWithTaskEnvironment { protected: typedef NetworkChangeNotifier::ConnectionType ConnectionType; typedef NetworkChangeNotifier::ConnectionSubtype ConnectionSubtype;
diff --git a/net/android/traffic_stats_unittest.cc b/net/android/traffic_stats_unittest.cc index a3d30eee..b7332bf 100644 --- a/net/android/traffic_stats_unittest.cc +++ b/net/android/traffic_stats_unittest.cc
@@ -16,8 +16,8 @@ namespace { TEST(TrafficStatsAndroidTest, BasicsTest) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); EmbeddedTestServer embedded_test_server; embedded_test_server.ServeFilesFromDirectory( @@ -52,8 +52,8 @@ } TEST(TrafficStatsAndroidTest, UIDBasicsTest) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); EmbeddedTestServer embedded_test_server; embedded_test_server.ServeFilesFromDirectory(
diff --git a/net/base/address_tracker_linux_unittest.cc b/net/base/address_tracker_linux_unittest.cc index 28739b1..c97ebcd 100644 --- a/net/base/address_tracker_linux_unittest.cc +++ b/net/base/address_tracker_linux_unittest.cc
@@ -721,8 +721,8 @@ }; TEST_F(AddressTrackerLinuxTest, BroadcastInit) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); InitializeAddressTracker(true); GetCurrentConnectionTypeRunner runner1(tracker_.get(), "waiter_thread_1");
diff --git a/net/base/directory_lister_unittest.cc b/net/base/directory_lister_unittest.cc index 8fa39dfa..833e988 100644 --- a/net/base/directory_lister_unittest.cc +++ b/net/base/directory_lister_unittest.cc
@@ -131,8 +131,7 @@ } // namespace -class DirectoryListerTest : public PlatformTest, - public WithScopedTaskEnvironment { +class DirectoryListerTest : public PlatformTest, public WithTaskEnvironment { public: DirectoryListerTest() : total_created_file_system_objects_in_temp_root_dir_(0),
diff --git a/net/base/elements_upload_data_stream_unittest.cc b/net/base/elements_upload_data_stream_unittest.cc index acc14e4..3ed0343 100644 --- a/net/base/elements_upload_data_stream_unittest.cc +++ b/net/base/elements_upload_data_stream_unittest.cc
@@ -144,7 +144,7 @@ } // namespace class ElementsUploadDataStreamTest : public PlatformTest, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { public: void SetUp() override { PlatformTest::SetUp();
diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc index 34caefaa..5000ce3 100644 --- a/net/base/file_stream_unittest.cc +++ b/net/base/file_stream_unittest.cc
@@ -56,7 +56,7 @@ } // namespace -class FileStreamTest : public PlatformTest, public WithScopedTaskEnvironment { +class FileStreamTest : public PlatformTest, public WithTaskEnvironment { public: void SetUp() override { PlatformTest::SetUp();
diff --git a/net/base/fuzzer_test_support.cc b/net/base/fuzzer_test_support.cc index 60bb664..656472b 100644 --- a/net/base/fuzzer_test_support.cc +++ b/net/base/fuzzer_test_support.cc
@@ -19,12 +19,11 @@ InitGlobals() { base::CommandLine::Init(0, nullptr); - // |test| instances uses ScopedTaskEnvironment, which needs TestTimeouts. + // |test| instances uses TaskEnvironment, which needs TestTimeouts. TestTimeouts::Initialize(); - scoped_task_environment = - std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + task_environment = std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::MainThreadType::IO); // Set up ICU. ICU is used internally by GURL, which is used throughout the // //net code. Initializing ICU is important to prevent fuzztests from @@ -37,9 +36,9 @@ } // A number of tests use async code which depends on there being a - // ScopedTaskEnvironment. Setting one up here allows tests to reuse the - // ScopedTaskEnvironment between runs. - std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment; + // TaskEnvironment. Setting one up here allows tests to reuse the + // TaskEnvironment between runs. + std::unique_ptr<base::test::TaskEnvironment> task_environment; base::AtExitManager at_exit_manager; };
diff --git a/net/base/layered_network_delegate.cc b/net/base/layered_network_delegate.cc index 9f47088..f901dccc 100644 --- a/net/base/layered_network_delegate.cc +++ b/net/base/layered_network_delegate.cc
@@ -229,14 +229,17 @@ bool LayeredNetworkDelegate::OnForcePrivacyMode( const GURL& url, - const GURL& site_for_cookies) const { - return OnForcePrivacyModeInternal(url, site_for_cookies) || - nested_network_delegate_->ForcePrivacyMode(url, site_for_cookies); + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const { + return OnForcePrivacyModeInternal(url, site_for_cookies, top_frame_origin) || + nested_network_delegate_->ForcePrivacyMode(url, site_for_cookies, + top_frame_origin); } bool LayeredNetworkDelegate::OnForcePrivacyModeInternal( const GURL& url, - const GURL& site_for_cookies) const { + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const { return false; }
diff --git a/net/base/layered_network_delegate.h b/net/base/layered_network_delegate.h index 9c65037b..e8c855c 100644 --- a/net/base/layered_network_delegate.h +++ b/net/base/layered_network_delegate.h
@@ -89,8 +89,10 @@ bool OnCanAccessFile(const URLRequest& request, const base::FilePath& original_path, const base::FilePath& absolute_path) const final; - bool OnForcePrivacyMode(const GURL& url, - const GURL& site_for_cookies) const final; + bool OnForcePrivacyMode( + const GURL& url, + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const final; bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( const URLRequest& request, const GURL& target_url, @@ -170,8 +172,10 @@ // If this returns false, it short circuits the corresponding call in any // nested NetworkDelegates. - virtual bool OnForcePrivacyModeInternal(const GURL& url, - const GURL& site_for_cookies) const; + virtual bool OnForcePrivacyModeInternal( + const GURL& url, + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const; // If this returns false, it short circuits the corresponding call in any // nested NetworkDelegates.
diff --git a/net/base/layered_network_delegate_unittest.cc b/net/base/layered_network_delegate_unittest.cc index b6b867e..a0043f9 100644 --- a/net/base/layered_network_delegate_unittest.cc +++ b/net/base/layered_network_delegate_unittest.cc
@@ -12,6 +12,7 @@ #include "base/files/file_path.h" #include "base/macros.h" #include "base/memory/ref_counted.h" +#include "base/optional.h" #include "net/base/auth.h" #include "net/base/net_errors.h" #include "net/base/network_delegate_impl.h" @@ -137,8 +138,10 @@ return false; } - bool OnForcePrivacyMode(const GURL& url, - const GURL& site_for_cookies) const override { + bool OnForcePrivacyMode( + const GURL& url, + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const override { IncrementAndCompareCounter("on_force_privacy_mode_count"); return false; } @@ -211,7 +214,7 @@ EXPECT_FALSE( OnCanSetCookie(*request, net::CanonicalCookie(), nullptr, true)); EXPECT_FALSE(OnCanAccessFile(*request, base::FilePath(), base::FilePath())); - EXPECT_FALSE(OnForcePrivacyMode(GURL(), GURL())); + EXPECT_FALSE(OnForcePrivacyMode(GURL(), GURL(), base::nullopt)); EXPECT_FALSE(OnCancelURLRequestWithPolicyViolatingReferrerHeader( *request, GURL(), GURL())); } @@ -325,8 +328,10 @@ EXPECT_EQ(1, (*counters_)["on_can_access_file_count"]); } - bool OnForcePrivacyModeInternal(const GURL& url, - const GURL& site_for_cookies) const override { + bool OnForcePrivacyModeInternal( + const GURL& url, + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const override { ++(*counters_)["on_force_privacy_mode_count"]; EXPECT_EQ(1, (*counters_)["on_force_privacy_mode_count"]); return false; @@ -379,7 +384,7 @@ } // namespace -class LayeredNetworkDelegateTest : public TestWithScopedTaskEnvironment { +class LayeredNetworkDelegateTest : public TestWithTaskEnvironment { public: LayeredNetworkDelegateTest() { std::unique_ptr<TestNetworkDelegateImpl> test_network_delegate(
diff --git a/net/base/network_change_notifier_fuchsia_unittest.cc b/net/base/network_change_notifier_fuchsia_unittest.cc index de4e6a8..2a5edfa 100644 --- a/net/base/network_change_notifier_fuchsia_unittest.cc +++ b/net/base/network_change_notifier_fuchsia_unittest.cc
@@ -258,9 +258,9 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, + base::test::TaskEnvironment::MainThreadType::IO}; testing::StrictMock<MockConnectionTypeObserver> observer_; testing::StrictMock<MockIPAddressObserver> ip_observer_; fuchsia::netstack::NetstackPtr netstack_ptr_;
diff --git a/net/base/network_change_notifier_linux.cc b/net/base/network_change_notifier_linux.cc index 7d5d1a3..9fae1e4 100644 --- a/net/base/network_change_notifier_linux.cc +++ b/net/base/network_change_notifier_linux.cc
@@ -94,7 +94,7 @@ // Ensure |blocking_thread_objects_| lives on // |blocking_thread_runner_| to prevent races where // NetworkChangeNotifierLinux outlives - // ScopedTaskEnvironment. https://crbug.com/938126 + // TaskEnvironment. https://crbug.com/938126 base::OnTaskRunnerDeleter(blocking_thread_runner_)) { blocking_thread_runner_->PostTask( FROM_HERE,
diff --git a/net/base/network_change_notifier_posix_unittest.cc b/net/base/network_change_notifier_posix_unittest.cc index 682fb2e..360c2569 100644 --- a/net/base/network_change_notifier_posix_unittest.cc +++ b/net/base/network_change_notifier_posix_unittest.cc
@@ -17,8 +17,7 @@ class NetworkChangeNotifierPosixTest : public testing::Test { public: NetworkChangeNotifierPosixTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), notifier_(new NetworkChangeNotifierPosix( NetworkChangeNotifier::CONNECTION_UNKNOWN, NetworkChangeNotifier::SUBTYPE_UNKNOWN)) { @@ -29,14 +28,14 @@ } void FastForwardUntilIdle() { - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } NetworkChangeNotifierPosix* notifier() { return notifier_.get(); } TestDnsConfigService* dns_config_service() { return dns_config_service_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::NetworkChangeNotifier::DisableForTest mock_notifier_disabler_; std::unique_ptr<NetworkChangeNotifierPosix> notifier_; TestDnsConfigService* dns_config_service_;
diff --git a/net/base/network_change_notifier_win_unittest.cc b/net/base/network_change_notifier_win_unittest.cc index 1f2d4bd5..9a41f58e 100644 --- a/net/base/network_change_notifier_win_unittest.cc +++ b/net/base/network_change_notifier_win_unittest.cc
@@ -82,7 +82,7 @@ } // namespace -class NetworkChangeNotifierWinTest : public TestWithScopedTaskEnvironment { +class NetworkChangeNotifierWinTest : public TestWithTaskEnvironment { public: // Calls WatchForAddressChange, and simulates a WatchForAddressChangeInternal // success. Expects that |network_change_notifier_| has just been created, so
diff --git a/net/base/network_delegate.cc b/net/base/network_delegate.cc index d0f2453..dae5c827 100644 --- a/net/base/network_delegate.cc +++ b/net/base/network_delegate.cc
@@ -165,11 +165,13 @@ return OnCanAccessFile(request, original_path, absolute_path); } -bool NetworkDelegate::ForcePrivacyMode(const GURL& url, - const GURL& site_for_cookies) const { +bool NetworkDelegate::ForcePrivacyMode( + const GURL& url, + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const { TRACE_EVENT0(NetTracingCategory(), "NetworkDelegate::ForcePrivacyMode"); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - return OnForcePrivacyMode(url, site_for_cookies); + return OnForcePrivacyMode(url, site_for_cookies, top_frame_origin); } bool NetworkDelegate::CancelURLRequestWithPolicyViolatingReferrerHeader(
diff --git a/net/base/network_delegate.h b/net/base/network_delegate.h index 49fe875c..e511559b 100644 --- a/net/base/network_delegate.h +++ b/net/base/network_delegate.h
@@ -106,7 +106,10 @@ bool CanAccessFile(const URLRequest& request, const base::FilePath& original_path, const base::FilePath& absolute_path) const; - bool ForcePrivacyMode(const GURL& url, const GURL& site_for_cookies) const; + bool ForcePrivacyMode( + const GURL& url, + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const; bool CancelURLRequestWithPolicyViolatingReferrerHeader( const URLRequest& request, @@ -316,8 +319,10 @@ // Returns true if the given |url| has to be requested over connection that // is not tracked by the server. Usually is false, unless user privacy // settings block cookies from being get or set. - virtual bool OnForcePrivacyMode(const GURL& url, - const GURL& site_for_cookies) const = 0; + virtual bool OnForcePrivacyMode( + const GURL& url, + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const = 0; // Called when the |referrer_url| for requesting |target_url| during handling // of the |request| is does not comply with the referrer policy (e.g. a
diff --git a/net/base/network_delegate_impl.cc b/net/base/network_delegate_impl.cc index e6656f5..088e5eb 100644 --- a/net/base/network_delegate_impl.cc +++ b/net/base/network_delegate_impl.cc
@@ -93,7 +93,8 @@ bool NetworkDelegateImpl::OnForcePrivacyMode( const GURL& url, - const GURL& site_for_cookies) const { + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const { return false; }
diff --git a/net/base/network_delegate_impl.h b/net/base/network_delegate_impl.h index e1c0fa7..bde4910 100644 --- a/net/base/network_delegate_impl.h +++ b/net/base/network_delegate_impl.h
@@ -95,8 +95,10 @@ const base::FilePath& original_path, const base::FilePath& absolute_path) const override; - bool OnForcePrivacyMode(const GURL& url, - const GURL& site_for_cookies) const override; + bool OnForcePrivacyMode( + const GURL& url, + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const override; bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( const URLRequest& request,
diff --git a/net/base/prioritized_task_runner_unittest.cc b/net/base/prioritized_task_runner_unittest.cc index 5576885..ab24ea2 100644 --- a/net/base/prioritized_task_runner_unittest.cc +++ b/net/base/prioritized_task_runner_unittest.cc
@@ -95,7 +95,7 @@ void ReleaseTaskRunner() { waitable_event_.Signal(); } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::vector<std::string> callback_names_; base::Lock callback_names_lock_; @@ -122,8 +122,7 @@ prioritized_task_runner->PostTaskAndReply( FROM_HERE, base::BindOnce(thread_check, task_runner, base::DoNothing::Once()), - base::BindOnce(thread_check, - scoped_task_environment_.GetMainThreadTaskRunner(), + base::BindOnce(thread_check, task_environment_.GetMainThreadTaskRunner(), run_loop.QuitClosure()), 0); @@ -145,7 +144,7 @@ 0); // Run the TaskRunner and both the Task and Reply should run. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ((std::vector<std::string>{"Task", "Reply"}), callback_names_); } @@ -183,7 +182,7 @@ // Run the TaskRunner and all of the tasks and replies should have run, in // priority order. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ((std::vector<std::string>{"Task0", "Task5", "Task7"}), TaskOrder()); EXPECT_EQ((std::vector<std::string>{"Reply0", "Reply5", "Reply7"}), ReplyOrder()); @@ -230,7 +229,7 @@ ProcessTaskRunner(task_runner.get()); // Run the replies. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ((std::vector<std::string>{"Task1", "Task2", "Task0"}), TaskOrder()); EXPECT_EQ((std::vector<std::string>{"Reply0", "Reply1", "Reply2"}), @@ -273,7 +272,7 @@ // Run the TaskRunner and all of the tasks and replies should have run, in // priority order. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ((std::vector<std::string>{"TaskMaxPlus1", "TaskMinus1", "TaskMax"}), TaskOrder()); EXPECT_EQ( @@ -296,7 +295,7 @@ 0); // Run the TaskRunner and both the Task and Reply should run. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ((std::vector<std::string>{"Task", "Reply"}), callback_names_); } @@ -333,7 +332,7 @@ ReleaseTaskRunner(); // Run the TaskRunner and both the Task and Reply should run. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ((std::vector<std::string>{"Task0", "Task3", "Task7"}), TaskOrder()); EXPECT_EQ((std::vector<std::string>{"Reply0", "Reply3", "Reply7"}), ReplyOrder()); @@ -366,7 +365,7 @@ // This is the order the tasks should run on the queue. std::sort(expected.begin(), expected.end()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // This is the order that the tasks ran on the queue. std::vector<int> results;
diff --git a/net/base/test_completion_callback_unittest.cc b/net/base/test_completion_callback_unittest.cc index b799d4b..76fddba 100644 --- a/net/base/test_completion_callback_unittest.cc +++ b/net/base/test_completion_callback_unittest.cc
@@ -111,7 +111,7 @@ } // namespace class TestCompletionCallbackTest : public PlatformTest, - public WithScopedTaskEnvironment {}; + public WithTaskEnvironment {}; TEST_F(TestCompletionCallbackTest, Simple) { ExampleEmployer boss;
diff --git a/net/base/upload_file_element_reader_unittest.cc b/net/base/upload_file_element_reader_unittest.cc index c4473380..735d0f7 100644 --- a/net/base/upload_file_element_reader_unittest.cc +++ b/net/base/upload_file_element_reader_unittest.cc
@@ -34,7 +34,7 @@ // FilePath and needs to open the file itself. When it's true, it's passed an // already open base::File. class UploadFileElementReaderTest : public testing::TestWithParam<bool>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: void SetUp() override { // Some tests (*.ReadPartially) rely on bytes_.size() being even.
diff --git a/net/cert/cert_verify_proc_unittest.cc b/net/cert/cert_verify_proc_unittest.cc index 5a77f87..c186aed 100644 --- a/net/cert/cert_verify_proc_unittest.cc +++ b/net/cert/cert_verify_proc_unittest.cc
@@ -3009,8 +3009,8 @@ : public CertVerifyProcInternalTest { protected: CertVerifyProcInternalWithNetFetchingTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT) {} + : task_environment_( + base::test::TaskEnvironment::MainThreadType::DEFAULT) {} void SetUp() override { // Create a network thread to be used for network fetches, and wait for @@ -3326,7 +3326,7 @@ context->reset(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::Thread> network_thread_;
diff --git a/net/cert/multi_threaded_cert_verifier_unittest.cc b/net/cert/multi_threaded_cert_verifier_unittest.cc index fac1994..3920c1b 100644 --- a/net/cert/multi_threaded_cert_verifier_unittest.cc +++ b/net/cert/multi_threaded_cert_verifier_unittest.cc
@@ -72,7 +72,7 @@ } // namespace -class MultiThreadedCertVerifierTest : public TestWithScopedTaskEnvironment { +class MultiThreadedCertVerifierTest : public TestWithTaskEnvironment { public: MultiThreadedCertVerifierTest() : mock_verify_proc_(base::MakeRefCounted<MockCertVerifyProc>()),
diff --git a/net/cert/nss_cert_database_chromeos_unittest.cc b/net/cert/nss_cert_database_chromeos_unittest.cc index 48ebc9a..6220593 100644 --- a/net/cert/nss_cert_database_chromeos_unittest.cc +++ b/net/cert/nss_cert_database_chromeos_unittest.cc
@@ -49,7 +49,7 @@ } // namespace -class NSSCertDatabaseChromeOSTest : public TestWithScopedTaskEnvironment, +class NSSCertDatabaseChromeOSTest : public TestWithTaskEnvironment, public CertDatabase::Observer { public: NSSCertDatabaseChromeOSTest()
diff --git a/net/cert/nss_cert_database_unittest.cc b/net/cert/nss_cert_database_unittest.cc index d2480dd..b9b827b 100644 --- a/net/cert/nss_cert_database_unittest.cc +++ b/net/cert/nss_cert_database_unittest.cc
@@ -60,7 +60,7 @@ } // namespace -class CertDatabaseNSSTest : public TestWithScopedTaskEnvironment { +class CertDatabaseNSSTest : public TestWithTaskEnvironment { public: void SetUp() override { ASSERT_TRUE(test_nssdb_.is_open());
diff --git a/net/cert/trial_comparison_cert_verifier_unittest.cc b/net/cert/trial_comparison_cert_verifier_unittest.cc index 4d2c3a4..4ce4e30b 100644 --- a/net/cert/trial_comparison_cert_verifier_unittest.cc +++ b/net/cert/trial_comparison_cert_verifier_unittest.cc
@@ -256,7 +256,7 @@ } // namespace -class TrialComparisonCertVerifierTest : public TestWithScopedTaskEnvironment { +class TrialComparisonCertVerifierTest : public TestWithTaskEnvironment { void SetUp() override { cert_chain_1_ = CreateCertificateChainFromFile( GetTestCertsDirectory(), "multi-root-chain1.pem",
diff --git a/net/cert_net/cert_net_fetcher_impl_unittest.cc b/net/cert_net/cert_net_fetcher_impl_unittest.cc index 81ed4aed..d873535 100644 --- a/net/cert_net/cert_net_fetcher_impl_unittest.cc +++ b/net/cert_net/cert_net_fetcher_impl_unittest.cc
@@ -232,7 +232,7 @@ // Installs URLRequestHangingReadJob handlers and clears them on teardown. class CertNetFetcherImplTestWithHangingReadHandler : public CertNetFetcherImplTest, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: void SetUp() override { URLRequestHangingReadJob::AddUrlHandler(); }
diff --git a/net/cert_net/nss_ocsp_unittest.cc b/net/cert_net/nss_ocsp_unittest.cc index 79984fff..cb598bee 100644 --- a/net/cert_net/nss_ocsp_unittest.cc +++ b/net/cert_net/nss_ocsp_unittest.cc
@@ -77,7 +77,7 @@ } // namespace -class NssHttpTest : public TestWithScopedTaskEnvironment { +class NssHttpTest : public TestWithTaskEnvironment { public: NssHttpTest() : context_(false),
diff --git a/net/cookies/cookie_constants.h b/net/cookies/cookie_constants.h index e6bc9f6..c792bd13 100644 --- a/net/cookies/cookie_constants.h +++ b/net/cookies/cookie_constants.h
@@ -41,6 +41,21 @@ LAX_MODE_ALLOW_UNSAFE = 4, // Allowed for effective SameSite only. }; +// What rules to apply when determining when whether access to a particular +// cookie is allowed. +// TODO(crbug.com/978172): Machinery to read the content setting and set the +// appropriate CookieAccessSemantics on the cookie (will be added as a new +// metadata field of CanonicalCookie). +enum class CookieAccessSemantics { + // Has not been checked yet. + UNKNOWN = -1, + // Has been checked and the cookie should *not* be subject to legacy access + // rules. + NONLEGACY = 0, + // Has been checked and the cookie should be subject to legacy access rules. + LEGACY, +}; + // Returns the Set-Cookie header priority token corresponding to |priority|. // // TODO(mkwst): Remove this once its callsites are refactored.
diff --git a/net/disk_cache/backend_cleanup_tracker_unittest.cc b/net/disk_cache/backend_cleanup_tracker_unittest.cc index 1ed8ecc..b02f258 100644 --- a/net/disk_cache/backend_cleanup_tracker_unittest.cc +++ b/net/disk_cache/backend_cleanup_tracker_unittest.cc
@@ -18,7 +18,7 @@ using testing::UnorderedElementsAre; using testing::IsEmpty; -class BackendCleanupTrackerTest : public net::TestWithScopedTaskEnvironment { +class BackendCleanupTrackerTest : public net::TestWithTaskEnvironment { protected: BackendCleanupTrackerTest() = default;
diff --git a/net/disk_cache/disk_cache_fuzzer.cc b/net/disk_cache/disk_cache_fuzzer.cc index b4d319a..15b8772 100644 --- a/net/disk_cache/disk_cache_fuzzer.cc +++ b/net/disk_cache/disk_cache_fuzzer.cc
@@ -84,10 +84,9 @@ // Mark this thread as an IO_THREAD with MOCK_TIME, and ensure that Now() // is driven from the same mock clock. - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::MainThreadType::IO, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + task_environment_ = std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::MainThreadType::IO, + base::test::TaskEnvironment::TimeSource::MOCK_TIME); // Disable noisy logging as per "libFuzzer in Chrome" documentation: // testing/libfuzzer/getting_started.md#Disable-noisy-error-message-logging. @@ -106,7 +105,7 @@ } // This allows us to mock time for all threads. - std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_; + std::unique_ptr<base::test::TaskEnvironment> task_environment_; // Used as a pre-filled buffer for all writes. scoped_refptr<net::IOBuffer> buffer_; @@ -439,7 +438,7 @@ // Handle any callbacks that other threads may have posted to us in the // meantime, so any successful async OpenEntry's (etc.) add their // entry_ptr's to the map. - init_globals->scoped_task_environment_->RunUntilIdle(); + init_globals->task_environment_->RunUntilIdle(); switch (command.fuzz_command_oneof_case()) { case disk_cache_fuzzer::FuzzCommand::kSetMaxSize: { @@ -842,7 +841,7 @@ command.fast_forward_by().capped_num_millis() % kMaxNumMillisToWait); MAYBE_PRINT << "FastForwardBy(" << to_wait << ")" << std::endl; - init_globals->scoped_task_environment_->FastForwardBy(to_wait); + init_globals->task_environment_->FastForwardBy(to_wait); base::Time curr_time = base::Time::Now(); saved_times_[command.fast_forward_by().time_id()] = curr_time; @@ -1217,7 +1216,7 @@ // TODO(mpdenton) should also be documented? open_iterators_.clear(); // Just in case, finish any callbacks. - init_globals->scoped_task_environment_->RunUntilIdle(); + init_globals->task_environment_->RunUntilIdle(); // Close all entries that haven't been closed yet. CloseAllRemainingEntries(); // Destroy the backend. @@ -1226,13 +1225,13 @@ // Here we won't bother with waiting for our OpenEntry* callbacks. cache_.reset(); // Finish any callbacks that came in before backend destruction. - init_globals->scoped_task_environment_->RunUntilIdle(); + init_globals->task_environment_->RunUntilIdle(); // Close all entries that haven't been closed yet. CloseAllRemainingEntries(); } // Make sure any tasks triggered by the CloseEntry's have run. - init_globals->scoped_task_environment_->RunUntilIdle(); + init_globals->task_environment_->RunUntilIdle(); if (simple_cache_impl_) CHECK(simple_file_tracker_->IsEmptyForTesting()); base::RunLoop().RunUntilIdle();
diff --git a/net/disk_cache/disk_cache_test_base.h b/net/disk_cache/disk_cache_test_base.h index 595a476..050401f 100644 --- a/net/disk_cache/disk_cache_test_base.h +++ b/net/disk_cache/disk_cache_test_base.h
@@ -40,8 +40,7 @@ // Mac, so this needs to be a PlatformTest. Even tests that do not require a // cache (and that do not need to be a DiskCacheTestWithCache) are susceptible // to this problem; all such tests should use TEST_F(DiskCacheTest, ...). -class DiskCacheTest : public PlatformTest, - public net::WithScopedTaskEnvironment { +class DiskCacheTest : public PlatformTest, public net::WithTaskEnvironment { protected: DiskCacheTest(); ~DiskCacheTest() override;
diff --git a/net/disk_cache/simple/simple_index_file_unittest.cc b/net/disk_cache/simple/simple_index_file_unittest.cc index 1056dfbe..446c1e8c 100644 --- a/net/disk_cache/simple/simple_index_file_unittest.cc +++ b/net/disk_cache/simple/simple_index_file_unittest.cc
@@ -176,7 +176,7 @@ } }; -class SimpleIndexFileTest : public net::TestWithScopedTaskEnvironment { +class SimpleIndexFileTest : public net::TestWithTaskEnvironment { public: bool CompareTwoEntryMetadata(const EntryMetadata& a, const EntryMetadata& b) { return a.last_used_time_seconds_since_epoch_ ==
diff --git a/net/disk_cache/simple/simple_index_unittest.cc b/net/disk_cache/simple/simple_index_unittest.cc index 375ce7d..66958eca 100644 --- a/net/disk_cache/simple/simple_index_unittest.cc +++ b/net/disk_cache/simple/simple_index_unittest.cc
@@ -105,7 +105,7 @@ SimpleIndex::EntrySet disk_write_entry_set_; }; -class SimpleIndexTest : public net::TestWithScopedTaskEnvironment, +class SimpleIndexTest : public net::TestWithTaskEnvironment, public SimpleIndexDelegate { protected: SimpleIndexTest() : hashes_(base::BindRepeating(&HashesInitializer)) {}
diff --git a/net/dns/address_sorter_unittest.cc b/net/dns/address_sorter_unittest.cc index df4739d..860629a 100644 --- a/net/dns/address_sorter_unittest.cc +++ b/net/dns/address_sorter_unittest.cc
@@ -44,7 +44,7 @@ TEST(AddressSorterTest, Sort) { int expected_result = OK; #if defined(OS_WIN) - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; EnsureWinsockInit(); SOCKET sock = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); if (sock == INVALID_SOCKET) {
diff --git a/net/dns/context_host_resolver_unittest.cc b/net/dns/context_host_resolver_unittest.cc index 6109aee..a0334fb 100644 --- a/net/dns/context_host_resolver_unittest.cc +++ b/net/dns/context_host_resolver_unittest.cc
@@ -37,7 +37,7 @@ const IPEndPoint kEndpoint(IPAddress(1, 2, 3, 4), 100); } -class ContextHostResolverTest : public TestWithScopedTaskEnvironment { +class ContextHostResolverTest : public TestWithTaskEnvironment { protected: void SetUp() override { manager_ = std::make_unique<HostResolverManager>(
diff --git a/net/dns/dns_config_service_posix_unittest.cc b/net/dns/dns_config_service_posix_unittest.cc index 2dffb4e..0d944db9 100644 --- a/net/dns/dns_config_service_posix_unittest.cc +++ b/net/dns/dns_config_service_posix_unittest.cc
@@ -188,22 +188,22 @@ TEST(DnsConfigServicePosixTest, DestroyWhileJobsWorking) { // Regression test to verify crash does not occur if DnsConfigServicePosix // instance is destroyed while SerialWorker jobs have posted to worker pool. - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); std::unique_ptr<internal::DnsConfigServicePosix> service( new internal::DnsConfigServicePosix()); // Call WatchConfig() which also tests ReadConfig(). service->WatchConfig(base::BindRepeating(&DummyConfigCallback)); service.reset(); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1000)); } TEST(DnsConfigServicePosixTest, DestroyOnDifferentThread) { // Regression test to verify crash does not occur if DnsConfigServicePosix // instance is destroyed on another thread. - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; scoped_refptr<base::SequencedTaskRunner> runner = base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock()}); @@ -216,7 +216,7 @@ base::Unretained(service.get()), base::BindRepeating(&DummyConfigCallback))); service.reset(); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } } // namespace @@ -242,7 +242,7 @@ void TearDown() override { ASSERT_TRUE(base::DeleteFile(temp_file_, false)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; bool seen_config_; base::FilePath temp_file_; std::unique_ptr<DnsConfigServicePosix> service_; @@ -253,7 +253,7 @@ TEST_F(DnsConfigServicePosixTest, ChangeConfigMultipleTimes) { service_->WatchConfig(base::Bind(&DnsConfigServicePosixTest::OnConfigChanged, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); for (int i = 0; i < 5; i++) { service_->RefreshConfig(); @@ -261,7 +261,7 @@ // called if the new config is different from the old one, so this can't be // ExpectChange(). base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(50)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // There should never be more than 4 nameservers in a real config.
diff --git a/net/dns/dns_config_service_unittest.cc b/net/dns/dns_config_service_unittest.cc index 39c63de..c3d7776 100644 --- a/net/dns/dns_config_service_unittest.cc +++ b/net/dns/dns_config_service_unittest.cc
@@ -23,7 +23,7 @@ namespace { -class DnsConfigServiceTest : public TestWithScopedTaskEnvironment { +class DnsConfigServiceTest : public TestWithTaskEnvironment { public: void OnConfigChanged(const DnsConfig& config) { last_config_ = config;
diff --git a/net/dns/dns_transaction_unittest.cc b/net/dns/dns_transaction_unittest.cc index 8fa95af..d5bbbab 100644 --- a/net/dns/dns_transaction_unittest.cc +++ b/net/dns/dns_transaction_unittest.cc
@@ -755,7 +755,7 @@ }; class DnsTransactionTest : public DnsTransactionTestBase, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { public: DnsTransactionTest() = default; ~DnsTransactionTest() override = default; @@ -880,11 +880,11 @@ }; class DnsTransactionTestWithMockTime : public DnsTransactionTestBase, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: DnsTransactionTestWithMockTime() - : WithScopedTaskEnvironment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : WithTaskEnvironment( + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~DnsTransactionTestWithMockTime() override = default; };
diff --git a/net/dns/host_resolver_manager_unittest.cc b/net/dns/host_resolver_manager_unittest.cc index bb39bd3..b08707a 100644 --- a/net/dns/host_resolver_manager_unittest.cc +++ b/net/dns/host_resolver_manager_unittest.cc
@@ -468,7 +468,7 @@ } // namespace -class HostResolverManagerTest : public TestWithScopedTaskEnvironment { +class HostResolverManagerTest : public TestWithTaskEnvironment { public: static const int kDefaultPort = 80; @@ -1105,13 +1105,7 @@ } } -// Flaky on Fuchsia and Linux ASAN. crbug.com/930483 -#if defined(OS_FUCHSIA) || defined(OS_LINUX) -#define MAYBE_DeleteWithinAbortedCallback DISABLED_DeleteWithinAbortedCallback -#else -#define MAYBE_DeleteWithinAbortedCallback DeleteWithinAbortedCallback -#endif -TEST_F(HostResolverManagerTest, MAYBE_DeleteWithinAbortedCallback) { +TEST_F(HostResolverManagerTest, DeleteWithinAbortedCallback) { std::vector<std::unique_ptr<ResolveHostResponseHelper>> responses; ResolveHostResponseHelper::Callback custom_callback = base::BindLambdaForTesting(
diff --git a/net/dns/mapped_host_resolver_unittest.cc b/net/dns/mapped_host_resolver_unittest.cc index 7301afcf..2ef9c75 100644 --- a/net/dns/mapped_host_resolver_unittest.cc +++ b/net/dns/mapped_host_resolver_unittest.cc
@@ -30,7 +30,7 @@ } TEST(MappedHostResolverTest, Inclusion) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Create a mock host resolver, with specific hostname to IP mappings. std::unique_ptr<MockHostResolver> resolver_impl(new MockHostResolver()); @@ -98,7 +98,7 @@ // Tests that exclusions are respected. TEST(MappedHostResolverTest, Exclusion) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Create a mock host resolver, with specific hostname to IP mappings. std::unique_ptr<MockHostResolver> resolver_impl(new MockHostResolver()); @@ -141,7 +141,7 @@ } TEST(MappedHostResolverTest, SetRulesFromString) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Create a mock host resolver, with specific hostname to IP mappings. std::unique_ptr<MockHostResolver> resolver_impl(new MockHostResolver()); @@ -182,7 +182,7 @@ // Parsing bad rules should silently discard the rule (and never crash). TEST(MappedHostResolverTest, ParseInvalidRules) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<MappedHostResolver> resolver( new MappedHostResolver(std::unique_ptr<HostResolver>())); @@ -199,7 +199,7 @@ // Test mapping hostnames to resolving failures. TEST(MappedHostResolverTest, MapToError) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Outstanding request. std::unique_ptr<MockHostResolver> resolver_impl(new MockHostResolver());
diff --git a/net/dns/mdns_client_unittest.cc b/net/dns/mdns_client_unittest.cc index b15a762..0298d3cc 100644 --- a/net/dns/mdns_client_unittest.cc +++ b/net/dns/mdns_client_unittest.cc
@@ -407,7 +407,7 @@ } // namespace -class MDnsTest : public TestWithScopedTaskEnvironment { +class MDnsTest : public TestWithTaskEnvironment { public: void SetUp() override; void DeleteTransaction(); @@ -1225,7 +1225,7 @@ MOCK_METHOD1(OnConnectionError, void(int error)); }; -class MDnsConnectionTest : public TestWithScopedTaskEnvironment { +class MDnsConnectionTest : public TestWithTaskEnvironment { public: MDnsConnectionTest() : connection_(&delegate_) { }
diff --git a/net/dns/serial_worker_unittest.cc b/net/dns/serial_worker_unittest.cc index b2a8512..98ab0f247c8 100644 --- a/net/dns/serial_worker_unittest.cc +++ b/net/dns/serial_worker_unittest.cc
@@ -20,7 +20,7 @@ namespace { -class SerialWorkerTest : public TestWithScopedTaskEnvironment { +class SerialWorkerTest : public TestWithTaskEnvironment { public: // The class under test class TestSerialWorker : public SerialWorker {
diff --git a/net/dns/system_dns_config_change_notifier_unittest.cc b/net/dns/system_dns_config_change_notifier_unittest.cc index c31b78be..9afdc8e 100644 --- a/net/dns/system_dns_config_change_notifier_unittest.cc +++ b/net/dns/system_dns_config_change_notifier_unittest.cc
@@ -30,7 +30,7 @@ const DnsConfig kConfig2(kNameservers2); } // namespace -class SystemDnsConfigChangeNotifierTest : public TestWithScopedTaskEnvironment { +class SystemDnsConfigChangeNotifierTest : public TestWithTaskEnvironment { public: // Set up a change notifier, owned on a dedicated blockable task runner, with // a faked underlying DnsConfigService.
diff --git a/net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc b/net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc index 065adc1..10ac2be 100644 --- a/net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc +++ b/net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc
@@ -102,7 +102,7 @@ store_ = nullptr; // Flush ThreadPool tasks, causing pending commits to run. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); store_ = new SQLitePersistentCookieStore( temp_dir_.GetPath().Append(cookie_filename), client_task_runner_, @@ -141,7 +141,7 @@ protected: int seed_multiple_; base::Time test_start_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const scoped_refptr<base::SequencedTaskRunner> background_task_runner_ = base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock()}); const scoped_refptr<base::SequencedTaskRunner> client_task_runner_ =
diff --git a/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc b/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc index 6d1fcb8..db01f9e 100644 --- a/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc +++ b/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc
@@ -95,7 +95,7 @@ typedef std::vector<std::unique_ptr<CanonicalCookie>> CanonicalCookieVector; -class SQLitePersistentCookieStoreTest : public TestWithScopedTaskEnvironment { +class SQLitePersistentCookieStoreTest : public TestWithTaskEnvironment { public: SQLitePersistentCookieStoreTest() : loaded_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, @@ -133,7 +133,7 @@ void DestroyStore() { store_ = nullptr; // Make sure we wait until the destructor has run by running all - // ScopedTaskEnvironment tasks. + // TaskEnvironment tasks. RunUntilIdle(); } @@ -374,7 +374,7 @@ AddCookie("A", "B", "www.bbb.com", "/", t); DestroyStore(); - // base::test::ScopedTaskEnvironment runs |background_task_runner_| and + // base::test::TaskEnvironment runs |background_task_runner_| and // |client_task_runner_| on the same thread. Therefore, when a // |background_task_runner_| task is blocked, |client_task_runner_| tasks // can't run. To allow precise control of |background_task_runner_| without
diff --git a/net/extras/sqlite/sqlite_persistent_reporting_and_nel_store_unittest.cc b/net/extras/sqlite/sqlite_persistent_reporting_and_nel_store_unittest.cc index e46dc6d..ad1b386 100644 --- a/net/extras/sqlite/sqlite_persistent_reporting_and_nel_store_unittest.cc +++ b/net/extras/sqlite/sqlite_persistent_reporting_and_nel_store_unittest.cc
@@ -85,7 +85,7 @@ } // namespace class SQLitePersistentReportingAndNelStoreTest - : public TestWithScopedTaskEnvironment { + : public TestWithTaskEnvironment { public: SQLitePersistentReportingAndNelStoreTest() {} @@ -98,7 +98,7 @@ void DestroyStore() { store_.reset(); // Make sure we wait until the destructor has run by running all - // ScopedTaskEnvironment tasks. + // TaskEnvironment tasks. RunUntilIdle(); }
diff --git a/net/ftp/ftp_network_transaction_unittest.cc b/net/ftp/ftp_network_transaction_unittest.cc index b204b89..1193a005 100644 --- a/net/ftp/ftp_network_transaction_unittest.cc +++ b/net/ftp/ftp_network_transaction_unittest.cc
@@ -709,7 +709,7 @@ class FtpNetworkTransactionTest : public PlatformTest, public ::testing::WithParamInterface<int>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { public: FtpNetworkTransactionTest() : host_resolver_(new MockHostResolver) { SetUpTransaction();
diff --git a/net/http/bidirectional_stream_unittest.cc b/net/http/bidirectional_stream_unittest.cc index 4e2f167..2792cc8 100644 --- a/net/http/bidirectional_stream_unittest.cc +++ b/net/http/bidirectional_stream_unittest.cc
@@ -399,7 +399,7 @@ } // namespace -class BidirectionalStreamTest : public TestWithScopedTaskEnvironment { +class BidirectionalStreamTest : public TestWithTaskEnvironment { public: BidirectionalStreamTest() : default_url_(kDefaultUrl),
diff --git a/net/http/http_auth_controller_unittest.cc b/net/http/http_auth_controller_unittest.cc index db47310..e065055a 100644 --- a/net/http/http_auth_controller_unittest.cc +++ b/net/http/http_auth_controller_unittest.cc
@@ -103,7 +103,7 @@ // permanent error, the HttpAuthController should disable the scheme // used and retry the request. TEST(HttpAuthControllerTest, PermanentErrors) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Run a synchronous handler that returns // ERR_UNEXPECTED_SECURITY_LIBRARY_STATUS. We expect a return value @@ -134,7 +134,7 @@ // Verify that the controller logs appropriate lifetime events. TEST(HttpAuthControllerTest, Logging) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; BoundTestNetLog net_log; RunSingleRoundAuthTest(RUN_HANDLER_SYNC, OK, OK, SCHEME_IS_ENABLED,
diff --git a/net/http/http_auth_handler_negotiate_unittest.cc b/net/http/http_auth_handler_negotiate_unittest.cc index e4111c8a..ca54284 100644 --- a/net/http/http_auth_handler_negotiate_unittest.cc +++ b/net/http/http_auth_handler_negotiate_unittest.cc
@@ -48,7 +48,7 @@ constexpr char kFakeToken[] = "FakeToken"; class HttpAuthHandlerNegotiateTest : public PlatformTest, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { public: void SetUp() override { auth_library_ = new MockAuthLibrary();
diff --git a/net/http/http_auth_handler_unittest.cc b/net/http/http_auth_handler_unittest.cc index bb25c16..91a6386 100644 --- a/net/http/http_auth_handler_unittest.cc +++ b/net/http/http_auth_handler_unittest.cc
@@ -22,7 +22,7 @@ namespace net { TEST(HttpAuthHandlerTest, NetLog) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; GURL origin("http://www.example.com"); std::string challenge = "Mock asdf";
diff --git a/net/http/http_cache_lookup_manager_unittest.cc b/net/http/http_cache_lookup_manager_unittest.cc index ac7dec90..259a25b 100644 --- a/net/http/http_cache_lookup_manager_unittest.cc +++ b/net/http/http_cache_lookup_manager_unittest.cc
@@ -84,7 +84,7 @@ } // namespace TEST(HttpCacheLookupManagerTest, ServerPushMissCache) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; MockHttpCache mock_cache; HttpCacheLookupManager push_delegate(mock_cache.http_cache()); GURL request_url("http://www.example.com/pushed.jpg"); @@ -105,7 +105,7 @@ } TEST(HttpCacheLookupManagerTest, ServerPushDoNotCreateCacheEntry) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; MockHttpCache mock_cache; HttpCacheLookupManager push_delegate(mock_cache.http_cache()); GURL request_url("http://www.example.com/pushed.jpg"); @@ -135,7 +135,7 @@ } TEST(HttpCacheLookupManagerTest, ServerPushHitCache) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; MockHttpCache mock_cache; HttpCacheLookupManager push_delegate(mock_cache.http_cache()); GURL request_url("http://www.example.com/pushed.jpg"); @@ -173,7 +173,7 @@ // pending lookup transaction for the same URL, the new server push will not // send a new lookup transaction and should not be canceled. TEST(HttpCacheLookupManagerTest, ServerPushPendingLookup) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; MockHttpCache mock_cache; HttpCacheLookupManager push_delegate(mock_cache.http_cache()); GURL request_url("http://www.example.com/pushed.jpg"); @@ -218,7 +218,7 @@ // Test the server push lookup is based on the full url. TEST(HttpCacheLookupManagerTest, ServerPushLookupOnUrl) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; MockHttpCache mock_cache; HttpCacheLookupManager push_delegate(mock_cache.http_cache()); GURL request_url("http://www.example.com/pushed.jpg?u=0");
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index c41fe4af..ad52d80 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc
@@ -689,7 +689,7 @@ } // namespace -using HttpCacheTest = TestWithScopedTaskEnvironment; +using HttpCacheTest = TestWithTaskEnvironment; class HttpCacheIOCallbackTest : public HttpCacheTest { public: HttpCacheIOCallbackTest() {} @@ -10252,7 +10252,7 @@ class HttpCacheHugeResourceTest : public ::testing::TestWithParam<HugeCacheTestConfiguration>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { public: static std::list<HugeCacheTestConfiguration> GetTestModes(); static std::list<HugeCacheTestConfiguration> kTestModes; @@ -10761,7 +10761,7 @@ RemoveMockTransaction(&kRangeGET_TransactionOK); } -class HttpCachePrefetchValidationTest : public TestWithScopedTaskEnvironment { +class HttpCachePrefetchValidationTest : public TestWithTaskEnvironment { protected: static const int kNumSecondsPerMinute = 60; static const int kMaxAgeSecs = 100; @@ -11939,7 +11939,7 @@ class HttpCacheMemoryDumpTest : public testing::TestWithParam<base::trace_event::MemoryDumpLevelOfDetail>, - public WithScopedTaskEnvironment {}; + public WithTaskEnvironment {}; INSTANTIATE_TEST_SUITE_P( /* no prefix */,
diff --git a/net/http/http_cache_writers_unittest.cc b/net/http/http_cache_writers_unittest.cc index 8690686..50fb436 100644 --- a/net/http/http_cache_writers_unittest.cc +++ b/net/http/http_cache_writers_unittest.cc
@@ -70,7 +70,7 @@ size_t make_readers_size_ = 0u; }; -class WritersTest : public TestWithScopedTaskEnvironment { +class WritersTest : public TestWithTaskEnvironment { public: enum class DeleteTransactionType { NONE, ACTIVE, WAITING, IDLE }; WritersTest()
diff --git a/net/http/http_network_layer_unittest.cc b/net/http/http_network_layer_unittest.cc index 6eb65a3..def21d35 100644 --- a/net/http/http_network_layer_unittest.cc +++ b/net/http/http_network_layer_unittest.cc
@@ -34,8 +34,7 @@ namespace { -class HttpNetworkLayerTest : public PlatformTest, - public WithScopedTaskEnvironment { +class HttpNetworkLayerTest : public PlatformTest, public WithTaskEnvironment { protected: HttpNetworkLayerTest() : ssl_config_service_(std::make_unique<SSLConfigServiceDefaults>()) {}
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index a70545f..fad29688 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc
@@ -352,7 +352,7 @@ } // namespace class HttpNetworkTransactionTest : public PlatformTest, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { public: ~HttpNetworkTransactionTest() override { // Important to restore the per-pool limit first, since the pool limit must @@ -365,8 +365,7 @@ protected: HttpNetworkTransactionTest() - : WithScopedTaskEnvironment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : WithTaskEnvironment(base::test::TaskEnvironment::TimeSource::MOCK_TIME), dummy_connect_job_params_( nullptr /* client_socket_factory */, nullptr /* host_resolver */,
diff --git a/net/http/http_proxy_connect_job_unittest.cc b/net/http/http_proxy_connect_job_unittest.cc index db9b4493..1bb3b3e 100644 --- a/net/http/http_proxy_connect_job_unittest.cc +++ b/net/http/http_proxy_connect_job_unittest.cc
@@ -53,11 +53,10 @@ } // namespace class HttpProxyConnectJobTest : public ::testing::TestWithParam<HttpProxyType>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: HttpProxyConnectJobTest() - : WithScopedTaskEnvironment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : WithTaskEnvironment(base::test::TaskEnvironment::TimeSource::MOCK_TIME), field_trial_list_(nullptr) { // Used a mock HostResolver that does not have a cache. session_deps_.host_resolver = std::make_unique<MockHostResolver>();
diff --git a/net/http/http_response_body_drainer_unittest.cc b/net/http/http_response_body_drainer_unittest.cc index a0f135b..228d1ee 100644 --- a/net/http/http_response_body_drainer_unittest.cc +++ b/net/http/http_response_body_drainer_unittest.cc
@@ -228,7 +228,7 @@ std::move(callback_).Run(result); } -class HttpResponseBodyDrainerTest : public TestWithScopedTaskEnvironment { +class HttpResponseBodyDrainerTest : public TestWithTaskEnvironment { protected: HttpResponseBodyDrainerTest() : proxy_resolution_service_(ProxyResolutionService::CreateDirect()),
diff --git a/net/http/http_server_properties_manager_unittest.cc b/net/http/http_server_properties_manager_unittest.cc index c9d3ad6..675c8e45 100644 --- a/net/http/http_server_properties_manager_unittest.cc +++ b/net/http/http_server_properties_manager_unittest.cc
@@ -101,11 +101,11 @@ } // namespace class HttpServerPropertiesManagerTest : public testing::Test, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: HttpServerPropertiesManagerTest() - : WithScopedTaskEnvironment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : WithTaskEnvironment( + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} void SetUp() override { one_day_from_now_ = base::Time::Now() + base::TimeDelta::FromDays(1);
diff --git a/net/http/http_server_properties_unittest.cc b/net/http/http_server_properties_unittest.cc index 1c27ac5..7cdcea33 100644 --- a/net/http/http_server_properties_unittest.cc +++ b/net/http/http_server_properties_unittest.cc
@@ -65,11 +65,11 @@ namespace { -class HttpServerPropertiesTest : public TestWithScopedTaskEnvironment { +class HttpServerPropertiesTest : public TestWithTaskEnvironment { protected: HttpServerPropertiesTest() - : TestWithScopedTaskEnvironment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : TestWithTaskEnvironment( + base::test::TaskEnvironment::TimeSource::MOCK_TIME), test_tick_clock_(GetMockTickClock()), impl_(nullptr /* pref_delegate */, nullptr /* net_log */,
diff --git a/net/http/http_stream_factory_job_controller_unittest.cc b/net/http/http_stream_factory_job_controller_unittest.cc index b31dce6..f85437e5 100644 --- a/net/http/http_stream_factory_job_controller_unittest.cc +++ b/net/http/http_stream_factory_job_controller_unittest.cc
@@ -185,12 +185,11 @@ } }; -class HttpStreamFactoryJobControllerTest - : public TestWithScopedTaskEnvironment { +class HttpStreamFactoryJobControllerTest : public TestWithTaskEnvironment { public: HttpStreamFactoryJobControllerTest() - : TestWithScopedTaskEnvironment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) { + : TestWithTaskEnvironment( + base::test::TaskEnvironment::TimeSource::MOCK_TIME) { session_deps_.enable_quic = true; session_deps_.host_resolver->set_synchronous_mode(true); }
diff --git a/net/http/http_stream_factory_unittest.cc b/net/http/http_stream_factory_unittest.cc index cdadf5c..244e510 100644 --- a/net/http/http_stream_factory_unittest.cc +++ b/net/http/http_stream_factory_unittest.cc
@@ -479,7 +479,7 @@ ClientSocketPool::GroupId last_group_id_; }; -using HttpStreamFactoryTest = TestWithScopedTaskEnvironment; +using HttpStreamFactoryTest = TestWithTaskEnvironment; // TODO(950069): Add testing for frame_origin in NetworkIsolationKey using // kAppendInitiatingFrameOriginToNetworkIsolationKey. @@ -2217,7 +2217,7 @@ } class HttpStreamFactoryBidirectionalQuicTest - : public TestWithScopedTaskEnvironment, + : public TestWithTaskEnvironment, public ::testing::WithParamInterface< std::tuple<quic::ParsedQuicVersion, bool>> { protected:
diff --git a/net/http/http_stream_parser_unittest.cc b/net/http/http_stream_parser_unittest.cc index a74972c..b07e4fd1 100644 --- a/net/http/http_stream_parser_unittest.cc +++ b/net/http/http_stream_parser_unittest.cc
@@ -153,7 +153,7 @@ } TEST(HttpStreamParser, DataReadErrorAsynchronous) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; MockWrite writes[] = { MockWrite(ASYNC, 0, "POST / HTTP/1.1\r\n"), @@ -219,7 +219,7 @@ }; TEST(HttpStreamParser, InitAsynchronousUploadDataStream) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; InitAsyncUploadDataStream upload_data_stream(0); @@ -370,8 +370,8 @@ } TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_FileBody) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); // Create an empty temporary file. base::ScopedTempDir temp_dir; @@ -600,7 +600,7 @@ } TEST(HttpStreamParser, SentBytesChunkedPostError) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; static const char kChunk[] = "Chunk 1"; @@ -657,7 +657,7 @@ // when sending a request with a chunked body with only one chunk that becomes // available asynchronously. TEST(HttpStreamParser, AsyncSingleChunkAndAsyncSocket) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; static const char kChunk[] = "Chunk"; @@ -739,7 +739,7 @@ // when sending a request with a chunked body with only one chunk that is // available synchronously. TEST(HttpStreamParser, SyncSingleChunkAndAsyncSocket) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; static const char kChunk[] = "Chunk"; @@ -818,7 +818,7 @@ // asynchronously. // This is a regression test for http://crbug.com/132243 TEST(HttpStreamParser, AsyncChunkAndAsyncSocketWithMultipleChunks) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // The chunks that will be written in the request, as reflected in the // MockWrites below. @@ -916,7 +916,7 @@ // when there's only one "chunk" with 0 bytes, and is received from the // UploadStream only after sending the request headers successfully. TEST(HttpStreamParser, AsyncEmptyChunkedUpload) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; MockWrite writes[] = { MockWrite(ASYNC, 0, @@ -993,7 +993,7 @@ // when there's only one "chunk" with 0 bytes, which was already appended before // the request was started. TEST(HttpStreamParser, SyncEmptyChunkedUpload) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; MockWrite writes[] = { MockWrite(ASYNC, 0,
diff --git a/net/http/http_stream_request_unittest.cc b/net/http/http_stream_request_unittest.cc index 031cb77dd..969e1dd 100644 --- a/net/http/http_stream_request_unittest.cc +++ b/net/http/http_stream_request_unittest.cc
@@ -22,7 +22,7 @@ // Make sure that Request passes on its priority updates to its jobs. TEST(HttpStreamRequestTest, SetPriority) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; SequencedSocketData data; data.set_connect_data(MockConnect(ASYNC, OK));
diff --git a/net/http/transport_security_persister_unittest.cc b/net/http/transport_security_persister_unittest.cc index 370821e..b4831f5 100644 --- a/net/http/transport_security_persister_unittest.cc +++ b/net/http/transport_security_persister_unittest.cc
@@ -26,7 +26,7 @@ const char kReportUri[] = "http://www.example.test/report"; -class TransportSecurityPersisterTest : public TestWithScopedTaskEnvironment { +class TransportSecurityPersisterTest : public TestWithTaskEnvironment { public: TransportSecurityPersisterTest() = default;
diff --git a/net/log/file_net_log_observer_unittest.cc b/net/log/file_net_log_observer_unittest.cc index 669da0d..9de9358 100644 --- a/net/log/file_net_log_observer_unittest.cc +++ b/net/log/file_net_log_observer_unittest.cc
@@ -223,7 +223,7 @@ // Used for tests that are common to both bounded and unbounded modes of the // the FileNetLogObserver. The param is true if bounded mode is used. class FileNetLogObserverTest : public ::testing::TestWithParam<bool>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { public: void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); @@ -290,7 +290,7 @@ // Used for tests that are exclusive to the bounded mode of FileNetLogObserver. class FileNetLogObserverBoundedTest : public ::testing::Test, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { public: void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
diff --git a/net/log/net_log_util_unittest.cc b/net/log/net_log_util_unittest.cc index 165f9f86..7361f8d 100644 --- a/net/log/net_log_util_unittest.cc +++ b/net/log/net_log_util_unittest.cc
@@ -33,7 +33,7 @@ // Make sure GetNetInfo doesn't crash when called on contexts with and without // caches, and they have the same number of elements. TEST(NetLogUtil, GetNetInfo) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; TestURLRequestContext context; HttpCache* http_cache = context.http_transaction_factory()->GetCache(); @@ -60,7 +60,7 @@ // Make sure CreateNetLogEntriesForActiveObjects works for requests from a // single URLRequestContext. TEST(NetLogUtil, CreateNetLogEntriesForActiveObjectsOneContext) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Using same context for each iteration makes sure deleted requests don't // appear in the list, or result in crashes. @@ -92,7 +92,7 @@ // Make sure CreateNetLogEntriesForActiveObjects works with multiple // URLRequestContexts. TEST(NetLogUtil, CreateNetLogEntriesForActiveObjectsMultipleContexts) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; TestDelegate delegate; for (size_t num_requests = 0; num_requests < 5; ++num_requests) {
diff --git a/net/log/trace_net_log_observer_unittest.cc b/net/log/trace_net_log_observer_unittest.cc index 19ac0cf..5e8ce8e4 100644 --- a/net/log/trace_net_log_observer_unittest.cc +++ b/net/log/trace_net_log_observer_unittest.cc
@@ -81,7 +81,7 @@ EnableTraceLog(disabled_netlog_category); } -class TraceNetLogObserverTest : public TestWithScopedTaskEnvironment { +class TraceNetLogObserverTest : public TestWithTaskEnvironment { public: TraceNetLogObserverTest() { TraceLog* tracelog = TraceLog::GetInstance(); @@ -427,7 +427,7 @@ } TEST(TraceNetLogObserverCategoryTest, DisabledCategory) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; TraceNetLogObserver observer; NetLog net_log; observer.WatchForTraceStart(&net_log); @@ -444,7 +444,7 @@ } TEST(TraceNetLogObserverCategoryTest, EnabledCategory) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; TraceNetLogObserver observer; NetLog net_log; observer.WatchForTraceStart(&net_log);
diff --git a/net/nqe/network_congestion_analyzer_unittest.cc b/net/nqe/network_congestion_analyzer_unittest.cc index 659c71b..b9d5fe1 100644 --- a/net/nqe/network_congestion_analyzer_unittest.cc +++ b/net/nqe/network_congestion_analyzer_unittest.cc
@@ -22,7 +22,7 @@ namespace internal { -using NetworkCongestionAnalyzerTest = TestWithScopedTaskEnvironment; +using NetworkCongestionAnalyzerTest = TestWithTaskEnvironment; namespace { @@ -339,4 +339,4 @@ } // namespace nqe -} // namespace net \ No newline at end of file +} // namespace net
diff --git a/net/nqe/network_qualities_prefs_manager_unittest.cc b/net/nqe/network_qualities_prefs_manager_unittest.cc index d7c0355..1e07ec9 100644 --- a/net/nqe/network_qualities_prefs_manager_unittest.cc +++ b/net/nqe/network_qualities_prefs_manager_unittest.cc
@@ -75,7 +75,7 @@ DISALLOW_COPY_AND_ASSIGN(TestPrefDelegate); }; -using NetworkQualitiesPrefManager = TestWithScopedTaskEnvironment; +using NetworkQualitiesPrefManager = TestWithTaskEnvironment; TEST_F(NetworkQualitiesPrefManager, Write) { // Force set the ECT to Slow 2G so that the ECT does not match the default
diff --git a/net/nqe/network_quality_estimator_unittest.cc b/net/nqe/network_quality_estimator_unittest.cc index 1481040..245bfdc 100644 --- a/net/nqe/network_quality_estimator_unittest.cc +++ b/net/nqe/network_quality_estimator_unittest.cc
@@ -203,7 +203,7 @@ } // namespace constexpr float kEpsilon = 0.001f; -using NetworkQualityEstimatorTest = TestWithScopedTaskEnvironment; +using NetworkQualityEstimatorTest = TestWithTaskEnvironment; TEST_F(NetworkQualityEstimatorTest, TestKbpsRTTUpdates) { base::HistogramTester histogram_tester;
diff --git a/net/nqe/network_quality_estimator_util_unittest.cc b/net/nqe/network_quality_estimator_util_unittest.cc index 2e5453e..d7409578 100644 --- a/net/nqe/network_quality_estimator_util_unittest.cc +++ b/net/nqe/network_quality_estimator_util_unittest.cc
@@ -29,7 +29,7 @@ // Verify that the cached network qualities from the prefs are not used if the // reading of the network quality prefs is not enabled.. TEST(NetworkQualityEstimatorUtilTest, ReservedHost) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<BoundTestNetLog> net_log = std::make_unique<BoundTestNetLog>(); @@ -81,7 +81,7 @@ // resolution is not cached. Further, once the resolution is cached, verify that // the cached entry is used. TEST(NetworkQualityEstimatorUtilTest, ReservedHostUncached) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<BoundTestNetLog> net_log = std::make_unique<BoundTestNetLog>(); @@ -113,7 +113,7 @@ // Verify that IsPrivateHost() returns correct results for local hosts. TEST(NetworkQualityEstimatorUtilTest, Localhost) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<BoundTestNetLog> net_log = std::make_unique<BoundTestNetLog>();
diff --git a/net/nqe/socket_watcher_unittest.cc b/net/nqe/socket_watcher_unittest.cc index 2258c54..ba4d44db 100644 --- a/net/nqe/socket_watcher_unittest.cc +++ b/net/nqe/socket_watcher_unittest.cc
@@ -24,7 +24,7 @@ namespace { -class NetworkQualitySocketWatcherTest : public TestWithScopedTaskEnvironment { +class NetworkQualitySocketWatcherTest : public TestWithTaskEnvironment { protected: NetworkQualitySocketWatcherTest() { ResetExpectedCallbackParams(); } ~NetworkQualitySocketWatcherTest() override { ResetExpectedCallbackParams(); }
diff --git a/net/nqe/throughput_analyzer_unittest.cc b/net/nqe/throughput_analyzer_unittest.cc index ebcb224..e8af76f 100644 --- a/net/nqe/throughput_analyzer_unittest.cc +++ b/net/nqe/throughput_analyzer_unittest.cc
@@ -103,7 +103,7 @@ DISALLOW_COPY_AND_ASSIGN(TestThroughputAnalyzer); }; -using ThroughputAnalyzerTest = TestWithScopedTaskEnvironment; +using ThroughputAnalyzerTest = TestWithTaskEnvironment; TEST_F(ThroughputAnalyzerTest, MaximumRequests) { const struct {
diff --git a/net/proxy_resolution/dhcp_pac_file_adapter_fetcher_win_unittest.cc b/net/proxy_resolution/dhcp_pac_file_adapter_fetcher_win_unittest.cc index 33471145..87f0cf6 100644 --- a/net/proxy_resolution/dhcp_pac_file_adapter_fetcher_win_unittest.cc +++ b/net/proxy_resolution/dhcp_pac_file_adapter_fetcher_win_unittest.cc
@@ -174,7 +174,7 @@ }; TEST(DhcpPacFileAdapterFetcher, NormalCaseURLNotInDhcp) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; client.fetcher_->configured_url_ = ""; @@ -186,7 +186,7 @@ } TEST(DhcpPacFileAdapterFetcher, NormalCaseURLInDhcp) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; client.RunTest(); @@ -199,7 +199,7 @@ } TEST(DhcpPacFileAdapterFetcher, TimeoutDuringDhcp) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Does a Fetch() with a long enough delay on accessing DHCP that the // fetcher should time out. This is to test a case manual testing found, @@ -225,7 +225,7 @@ } TEST(DhcpPacFileAdapterFetcher, CancelWhileDhcp) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; client.RunTest(); @@ -240,7 +240,7 @@ } TEST(DhcpPacFileAdapterFetcher, CancelWhileFetcher) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; // This causes the mock fetcher not to pretend the @@ -264,7 +264,7 @@ } TEST(DhcpPacFileAdapterFetcher, CancelAtCompletion) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; client.RunTest(); @@ -299,7 +299,7 @@ }; TEST(DhcpPacFileAdapterFetcher, MockDhcpRealFetch) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; EmbeddedTestServer test_server; test_server.ServeFilesFromSourceDirectory( @@ -329,7 +329,7 @@ #define BASE_URL "http://corpserver/proxy.pac" TEST(DhcpPacFileAdapterFetcher, SanitizeDhcpApiString) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; const size_t kBaseUrlLen = strlen(BASE_URL);
diff --git a/net/proxy_resolution/dhcp_pac_file_fetcher_factory_unittest.cc b/net/proxy_resolution/dhcp_pac_file_fetcher_factory_unittest.cc index 047c7626..d337d32 100644 --- a/net/proxy_resolution/dhcp_pac_file_fetcher_factory_unittest.cc +++ b/net/proxy_resolution/dhcp_pac_file_fetcher_factory_unittest.cc
@@ -13,7 +13,7 @@ #if defined(OS_WIN) TEST(DhcpPacFileFetcherFactoryTest, WindowsFetcherOnWindows) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; DhcpPacFileFetcherFactory factory; TestURLRequestContext context; std::unique_ptr<DhcpPacFileFetcher> fetcher(factory.Create(&context)); @@ -24,7 +24,7 @@ #else // !defined(OS_WIN) TEST(DhcpPacFileFetcherFactoryTest, ReturnNullOnUnsupportedPlatforms) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; DhcpPacFileFetcherFactory factory; TestURLRequestContext context; std::unique_ptr<DhcpPacFileFetcher> fetcher(factory.Create(&context));
diff --git a/net/proxy_resolution/dhcp_pac_file_fetcher_win_unittest.cc b/net/proxy_resolution/dhcp_pac_file_fetcher_win_unittest.cc index 718738a..44697be 100644 --- a/net/proxy_resolution/dhcp_pac_file_fetcher_win_unittest.cc +++ b/net/proxy_resolution/dhcp_pac_file_fetcher_win_unittest.cc
@@ -123,7 +123,7 @@ }; TEST(DhcpPacFileFetcherWin, RealFetch) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // This tests a call to Fetch() with no stubbing out of dependencies. // @@ -141,7 +141,7 @@ } TEST(DhcpPacFileFetcherWin, RealFetchWithCancel) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Does a Fetch() with an immediate cancel. As before, just // exercises the code without stubbing out dependencies. @@ -193,7 +193,7 @@ }; TEST(DhcpPacFileFetcherWin, RealFetchWithDeferredCancel) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Does a Fetch() with a slightly delayed cancel. As before, just // exercises the code without stubbing out dependencies, but @@ -454,7 +454,7 @@ } TEST(DhcpPacFileFetcherWin, NormalCaseURLConfiguredOneAdapter) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; TestNormalCaseURLConfiguredOneAdapter(&client); @@ -477,7 +477,7 @@ } TEST(DhcpPacFileFetcherWin, NormalCaseURLConfiguredMultipleAdapters) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; TestNormalCaseURLConfiguredMultipleAdapters(&client); @@ -503,7 +503,7 @@ TEST(DhcpPacFileFetcherWin, NormalCaseURLConfiguredMultipleAdaptersWithTimeout) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; TestNormalCaseURLConfiguredMultipleAdaptersWithTimeout(&client); @@ -534,7 +534,7 @@ TEST(DhcpPacFileFetcherWin, FailureCaseURLConfiguredMultipleAdaptersWithTimeout) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; TestFailureCaseURLConfiguredMultipleAdaptersWithTimeout(&client); @@ -560,7 +560,7 @@ } TEST(DhcpPacFileFetcherWin, FailureCaseNoURLConfigured) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; TestFailureCaseNoURLConfigured(&client); @@ -575,7 +575,7 @@ } TEST(DhcpPacFileFetcherWin, FailureCaseNoDhcpAdapters) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; TestFailureCaseNoDhcpAdapters(&client); @@ -613,7 +613,7 @@ } TEST(DhcpPacFileFetcherWin, ShortCircuitLessPreferredAdapters) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; TestShortCircuitLessPreferredAdapters(&client); @@ -634,14 +634,14 @@ // Regression test to check that when we cancel immediately, no // adapter fetchers get created. TEST(DhcpPacFileFetcherWin, ImmediateCancel) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; TestImmediateCancel(&client); } TEST(DhcpPacFileFetcherWin, ReuseFetcher) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; @@ -678,7 +678,7 @@ } TEST(DhcpPacFileFetcherWin, OnShutdown) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; FetcherClient client; TestURLRequestContext context;
diff --git a/net/proxy_resolution/multi_threaded_proxy_resolver_unittest.cc b/net/proxy_resolution/multi_threaded_proxy_resolver_unittest.cc index a1a3c3b..fcb33d6 100644 --- a/net/proxy_resolution/multi_threaded_proxy_resolver_unittest.cc +++ b/net/proxy_resolution/multi_threaded_proxy_resolver_unittest.cc
@@ -210,7 +210,7 @@ std::unique_ptr<ProxyResolverFactory> factory_; }; -class MultiThreadedProxyResolverTest : public TestWithScopedTaskEnvironment { +class MultiThreadedProxyResolverTest : public TestWithTaskEnvironment { public: void Init(size_t num_threads) { std::unique_ptr<BlockableProxyResolverFactory> factory_owner(
diff --git a/net/proxy_resolution/network_delegate_error_observer_unittest.cc b/net/proxy_resolution/network_delegate_error_observer_unittest.cc index 1bd3e42..6f0013f1 100644 --- a/net/proxy_resolution/network_delegate_error_observer_unittest.cc +++ b/net/proxy_resolution/network_delegate_error_observer_unittest.cc
@@ -87,7 +87,7 @@ // Check that the OnPACScriptError method can be called from an arbitrary // thread. TEST(NetworkDelegateErrorObserverTest, CallOnThread) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::Thread thread("test_thread"); thread.Start(); TestNetworkDelegate network_delegate; @@ -104,7 +104,7 @@ // Check that passing a NULL network delegate works. TEST(NetworkDelegateErrorObserverTest, NoDelegate) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::Thread thread("test_thread"); thread.Start(); NetworkDelegateErrorObserver observer(
diff --git a/net/proxy_resolution/pac_file_decider_unittest.cc b/net/proxy_resolution/pac_file_decider_unittest.cc index 8a89c51..0652f6be 100644 --- a/net/proxy_resolution/pac_file_decider_unittest.cc +++ b/net/proxy_resolution/pac_file_decider_unittest.cc
@@ -331,7 +331,7 @@ EXPECT_EQ(rule.url, decider.effective_config().value().pac_url()); } -class PacFileDeciderQuickCheckTest : public TestWithScopedTaskEnvironment { +class PacFileDeciderQuickCheckTest : public TestWithTaskEnvironment { public: PacFileDeciderQuickCheckTest() : rule_(rules_.AddSuccessRule("http://wpad/wpad.dat")), @@ -624,7 +624,7 @@ // a 1 millisecond delay. This means it will now complete asynchronously. // Moreover, we test the NetLog to make sure it logged the pause. TEST(PacFileDeciderTest, CustomPacFails1_WithPositiveDelay) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; Rules rules; RuleBasedPacFileFetcher fetcher(&rules); @@ -825,7 +825,7 @@ // http://codereview.chromium.org/7044058/ // Thus, we don't care much about actual results (hence no EXPECT or ASSERT // macros below), just that it doesn't crash. - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; Rules rules; RuleBasedPacFileFetcher fetcher(&rules);
diff --git a/net/proxy_resolution/pac_file_fetcher_impl_unittest.cc b/net/proxy_resolution/pac_file_fetcher_impl_unittest.cc index 15e796e..1b6ec74 100644 --- a/net/proxy_resolution/pac_file_fetcher_impl_unittest.cc +++ b/net/proxy_resolution/pac_file_fetcher_impl_unittest.cc
@@ -218,8 +218,7 @@ DISALLOW_COPY_AND_ASSIGN(BasicNetworkDelegate); }; -class PacFileFetcherImplTest : public PlatformTest, - public WithScopedTaskEnvironment { +class PacFileFetcherImplTest : public PlatformTest, public WithTaskEnvironment { public: PacFileFetcherImplTest() { test_server_.AddDefaultHandlers(base::FilePath(kDocRoot));
diff --git a/net/proxy_resolution/proxy_config_service_android_unittest.cc b/net/proxy_resolution/proxy_config_service_android_unittest.cc index 6283c44..3f6a950 100644 --- a/net/proxy_resolution/proxy_config_service_android_unittest.cc +++ b/net/proxy_resolution/proxy_config_service_android_unittest.cc
@@ -60,7 +60,7 @@ typedef std::map<std::string, std::string> StringMap; -class ProxyConfigServiceAndroidTestBase : public TestWithScopedTaskEnvironment { +class ProxyConfigServiceAndroidTestBase : public TestWithTaskEnvironment { protected: // Note that the current thread's message loop is initialized by the test // suite (see net/test/net_test_suite.cc).
diff --git a/net/proxy_resolution/proxy_config_service_linux_unittest.cc b/net/proxy_resolution/proxy_config_service_linux_unittest.cc index bd63225..a487fd4 100644 --- a/net/proxy_resolution/proxy_config_service_linux_unittest.cc +++ b/net/proxy_resolution/proxy_config_service_linux_unittest.cc
@@ -411,7 +411,7 @@ // but all the test cases with the same prefix ("ProxyConfigServiceLinuxTest") // must use the same test fixture class (also "ProxyConfigServiceLinuxTest"). class ProxyConfigServiceLinuxTest : public PlatformTest, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: void SetUp() override { PlatformTest::SetUp();
diff --git a/net/proxy_resolution/proxy_resolution_service_unittest.cc b/net/proxy_resolution/proxy_resolution_service_unittest.cc index ff28440..31e50376 100644 --- a/net/proxy_resolution/proxy_resolution_service_unittest.cc +++ b/net/proxy_resolution/proxy_resolution_service_unittest.cc
@@ -116,7 +116,7 @@ // // The tests which verify the polling code re-enable the polling behavior but // are careful to avoid timing problems. -class ProxyResolutionServiceTest : public TestWithScopedTaskEnvironment { +class ProxyResolutionServiceTest : public TestWithTaskEnvironment { protected: void SetUp() override { testing::Test::SetUp();
diff --git a/net/proxy_resolution/proxy_resolver_v8_tracing_unittest.cc b/net/proxy_resolution/proxy_resolver_v8_tracing_unittest.cc index a22a943..7e4dbbb51 100644 --- a/net/proxy_resolution/proxy_resolver_v8_tracing_unittest.cc +++ b/net/proxy_resolution/proxy_resolver_v8_tracing_unittest.cc
@@ -39,7 +39,7 @@ namespace { -class ProxyResolverV8TracingTest : public TestWithScopedTaskEnvironment { +class ProxyResolverV8TracingTest : public TestWithTaskEnvironment { public: void TearDown() override { // Drain any pending messages, which may be left over from cancellation.
diff --git a/net/proxy_resolution/proxy_resolver_v8_unittest.cc b/net/proxy_resolution/proxy_resolver_v8_unittest.cc index 2292f2c..7f3d5ad 100644 --- a/net/proxy_resolution/proxy_resolver_v8_unittest.cc +++ b/net/proxy_resolution/proxy_resolver_v8_unittest.cc
@@ -102,7 +102,7 @@ bool should_terminate; }; -class ProxyResolverV8Test : public TestWithScopedTaskEnvironment { +class ProxyResolverV8Test : public TestWithTaskEnvironment { public: // Creates a ProxyResolverV8 using the PAC script contained in |filename|. If // called more than once, the previous ProxyResolverV8 is deleted.
diff --git a/net/quic/bidirectional_stream_quic_impl_unittest.cc b/net/quic/bidirectional_stream_quic_impl_unittest.cc index f969027..2d096868 100644 --- a/net/quic/bidirectional_stream_quic_impl_unittest.cc +++ b/net/quic/bidirectional_stream_quic_impl_unittest.cc
@@ -395,7 +395,7 @@ class BidirectionalStreamQuicImplTest : public ::testing::TestWithParam< std::tuple<quic::ParsedQuicVersion, bool>>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: static const bool kFin = true; static const bool kIncludeVersion = true;
diff --git a/net/quic/network_connection_unittest.cc b/net/quic/network_connection_unittest.cc index ebddd84..a73c95ff 100644 --- a/net/quic/network_connection_unittest.cc +++ b/net/quic/network_connection_unittest.cc
@@ -68,7 +68,7 @@ } TEST_F(NetworkConnectionTest, ConnectionChange) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; notifier_->SetConnectionType(CONNECTION_2G);
diff --git a/net/quic/platform/impl/quic_test_impl.h b/net/quic/platform/impl/quic_test_impl.h index 72f2485..56341e0 100644 --- a/net/quic/platform/impl/quic_test_impl.h +++ b/net/quic/platform/impl/quic_test_impl.h
@@ -56,11 +56,10 @@ class ScopedEnvironmentForThreadsImpl { public: ScopedEnvironmentForThreadsImpl() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} public: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; #define QUIC_TEST_DISABLED_IN_CHROME_IMPL(name) DISABLED_##name
diff --git a/net/quic/quic_chromium_client_session_test.cc b/net/quic/quic_chromium_client_session_test.cc index a2174f3..ea83c2c7 100644 --- a/net/quic/quic_chromium_client_session_test.cc +++ b/net/quic/quic_chromium_client_session_test.cc
@@ -87,7 +87,7 @@ class QuicChromiumClientSessionTest : public ::testing::TestWithParam< std::tuple<quic::ParsedQuicVersion, bool>>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { public: QuicChromiumClientSessionTest() : version_(std::get<0>(GetParam())),
diff --git a/net/quic/quic_chromium_client_stream_test.cc b/net/quic/quic_chromium_client_stream_test.cc index f654267d..477fd22 100644 --- a/net/quic/quic_chromium_client_stream_test.cc +++ b/net/quic/quic_chromium_client_stream_test.cc
@@ -157,7 +157,7 @@ class QuicChromiumClientStreamTest : public ::testing::TestWithParam<quic::QuicTransportVersion>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { public: QuicChromiumClientStreamTest() : crypto_config_(
diff --git a/net/quic/quic_end_to_end_unittest.cc b/net/quic/quic_end_to_end_unittest.cc index 6383abf..24de77d 100644 --- a/net/quic/quic_end_to_end_unittest.cc +++ b/net/quic/quic_end_to_end_unittest.cc
@@ -82,8 +82,7 @@ } // namespace -class QuicEndToEndTest : public ::testing::Test, - public WithScopedTaskEnvironment { +class QuicEndToEndTest : public ::testing::Test, public WithTaskEnvironment { protected: QuicEndToEndTest() : host_resolver_impl_(CreateResolverImpl()),
diff --git a/net/quic/quic_flags_list.h b/net/quic/quic_flags_list.h index 2f8ddf4..5705216 100644 --- a/net/quic/quic_flags_list.h +++ b/net/quic/quic_flags_list.h
@@ -302,7 +302,7 @@ // If true, when RTO fires and there is no packet to be RTOed, let connection // send. -QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_fix_rto_retransmission2, true) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_fix_rto_retransmission3, true) // If true, QuicSession::GetOrCreateDynamicStream() is deprecated, and its // contents are moved to GetOrCreateStream(). @@ -400,3 +400,11 @@ QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_use_length_prefix_from_packet_info, false) + +// If true, enable IETF style probe timeout. +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_enable_pto, false) + +// When true, QuicFramer will use QueueUndecryptablePacket on all QUIC versions. +QUIC_FLAG(bool, + FLAGS_quic_restart_flag_quic_framer_uses_undecryptable_upcall, + false)
diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc index 1ba2168..d02810c 100644 --- a/net/quic/quic_http_stream_test.cc +++ b/net/quic/quic_http_stream_test.cc
@@ -176,7 +176,7 @@ class QuicHttpStreamTest : public ::testing::TestWithParam< std::tuple<quic::ParsedQuicVersion, bool>>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { public: void CloseStream(QuicHttpStream* stream, int /*rv*/) { stream->Close(false); }
diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc index 0f88a99..66c0ead3 100644 --- a/net/quic/quic_network_transaction_unittest.cc +++ b/net/quic/quic_network_transaction_unittest.cc
@@ -261,7 +261,7 @@ : public PlatformTest, public ::testing::WithParamInterface< std::tuple<quic::ParsedQuicVersion, bool>>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: QuicNetworkTransactionTest() : version_(std::get<0>(GetParam())), @@ -6601,7 +6601,7 @@ class QuicNetworkTransactionWithDestinationTest : public PlatformTest, public ::testing::WithParamInterface<PoolingTestParams>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: QuicNetworkTransactionWithDestinationTest() : version_(GetParam().version),
diff --git a/net/quic/quic_proxy_client_socket_unittest.cc b/net/quic/quic_proxy_client_socket_unittest.cc index 682982a..5cc10ee 100644 --- a/net/quic/quic_proxy_client_socket_unittest.cc +++ b/net/quic/quic_proxy_client_socket_unittest.cc
@@ -84,7 +84,7 @@ class QuicProxyClientSocketTest : public ::testing::TestWithParam< std::tuple<quic::ParsedQuicVersion, bool>>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: static const bool kFin = true; static const bool kIncludeVersion = true; @@ -493,7 +493,7 @@ void AssertSyncReadEquals(const char* data, int len) { scoped_refptr<IOBuffer> buf = base::MakeRefCounted<IOBuffer>(len); ASSERT_EQ(len, sock_->Read(buf.get(), len, CompletionOnceCallback())); - ASSERT_EQ(spdy::SpdyString(data, len), spdy::SpdyString(buf->data(), len)); + ASSERT_EQ(std::string(data, len), std::string(buf->data(), len)); ASSERT_TRUE(sock_->IsConnected()); } @@ -507,7 +507,7 @@ EXPECT_EQ(len, read_callback_.WaitForResult()); EXPECT_TRUE(sock_->IsConnected()); - ASSERT_EQ(spdy::SpdyString(data, len), spdy::SpdyString(buf->data(), len)); + ASSERT_EQ(std::string(data, len), std::string(buf->data(), len)); } void AssertReadStarts(const char* data, int len) { @@ -523,8 +523,7 @@ // Now the read will return. EXPECT_EQ(len, read_callback_.WaitForResult()); - ASSERT_EQ(spdy::SpdyString(data, len), - spdy::SpdyString(read_buf_->data(), len)); + ASSERT_EQ(std::string(data, len), std::string(read_buf_->data(), len)); } std::string ConstructDataHeader(size_t body_len) { @@ -1184,8 +1183,7 @@ // Now attempt to do a read of more data than remains buffered scoped_refptr<IOBuffer> buf = base::MakeRefCounted<IOBuffer>(kLen33); ASSERT_EQ(kLen3, sock_->Read(buf.get(), kLen33, CompletionOnceCallback())); - ASSERT_EQ(spdy::SpdyString(kMsg3, kLen3), - spdy::SpdyString(buf->data(), kLen3)); + ASSERT_EQ(std::string(kMsg3, kLen3), std::string(buf->data(), kLen3)); ASSERT_TRUE(sock_->IsConnected()); }
diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc index f505877..d77a050 100644 --- a/net/quic/quic_stream_factory_test.cc +++ b/net/quic/quic_stream_factory_test.cc
@@ -208,7 +208,7 @@ DISALLOW_COPY_AND_ASSIGN(TestConnectionMigrationSocketFactory); }; -class QuicStreamFactoryTestBase : public WithScopedTaskEnvironment { +class QuicStreamFactoryTestBase : public WithTaskEnvironment { protected: QuicStreamFactoryTestBase(quic::ParsedQuicVersion version, bool client_headers_include_h2_stream_dependency)
diff --git a/net/quic/quic_test_packet_printer.cc b/net/quic/quic_test_packet_printer.cc index bc76d7d..5c7f05e 100644 --- a/net/quic/quic_test_packet_printer.cc +++ b/net/quic/quic_test_packet_printer.cc
@@ -61,6 +61,12 @@ void OnCoalescedPacket(const QuicEncryptedPacket& packet) override { *output_ << "OnCoalescedPacket\n"; } + void OnUndecryptablePacket(const QuicEncryptedPacket& packet, + EncryptionLevel decryption_level, + bool has_decryption_key) override { + *output_ << "OnUndecryptablePacket, decryption_level: " << decryption_level + << "\n"; + } bool OnStreamFrame(const QuicStreamFrame& frame) override { *output_ << "OnStreamFrame: " << frame; *output_ << " data: { "
diff --git a/net/reporting/reporting_service_unittest.cc b/net/reporting/reporting_service_unittest.cc index 6277f9a..1fd216a 100644 --- a/net/reporting/reporting_service_unittest.cc +++ b/net/reporting/reporting_service_unittest.cc
@@ -31,7 +31,7 @@ // The tests are parametrized on a boolean value which represents whether to use // a MockPersistentReportingStore (if false, no store is used). class ReportingServiceTest : public ::testing::TestWithParam<bool>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: const GURL kUrl_ = GURL("https://origin/path"); const GURL kUrl2_ = GURL("https://origin2/path");
diff --git a/net/reporting/reporting_test_util.h b/net/reporting/reporting_test_util.h index 16ef871..f4f64ca8 100644 --- a/net/reporting/reporting_test_util.h +++ b/net/reporting/reporting_test_util.h
@@ -177,7 +177,7 @@ // A unit test base class that provides a TestReportingContext and shorthand // getters. -class ReportingTestBase : public TestWithScopedTaskEnvironment { +class ReportingTestBase : public TestWithTaskEnvironment { protected: ReportingTestBase(); ~ReportingTestBase() override;
diff --git a/net/reporting/reporting_uploader_unittest.cc b/net/reporting/reporting_uploader_unittest.cc index 4767b4c..7e4e279 100644 --- a/net/reporting/reporting_uploader_unittest.cc +++ b/net/reporting/reporting_uploader_unittest.cc
@@ -24,7 +24,7 @@ namespace net { namespace { -class ReportingUploaderTest : public TestWithScopedTaskEnvironment { +class ReportingUploaderTest : public TestWithTaskEnvironment { protected: ReportingUploaderTest() : server_(test_server::EmbeddedTestServer::TYPE_HTTPS),
diff --git a/net/server/http_server_unittest.cc b/net/server/http_server_unittest.cc index ce54cb54..0948ae62 100644 --- a/net/server/http_server_unittest.cc +++ b/net/server/http_server_unittest.cc
@@ -170,7 +170,7 @@ } // namespace -class HttpServerTest : public TestWithScopedTaskEnvironment, +class HttpServerTest : public TestWithTaskEnvironment, public HttpServer::Delegate { public: HttpServerTest()
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index 87bab386..bbc524a 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -622,11 +622,11 @@ waiting_jobs_[job]->set_has_established_connection(); } -class ClientSocketPoolBaseTest : public TestWithScopedTaskEnvironment { +class ClientSocketPoolBaseTest : public TestWithTaskEnvironment { protected: ClientSocketPoolBaseTest() - : TestWithScopedTaskEnvironment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : TestWithTaskEnvironment( + base::test::TaskEnvironment::TimeSource::MOCK_TIME), params_(ClientSocketPool::SocketParams::CreateForHttpForTesting()) { connect_backup_jobs_enabled_ = TransportClientSocketPool::connect_backup_jobs_enabled();
diff --git a/net/socket/connect_job_unittest.cc b/net/socket/connect_job_unittest.cc index ec058c4..175ea34e 100644 --- a/net/socket/connect_job_unittest.cc +++ b/net/socket/connect_job_unittest.cc
@@ -89,8 +89,7 @@ class ConnectJobTest : public testing::Test { public: ConnectJobTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), common_connect_job_params_( nullptr /* client_socket_factory */, nullptr /* host_resolver */, @@ -109,7 +108,7 @@ ~ConnectJobTest() override = default; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestNetLog net_log_; const CommonConnectJobParams common_connect_job_params_; TestConnectJobDelegate delegate_; @@ -139,7 +138,7 @@ TestConnectJob job(TestConnectJob::JobType::kHung, base::TimeDelta(), &common_connect_job_params_, &delegate_); ASSERT_THAT(job.Connect(), test::IsError(ERR_IO_PENDING)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(delegate_.has_result()); } @@ -171,13 +170,13 @@ ASSERT_THAT(job->Connect(), test::IsError(ERR_IO_PENDING)); // Nothing should happen before the specified time. - scoped_task_environment_.FastForwardBy(kTimeout - - base::TimeDelta::FromMilliseconds(1)); + task_environment_.FastForwardBy(kTimeout - + base::TimeDelta::FromMilliseconds(1)); base::RunLoop().RunUntilIdle(); EXPECT_FALSE(delegate_.has_result()); // At which point the job should time out. - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(1)); EXPECT_THAT(delegate_.WaitForResult(), test::IsError(ERR_TIMED_OUT)); // Have to delete the job for it to log the end event. @@ -208,19 +207,19 @@ ASSERT_THAT(job.Connect(), test::IsError(ERR_IO_PENDING)); // Nothing should happen before the specified time. - scoped_task_environment_.FastForwardBy(kTimeout - - base::TimeDelta::FromMilliseconds(1)); + task_environment_.FastForwardBy(kTimeout - + base::TimeDelta::FromMilliseconds(1)); base::RunLoop().RunUntilIdle(); EXPECT_FALSE(delegate_.has_result()); // Make sure restarting the timer is respected. job.ResetTimer(kTimeout); - scoped_task_environment_.FastForwardBy(kTimeout - - base::TimeDelta::FromMilliseconds(1)); + task_environment_.FastForwardBy(kTimeout - + base::TimeDelta::FromMilliseconds(1)); base::RunLoop().RunUntilIdle(); EXPECT_FALSE(delegate_.has_result()); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(1)); EXPECT_THAT(delegate_.WaitForResult(), test::IsError(ERR_TIMED_OUT)); }
diff --git a/net/socket/sequenced_socket_data_unittest.cc b/net/socket/sequenced_socket_data_unittest.cc index 97562f14..76c3634 100644 --- a/net/socket/sequenced_socket_data_unittest.cc +++ b/net/socket/sequenced_socket_data_unittest.cc
@@ -148,7 +148,7 @@ DISALLOW_COPY_AND_ASSIGN(ReentrantHelper); }; -class SequencedSocketDataTest : public TestWithScopedTaskEnvironment { +class SequencedSocketDataTest : public TestWithTaskEnvironment { public: SequencedSocketDataTest(); ~SequencedSocketDataTest() override;
diff --git a/net/socket/socket_bio_adapter_unittest.cc b/net/socket/socket_bio_adapter_unittest.cc index f779c3a7..04300a76 100644 --- a/net/socket/socket_bio_adapter_unittest.cc +++ b/net/socket/socket_bio_adapter_unittest.cc
@@ -38,7 +38,7 @@ class SocketBIOAdapterTest : public testing::TestWithParam<ReadIfReadySupport>, public SocketBIOAdapter::Delegate, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: void SetUp() override { if (GetParam() == READ_IF_READY_SUPPORTED) {
diff --git a/net/socket/socks5_client_socket_unittest.cc b/net/socket/socks5_client_socket_unittest.cc index a25befe..3fdc356e 100644 --- a/net/socket/socks5_client_socket_unittest.cc +++ b/net/socket/socks5_client_socket_unittest.cc
@@ -42,8 +42,7 @@ namespace { // Base class to test SOCKS5ClientSocket -class SOCKS5ClientSocketTest : public PlatformTest, - public WithScopedTaskEnvironment { +class SOCKS5ClientSocketTest : public PlatformTest, public WithTaskEnvironment { public: SOCKS5ClientSocketTest(); // Create a SOCKSClientSocket on top of a MockSocket.
diff --git a/net/socket/socks_client_socket_unittest.cc b/net/socket/socks_client_socket_unittest.cc index a946f2e..4ca5288 100644 --- a/net/socket/socks_client_socket_unittest.cc +++ b/net/socket/socks_client_socket_unittest.cc
@@ -38,8 +38,7 @@ class NetLog; -class SOCKSClientSocketTest : public PlatformTest, - public WithScopedTaskEnvironment { +class SOCKSClientSocketTest : public PlatformTest, public WithTaskEnvironment { public: SOCKSClientSocketTest(); // Create a SOCKSClientSocket on top of a MockSocket.
diff --git a/net/socket/socks_connect_job_unittest.cc b/net/socket/socks_connect_job_unittest.cc index 07e9fd658..715faa27 100644 --- a/net/socket/socks_connect_job_unittest.cc +++ b/net/socket/socks_connect_job_unittest.cc
@@ -37,8 +37,7 @@ constexpr base::TimeDelta kTinyTime = base::TimeDelta::FromMicroseconds(1); -class SOCKSConnectJobTest : public testing::Test, - public WithScopedTaskEnvironment { +class SOCKSConnectJobTest : public testing::Test, public WithTaskEnvironment { public: enum class SOCKSVersion { V4, @@ -46,8 +45,7 @@ }; SOCKSConnectJobTest() - : WithScopedTaskEnvironment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : WithTaskEnvironment(base::test::TaskEnvironment::TimeSource::MOCK_TIME), common_connect_job_params_( &client_socket_factory_, &host_resolver_,
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc index 3120803..2dc036c 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc
@@ -789,8 +789,7 @@ const HashValueVector& hashes)); }; -class SSLClientSocketTest : public PlatformTest, - public WithScopedTaskEnvironment { +class SSLClientSocketTest : public PlatformTest, public WithTaskEnvironment { public: SSLClientSocketTest() : socket_factory_(ClientSocketFactory::GetDefaultFactory()),
diff --git a/net/socket/ssl_connect_job_unittest.cc b/net/socket/ssl_connect_job_unittest.cc index e346938c..b8cbee22 100644 --- a/net/socket/ssl_connect_job_unittest.cc +++ b/net/socket/ssl_connect_job_unittest.cc
@@ -73,12 +73,10 @@ EXPECT_EQ(base::TimeTicks::Now(), connect_timing.connect_end); } -class SSLConnectJobTest : public WithScopedTaskEnvironment, - public testing::Test { +class SSLConnectJobTest : public WithTaskEnvironment, public testing::Test { public: SSLConnectJobTest() - : WithScopedTaskEnvironment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : WithTaskEnvironment(base::test::TaskEnvironment::TimeSource::MOCK_TIME), proxy_resolution_service_(ProxyResolutionService::CreateDirect()), ssl_config_service_(new SSLConfigServiceDefaults), http_auth_handler_factory_(HttpAuthHandlerFactory::CreateDefault()), @@ -103,8 +101,7 @@ /*tunnel=*/true, TRAFFIC_ANNOTATION_FOR_TESTS, NetworkIsolationKey())), - common_connect_job_params_(session_->CreateCommonConnectJobParams()) { - } + common_connect_job_params_(session_->CreateCommonConnectJobParams()) {} ~SSLConnectJobTest() override = default;
diff --git a/net/socket/ssl_server_socket_unittest.cc b/net/socket/ssl_server_socket_unittest.cc index adc2664..1fbf20e 100644 --- a/net/socket/ssl_server_socket_unittest.cc +++ b/net/socket/ssl_server_socket_unittest.cc
@@ -304,7 +304,7 @@ // Verify the correctness of the test helper classes first. TEST(FakeSocketTest, DataTransfer) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Establish channels between two sockets. FakeDataChannel channel_1; @@ -350,8 +350,7 @@ EXPECT_EQ(0, memcmp(kTestData, read_buf->data(), read)); } -class SSLServerSocketTest : public PlatformTest, - public WithScopedTaskEnvironment { +class SSLServerSocketTest : public PlatformTest, public WithTaskEnvironment { public: SSLServerSocketTest() : ssl_config_service_(new TestSSLConfigService(SSLContextConfig())),
diff --git a/net/socket/tcp_client_socket_unittest.cc b/net/socket/tcp_client_socket_unittest.cc index 0fc86063..17ee0c1 100644 --- a/net/socket/tcp_client_socket_unittest.cc +++ b/net/socket/tcp_client_socket_unittest.cc
@@ -68,8 +68,7 @@ class TCPClientSocketTest : public testing::Test { public: TCPClientSocketTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { std::unique_ptr<TestPowerMonitorSource> power_monitor_source = std::make_unique<TestPowerMonitorSource>(); power_monitor_source_ = power_monitor_source.get(); @@ -121,7 +120,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestPowerMonitorSource* power_monitor_source_; };
diff --git a/net/socket/tcp_server_socket_unittest.cc b/net/socket/tcp_server_socket_unittest.cc index 17cb955..8340d73 100644 --- a/net/socket/tcp_server_socket_unittest.cc +++ b/net/socket/tcp_server_socket_unittest.cc
@@ -33,8 +33,7 @@ namespace { const int kListenBacklog = 5; -class TCPServerSocketTest : public PlatformTest, - public WithScopedTaskEnvironment { +class TCPServerSocketTest : public PlatformTest, public WithTaskEnvironment { protected: TCPServerSocketTest() : socket_(nullptr, NetLogSource()) {}
diff --git a/net/socket/tcp_socket_unittest.cc b/net/socket/tcp_socket_unittest.cc index 0f07cf4..ccfde078 100644 --- a/net/socket/tcp_socket_unittest.cc +++ b/net/socket/tcp_socket_unittest.cc
@@ -99,7 +99,7 @@ const int kListenBacklog = 5; -class TCPSocketTest : public PlatformTest, public WithScopedTaskEnvironment { +class TCPSocketTest : public PlatformTest, public WithTaskEnvironment { protected: TCPSocketTest() : socket_(nullptr, nullptr, NetLogSource()) {}
diff --git a/net/socket/transport_client_socket_pool_unittest.cc b/net/socket/transport_client_socket_pool_unittest.cc index a28885fe..0a1638a 100644 --- a/net/socket/transport_client_socket_pool_unittest.cc +++ b/net/socket/transport_client_socket_pool_unittest.cc
@@ -92,13 +92,13 @@ }; class TransportClientSocketPoolTest : public ::testing::Test, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: // Constructor that allows mocking of the time. explicit TransportClientSocketPoolTest( - base::test::ScopedTaskEnvironment::TimeSource time_source = - base::test::ScopedTaskEnvironment::TimeSource::DEFAULT) - : WithScopedTaskEnvironment(time_source), + base::test::TaskEnvironment::TimeSource time_source = + base::test::TaskEnvironment::TimeSource::DEFAULT) + : WithTaskEnvironment(time_source), connect_backup_jobs_enabled_( TransportClientSocketPool::set_connect_backup_jobs_enabled(true)), group_id_(HostPortPair("www.google.com", 80), @@ -2151,7 +2151,7 @@ protected: TransportClientSocketPoolMockNowSourceTest() : TransportClientSocketPoolTest( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} private: DISALLOW_COPY_AND_ASSIGN(TransportClientSocketPoolMockNowSourceTest);
diff --git a/net/socket/transport_client_socket_unittest.cc b/net/socket/transport_client_socket_unittest.cc index 46e285ef..26fb2e95 100644 --- a/net/socket/transport_client_socket_unittest.cc +++ b/net/socket/transport_client_socket_unittest.cc
@@ -43,7 +43,7 @@ class TransportClientSocketTest : public ::testing::TestWithParam<ClientSocketTestTypes>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { public: TransportClientSocketTest() : listen_port_(0),
diff --git a/net/socket/transport_connect_job_unittest.cc b/net/socket/transport_connect_job_unittest.cc index e7300b0..9e27371 100644 --- a/net/socket/transport_connect_job_unittest.cc +++ b/net/socket/transport_connect_job_unittest.cc
@@ -30,12 +30,11 @@ const char kHostName[] = "unresolvable.host.name"; -class TransportConnectJobTest : public WithScopedTaskEnvironment, +class TransportConnectJobTest : public WithTaskEnvironment, public testing::Test { public: TransportConnectJobTest() - : WithScopedTaskEnvironment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : WithTaskEnvironment(base::test::TaskEnvironment::TimeSource::MOCK_TIME), client_socket_factory_(&net_log_), common_connect_job_params_( &client_socket_factory_,
diff --git a/net/socket/udp_socket_perftest.cc b/net/socket/udp_socket_perftest.cc index 4e42c52b..c46cca6 100644 --- a/net/socket/udp_socket_perftest.cc +++ b/net/socket/udp_socket_perftest.cc
@@ -91,8 +91,8 @@ } void UDPSocketPerfTest::WriteBenchmark(bool use_nonblocking_io) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); const uint16_t kPort = 9999; // Setup the server to listen.
diff --git a/net/socket/udp_socket_posix.cc b/net/socket/udp_socket_posix.cc index af48ba5e..abe242cd 100644 --- a/net/socket/udp_socket_posix.cc +++ b/net/socket/udp_socket_posix.cc
@@ -1323,7 +1323,7 @@ // TODO(ckrasic) Sad face. Do this lazily because many tests exploded // otherwise. |threading_and_tasks.md| advises to instantiate a -// |base::test::ScopedTaskEnvironment| in the test, implementing that +// |base::test::TaskEnvironment| in the test, implementing that // for all tests that might exercise QUIC is too daunting. Also, in // some tests it seemed like following the advice just broke in other // ways.
diff --git a/net/socket/udp_socket_posix_unittest.cc b/net/socket/udp_socket_posix_unittest.cc index 43817cc5..84d96f6 100644 --- a/net/socket/udp_socket_posix_unittest.cc +++ b/net/socket/udp_socket_posix_unittest.cc
@@ -126,11 +126,11 @@ } }; -class UDPSocketPosixTest : public TestWithScopedTaskEnvironment { +class UDPSocketPosixTest : public TestWithTaskEnvironment { public: UDPSocketPosixTest() - : TestWithScopedTaskEnvironment( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : TestWithTaskEnvironment( + base::test::TaskEnvironment::TimeSource::MOCK_TIME), socket_(DatagramSocket::DEFAULT_BIND, &client_log_, NetLogSource()), callback_fired_(false) { write_callback_ = base::BindRepeating(&UDPSocketPosixTest::OnWriteComplete,
diff --git a/net/socket/udp_socket_unittest.cc b/net/socket/udp_socket_unittest.cc index 47ff0d115..5bcffa4 100644 --- a/net/socket/udp_socket_unittest.cc +++ b/net/socket/udp_socket_unittest.cc
@@ -67,7 +67,7 @@ return true; } -class UDPSocketTest : public PlatformTest, public WithScopedTaskEnvironment { +class UDPSocketTest : public PlatformTest, public WithTaskEnvironment { public: UDPSocketTest() : buffer_(base::MakeRefCounted<IOBufferWithSize>(kMaxRead)) {} @@ -1051,7 +1051,7 @@ EXPECT_CALL(api, CloseHandle(kFakeHandle1)); } -class DscpManagerTest : public TestWithScopedTaskEnvironment { +class DscpManagerTest : public TestWithTaskEnvironment { protected: DscpManagerTest() { EXPECT_CALL(api_, qwave_supported()).WillRepeatedly(Return(true));
diff --git a/net/socket/unix_domain_client_socket_posix_unittest.cc b/net/socket/unix_domain_client_socket_posix_unittest.cc index 79b2fa8..5ca8ddcf 100644 --- a/net/socket/unix_domain_client_socket_posix_unittest.cc +++ b/net/socket/unix_domain_client_socket_posix_unittest.cc
@@ -123,7 +123,7 @@ return write_buf->BytesConsumed(); } -class UnixDomainClientSocketTest : public TestWithScopedTaskEnvironment { +class UnixDomainClientSocketTest : public TestWithTaskEnvironment { protected: UnixDomainClientSocketTest() { EXPECT_TRUE(temp_dir_.CreateUniqueTempDir());
diff --git a/net/socket/unix_domain_server_socket_posix_unittest.cc b/net/socket/unix_domain_server_socket_posix_unittest.cc index 11e3538b..228f0a50 100644 --- a/net/socket/unix_domain_server_socket_posix_unittest.cc +++ b/net/socket/unix_domain_server_socket_posix_unittest.cc
@@ -87,8 +87,8 @@ } TEST_F(UnixDomainServerSocketTest, AcceptWithForbiddenUser) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); const bool kUseAbstractNamespace = false;
diff --git a/net/socket/websocket_endpoint_lock_manager_unittest.cc b/net/socket/websocket_endpoint_lock_manager_unittest.cc index c55e63d..f43d673 100644 --- a/net/socket/websocket_endpoint_lock_manager_unittest.cc +++ b/net/socket/websocket_endpoint_lock_manager_unittest.cc
@@ -57,7 +57,7 @@ base::RunLoop run_loop_; }; -class WebSocketEndpointLockManagerTest : public TestWithScopedTaskEnvironment { +class WebSocketEndpointLockManagerTest : public TestWithTaskEnvironment { protected: WebSocketEndpointLockManagerTest() { websocket_endpoint_lock_manager_.SetUnlockDelayForTesting(
diff --git a/net/socket/websocket_transport_client_socket_pool_unittest.cc b/net/socket/websocket_transport_client_socket_pool_unittest.cc index c404a2d..0223c465 100644 --- a/net/socket/websocket_transport_client_socket_pool_unittest.cc +++ b/net/socket/websocket_transport_client_socket_pool_unittest.cc
@@ -60,8 +60,7 @@ run_loop.Run(); } -class WebSocketTransportClientSocketPoolTest - : public TestWithScopedTaskEnvironment { +class WebSocketTransportClientSocketPoolTest : public TestWithTaskEnvironment { protected: WebSocketTransportClientSocketPoolTest() : group_id_(HostPortPair("www.google.com", 80),
diff --git a/net/spdy/bidirectional_stream_spdy_impl_unittest.cc b/net/spdy/bidirectional_stream_spdy_impl_unittest.cc index 5373ba3..d73ece2 100644 --- a/net/spdy/bidirectional_stream_spdy_impl_unittest.cc +++ b/net/spdy/bidirectional_stream_spdy_impl_unittest.cc
@@ -240,7 +240,7 @@ } // namespace class BidirectionalStreamSpdyImplTest : public testing::TestWithParam<bool>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { public: BidirectionalStreamSpdyImplTest() : default_url_(kDefaultUrl),
diff --git a/net/spdy/fuzzing/hpack_example_generator.cc b/net/spdy/fuzzing/hpack_example_generator.cc index c38b288..a6be0ac 100644 --- a/net/spdy/fuzzing/hpack_example_generator.cc +++ b/net/spdy/fuzzing/hpack_example_generator.cc
@@ -11,7 +11,6 @@ #include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.h" #include "net/third_party/quiche/src/spdy/core/spdy_protocol.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" namespace { @@ -24,7 +23,6 @@ } // namespace using spdy::HpackFuzzUtil; -using spdy::SpdyString; using std::map; // Generates a configurable number of header sets (using HpackFuzzUtil), and @@ -44,8 +42,7 @@ << " --" << kExampleCount << "=1000"; return -1; } - spdy::SpdyString file_to_write = - command_line.GetSwitchValueASCII(kFileToWrite); + std::string file_to_write = command_line.GetSwitchValueASCII(kFileToWrite); int example_count = 0; base::StringToInt(command_line.GetSwitchValueASCII(kExampleCount), @@ -64,10 +61,10 @@ spdy::SpdyHeaderBlock headers = HpackFuzzUtil::NextGeneratedHeaderSet(&context); - spdy::SpdyString buffer; + std::string buffer; CHECK(encoder.EncodeHeaderSet(headers, &buffer)); - spdy::SpdyString prefix = HpackFuzzUtil::HeaderBlockPrefix(buffer.size()); + std::string prefix = HpackFuzzUtil::HeaderBlockPrefix(buffer.size()); CHECK_LT(0, file_out.WriteAtCurrentPos(prefix.data(), prefix.size())); CHECK_LT(0, file_out.WriteAtCurrentPos(buffer.data(), buffer.size()));
diff --git a/net/spdy/fuzzing/hpack_fuzz_util.cc b/net/spdy/fuzzing/hpack_fuzz_util.cc index 400ed0d..086a5b6 100644 --- a/net/spdy/fuzzing/hpack_fuzz_util.cc +++ b/net/spdy/fuzzing/hpack_fuzz_util.cc
@@ -80,7 +80,7 @@ for (size_t j = 0; j != header_count; ++j) { size_t name_index = SampleExponential(kHeaderIndexMean, kHeaderIndexMax); size_t value_index = SampleExponential(kHeaderIndexMean, kHeaderIndexMax); - SpdyString name, value; + std::string name, value; if (name_index >= context->names.size()) { context->names.push_back(RandBytesAsString( 1 + SampleExponential(kNameLengthMean, kNameLengthMax))); @@ -128,9 +128,9 @@ } // static -SpdyString HpackFuzzUtil::HeaderBlockPrefix(size_t block_size) { +std::string HpackFuzzUtil::HeaderBlockPrefix(size_t block_size) { uint32_t length = base::HostToNet32(static_cast<uint32_t>(block_size)); - return SpdyString(reinterpret_cast<char*>(&length), sizeof(uint32_t)); + return std::string(reinterpret_cast<char*>(&length), sizeof(uint32_t)); } // static @@ -154,7 +154,7 @@ return false; } // Second stage: Re-encode the decoded header block. This must succeed. - SpdyString second_stage_out; + std::string second_stage_out; CHECK(context->second_stage->EncodeHeaderSet( context->first_stage->decoded_block(), &second_stage_out));
diff --git a/net/spdy/fuzzing/hpack_fuzz_util.h b/net/spdy/fuzzing/hpack_fuzz_util.h index 5d95ca2..f581e46 100644 --- a/net/spdy/fuzzing/hpack_fuzz_util.h +++ b/net/spdy/fuzzing/hpack_fuzz_util.h
@@ -14,7 +14,6 @@ #include "net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_export.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" namespace spdy { @@ -26,8 +25,8 @@ struct GeneratorContext { GeneratorContext(); ~GeneratorContext(); - std::vector<SpdyString> names; - std::vector<SpdyString> values; + std::vector<std::string> names; + std::vector<std::string> values; }; // Initializes a GeneratorContext with a random seed and name/value fixtures. @@ -40,7 +39,7 @@ // upper-bounded by |sanity_bound|. static size_t SampleExponential(size_t mean, size_t sanity_bound); - // Holds an input SpdyString, and manages an offset into that SpdyString. + // Holds an input string, and manages an offset into that string. struct Input { Input(); // Initializes |offset| to zero. ~Input(); @@ -48,7 +47,7 @@ size_t remaining() { return input.size() - offset; } const char* ptr() { return input.data() + offset; } - SpdyString input; + std::string input; size_t offset; }; @@ -58,7 +57,7 @@ // Returns the serialized header block length prefix for a block of // |block_size| bytes. - static SpdyString HeaderBlockPrefix(size_t block_size); + static std::string HeaderBlockPrefix(size_t block_size); // A FuzzerContext holds fuzzer input, as well as each of the decoder and // encoder stages which fuzzed header blocks are processed through.
diff --git a/net/spdy/fuzzing/hpack_fuzz_util_test.cc b/net/spdy/fuzzing/hpack_fuzz_util_test.cc index 8294fd4..5036b1e 100644 --- a/net/spdy/fuzzing/hpack_fuzz_util_test.cc +++ b/net/spdy/fuzzing/hpack_fuzz_util_test.cc
@@ -91,16 +91,16 @@ } TEST(HpackFuzzUtilTest, SerializedHeaderBlockPrefixes) { - EXPECT_EQ(SpdyString("\x00\x00\x00\x00", 4), + EXPECT_EQ(std::string("\x00\x00\x00\x00", 4), HpackFuzzUtil::HeaderBlockPrefix(0)); - EXPECT_EQ(SpdyString("\x00\x00\x00\x05", 4), + EXPECT_EQ(std::string("\x00\x00\x00\x05", 4), HpackFuzzUtil::HeaderBlockPrefix(5)); EXPECT_EQ("\x4f\xb3\x0a\x91", HpackFuzzUtil::HeaderBlockPrefix(1337133713)); } TEST(HpackFuzzUtilTest, PassValidInputThroughAllStages) { // Example lifted from HpackDecoderTest.SectionD4RequestHuffmanExamples. - SpdyString input = SpdyHexDecode("828684418cf1e3c2e5f23a6ba0ab90f4ff"); + std::string input = SpdyHexDecode("828684418cf1e3c2e5f23a6ba0ab90f4ff"); HpackFuzzUtil::FuzzerContext context; HpackFuzzUtil::InitializeFuzzerContext(&context); @@ -142,7 +142,7 @@ TEST(HpackFuzzUtilTest, FlipBitsMutatesBuffer) { char buffer[] = "testbuffer1234567890"; - SpdyString unmodified(buffer, base::size(buffer) - 1); + std::string unmodified(buffer, base::size(buffer) - 1); EXPECT_EQ(unmodified, buffer); HpackFuzzUtil::FlipBits(reinterpret_cast<uint8_t*>(buffer),
diff --git a/net/spdy/platform/impl/spdy_string_impl.h b/net/spdy/platform/impl/spdy_string_impl.h deleted file mode 100644 index 8bf8a7c..0000000 --- a/net/spdy/platform/impl/spdy_string_impl.h +++ /dev/null
@@ -1,16 +0,0 @@ -// Copyright (c) 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 NET_SPDY_PLATFORM_IMPL_SPDY_STRING_IMPL_H_ -#define NET_SPDY_PLATFORM_IMPL_SPDY_STRING_IMPL_H_ - -#include <string> - -namespace spdy { - -using SpdyStringImpl = std::string; - -} // namespace spdy - -#endif // NET_SPDY_PLATFORM_IMPL_SPDY_STRING_IMPL_H_
diff --git a/net/spdy/platform/impl/spdy_string_utils_impl.h b/net/spdy/platform/impl/spdy_string_utils_impl.h index 3925cf8..f9cbf6f6 100644 --- a/net/spdy/platform/impl/spdy_string_utils_impl.h +++ b/net/spdy/platform/impl/spdy_string_utils_impl.h
@@ -13,13 +13,12 @@ #include "base/strings/stringprintf.h" #include "net/base/hex_utils.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_export.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" namespace spdy { template <typename... Args> -inline SpdyString SpdyStrCatImpl(const Args&... args) { +inline std::string SpdyStrCatImpl(const Args&... args) { std::ostringstream oss; int dummy[] = {1, (oss << args, 0)...}; static_cast<void>(dummy); @@ -27,7 +26,7 @@ } template <typename... Args> -inline void SpdyStrAppendImpl(SpdyString* output, Args... args) { +inline void SpdyStrAppendImpl(std::string* output, Args... args) { output->append(SpdyStrCatImpl(args...)); } @@ -35,22 +34,22 @@ return base::HexDigitToInt(c); } -inline SpdyString SpdyHexDecodeImpl(SpdyStringPiece data) { +inline std::string SpdyHexDecodeImpl(SpdyStringPiece data) { return net::HexDecode(data); } NET_EXPORT_PRIVATE bool SpdyHexDecodeToUInt32Impl(SpdyStringPiece data, uint32_t* out); -inline SpdyString SpdyHexEncodeImpl(const char* bytes, size_t size) { +inline std::string SpdyHexEncodeImpl(const char* bytes, size_t size) { return base::ToLowerASCII(base::HexEncode(bytes, size)); } -inline SpdyString SpdyHexEncodeUInt32AndTrimImpl(uint32_t data) { +inline std::string SpdyHexEncodeUInt32AndTrimImpl(uint32_t data) { return base::StringPrintf("%x", data); } -inline SpdyString SpdyHexDumpImpl(SpdyStringPiece data) { +inline std::string SpdyHexDumpImpl(SpdyStringPiece data) { return net::HexDump(data); }
diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc index fd84847..686926e 100644 --- a/net/spdy/spdy_http_stream_unittest.cc +++ b/net/spdy/spdy_http_stream_unittest.cc
@@ -123,7 +123,7 @@ } // namespace -class SpdyHttpStreamTest : public TestWithScopedTaskEnvironment { +class SpdyHttpStreamTest : public TestWithTaskEnvironment { public: SpdyHttpStreamTest() : url_(kDefaultUrl),
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index 5177cb98..440fcbad 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -81,7 +81,7 @@ const char kPushedUrl[] = "https://www.example.org/foo.dat"; -class SpdyNetworkTransactionTest : public TestWithScopedTaskEnvironment { +class SpdyNetworkTransactionTest : public TestWithTaskEnvironment { protected: SpdyNetworkTransactionTest() : default_url_(kDefaultUrl),
diff --git a/net/spdy/spdy_proxy_client_socket_unittest.cc b/net/spdy/spdy_proxy_client_socket_unittest.cc index e6328d0..3744fba 100644 --- a/net/spdy/spdy_proxy_client_socket_unittest.cc +++ b/net/spdy/spdy_proxy_client_socket_unittest.cc
@@ -120,7 +120,7 @@ } // namespace class SpdyProxyClientSocketTest : public PlatformTest, - public WithScopedTaskEnvironment, + public WithTaskEnvironment, public ::testing::WithParamInterface<bool> { public: SpdyProxyClientSocketTest();
diff --git a/net/spdy/spdy_session_pool_unittest.cc b/net/spdy/spdy_session_pool_unittest.cc index 7ab061bc2..138941e 100644 --- a/net/spdy/spdy_session_pool_unittest.cc +++ b/net/spdy/spdy_session_pool_unittest.cc
@@ -45,7 +45,7 @@ namespace net { -class SpdySessionPoolTest : public TestWithScopedTaskEnvironment { +class SpdySessionPoolTest : public TestWithTaskEnvironment { protected: // Used by RunIPPoolingTest(). enum SpdyPoolCloseSessionsType {
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc index def20b7..f446d2be 100644 --- a/net/spdy/spdy_session_unittest.cc +++ b/net/spdy/spdy_session_unittest.cc
@@ -114,7 +114,7 @@ } // namespace -class SpdySessionTest : public PlatformTest, public WithScopedTaskEnvironment { +class SpdySessionTest : public PlatformTest, public WithTaskEnvironment { public: // Functions used with RunResumeAfterUnstallTest(). @@ -151,10 +151,9 @@ } protected: - explicit SpdySessionTest( - base::test::ScopedTaskEnvironment::TimeSource time_source = - base::test::ScopedTaskEnvironment::TimeSource::DEFAULT) - : WithScopedTaskEnvironment(time_source), + explicit SpdySessionTest(base::test::TaskEnvironment::TimeSource time_source = + base::test::TaskEnvironment::TimeSource::DEFAULT) + : WithTaskEnvironment(time_source), old_max_group_sockets_(ClientSocketPoolManager::max_sockets_per_group( HttpNetworkSession::NORMAL_SOCKET_POOL)), old_max_pool_sockets_(ClientSocketPoolManager::max_sockets_per_pool( @@ -383,8 +382,7 @@ class SpdySessionTestWithMockTime : public SpdySessionTest { protected: SpdySessionTestWithMockTime() - : SpdySessionTest( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : SpdySessionTest(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} }; // Try to create a SPDY session that will fail during
diff --git a/net/spdy/spdy_stream_unittest.cc b/net/spdy/spdy_stream_unittest.cc index 78ba72a..3bb1008 100644 --- a/net/spdy/spdy_stream_unittest.cc +++ b/net/spdy/spdy_stream_unittest.cc
@@ -62,7 +62,7 @@ } // namespace -class SpdyStreamTest : public TestWithScopedTaskEnvironment { +class SpdyStreamTest : public TestWithTaskEnvironment { protected: // A function that takes a SpdyStream and the number of bytes which // will unstall the next frame completely.
diff --git a/net/ssl/client_cert_store_nss_unittest.cc b/net/ssl/client_cert_store_nss_unittest.cc index cf3a294..8a28268 100644 --- a/net/ssl/client_cert_store_nss_unittest.cc +++ b/net/ssl/client_cert_store_nss_unittest.cc
@@ -76,7 +76,7 @@ // Tests that ClientCertStoreNSS attempts to build a certificate chain by // querying NSS before return a certificate. TEST(ClientCertStoreNSSTest, BuildsCertificateChain) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Set up a test DB and import client_1.pem and client_1_ca.pem. crypto::ScopedTestNSSDB test_db; @@ -169,7 +169,7 @@ } TEST(ClientCertStoreNSSTest, SubjectPrintableStringContainingUTF8) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; crypto::ScopedTestNSSDB test_db; base::FilePath certs_dir =
diff --git a/net/ssl/client_cert_store_unittest-inl.h b/net/ssl/client_cert_store_unittest-inl.h index 71318b5..490f216 100644 --- a/net/ssl/client_cert_store_unittest-inl.h +++ b/net/ssl/client_cert_store_unittest-inl.h
@@ -58,7 +58,7 @@ // const SSLCertRequestInfo& cert_request_info, // ClientCertIdentityList* selected_identities); template <typename T> -class ClientCertStoreTest : public TestWithScopedTaskEnvironment { +class ClientCertStoreTest : public TestWithTaskEnvironment { public: T delegate_; };
diff --git a/net/ssl/ssl_client_session_cache_unittest.cc b/net/ssl/ssl_client_session_cache_unittest.cc index 32e7f30..c53647a0 100644 --- a/net/ssl/ssl_client_session_cache_unittest.cc +++ b/net/ssl/ssl_client_session_cache_unittest.cc
@@ -365,7 +365,7 @@ // Test that SSL cache is flushed on low memory notifications TEST_F(SSLClientSessionCacheTest, TestFlushOnMemoryNotifications) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // kExpirationCheckCount is set to a suitably large number so the automated // pruning never triggers.
diff --git a/net/ssl/ssl_platform_key_android_unittest.cc b/net/ssl/ssl_platform_key_android_unittest.cc index a09ebc23..0c636a18 100644 --- a/net/ssl/ssl_platform_key_android_unittest.cc +++ b/net/ssl/ssl_platform_key_android_unittest.cc
@@ -75,7 +75,7 @@ } // namespace class SSLPlatformKeyAndroidTest : public testing::TestWithParam<TestKey>, - public WithScopedTaskEnvironment {}; + public WithTaskEnvironment {}; TEST_P(SSLPlatformKeyAndroidTest, Matches) { const TestKey& test_key = GetParam();
diff --git a/net/ssl/ssl_platform_key_mac_unittest.cc b/net/ssl/ssl_platform_key_mac_unittest.cc index dadc146..d588b81 100644 --- a/net/ssl/ssl_platform_key_mac_unittest.cc +++ b/net/ssl/ssl_platform_key_mac_unittest.cc
@@ -48,7 +48,7 @@ class SSLPlatformKeyMacTest : public testing::TestWithParam<TestKey> {}; TEST_P(SSLPlatformKeyMacTest, KeyMatches) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; const TestKey& test_key = GetParam();
diff --git a/net/ssl/ssl_platform_key_nss_unittest.cc b/net/ssl/ssl_platform_key_nss_unittest.cc index d215c228b5..b2d5897 100644 --- a/net/ssl/ssl_platform_key_nss_unittest.cc +++ b/net/ssl/ssl_platform_key_nss_unittest.cc
@@ -59,7 +59,7 @@ } // namespace class SSLPlatformKeyNSSTest : public testing::TestWithParam<TestKey>, - public WithScopedTaskEnvironment {}; + public WithTaskEnvironment {}; TEST_P(SSLPlatformKeyNSSTest, KeyMatches) { const TestKey& test_key = GetParam();
diff --git a/net/ssl/ssl_platform_key_win_unittest.cc b/net/ssl/ssl_platform_key_win_unittest.cc index 0abf933..357923d 100644 --- a/net/ssl/ssl_platform_key_win_unittest.cc +++ b/net/ssl/ssl_platform_key_win_unittest.cc
@@ -223,7 +223,7 @@ } // namespace class SSLPlatformKeyCNGTest : public testing::TestWithParam<TestKey>, - public WithScopedTaskEnvironment {}; + public WithTaskEnvironment {}; TEST_P(SSLPlatformKeyCNGTest, KeyMatches) { const TestKey& test_key = GetParam(); @@ -274,7 +274,7 @@ TestKeyToString); TEST(SSLPlatformKeyCAPITest, KeyMatches) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Load test data. scoped_refptr<X509Certificate> cert =
diff --git a/net/test/embedded_test_server/embedded_test_server_unittest.cc b/net/test/embedded_test_server/embedded_test_server_unittest.cc index f4eafbb..db18db24 100644 --- a/net/test/embedded_test_server/embedded_test_server_unittest.cc +++ b/net/test/embedded_test_server/embedded_test_server_unittest.cc
@@ -122,7 +122,7 @@ class EmbeddedTestServerTest : public testing::TestWithParam<EmbeddedTestServer::Type>, public URLFetcherDelegate, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { public: EmbeddedTestServerTest() : num_responses_received_(0), @@ -509,7 +509,7 @@ class EmbeddedTestServerThreadingTest : public testing::TestWithParam<ThreadingTestParams>, - public WithScopedTaskEnvironment {}; + public WithTaskEnvironment {}; class EmbeddedTestServerThreadingTestDelegate : public base::PlatformThread::Delegate,
diff --git a/net/test/net_test_suite.h b/net/test/net_test_suite.h index 591db73e..9cf523c 100644 --- a/net/test/net_test_suite.h +++ b/net/test/net_test_suite.h
@@ -14,7 +14,7 @@ namespace base { namespace test { -class ScopedTaskEnvironment; +class TaskEnvironment; } }
diff --git a/net/test/tcp_socket_proxy_unittest.cc b/net/test/tcp_socket_proxy_unittest.cc index 54bde532..18105ab 100644 --- a/net/test/tcp_socket_proxy_unittest.cc +++ b/net/test/tcp_socket_proxy_unittest.cc
@@ -21,7 +21,7 @@ namespace net { -class TcpSocketProxyTest : public TestWithScopedTaskEnvironment { +class TcpSocketProxyTest : public TestWithTaskEnvironment { public: TcpSocketProxyTest() : io_thread_("TcpSocketProxyTest IO Thread") { EXPECT_TRUE(io_thread_.StartWithOptions(
diff --git a/net/tools/quic/quic_http_proxy_backend_stream_test.cc b/net/tools/quic/quic_http_proxy_backend_stream_test.cc index e015b959..42643f1 100644 --- a/net/tools/quic/quic_http_proxy_backend_stream_test.cc +++ b/net/tools/quic/quic_http_proxy_backend_stream_test.cc
@@ -188,7 +188,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::string backend_url_; std::unique_ptr<QuicHttpProxyBackend> proxy_backend_; std::unique_ptr<QuicHttpProxyBackend> proxy_backend_fail_;
diff --git a/net/tools/quic/quic_http_proxy_backend_test.cc b/net/tools/quic/quic_http_proxy_backend_test.cc index 8d07cf3..aaf94de 100644 --- a/net/tools/quic/quic_http_proxy_backend_test.cc +++ b/net/tools/quic/quic_http_proxy_backend_test.cc
@@ -42,7 +42,7 @@ private: bool did_complete_; - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; const scoped_refptr<base::SingleThreadTaskRunner> task_runner_ = base::ThreadTaskRunnerHandle::Get(); base::RunLoop run_loop_;
diff --git a/net/tools/quic/quic_simple_client_test.cc b/net/tools/quic/quic_simple_client_test.cc index dcd7544..52d359a 100644 --- a/net/tools/quic/quic_simple_client_test.cc +++ b/net/tools/quic/quic_simple_client_test.cc
@@ -14,7 +14,7 @@ namespace test { TEST(QuicSimpleClientTest, Initialize) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; quic::QuicSocketAddress server_address(quic::QuicIpAddress::Loopback4(), 80); quic::QuicServerId server_id("hostname", server_address.port(), false); quic::ParsedQuicVersionVector versions = quic::AllSupportedVersions();
diff --git a/net/url_request/http_with_dns_over_https_unittest.cc b/net/url_request/http_with_dns_over_https_unittest.cc index c91c9ac..0965d3a8 100644 --- a/net/url_request/http_with_dns_over_https_unittest.cc +++ b/net/url_request/http_with_dns_over_https_unittest.cc
@@ -52,7 +52,7 @@ ~TestHostResolverProc() override {} }; -class HttpWithDnsOverHttpsTest : public TestWithScopedTaskEnvironment { +class HttpWithDnsOverHttpsTest : public TestWithTaskEnvironment { public: HttpWithDnsOverHttpsTest() : resolver_(HostResolver::CreateStandaloneContextResolver(nullptr)),
diff --git a/net/url_request/report_sender_unittest.cc b/net/url_request/report_sender_unittest.cc index 420ef60..ea190a1 100644 --- a/net/url_request/report_sender_unittest.cc +++ b/net/url_request/report_sender_unittest.cc
@@ -184,7 +184,7 @@ DISALLOW_COPY_AND_ASSIGN(TestReportSenderNetworkDelegate); }; -class ReportSenderTest : public TestWithScopedTaskEnvironment { +class ReportSenderTest : public TestWithTaskEnvironment { public: ReportSenderTest() : context_(true) { context_.set_network_delegate(&network_delegate_);
diff --git a/net/url_request/url_fetcher_impl_unittest.cc b/net/url_request/url_fetcher_impl_unittest.cc index cc009cfe..2ac3528 100644 --- a/net/url_request/url_fetcher_impl_unittest.cc +++ b/net/url_request/url_fetcher_impl_unittest.cc
@@ -339,7 +339,7 @@ } // namespace -class URLFetcherTest : public TestWithScopedTaskEnvironment { +class URLFetcherTest : public TestWithTaskEnvironment { public: URLFetcherTest() : num_upload_streams_created_(0) {}
diff --git a/net/url_request/url_fetcher_response_writer_unittest.cc b/net/url_request/url_fetcher_response_writer_unittest.cc index 45bfd22..abc49e6a 100644 --- a/net/url_request/url_fetcher_response_writer_unittest.cc +++ b/net/url_request/url_fetcher_response_writer_unittest.cc
@@ -58,7 +58,7 @@ } class URLFetcherFileWriterTest : public PlatformTest, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); @@ -208,7 +208,7 @@ } class URLFetcherFileWriterTemporaryFileTest : public PlatformTest, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: void SetUp() override { writer_.reset(new URLFetcherFileWriter(base::ThreadTaskRunnerHandle::Get(),
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index 736dddb..5fec727 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc
@@ -1155,8 +1155,8 @@ // with the network service - remove it. bool enable_privacy_mode = !g_default_can_use_cookies; if (network_delegate_) { - enable_privacy_mode = - network_delegate_->ForcePrivacyMode(url(), site_for_cookies_); + enable_privacy_mode = network_delegate_->ForcePrivacyMode( + url(), site_for_cookies_, network_isolation_key_.GetTopFrameOrigin()); } return enable_privacy_mode ? PRIVACY_MODE_ENABLED : PRIVACY_MODE_DISABLED; }
diff --git a/net/url_request/url_request_context_builder_unittest.cc b/net/url_request/url_request_context_builder_unittest.cc index 98b4b77..a1f88cd4 100644 --- a/net/url_request/url_request_context_builder_unittest.cc +++ b/net/url_request/url_request_context_builder_unittest.cc
@@ -67,7 +67,7 @@ }; class URLRequestContextBuilderTest : public PlatformTest, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: URLRequestContextBuilderTest() { test_server_.AddDefaultHandlers(
diff --git a/net/url_request/url_request_context_unittest.cc b/net/url_request/url_request_context_unittest.cc index 29c5af28..8afa495 100644 --- a/net/url_request/url_request_context_unittest.cc +++ b/net/url_request/url_request_context_unittest.cc
@@ -17,7 +17,7 @@ class URLRequestContextMemoryDumpTest : public testing::TestWithParam<base::trace_event::MemoryDumpLevelOfDetail>, - public WithScopedTaskEnvironment {}; + public WithTaskEnvironment {}; INSTANTIATE_TEST_SUITE_P( /* no prefix */,
diff --git a/net/url_request/url_request_file_dir_job_unittest.cc b/net/url_request/url_request_file_dir_job_unittest.cc index 148dafc..cceb649 100644 --- a/net/url_request/url_request_file_dir_job_unittest.cc +++ b/net/url_request/url_request_file_dir_job_unittest.cc
@@ -140,7 +140,7 @@ DISALLOW_COPY_AND_ASSIGN(TestDirectoryURLRequestDelegate); }; -class URLRequestFileDirTest : public TestWithScopedTaskEnvironment { +class URLRequestFileDirTest : public TestWithTaskEnvironment { public: URLRequestFileDirTest() : buffer_(base::MakeRefCounted<IOBuffer>(kBufferSize)) {}
diff --git a/net/url_request/url_request_file_job_unittest.cc b/net/url_request/url_request_file_job_unittest.cc index 21fa911c..19cd380 100644 --- a/net/url_request/url_request_file_job_unittest.cc +++ b/net/url_request/url_request_file_job_unittest.cc
@@ -180,7 +180,7 @@ // A superclass for tests of the OnReadComplete / OnSeekComplete / // OnReadComplete functions of URLRequestFileJob. -class URLRequestFileJobEventsTest : public TestWithScopedTaskEnvironment { +class URLRequestFileJobEventsTest : public TestWithTaskEnvironment { public: URLRequestFileJobEventsTest();
diff --git a/net/url_request/url_request_filter_unittest.cc b/net/url_request/url_request_filter_unittest.cc index 6a88e83..813f77e 100644 --- a/net/url_request/url_request_filter_unittest.cc +++ b/net/url_request/url_request_filter_unittest.cc
@@ -47,8 +47,8 @@ }; TEST(URLRequestFilter, BasicMatching) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestDelegate delegate; TestURLRequestContext request_context; URLRequestFilter* filter = URLRequestFilter::GetInstance();
diff --git a/net/url_request/url_request_ftp_job_unittest.cc b/net/url_request/url_request_ftp_job_unittest.cc index f342822..84403fd 100644 --- a/net/url_request/url_request_ftp_job_unittest.cc +++ b/net/url_request/url_request_ftp_job_unittest.cc
@@ -153,7 +153,7 @@ DISALLOW_COPY_AND_ASSIGN(MockURLRequestFtpJobFactory); }; -using UrlRequestFtpJobTest = TestWithScopedTaskEnvironment; +using UrlRequestFtpJobTest = TestWithTaskEnvironment; TEST_F(UrlRequestFtpJobTest, HistogramLogSuccessNoAuth) { base::HistogramTester histograms; @@ -262,4 +262,4 @@ 1); } } // namespace -} // namespace net \ No newline at end of file +} // namespace net
diff --git a/net/url_request/url_request_http_job_unittest.cc b/net/url_request/url_request_http_job_unittest.cc index d4c0aaa..1ea79d2 100644 --- a/net/url_request/url_request_http_job_unittest.cc +++ b/net/url_request/url_request_http_job_unittest.cc
@@ -119,7 +119,7 @@ DISALLOW_COPY_AND_ASSIGN(TestURLRequestHttpJob); }; -class URLRequestHttpJobSetUpSourceTest : public TestWithScopedTaskEnvironment { +class URLRequestHttpJobSetUpSourceTest : public TestWithTaskEnvironment { public: URLRequestHttpJobSetUpSourceTest() : context_(true) { test_job_interceptor_ = new TestJobInterceptor(); @@ -186,7 +186,7 @@ EXPECT_EQ("Test Content", delegate_.data_received()); } -class URLRequestHttpJobWithProxy : public WithScopedTaskEnvironment { +class URLRequestHttpJobWithProxy : public WithTaskEnvironment { public: explicit URLRequestHttpJobWithProxy( std::unique_ptr<ProxyResolutionService> proxy_resolution_service) @@ -343,7 +343,7 @@ http_job_with_proxy.network_delegate_.total_network_bytes_received()); } -class URLRequestHttpJobTest : public TestWithScopedTaskEnvironment { +class URLRequestHttpJobTest : public TestWithTaskEnvironment { protected: URLRequestHttpJobTest() : context_(true) { context_.set_http_transaction_factory(&network_layer_); @@ -373,8 +373,7 @@ std::unique_ptr<URLRequest> req_; }; -class URLRequestHttpJobWithMockSocketsTest - : public TestWithScopedTaskEnvironment { +class URLRequestHttpJobWithMockSocketsTest : public TestWithTaskEnvironment { protected: URLRequestHttpJobWithMockSocketsTest() : context_(new TestURLRequestContext(true)) { @@ -1397,8 +1396,7 @@ } } -class URLRequestHttpJobWithBrotliSupportTest - : public TestWithScopedTaskEnvironment { +class URLRequestHttpJobWithBrotliSupportTest : public TestWithTaskEnvironment { protected: URLRequestHttpJobWithBrotliSupportTest() : context_(new TestURLRequestContext(true)) { @@ -1525,7 +1523,7 @@ #if BUILDFLAG(ENABLE_WEBSOCKETS) -class URLRequestHttpJobWebSocketTest : public TestWithScopedTaskEnvironment { +class URLRequestHttpJobWebSocketTest : public TestWithTaskEnvironment { protected: URLRequestHttpJobWebSocketTest() : context_(true) { context_.set_network_delegate(&network_delegate_);
diff --git a/net/url_request/url_request_job_factory_impl_unittest.cc b/net/url_request/url_request_job_factory_impl_unittest.cc index 55664cf79..4a330d5 100644 --- a/net/url_request/url_request_job_factory_impl_unittest.cc +++ b/net/url_request/url_request_job_factory_impl_unittest.cc
@@ -61,7 +61,7 @@ }; TEST(URLRequestJobFactoryTest, NoProtocolHandler) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; TestDelegate delegate; TestURLRequestContext request_context; std::unique_ptr<URLRequest> request( @@ -74,8 +74,8 @@ } TEST(URLRequestJobFactoryTest, BasicProtocolHandler) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TestDelegate delegate; URLRequestJobFactoryImpl job_factory; TestURLRequestContext request_context; @@ -92,7 +92,7 @@ } TEST(URLRequestJobFactoryTest, DeleteProtocolHandler) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; URLRequestJobFactoryImpl job_factory; TestURLRequestContext request_context; request_context.set_job_factory(&job_factory);
diff --git a/net/url_request/url_request_job_unittest.cc b/net/url_request/url_request_job_unittest.cc index bfd3bbe..72a7e68 100644 --- a/net/url_request/url_request_job_unittest.cc +++ b/net/url_request/url_request_job_unittest.cc
@@ -267,7 +267,7 @@ } // namespace -using URLRequestJobTest = TestWithScopedTaskEnvironment; +using URLRequestJobTest = TestWithTaskEnvironment; TEST_F(URLRequestJobTest, TransactionNoFilter) { MockNetworkLayer network_layer;
diff --git a/net/url_request/url_request_quic_unittest.cc b/net/url_request/url_request_quic_unittest.cc index afb88f2..8e71a087 100644 --- a/net/url_request/url_request_quic_unittest.cc +++ b/net/url_request/url_request_quic_unittest.cc
@@ -45,7 +45,7 @@ const char kHelloBodyValue[] = "Hello from QUIC Server"; const int kHelloStatus = 200; -class URLRequestQuicTest : public TestWithScopedTaskEnvironment { +class URLRequestQuicTest : public TestWithTaskEnvironment { protected: URLRequestQuicTest() : context_(new TestURLRequestContext(true)) { StartQuicServer();
diff --git a/net/url_request/url_request_simple_job_unittest.cc b/net/url_request/url_request_simple_job_unittest.cc index 7a0bc59..3fb6599e 100644 --- a/net/url_request/url_request_simple_job_unittest.cc +++ b/net/url_request/url_request_simple_job_unittest.cc
@@ -108,7 +108,7 @@ DISALLOW_COPY_AND_ASSIGN(SimpleJobProtocolHandler); }; -class URLRequestSimpleJobTest : public TestWithScopedTaskEnvironment { +class URLRequestSimpleJobTest : public TestWithTaskEnvironment { public: URLRequestSimpleJobTest() : context_(true) { job_factory_.SetProtocolHandler(
diff --git a/net/url_request/url_request_throttler_simulation_unittest.cc b/net/url_request/url_request_throttler_simulation_unittest.cc index e26e150..cf84cc1 100644 --- a/net/url_request/url_request_throttler_simulation_unittest.cc +++ b/net/url_request/url_request_throttler_simulation_unittest.cc
@@ -528,7 +528,7 @@ } TEST(URLRequestThrottlerSimulation, HelpsInAttack) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; Server unprotected_server(30, 1.0); RequesterResults unprotected_attacker_results; @@ -615,7 +615,7 @@ } TEST(URLRequestThrottlerSimulation, PerceivedDowntimeRatio) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; struct Stats { // Expected interval that we expect the ratio of downtime when anti-DDoS
diff --git a/net/url_request/url_request_throttler_unittest.cc b/net/url_request/url_request_throttler_unittest.cc index 5090c87..224d29b0 100644 --- a/net/url_request/url_request_throttler_unittest.cc +++ b/net/url_request/url_request_throttler_unittest.cc
@@ -159,7 +159,7 @@ } // namespace -class URLRequestThrottlerEntryTest : public TestWithScopedTaskEnvironment { +class URLRequestThrottlerEntryTest : public TestWithTaskEnvironment { protected: URLRequestThrottlerEntryTest() : request_(context_.CreateRequest(GURL(), @@ -310,7 +310,7 @@ EXPECT_EQ(time_4, entry_->sliding_window_release_time()); } -class URLRequestThrottlerManagerTest : public TestWithScopedTaskEnvironment { +class URLRequestThrottlerManagerTest : public TestWithTaskEnvironment { protected: URLRequestThrottlerManagerTest() : request_(context_.CreateRequest(GURL(),
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index d56e39c5..d7001650 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc
@@ -805,7 +805,7 @@ } // namespace // Inherit PlatformTest since we require the autorelease pool on Mac OS X. -class URLRequestTest : public PlatformTest, public WithScopedTaskEnvironment { +class URLRequestTest : public PlatformTest, public WithTaskEnvironment { public: URLRequestTest() : default_context_(std::make_unique<TestURLRequestContext>(true)) { @@ -10269,7 +10269,7 @@ VerifyReferrerAfterRedirect(URLRequest::NO_REFERRER, GURL(), GURL()); } -class HTTPSRequestTest : public TestWithScopedTaskEnvironment { +class HTTPSRequestTest : public TestWithTaskEnvironment { public: HTTPSRequestTest() : default_context_(true) { default_context_.set_network_delegate(&default_network_delegate_); @@ -11214,7 +11214,7 @@ } } -class HTTPSFallbackTest : public TestWithScopedTaskEnvironment { +class HTTPSFallbackTest : public TestWithTaskEnvironment { public: HTTPSFallbackTest() : context_(true) { ssl_config_service_ = @@ -11298,7 +11298,7 @@ ExpectFailure(ERR_SSL_VERSION_OR_CIPHER_MISMATCH); } -class HTTPSSessionTest : public TestWithScopedTaskEnvironment { +class HTTPSSessionTest : public TestWithTaskEnvironment { public: HTTPSSessionTest() : default_context_(true) { cert_verifier_.set_default_result(OK); @@ -13324,7 +13324,7 @@ return std::make_unique<ZeroRTTResponse>(zero_rtt, false); } -class HTTPSEarlyDataTest : public TestWithScopedTaskEnvironment { +class HTTPSEarlyDataTest : public TestWithTaskEnvironment { public: HTTPSEarlyDataTest() : context_(true), test_server_(net::EmbeddedTestServer::TYPE_HTTPS) {
diff --git a/net/websockets/websocket_basic_stream_adapters_test.cc b/net/websockets/websocket_basic_stream_adapters_test.cc index 18a3cedd..26ec20b 100644 --- a/net/websockets/websocket_basic_stream_adapters_test.cc +++ b/net/websockets/websocket_basic_stream_adapters_test.cc
@@ -50,8 +50,7 @@ namespace test { -class WebSocketClientSocketHandleAdapterTest - : public TestWithScopedTaskEnvironment { +class WebSocketClientSocketHandleAdapterTest : public TestWithTaskEnvironment { protected: WebSocketClientSocketHandleAdapterTest() : host_port_pair_("www.example.org", 443), @@ -278,7 +277,7 @@ MOCK_METHOD1(OnClose, void(int)); }; -class WebSocketSpdyStreamAdapterTest : public TestWithScopedTaskEnvironment { +class WebSocketSpdyStreamAdapterTest : public TestWithTaskEnvironment { protected: WebSocketSpdyStreamAdapterTest() : url_("wss://www.example.org/"),
diff --git a/net/websockets/websocket_basic_stream_test.cc b/net/websockets/websocket_basic_stream_test.cc index 1a23048..40beb38 100644 --- a/net/websockets/websocket_basic_stream_test.cc +++ b/net/websockets/websocket_basic_stream_test.cc
@@ -104,7 +104,7 @@ }; // A fixture for tests which only perform normal socket operations. -class WebSocketBasicStreamSocketTest : public TestWithScopedTaskEnvironment { +class WebSocketBasicStreamSocketTest : public TestWithTaskEnvironment { protected: WebSocketBasicStreamSocketTest() : common_connect_job_params_(
diff --git a/net/websockets/websocket_channel_test.cc b/net/websockets/websocket_channel_test.cc index f40c6a6a..b735cc82 100644 --- a/net/websockets/websocket_channel_test.cc +++ b/net/websockets/websocket_channel_test.cc
@@ -788,7 +788,7 @@ }; // Base class for all test fixtures. -class WebSocketChannelTest : public TestWithScopedTaskEnvironment { +class WebSocketChannelTest : public TestWithTaskEnvironment { protected: WebSocketChannelTest() : stream_(std::make_unique<FakeWebSocketStream>()) {}
diff --git a/net/websockets/websocket_end_to_end_test.cc b/net/websockets/websocket_end_to_end_test.cc index 3082311..06cfe79 100644 --- a/net/websockets/websocket_end_to_end_test.cc +++ b/net/websockets/websocket_end_to_end_test.cc
@@ -265,7 +265,7 @@ DISALLOW_COPY_AND_ASSIGN(TestProxyDelegateWithProxyInfo); }; -class WebSocketEndToEndTest : public TestWithScopedTaskEnvironment { +class WebSocketEndToEndTest : public TestWithTaskEnvironment { protected: WebSocketEndToEndTest() : event_interface_(),
diff --git a/net/websockets/websocket_handshake_stream_create_helper_test.cc b/net/websockets/websocket_handshake_stream_create_helper_test.cc index 3678bf5..b68bc89 100644 --- a/net/websockets/websocket_handshake_stream_create_helper_test.cc +++ b/net/websockets/websocket_handshake_stream_create_helper_test.cc
@@ -148,7 +148,7 @@ class WebSocketHandshakeStreamCreateHelperTest : public TestWithParam<HandshakeStreamType>, - public WithScopedTaskEnvironment { + public WithTaskEnvironment { protected: std::unique_ptr<WebSocketStream> CreateAndInitializeStream( const std::vector<std::string>& sub_protocols,
diff --git a/net/websockets/websocket_stream_create_test_base.h b/net/websockets/websocket_stream_create_test_base.h index 3df0f4d6..e81aa8b 100644 --- a/net/websockets/websocket_stream_create_test_base.h +++ b/net/websockets/websocket_stream_create_test_base.h
@@ -31,7 +31,7 @@ struct WebSocketHandshakeRequestInfo; struct WebSocketHandshakeResponseInfo; -class WebSocketStreamCreateTestBase : public WithScopedTaskEnvironment { +class WebSocketStreamCreateTestBase : public WithTaskEnvironment { public: using HeaderKeyValuePair = std::pair<std::string, std::string>;
diff --git a/ppapi/host/resource_message_filter_unittest.cc b/ppapi/host/resource_message_filter_unittest.cc index c0abd5f..5612679 100644 --- a/ppapi/host/resource_message_filter_unittest.cc +++ b/ppapi/host/resource_message_filter_unittest.cc
@@ -212,11 +212,11 @@ // ResourceMessageFilter instances need to be created on a thread with message // loop. Therefore, we create a message loop and run the testing logic as a // task on it. - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // It should be safe to use base::Unretained() because the object won't be // destroyed before the task is run. - scoped_task_environment.GetMainThreadTaskRunner()->PostTask( + task_environment.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&ResourceMessageFilterTest::TestHandleMessageImpl, base::Unretained(this)));
diff --git a/ppapi/proxy/ppapi_proxy_test.h b/ppapi/proxy/ppapi_proxy_test.h index 3f39598..1ee5eb7a 100644 --- a/ppapi/proxy/ppapi_proxy_test.h +++ b/ppapi/proxy/ppapi_proxy_test.h
@@ -202,7 +202,7 @@ virtual void SetUp(); virtual void TearDown(); private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // This class provides support for multi-thread testing. A secondary thread is @@ -334,7 +334,7 @@ virtual void SetUp(); virtual void TearDown(); private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Use this base class to test both sides of a proxy. @@ -372,7 +372,7 @@ // The plugin side of the proxy runs on its own thread. base::Thread plugin_thread_; // The message loop for the main (host) thread. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Aliases for the host and plugin harnesses; if we're testing a PPP // interface, remote_harness will point to plugin_, and local_harness
diff --git a/ppapi/proxy/raw_var_data_unittest.cc b/ppapi/proxy/raw_var_data_unittest.cc index 59c56641..486ec00 100644 --- a/ppapi/proxy/raw_var_data_unittest.cc +++ b/ppapi/proxy/raw_var_data_unittest.cc
@@ -52,8 +52,8 @@ } private: - base::test::ScopedTaskEnvironment - scoped_task_environment_; // Required to receive callbacks. + base::test::TaskEnvironment + task_environment_; // Required to receive callbacks. TestGlobals globals_; };
diff --git a/ppapi/shared_impl/proxy_lock_unittest.cc b/ppapi/shared_impl/proxy_lock_unittest.cc index 980bfe4..c0d0068f 100644 --- a/ppapi/shared_impl/proxy_lock_unittest.cc +++ b/ppapi/shared_impl/proxy_lock_unittest.cc
@@ -68,8 +68,8 @@ } // namespace class PpapiProxyLockTest : public testing::Test { - base::test::ScopedTaskEnvironment - scoped_task_environment_; // Required to receive callbacks. + base::test::TaskEnvironment + task_environment_; // Required to receive callbacks. }; TEST_F(PpapiProxyLockTest, Locking) {
diff --git a/ppapi/shared_impl/resource_tracker_unittest.cc b/ppapi/shared_impl/resource_tracker_unittest.cc index 4044882..3bacc40 100644 --- a/ppapi/shared_impl/resource_tracker_unittest.cc +++ b/ppapi/shared_impl/resource_tracker_unittest.cc
@@ -49,8 +49,8 @@ ResourceTracker& resource_tracker() { return *globals_.GetResourceTracker(); } private: - base::test::ScopedTaskEnvironment - scoped_task_environment_; // Required to receive callbacks. + base::test::TaskEnvironment + task_environment_; // Required to receive callbacks. TestGlobals globals_; };
diff --git a/ppapi/shared_impl/var_tracker_unittest.cc b/ppapi/shared_impl/var_tracker_unittest.cc index a31053f3..5db7841f 100644 --- a/ppapi/shared_impl/var_tracker_unittest.cc +++ b/ppapi/shared_impl/var_tracker_unittest.cc
@@ -49,8 +49,8 @@ VarTracker& var_tracker() { return *globals_.GetVarTracker(); } private: - base::test::ScopedTaskEnvironment - scoped_task_environment_; // Required to receive callbacks. + base::test::TaskEnvironment + task_environment_; // Required to receive callbacks. TestGlobals globals_; };
diff --git a/printing/printing_context_win_unittest.cc b/printing/printing_context_win_unittest.cc index 2c6bfa516..277a2ba 100644 --- a/printing/printing_context_win_unittest.cc +++ b/printing/printing_context_win_unittest.cc
@@ -147,7 +147,7 @@ if (IsTestCaseDisabled()) return; - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; MockPrintingContextWin context(this); context.AskUserForSettings( 123, false, false, @@ -162,7 +162,7 @@ if (IsTestCaseDisabled()) return; - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; MockPrintingContextWin context(this); context.AskUserForSettings( 123, false, false,
diff --git a/remoting/base/auto_thread_task_runner_unittest.cc b/remoting/base/auto_thread_task_runner_unittest.cc index 2e6d02d..f5a9b58 100644 --- a/remoting/base/auto_thread_task_runner_unittest.cc +++ b/remoting/base/auto_thread_task_runner_unittest.cc
@@ -23,15 +23,14 @@ TEST(AutoThreadTaskRunnerTest, StartAndStop) { // Create a task runner. - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; scoped_refptr<AutoThreadTaskRunner> task_runner = new AutoThreadTaskRunner( - scoped_task_environment.GetMainThreadTaskRunner(), - run_loop.QuitClosure()); + task_environment.GetMainThreadTaskRunner(), run_loop.QuitClosure()); // Post a task to make sure it is executed. bool success = false; - scoped_task_environment.GetMainThreadTaskRunner()->PostTask( + task_environment.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&SetFlagTask, &success)); task_runner = NULL;
diff --git a/remoting/base/auto_thread_unittest.cc b/remoting/base/auto_thread_unittest.cc index 39504c1..408cd474 100644 --- a/remoting/base/auto_thread_unittest.cc +++ b/remoting/base/auto_thread_unittest.cc
@@ -57,20 +57,20 @@ class AutoThreadTest : public testing::Test { public: void RunMessageLoop() { - // Release |main_task_runner_|, then run |scoped_task_environment_| until + // Release |main_task_runner_|, then run |task_environment_| until // other references created in tests are gone. We also post a delayed quit // task to |message_loop_| so the test will not hang on failure. main_task_runner_ = NULL; base::RunLoop run_loop; quit_closure_ = run_loop.QuitClosure(); - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromSeconds(5)); run_loop.Run(); } void SetUp() override { main_task_runner_ = new AutoThreadTaskRunner( - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), base::Bind(&AutoThreadTest::QuitMainMessageLoop, base::Unretained(this))); } @@ -83,7 +83,7 @@ protected: void QuitMainMessageLoop() { std::move(quit_closure_).Run(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::OnceClosure quit_closure_; scoped_refptr<AutoThreadTaskRunner> main_task_runner_; };
diff --git a/remoting/base/buffered_socket_writer_unittest.cc b/remoting/base/buffered_socket_writer_unittest.cc index 64aed4f..94b0f2a 100644 --- a/remoting/base/buffered_socket_writer_unittest.cc +++ b/remoting/base/buffered_socket_writer_unittest.cc
@@ -158,7 +158,7 @@ VerifyWrittenData(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::NetLog net_log_; SocketDataProvider socket_data_provider_; std::unique_ptr<net::StreamSocket> socket_;
diff --git a/remoting/base/grpc_support/grpc_async_executor_unittest.cc b/remoting/base/grpc_support/grpc_async_executor_unittest.cc index 469b46a4..93946ee 100644 --- a/remoting/base/grpc_support/grpc_async_executor_unittest.cc +++ b/remoting/base/grpc_support/grpc_async_executor_unittest.cc
@@ -100,12 +100,11 @@ std::unique_ptr<GrpcAsyncExecutor> executor_; std::unique_ptr<test::GrpcAsyncTestServer> server_; std::unique_ptr<GrpcAsyncExecutorTestService::Stub> stub_; - std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_; + std::unique_ptr<base::test::TaskEnvironment> task_environment_; }; void GrpcAsyncExecutorTest::SetUp() { - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>(); + task_environment_ = std::make_unique<base::test::TaskEnvironment>(); executor_ = std::make_unique<GrpcAsyncExecutor>(); server_ = std::make_unique<test::GrpcAsyncTestServer>( std::make_unique<GrpcAsyncExecutorTestService::AsyncService>()); @@ -629,11 +628,10 @@ ServerStreamInitialMetadataDeadline_DefaultDeadline) { // Other tests can't work with mock time so we have to replace it here. // We also have to reset the old task environment before creating a new one - // since only one ScopedTaskEnvironment can exist at a time. - scoped_task_environment_.reset(); - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + // since only one TaskEnvironment can exist at a time. + task_environment_.reset(); + task_environment_ = std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); MockOnceClosure on_channel_ready; MockMessageCallback on_incoming_message; @@ -643,15 +641,14 @@ on_incoming_message.Get(), on_status.Get()); EXPECT_CALL(on_status, Run(Property(&grpc::Status::error_code, grpc::StatusCode::DEADLINE_EXCEEDED))); - scoped_task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(30)); + task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(30)); } TEST_F(GrpcAsyncExecutorTest, ServerStreamInitialMetadataDeadline_ManualDeadline) { - scoped_task_environment_.reset(); - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + task_environment_.reset(); + task_environment_ = std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); MockOnceClosure on_channel_ready; MockMessageCallback on_incoming_message; @@ -662,13 +659,13 @@ base::Time::Now() + base::TimeDelta::FromSeconds(60)); // |on_status| shouldn't be called in the first 30 seconds. - scoped_task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(30)); + task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(30)); EXPECT_CALL(on_status, Run(Property(&grpc::Status::error_code, grpc::StatusCode::DEADLINE_EXCEEDED))); // |on_status| should be called here. - scoped_task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(30)); + task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(30)); } } // namespace remoting
diff --git a/remoting/base/grpc_support/grpc_authenticated_executor_unittest.cc b/remoting/base/grpc_support/grpc_authenticated_executor_unittest.cc index 2ad8fac3..d9c8aaa 100644 --- a/remoting/base/grpc_support/grpc_authenticated_executor_unittest.cc +++ b/remoting/base/grpc_support/grpc_authenticated_executor_unittest.cc
@@ -53,7 +53,7 @@ private: FakeOAuthTokenGetter token_getter_{OAuthTokenGetter::Status::SUCCESS, "fake_user", "fake_token"}; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; void GrpcAuthenticatedExecutorTest::SetUp() {
diff --git a/remoting/base/oauth_token_getter_proxy_unittest.cc b/remoting/base/oauth_token_getter_proxy_unittest.cc index 5c61ae8b..498dc91 100644 --- a/remoting/base/oauth_token_getter_proxy_unittest.cc +++ b/remoting/base/oauth_token_getter_proxy_unittest.cc
@@ -135,7 +135,7 @@ std::unique_ptr<TokenCallbackResult> expected_callback_result_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(OAuthTokenGetterProxyTest); };
diff --git a/remoting/base/telemetry_log_writer_unittest.cc b/remoting/base/telemetry_log_writer_unittest.cc index e4ea612..0401f9f2 100644 --- a/remoting/base/telemetry_log_writer_unittest.cc +++ b/remoting/base/telemetry_log_writer_unittest.cc
@@ -139,7 +139,7 @@ private: int id_ = 0; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Test workflow: add request -> log event -> respond request.
diff --git a/remoting/client/display/gl_renderer_unittest.cc b/remoting/client/display/gl_renderer_unittest.cc index 03245536..3ccd78f 100644 --- a/remoting/client/display/gl_renderer_unittest.cc +++ b/remoting/client/display/gl_renderer_unittest.cc
@@ -125,7 +125,7 @@ return on_desktop_frame_processed_call_count_; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<GlRenderer> renderer_; FakeGlRendererDelegate delegate_; @@ -160,7 +160,7 @@ void GlRendererTest::PostSetDesktopFrameTasks(const webrtc::DesktopSize& size, int count) { for (int i = 0; i < count; i++) { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&GlRendererTest::SetDesktopFrameWithSize, base::Unretained(this), size)); } @@ -172,8 +172,8 @@ void GlRendererTest::RunTasksInCurrentQueue() { base::RunLoop run_loop; - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( - FROM_HERE, run_loop.QuitClosure()); + task_environment_.GetMainThreadTaskRunner()->PostTask(FROM_HERE, + run_loop.QuitClosure()); run_loop.Run(); }
diff --git a/remoting/client/queued_task_poster_unittest.cc b/remoting/client/queued_task_poster_unittest.cc index 67acf16f..fcbadfb 100644 --- a/remoting/client/queued_task_poster_unittest.cc +++ b/remoting/client/queued_task_poster_unittest.cc
@@ -42,7 +42,7 @@ void AssertSequenceNotStarted(); base::Thread target_thread_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; bool sequence_started_ = false; };
diff --git a/remoting/client/software_video_renderer_unittest.cc b/remoting/client/software_video_renderer_unittest.cc index a75a045..2f7854b6 100644 --- a/remoting/client/software_video_renderer_unittest.cc +++ b/remoting/client/software_video_renderer_unittest.cc
@@ -143,7 +143,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ClientContext context_; TestFrameConsumer frame_consumer_;
diff --git a/remoting/host/chromeos/clipboard_aura_unittest.cc b/remoting/host/chromeos/clipboard_aura_unittest.cc index d1616ae..f72564d 100644 --- a/remoting/host/chromeos/clipboard_aura_unittest.cc +++ b/remoting/host/chromeos/clipboard_aura_unittest.cc
@@ -56,8 +56,8 @@ protected: void StopAndResetClipboard(); - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; ClientClipboard* client_clipboard_; std::unique_ptr<ClipboardAura> clipboard_; }; @@ -119,13 +119,13 @@ Eq("Test data.")))).Times(1); base::RunLoop run_loop; - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, base::BindOnce(&ClipboardAuraTest_MonitorClipboardChanges_Test:: StopAndResetClipboard, base::Unretained(this)), TestTimeouts::tiny_timeout()); - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); run_loop.Run(); }
diff --git a/remoting/host/chromoting_host_context_unittest.cc b/remoting/host/chromoting_host_context_unittest.cc index 9f0bd83..8eb63077 100644 --- a/remoting/host/chromoting_host_context_unittest.cc +++ b/remoting/host/chromoting_host_context_unittest.cc
@@ -14,14 +14,13 @@ // A simple test that starts and stop the context. This tests the context // operates properly and all threads and message loops are valid. TEST(ChromotingHostContextTest, StartAndStop) { - base::test::ScopedTaskEnvironment scoped_task_environment{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::MainThreadType::UI}; base::RunLoop run_loop; std::unique_ptr<ChromotingHostContext> context = ChromotingHostContext::Create(new AutoThreadTaskRunner( - scoped_task_environment.GetMainThreadTaskRunner(), - run_loop.QuitClosure())); + task_environment.GetMainThreadTaskRunner(), run_loop.QuitClosure())); EXPECT_TRUE(context); if (!context)
diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc index df0d8a3..082be37 100644 --- a/remoting/host/chromoting_host_unittest.cc +++ b/remoting/host/chromoting_host_unittest.cc
@@ -210,7 +210,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_; scoped_refptr<AutoThreadTaskRunner> task_runner_; MockConnectionToClientEventHandler handler_;
diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc index c813625..84cddeb0 100644 --- a/remoting/host/client_session_unittest.cc +++ b/remoting/host/client_session_unittest.cc
@@ -188,7 +188,7 @@ int curr_display_; // Message loop that will process all ClientSession tasks. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // AutoThreadTaskRunner on which |client_session_| will be run. scoped_refptr<AutoThreadTaskRunner> task_runner_; @@ -219,13 +219,12 @@ }; void ClientSessionTest::SetUp() { - // Arrange to run |scoped_task_environment_| until no components depend on it. + // Arrange to run |task_environment_| until no components depend on it. task_runner_ = new AutoThreadTaskRunner( - scoped_task_environment_.GetMainThreadTaskRunner(), - run_loop_.QuitClosure()); + task_environment_.GetMainThreadTaskRunner(), run_loop_.QuitClosure()); desktop_environment_factory_.reset(new FakeDesktopEnvironmentFactory( - scoped_task_environment_.GetMainThreadTaskRunner())); + task_environment_.GetMainThreadTaskRunner())); desktop_environment_options_ = DesktopEnvironmentOptions::CreateDefault(); }
diff --git a/remoting/host/config_file_watcher_unittest.cc b/remoting/host/config_file_watcher_unittest.cc index b009aca5..6af0439 100644 --- a/remoting/host/config_file_watcher_unittest.cc +++ b/remoting/host/config_file_watcher_unittest.cc
@@ -52,8 +52,8 @@ void StopWatcher(); protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; base::RunLoop run_loop_; ConfigFileWatcherDelegate delegate_; @@ -78,8 +78,7 @@ // Arrange to run |message_loop_| until no components depend on it. scoped_refptr<AutoThreadTaskRunner> task_runner = new AutoThreadTaskRunner( - scoped_task_environment_.GetMainThreadTaskRunner(), - run_loop_.QuitClosure()); + task_environment_.GetMainThreadTaskRunner(), run_loop_.QuitClosure()); scoped_refptr<AutoThreadTaskRunner> io_task_runner = AutoThread::CreateWithType("IPC thread", task_runner,
diff --git a/remoting/host/daemon_process_unittest.cc b/remoting/host/daemon_process_unittest.cc index 6e846aa5..8d451cb9 100644 --- a/remoting/host/daemon_process_unittest.cc +++ b/remoting/host/daemon_process_unittest.cc
@@ -151,8 +151,8 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<MockDaemonProcess> daemon_process_; int terminal_id_; @@ -165,7 +165,7 @@ void DaemonProcessTest::SetUp() { scoped_refptr<AutoThreadTaskRunner> task_runner = new AutoThreadTaskRunner( - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), base::Bind(&DaemonProcessTest::QuitMessageLoop, base::Unretained(this))); daemon_process_.reset( new MockDaemonProcess(task_runner, task_runner, @@ -210,7 +210,7 @@ } void DaemonProcessTest::QuitMessageLoop() { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::RunLoop::QuitCurrentWhenIdleClosureDeprecated()); } @@ -392,7 +392,7 @@ })); static_cast<WorkerProcessIpcDelegate*>(daemon_process_.get()) ->OnWorkerProcessStopped(); - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromMilliseconds(10)); run_loop.Run(); }
diff --git a/remoting/host/desktop_process_unittest.cc b/remoting/host/desktop_process_unittest.cc index f845e46..dd6185a6 100644 --- a/remoting/host/desktop_process_unittest.cc +++ b/remoting/host/desktop_process_unittest.cc
@@ -153,8 +153,8 @@ MockDaemonListener daemon_listener_; // Runs the daemon's end of the channel. - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; scoped_refptr<AutoThreadTaskRunner> io_task_runner_; @@ -229,7 +229,7 @@ } void DesktopProcessTest::PostDisconnectChannels() { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&DesktopProcessTest::DisconnectChannels, base::Unretained(this))); } @@ -238,10 +238,10 @@ base::RunLoop run_loop; base::Closure quit_ui_task_runner = base::Bind(base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask), - scoped_task_environment_.GetMainThreadTaskRunner(), FROM_HERE, + task_environment_.GetMainThreadTaskRunner(), FROM_HERE, run_loop.QuitClosure()); scoped_refptr<AutoThreadTaskRunner> ui_task_runner = new AutoThreadTaskRunner( - scoped_task_environment_.GetMainThreadTaskRunner(), quit_ui_task_runner); + task_environment_.GetMainThreadTaskRunner(), quit_ui_task_runner); io_task_runner_ = AutoThread::CreateWithType("IPC thread", ui_task_runner, base::MessagePumpType::IO);
diff --git a/remoting/host/desktop_session_agent_unittest.cc b/remoting/host/desktop_session_agent_unittest.cc index bb5ffc2..f83a7d9f 100644 --- a/remoting/host/desktop_session_agent_unittest.cc +++ b/remoting/host/desktop_session_agent_unittest.cc
@@ -93,16 +93,16 @@ void Shutdown(); protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop run_loop_; scoped_refptr<AutoThreadTaskRunner> task_runner_; scoped_refptr<DesktopSessionAgent> agent_; }; DesktopSessionAgentTest::DesktopSessionAgentTest() - : task_runner_(new AutoThreadTaskRunner( - scoped_task_environment_.GetMainThreadTaskRunner(), - run_loop_.QuitClosure())), + : task_runner_( + new AutoThreadTaskRunner(task_environment_.GetMainThreadTaskRunner(), + run_loop_.QuitClosure())), agent_(new DesktopSessionAgent(task_runner_, task_runner_, task_runner_,
diff --git a/remoting/host/file_transfer/buffered_file_writer_unittest.cc b/remoting/host/file_transfer/buffered_file_writer_unittest.cc index 9647249b..d896a62 100644 --- a/remoting/host/file_transfer/buffered_file_writer_unittest.cc +++ b/remoting/host/file_transfer/buffered_file_writer_unittest.cc
@@ -34,7 +34,7 @@ bool complete_called_ = false; base::Optional<protocol::FileTransfer_Error> error_ = base::nullopt; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; BufferedFileWriterTest::BufferedFileWriterTest() = default; @@ -69,16 +69,16 @@ base::Unretained(this))); writer.Start(kTestFilename); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); writer.Write(kTestDataOne); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); writer.Write(kTestDataTwo); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); writer.Write(kTestDataThree); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); writer.Close(); ASSERT_EQ(false, complete_called_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(true, complete_called_); ASSERT_EQ(1ul, test_io.files_written.size()); @@ -107,7 +107,7 @@ writer.Write(kTestDataThree); writer.Close(); ASSERT_EQ(false, complete_called_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(true, complete_called_); ASSERT_EQ(1ul, test_io.files_written.size()); @@ -135,11 +135,11 @@ writer.Start(kTestFilename); writer.Write(kTestDataOne); writer.Write(kTestDataTwo); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); test_io.io_error = fake_error; writer.Write(kTestDataThree); writer.Close(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(error_); ASSERT_EQ(fake_error.SerializeAsString(), error_->SerializeAsString()); @@ -166,10 +166,10 @@ writer.Start(kTestFilename); writer.Write(kTestDataOne); writer.Write(kTestDataTwo); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); writer.Write(kTestDataThree); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(!complete_called_ && !error_); ASSERT_EQ(1ul, test_io.files_written.size());
diff --git a/remoting/host/file_transfer/file_transfer_message_handler_unittest.cc b/remoting/host/file_transfer/file_transfer_message_handler_unittest.cc index 23f7ac7..bb5892c 100644 --- a/remoting/host/file_transfer/file_transfer_message_handler_unittest.cc +++ b/remoting/host/file_transfer/file_transfer_message_handler_unittest.cc
@@ -83,7 +83,7 @@ const std::string kTestDataTwo = "this is the second test string"; const std::string kTestDataThree = "this is the third test string"; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<protocol::FakeMessagePipe> fake_pipe_; protocol::FileTransfer fake_metadata_; protocol::FileTransfer fake_end_; @@ -92,9 +92,9 @@ }; FileTransferMessageHandlerTest::FileTransferMessageHandlerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} + : task_environment_( + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} FileTransferMessageHandlerTest::~FileTransferMessageHandlerTest() = default; void FileTransferMessageHandlerTest::SetUp() { @@ -129,7 +129,7 @@ fake_pipe_->Receive(DataToBuffer(kTestDataTwo)); fake_pipe_->Receive(DataToBuffer(kTestDataThree)); fake_pipe_->Receive(MessageToBuffer(fake_end_)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_pipe_->ClosePipe(); @@ -163,11 +163,11 @@ fake_pipe_->Receive(MessageToBuffer(fake_metadata_)); fake_pipe_->Receive(DataToBuffer(kTestDataOne)); fake_pipe_->Receive(DataToBuffer(kTestDataTwo)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); test_io.io_error = fake_error; fake_pipe_->Receive(DataToBuffer(kTestDataTwo)); fake_pipe_->Receive(MessageToBuffer(fake_end_)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_pipe_->ClosePipe(); @@ -198,9 +198,9 @@ fake_pipe_->Receive(MessageToBuffer(fake_metadata_)); fake_pipe_->Receive(DataToBuffer(kTestDataOne)); fake_pipe_->Receive(DataToBuffer(kTestDataTwo)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_pipe_->Receive(MessageToBuffer(fake_error_message)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_pipe_->ClosePipe(); @@ -230,7 +230,7 @@ fake_pipe_->Receive(MessageToBuffer(fake_metadata_)); fake_pipe_->Receive(DataToBuffer(kTestDataOne)); fake_pipe_->Receive(DataToBuffer(kTestDataTwo)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_pipe_->ClosePipe(); @@ -254,7 +254,7 @@ fake_pipe_->Receive(DataToBuffer(kTestDataTwo)); fake_pipe_->Receive(DataToBuffer(kTestDataThree)); fake_pipe_->Receive(MessageToBuffer(fake_end_)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_pipe_->ClosePipe(); @@ -284,7 +284,7 @@ fake_pipe_->Receive(DataToBuffer(kTestDataTwo)); fake_pipe_->Receive(DataToBuffer(kTestDataThree)); fake_pipe_->Receive(MessageToBuffer(fake_end_)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_pipe_->Receive(MessageToBuffer(fake_metadata_)); fake_pipe_->ClosePipe(); @@ -315,7 +315,7 @@ fake_pipe_->Receive(DataToBuffer(kTestDataThree)); fake_pipe_->Receive(MessageToBuffer(fake_end_)); fake_pipe_->Receive(DataToBuffer(kTestDataOne)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_pipe_->ClosePipe(); @@ -351,9 +351,9 @@ fake_pipe_->OpenPipe(); fake_pipe_->Receive(MessageToBuffer(fake_request_transfer_)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_pipe_->Receive(MessageToBuffer(fake_success_)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_pipe_->ClosePipe(); @@ -383,7 +383,7 @@ fake_pipe_->OpenPipe(); fake_pipe_->Receive(MessageToBuffer(fake_request_transfer_)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_pipe_->ClosePipe(); @@ -413,7 +413,7 @@ fake_pipe_->OpenPipe(); fake_pipe_->Receive(MessageToBuffer(fake_request_transfer_)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); fake_pipe_->ClosePipe();
diff --git a/remoting/host/file_transfer/ipc_file_operations_unittest.cc b/remoting/host/file_transfer/ipc_file_operations_unittest.cc index 44462d5..663afd7 100644 --- a/remoting/host/file_transfer/ipc_file_operations_unittest.cc +++ b/remoting/host/file_transfer/ipc_file_operations_unittest.cc
@@ -114,7 +114,7 @@ base::FilePath TestDir(); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedPathOverride scoped_path_override_; std::unique_ptr<FileOperations> file_operations_; @@ -122,13 +122,13 @@ }; IpcFileOperationsTest::IpcFileOperationsTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED), + : task_environment_( + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED), // Points DIR_USER_DESKTOP at a scoped temporary directory. scoped_path_override_(base::DIR_USER_DESKTOP), file_operations_(std::make_unique<IpcTestBridge>( - scoped_task_environment_.GetMainThreadTaskRunner())) {} + task_environment_.GetMainThreadTaskRunner())) {} IpcFileOperationsTest::~IpcFileOperationsTest() = default; @@ -150,7 +150,7 @@ open_result = std::move(result); })); ASSERT_EQ(FileOperations::kBusy, writer->state()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(FileOperations::kReady, writer->state()); ASSERT_TRUE(open_result); ASSERT_TRUE(*open_result); @@ -162,7 +162,7 @@ write_result = std::move(result); })); ASSERT_EQ(FileOperations::kBusy, writer->state()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(FileOperations::kReady, writer->state()); ASSERT_TRUE(write_result); ASSERT_TRUE(*write_result); @@ -173,7 +173,7 @@ close_result = std::move(result); })); ASSERT_EQ(FileOperations::kBusy, writer->state()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(FileOperations::kComplete, writer->state()); std::string actual_file_data; @@ -192,7 +192,7 @@ BindLambda([&](FileOperations::Writer::Result result) { open_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(open_result && *open_result); for (const auto& chunk : {kTestDataOne, kTestDataTwo, kTestDataThree}) { @@ -201,12 +201,12 @@ BindLambda([&](FileOperations::Writer::Result result) { write_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(write_result && *write_result); } writer.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(base::IsDirectoryEmpty(TestDir())); } @@ -221,7 +221,7 @@ BindLambda([&](FileOperations::Writer::Result result) { open_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(open_result && *open_result); base::Optional<FileOperations::Writer::Result> write_result; @@ -232,7 +232,7 @@ EXPECT_EQ(FileOperations::kBusy, writer->state()); writer.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(write_result); EXPECT_TRUE(base::IsDirectoryEmpty(TestDir())); @@ -255,7 +255,7 @@ open_result = std::move(result); })); ASSERT_EQ(FileOperations::kBusy, reader->state()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(FileOperations::kReady, reader->state()); ASSERT_TRUE(open_result); ASSERT_TRUE(*open_result); @@ -268,7 +268,7 @@ read_result = std::move(result); })); ASSERT_EQ(FileOperations::kBusy, reader->state()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(FileOperations::kReady, reader->state()); ASSERT_TRUE(read_result); ASSERT_TRUE(*read_result); @@ -292,7 +292,7 @@ reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) { open_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(open_result && *open_result); base::Optional<FileOperations::Reader::ReadResult> read_result; @@ -302,7 +302,7 @@ BindLambda([&](FileOperations::Reader::ReadResult result) { read_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(FileOperations::kReady, reader->state()); ASSERT_TRUE(read_result); ASSERT_TRUE(*read_result); @@ -313,7 +313,7 @@ BindLambda([&](FileOperations::Reader::ReadResult result) { read_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(FileOperations::kComplete, reader->state()); ASSERT_TRUE(read_result); ASSERT_TRUE(*read_result); @@ -334,7 +334,7 @@ reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) { open_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(open_result && *open_result); base::Optional<FileOperations::Reader::ReadResult> read_result; @@ -342,7 +342,7 @@ BindLambda([&](FileOperations::Reader::ReadResult result) { read_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(FileOperations::kComplete, reader->state()); ASSERT_TRUE(read_result); ASSERT_TRUE(*read_result); @@ -360,7 +360,7 @@ reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) { open_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(FileOperations::kFailed, reader->state()); ASSERT_TRUE(open_result); ASSERT_FALSE(*open_result);
diff --git a/remoting/host/file_transfer/local_file_operations_unittest.cc b/remoting/host/file_transfer/local_file_operations_unittest.cc index 335b969..d334b0f0 100644 --- a/remoting/host/file_transfer/local_file_operations_unittest.cc +++ b/remoting/host/file_transfer/local_file_operations_unittest.cc
@@ -60,7 +60,7 @@ FileOperations::Writer::Result result); void OnCloseComplete(FileOperations::Writer::Result result); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedPathOverride scoped_path_override_; std::unique_ptr<FileOperations> file_operations_; std::unique_ptr<FileOperations::Writer> file_writer_; @@ -68,13 +68,13 @@ }; LocalFileOperationsTest::LocalFileOperationsTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED), + : task_environment_( + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED), // Points DIR_USER_DESKTOP at a scoped temporary directory. scoped_path_override_(base::DIR_USER_DESKTOP), file_operations_(std::make_unique<LocalFileOperations>( - scoped_task_environment_.GetMainThreadTaskRunner())) {} + task_environment_.GetMainThreadTaskRunner())) {} void LocalFileOperationsTest::SetUp() {} @@ -130,7 +130,7 @@ kTestFilename, base::queue<std::string>({kTestDataOne, kTestDataTwo, kTestDataThree}), true /* close */); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(operation_completed_); std::string actual_file_data; @@ -144,17 +144,17 @@ TEST_F(LocalFileOperationsTest, RenamesFileIfExists) { WriteFile(kTestFilename, base::queue<std::string>({kTestDataOne}), true /* close */); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(operation_completed_); WriteFile(kTestFilename, base::queue<std::string>({kTestDataTwo}), true /* close */); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(operation_completed_); WriteFile(kTestFilename, base::queue<std::string>({kTestDataThree}), true /* close */); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(operation_completed_); std::string actual_file_data_one; @@ -177,11 +177,11 @@ kTestFilename, base::queue<std::string>({kTestDataOne, kTestDataTwo, kTestDataThree}), false /* close */); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(operation_completed_); file_writer_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(base::IsDirectoryEmpty(TestDir())); } @@ -190,12 +190,12 @@ TEST_F(LocalFileOperationsTest, CancelsWhileOperationPending) { WriteFile(kTestFilename, base::queue<std::string>({kTestDataOne}), false /* close */); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(operation_completed_); file_writer_->WriteChunk(kTestDataTwo, base::DoNothing()); file_writer_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(base::IsDirectoryEmpty(TestDir())); } @@ -217,7 +217,7 @@ open_result = std::move(result); })); ASSERT_EQ(FileOperations::kBusy, reader->state()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(FileOperations::kReady, reader->state()); ASSERT_TRUE(open_result); ASSERT_TRUE(*open_result); @@ -240,7 +240,7 @@ reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) { open_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(open_result && *open_result); for (const auto& chunk : {kTestDataOne, kTestDataTwo, kTestDataThree}) { @@ -251,7 +251,7 @@ read_result = std::move(result); })); ASSERT_EQ(FileOperations::kBusy, reader->state()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(FileOperations::kReady, reader->state()); ASSERT_TRUE(read_result); ASSERT_TRUE(*read_result); @@ -274,7 +274,7 @@ reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) { open_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(open_result && *open_result); base::Optional<FileOperations::Reader::ReadResult> read_result; @@ -283,7 +283,7 @@ BindLambda([&](FileOperations::Reader::ReadResult result) { read_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(FileOperations::kReady, reader->state()); ASSERT_TRUE(read_result && *read_result); EXPECT_EQ(contents, **read_result); @@ -293,7 +293,7 @@ BindLambda([&](FileOperations::Reader::ReadResult result) { read_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(FileOperations::kComplete, reader->state()); ASSERT_TRUE(read_result && *read_result); EXPECT_EQ(std::size_t{0}, (*read_result)->size()); @@ -310,7 +310,7 @@ reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) { open_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(FileOperations::kFailed, reader->state()); ASSERT_TRUE(open_result); ASSERT_FALSE(*open_result); @@ -329,7 +329,7 @@ reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) { open_result = std::move(result); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(FileOperations::kFailed, reader->state()); ASSERT_TRUE(open_result); ASSERT_FALSE(*open_result);
diff --git a/remoting/host/ftl_host_change_notification_listener_unittest.cc b/remoting/host/ftl_host_change_notification_listener_unittest.cc index 81b1ff64..323f5f8 100644 --- a/remoting/host/ftl_host_change_notification_listener_unittest.cc +++ b/remoting/host/ftl_host_change_notification_listener_unittest.cc
@@ -76,7 +76,7 @@ ftl::Id system_sender_id_; ftl::Id peer_sender_id_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockListener mock_listener_; MockSignalStrategy signal_strategy_;
diff --git a/remoting/host/ftl_signaling_connector_unittest.cc b/remoting/host/ftl_signaling_connector_unittest.cc index 132348a4..4a67374 100644 --- a/remoting/host/ftl_signaling_connector_unittest.cc +++ b/remoting/host/ftl_signaling_connector_unittest.cc
@@ -33,7 +33,7 @@ } ~FtlSignalingConnectorTest() override { - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } protected: @@ -45,8 +45,8 @@ return signaling_connector_->backoff_reset_timer_; } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; FakeSignalStrategy signal_strategy_{SignalingAddress(kLocalFtlId)}; base::MockCallback<base::OnceClosure> auth_failed_callback_; std::unique_ptr<FtlSignalingConnector> signaling_connector_; @@ -54,7 +54,7 @@ TEST_F(FtlSignalingConnectorTest, StartAndSucceed) { signaling_connector_->Start(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_EQ(SignalStrategy::CONNECTING, signal_strategy_.GetState()); signal_strategy_.ProceedConnect(); ASSERT_EQ(SignalStrategy::CONNECTED, signal_strategy_.GetState()); @@ -63,7 +63,7 @@ TEST_F(FtlSignalingConnectorTest, StartAndAuthFailed) { signaling_connector_->Start(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_EQ(SignalStrategy::CONNECTING, signal_strategy_.GetState()); signal_strategy_.SetIsSignInError(true); @@ -76,14 +76,14 @@ TEST_F(FtlSignalingConnectorTest, StartAndFailedThenRetryAndSucceeded) { ASSERT_EQ(0, GetBackoff().failure_count()); signaling_connector_->Start(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_EQ(SignalStrategy::CONNECTING, signal_strategy_.GetState()); signal_strategy_.SetError(SignalStrategy::NETWORK_ERROR); signal_strategy_.Disconnect(); ASSERT_EQ(1, GetBackoff().failure_count()); - scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); ASSERT_EQ(SignalStrategy::CONNECTING, signal_strategy_.GetState()); signal_strategy_.ProceedConnect(); @@ -91,7 +91,7 @@ ASSERT_EQ(1, GetBackoff().failure_count()); // Failure count is eventually reset to 0. - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_EQ(0, GetBackoff().failure_count()); } @@ -99,7 +99,7 @@ StartAndImmediatelyDisconnected_RetryWithBackoff) { ASSERT_EQ(0, GetBackoff().failure_count()); signaling_connector_->Start(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_EQ(SignalStrategy::CONNECTING, signal_strategy_.GetState()); signal_strategy_.ProceedConnect(); @@ -108,7 +108,7 @@ signal_strategy_.Disconnect(); ASSERT_EQ(1, GetBackoff().failure_count()); - scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); ASSERT_EQ(SignalStrategy::CONNECTING, signal_strategy_.GetState()); signal_strategy_.ProceedConnect(); @@ -116,7 +116,7 @@ ASSERT_EQ(1, GetBackoff().failure_count()); // Failure count is eventually reset to 0. - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_EQ(0, GetBackoff().failure_count()); } @@ -125,7 +125,7 @@ net::NetworkChangeNotifier::CONNECTION_ETHERNET); // Reconnection starts with some delay. ASSERT_EQ(SignalStrategy::DISCONNECTED, signal_strategy_.GetState()); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_EQ(SignalStrategy::CONNECTING, signal_strategy_.GetState()); }
diff --git a/remoting/host/gcd_rest_client_unittest.cc b/remoting/host/gcd_rest_client_unittest.cc index 0fb7e88a..68f68379 100644 --- a/remoting/host/gcd_rest_client_unittest.cc +++ b/remoting/host/gcd_rest_client_unittest.cc
@@ -62,7 +62,7 @@ GcdRestClient::Result last_result_ = GcdRestClient::OTHER_ERROR; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(GcdRestClientTest, NetworkErrorGettingToken) {
diff --git a/remoting/host/gcd_state_updater_unittest.cc b/remoting/host/gcd_state_updater_unittest.cc index 6193e567..8e09f44 100644 --- a/remoting/host/gcd_state_updater_unittest.cc +++ b/remoting/host/gcd_state_updater_unittest.cc
@@ -34,9 +34,9 @@ class GcdStateUpdaterTest : public testing::Test { public: GcdStateUpdaterTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED), + : task_environment_( + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED), test_shared_url_loader_factory_( base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( &test_url_loader_factory_)), @@ -65,7 +65,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::SimpleTestClock test_clock_; net::TestURLFetcherFactory url_fetcher_factory_; network::TestURLLoaderFactory test_url_loader_factory_; @@ -97,7 +97,7 @@ })); signal_strategy_.Connect(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1, on_success_count_); @@ -115,12 +115,12 @@ // Connect, then re-connect with a different JID while the status // update for the first connection is pending. signal_strategy_.Connect(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); signal_strategy_.Disconnect(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); signal_strategy_.SetLocalAddress(SignalingAddress("local_jid2")); signal_strategy_.Connect(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Let the first status update finish. This should be a no-op in // the updater because the local JID has changed since this request @@ -140,11 +140,11 @@ network::GetUploadData(request)); test_url_loader_factory_.AddResponse(request.url.spec(), std::string(), net::HTTP_OK); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); })); // Wait for the next retry. - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); // There should be a new pending request now with the new local JID. // It will be caught and handled by the interceptor installed above. @@ -162,14 +162,14 @@ &signal_strategy_, std::move(rest_client_))); signal_strategy_.Connect(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); auto* request = GetPendingRequest(0); test_url_loader_factory_.SimulateResponseWithoutRemovingFromPendingList( request, network::ResourceResponseHead(), std::string(), network::URLLoaderCompletionStatus(net::ERR_FAILED)); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); request = GetPendingRequest(1); test_url_loader_factory_.SimulateResponseWithoutRemovingFromPendingList( @@ -189,7 +189,7 @@ &signal_strategy_, std::move(rest_client_))); signal_strategy_.Connect(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); auto* request = GetPendingRequest(0); test_url_loader_factory_.SimulateResponseWithoutRemovingFromPendingList(
diff --git a/remoting/host/heartbeat_sender_unittest.cc b/remoting/host/heartbeat_sender_unittest.cc index 9ea014503..988aaa1 100644 --- a/remoting/host/heartbeat_sender_unittest.cc +++ b/remoting/host/heartbeat_sender_unittest.cc
@@ -101,7 +101,7 @@ ~HeartbeatSenderTest() override { heartbeat_sender_.reset(); signal_strategy_.reset(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } protected: @@ -122,8 +122,8 @@ return heartbeat_sender_->backoff_; } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; MockHeartbeatClient* mock_client_; std::unique_ptr<FakeSignalStrategy> signal_strategy_; @@ -156,7 +156,7 @@ EXPECT_CALL(mock_heartbeat_successful_callback_, Run()).Times(1); signal_strategy_->Connect(); - scoped_task_environment_.FastForwardBy(kWaitForAllStrategiesConnectedTimeout); + task_environment_.FastForwardBy(kWaitForAllStrategiesConnectedTimeout); } TEST_F(HeartbeatSenderTest, SignalingReconnect_NewHeartbeats) { @@ -221,7 +221,7 @@ response.set_set_interval_seconds(kGoodIntervalSeconds); std::move(callback).Run(grpc::Status::OK, response); }); - scoped_task_environment_.FastForwardBy(kTestHeartbeatDelay); + task_environment_.FastForwardBy(kTestHeartbeatDelay); } TEST_F(HeartbeatSenderTest, UnknownHostId) { @@ -237,7 +237,7 @@ signal_strategy_->Connect(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } TEST_F(HeartbeatSenderTest, SendHeartbeatLogEntryOnHeartbeat) { @@ -271,9 +271,9 @@ ASSERT_EQ(0, GetBackoff().failure_count()); signal_strategy_->Connect(); ASSERT_EQ(1, GetBackoff().failure_count()); - scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); ASSERT_EQ(2, GetBackoff().failure_count()); - scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); ASSERT_EQ(0, GetBackoff().failure_count()); } @@ -292,7 +292,7 @@ EXPECT_CALL(mock_unauthenticated_error_callback_, Run()).Times(1); signal_strategy_->Connect(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); // Should retry heartbeating at least once. ASSERT_LT(1, heartbeat_count);
diff --git a/remoting/host/host_power_save_blocker_unittest.cc b/remoting/host/host_power_save_blocker_unittest.cc index c95d4f1..334c8f7 100644 --- a/remoting/host/host_power_save_blocker_unittest.cc +++ b/remoting/host/host_power_save_blocker_unittest.cc
@@ -24,8 +24,8 @@ void SetUp() override; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; base::Thread blocking_thread_; scoped_refptr<HostStatusMonitor> monitor_; std::unique_ptr<HostPowerSaveBlocker> blocker_; @@ -39,7 +39,7 @@ base::Thread::Options(base::MessagePumpType::IO, 0)) && blocking_thread_.WaitUntilThreadStarted()); blocker_.reset(new HostPowerSaveBlocker( - monitor_, scoped_task_environment_.GetMainThreadTaskRunner(), + monitor_, task_environment_.GetMainThreadTaskRunner(), blocking_thread_.task_runner())); }
diff --git a/remoting/host/host_status_logger_unittest.cc b/remoting/host/host_status_logger_unittest.cc index f401015..86d2d12d 100644 --- a/remoting/host/host_status_logger_unittest.cc +++ b/remoting/host/host_status_logger_unittest.cc
@@ -138,7 +138,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockSignalStrategy signal_strategy_; std::unique_ptr<XmppLogToServer> log_to_server_; std::unique_ptr<HostStatusLogger> host_status_logger_;
diff --git a/remoting/host/input_monitor/local_input_monitor_unittest.cc b/remoting/host/input_monitor/local_input_monitor_unittest.cc index be5ce5e3..a04fb9c 100644 --- a/remoting/host/input_monitor/local_input_monitor_unittest.cc +++ b/remoting/host/input_monitor/local_input_monitor_unittest.cc
@@ -33,12 +33,12 @@ void SetUp() override; - base::test::ScopedTaskEnvironment scoped_task_environment_ { + base::test::TaskEnvironment task_environment_ { #if defined(OS_WIN) - base::test::ScopedTaskEnvironment::MainThreadType::UI + base::test::TaskEnvironment::MainThreadType::UI #else // !defined(OS_WIN) // Required to watch a file descriptor from NativeMessageProcessHost. - base::test::ScopedTaskEnvironment::MainThreadType::IO + base::test::TaskEnvironment::MainThreadType::IO #endif // !defined(OS_WIN) };
diff --git a/remoting/host/ipc_desktop_environment_unittest.cc b/remoting/host/ipc_desktop_environment_unittest.cc index 0f1cda3e..8751a181 100644 --- a/remoting/host/ipc_desktop_environment_unittest.cc +++ b/remoting/host/ipc_desktop_environment_unittest.cc
@@ -198,8 +198,8 @@ void RunMainLoopUntilDone(); - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; // Runs until |desktop_session_proxy_| is connected to the desktop. std::unique_ptr<base::RunLoop> setup_run_loop_; @@ -263,9 +263,9 @@ void IpcDesktopEnvironmentTest::SetUp() { // Arrange to run |message_loop_| until no components depend on it. - task_runner_ = new AutoThreadTaskRunner( - scoped_task_environment_.GetMainThreadTaskRunner(), - main_run_loop_.QuitClosure()); + task_runner_ = + new AutoThreadTaskRunner(task_environment_.GetMainThreadTaskRunner(), + main_run_loop_.QuitClosure()); io_task_runner_ = AutoThread::CreateWithType("IPC thread", task_runner_, base::MessagePumpType::IO); @@ -371,7 +371,7 @@ .Times(AtMost(1)); // Let tests know that the remote desktop environment is created. - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, setup_run_loop_->QuitClosure()); return desktop_environment;
diff --git a/remoting/host/it2me/it2me_confirmation_dialog_proxy_unittest.cc b/remoting/host/it2me/it2me_confirmation_dialog_proxy_unittest.cc index ba5c780..30c7e91 100644 --- a/remoting/host/it2me/it2me_confirmation_dialog_proxy_unittest.cc +++ b/remoting/host/it2me/it2me_confirmation_dialog_proxy_unittest.cc
@@ -87,7 +87,7 @@ ~It2MeConfirmationDialogProxyTest() override; scoped_refptr<base::SingleThreadTaskRunner> main_task_runner() { - return scoped_task_environment_.GetMainThreadTaskRunner(); + return task_environment_.GetMainThreadTaskRunner(); } scoped_refptr<base::SingleThreadTaskRunner> dialog_task_runner() { @@ -111,7 +111,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop run_loop_; base::Thread dialog_thread_;
diff --git a/remoting/host/it2me/it2me_host_unittest.cc b/remoting/host/it2me/it2me_host_unittest.cc index 3dc361ee..d7d0999 100644 --- a/remoting/host/it2me/it2me_host_unittest.cc +++ b/remoting/host/it2me/it2me_host_unittest.cc
@@ -188,7 +188,7 @@ private: void StartupHostStateHelper(const base::Closure& quit_closure); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; std::unique_ptr<FakeSignalStrategy> fake_bot_signal_strategy_;
diff --git a/remoting/host/linux/audio_pipe_reader_unittest.cc b/remoting/host/linux/audio_pipe_reader_unittest.cc index 70d35a4..08a1952 100644 --- a/remoting/host/linux/audio_pipe_reader_unittest.cc +++ b/remoting/host/linux/audio_pipe_reader_unittest.cc
@@ -75,7 +75,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; std::unique_ptr<base::Thread> audio_thread_; base::ScopedTempDir test_dir_;
diff --git a/remoting/host/linux/certificate_watcher_unittest.cc b/remoting/host/linux/certificate_watcher_unittest.cc index 1cb3742..7b97c2c 100644 --- a/remoting/host/linux/certificate_watcher_unittest.cc +++ b/remoting/host/linux/certificate_watcher_unittest.cc
@@ -28,7 +28,7 @@ class CertificateWatcherTest : public testing::Test { public: CertificateWatcherTest() - : task_runner_(scoped_task_environment_.GetMainThreadTaskRunner()) { + : task_runner_(task_environment_.GetMainThreadTaskRunner()) { EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); watcher_.reset(new CertificateWatcher( base::Bind(&CertificateWatcherTest::OnRestart, base::Unretained(this)), @@ -93,8 +93,8 @@ } } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; base::ScopedTempDir temp_dir_; std::unique_ptr<CertificateWatcher> watcher_;
diff --git a/remoting/host/linux/x11_character_injector_unittest.cc b/remoting/host/linux/x11_character_injector_unittest.cc index 898af6db..8ccd7287 100644 --- a/remoting/host/linux/x11_character_injector_unittest.cc +++ b/remoting/host/linux/x11_character_injector_unittest.cc
@@ -152,7 +152,7 @@ std::unique_ptr<X11CharacterInjector> injector_; FakeX11Keyboard* keyboard_; // Owned by |injector_|. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; void X11CharacterInjectorTest::SetUp() {
diff --git a/remoting/host/mouse_cursor_monitor_proxy_unittest.cc b/remoting/host/mouse_cursor_monitor_proxy_unittest.cc index d4093207..084d54a 100644 --- a/remoting/host/mouse_cursor_monitor_proxy_unittest.cc +++ b/remoting/host/mouse_cursor_monitor_proxy_unittest.cc
@@ -92,7 +92,7 @@ const webrtc::DesktopVector& position) override; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop run_loop_; base::Thread capture_thread_; std::unique_ptr<MouseCursorMonitorProxy> proxy_; @@ -102,8 +102,7 @@ void MouseCursorMonitorProxyTest::OnMouseCursor( webrtc::MouseCursor* mouse_cursor) { - DCHECK(scoped_task_environment_.GetMainThreadTaskRunner() - ->BelongsToCurrentThread()); + DCHECK(task_environment_.GetMainThreadTaskRunner()->BelongsToCurrentThread()); EXPECT_EQ(kCursorWidth, mouse_cursor->image()->size().width()); EXPECT_EQ(kCursorHeight, mouse_cursor->image()->size().height());
diff --git a/remoting/host/mouse_shape_pump_unittest.cc b/remoting/host/mouse_shape_pump_unittest.cc index 43ccaf5..f4b3ab2 100644 --- a/remoting/host/mouse_shape_pump_unittest.cc +++ b/remoting/host/mouse_shape_pump_unittest.cc
@@ -66,7 +66,7 @@ void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape); protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop run_loop_; std::unique_ptr<MouseShapePump> pump_;
diff --git a/remoting/host/native_messaging/native_messaging_reader_unittest.cc b/remoting/host/native_messaging/native_messaging_reader_unittest.cc index 7fb509a..895ad3e 100644 --- a/remoting/host/native_messaging/native_messaging_reader_unittest.cc +++ b/remoting/host/native_messaging/native_messaging_reader_unittest.cc
@@ -50,8 +50,8 @@ private: // MessageLoop declared here, since the NativeMessageReader ctor requires a // MessageLoop to have been created. - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<base::RunLoop> run_loop_; };
diff --git a/remoting/host/policy_watcher_unittest.cc b/remoting/host/policy_watcher_unittest.cc index 594df442..8fdf939f 100644 --- a/remoting/host/policy_watcher_unittest.cc +++ b/remoting/host/policy_watcher_unittest.cc
@@ -61,8 +61,7 @@ class PolicyWatcherTest : public testing::Test { public: PolicyWatcherTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} void SetUp() override { // We expect no callbacks unless explicitly specified by individual tests. @@ -250,7 +249,7 @@ static const char* kHostDomain; static const char* kClientDomain; static const char* kPortRange; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockPolicyCallback mock_policy_callback_; // |policy_loader_| is owned by |policy_watcher_|. PolicyWatcherTest retains
diff --git a/remoting/host/process_stats_sender_unittest.cc b/remoting/host/process_stats_sender_unittest.cc index e2ca4763..7ed2029e 100644 --- a/remoting/host/process_stats_sender_unittest.cc +++ b/remoting/host/process_stats_sender_unittest.cc
@@ -98,7 +98,7 @@ } // namespace TEST(ProcessStatsSenderTest, ReportUsage) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; FakeProcessStatsStub stub; std::unique_ptr<ProcessStatsSender> stats; @@ -115,7 +115,7 @@ }, base::Unretained(&stats), std::cref(stub), std::cref(agent), base::Unretained(&run_loop))); - scoped_task_environment.GetMainThreadTaskRunner()->PostTask( + task_environment.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce( [](std::unique_ptr<ProcessStatsSender>* stats, @@ -134,7 +134,7 @@ } TEST(ProcessStatsSenderTest, MergeUsage) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; FakeProcessStatsStub stub; std::unique_ptr<ProcessStatsSender> stats; @@ -154,7 +154,7 @@ }, base::Unretained(&stats), std::cref(stub), std::cref(agent1), std::cref(agent2), base::Unretained(&run_loop))); - scoped_task_environment.GetMainThreadTaskRunner()->PostTask( + task_environment.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce( [](std::unique_ptr<ProcessStatsSender>* stats,
diff --git a/remoting/host/remoting_register_support_host_request_unittest.cc b/remoting/host/remoting_register_support_host_request_unittest.cc index 9e842b7..6af7d510 100644 --- a/remoting/host/remoting_register_support_host_request_unittest.cc +++ b/remoting/host/remoting_register_support_host_request_unittest.cc
@@ -83,7 +83,7 @@ ~RemotingRegisterSupportHostTest() override { register_host_request_.reset(); signal_strategy_.reset(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } protected: @@ -96,8 +96,8 @@ MOCK_METHOD0(CancelPendingRequests, void()); }; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; std::unique_ptr<RemotingRegisterSupportHostRequest> register_host_request_; MockRegisterSupportHostClient* register_host_client_ = nullptr;
diff --git a/remoting/host/resizing_host_observer_unittest.cc b/remoting/host/resizing_host_observer_unittest.cc index 38d7272..2ff51cf4 100644 --- a/remoting/host/resizing_host_observer_unittest.cc +++ b/remoting/host/resizing_host_observer_unittest.cc
@@ -297,7 +297,7 @@ resizing_host_observer_->SetNowFunctionForTesting( base::Bind(&ResizingHostObserverTest::GetTime, base::Unretained(this))); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; EXPECT_EQ(MakeResolution(100, 100), @@ -315,7 +315,7 @@ // Since it was queued 900 + 99 ms after the first, we need to wait an // additional 1ms. However, since RunLoop is not guaranteed to process tasks // with the same due time in FIFO order, wait an additional 1ms for safety. - scoped_task_environment.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromMilliseconds(2)); run_loop.Run();
diff --git a/remoting/host/security_key/security_key_auth_handler_posix_unittest.cc b/remoting/host/security_key/security_key_auth_handler_posix_unittest.cc index ccb29f8..8ce1f728 100644 --- a/remoting/host/security_key/security_key_auth_handler_posix_unittest.cc +++ b/remoting/host/security_key/security_key_auth_handler_posix_unittest.cc
@@ -168,8 +168,8 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<base::RunLoop> run_loop_; base::Thread file_thread_;
diff --git a/remoting/host/security_key/security_key_auth_handler_win_unittest.cc b/remoting/host/security_key/security_key_auth_handler_win_unittest.cc index 917f005..bf7fb015 100644 --- a/remoting/host/security_key/security_key_auth_handler_win_unittest.cc +++ b/remoting/host/security_key/security_key_auth_handler_win_unittest.cc
@@ -85,8 +85,8 @@ mojo::NamedPlatformChannel::ServerName GetUniqueTestChannelHandle(); // IPC tests require a valid MessageLoop to run. - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; // Used to allow |message_loop_| to run during tests. The instance is reset // after each stage of the tests has been completed.
diff --git a/remoting/host/security_key/security_key_extension_session_unittest.cc b/remoting/host/security_key/security_key_extension_session_unittest.cc index a1b23c1..98d5b6b 100644 --- a/remoting/host/security_key/security_key_extension_session_unittest.cc +++ b/remoting/host/security_key/security_key_extension_session_unittest.cc
@@ -153,8 +153,8 @@ void CreateSecurityKeyConnection(); protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; // Object under test. std::unique_ptr<SecurityKeyExtensionSession> security_key_extension_session_;
diff --git a/remoting/host/security_key/security_key_ipc_client_unittest.cc b/remoting/host/security_key/security_key_ipc_client_unittest.cc index 830e7a6..3a84f9f4 100644 --- a/remoting/host/security_key/security_key_ipc_client_unittest.cc +++ b/remoting/host/security_key/security_key_ipc_client_unittest.cc
@@ -79,8 +79,8 @@ mojo::NamedPlatformChannel::ServerName GenerateUniqueTestChannelName(); // IPC tests require a valid MessageLoop to run. - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; // Used to allow |message_loop_| to run during tests. The instance is reset // after each stage of the tests has been completed.
diff --git a/remoting/host/security_key/security_key_ipc_server_unittest.cc b/remoting/host/security_key/security_key_ipc_server_unittest.cc index 3984384..1f60bd6 100644 --- a/remoting/host/security_key/security_key_ipc_server_unittest.cc +++ b/remoting/host/security_key/security_key_ipc_server_unittest.cc
@@ -69,8 +69,8 @@ uint32_t desktop_session_id() const override { return peer_session_id_; } // IPC tests require a valid MessageLoop to run. - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; // Used to allow |message_loop_| to run during tests. The instance is reset // after each stage of the tests has been completed.
diff --git a/remoting/host/security_key/security_key_message_handler_unittest.cc b/remoting/host/security_key/security_key_message_handler_unittest.cc index 467ac0ef..31c510f 100644 --- a/remoting/host/security_key/security_key_message_handler_unittest.cc +++ b/remoting/host/security_key/security_key_message_handler_unittest.cc
@@ -53,8 +53,8 @@ std::unique_ptr<SecurityKeyMessageHandler> message_handler_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<base::RunLoop> run_loop_; DISALLOW_COPY_AND_ASSIGN(SecurityKeyMessageHandlerTest);
diff --git a/remoting/host/security_key/security_key_message_reader_impl_unittest.cc b/remoting/host/security_key/security_key_message_reader_impl_unittest.cc index 6425f86..51fb8efa 100644 --- a/remoting/host/security_key/security_key_message_reader_impl_unittest.cc +++ b/remoting/host/security_key/security_key_message_reader_impl_unittest.cc
@@ -61,8 +61,8 @@ std::vector<std::unique_ptr<SecurityKeyMessage>> messages_received_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<base::RunLoop> run_loop_; DISALLOW_COPY_AND_ASSIGN(SecurityKeyMessageReaderImplTest);
diff --git a/remoting/host/security_key/security_key_message_writer_impl_unittest.cc b/remoting/host/security_key/security_key_message_writer_impl_unittest.cc index 690d1e632..2e7bb1c6 100644 --- a/remoting/host/security_key/security_key_message_writer_impl_unittest.cc +++ b/remoting/host/security_key/security_key_message_writer_impl_unittest.cc
@@ -103,8 +103,8 @@ reader_thread.StartWithOptions(options); // Used to block until the read complete callback is triggered. - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); base::RunLoop run_loop; ASSERT_TRUE(base::PostTaskAndReplyWithResult(
diff --git a/remoting/host/token_validator_factory_impl_unittest.cc b/remoting/host/token_validator_factory_impl_unittest.cc index 37d6563c..41f03b2 100644 --- a/remoting/host/token_validator_factory_impl_unittest.cc +++ b/remoting/host/token_validator_factory_impl_unittest.cc
@@ -111,8 +111,7 @@ class TokenValidatorFactoryImplTest : public testing::Test { public: TokenValidatorFactoryImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} void SuccessCallback(const std::string& shared_secret) { EXPECT_FALSE(shared_secret.empty()); @@ -134,7 +133,7 @@ void SetUp() override { key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair); request_context_getter_ = new net::TestURLRequestContextGetter( - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), std::make_unique<SetResponseURLRequestContext>()); ThirdPartyAuthConfig config; config.token_url = GURL(kTokenUrl); @@ -177,7 +176,7 @@ context->SetErrorResponse(failure_phase, net_error); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop run_loop_; scoped_refptr<RsaKeyPair> key_pair_; scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
diff --git a/remoting/host/win/rdp_client_unittest.cc b/remoting/host/win/rdp_client_unittest.cc index 33170f4..5e55c6b7 100644 --- a/remoting/host/win/rdp_client_unittest.cc +++ b/remoting/host/win/rdp_client_unittest.cc
@@ -100,8 +100,8 @@ // Used by RdpClient. The loop is stopped once there are no more references to // |task_runner_|. - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; base::RunLoop run_loop_; scoped_refptr<AutoThreadTaskRunner> task_runner_; @@ -122,8 +122,7 @@ void RdpClientTest::SetUp() { // Arrange to run |run_loop_| until no components depend on it. task_runner_ = new AutoThreadTaskRunner( - scoped_task_environment_.GetMainThreadTaskRunner(), - run_loop_.QuitClosure()); + task_environment_.GetMainThreadTaskRunner(), run_loop_.QuitClosure()); module_.reset(new RdpClientModule()); } @@ -141,7 +140,7 @@ EXPECT_TRUE(WtsTerminalMonitor::LookupTerminalId(session_id, &id)); EXPECT_EQ(id, terminal_id_); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&RdpClientTest::CloseRdpClient, base::Unretained(this))); }
diff --git a/remoting/host/win/worker_process_launcher_unittest.cc b/remoting/host/win/worker_process_launcher_unittest.cc index 7d0b5f3..964f49e 100644 --- a/remoting/host/win/worker_process_launcher_unittest.cc +++ b/remoting/host/win/worker_process_launcher_unittest.cc
@@ -158,8 +158,8 @@ protected: void DoLaunchProcess(); - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; scoped_refptr<AutoThreadTaskRunner> task_runner_; // Receives messages sent to the worker process. @@ -196,7 +196,7 @@ void WorkerProcessLauncherTest::SetUp() { task_runner_ = new AutoThreadTaskRunner( - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), base::Bind(&WorkerProcessLauncherTest::QuitMainMessageLoop, base::Unretained(this))); @@ -341,7 +341,7 @@ } void WorkerProcessLauncherTest::QuitMainMessageLoop() { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::RunLoop::QuitCurrentWhenIdleClosureDeprecated()); }
diff --git a/remoting/host/xmpp_register_support_host_request_unittest.cc b/remoting/host/xmpp_register_support_host_request_unittest.cc index 7a5c143..eeeda3e9 100644 --- a/remoting/host/xmpp_register_support_host_request_unittest.cc +++ b/remoting/host/xmpp_register_support_host_request_unittest.cc
@@ -73,8 +73,8 @@ .WillRepeatedly(RemoveListener(&signal_strategy_listeners_)); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; MockSignalStrategy signal_strategy_; base::ObserverList<SignalStrategy::Listener, true> signal_strategy_listeners_; scoped_refptr<RsaKeyPair> key_pair_; @@ -94,7 +94,7 @@ EXPECT_CALL(callback_, Run("", base::TimeDelta::FromSeconds(0), ErrorCode::SIGNALING_TIMEOUT)); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(15)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(15)); } TEST_F(XmppRegisterSupportHostRequestTest, Send) { @@ -110,7 +110,7 @@ .WillOnce(DoAll(SaveArg<0>(&sent_iq), Return(true))); request->OnSignalStrategyStateChange(SignalStrategy::CONNECTED); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Verify format of the query. std::unique_ptr<XmlElement> stanza(sent_iq); @@ -185,7 +185,7 @@ } EXPECT_EQ(1, consumed); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } // namespace remoting
diff --git a/remoting/ios/facade/host_list_service_unittest.mm b/remoting/ios/facade/host_list_service_unittest.mm index b547855..eff07a6 100644 --- a/remoting/ios/facade/host_list_service_unittest.mm +++ b/remoting/ios/facade/host_list_service_unittest.mm
@@ -80,7 +80,7 @@ id remoting_service_mock_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<HostListService::CallbackSubscription> host_list_state_subscription_; std::unique_ptr<HostListService::CallbackSubscription>
diff --git a/remoting/protocol/audio_decode_scheduler_unittest.cc b/remoting/protocol/audio_decode_scheduler_unittest.cc index 4148b67..54e78105 100644 --- a/remoting/protocol/audio_decode_scheduler_unittest.cc +++ b/remoting/protocol/audio_decode_scheduler_unittest.cc
@@ -57,7 +57,7 @@ void TearDown() override; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop run_loop_; scoped_refptr<AutoThreadTaskRunner> audio_decode_task_runner_; scoped_refptr<AutoThreadTaskRunner> main_task_runner_; @@ -66,8 +66,7 @@ void AudioDecodeSchedulerTest::SetUp() { main_task_runner_ = new AutoThreadTaskRunner( - scoped_task_environment_.GetMainThreadTaskRunner(), - run_loop_.QuitClosure()); + task_environment_.GetMainThreadTaskRunner(), run_loop_.QuitClosure()); audio_decode_task_runner_ = AutoThread::Create("decode", main_task_runner_); session_config_ = SessionConfig::ForTestWithAudio(); }
diff --git a/remoting/protocol/audio_pump_unittest.cc b/remoting/protocol/audio_pump_unittest.cc index 51beb4d7..1b0a0dd 100644 --- a/remoting/protocol/audio_pump_unittest.cc +++ b/remoting/protocol/audio_pump_unittest.cc
@@ -71,7 +71,7 @@ base::OnceClosure done) override; protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // |source_| and |encoder_| are owned by the |pump_|. FakeAudioSource* source_; @@ -89,7 +89,7 @@ void AudioPumpTest::SetUp() { source_ = new FakeAudioSource(); encoder_ = new FakeAudioEncoder(); - pump_.reset(new AudioPump(scoped_task_environment_.GetMainThreadTaskRunner(), + pump_.reset(new AudioPump(task_environment_.GetMainThreadTaskRunner(), base::WrapUnique(source_), base::WrapUnique(encoder_), this)); }
diff --git a/remoting/protocol/authenticator_test_base.h b/remoting/protocol/authenticator_test_base.h index d899eba..5805a163 100644 --- a/remoting/protocol/authenticator_test_base.h +++ b/remoting/protocol/authenticator_test_base.h
@@ -65,7 +65,7 @@ std::unique_ptr<P2PStreamSocket> host_socket_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(AuthenticatorTestBase); };
diff --git a/remoting/protocol/capture_scheduler_unittest.cc b/remoting/protocol/capture_scheduler_unittest.cc index d1d668b..87d3bb0 100644 --- a/remoting/protocol/capture_scheduler_unittest.cc +++ b/remoting/protocol/capture_scheduler_unittest.cc
@@ -73,7 +73,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<CaptureScheduler> scheduler_;
diff --git a/remoting/protocol/channel_multiplexer_unittest.cc b/remoting/protocol/channel_multiplexer_unittest.cc index c815812..ee21951 100644 --- a/remoting/protocol/channel_multiplexer_unittest.cc +++ b/remoting/protocol/channel_multiplexer_unittest.cc
@@ -125,7 +125,7 @@ private: // Must be instantiated before the FakeStreamChannelFactories below. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; protected: FakeStreamChannelFactory host_channel_factory_;
diff --git a/remoting/protocol/channel_socket_adapter_unittest.cc b/remoting/protocol/channel_socket_adapter_unittest.cc index 83eba3a..e486b79 100644 --- a/remoting/protocol/channel_socket_adapter_unittest.cc +++ b/remoting/protocol/channel_socket_adapter_unittest.cc
@@ -55,8 +55,8 @@ std::unique_ptr<TransportChannelSocketAdapter> target_; net::CompletionRepeatingCallback callback_; int callback_result_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; }; // Verify that Read() returns net::ERR_IO_PENDING.
diff --git a/remoting/protocol/chromium_socket_factory_unittest.cc b/remoting/protocol/chromium_socket_factory_unittest.cc index 9e735b2..805876b 100644 --- a/remoting/protocol/chromium_socket_factory_unittest.cc +++ b/remoting/protocol/chromium_socket_factory_unittest.cc
@@ -82,7 +82,7 @@ while (last_packet_.empty() && attempts++ < kMaxAttempts) { sender->SendTo(test_packet.data(), test_packet.size(), socket_->GetLocalAddress(), options); - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop_.QuitClosure(), kAttemptPeriod); run_loop_.Run(); } @@ -91,8 +91,8 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; base::RunLoop run_loop_; std::unique_ptr<rtc::PacketSocketFactory> socket_factory_;
diff --git a/remoting/protocol/client_video_dispatcher_unittest.cc b/remoting/protocol/client_video_dispatcher_unittest.cc index 08cda1d4..a316dda 100644 --- a/remoting/protocol/client_video_dispatcher_unittest.cc +++ b/remoting/protocol/client_video_dispatcher_unittest.cc
@@ -46,7 +46,7 @@ void OnMessageReceived(std::unique_ptr<CompoundBuffer> buffer); void OnReadError(int error); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Set to true in OnChannelInitialized(). bool initialized_ = false;
diff --git a/remoting/protocol/connection_unittest.cc b/remoting/protocol/connection_unittest.cc index 24a8c5d..786ecbd81 100644 --- a/remoting/protocol/connection_unittest.cc +++ b/remoting/protocol/connection_unittest.cc
@@ -262,8 +262,7 @@ public testing::WithParamInterface<bool> { public: ConnectionTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), video_encode_thread_("VideoEncode"), audio_encode_thread_("AudioEncode"), audio_decode_thread_("AudioDecode") { @@ -291,16 +290,16 @@ host_connection_.reset(new WebrtcConnectionToClient( base::WrapUnique(host_session_), TransportContext::ForTests(protocol::TransportRole::SERVER), - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner())); + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner())); client_connection_.reset(new WebrtcConnectionToHost()); } else { host_connection_.reset(new IceConnectionToClient( base::WrapUnique(host_session_), TransportContext::ForTests(protocol::TransportRole::SERVER), - scoped_task_environment_.GetMainThreadTaskRunner(), - scoped_task_environment_.GetMainThreadTaskRunner())); + task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner())); client_connection_.reset(new IceConnectionToHost()); } @@ -436,7 +435,7 @@ .empty()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; MockConnectionToClientEventHandler host_event_handler_;
diff --git a/remoting/protocol/data_channel_manager_unittest.cc b/remoting/protocol/data_channel_manager_unittest.cc index 3070b0e3..fe5c74d5 100644 --- a/remoting/protocol/data_channel_manager_unittest.cc +++ b/remoting/protocol/data_channel_manager_unittest.cc
@@ -99,7 +99,7 @@ FakeNamedMessagePipeHandler::handlers_; void TestDataChannelManagerFullMatch(bool asynchronous) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; DataChannelManager manager; manager.RegisterCreateHandlerCallback("FullMatch", base::Bind( [](const std::string& expected_data, @@ -191,7 +191,7 @@ } void TestDataChannelManagerMultipleRegistrations(bool asynchronous) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; DataChannelManager manager; manager.RegisterCreateHandlerCallback("FullMatch", base::Bind( [](const std::string& expected_data,
diff --git a/remoting/protocol/ice_transport_unittest.cc b/remoting/protocol/ice_transport_unittest.cc index 04c3d1d..f5445a1 100644 --- a/remoting/protocol/ice_transport_unittest.cc +++ b/remoting/protocol/ice_transport_unittest.cc
@@ -180,8 +180,8 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<base::RunLoop> run_loop_; NetworkSettings network_settings_;
diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc index 0423b0e..d13535a6 100644 --- a/remoting/protocol/jingle_session_unittest.cc +++ b/remoting/protocol/jingle_session_unittest.cc
@@ -321,8 +321,8 @@ } } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; NetworkSettings network_settings_;
diff --git a/remoting/protocol/message_reader_unittest.cc b/remoting/protocol/message_reader_unittest.cc index 1138fce..b946e8a 100644 --- a/remoting/protocol/message_reader_unittest.cc +++ b/remoting/protocol/message_reader_unittest.cc
@@ -79,7 +79,7 @@ callback_.OnMessage(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MessageReader> reader_; FakeStreamSocket socket_; MockMessageReceivedCallback callback_;
diff --git a/remoting/protocol/monitored_video_stub_unittest.cc b/remoting/protocol/monitored_video_stub_unittest.cc index 054e48b..6516f5c 100644 --- a/remoting/protocol/monitored_video_stub_unittest.cc +++ b/remoting/protocol/monitored_video_stub_unittest.cc
@@ -43,7 +43,7 @@ MOCK_METHOD1(OnVideoChannelStatus, void(bool connected)); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockVideoStub video_stub_; std::unique_ptr<MonitoredVideoStub> monitor_; @@ -91,7 +91,7 @@ monitor_->ProcessVideoPacket(std::move(packet_), base::Closure()); - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, base::RunLoop::QuitCurrentWhenIdleClosureDeprecated(), // The delay should be much greater than |kTestOverrideDelayMilliseconds|. TestTimeouts::tiny_timeout());
diff --git a/remoting/protocol/pairing_registry_unittest.cc b/remoting/protocol/pairing_registry_unittest.cc index 13a5546..33a9802 100644 --- a/remoting/protocol/pairing_registry_unittest.cc +++ b/remoting/protocol/pairing_registry_unittest.cc
@@ -82,7 +82,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop run_loop_; int callback_count_;
diff --git a/remoting/protocol/pseudotcp_adapter_unittest.cc b/remoting/protocol/pseudotcp_adapter_unittest.cc index 08887264..5f6ea9a8 100644 --- a/remoting/protocol/pseudotcp_adapter_unittest.cc +++ b/remoting/protocol/pseudotcp_adapter_unittest.cc
@@ -316,7 +316,7 @@ std::unique_ptr<PseudoTcpAdapter> host_pseudotcp_; std::unique_ptr<PseudoTcpAdapter> client_pseudotcp_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(PseudoTcpAdapterTest, DataTransfer) {
diff --git a/remoting/protocol/remoting_ice_config_request_unittest.cc b/remoting/protocol/remoting_ice_config_request_unittest.cc index b947b920..255b26e3 100644 --- a/remoting/protocol/remoting_ice_config_request_unittest.cc +++ b/remoting/protocol/remoting_ice_config_request_unittest.cc
@@ -55,7 +55,7 @@ return received_config; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; RemotingIceConfigRequest request_; test::GrpcTestServer<MockNetworkTraversalService> test_server_; };
diff --git a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc index e05c1f6..07244c1 100644 --- a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc +++ b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc
@@ -136,7 +136,7 @@ client_socket_ = std::move(socket); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<RsaKeyPair> key_pair_; std::string host_cert_;
diff --git a/remoting/protocol/validating_authenticator_unittest.cc b/remoting/protocol/validating_authenticator_unittest.cc index 26c72be..9ed4b37 100644 --- a/remoting/protocol/validating_authenticator_unittest.cc +++ b/remoting/protocol/validating_authenticator_unittest.cc
@@ -77,7 +77,7 @@ std::unique_ptr<ValidatingAuthenticator> validating_authenticator_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(ValidatingAuthenticatorTest); };
diff --git a/remoting/protocol/video_frame_pump_unittest.cc b/remoting/protocol/video_frame_pump_unittest.cc index e324dec..6a3998b 100644 --- a/remoting/protocol/video_frame_pump_unittest.cc +++ b/remoting/protocol/video_frame_pump_unittest.cc
@@ -147,7 +147,7 @@ std::unique_ptr<VideoEncoder> encoder); protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop run_loop_; scoped_refptr<AutoThreadTaskRunner> encode_task_runner_; scoped_refptr<AutoThreadTaskRunner> main_task_runner_; @@ -158,8 +158,7 @@ void VideoFramePumpTest::SetUp() { main_task_runner_ = new AutoThreadTaskRunner( - scoped_task_environment_.GetMainThreadTaskRunner(), - run_loop_.QuitClosure()); + task_environment_.GetMainThreadTaskRunner(), run_loop_.QuitClosure()); encode_task_runner_ = AutoThread::Create("encode", main_task_runner_); }
diff --git a/remoting/protocol/webrtc_audio_source_adapter_unittest.cc b/remoting/protocol/webrtc_audio_source_adapter_unittest.cc index 05b8ec8..241481e3 100644 --- a/remoting/protocol/webrtc_audio_source_adapter_unittest.cc +++ b/remoting/protocol/webrtc_audio_source_adapter_unittest.cc
@@ -61,7 +61,7 @@ public: void SetUp() override { audio_source_adapter_ = new rtc::RefCountedObject<WebrtcAudioSourceAdapter>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); audio_source_ = new FakeAudioSource(); audio_source_adapter_->Start(base::WrapUnique(audio_source_)); audio_source_adapter_->AddSink(&sink_); @@ -74,7 +74,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeAudioSource* audio_source_; scoped_refptr<WebrtcAudioSourceAdapter> audio_source_adapter_; FakeAudioSink sink_;
diff --git a/remoting/protocol/webrtc_transport_unittest.cc b/remoting/protocol/webrtc_transport_unittest.cc index fcc6180..4fa5b99 100644 --- a/remoting/protocol/webrtc_transport_unittest.cc +++ b/remoting/protocol/webrtc_transport_unittest.cc
@@ -150,8 +150,7 @@ class WebrtcTransportTest : public testing::Test { public: WebrtcTransportTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); network_settings_ = NetworkSettings(NetworkSettings::NAT_TRAVERSAL_OUTGOING); @@ -297,7 +296,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; NetworkSettings network_settings_;
diff --git a/remoting/signaling/ftl_message_reception_channel_unittest.cc b/remoting/signaling/ftl_message_reception_channel_unittest.cc index 52e689f..702bcd9 100644 --- a/remoting/signaling/ftl_message_reception_channel_unittest.cc +++ b/remoting/signaling/ftl_message_reception_channel_unittest.cc
@@ -106,8 +106,8 @@ base::TimeDelta GetTimeUntilRetry() const; int GetRetryFailureCount() const; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; std::unique_ptr<FtlMessageReceptionChannel> channel_; base::MockCallback<FtlMessageReceptionChannel::StreamOpener> mock_stream_opener_; @@ -122,7 +122,7 @@ void FtlMessageReceptionChannelTest::TearDown() { channel_.reset(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } base::TimeDelta FtlMessageReceptionChannelTest::GetTimeUntilRetry() const { @@ -214,7 +214,7 @@ GetTimeUntilRetry().InSecondsF(), 0.5); // This will make the channel reopen the stream. - scoped_task_environment_.FastForwardBy(GetTimeUntilRetry()); + task_environment_.FastForwardBy(GetTimeUntilRetry()); }, &old_stream)) .WillOnce(StartStream( @@ -322,7 +322,7 @@ const ReceiveMessagesResponseCallback& on_incoming_msg, StatusCallback on_channel_closed) { std::move(on_channel_ready).Run(); - scoped_task_environment_.FastForwardBy( + task_environment_.FastForwardBy( FtlMessageReceptionChannel::kPongTimeout); ASSERT_EQ(1, GetRetryFailureCount()); @@ -330,7 +330,7 @@ GetTimeUntilRetry().InSecondsF(), 0.5); // This will make the channel reopen the stream. - scoped_task_environment_.FastForwardBy(GetTimeUntilRetry()); + task_environment_.FastForwardBy(GetTimeUntilRetry()); }, &old_stream)) .WillOnce(StartStream( @@ -425,7 +425,7 @@ } // This will tail-recursively call the stream opener. - scoped_task_environment_.FastForwardBy(time_until_retry); + task_environment_.FastForwardBy(time_until_retry); })); channel_->StartReceivingMessages(base::DoNothing(),
diff --git a/remoting/signaling/ftl_messaging_client_unittest.cc b/remoting/signaling/ftl_messaging_client_unittest.cc index 036271ff..0129a543 100644 --- a/remoting/signaling/ftl_messaging_client_unittest.cc +++ b/remoting/signaling/ftl_messaging_client_unittest.cc
@@ -165,7 +165,7 @@ MockMessageReceptionChannel* mock_message_reception_channel_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockRegistrationManager mock_registration_manager_; };
diff --git a/remoting/signaling/ftl_registration_manager_unittest.cc b/remoting/signaling/ftl_registration_manager_unittest.cc index d7dee37..3029e8e5 100644 --- a/remoting/signaling/ftl_registration_manager_unittest.cc +++ b/remoting/signaling/ftl_registration_manager_unittest.cc
@@ -82,8 +82,8 @@ return registration_manager_.sign_in_backoff_; } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; FakeOAuthTokenGetter token_getter{OAuthTokenGetter::SUCCESS, "fake_email", "access_token"}; FtlRegistrationManager registration_manager_{ @@ -104,14 +104,14 @@ EXPECT_CALL(done_callback_, Run(IsStatusOk())).Times(1); registration_manager_.SignInGaia(done_callback_.Get()); - scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); ASSERT_TRUE(registration_manager_.IsSignedIn()); ASSERT_EQ("registration_id_1", registration_manager_.GetRegistrationId()); ASSERT_EQ(kAuthToken, registration_manager_.GetFtlAuthToken()); - scoped_task_environment_.FastForwardBy(kAuthTokenExpiration); - scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + task_environment_.FastForwardBy(kAuthTokenExpiration); + task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); ASSERT_EQ("registration_id_2", registration_manager_.GetRegistrationId()); } @@ -140,7 +140,7 @@ EXPECT_CALL(done_callback_, Run(HasErrorCode(grpc::StatusCode::UNAVAILABLE))) .Times(1); registration_manager_.SignInGaia(done_callback_.Get()); - scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); ASSERT_FALSE(registration_manager_.IsSignedIn()); ASSERT_EQ(1, GetBackoff().failure_count()); @@ -148,13 +148,13 @@ Run(HasErrorCode(grpc::StatusCode::UNAUTHENTICATED))) .Times(1); registration_manager_.SignInGaia(done_callback_.Get()); - scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); ASSERT_FALSE(registration_manager_.IsSignedIn()); ASSERT_EQ(2, GetBackoff().failure_count()); EXPECT_CALL(done_callback_, Run(IsStatusOk())).Times(1); registration_manager_.SignInGaia(done_callback_.Get()); - scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); ASSERT_TRUE(registration_manager_.IsSignedIn()); ASSERT_EQ("registration_id", registration_manager_.GetRegistrationId()); ASSERT_EQ(0, GetBackoff().failure_count()); @@ -170,7 +170,7 @@ EXPECT_CALL(done_callback_, Run(IsStatusOk())).Times(1); registration_manager_.SignInGaia(done_callback_.Get()); - scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); ASSERT_TRUE(registration_manager_.IsSignedIn()); ASSERT_EQ("registration_id", registration_manager_.GetRegistrationId()); @@ -183,7 +183,7 @@ ASSERT_TRUE(registration_manager_.GetRegistrationId().empty()); ASSERT_TRUE(registration_manager_.GetFtlAuthToken().empty()); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_FALSE(registration_manager_.IsSignedIn()); }
diff --git a/remoting/signaling/ftl_signal_strategy_unittest.cc b/remoting/signaling/ftl_signal_strategy_unittest.cc index d1c8725..c1bd69d 100644 --- a/remoting/signaling/ftl_signal_strategy_unittest.cc +++ b/remoting/signaling/ftl_signal_strategy_unittest.cc
@@ -211,7 +211,7 @@ ~FtlSignalStrategyTest() override { signal_strategy_->RemoveListener(this); signal_strategy_.reset(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } protected: @@ -236,8 +236,8 @@ const std::string&, const ftl::ChromotingMessage&)); - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; MockOAuthTokenGetter* token_getter_ = nullptr; FakeRegistrationManager* registration_manager_ = nullptr;
diff --git a/remoting/signaling/iq_sender_unittest.cc b/remoting/signaling/iq_sender_unittest.cc index d0518d5..94be6a02 100644 --- a/remoting/signaling/iq_sender_unittest.cc +++ b/remoting/signaling/iq_sender_unittest.cc
@@ -96,7 +96,7 @@ return result; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockSignalStrategy signal_strategy_; std::unique_ptr<IqSender> sender_; base::MockCallback<IqSender::ReplyCallback> callback_;
diff --git a/remoting/signaling/message_tracker_unittest.cc b/remoting/signaling/message_tracker_unittest.cc index c6d7bb1d..ecd7f4f 100644 --- a/remoting/signaling/message_tracker_unittest.cc +++ b/remoting/signaling/message_tracker_unittest.cc
@@ -14,8 +14,8 @@ protected: static constexpr base::TimeDelta GetCleanupInterval(); - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; MessageTracker message_tracker_; }; @@ -36,14 +36,14 @@ TEST_F(MessageTrackerTest, TrackIdAndAdvanceTimer_ExpiredIdNotRejected) { message_tracker_.TrackId("1"); ASSERT_TRUE(message_tracker_.IsIdTracked("1")); - scoped_task_environment_.FastForwardBy(GetCleanupInterval() * 2); + task_environment_.FastForwardBy(GetCleanupInterval() * 2); ASSERT_FALSE(message_tracker_.IsIdTracked("1")); } TEST_F(MessageTrackerTest, TrackIdAndAdvanceTimer_NotExpiredIdRejected) { message_tracker_.TrackId("1"); ASSERT_TRUE(message_tracker_.IsIdTracked("1")); - scoped_task_environment_.FastForwardBy(GetCleanupInterval() / 2); + task_environment_.FastForwardBy(GetCleanupInterval() / 2); ASSERT_TRUE(message_tracker_.IsIdTracked("1")); }
diff --git a/remoting/signaling/remoting_log_to_server_unittest.cc b/remoting/signaling/remoting_log_to_server_unittest.cc index bafb5e7..6dbbb0b 100644 --- a/remoting/signaling/remoting_log_to_server_unittest.cc +++ b/remoting/signaling/remoting_log_to_server_unittest.cc
@@ -27,7 +27,7 @@ } ~RemotingLogToServerTest() override { - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } protected: @@ -42,8 +42,8 @@ using CreateLogEntryResponseCallback = RemotingLogToServer::CreateLogEntryResponseCallback; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; base::MockCallback<RemotingLogToServer::CreateLogEntryCallback> mock_create_log_entry_; @@ -69,7 +69,7 @@ entry.Set("test-key", "test-value"); log_to_server_.Log(entry); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_EQ(0, GetBackoffEntry().failure_count()); } @@ -91,8 +91,7 @@ log_to_server_.Log(entry); for (int i = 1; i <= GetMaxSendLogAttempts(); i++) { - scoped_task_environment_.FastForwardBy( - GetBackoffEntry().GetTimeUntilRelease()); + task_environment_.FastForwardBy(GetBackoffEntry().GetTimeUntilRelease()); ASSERT_EQ(i, GetBackoffEntry().failure_count()); } } @@ -133,26 +132,26 @@ ServerLogEntry entry_1; entry_1.Set("test-key-1", "test-value-1"); log_to_server_.Log(entry_1); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ServerLogEntry entry_2; entry_2.Set("test-key-2", "test-value-2"); log_to_server_.Log(entry_2); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_EQ(0, GetBackoffEntry().failure_count()); std::move(response_callback_1) .Run(grpc::Status(grpc::StatusCode::UNAVAILABLE, "unavailable"), {}); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); std::move(response_callback_2) .Run(grpc::Status(grpc::StatusCode::UNAVAILABLE, "unavailable"), {}); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_EQ(2, GetBackoffEntry().failure_count()); std::move(response_callback_1).Run(grpc::Status::OK, {}); std::move(response_callback_2).Run(grpc::Status::OK, {}); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_EQ(0, GetBackoffEntry().failure_count()); }
diff --git a/remoting/signaling/xmpp_log_to_server_unittest.cc b/remoting/signaling/xmpp_log_to_server_unittest.cc index f27aac0..02f2e44 100644 --- a/remoting/signaling/xmpp_log_to_server_unittest.cc +++ b/remoting/signaling/xmpp_log_to_server_unittest.cc
@@ -48,7 +48,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop run_loop_; MockSignalStrategy signal_strategy_; std::unique_ptr<XmppLogToServer> xmpp_log_to_server_;
diff --git a/remoting/test/access_token_fetcher_unittest.cc b/remoting/test/access_token_fetcher_unittest.cc index cb3cddc..58823de 100644 --- a/remoting/test/access_token_fetcher_unittest.cc +++ b/remoting/test/access_token_fetcher_unittest.cc
@@ -81,7 +81,7 @@ std::string refresh_token_retrieved_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> shared_factory_; @@ -89,8 +89,7 @@ }; AccessTokenFetcherTest::AccessTokenFetcherTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), shared_factory_( base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( &test_url_loader_factory_)) {}
diff --git a/remoting/test/connection_time_observer_unittest.cc b/remoting/test/connection_time_observer_unittest.cc index 8899b5f..863ce7a9 100644 --- a/remoting/test/connection_time_observer_unittest.cc +++ b/remoting/test/connection_time_observer_unittest.cc
@@ -115,8 +115,8 @@ connection_time_observer_->SetTransitionTimesMapForTest( std::map<protocol::ConnectionToHost::State, base::TimeTicks>()); - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); base::RunLoop run_loop; // Should fail to find INITIALIZING in an empty map.
diff --git a/remoting/test/host_list_fetcher_unittest.cc b/remoting/test/host_list_fetcher_unittest.cc index 0d1fd94..8287448 100644 --- a/remoting/test/host_list_fetcher_unittest.cc +++ b/remoting/test/host_list_fetcher_unittest.cc
@@ -194,8 +194,8 @@ net::URLRequestStatus::Status status); private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; net::FakeURLFetcherFactory url_fetcher_factory_; DISALLOW_COPY_AND_ASSIGN(HostListFetcherTest);
diff --git a/remoting/test/it2me_standalone_host.cc b/remoting/test/it2me_standalone_host.cc index 63c722b..1ef3cd4 100644 --- a/remoting/test/it2me_standalone_host.cc +++ b/remoting/test/it2me_standalone_host.cc
@@ -38,8 +38,7 @@ using ::remoting::protocol::MockSession; It2MeStandaloneHost::It2MeStandaloneHost() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), context_(ChromotingHostContext::Create( new AutoThreadTaskRunner(base::ThreadTaskRunnerHandle::Get(), run_loop_.QuitClosure()))),
diff --git a/remoting/test/it2me_standalone_host.h b/remoting/test/it2me_standalone_host.h index 5d1f643..c142c586 100644 --- a/remoting/test/it2me_standalone_host.h +++ b/remoting/test/it2me_standalone_host.h
@@ -43,7 +43,7 @@ private: void Connect(); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop run_loop_; std::unique_ptr<ChromotingHostContext> context_; scoped_refptr<AutoThreadTaskRunner> main_task_runner_;
diff --git a/remoting/test/protocol_perftest.cc b/remoting/test/protocol_perftest.cc index cf49959..c7b4c77a 100644 --- a/remoting/test/protocol_perftest.cc +++ b/remoting/test/protocol_perftest.cc
@@ -53,7 +53,7 @@ namespace remoting { -using base::test::ScopedTaskEnvironment; +using base::test::TaskEnvironment; using protocol::ChannelConfig; namespace { @@ -109,7 +109,7 @@ public HostStatusObserver { public: ProtocolPerfTest() - : task_environment_(ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(TaskEnvironment::MainThreadType::IO), host_thread_("host"), capture_thread_("capture"), encode_thread_("encode"), @@ -381,7 +381,7 @@ void MeasureTotalLatency(bool use_webrtc); void MeasureScrollPerformance(bool use_webrtc); - ScopedTaskEnvironment task_environment_; + TaskEnvironment task_environment_; scoped_refptr<FakeNetworkDispatcher> fake_network_dispatcher_;
diff --git a/remoting/test/test_chromoting_client_unittest.cc b/remoting/test/test_chromoting_client_unittest.cc index 415881ea..2ef88f2a 100644 --- a/remoting/test/test_chromoting_client_unittest.cc +++ b/remoting/test/test_chromoting_client_unittest.cc
@@ -53,8 +53,8 @@ protocol::ErrorCode error_code) override; void ConnectionReady(bool ready) override; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; DISALLOW_COPY_AND_ASSIGN(TestChromotingClientTest); };
diff --git a/rlz/lib/rlz_lib_test.cc b/rlz/lib/rlz_lib_test.cc index 06a489e..a7cbba0 100644 --- a/rlz/lib/rlz_lib_test.cc +++ b/rlz/lib/rlz_lib_test.cc
@@ -108,7 +108,7 @@ url_loader_factory->AddResponse(url, kGoodPingResponses); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(RlzLibTest, RecordProductEvent) {
diff --git a/rlz/test/rlz_unittest_main.cc b/rlz/test/rlz_unittest_main.cc index bd555db..ec6c6dda 100644 --- a/rlz/test/rlz_unittest_main.cc +++ b/rlz/test/rlz_unittest_main.cc
@@ -28,7 +28,7 @@ mojo::core::Init(); - // RlzLibTest uses base::test::ScopedTaskEnvironment that needs TestTimeouts. + // RlzLibTest uses base::test::TaskEnvironment that needs TestTimeouts. TestTimeouts::Initialize(); int ret = RUN_ALL_TESTS();
diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc index 7dbcc87..816c0d6 100644 --- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc +++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
@@ -313,6 +313,7 @@ case __NR_rt_sigaction: case __NR_rt_sigprocmask: case __NR_rt_sigreturn: + case __NR_rt_sigtimedwait: #if defined(__i386__) || defined(__arm__) || \ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) case __NR_sigaction: @@ -323,7 +324,6 @@ case __NR_rt_sigpending: case __NR_rt_sigqueueinfo: case __NR_rt_sigsuspend: - case __NR_rt_sigtimedwait: case __NR_rt_tgsigqueueinfo: case __NR_sigaltstack: #if !defined(__aarch64__)
diff --git a/sandbox/mac/mojom/mojom_traits_unittest.cc b/sandbox/mac/mojom/mojom_traits_unittest.cc index fc30101..8d44042e 100644 --- a/sandbox/mac/mojom/mojom_traits_unittest.cc +++ b/sandbox/mac/mojom/mojom_traits_unittest.cc
@@ -29,7 +29,7 @@ std::move(callback).Run(std::move(token)); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; sandbox::mac::mojom::TraitsTestServicePtr interface_ptr_; mojo::Binding<sandbox::mac::mojom::TraitsTestService> binding_;
diff --git a/services/audio/debug_recording_unittest.cc b/services/audio/debug_recording_unittest.cc index 311e59b..b12890a 100644 --- a/services/audio/debug_recording_unittest.cc +++ b/services/audio/debug_recording_unittest.cc
@@ -21,7 +21,7 @@ #include "services/service_manager/public/cpp/service_keepalive.h" #include "testing/gmock/include/gmock/gmock.h" -using testing::_; + using testing::_; using testing::Exactly; namespace audio { @@ -100,7 +100,7 @@ void DestroyDebugRecording() { remote_debug_recording_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(service_keepalive_.HasNoRefs()); } @@ -145,7 +145,7 @@ EXPECT_CALL(*mock_debug_recording_manager_, EnableDebugRecording(_)); remote_debug_recording_->Enable(std::move(remote_file_provider)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int id = 1; EXPECT_CALL( @@ -153,7 +153,7 @@ DoCreateWavFile(media::AudioDebugRecordingStreamType::kInput, id)); debug_recording_->CreateWavFile(media::AudioDebugRecordingStreamType::kInput, id, base::BindOnce(&FileCreated)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_CALL(*mock_debug_recording_manager_, DisableDebugRecording()); DestroyDebugRecording();
diff --git a/services/audio/device_notifier_unittest.cc b/services/audio/device_notifier_unittest.cc index 51cfb38..7986af76 100644 --- a/services/audio/device_notifier_unittest.cc +++ b/services/audio/device_notifier_unittest.cc
@@ -59,14 +59,14 @@ void DestroyDeviceNotifier() { remote_device_notifier_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(service_keepalive_.HasNoRefs()); } // service_manager::ServiceKeepalive::Observer: void OnIdleTimeout() override { OnNoServiceRefs(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::Remote<mojom::DeviceNotifier> remote_device_notifier_; private: @@ -90,20 +90,20 @@ EXPECT_CALL(listener, DevicesChanged()).Times(0); base::SystemMonitor::Get()->ProcessDevicesChanged( base::SystemMonitor::DEVTYPE_AUDIO); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Register the listener and simulate an audio-device event. remote_device_notifier_->RegisterListener(std::move(remote_device_listener)); EXPECT_CALL(listener, DevicesChanged()); base::SystemMonitor::Get()->ProcessDevicesChanged( base::SystemMonitor::DEVTYPE_AUDIO); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Simulate a video-device event, which should be ignored. EXPECT_CALL(listener, DevicesChanged()).Times(0); base::SystemMonitor::Get()->ProcessDevicesChanged( base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); DestroyDeviceNotifier(); }
diff --git a/services/audio/input_controller_unittest.cc b/services/audio/input_controller_unittest.cc index dd1fa6c..9ee986b 100644 --- a/services/audio/input_controller_unittest.cc +++ b/services/audio/input_controller_unittest.cc
@@ -105,8 +105,8 @@ }; // Parameter: use audio processing. -template <base::test::ScopedTaskEnvironment::TimeSource TimeSource = - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME> +template <base::test::TaskEnvironment::TimeSource TimeSource = + base::test::TaskEnvironment::TimeSource::MOCK_TIME> class TimeSourceInputControllerTest : public ::testing::TestWithParam<bool> { public: TimeSourceInputControllerTest() @@ -151,7 +151,7 @@ &stream_monitor_coordinator_, std::move(config_ptr)); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; StreamMonitorCoordinator stream_monitor_coordinator_; std::unique_ptr<InputController> controller_; @@ -170,7 +170,7 @@ }; using SystemTimeInputControllerTest = TimeSourceInputControllerTest< - base::test::ScopedTaskEnvironment::TimeSource::SYSTEM_TIME>; + base::test::TaskEnvironment::TimeSource::SYSTEM_TIME>; using InputControllerTest = TimeSourceInputControllerTest<>; TEST_P(InputControllerTest, CreateAndCloseWithoutRecording) {
diff --git a/services/audio/input_stream_unittest.cc b/services/audio/input_stream_unittest.cc index ec94109..5e85ac71 100644 --- a/services/audio/input_stream_unittest.cc +++ b/services/audio/input_stream_unittest.cc
@@ -198,7 +198,7 @@ MOCK_METHOD1(BadMessageCallback, void(const std::string&)); private: - base::test::ScopedTaskEnvironment scoped_task_env_; + base::test::TaskEnvironment scoped_task_env_; media::MockAudioManager audio_manager_; StreamFactory stream_factory_; mojo::Remote<mojom::StreamFactory> remote_stream_factory_;
diff --git a/services/audio/input_sync_writer_unittest.cc b/services/audio/input_sync_writer_unittest.cc index e7d34c6..1ff8ab4 100644 --- a/services/audio/input_sync_writer_unittest.cc +++ b/services/audio/input_sync_writer_unittest.cc
@@ -155,7 +155,7 @@ using MockLogger = base::MockCallback<base::RepeatingCallback<void(const std::string&)>>; - base::test::ScopedTaskEnvironment env_; + base::test::TaskEnvironment env_; MockLogger mock_logger_; std::unique_ptr<InputSyncWriter> writer_; MockCancelableSyncSocket* socket_;
diff --git a/services/audio/local_muter_unittest.cc b/services/audio/local_muter_unittest.cc index 4853fb2..661168e 100644 --- a/services/audio/local_muter_unittest.cc +++ b/services/audio/local_muter_unittest.cc
@@ -84,7 +84,7 @@ } TEST(LocalMuter, UnmutesWhenLastBindingIsLost) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; LoopbackCoordinator coordinator; const UnguessableToken group_id = UnguessableToken::Create();
diff --git a/services/audio/log_factory_manager_unittest.cc b/services/audio/log_factory_manager_unittest.cc index 6a910a0..cc3f294 100644 --- a/services/audio/log_factory_manager_unittest.cc +++ b/services/audio/log_factory_manager_unittest.cc
@@ -98,14 +98,14 @@ void DestroyLogFactoryManager() { remote_log_factory_manager_.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(service_keepalive_.HasNoRefs()); } // service_manager::ServiceKeepalive::Observer: void OnIdleTimeout() override { OnNoServiceRefs(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::Remote<mojom::LogFactoryManager> remote_log_factory_manager_; std::unique_ptr<LogFactoryManager> log_factory_manager_; @@ -146,7 +146,7 @@ EXPECT_CALL(*mock_log1, OnStopped()); EXPECT_CALL(*mock_log1, OnClosed()); remote_log_factory_manager_->SetLogFactory(std::move(remote_log_factory)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Create another log after the factory is already set. const int kComponentId2 = 2;
diff --git a/services/audio/loopback_stream_unittest.cc b/services/audio/loopback_stream_unittest.cc index 860eab37..ec8ab1d 100644 --- a/services/audio/loopback_stream_unittest.cc +++ b/services/audio/loopback_stream_unittest.cc
@@ -139,14 +139,14 @@ } sources_.clear(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } MockClientAndObserver* client() { return &client_; } LoopbackStream* stream() { return stream_.get(); } FakeSyncWriter* consumer() { return consumer_; } - void RunMojoTasks() { scoped_task_environment_.RunUntilIdle(); } + void RunMojoTasks() { task_environment_.RunUntilIdle(); } FakeLoopbackGroupMember* AddSource(int channels, int sample_rate) { sources_.emplace_back(std::make_unique<FakeLoopbackGroupMember>( @@ -183,7 +183,7 @@ base::BindOnce([](LoopbackStreamTest* self, LoopbackStream* stream) { self->stream_ = nullptr; }, this), - scoped_task_environment_.GetMainThreadTaskRunner(), + task_environment_.GetMainThreadTaskRunner(), remote_input_stream_.BindNewPipeAndPassReceiver(), std::move(client), std::move(observer), GetLoopbackStreamParams(), // The following argument is the |shared_memory_count|, which does not @@ -193,7 +193,7 @@ // Override the clock used by the LoopbackStream so that everything is // single-threaded and synchronized with the driving code in these tests. - stream_->set_clock_for_testing(scoped_task_environment_.GetMockTickClock()); + stream_->set_clock_for_testing(task_environment_.GetMockTickClock()); // Redirect the output of the LoopbackStream to a FakeSyncWriter. // LoopbackStream takes ownership of the FakeSyncWriter. @@ -234,14 +234,14 @@ // Render audio meant for local output at some point in the near // future. const base::TimeTicks output_timestamp = - scoped_task_environment_.NowTicks() + kDelayUntilOutput; + task_environment_.NowTicks() + kDelayUntilOutput; for (const auto& source : sources_) { source->RenderMoreAudio(output_timestamp); } // Move the task runner forward, which will cause the FlowNetwork's // delayed tasks to run, which will generate output for the consumer. - scoped_task_environment_.FastForwardBy(kBufferDuration); + task_environment_.FastForwardBy(kBufferDuration); } while (consumer_->GetRecordedFrameCount() < min_frames_to_record); } @@ -251,8 +251,8 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; LoopbackCoordinator coordinator_; const base::UnguessableToken group_id_; std::vector<std::unique_ptr<FakeLoopbackGroupMember>> sources_;
diff --git a/services/audio/output_stream_unittest.cc b/services/audio/output_stream_unittest.cc index 902d480..0748de9 100644 --- a/services/audio/output_stream_unittest.cc +++ b/services/audio/output_stream_unittest.cc
@@ -183,7 +183,7 @@ } private: - base::test::ScopedTaskEnvironment tasks_; + base::test::TaskEnvironment tasks_; media::MockAudioManager audio_manager_; StreamFactory stream_factory_; mojo::Remote<mojom::StreamFactory> remote_stream_factory_;
diff --git a/services/audio/public/cpp/input_ipc_unittest.cc b/services/audio/public/cpp/input_ipc_unittest.cc index 2642798..c22dde0a 100644 --- a/services/audio/public/cpp/input_ipc_unittest.cc +++ b/services/audio/public/cpp/input_ipc_unittest.cc
@@ -113,7 +113,7 @@ class InputIPCTest : public ::testing::Test { public: - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<audio::InputIPC> ipc; const media::AudioParameters audioParameters = media::AudioParameters(media::AudioParameters::AUDIO_PCM_LINEAR, @@ -123,10 +123,9 @@ protected: InputIPCTest() - : scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) {} + : task_environment( + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} std::unique_ptr<StrictMock<TestStreamFactory>> factory_; void SetUp() override { @@ -142,14 +141,14 @@ StrictMock<MockDelegate> delegate; EXPECT_CALL(delegate, GotOnStreamCreated(_)); ipc->CreateStream(&delegate, audioParameters, false, 0); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } TEST_F(InputIPCTest, StreamCreatedAfterCloseIsIgnored) { StrictMock<MockDelegate> delegate; ipc->CreateStream(&delegate, audioParameters, false, 0); ipc->CloseStream(); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } TEST_F(InputIPCTest, CreateStreamPropagatesInitiallyMuted) { @@ -158,16 +157,16 @@ factory_->initially_muted_ = true; EXPECT_CALL(delegate, GotOnStreamCreated(true)); ipc->CreateStream(&delegate, audioParameters, false, 0); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); ipc->CloseStream(); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); factory_->initially_muted_ = false; EXPECT_CALL(delegate, GotOnStreamCreated(false)); ipc->CreateStream(&delegate, audioParameters, false, 0); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); ipc->CloseStream(); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } TEST_F(InputIPCTest, MutedStateChangesPropagates) { @@ -175,26 +174,26 @@ EXPECT_CALL(delegate, GotOnStreamCreated(_)); ipc->CreateStream(&delegate, audioParameters, false, 0); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); EXPECT_CALL(delegate, OnMuted(true)); factory_->client_->OnMutedStateChanged(true); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); EXPECT_CALL(delegate, OnMuted(false)); factory_->client_->OnMutedStateChanged(false); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } TEST_F(InputIPCTest, Record_Records) { StrictMock<MockDelegate> delegate; EXPECT_CALL(delegate, GotOnStreamCreated(_)); ipc->CreateStream(&delegate, audioParameters, false, 0); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); EXPECT_CALL(factory_->stream_, Record()); ipc->RecordStream(); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } TEST_F(InputIPCTest, IsReusable) { @@ -202,10 +201,10 @@ StrictMock<MockDelegate> delegate; EXPECT_CALL(delegate, GotOnStreamCreated(_)); ipc->CreateStream(&delegate, audioParameters, false, 0); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); ipc->CloseStream(); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); testing::Mock::VerifyAndClearExpectations(&delegate); } @@ -215,11 +214,11 @@ StrictMock<MockDelegate> delegate; EXPECT_CALL(delegate, GotOnStreamCreated(_)); ipc->CreateStream(&delegate, audioParameters, false, 0); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); EXPECT_CALL(factory_->stream_, SetVolume(kNewVolume)); ipc->SetVolume(kNewVolume); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } TEST_F(InputIPCTest, SetOutputDeviceForAec_AssociatesInputAndOutputForAec) { @@ -227,11 +226,11 @@ StrictMock<MockDelegate> delegate; EXPECT_CALL(delegate, GotOnStreamCreated(_)); ipc->CreateStream(&delegate, audioParameters, false, 0); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); EXPECT_CALL(*factory_, AssociateInputAndOutputForAec(_, kOutputDeviceId)); ipc->SetOutputDeviceForAec(kOutputDeviceId); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } TEST_F(InputIPCTest, FailedStreamCreationNullCallback) { @@ -239,7 +238,7 @@ EXPECT_CALL(delegate, OnError()).Times(2); factory_->should_fail_ = true; ipc->CreateStream(&delegate, audioParameters, false, 0); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } TEST_F(InputIPCTest, FailedStreamCreationDestuctedFactory) { @@ -247,7 +246,7 @@ EXPECT_CALL(delegate, OnError()); factory_ = nullptr; ipc->CreateStream(&delegate, audioParameters, false, 0); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } } // namespace audio
diff --git a/services/audio/public/cpp/output_device_unittest.cc b/services/audio/public/cpp/output_device_unittest.cc index a975435..2c7b95ad 100644 --- a/services/audio/public/cpp/output_device_unittest.cc +++ b/services/audio/public/cpp/output_device_unittest.cc
@@ -140,9 +140,9 @@ class AudioServiceOutputDeviceTest : public testing::Test { public: AudioServiceOutputDeviceTest() - : task_env_(base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) { + : task_env_( + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) { stream_factory_ = std::make_unique<FakeOutputStreamFactory>(); } @@ -157,7 +157,7 @@ return stream_factory_->receiver_.BindNewPipeAndPassRemote(); } - base::test::ScopedTaskEnvironment task_env_; + base::test::TaskEnvironment task_env_; std::unique_ptr<FakeOutputStreamFactory> stream_factory_; private:
diff --git a/services/audio/stream_factory_unittest.cc b/services/audio/stream_factory_unittest.cc index 257e624..8b99aa4 100644 --- a/services/audio/stream_factory_unittest.cc +++ b/services/audio/stream_factory_unittest.cc
@@ -20,7 +20,7 @@ // Stream creation is tested as part of the stream unit tests. TEST(AudioServiceStreamFactoryTest, TakesServiceRef) { - base::test::ScopedTaskEnvironment env; + base::test::TaskEnvironment env; service_manager::ServiceKeepalive keepalive{nullptr, base::nullopt}; media::MockAudioManager audio_manager( std::make_unique<media::TestAudioThread>());
diff --git a/services/audio/sync_reader_unittest.cc b/services/audio/sync_reader_unittest.cc index b4410fc..370e20f 100644 --- a/services/audio/sync_reader_unittest.cc +++ b/services/audio/sync_reader_unittest.cc
@@ -54,7 +54,7 @@ ~SyncReaderBitstreamTest() override {} private: - base::test::ScopedTaskEnvironment env_; + base::test::TaskEnvironment env_; }; TEST_P(SyncReaderBitstreamTest, BitstreamBufferOverflow_DoesNotWriteOOB) {
diff --git a/services/audio/test/audio_system_to_service_adapter_test.cc b/services/audio/test/audio_system_to_service_adapter_test.cc index 6990ef0..88256db 100644 --- a/services/audio/test/audio_system_to_service_adapter_test.cc +++ b/services/audio/test/audio_system_to_service_adapter_test.cc
@@ -69,7 +69,7 @@ // AudioSystem conformance tests won't set expecnations. NiceMock<MockFunction<void(void)>> system_info_bind_requested_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<media::MockAudioManager> audio_manager_; std::unique_ptr<mojom::SystemInfo> system_info_impl_; std::unique_ptr<mojo::Receiver<mojom::SystemInfo>> system_info_receiver_; @@ -433,8 +433,8 @@ MOCK_METHOD0(ClientConnected, void(void)); MOCK_METHOD0(ClientDisconnected, void(void)); - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; const base::Optional<std::string> valid_reply_{kValidReplyId}; base::MockCallback<media::AudioSystem::OnDeviceIdCallback> response_received_; @@ -453,10 +453,10 @@ EXPECT_CALL(response_received_, Run(valid_reply_)); audio_system.GetAssociatedOutputDeviceID(kSomeDeviceId, response_received_.Get()); - scoped_task_environment_.FastForwardBy(kResponseDelay); + task_environment_.FastForwardBy(kResponseDelay); } EXPECT_CALL(*this, ClientDisconnected()); - scoped_task_environment_.FastForwardBy(kDisconnectTimeout); + task_environment_.FastForwardBy(kDisconnectTimeout); } TEST_F(AudioSystemToServiceAdapterDisconnectTest, @@ -469,10 +469,10 @@ EXPECT_CALL(response_received_, Run(valid_reply_)); audio_system.GetAssociatedOutputDeviceID(kSomeDeviceId, response_received_.Get()); - scoped_task_environment_.FastForwardBy(kResponseDelay); + task_environment_.FastForwardBy(kResponseDelay); } EXPECT_CALL(*this, ClientDisconnected()); - scoped_task_environment_.FastForwardBy(kDisconnectTimeout); + task_environment_.FastForwardBy(kDisconnectTimeout); } TEST_F(AudioSystemToServiceAdapterDisconnectTest, @@ -485,7 +485,7 @@ EXPECT_CALL(response_received_, Run(valid_reply_)); audio_system.GetAssociatedOutputDeviceID(kSomeDeviceId, response_received_.Get()); - scoped_task_environment_.FastForwardBy(kResponseDelay); + task_environment_.FastForwardBy(kResponseDelay); } { EXPECT_CALL(*this, ClientConnected()).Times(0); @@ -493,10 +493,10 @@ EXPECT_CALL(response_received_, Run(valid_reply_)); audio_system.GetAssociatedOutputDeviceID(kSomeDeviceId, response_received_.Get()); - scoped_task_environment_.FastForwardBy(kResponseDelay); + task_environment_.FastForwardBy(kResponseDelay); } EXPECT_CALL(*this, ClientDisconnected()); - scoped_task_environment_.FastForwardBy(kDisconnectTimeout); + task_environment_.FastForwardBy(kDisconnectTimeout); } TEST_F(AudioSystemToServiceAdapterDisconnectTest, @@ -507,7 +507,7 @@ EXPECT_CALL(response_received_, Run(valid_reply_)); audio_system.GetAssociatedOutputDeviceID(kSomeDeviceId, response_received_.Get()); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } } // namespace audio
diff --git a/services/audio/test/debug_recording_session_unittest.cc b/services/audio/test/debug_recording_session_unittest.cc index 3f2207b..b39cf1f 100644 --- a/services/audio/test/debug_recording_session_unittest.cc +++ b/services/audio/test/debug_recording_session_unittest.cc
@@ -71,7 +71,7 @@ protected: mojo::Remote<mojom::DebugRecordingFileProvider> remote_file_provider_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: std::unique_ptr<DebugRecordingSession::DebugRecordingFileProvider> @@ -95,7 +95,7 @@ static_cast<media::AudioManager*>(mock_audio_manager_.get()), connector_factory_.RegisterInstance(audio::mojom::kServiceName)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void TearDown() override { ShutdownAudioManager(); } @@ -106,14 +106,14 @@ std::make_unique<DebugRecordingSession>( base::FilePath(kBaseFileName), connector_factory_.CreateConnector())); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); return session; } void DestroyDebugRecordingSession( std::unique_ptr<DebugRecordingSession> debug_recording_session) { debug_recording_session.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } private: @@ -130,7 +130,7 @@ media::AudioDebugRecordingStreamType::kInput, id, base::BindOnce(&DebugRecordingFileProviderTest::FileCreated, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::FilePath file_name(GetFileName(kInput, id)); EXPECT_TRUE(base::PathExists(file_name)); @@ -144,7 +144,7 @@ media::AudioDebugRecordingStreamType::kOutput, id, base::BindOnce(&DebugRecordingFileProviderTest::FileCreated, base::Unretained(this))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::FilePath file_name(GetFileName(kOutput, id)); EXPECT_TRUE(base::PathExists(file_name)); @@ -161,7 +161,7 @@ base::BindOnce(&DebugRecordingFileProviderTest::FileCreated, base::Unretained(this))); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); for (uint32_t id : ids) { base::FilePath file_name(GetFileName(kOutput, id)); @@ -181,7 +181,7 @@ id, base::BindOnce(&DebugRecordingFileProviderTest::FileCreated, base::Unretained(this)))); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::FilePath file_name( GetFileName(NumberToStringType(invalid_stream_type), id));
diff --git a/services/audio/test/fake_consumer.cc b/services/audio/test/fake_consumer.cc index e7ada55..45eedc39 100644 --- a/services/audio/test/fake_consumer.cc +++ b/services/audio/test/fake_consumer.cc
@@ -122,9 +122,9 @@ void FakeConsumer::SaveToFile(const base::FilePath& path) const { // Not all tests set-up a full task environment. However, AudioDebugFileWriter // requires one. Provide a temporary one here, if necessary. - std::unique_ptr<base::test::ScopedTaskEnvironment> task_environment; + std::unique_ptr<base::test::TaskEnvironment> task_environment; if (!base::ThreadPoolInstance::Get()) { - task_environment = std::make_unique<base::test::ScopedTaskEnvironment>(); + task_environment = std::make_unique<base::test::TaskEnvironment>(); } const media::AudioParameters params(
diff --git a/services/audio/test/in_process_service_test.cc b/services/audio/test/in_process_service_test.cc index e498690..1fff855 100644 --- a/services/audio/test/in_process_service_test.cc +++ b/services/audio/test/in_process_service_test.cc
@@ -171,7 +171,7 @@ media::AudioSystem* audio_system() { return audio_system_.get(); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestServiceManager test_service_manager_; media::MockAudioManager audio_manager_; std::unique_ptr<ServiceTestHelper> helper_;
diff --git a/services/audio/test/service_lifetime_connector_test.cc b/services/audio/test/service_lifetime_connector_test.cc index ffc868db..4dcfade 100644 --- a/services/audio/test/service_lifetime_connector_test.cc +++ b/services/audio/test/service_lifetime_connector_test.cc
@@ -53,8 +53,8 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; StrictMock<base::MockCallback<base::RepeatingClosure>> quit_request_; std::unique_ptr<media::MockAudioManager> audio_manager_; @@ -84,7 +84,7 @@ connector_factory.RegisterInstance(mojom::kServiceName)); service_->set_termination_closure(quit_request_.Get()); connector_ = connector_factory.CreateConnector(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); mojom::SystemInfoPtr info; connector_->BindInterface(mojom::kServiceName, &info); @@ -101,13 +101,13 @@ // Make sure the service does not disconnect before a timeout. EXPECT_CALL(quit_request_, Run()).Times(Exactly(0)); info.reset(); - scoped_task_environment_.FastForwardBy(default_timeout / 2); + task_environment_.FastForwardBy(default_timeout / 2); } // Now wait for what is left from of the timeout: the service should // disconnect. EXPECT_CALL(quit_request_, Run()).Times(Exactly(1)); - scoped_task_environment_.FastForwardBy(default_timeout / 2); + task_environment_.FastForwardBy(default_timeout / 2); service_.reset(); } @@ -125,7 +125,7 @@ connector_factory.RegisterInstance(mojom::kServiceName)); service_->set_termination_closure(quit_request_.Get()); connector_ = connector_factory.CreateConnector(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); mojom::SystemInfoPtr info; connector_->BindInterface(mojom::kServiceName, &info); @@ -139,7 +139,7 @@ info.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); service_.reset(); } @@ -154,7 +154,7 @@ connector_factory.RegisterInstance(mojom::kServiceName)); service_->set_termination_closure(quit_request_.Get()); connector_ = connector_factory.CreateConnector(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); mojom::SystemInfoPtr info; connector_->BindInterface(mojom::kServiceName, &info); @@ -168,7 +168,7 @@ info.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); service_.reset(); } @@ -180,7 +180,7 @@ connector_->BindInterface(mojom::kServiceName, &info); EXPECT_TRUE(info.is_bound()); - scoped_task_environment_.FastForwardBy(kQuitTimeout * 2); + task_environment_.FastForwardBy(kQuitTimeout * 2); EXPECT_TRUE(info.is_bound()); } @@ -193,12 +193,12 @@ // Make sure the service does not disconnect before a timeout. EXPECT_CALL(quit_request_, Run()).Times(Exactly(0)); info.reset(); - scoped_task_environment_.FastForwardBy(kQuitTimeout / 2); + task_environment_.FastForwardBy(kQuitTimeout / 2); } // Now wait for what is left from of the timeout: the service should // disconnect. EXPECT_CALL(quit_request_, Run()).Times(Exactly(1)); - scoped_task_environment_.FastForwardBy(kQuitTimeout / 2); + task_environment_.FastForwardBy(kQuitTimeout / 2); } TEST_F(AudioServiceLifetimeConnectorTest, @@ -215,7 +215,7 @@ connector_->BindInterface(mojom::kServiceName, &info2); EXPECT_TRUE(info2.is_bound()); - scoped_task_environment_.FastForwardBy(kQuitTimeout); + task_environment_.FastForwardBy(kQuitTimeout); EXPECT_TRUE(info2.is_bound()); } @@ -231,21 +231,21 @@ connector_->BindInterface(mojom::kServiceName, &info2); EXPECT_TRUE(info2.is_bound()); - scoped_task_environment_.FastForwardBy(kQuitTimeout); + task_environment_.FastForwardBy(kQuitTimeout); EXPECT_TRUE(info1.is_bound()); EXPECT_TRUE(info2.is_bound()); info1.reset(); EXPECT_TRUE(info2.is_bound()); - scoped_task_environment_.FastForwardBy(kQuitTimeout); + task_environment_.FastForwardBy(kQuitTimeout); EXPECT_FALSE(info1.is_bound()); EXPECT_TRUE(info2.is_bound()); } // Now disconnect the last client and wait for service quit request. EXPECT_CALL(quit_request_, Run()).Times(Exactly(1)); info2.reset(); - scoped_task_environment_.FastForwardBy(kQuitTimeout); + task_environment_.FastForwardBy(kQuitTimeout); } TEST_F(AudioServiceLifetimeConnectorTest, @@ -258,15 +258,15 @@ connector_->BindInterface(mojom::kServiceName, &info1); EXPECT_TRUE(info1.is_bound()); info1.reset(); - scoped_task_environment_.FastForwardBy(kQuitTimeout * 0.75); + task_environment_.FastForwardBy(kQuitTimeout * 0.75); connector_->BindInterface(mojom::kServiceName, &info2); EXPECT_TRUE(info2.is_bound()); info2.reset(); - scoped_task_environment_.FastForwardBy(kQuitTimeout * 0.75); + task_environment_.FastForwardBy(kQuitTimeout * 0.75); } EXPECT_CALL(quit_request_, Run()).Times(Exactly(1)); - scoped_task_environment_.FastForwardBy(kQuitTimeout * 0.25); + task_environment_.FastForwardBy(kQuitTimeout * 0.25); } } // namespace audio
diff --git a/services/audio/test/standalone_service_test.cc b/services/audio/test/standalone_service_test.cc index 9a495921..eb09631 100644 --- a/services/audio/test/standalone_service_test.cc +++ b/services/audio/test/standalone_service_test.cc
@@ -51,7 +51,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestServiceManager test_service_manager_; service_manager::TestService test_service_;
diff --git a/services/content/public/cpp/test/fake_navigable_contents_factory_unittest.cc b/services/content/public/cpp/test/fake_navigable_contents_factory_unittest.cc index b8e5d56..fa95592 100644 --- a/services/content/public/cpp/test/fake_navigable_contents_factory_unittest.cc +++ b/services/content/public/cpp/test/fake_navigable_contents_factory_unittest.cc
@@ -34,7 +34,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; mojo::Remote<mojom::NavigableContentsFactory> remote_factory_; FakeNavigableContentsFactory factory_;
diff --git a/services/content/service_unittest.cc b/services/content/service_unittest.cc index c4e9c1a..fd41e75 100644 --- a/services/content/service_unittest.cc +++ b/services/content/service_unittest.cc
@@ -129,7 +129,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestConnectorFactory connector_factory_; TestServiceDelegate delegate_; Service service_;
diff --git a/services/data_decoder/bundled_exchanges_parser_factory_unittest.cc b/services/data_decoder/bundled_exchanges_parser_factory_unittest.cc index 814d210c..3c71ed8 100644 --- a/services/data_decoder/bundled_exchanges_parser_factory_unittest.cc +++ b/services/data_decoder/bundled_exchanges_parser_factory_unittest.cc
@@ -52,7 +52,7 @@ private: std::unique_ptr<BundledExchangesParserFactory> factory_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(BundledExchangesParserFactoryTest, GetSize) {
diff --git a/services/data_decoder/bundled_exchanges_parser_unittest.cc b/services/data_decoder/bundled_exchanges_parser_unittest.cc index cf32b07..03fbdec 100644 --- a/services/data_decoder/bundled_exchanges_parser_unittest.cc +++ b/services/data_decoder/bundled_exchanges_parser_unittest.cc
@@ -256,7 +256,7 @@ class BundledExchangeParserTest : public testing::Test { private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(BundledExchangeParserTest, WrongMagic) {
diff --git a/services/data_decoder/image_decoder_impl_unittest.cc b/services/data_decoder/image_decoder_impl_unittest.cc index bea5c2fb..db0c29ef 100644 --- a/services/data_decoder/image_decoder_impl_unittest.cc +++ b/services/data_decoder/image_decoder_impl_unittest.cc
@@ -108,7 +108,7 @@ ImageDecoderImpl* decoder() { return &decoder_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ImageDecoderImpl decoder_; };
diff --git a/services/data_decoder/public/cpp/json_sanitizer_unittest.cc b/services/data_decoder/public/cpp/json_sanitizer_unittest.cc index aec6663..9332497 100644 --- a/services/data_decoder/public/cpp/json_sanitizer_unittest.cc +++ b/services/data_decoder/public/cpp/json_sanitizer_unittest.cc
@@ -46,7 +46,7 @@ void OnSuccess(const std::string& json); void OnError(const std::string& error); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; #if !defined(OS_ANDROID) TestingJsonParser::ScopedFactoryOverride factory_override_;
diff --git a/services/data_decoder/public/cpp/safe_bundled_exchanges_parser_unittest.cc b/services/data_decoder/public/cpp/safe_bundled_exchanges_parser_unittest.cc index 6446f20..7f8c63a1 100644 --- a/services/data_decoder/public/cpp/safe_bundled_exchanges_parser_unittest.cc +++ b/services/data_decoder/public/cpp/safe_bundled_exchanges_parser_unittest.cc
@@ -122,7 +122,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestDataDecoderService service_; };
diff --git a/services/data_decoder/public/cpp/testing_json_parser_unittest.cc b/services/data_decoder/public/cpp/testing_json_parser_unittest.cc index 16903a8d..910c611 100644 --- a/services/data_decoder/public/cpp/testing_json_parser_unittest.cc +++ b/services/data_decoder/public/cpp/testing_json_parser_unittest.cc
@@ -56,7 +56,7 @@ EXPECT_FALSE(error.empty()); } - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; TestingJsonParser::ScopedFactoryOverride factory_override_; bool did_success_ = false; bool did_error_ = false;
diff --git a/services/device/device_service_test_base.h b/services/device/device_service_test_base.h index 2343cf2..0bdf9c2b 100644 --- a/services/device/device_service_test_base.h +++ b/services/device/device_service_test_base.h
@@ -38,7 +38,7 @@ // by the child test fixture. void DestroyDeviceService(); - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; // Both of these task runners should be deprecated in favor of individual // components of the device service creating their own.
diff --git a/services/device/fingerprint/fingerprint_chromeos_unittest.cc b/services/device/fingerprint/fingerprint_chromeos_unittest.cc index 380c845..40454f1 100644 --- a/services/device/fingerprint/fingerprint_chromeos_unittest.cc +++ b/services/device/fingerprint/fingerprint_chromeos_unittest.cc
@@ -125,7 +125,7 @@ int get_records_results() { return get_records_results_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FingerprintChromeOS> fingerprint_; int get_records_results_ = 0;
diff --git a/services/device/generic_sensor/absolute_orientation_euler_angles_fusion_algorithm_using_accelerometer_and_magnetometer_unittest.cc b/services/device/generic_sensor/absolute_orientation_euler_angles_fusion_algorithm_using_accelerometer_and_magnetometer_unittest.cc index b11a5ed..6e1562a 100644 --- a/services/device/generic_sensor/absolute_orientation_euler_angles_fusion_algorithm_using_accelerometer_and_magnetometer_unittest.cc +++ b/services/device/generic_sensor/absolute_orientation_euler_angles_fusion_algorithm_using_accelerometer_and_magnetometer_unittest.cc
@@ -67,7 +67,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<FakePlatformSensorFusion> fake_fusion_sensor_; AbsoluteOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndMagnetometer* fusion_algorithm_;
diff --git a/services/device/generic_sensor/linear_acceleration_fusion_algorithm_using_accelerometer_unittest.cc b/services/device/generic_sensor/linear_acceleration_fusion_algorithm_using_accelerometer_unittest.cc index cd59e453..0943181d 100644 --- a/services/device/generic_sensor/linear_acceleration_fusion_algorithm_using_accelerometer_unittest.cc +++ b/services/device/generic_sensor/linear_acceleration_fusion_algorithm_using_accelerometer_unittest.cc
@@ -106,7 +106,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<FakePlatformSensorFusion> fake_fusion_sensor_; LinearAccelerationFusionAlgorithmUsingAccelerometer* fusion_algorithm_; };
diff --git a/services/device/generic_sensor/orientation_euler_angles_fusion_algorithm_using_quaternion_unittest.cc b/services/device/generic_sensor/orientation_euler_angles_fusion_algorithm_using_quaternion_unittest.cc index 4e88022..4554953 100644 --- a/services/device/generic_sensor/orientation_euler_angles_fusion_algorithm_using_quaternion_unittest.cc +++ b/services/device/generic_sensor/orientation_euler_angles_fusion_algorithm_using_quaternion_unittest.cc
@@ -26,7 +26,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<FakePlatformSensorFusion> fake_fusion_sensor_; OrientationEulerAnglesFusionAlgorithmUsingQuaternion* fusion_algorithm_; };
diff --git a/services/device/generic_sensor/orientation_quaternion_fusion_algorithm_using_euler_angles_unittest.cc b/services/device/generic_sensor/orientation_quaternion_fusion_algorithm_using_euler_angles_unittest.cc index 6622334..76d4a7c 100644 --- a/services/device/generic_sensor/orientation_quaternion_fusion_algorithm_using_euler_angles_unittest.cc +++ b/services/device/generic_sensor/orientation_quaternion_fusion_algorithm_using_euler_angles_unittest.cc
@@ -28,7 +28,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<FakePlatformSensorFusion> fake_fusion_sensor_; OrientationQuaternionFusionAlgorithmUsingEulerAngles* fusion_algorithm_; };
diff --git a/services/device/generic_sensor/platform_sensor_and_provider_unittest.cc b/services/device/generic_sensor/platform_sensor_and_provider_unittest.cc index cfb1558b..87d90a5 100644 --- a/services/device/generic_sensor/platform_sensor_and_provider_unittest.cc +++ b/services/device/generic_sensor/platform_sensor_and_provider_unittest.cc
@@ -26,7 +26,7 @@ std::unique_ptr<FakePlatformSensorProvider> provider_; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(PlatformSensorProviderTest); };
diff --git a/services/device/generic_sensor/platform_sensor_and_provider_unittest_linux.cc b/services/device/generic_sensor/platform_sensor_and_provider_unittest_linux.cc index 19f90a3..701bd74 100644 --- a/services/device/generic_sensor/platform_sensor_and_provider_unittest_linux.cc +++ b/services/device/generic_sensor/platform_sensor_and_provider_unittest_linux.cc
@@ -282,7 +282,7 @@ ASSERT_TRUE(success); // Make sure all tasks have been delivered (including SensorDeviceManager // notifying PlatformSensorProviderLinux of a device addition). - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Generates a "remove device" event by removed sensors' directory and @@ -298,10 +298,10 @@ ASSERT_TRUE(success); // Make sure all tasks have been delivered (including SensorDeviceManager // notifying PlatformSensorProviderLinux of a device removal). - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockSensorDeviceManager* manager_; std::unique_ptr<PlatformSensorProviderLinux> provider_;
diff --git a/services/device/generic_sensor/platform_sensor_and_provider_unittest_win.cc b/services/device/generic_sensor/platform_sensor_and_provider_unittest_win.cc index cc62c56..25fd0cf 100644 --- a/services/device/generic_sensor/platform_sensor_and_provider_unittest_win.cc +++ b/services/device/generic_sensor/platform_sensor_and_provider_unittest_win.cc
@@ -191,8 +191,7 @@ class PlatformSensorAndProviderTestWin : public ::testing::Test { public: PlatformSensorAndProviderTestWin() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} void SetUp() override { sensor_ = new NiceMock<MockISensor>(); @@ -287,7 +286,7 @@ events->AddRef(); sensor_events_.Attach(events); if (this->run_loop_) { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PlatformSensorAndProviderTestWin::QuitInnerLoop, base::Unretained(this))); @@ -301,7 +300,7 @@ .WillByDefault(Invoke([this](ISensorEvents* events) { sensor_events_.Reset(); if (this->run_loop_) { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PlatformSensorAndProviderTestWin::QuitInnerLoop, base::Unretained(this))); @@ -382,7 +381,7 @@ } base::win::ScopedCOMInitializer com_initializer_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<MockISensorManager> sensor_manager_; scoped_refptr<MockISensorCollection> sensor_collection_; scoped_refptr<MockISensor> sensor_;
diff --git a/services/device/generic_sensor/platform_sensor_fusion_unittest.cc b/services/device/generic_sensor/platform_sensor_fusion_unittest.cc index 3a48154..aa39c86 100644 --- a/services/device/generic_sensor/platform_sensor_fusion_unittest.cc +++ b/services/device/generic_sensor/platform_sensor_fusion_unittest.cc
@@ -90,7 +90,7 @@ EXPECT_TRUE(platform_sensor_fusion_callback_called_); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<FakePlatformSensorProvider> provider_; bool accelerometer_callback_called_ = false; scoped_refptr<FakePlatformSensor> accelerometer_;
diff --git a/services/device/generic_sensor/platform_sensor_provider_winrt_unittest.cc b/services/device/generic_sensor/platform_sensor_provider_winrt_unittest.cc index bdda78f..9017053 100644 --- a/services/device/generic_sensor/platform_sensor_provider_winrt_unittest.cc +++ b/services/device/generic_sensor/platform_sensor_provider_winrt_unittest.cc
@@ -43,7 +43,7 @@ // Tests that PlatformSensorProviderWinrt can successfully be instantiated // and passes the correct result to the CreateSensor callback. TEST(PlatformSensorProviderTestWinrt, SensorCreationReturnCheck) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; auto mock_sensor_reader_factory = std::make_unique<testing::NiceMock<MockSensorReaderFactory>>(); @@ -103,4 +103,4 @@ run_loop->Run(); } -} // namespace device \ No newline at end of file +} // namespace device
diff --git a/services/device/generic_sensor/platform_sensor_reader_winrt_unittests.cc b/services/device/generic_sensor/platform_sensor_reader_winrt_unittests.cc index 8ffe5bca..cd1d971 100644 --- a/services/device/generic_sensor/platform_sensor_reader_winrt_unittests.cc +++ b/services/device/generic_sensor/platform_sensor_reader_winrt_unittests.cc
@@ -541,7 +541,7 @@ class PlatformSensorReaderTestWinrt : public testing::Test { private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::win::ScopedCOMInitializer scoped_com_initializer_; }; @@ -1299,4 +1299,4 @@ fake_sensor->TriggerFakeSensorReading(reading); } -} // namespace device \ No newline at end of file +} // namespace device
diff --git a/services/device/generic_sensor/relative_orientation_euler_angles_fusion_algorithm_using_accelerometer_and_gyroscope_unittest.cc b/services/device/generic_sensor/relative_orientation_euler_angles_fusion_algorithm_using_accelerometer_and_gyroscope_unittest.cc index 8d99ff0c..838d542 100644 --- a/services/device/generic_sensor/relative_orientation_euler_angles_fusion_algorithm_using_accelerometer_and_gyroscope_unittest.cc +++ b/services/device/generic_sensor/relative_orientation_euler_angles_fusion_algorithm_using_accelerometer_and_gyroscope_unittest.cc
@@ -69,7 +69,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<FakePlatformSensorFusion> fake_fusion_sensor_; RelativeOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndGyroscope* fusion_algorithm_;
diff --git a/services/device/generic_sensor/relative_orientation_euler_angles_fusion_algorithm_using_accelerometer_unittest.cc b/services/device/generic_sensor/relative_orientation_euler_angles_fusion_algorithm_using_accelerometer_unittest.cc index 4c589f4..68300ac 100644 --- a/services/device/generic_sensor/relative_orientation_euler_angles_fusion_algorithm_using_accelerometer_unittest.cc +++ b/services/device/generic_sensor/relative_orientation_euler_angles_fusion_algorithm_using_accelerometer_unittest.cc
@@ -55,7 +55,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<FakePlatformSensorFusion> fake_fusion_sensor_; RelativeOrientationEulerAnglesFusionAlgorithmUsingAccelerometer* fusion_algorithm_;
diff --git a/services/device/geolocation/geolocation_provider_impl_unittest.cc b/services/device/geolocation/geolocation_provider_impl_unittest.cc index e941bcf..fa03439 100644 --- a/services/device/geolocation/geolocation_provider_impl_unittest.cc +++ b/services/device/geolocation/geolocation_provider_impl_unittest.cc
@@ -102,8 +102,7 @@ class GeolocationProviderTest : public testing::Test { protected: GeolocationProviderTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), arbitrator_(new FakeLocationProvider) { provider()->SetArbitratorForTesting(base::WrapUnique(arbitrator_)); } @@ -129,7 +128,7 @@ // test completes. base::ShadowingAtExitManager at_exit_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ThreadChecker thread_checker_;
diff --git a/services/device/geolocation/location_arbitrator_unittest.cc b/services/device/geolocation/location_arbitrator_unittest.cc index 2cbf5089..87b86b4 100644 --- a/services/device/geolocation/location_arbitrator_unittest.cc +++ b/services/device/geolocation/location_arbitrator_unittest.cc
@@ -162,7 +162,7 @@ const std::unique_ptr<MockLocationObserver> observer_; std::unique_ptr<TestingLocationArbitrator> arbitrator_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; };
diff --git a/services/device/geolocation/network_location_provider_unittest.cc b/services/device/geolocation/network_location_provider_unittest.cc index c23e11e..6ecb51d 100644 --- a/services/device/geolocation/network_location_provider_unittest.cc +++ b/services/device/geolocation/network_location_provider_unittest.cc
@@ -284,7 +284,7 @@ } } - const base::test::ScopedTaskEnvironment scoped_task_environment_; + const base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_url_loader_factory_; const scoped_refptr<MockWifiDataProvider> wifi_data_provider_; FakePositionCache position_cache_;
diff --git a/services/device/geolocation/position_cache_impl_perftest.cc b/services/device/geolocation/position_cache_impl_perftest.cc index 9a80117..fe5cce7 100644 --- a/services/device/geolocation/position_cache_impl_perftest.cc +++ b/services/device/geolocation/position_cache_impl_perftest.cc
@@ -20,8 +20,7 @@ class PositionCacheImplPerfTest : public ::testing::Test { public: PositionCacheImplPerfTest() - : task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), cache_(task_environment_.GetMockTickClock()) {} void SetUp() override { @@ -34,7 +33,7 @@ protected: static constexpr size_t kBatchSize = 5000; std::vector<std::pair<WifiData, mojom::Geoposition>> data_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; PositionCacheImpl cache_; };
diff --git a/services/device/geolocation/position_cache_impl_unittest.cc b/services/device/geolocation/position_cache_impl_unittest.cc index a7815f6..df3fd2de 100644 --- a/services/device/geolocation/position_cache_impl_unittest.cc +++ b/services/device/geolocation/position_cache_impl_unittest.cc
@@ -20,13 +20,12 @@ class PositionCacheImplTest : public ::testing::Test { public: PositionCacheImplTest() - : task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), network_change_notifier_(net::NetworkChangeNotifier::CreateMock()), cache_(task_environment_.GetMockTickClock()) {} protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_; PositionCacheImpl cache_; };
diff --git a/services/device/geolocation/public_ip_address_geolocator_unittest.cc b/services/device/geolocation/public_ip_address_geolocator_unittest.cc index 0fb69356..ba36854 100644 --- a/services/device/geolocation/public_ip_address_geolocator_unittest.cc +++ b/services/device/geolocation/public_ip_address_geolocator_unittest.cc
@@ -25,8 +25,7 @@ class PublicIpAddressGeolocatorTest : public testing::Test { public: PublicIpAddressGeolocatorTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), network_connection_tracker_( network::TestNetworkConnectionTracker::CreateInstance()) { notifier_.reset(new PublicIpAddressLocationNotifier( @@ -92,7 +91,7 @@ mojo::StrongBindingSet<mojom::Geolocation> binding_set_; // Test task runner. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // List of any Mojo bad-message errors raised. std::vector<std::string> bad_messages_;
diff --git a/services/device/geolocation/public_ip_address_location_notifier_unittest.cc b/services/device/geolocation/public_ip_address_location_notifier_unittest.cc index 0ad5b6c..cfb03615 100644 --- a/services/device/geolocation/public_ip_address_location_notifier_unittest.cc +++ b/services/device/geolocation/public_ip_address_location_notifier_unittest.cc
@@ -85,7 +85,7 @@ std::string body = base::StringPrintf(kNetworkResponseFormatString, latitude); test_url_loader_factory_.AddResponse(request_url, body, net::HTTP_OK); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); test_url_loader_factory_.ClearResponses(); } @@ -102,7 +102,7 @@ test_url_loader_factory_.AddResponse(request_url, std::string(), net::HTTP_INTERNAL_SERVER_ERROR); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); test_url_loader_factory_.ClearResponses(); } @@ -122,8 +122,8 @@ } // Use a TaskRunner on which we can fast-forward time. - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; // Test NetworkConnectionTracker instance. std::unique_ptr<network::TestNetworkConnectionTracker> @@ -198,7 +198,7 @@ network::TestNetworkConnectionTracker::GetInstance()->SetConnectionType( network::mojom::ConnectionType::CONNECTION_UNKNOWN); // Wait for the notifier to complete its delayed reaction. - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); // Now expect a network request and query_2 to return. RespondToFetchWithLatitude(2.0f); @@ -230,14 +230,14 @@ for (int i = 0; i < 10; ++i) { network::TestNetworkConnectionTracker::GetInstance()->SetConnectionType( network::mojom::ConnectionType::CONNECTION_UNKNOWN); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(5)); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(5)); } // Expect still no network request or callback. EXPECT_EQ(0, test_url_loader_factory_.NumPending()); EXPECT_FALSE(query_2.position().has_value()); // Wait longer. - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); // Now expect a network request & query_2 to return. RespondToFetchWithLatitude(2.0f); @@ -273,7 +273,7 @@ network::TestNetworkConnectionTracker::GetInstance()->SetConnectionType( network::mojom::ConnectionType::CONNECTION_UNKNOWN); // Wait for the notifier to complete its delayed reaction. - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); // Now expect a network request & fake a valid response. RespondToFetchWithLatitude(2.0f);
diff --git a/services/device/geolocation/wifi_data_provider_chromeos_unittest.cc b/services/device/geolocation/wifi_data_provider_chromeos_unittest.cc index a76e2bdd..737666f2 100644 --- a/services/device/geolocation/wifi_data_provider_chromeos_unittest.cc +++ b/services/device/geolocation/wifi_data_provider_chromeos_unittest.cc
@@ -19,8 +19,7 @@ class GeolocationChromeOsWifiDataProviderTest : public testing::Test { protected: GeolocationChromeOsWifiDataProviderTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { chromeos::shill_clients::InitializeFakes(); @@ -59,7 +58,7 @@ base::RunLoop().RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<WifiDataProviderChromeOs> provider_; chromeos::ShillManagerClient* manager_client_; chromeos::ShillManagerClient::TestInterface* manager_test_;
diff --git a/services/device/geolocation/wifi_data_provider_common_unittest.cc b/services/device/geolocation/wifi_data_provider_common_unittest.cc index 26aca3d..629d377 100644 --- a/services/device/geolocation/wifi_data_provider_common_unittest.cc +++ b/services/device/geolocation/wifi_data_provider_common_unittest.cc
@@ -87,8 +87,7 @@ class GeolocationWifiDataProviderCommonTest : public testing::Test { public: GeolocationWifiDataProviderCommonTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), wifi_data_callback_(base::DoNothing()) {} void TearDownProvider() { @@ -128,7 +127,7 @@ } protected: - const base::test::ScopedTaskEnvironment scoped_task_environment_; + const base::test::TaskEnvironment task_environment_; WifiDataProviderManager::WifiDataUpdateCallback wifi_data_callback_; scoped_refptr<WifiDataProviderCommonWithMock> provider_;
diff --git a/services/device/geolocation/wifi_data_provider_linux_unittest.cc b/services/device/geolocation/wifi_data_provider_linux_unittest.cc index 5098e38..cfbba14 100644 --- a/services/device/geolocation/wifi_data_provider_linux_unittest.cc +++ b/services/device/geolocation/wifi_data_provider_linux_unittest.cc
@@ -97,12 +97,11 @@ protected: GeolocationWifiDataProviderLinuxTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} // WifiDataProvider requires a task runner to be present. The |message_loop_| // is defined here, as it should outlive |wifi_provider_linux_|. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<dbus::MockBus> mock_bus_; scoped_refptr<dbus::MockObjectProxy> mock_network_manager_proxy_; scoped_refptr<dbus::MockObjectProxy> mock_access_point_proxy_;
diff --git a/services/device/geolocation/wifi_data_provider_win_unittest.cc b/services/device/geolocation/wifi_data_provider_win_unittest.cc index f3a3476..4baf1cdc 100644 --- a/services/device/geolocation/wifi_data_provider_win_unittest.cc +++ b/services/device/geolocation/wifi_data_provider_win_unittest.cc
@@ -14,8 +14,8 @@ TEST(GeolocationWifiDataProviderWinTest, CreateDestroy) { // WifiDataProvider requires a task runner to be present. - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); scoped_refptr<WifiDataProviderWin> instance(new WifiDataProviderWin); instance = NULL; SUCCEED();
diff --git a/services/device/hid/hid_connection_unittest.cc b/services/device/hid/hid_connection_unittest.cc index 1c36d49..edfa5cf 100644 --- a/services/device/hid/hid_connection_unittest.cc +++ b/services/device/hid/hid_connection_unittest.cc
@@ -149,8 +149,7 @@ class HidConnectionTest : public testing::Test { public: HidConnectionTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), io_thread_(base::TestIOThread::kAutoStart) {} protected: @@ -173,7 +172,7 @@ ASSERT_FALSE(device_guid_.empty()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::TestIOThread io_thread_; std::unique_ptr<HidService> service_; std::unique_ptr<UsbTestGadget> test_gadget_;
diff --git a/services/device/hid/hid_service_unittest.cc b/services/device/hid/hid_service_unittest.cc index 37bf89a..bf99069 100644 --- a/services/device/hid/hid_service_unittest.cc +++ b/services/device/hid/hid_service_unittest.cc
@@ -16,11 +16,10 @@ class HidServiceTest : public ::testing::Test { public: HidServiceTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<HidService> service_; };
diff --git a/services/device/hid/input_service_linux_unittest.cc b/services/device/hid/input_service_linux_unittest.cc index 0189809e..7d5dd37 100644 --- a/services/device/hid/input_service_linux_unittest.cc +++ b/services/device/hid/input_service_linux_unittest.cc
@@ -27,8 +27,8 @@ } // namespace TEST(InputServiceLinux, Simple) { - base::test::ScopedTaskEnvironment task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); InputServiceLinux* service = InputServiceLinux::GetInstance(); ASSERT_TRUE(service);
diff --git a/services/device/public/cpp/power_monitor/power_monitor_broadcast_source_unittest.cc b/services/device/public/cpp/power_monitor/power_monitor_broadcast_source_unittest.cc index f7827a6f..a8bf4e2 100644 --- a/services/device/public/cpp/power_monitor/power_monitor_broadcast_source_unittest.cc +++ b/services/device/public/cpp/power_monitor/power_monitor_broadcast_source_unittest.cc
@@ -35,7 +35,7 @@ return power_monitor_source_ptr_->client_for_testing(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: PowerMonitorBroadcastSource* power_monitor_source_ptr_;
diff --git a/services/device/serial/serial_device_enumerator_unittest.cc b/services/device/serial/serial_device_enumerator_unittest.cc index 7db84f65..7b9918a 100644 --- a/services/device/serial/serial_device_enumerator_unittest.cc +++ b/services/device/serial/serial_device_enumerator_unittest.cc
@@ -16,12 +16,11 @@ class SerialDeviceEnumeratorTest : public testing::Test { public: SerialDeviceEnumeratorTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} ~SerialDeviceEnumeratorTest() override = default; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(SerialDeviceEnumeratorTest, GetDevices) {
diff --git a/services/device/usb/usb_device_handle_unittest.cc b/services/device/usb/usb_device_handle_unittest.cc index 0fca89e..547e0972 100644 --- a/services/device/usb/usb_device_handle_unittest.cc +++ b/services/device/usb/usb_device_handle_unittest.cc
@@ -31,13 +31,12 @@ class UsbDeviceHandleTest : public ::testing::Test { public: UsbDeviceHandleTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), usb_service_(UsbService::Create()), io_thread_(base::TestIOThread::kAutoStart) {} protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<UsbService> usb_service_; base::TestIOThread io_thread_; };
diff --git a/services/device/usb/usb_service_unittest.cc b/services/device/usb/usb_service_unittest.cc index 062244de..71b49cf 100644 --- a/services/device/usb/usb_service_unittest.cc +++ b/services/device/usb/usb_service_unittest.cc
@@ -25,13 +25,12 @@ class UsbServiceTest : public ::testing::Test { public: UsbServiceTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), usb_service_(UsbService::Create()), io_thread_(base::TestIOThread::kAutoStart) {} protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<UsbService> usb_service_; base::TestIOThread io_thread_; };
diff --git a/services/identity/identity_accessor_impl_unittest.cc b/services/identity/identity_accessor_impl_unittest.cc index 1aa6967..53b7414 100644 --- a/services/identity/identity_accessor_impl_unittest.cc +++ b/services/identity/identity_accessor_impl_unittest.cc
@@ -106,7 +106,7 @@ identity_accessor_.set_connection_error_handler(handler); } - base::test::ScopedTaskEnvironment task_environemnt_; + base::test::TaskEnvironment task_environemnt_; mojom::IdentityAccessorPtr identity_accessor_; base::Optional<CoreAccountInfo> primary_account_info_;
diff --git a/services/image_annotation/annotator_unittest.cc b/services/image_annotation/annotator_unittest.cc index 730d4f41..736788a02 100644 --- a/services/image_annotation/annotator_unittest.cc +++ b/services/image_annotation/annotator_unittest.cc
@@ -384,8 +384,8 @@ // Test that annotation works for one client, and that the cache is populated. TEST(AnnotatorTest, OcrSuccessAndCache) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -490,8 +490,8 @@ // Test that description annotations are successfully returned. TEST(AnnotatorTest, DescriptionSuccess) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -597,8 +597,8 @@ // Test that the specialized OCR result takes precedence. TEST(AnnotatorTest, DoubleOcrResult) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -712,8 +712,8 @@ // Test that HTTP failure is gracefully handled. TEST(AnnotatorTest, HttpError) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -767,8 +767,8 @@ // Test that backend failure is gracefully handled. TEST(AnnotatorTest, BackendError) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -850,8 +850,8 @@ // Test that partial results are returned if the OCR backend fails. TEST(AnnotatorTest, OcrBackendError) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -944,8 +944,8 @@ // Test that partial results are returned if the description backend fails. TEST(AnnotatorTest, DescriptionBackendError) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -1034,8 +1034,8 @@ // Test that server failure (i.e. nonsense response) is gracefully handled. TEST(AnnotatorTest, ServerError) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -1092,8 +1092,8 @@ // Test that adult content returns an error. TEST(AnnotatorTest, AdultError) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -1167,8 +1167,8 @@ // Test that work is reassigned if a processor fails. TEST(AnnotatorTest, ProcessorFails) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -1247,8 +1247,8 @@ // Test a case that was previously buggy: when one client requests annotations, // then fails local processing, then another client makes the same request. TEST(AnnotatorTest, ProcessorFailedPreviously) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -1316,8 +1316,8 @@ // Test that work is reassigned if processor dies. TEST(AnnotatorTest, ProcessorDies) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -1391,8 +1391,8 @@ // Test that multiple concurrent requests are handled in the same batch. TEST(AnnotatorTest, ConcurrentSameBatch) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -1478,8 +1478,8 @@ // Test that multiple concurrent requests are handled in separate batches. TEST(AnnotatorTest, ConcurrentSeparateBatches) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -1622,8 +1622,8 @@ // Test that work is not duplicated if it is already ongoing. TEST(AnnotatorTest, DuplicateWork) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -1730,8 +1730,8 @@ // Test that the description engine is not requested for images that violate // model policy (i.e. are too small or have too-high an aspect ratio). TEST(AnnotatorTest, DescPolicy) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -1932,8 +1932,8 @@ // Test that description language preferences are sent to the server. TEST(AnnotatorTest, DescLanguage) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); TestServerURLLoaderFactory test_url_factory( "https://ia-pa.googleapis.com/v1/"); data_decoder::TestDataDecoderService test_dd_service; @@ -2126,8 +2126,8 @@ // Test that the specified API key is sent, but only to Google-associated server // domains. TEST(AnnotatorTest, ApiKey) { - base::test::ScopedTaskEnvironment test_task_env( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); + base::test::TaskEnvironment test_task_env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); data_decoder::TestDataDecoderService test_dd_service; // A call to a secure Google-owner server URL should include the specified API
diff --git a/services/image_annotation/public/cpp/image_processor_unittest.cc b/services/image_annotation/public/cpp/image_processor_unittest.cc index 38154df..a1d049d 100644 --- a/services/image_annotation/public/cpp/image_processor_unittest.cc +++ b/services/image_annotation/public/cpp/image_processor_unittest.cc
@@ -91,7 +91,7 @@ } // namespace TEST(ImageProcessorTest, NullImage) { - base::test::ScopedTaskEnvironment test_task_env; + base::test::TaskEnvironment test_task_env; base::HistogramTester histogram_tester; bool empty_bytes = false; @@ -114,7 +114,7 @@ } TEST(ImageProcessorTest, ImageContent) { - base::test::ScopedTaskEnvironment test_task_env; + base::test::TaskEnvironment test_task_env; base::HistogramTester histogram_tester; // Create one image that doesn't need scaling and one image that does.
diff --git a/services/media_session/audio_focus_manager_unittest.cc b/services/media_session/audio_focus_manager_unittest.cc index 05e576c..33b0150 100644 --- a/services/media_session/audio_focus_manager_unittest.cc +++ b/services/media_session/audio_focus_manager_unittest.cc
@@ -264,7 +264,7 @@ audio_focus_remote_.FlushForTesting(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; base::HistogramTester histogram_tester_; service_manager::TestConnectorFactory connector_factory_;
diff --git a/services/media_session/media_controller_unittest.cc b/services/media_session/media_controller_unittest.cc index 9ca1c27a..f6a74e5 100644 --- a/services/media_session/media_controller_unittest.cc +++ b/services/media_session/media_controller_unittest.cc
@@ -69,7 +69,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestConnectorFactory connector_factory_; std::unique_ptr<MediaSessionService> service_; mojo::Remote<mojom::AudioFocusManager> audio_focus_remote_;
diff --git a/services/media_session/media_session_service_unittest.cc b/services/media_session/media_session_service_unittest.cc index 67e84550..27347914 100644 --- a/services/media_session/media_session_service_unittest.cc +++ b/services/media_session/media_session_service_unittest.cc
@@ -17,7 +17,7 @@ ~MediaSessionTest() override = default; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(MediaSessionTest); };
diff --git a/services/network/cert_verifier_with_trust_anchors_unittest.cc b/services/network/cert_verifier_with_trust_anchors_unittest.cc index e7e1d6f1..343a3623 100644 --- a/services/network/cert_verifier_with_trust_anchors_unittest.cc +++ b/services/network/cert_verifier_with_trust_anchors_unittest.cc
@@ -35,8 +35,7 @@ CertVerifierWithTrustAnchorsTest() : trust_anchor_used_(false), test_nss_user_("user1"), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} ~CertVerifierWithTrustAnchorsTest() override {} @@ -132,7 +131,7 @@ bool trust_anchor_used_; crypto::ScopedTestNSSChromeOSUser test_nss_user_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(CertVerifierWithTrustAnchorsTest, VerifyUntrustedCert) {
diff --git a/services/network/chunked_data_pipe_upload_data_stream_unittest.cc b/services/network/chunked_data_pipe_upload_data_stream_unittest.cc index dfb0872..13c0b44 100644 --- a/services/network/chunked_data_pipe_upload_data_stream_unittest.cc +++ b/services/network/chunked_data_pipe_upload_data_stream_unittest.cc
@@ -55,8 +55,8 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; std::unique_ptr<TestChunkedDataPipeGetter> chunked_data_pipe_getter_; std::unique_ptr<ChunkedDataPipeUploadDataStream> chunked_upload_stream_;
diff --git a/services/network/cookie_manager.cc b/services/network/cookie_manager.cc index 6517ef2..fc0bc14 100644 --- a/services/network/cookie_manager.cc +++ b/services/network/cookie_manager.cc
@@ -231,6 +231,11 @@ cookie_settings_.set_block_third_party_cookies(block); } +void CookieManager::SetContentSettingsForLegacyCookieAccess( + const ContentSettingsForOneType& settings) { + cookie_settings_.set_content_settings_for_legacy_cookie_access(settings); +} + // static void CookieManager::ConfigureCookieSettings( const network::mojom::CookieManagerParams& params, @@ -243,6 +248,8 @@ params.matching_scheme_cookies_allowed_schemes); out->set_third_party_cookies_allowed_schemes( params.third_party_cookies_allowed_schemes); + out->set_content_settings_for_legacy_cookie_access( + params.settings_for_legacy_cookie_access); } void CookieManager::CrashOnGetCookieList() {
diff --git a/services/network/cookie_manager.h b/services/network/cookie_manager.h index 0d7a4a8..c5667882 100644 --- a/services/network/cookie_manager.h +++ b/services/network/cookie_manager.h
@@ -85,6 +85,8 @@ AllowFileSchemeCookiesCallback callback) override; void SetForceKeepSessionState() override; void BlockThirdPartyCookies(bool block) override; + void SetContentSettingsForLegacyCookieAccess( + const ContentSettingsForOneType& settings) override; // Configures |out| based on |params|. (This doesn't honor // allow_file_scheme_cookies, which affects the cookie store rather than the
diff --git a/services/network/cookie_manager_unittest.cc b/services/network/cookie_manager_unittest.cc index d358662a..cf42d918 100644 --- a/services/network/cookie_manager_unittest.cc +++ b/services/network/cookie_manager_unittest.cc
@@ -316,7 +316,7 @@ &CookieManagerTest::OnConnectionError, base::Unretained(this))); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: void OnConnectionError() { connection_error_seen_ = true; } @@ -2118,8 +2118,8 @@ scoped_refptr<SessionCleanupCookieStore> CreateCookieStore() { auto sqlite_store = base::MakeRefCounted<net::SQLitePersistentCookieStore>( temp_dir_.GetPath().Append(kTestCookiesFilename), - scoped_task_environment_.GetMainThreadTaskRunner(), - background_task_runner_, true, nullptr); + task_environment_.GetMainThreadTaskRunner(), background_task_runner_, + true, nullptr); return base::MakeRefCounted<SessionCleanupCookieStore>(sqlite_store.get()); }
diff --git a/services/network/cookie_settings.cc b/services/network/cookie_settings.cc index 0f56483..b3b0a14 100644 --- a/services/network/cookie_settings.cc +++ b/services/network/cookie_settings.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "net/base/net_errors.h" #include "net/base/static_cookie_policy.h" +#include "net/cookies/cookie_util.h" namespace network { namespace { @@ -30,10 +31,32 @@ std::cref(content_settings_)); } -void CookieSettings::GetCookieSetting(const GURL& url, - const GURL& first_party_url, - content_settings::SettingSource* source, - ContentSetting* cookie_setting) const { +void CookieSettings::GetSettingForLegacyCookieAccess( + const GURL& cookie_domain, + ContentSetting* setting) const { + DCHECK(setting); + + // Default to match what was registered in the ContentSettingsRegistry. + *setting = net::cookie_util::IsSameSiteByDefaultCookiesEnabled() + ? CONTENT_SETTING_BLOCK + : CONTENT_SETTING_ALLOW; + + for (const auto& entry : settings_for_legacy_cookie_access_) { + if (entry.primary_pattern.Matches(cookie_domain)) { + *setting = entry.GetContentSetting(); + DCHECK(IsValidSettingForLegacyAccess(*setting)); + return; + } + } +} + +void CookieSettings::GetCookieSettingInternal( + const GURL& url, + const GURL& first_party_url, + bool is_third_party_request, + content_settings::SettingSource* source, + ContentSetting* cookie_setting) const { + DCHECK(cookie_setting); if (base::Contains(secure_origin_cookies_allowed_schemes_, first_party_url.scheme()) && url.SchemeIsCryptographic()) { @@ -64,9 +87,7 @@ } } - net::StaticCookiePolicy policy( - net::StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES); - if (block_third && policy.CanAccessCookies(url, first_party_url) != net::OK) + if (block_third && is_third_party_request) *cookie_setting = CONTENT_SETTING_BLOCK; }
diff --git a/services/network/cookie_settings.h b/services/network/cookie_settings.h index 578af6b3..bd9cd4b 100644 --- a/services/network/cookie_settings.h +++ b/services/network/cookie_settings.h
@@ -53,6 +53,11 @@ third_party_cookies_allowed_schemes.end()); } + void set_content_settings_for_legacy_cookie_access( + const ContentSettingsForOneType& settings) { + settings_for_legacy_cookie_access_ = settings; + } + // Returns a predicate that takes the domain of a cookie and a bool whether // the cookie is secure and returns true if the cookie should be deleted on // exit. @@ -60,12 +65,17 @@ CreateDeleteCookieOnExitPredicate() const; // content_settings::CookieSettingsBase: - void GetCookieSetting(const GURL& url, - const GURL& first_party_url, - content_settings::SettingSource* source, - ContentSetting* cookie_setting) const override; + void GetSettingForLegacyCookieAccess(const GURL& cookie_domain, + ContentSetting* setting) const override; private: + // content_settings::CookieSettingsBase: + void GetCookieSettingInternal(const GURL& url, + const GURL& first_party_url, + bool is_third_party_request, + content_settings::SettingSource* source, + ContentSetting* cookie_setting) const override; + // Returns true if at least one content settings is session only. bool HasSessionOnlyOrigins() const; @@ -74,6 +84,7 @@ std::set<std::string> secure_origin_cookies_allowed_schemes_; std::set<std::string> matching_scheme_cookies_allowed_schemes_; std::set<std::string> third_party_cookies_allowed_schemes_; + ContentSettingsForOneType settings_for_legacy_cookie_access_; DISALLOW_COPY_AND_ASSIGN(CookieSettings); };
diff --git a/services/network/cookie_settings_unittest.cc b/services/network/cookie_settings_unittest.cc index d2e131ea..4e1dd28 100644 --- a/services/network/cookie_settings_unittest.cc +++ b/services/network/cookie_settings_unittest.cc
@@ -4,6 +4,10 @@ #include "services/network/cookie_settings.h" +#include "base/test/scoped_feature_list.h" +#include "net/base/features.h" +#include "net/cookies/cookie_constants.h" +#include "net/cookies/cookie_util.h" #include "testing/gtest/include/gtest/gtest.h" namespace network { @@ -11,14 +15,19 @@ constexpr char kURL[] = "http://foo.com"; constexpr char kOtherURL[] = "http://other.com"; +constexpr char kDomain[] = "example.com"; +constexpr char kDotDomain[] = ".example.com"; +constexpr char kSubDomain[] = "www.corp.example.com"; +constexpr char kOtherDomain[] = "not-example.com"; +constexpr char kDomainWildcardPattern[] = "[*.]example.com"; -ContentSettingPatternSource CreateSetting(const std::string& url, - const std::string& secondary_url, +ContentSettingPatternSource CreateSetting(const std::string& primary_pattern, + const std::string& secondary_pattern, ContentSetting setting) { return ContentSettingPatternSource( - ContentSettingsPattern::FromString(url), - ContentSettingsPattern::FromString(secondary_url), base::Value(setting), - std::string(), false); + ContentSettingsPattern::FromString(primary_pattern), + ContentSettingsPattern::FromString(secondary_pattern), + base::Value(setting), std::string(), false /* incognito */); } TEST(CookieSettingsTest, GetCookieSettingDefault) { @@ -186,5 +195,152 @@ EXPECT_EQ(setting, CONTENT_SETTING_BLOCK); } +TEST(CookieSettingsTest, LegacyCookieAccessDefault) { + CookieSettings settings; + ContentSetting setting; + GURL cookie_domain = + net::cookie_util::CookieOriginToURL(kDomain, true /* is_https */); + + // Test SameSite-by-default enabled (default semantics is NONLEGACY) + { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndEnableFeature(net::features::kSameSiteByDefaultCookies); + settings.GetSettingForLegacyCookieAccess(cookie_domain, &setting); + EXPECT_EQ(setting, CONTENT_SETTING_BLOCK); + EXPECT_EQ(net::CookieAccessSemantics::NONLEGACY, + settings.GetCookieAccessSemanticsForDomain(cookie_domain)); + } + + // Test SameSite-by-default disabled (default semantics is LEGACY) + // TODO(crbug.com/953306): Remove this when legacy code path is removed. + { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndDisableFeature( + net::features::kSameSiteByDefaultCookies); + settings.GetSettingForLegacyCookieAccess(cookie_domain, &setting); + EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); + EXPECT_EQ(net::CookieAccessSemantics::LEGACY, + settings.GetCookieAccessSemanticsForDomain(cookie_domain)); + } +} + +// Test SameSite-by-default disabled (default semantics is LEGACY) +// TODO(crbug.com/953306): Remove this when legacy code path is removed. +TEST(CookieSettingsTest, + CookieAccessSemanticsForDomain_SameSiteByDefaultDisabled) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndDisableFeature(net::features::kSameSiteByDefaultCookies); + CookieSettings settings; + settings.set_content_settings_for_legacy_cookie_access( + {CreateSetting(kDomain, "*", CONTENT_SETTING_BLOCK)}); + const struct { + net::CookieAccessSemantics status; + std::string cookie_domain; + } kTestCases[] = { + // These two test cases are NONLEGACY because they match the setting. + {net::CookieAccessSemantics::NONLEGACY, kDomain}, + {net::CookieAccessSemantics::NONLEGACY, kDotDomain}, + // These two test cases default into LEGACY. + // Subdomain does not match pattern. + {net::CookieAccessSemantics::LEGACY, kSubDomain}, + {net::CookieAccessSemantics::LEGACY, kOtherDomain}}; + for (const auto& test : kTestCases) { + EXPECT_EQ(test.status, settings.GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, true /* is_https */))); + EXPECT_EQ(test.status, settings.GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, false /* is_https */))); + } +} + +// Test SameSite-by-default enabled (default semantics is NONLEGACY) +TEST(CookieSettingsTest, + CookieAccessSemanticsForDomain_SameSiteByDefaultEnabled) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndEnableFeature(net::features::kSameSiteByDefaultCookies); + CookieSettings settings; + settings.set_content_settings_for_legacy_cookie_access( + {CreateSetting(kDomain, "*", CONTENT_SETTING_ALLOW)}); + const struct { + net::CookieAccessSemantics status; + std::string cookie_domain; + } kTestCases[] = { + // These two test cases are LEGACY because they match the setting. + {net::CookieAccessSemantics::LEGACY, kDomain}, + {net::CookieAccessSemantics::LEGACY, kDotDomain}, + // These two test cases default into NONLEGACY. + // Subdomain does not match pattern. + {net::CookieAccessSemantics::NONLEGACY, kSubDomain}, + {net::CookieAccessSemantics::NONLEGACY, kOtherDomain}}; + for (const auto& test : kTestCases) { + EXPECT_EQ(test.status, settings.GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, true /* is_https */))); + EXPECT_EQ(test.status, settings.GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, false /* is_https */))); + } +} + +// Test SameSite-by-default disabled (default semantics is LEGACY) +// TODO(crbug.com/953306): Remove this when legacy code path is removed. +TEST(CookieSettingsTest, + CookieAccessSemanticsForDomainWithWildcard_SameSiteByDefaultDisabled) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndDisableFeature(net::features::kSameSiteByDefaultCookies); + CookieSettings settings; + settings.set_content_settings_for_legacy_cookie_access( + {CreateSetting(kDomainWildcardPattern, "*", CONTENT_SETTING_BLOCK)}); + const struct { + net::CookieAccessSemantics status; + std::string cookie_domain; + } kTestCases[] = { + // These three test cases are NONLEGACY because they match the setting. + {net::CookieAccessSemantics::NONLEGACY, kDomain}, + {net::CookieAccessSemantics::NONLEGACY, kDotDomain}, + // Subdomain also matches pattern. + {net::CookieAccessSemantics::NONLEGACY, kSubDomain}, + // This test case defaults into LEGACY. + {net::CookieAccessSemantics::LEGACY, kOtherDomain}}; + for (const auto& test : kTestCases) { + EXPECT_EQ(test.status, settings.GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, true /* is_https */))); + EXPECT_EQ(test.status, settings.GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, false /* is_https */))); + } +} + +// Test SameSite-by-default enabled (default semantics is NONLEGACY) +TEST(CookieSettingsTest, + CookieAccessSemanticsForDomainWithWildcard_SameSiteByDefaultEnabled) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndEnableFeature(net::features::kSameSiteByDefaultCookies); + CookieSettings settings; + settings.set_content_settings_for_legacy_cookie_access( + {CreateSetting(kDomainWildcardPattern, "*", CONTENT_SETTING_ALLOW)}); + const struct { + net::CookieAccessSemantics status; + std::string cookie_domain; + } kTestCases[] = { + // These three test cases are LEGACY because they match the setting. + {net::CookieAccessSemantics::LEGACY, kDomain}, + {net::CookieAccessSemantics::LEGACY, kDotDomain}, + // Subdomain also matches pattern. + {net::CookieAccessSemantics::LEGACY, kSubDomain}, + // This test case defaults into NONLEGACY. + {net::CookieAccessSemantics::NONLEGACY, kOtherDomain}}; + for (const auto& test : kTestCases) { + EXPECT_EQ(test.status, settings.GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, true /* is_https */))); + EXPECT_EQ(test.status, settings.GetCookieAccessSemanticsForDomain( + net::cookie_util::CookieOriginToURL( + test.cookie_domain, false /* is_https */))); + } +} + } // namespace } // namespace network
diff --git a/services/network/cors/cors_url_loader_factory_unittest.cc b/services/network/cors/cors_url_loader_factory_unittest.cc index a03918d..a1aaee2 100644 --- a/services/network/cors/cors_url_loader_factory_unittest.cc +++ b/services/network/cors/cors_url_loader_factory_unittest.cc
@@ -38,8 +38,7 @@ class CorsURLLoaderFactoryTest : public testing::Test { public: CorsURLLoaderFactoryTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), resource_scheduler_(true) { net::URLRequestContextBuilder context_builder; context_builder.set_proxy_resolution_service( @@ -91,7 +90,7 @@ base::test::ScopedFeatureList feature_list_; // Test environment. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<net::URLRequestContext> url_request_context_; ResourceScheduler resource_scheduler_; std::unique_ptr<NetworkService> network_service_;
diff --git a/services/network/cors/cors_url_loader_unittest.cc b/services/network/cors/cors_url_loader_unittest.cc index 1c9bbba..2a96cf9d 100644 --- a/services/network/cors/cors_url_loader_unittest.cc +++ b/services/network/cors/cors_url_loader_unittest.cc
@@ -142,8 +142,7 @@ using ReferrerPolicy = net::URLRequest::ReferrerPolicy; CorsURLLoaderTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), resource_scheduler_(true) { net::URLRequestContextBuilder context_builder; context_builder.set_proxy_resolution_service( @@ -355,7 +354,7 @@ base::test::ScopedFeatureList feature_list_; // Test environment. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<net::URLRequestContext> url_request_context_; ResourceScheduler resource_scheduler_; std::unique_ptr<NetworkService> network_service_;
diff --git a/services/network/cors/preflight_controller_unittest.cc b/services/network/cors/preflight_controller_unittest.cc index e392cc1..f4696f2e 100644 --- a/services/network/cors/preflight_controller_unittest.cc +++ b/services/network/cors/preflight_controller_unittest.cc
@@ -221,8 +221,7 @@ class PreflightControllerTest : public testing::Test { public: PreflightControllerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { mojom::NetworkServicePtr network_service_ptr; mojom::NetworkServiceRequest network_service_request = mojo::MakeRequest(&network_service_ptr); @@ -310,7 +309,7 @@ return response; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; std::unique_ptr<mojom::NetworkService> network_service_;
diff --git a/services/network/cross_origin_read_blocking_unittest.cc b/services/network/cross_origin_read_blocking_unittest.cc index 66d63ba..8b31a4a 100644 --- a/services/network/cross_origin_read_blocking_unittest.cc +++ b/services/network/cross_origin_read_blocking_unittest.cc
@@ -2140,7 +2140,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::TestURLRequestContext context_; net::TestDelegate delegate_;
diff --git a/services/network/data_pipe_element_reader_unittest.cc b/services/network/data_pipe_element_reader_unittest.cc index 599c342..f5a825c1 100644 --- a/services/network/data_pipe_element_reader_unittest.cc +++ b/services/network/data_pipe_element_reader_unittest.cc
@@ -91,8 +91,8 @@ : element_reader_(nullptr, data_pipe_getter_.GetDataPipeGetterPtr()) {} protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; PassThroughDataPipeGetter data_pipe_getter_; DataPipeElementReader element_reader_; };
diff --git a/services/network/dns_config_change_manager_unittest.cc b/services/network/dns_config_change_manager_unittest.cc index 08945fa..343e43c 100644 --- a/services/network/dns_config_change_manager_unittest.cc +++ b/services/network/dns_config_change_manager_unittest.cc
@@ -62,7 +62,7 @@ TestDnsConfigChangeManagerClient* client() { return &client_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<net::NetworkChangeNotifier> notifier_mock_ = net::NetworkChangeNotifier::CreateMock(); DnsConfigChangeManager manager_;
diff --git a/services/network/expect_ct_reporter_unittest.cc b/services/network/expect_ct_reporter_unittest.cc index 3582294..e70d104 100644 --- a/services/network/expect_ct_reporter_unittest.cc +++ b/services/network/expect_ct_reporter_unittest.cc
@@ -291,8 +291,7 @@ class ExpectCTReporterWaitTest : public ::testing::Test { public: ExpectCTReporterWaitTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} void SetUp() override { // Initializes URLRequestContext after the thread is set up. @@ -326,7 +325,7 @@ private: TestExpectCTNetworkDelegate network_delegate_; std::unique_ptr<net::TestURLRequestContext> context_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(ExpectCTReporterWaitTest); }; @@ -381,8 +380,7 @@ {"Access-Control-Allow-Headers", "content-type,another-header"}}; ExpectCTReporterTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} ~ExpectCTReporterTest() override {} protected: @@ -443,7 +441,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::EmbeddedTestServer report_server_; };
diff --git a/services/network/host_resolver_unittest.cc b/services/network/host_resolver_unittest.cc index a87fc24..81eb261 100644 --- a/services/network/host_resolver_unittest.cc +++ b/services/network/host_resolver_unittest.cc
@@ -37,11 +37,10 @@ class HostResolverTest : public testing::Test { public: HostResolverTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; net::IPEndPoint CreateExpectedEndPoint(const std::string& address,
diff --git a/services/network/http_cache_data_counter_unittest.cc b/services/network/http_cache_data_counter_unittest.cc index 0f4a804..d5236dd 100644 --- a/services/network/http_cache_data_counter_unittest.cc +++ b/services/network/http_cache_data_counter_unittest.cc
@@ -61,8 +61,7 @@ class HttpCacheDataCounterTest : public testing::Test { public: HttpCacheDataCounterTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), network_service_(NetworkService::CreateForTesting()) {} ~HttpCacheDataCounterTest() override = default; @@ -104,7 +103,7 @@ ASSERT_TRUE(base::Time::FromString(test_entry.date, &time)); entry->SetLastUsedTimeForTest(time); entry->Close(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } @@ -183,7 +182,7 @@ std::move(context_params)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir cache_dir_; std::unique_ptr<NetworkService> network_service_; std::unique_ptr<NetworkContext> network_context_; @@ -215,8 +214,8 @@ // Return the sensible thing (0 bytes used) when there is no cache. TEST(HttpCacheDataCounterTestNoCache, BeSensible) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); std::unique_ptr<NetworkService> network_service( NetworkService::CreateForTesting()); std::unique_ptr<NetworkContext> network_context;
diff --git a/services/network/http_cache_data_remover_unittest.cc b/services/network/http_cache_data_remover_unittest.cc index db46765..6870cff2 100644 --- a/services/network/http_cache_data_remover_unittest.cc +++ b/services/network/http_cache_data_remover_unittest.cc
@@ -69,8 +69,7 @@ class HttpCacheDataRemoverTest : public testing::Test { public: HttpCacheDataRemoverTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), network_service_(NetworkService::CreateForTesting()) {} ~HttpCacheDataRemoverTest() override = default; @@ -102,7 +101,7 @@ ASSERT_TRUE(base::Time::FromString(test_entry.date, &time)); entry->SetLastUsedTimeForTest(time); entry->Close(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } ASSERT_EQ(base::size(kCacheEntries), static_cast<size_t>(backend_->GetEntryCount())); @@ -155,7 +154,7 @@ std::move(context_params)); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<NetworkService> network_service_; std::unique_ptr<NetworkContext> network_context_; @@ -338,7 +337,7 @@ // Delete the data remover and make sure after all task have been processed // that the callback wasn't invoked. data_remover.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(callback_invoked); }
diff --git a/services/network/mdns_responder_unittest.cc b/services/network/mdns_responder_unittest.cc index dd8d31f..1e982cb 100644 --- a/services/network/mdns_responder_unittest.cc +++ b/services/network/mdns_responder_unittest.cc
@@ -391,8 +391,7 @@ class MdnsResponderTest : public testing::Test { public: MdnsResponderTest() - : failing_socket_factory_( - scoped_task_environment_.GetMainThreadTaskRunner()) { + : failing_socket_factory_(task_environment_.GetMainThreadTaskRunner()) { Reset(); } @@ -415,8 +414,7 @@ host_manager_->SetNameGeneratorForTesting( std::make_unique<SimpleNameGenerator>()); - host_manager_->SetTickClockForTesting( - scoped_task_environment_.GetMockTickClock()); + host_manager_->SetTickClockForTesting(task_environment_.GetMockTickClock()); CreateMdnsResponders(); } @@ -478,14 +476,14 @@ } void RunUntilNoTasksRemain() { - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } void RunFor(base::TimeDelta duration) { - scoped_task_environment_.FastForwardBy(duration); + task_environment_.FastForwardBy(duration); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; // Overrides the current thread task runner, so we can simulate the passage // of time and avoid any actual sleeps. NiceMock<net::MockMDnsSocketFactory> socket_factory_;
diff --git a/services/network/mojo_host_resolver_impl_unittest.cc b/services/network/mojo_host_resolver_impl_unittest.cc index 02b2f68..7e5fac0 100644 --- a/services/network/mojo_host_resolver_impl_unittest.cc +++ b/services/network/mojo_host_resolver_impl_unittest.cc
@@ -125,7 +125,7 @@ } } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::MockHostResolver mock_host_resolver_; std::unique_ptr<MojoHostResolverImpl> resolver_service_;
diff --git a/services/network/network_change_manager_unittest.cc b/services/network/network_change_manager_unittest.cc index fca5f73..d1804fb8 100644 --- a/services/network/network_change_manager_unittest.cc +++ b/services/network/network_change_manager_unittest.cc
@@ -113,7 +113,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<NetworkChangeManager> network_change_manager_; std::unique_ptr<TestNetworkChangeManagerClient> network_change_manager_client_;
diff --git a/services/network/network_context.cc b/services/network/network_context.cc index ae8288e..9923e19a 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc
@@ -61,6 +61,7 @@ #include "net/traffic_annotation/network_traffic_annotation.h" #include "net/url_request/report_sender.h" #include "net/url_request/static_http_user_agent_settings.h" +#include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_builder.h" #include "services/network/cookie_manager.h" @@ -441,8 +442,9 @@ return allowed_from_caller && network_context_->cookie_manager() ->cookie_settings() - .IsCookieAccessAllowed(request.url(), - request.site_for_cookies()); + .IsCookieAccessAllowed( + request.url(), request.site_for_cookies(), + request.network_isolation_key().GetTopFrameOrigin()); } bool OnCanSetCookieInternal(const net::URLRequest& request, @@ -452,15 +454,18 @@ return allowed_from_caller && network_context_->cookie_manager() ->cookie_settings() - .IsCookieAccessAllowed(request.url(), - request.site_for_cookies()); + .IsCookieAccessAllowed( + request.url(), request.site_for_cookies(), + request.network_isolation_key().GetTopFrameOrigin()); } - bool OnForcePrivacyModeInternal(const GURL& url, - const GURL& site_for_cookies) const override { + bool OnForcePrivacyModeInternal( + const GURL& url, + const GURL& site_for_cookies, + const base::Optional<url::Origin>& top_frame_origin) const override { return !network_context_->cookie_manager() ->cookie_settings() - .IsCookieAccessAllowed(url, site_for_cookies); + .IsCookieAccessAllowed(url, site_for_cookies, top_frame_origin); } void OnResponseStartedInternal(net::URLRequest* request,
diff --git a/services/network/network_context_unittest.cc b/services/network/network_context_unittest.cc index f794703..e303ec7 100644 --- a/services/network/network_context_unittest.cc +++ b/services/network/network_context_unittest.cc
@@ -134,6 +134,8 @@ const GURL kURL("http://foo.com"); const GURL kOtherURL("http://other.com"); +const url::Origin kOrigin = url::Origin::Create(kURL); +const url::Origin kOtherOrigin = url::Origin::Create(kOtherURL); constexpr char kMockHost[] = "mock.host"; constexpr char kCustomProxyResponse[] = "CustomProxyResponse"; constexpr int kProcessId = 11; @@ -333,8 +335,7 @@ class NetworkContextTest : public testing::Test { public: NetworkContextTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), network_change_notifier_(net::NetworkChangeNotifier::CreateMock()), network_service_(NetworkService::CreateForTesting()) {} ~NetworkContextTest() override {} @@ -426,7 +427,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_; std::unique_ptr<NetworkService> network_service_; // Stores the NetworkContextPtr of the most recently created NetworkContext. @@ -838,7 +839,7 @@ CreateContextWithParams(std::move(context_params)); // Wait for properties to load from disk, and sanity check initial state. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(network_context->url_request_context() ->http_server_properties() ->GetSupportsSpdy(kSchemeHostPort)); @@ -850,7 +851,7 @@ // Deleting the context will cause it to flush state. Wait for the pref // service to flush to disk. network_context.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Create a new NetworkContext using the same path for HTTP server properties. context_params = mojom::NetworkContextParams::New(); @@ -858,7 +859,7 @@ network_context = CreateContextWithParams(std::move(context_params)); // Wait for properties to load from disk. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(network_context->url_request_context() ->http_server_properties() @@ -877,7 +878,7 @@ // Destroy the network context and let any pending writes complete before // destroying |temp_dir|, to avoid leaking any files. network_context.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(temp_dir.Delete()); } @@ -982,7 +983,7 @@ // Destroy the network context, and wait for all tasks to write state to // disk to finish running. network_context.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(on_disk, base::PathExists(transport_security_persister_file_path)); @@ -995,7 +996,7 @@ } network_context = CreateContextWithParams(std::move(context_params)); // Wait for the entry to load. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); state = network_context->url_request_context()->transport_security_state(); ASSERT_EQ(on_disk, state->GetDynamicSTSState(kDomain, &sts_state)); if (on_disk) @@ -2218,7 +2219,7 @@ for (const auto& proxy_config_set : proxy_config_sets) { config_client->OnProxyConfigUpdated(net::ProxyConfigWithAnnotation( proxy_config_set.proxy_config, TRAFFIC_ANNOTATION_FOR_TESTS)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); TestProxyLookupClient http_proxy_lookup_client2; http_proxy_lookup_client2.StartLookUpProxyForURL(GURL("http://foo"), @@ -2286,7 +2287,7 @@ TestProxyLookupClient ftp_proxy_lookup_client; ftp_proxy_lookup_client.StartLookUpProxyForURL(GURL("ftp://foo/"), network_context.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(proxy_resolution_service->config()); EXPECT_FALSE(proxy_resolution_service->fetched_config()); EXPECT_FALSE(http_proxy_lookup_client.is_done()); @@ -2324,7 +2325,7 @@ TestProxyLookupClient proxy_lookup_client; proxy_lookup_client.StartLookUpProxyForURL(GURL("http://foo/"), network_context.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1u, network_context->pending_proxy_lookup_requests_for_testing()); EXPECT_FALSE(proxy_lookup_client.is_done()); @@ -2351,14 +2352,14 @@ std::make_unique<TestProxyLookupClient>(); proxy_lookup_client->StartLookUpProxyForURL(GURL("http://foo/"), network_context.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(proxy_lookup_client->is_done()); EXPECT_EQ(1u, network_context->pending_proxy_lookup_requests_for_testing()); // Cancelling the proxy lookup should cause the proxy lookup request objects // to be deleted. proxy_lookup_client.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0u, network_context->pending_proxy_lookup_requests_for_testing()); } @@ -2623,7 +2624,7 @@ net_log_exporter = nullptr; block_mktemp.Signal(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(base::PathExists(path)); base::DeleteFile(temp_path, false); @@ -3128,7 +3129,7 @@ // Run a bit to ensure the resolve request makes it to the resolver. Otherwise // the resolver will be destroyed and close its pipe before it even knows // about the request to send a failure. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); bool control_handle_closed = false; auto connection_error_callback = @@ -3233,7 +3234,7 @@ EXPECT_FALSE(network_context->url_request_context() ->network_delegate() - ->ForcePrivacyMode(kURL, kOtherURL)); + ->ForcePrivacyMode(kURL, kOtherURL, kOtherOrigin)); } TEST_F(NetworkContextTest, PrivacyModeEnabledIfCookiesBlocked) { @@ -3244,10 +3245,10 @@ network_context.get()); EXPECT_TRUE(network_context->url_request_context() ->network_delegate() - ->ForcePrivacyMode(kURL, kOtherURL)); + ->ForcePrivacyMode(kURL, kOtherURL, kOtherOrigin)); EXPECT_FALSE(network_context->url_request_context() ->network_delegate() - ->ForcePrivacyMode(kOtherURL, kURL)); + ->ForcePrivacyMode(kOtherURL, kURL, kOrigin)); } TEST_F(NetworkContextTest, PrivacyModeDisabledIfCookiesAllowed) { @@ -3258,7 +3259,7 @@ network_context.get()); EXPECT_FALSE(network_context->url_request_context() ->network_delegate() - ->ForcePrivacyMode(kURL, kOtherURL)); + ->ForcePrivacyMode(kURL, kOtherURL, kOtherOrigin)); } TEST_F(NetworkContextTest, PrivacyModeDisabledIfCookiesSettingForOtherURL) { @@ -3270,7 +3271,7 @@ network_context.get()); EXPECT_FALSE(network_context->url_request_context() ->network_delegate() - ->ForcePrivacyMode(kURL, kOtherURL)); + ->ForcePrivacyMode(kURL, kOtherURL, kOtherOrigin)); } TEST_F(NetworkContextTest, PrivacyModeEnabledIfThirdPartyCookiesBlocked) { @@ -3280,12 +3281,12 @@ network_context->url_request_context()->network_delegate(); network_context->cookie_manager()->BlockThirdPartyCookies(true); - EXPECT_TRUE(delegate->ForcePrivacyMode(kURL, kOtherURL)); - EXPECT_FALSE(delegate->ForcePrivacyMode(kURL, kURL)); + EXPECT_TRUE(delegate->ForcePrivacyMode(kURL, kOtherURL, kOtherOrigin)); + EXPECT_FALSE(delegate->ForcePrivacyMode(kURL, kURL, kOrigin)); network_context->cookie_manager()->BlockThirdPartyCookies(false); - EXPECT_FALSE(delegate->ForcePrivacyMode(kURL, kOtherURL)); - EXPECT_FALSE(delegate->ForcePrivacyMode(kURL, kURL)); + EXPECT_FALSE(delegate->ForcePrivacyMode(kURL, kOtherURL, kOtherOrigin)); + EXPECT_FALSE(delegate->ForcePrivacyMode(kURL, kURL, kOrigin)); } TEST_F(NetworkContextTest, CanSetCookieFalseIfCookiesBlocked) { @@ -5005,7 +5006,7 @@ config->pre_cache_headers.SetHeader("pre_foo", "pre_foo_value"); config->post_cache_headers.SetHeader("post_foo", "post_foo_value"); proxy_config_client->OnCustomProxyConfigUpdated(std::move(config)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResourceRequest request; request.custom_proxy_pre_cache_headers.SetHeader("pre_bar", "pre_bar_value"); @@ -5059,14 +5060,14 @@ // is a redirect loop. config->can_use_proxy_on_http_url_redirect_cycles = false; proxy_config_client->OnCustomProxyConfigUpdated(std::move(config)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResourceRequest request; request.url = kUrl; request.render_frame_id = kRouteId; std::unique_ptr<TestURLLoaderClient> client = FetchRedirectedRequest( kRedirectCycle.size(), request, network_context.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::string response; EXPECT_TRUE( mojo::BlockingCopyToString(client->response_body_release(), &response)); @@ -5109,14 +5110,14 @@ // is a redirect loop. config->can_use_proxy_on_http_url_redirect_cycles = false; proxy_config_client->OnCustomProxyConfigUpdated(std::move(config)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResourceRequest request; request.url = kUrl1; request.render_frame_id = kRouteId; std::unique_ptr<TestURLLoaderClient> client = FetchRedirectedRequest( kRedirectCycle.size(), request, network_context.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::string response; EXPECT_TRUE( mojo::BlockingCopyToString(client->response_body_release(), &response)); @@ -5144,7 +5145,7 @@ config->pre_cache_headers.SetHeader("foo", "first_foo_key=value1"); config->post_cache_headers.SetHeader("bar", "first_bar_key=value2"); proxy_config_client->OnCustomProxyConfigUpdated(std::move(config)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResourceRequest request; request.custom_proxy_pre_cache_headers.SetHeader("foo", @@ -5187,7 +5188,7 @@ config->pre_cache_headers.SetHeader("foo", "foo_value"); config->post_cache_headers.SetHeader("bar", "bar_value"); proxy_config_client->OnCustomProxyConfigUpdated(config->Clone()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResourceRequest request; request.url = GetURLWithMockHost(test_server, "/echoheadercache?foo&bar"); @@ -5205,7 +5206,7 @@ // post_cache_headers should not break caching. config->post_cache_headers.SetHeader("bar", "new_bar"); proxy_config_client->OnCustomProxyConfigUpdated(config->Clone()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); client = FetchRequest(request, network_context.get()); EXPECT_TRUE( @@ -5217,7 +5218,7 @@ // pre_cache_headers should invalidate cache. config->pre_cache_headers.SetHeader("foo", "new_foo"); proxy_config_client->OnCustomProxyConfigUpdated(config->Clone()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); client = FetchRequest(request, network_context.get()); EXPECT_TRUE( @@ -5247,7 +5248,7 @@ net::ProxyServer proxy_server = ConvertToProxyServer(proxy_test_server); config->rules.ParseFromString("http=" + proxy_server.ToURI()); proxy_config_client->OnCustomProxyConfigUpdated(std::move(config)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResourceRequest request; request.url = GetURLWithMockHost(test_server, "/echoheadercache?foo&bar"); @@ -5303,7 +5304,7 @@ config->pre_cache_headers.SetHeader("pre_foo", "bad"); config->post_cache_headers.SetHeader("post_foo", "bad"); proxy_config_client->OnCustomProxyConfigUpdated(std::move(config)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResourceRequest request; request.custom_proxy_pre_cache_headers.SetHeader("pre_bar", "bad"); @@ -5349,7 +5350,7 @@ config->pre_cache_headers.SetHeader("pre_foo", "bad"); config->post_cache_headers.SetHeader("post_foo", "bad"); proxy_config_client->OnCustomProxyConfigUpdated(std::move(config)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResourceRequest request; request.custom_proxy_pre_cache_headers.SetHeader("pre_bar", "bad"); @@ -5384,7 +5385,7 @@ config->rules.ParseFromString( "http=" + ConvertToProxyServer(proxy_test_server).ToURI()); proxy_config_client->OnCustomProxyConfigUpdated(std::move(config)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResourceRequest request; request.url = GURL("http://does.not.resolve/echo"); @@ -5449,7 +5450,7 @@ // flag is set. config->can_use_proxy_on_http_url_redirect_cycles = false; proxy_config_client->OnCustomProxyConfigUpdated(std::move(config)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ResourceRequest request; request.url = GetURLWithMockHost(test_server, "/echo"); @@ -5457,7 +5458,7 @@ std::unique_ptr<TestURLLoaderClient> client = FetchRequest(request, network_context.get(), mojom::kURLLoadOptionNone, test_case.process_id); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); std::string response; EXPECT_TRUE( mojo::BlockingCopyToString(client->response_body_release(), &response)); @@ -5564,6 +5565,7 @@ ResourceRequest first_party_request; first_party_request.url = server_url; first_party_request.site_for_cookies = first_party_url; + first_party_request.top_frame_origin = url::Origin::Create(first_party_url); std::unique_ptr<TestURLLoaderClient> client = FetchRequest( first_party_request, network_context.get(), url_loader_options); @@ -5577,6 +5579,7 @@ ResourceRequest third_party_request; third_party_request.url = server_url; third_party_request.site_for_cookies = third_party_url; + third_party_request.top_frame_origin = url::Origin::Create(third_party_url); client = FetchRequest(third_party_request, network_context.get(), url_loader_options); @@ -5608,6 +5611,7 @@ ResourceRequest first_party_request; first_party_request.url = server_url; first_party_request.site_for_cookies = first_party_url; + first_party_request.top_frame_origin = url::Origin::Create(first_party_url); std::unique_ptr<TestURLLoaderClient> client = FetchRequest( first_party_request, network_context.get(), url_loader_options); @@ -5621,6 +5625,7 @@ ResourceRequest third_party_request; third_party_request.url = server_url; third_party_request.site_for_cookies = third_party_url; + third_party_request.top_frame_origin = url::Origin::Create(third_party_url); client = FetchRequest(third_party_request, network_context.get(), url_loader_options); @@ -5652,6 +5657,7 @@ ResourceRequest first_party_request; first_party_request.url = server_url; first_party_request.site_for_cookies = first_party_url; + first_party_request.top_frame_origin = url::Origin::Create(first_party_url); std::unique_ptr<TestURLLoaderClient> client = FetchRequest( first_party_request, network_context.get(), url_loader_options); @@ -5665,6 +5671,7 @@ ResourceRequest third_party_request; third_party_request.url = server_url; third_party_request.site_for_cookies = third_party_url; + third_party_request.top_frame_origin = url::Origin::Create(third_party_url); client = FetchRequest(third_party_request, network_context.get(), url_loader_options);
diff --git a/services/network/network_qualities_pref_delegate_unittest.cc b/services/network/network_qualities_pref_delegate_unittest.cc index 066555bc..13195d7 100644 --- a/services/network/network_qualities_pref_delegate_unittest.cc +++ b/services/network/network_qualities_pref_delegate_unittest.cc
@@ -26,13 +26,12 @@ class NetworkQualitiesPrefDelegateTest : public testing::Test { public: NetworkQualitiesPrefDelegateTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} ~NetworkQualitiesPrefDelegateTest() override = default; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(NetworkQualitiesPrefDelegateTest); };
diff --git a/services/network/network_quality_estimator_manager_unittest.cc b/services/network/network_quality_estimator_manager_unittest.cc index 0aa53001..9efd3a9 100644 --- a/services/network/network_quality_estimator_manager_unittest.cc +++ b/services/network/network_quality_estimator_manager_unittest.cc
@@ -131,7 +131,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<net::BoundTestNetLog> net_log_; std::unique_ptr<NetworkQualityEstimatorManager> network_quality_estimator_manager_;
diff --git a/services/network/network_service_proxy_delegate_unittest.cc b/services/network/network_service_proxy_delegate_unittest.cc index d422b32..a74ce0c 100644 --- a/services/network/network_service_proxy_delegate_unittest.cc +++ b/services/network/network_service_proxy_delegate_unittest.cc
@@ -57,13 +57,13 @@ void SetConfig(mojom::CustomProxyConfigPtr config) { client_->OnCustomProxyConfigUpdated(std::move(config)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } private: mojom::CustomProxyConfigClientPtr client_; std::unique_ptr<net::TestURLRequestContext> context_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(NetworkServiceProxyDelegateTest, NullConfigDoesNotCrash) {
diff --git a/services/network/network_service_unittest.cc b/services/network/network_service_unittest.cc index aa17b1fb..89a9cacc 100644 --- a/services/network/network_service_unittest.cc +++ b/services/network/network_service_unittest.cc
@@ -84,8 +84,7 @@ class NetworkServiceTest : public testing::Test { public: NetworkServiceTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), service_(NetworkService::CreateForTesting()) {} ~NetworkServiceTest() override {} @@ -94,7 +93,7 @@ void DestroyService() { service_.reset(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<NetworkService> service_; }; @@ -676,8 +675,7 @@ class NetworkServiceTestWithService : public testing::Test { public: NetworkServiceTestWithService() - : task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} ~NetworkServiceTestWithService() override {} void SetUp() override { @@ -732,7 +730,7 @@ mojom::NetworkContext* context() { return network_context_.get(); } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestConnectorFactory test_connector_factory_; std::unique_ptr<NetworkService> service_; @@ -1321,8 +1319,7 @@ class NetworkChangeTest : public testing::Test { public: NetworkChangeTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), network_change_notifier_(net::NetworkChangeNotifier::CreateMock()), service_(NetworkService::CreateForTesting()) {} @@ -1331,7 +1328,7 @@ NetworkService* service() const { return service_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_; std::unique_ptr<NetworkService> service_; }; @@ -1353,8 +1350,7 @@ class NetworkServiceNetworkChangeTest : public testing::Test { public: NetworkServiceNetworkChangeTest() - : task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), network_change_notifier_(net::NetworkChangeNotifier::CreateMock()), service_(NetworkService::CreateForTesting( test_connector_factory_.RegisterInstance(kNetworkServiceName))) { @@ -1367,7 +1363,7 @@ mojom::NetworkService* service() { return network_service_.get(); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestConnectorFactory test_connector_factory_; std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_; std::unique_ptr<NetworkService> service_;
diff --git a/services/network/origin_policy/origin_policy_fetcher_unittest.cc b/services/network/origin_policy/origin_policy_fetcher_unittest.cc index 8e512d6..dfcb9b4 100644 --- a/services/network/origin_policy/origin_policy_fetcher_unittest.cc +++ b/services/network/origin_policy/origin_policy_fetcher_unittest.cc
@@ -34,8 +34,7 @@ class OriginPolicyFetcherTest : public testing::Test { public: OriginPolicyFetcherTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { network_service_ = NetworkService::CreateForTesting(); auto context_params = mojom::NetworkContextParams::New(); // Use a fixed proxy config, to avoid dependencies on local network @@ -129,7 +128,7 @@ return std::move(response); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<NetworkService> network_service_; std::unique_ptr<NetworkContext> network_context_; mojom::NetworkContextPtr network_context_ptr_;
diff --git a/services/network/origin_policy/origin_policy_manager_unittest.cc b/services/network/origin_policy/origin_policy_manager_unittest.cc index 3b0e2a7..2ca8bda 100644 --- a/services/network/origin_policy/origin_policy_manager_unittest.cc +++ b/services/network/origin_policy/origin_policy_manager_unittest.cc
@@ -37,8 +37,7 @@ class OriginPolicyManagerTest : public testing::Test { public: OriginPolicyManagerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { network_service_ = NetworkService::CreateForTesting(); auto context_params = mojom::NetworkContextParams::New(); @@ -116,7 +115,7 @@ return std::move(response); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<NetworkService> network_service_; std::unique_ptr<NetworkContext> network_context_;
diff --git a/services/network/p2p/socket_tcp_server_unittest.cc b/services/network/p2p/socket_tcp_server_unittest.cc index 37b4c198e..1024208 100644 --- a/services/network/p2p/socket_tcp_server_unittest.cc +++ b/services/network/p2p/socket_tcp_server_unittest.cc
@@ -117,7 +117,7 @@ return host->socket_.get(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeServerSocket* socket_; // Owned by |p2p_socket_|. std::unique_ptr<FakeSocketClient> fake_client_; FakeP2PSocketDelegate socket_delegate_;
diff --git a/services/network/p2p/socket_tcp_unittest.cc b/services/network/p2p/socket_tcp_unittest.cc index 714be9c..6a1140a 100644 --- a/services/network/p2p/socket_tcp_unittest.cc +++ b/services/network/p2p/socket_tcp_unittest.cc
@@ -76,7 +76,7 @@ return result; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::string sent_data_; FakeSocket* socket_; // Owned by |socket_impl_|. std::unique_ptr<P2PSocketTcpBase> socket_impl_; @@ -465,8 +465,8 @@ // ProxyResolvingClientSocket::Connect() won't be called twice. // Regression test for crbug.com/840797. TEST(P2PSocketTcpWithPseudoTlsTest, Basic) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); mojom::P2PSocketClientPtr socket_client; auto socket_client_request = mojo::MakeRequest(&socket_client); @@ -525,8 +525,8 @@ // Tests that if a socket type satisfies IsTlsClientSocket(), TLS connection is // established. TEST_P(P2PSocketTcpWithTlsTest, Basic) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); mojom::P2PSocketClientPtr socket_client; auto socket_client_request = mojo::MakeRequest(&socket_client);
diff --git a/services/network/p2p/socket_udp_unittest.cc b/services/network/p2p/socket_udp_unittest.cc index 3818623..6cf5ed3 100644 --- a/services/network/p2p/socket_udp_unittest.cc +++ b/services/network/p2p/socket_udp_unittest.cc
@@ -242,7 +242,7 @@ return static_cast<FakeDatagramServerSocket*>(socket_host->socket_.get()); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; P2PMessageThrottler throttler_; ScopedFakeClock fake_clock_; base::circular_deque<FakeDatagramServerSocket::UDPPacket> sent_packets_;
diff --git a/services/network/proxy_config_service_mojo_unittest.cc b/services/network/proxy_config_service_mojo_unittest.cc index 207694c9..5f5fa1e 100644 --- a/services/network/proxy_config_service_mojo_unittest.cc +++ b/services/network/proxy_config_service_mojo_unittest.cc
@@ -68,8 +68,7 @@ class ProxyConfigServiceMojoTest : public testing::Test { public: ProxyConfigServiceMojoTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), proxy_config_service_(mojo::MakeRequest(&config_client_), base::Optional<net::ProxyConfigWithAnnotation>(), nullptr), @@ -84,9 +83,9 @@ protected: // After notifying a new configuration through |config_client_|, waits for the // observers to have been notified. - void WaitForConfig() { scoped_task_environment_.RunUntilIdle(); } + void WaitForConfig() { task_environment_.RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojom::ProxyConfigClientPtr config_client_; ProxyConfigServiceMojo proxy_config_service_; TestProxyConfigServiceObserver observer_;
diff --git a/services/network/proxy_resolver_factory_mojo_unittest.cc b/services/network/proxy_resolver_factory_mojo_unittest.cc index 19a5d158..7b32137 100644 --- a/services/network/proxy_resolver_factory_mojo_unittest.cc +++ b/services/network/proxy_resolver_factory_mojo_unittest.cc
@@ -550,7 +550,7 @@ std::move(callback).Run(result); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; net::HangingHostResolver host_resolver_; net::TestNetLog net_log_; std::unique_ptr<MockMojoProxyResolverFactory> mock_proxy_resolver_factory_;
diff --git a/services/network/proxy_resolving_client_socket_unittest.cc b/services/network/proxy_resolving_client_socket_unittest.cc index 7049ba3..4df40ab1 100644 --- a/services/network/proxy_resolving_client_socket_unittest.cc +++ b/services/network/proxy_resolving_client_socket_unittest.cc
@@ -70,7 +70,7 @@ base::RunLoop().RunUntilIdle(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestURLRequestContextWithProxy context_with_proxy_; net::MockClientSocketFactory mock_client_socket_factory_; const bool use_tls_; @@ -791,7 +791,7 @@ ~ReconsiderProxyAfterErrorTest() override {} - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::MockClientSocketFactory mock_client_socket_factory_; TestURLRequestContextWithProxy context_with_proxy_; const bool use_tls_;
diff --git a/services/network/proxy_resolving_socket_mojo_unittest.cc b/services/network/proxy_resolving_socket_mojo_unittest.cc index 9228d61..6ef4a5fd 100644 --- a/services/network/proxy_resolving_socket_mojo_unittest.cc +++ b/services/network/proxy_resolving_socket_mojo_unittest.cc
@@ -56,8 +56,7 @@ ProxyResolvingSocketTestBase(bool use_tls) : use_tls_(use_tls), fake_tls_handshake_(false), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} ~ProxyResolvingSocketTestBase() {} @@ -154,7 +153,7 @@ private: const bool use_tls_; bool fake_tls_handshake_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<net::MockClientSocketFactory> mock_client_socket_factory_; std::unique_ptr<TestURLRequestContextWithProxy> context_with_proxy_; mojom::ProxyResolvingSocketFactoryPtr factory_ptr_;
diff --git a/services/network/public/cpp/cors/preflight_cache_unittest.cc b/services/network/public/cpp/cors/preflight_cache_unittest.cc index b61dfdd2..69dfb9a 100644 --- a/services/network/public/cpp/cors/preflight_cache_unittest.cc +++ b/services/network/public/cpp/cors/preflight_cache_unittest.cc
@@ -53,7 +53,7 @@ void SetUp() override { PreflightResult::SetTickClockForTesting(&clock_); } void TearDown() override { PreflightResult::SetTickClockForTesting(nullptr); } - base::test::ScopedTaskEnvironment env_; + base::test::TaskEnvironment env_; PreflightCache cache_; base::SimpleTestTickClock clock_; };
diff --git a/services/network/public/cpp/cross_thread_shared_url_loader_factory_info_unittest.cc b/services/network/public/cpp/cross_thread_shared_url_loader_factory_info_unittest.cc index e85c7de4..dd7e9af0 100644 --- a/services/network/public/cpp/cross_thread_shared_url_loader_factory_info_unittest.cc +++ b/services/network/public/cpp/cross_thread_shared_url_loader_factory_info_unittest.cc
@@ -77,7 +77,7 @@ } void TearDown() override { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Release |shared_factory_| on |loader_thread_| base::RunLoop run_loop; @@ -145,7 +145,7 @@ run_loop.Run(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<CloneCheckingURLLoaderFactory> test_url_loader_factory_; scoped_refptr<SharedURLLoaderFactory> shared_factory_;
diff --git a/services/network/public/cpp/network_connection_tracker_unittest.cc b/services/network/public/cpp/network_connection_tracker_unittest.cc index 4887af47..9070e23 100644 --- a/services/network/public/cpp/network_connection_tracker_unittest.cc +++ b/services/network/public/cpp/network_connection_tracker_unittest.cc
@@ -214,7 +214,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<net::test::MockNetworkChangeNotifier> mock_network_change_notifier_; std::unique_ptr<NetworkService> network_service_;
diff --git a/services/network/public/cpp/network_quality_tracker_unittest.cc b/services/network/public/cpp/network_quality_tracker_unittest.cc index e0e5eb74..5ca2b383 100644 --- a/services/network/public/cpp/network_quality_tracker_unittest.cc +++ b/services/network/public/cpp/network_quality_tracker_unittest.cc
@@ -167,8 +167,7 @@ class NetworkQualityTrackerTest : public testing::Test { public: NetworkQualityTrackerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { network::mojom::NetworkServicePtr network_service_ptr; network::mojom::NetworkServiceRequest network_service_request = mojo::MakeRequest(&network_service_ptr); @@ -211,7 +210,7 @@ return network_service_.get(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<network::NetworkService> network_service_; std::unique_ptr<NetworkQualityTracker> tracker_; std::unique_ptr<TestEffectiveConnectionTypeObserver> ect_observer_;
diff --git a/services/network/public/cpp/server/http_server_unittest.cc b/services/network/public/cpp/server/http_server_unittest.cc index 6351ab5..99cabe9 100644 --- a/services/network/public/cpp/server/http_server_unittest.cc +++ b/services/network/public/cpp/server/http_server_unittest.cc
@@ -164,8 +164,7 @@ class HttpServerTest : public testing::Test, public HttpServer::Delegate { public: HttpServerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), quit_after_request_count_(0), quit_on_close_connection_(-1), factory_(nullptr, &url_request_context_) {} @@ -275,7 +274,7 @@ connection_map_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; size_t quit_after_request_count_; int quit_on_close_connection_;
diff --git a/services/network/public/cpp/simple_url_loader_unittest.cc b/services/network/public/cpp/simple_url_loader_unittest.cc index 35aceedd..61bfa496 100644 --- a/services/network/public/cpp/simple_url_loader_unittest.cc +++ b/services/network/public/cpp/simple_url_loader_unittest.cc
@@ -568,8 +568,7 @@ class SimpleURLLoaderTestBase { public: SimpleURLLoaderTestBase() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { network::mojom::NetworkServicePtr network_service_ptr; network::mojom::NetworkServiceRequest network_service_request = mojo::MakeRequest(&network_service_ptr); @@ -628,7 +627,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<network::mojom::NetworkService> network_service_; std::unique_ptr<network::mojom::NetworkServiceClient> network_service_client_; @@ -1643,7 +1642,7 @@ test_helper->StartSimpleLoader(url_loader_factory_.get()); test_helper.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_P(SimpleURLLoaderTest, UploadFileCanceledWithRetry) { @@ -1654,9 +1653,9 @@ test_helper->simple_url_loader()->SetRetryOptions( 2, SimpleURLLoader::RETRY_ON_5XX); test_helper->StartSimpleLoader(url_loader_factory_.get()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); test_helper.reset(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } enum class TestLoaderEvent { @@ -1708,12 +1707,12 @@ // unexpected order, to test handling of events from less trusted processes. class MockURLLoader : public network::mojom::URLLoader { public: - MockURLLoader(base::test::ScopedTaskEnvironment* scoped_task_environment, + MockURLLoader(base::test::TaskEnvironment* task_environment, network::mojom::URLLoaderRequest url_loader_request, network::mojom::URLLoaderClientPtr client, std::vector<TestLoaderEvent> test_events, scoped_refptr<network::ResourceRequestBody> request_body) - : scoped_task_environment_(scoped_task_environment), + : task_environment_(task_environment), binding_(this, std::move(url_loader_request)), client_(std::move(client)), test_events_(std::move(test_events)) { @@ -1902,13 +1901,12 @@ break; } case TestLoaderEvent::kAdvanceOneSecond: { - scoped_task_environment_->FastForwardBy( - base::TimeDelta::FromSeconds(1)); + task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(1)); break; } } // Wait for Mojo to pass along the message, to ensure expected ordering. - scoped_task_environment_->RunUntilIdle(); + task_environment_->RunUntilIdle(); } } ~MockURLLoader() override {} @@ -1945,7 +1943,7 @@ read_run_loop_->Quit(); } - base::test::ScopedTaskEnvironment* scoped_task_environment_; + base::test::TaskEnvironment* task_environment_; std::unique_ptr<net::URLRequest> url_request_; mojo::Binding<network::mojom::URLLoader> binding_; @@ -1968,9 +1966,8 @@ class MockURLLoaderFactory : public network::mojom::URLLoaderFactory { public: - explicit MockURLLoaderFactory( - base::test::ScopedTaskEnvironment* scoped_task_environment) - : scoped_task_environment_(scoped_task_environment) {} + explicit MockURLLoaderFactory(base::test::TaskEnvironment* task_environment) + : task_environment_(task_environment) {} ~MockURLLoaderFactory() override {} // network::mojom::URLLoaderFactory implementation: @@ -1986,8 +1983,8 @@ ASSERT_FALSE(test_events_.empty()); requested_urls_.push_back(url_request.url); url_loaders_.push_back(std::make_unique<MockURLLoader>( - scoped_task_environment_, std::move(url_loader_request), - std::move(client), test_events_.front(), url_request.request_body)); + task_environment_, std::move(url_loader_request), std::move(client), + test_events_.front(), url_request.request_body)); test_events_.pop_front(); url_loader_queue_.push_back(url_loaders_.back().get()); @@ -2041,7 +2038,7 @@ const std::list<GURL>& requested_urls() const { return requested_urls_; } private: - base::test::ScopedTaskEnvironment* scoped_task_environment_; + base::test::TaskEnvironment* task_environment_; std::list<std::unique_ptr<MockURLLoader>> url_loaders_; std::list<std::vector<TestLoaderEvent>> test_events_; @@ -2060,7 +2057,7 @@ // Check that the request fails if OnComplete() is called before anything else. TEST_P(SimpleURLLoaderTest, ResponseCompleteBeforeReceivedResponse) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents({TestLoaderEvent::kResponseComplete}); std::unique_ptr<SimpleLoaderTestHelper> test_helper = CreateHelperForURL(GURL("foo://bar/")); @@ -2074,7 +2071,7 @@ // Check that the request fails if OnComplete() is called before the body pipe // is received. TEST_P(SimpleURLLoaderTest, ResponseCompleteAfterReceivedResponse) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kResponseComplete}); std::unique_ptr<SimpleLoaderTestHelper> test_helper = @@ -2087,7 +2084,7 @@ } TEST_P(SimpleURLLoaderTest, CloseClientPipeBeforeBodyStarts) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kClientPipeClosed}); std::unique_ptr<SimpleLoaderTestHelper> test_helper = @@ -2134,7 +2131,7 @@ bytes_received < 2) { continue; } - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); std::vector<TestLoaderEvent> events; events.push_back(TestLoaderEvent::kReceivedResponse); events.push_back(TestLoaderEvent::kBodyBufferReceived); @@ -2195,7 +2192,7 @@ // Make sure the close client pipe message doesn't cause any issues. TEST_P(SimpleURLLoaderTest, ErrorAndCloseClientPipeBeforeBodyStarts) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents({TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kResponseCompleteFailed, TestLoaderEvent::kClientPipeClosed}); @@ -2210,7 +2207,7 @@ // Make sure the close client pipe message doesn't cause any issues. TEST_P(SimpleURLLoaderTest, SuccessAndCloseClientPipeBeforeBodyComplete) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kBodyBufferReceived, TestLoaderEvent::kResponseComplete, TestLoaderEvent::kClientPipeClosed, @@ -2230,7 +2227,7 @@ // Make sure the close client pipe message doesn't cause any issues. TEST_P(SimpleURLLoaderTest, SuccessAndCloseClientPipeAfterBodyComplete) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kBodyBufferReceived, TestLoaderEvent::kBodyDataRead, TestLoaderEvent::kBodyBufferClosed, @@ -2249,7 +2246,7 @@ } TEST_P(SimpleURLLoaderTest, DoubleReceivedResponse) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kReceivedResponse}); std::unique_ptr<SimpleLoaderTestHelper> test_helper = @@ -2262,7 +2259,7 @@ } TEST_P(SimpleURLLoaderTest, RedirectAfterReseivedResponse) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kReceivedRedirect}); std::unique_ptr<SimpleLoaderTestHelper> test_helper = @@ -2275,7 +2272,7 @@ } TEST_P(SimpleURLLoaderTest, UnexpectedBodyBufferReceived) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents({TestLoaderEvent::kBodyBufferReceived}); std::unique_ptr<SimpleLoaderTestHelper> test_helper = CreateHelperForURL(GURL("foo://bar/")); @@ -2287,7 +2284,7 @@ } TEST_P(SimpleURLLoaderTest, DoubleBodyBufferReceived) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents({TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kBodyBufferReceived, TestLoaderEvent::kBodyBufferReceived}); @@ -2301,7 +2298,7 @@ } TEST_P(SimpleURLLoaderTest, UnexpectedMessageAfterBodyStarts) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kBodyBufferReceived, TestLoaderEvent::kBodyDataRead, TestLoaderEvent::kReceivedRedirect}); @@ -2315,7 +2312,7 @@ } TEST_P(SimpleURLLoaderTest, UnexpectedMessageAfterBodyStarts2) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kBodyBufferReceived, TestLoaderEvent::kBodyDataRead, TestLoaderEvent::kBodyBufferReceived}); @@ -2329,7 +2326,7 @@ } TEST_P(SimpleURLLoaderTest, UnexpectedMessageAfterBodyComplete) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kBodyBufferReceived, TestLoaderEvent::kBodyDataRead, TestLoaderEvent::kBodyBufferClosed, @@ -2344,7 +2341,7 @@ } TEST_P(SimpleURLLoaderTest, MoreDataThanExpected) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kBodyBufferReceived, TestLoaderEvent::kBodyDataRead, TestLoaderEvent::kBodyDataRead, @@ -2362,7 +2359,7 @@ TEST_P(SimpleURLLoaderTest, DownloadProgressCallbackIncremental) { // Make sure that intermediate states of download are reported to the // progress callback. - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kBodyBufferReceived, TestLoaderEvent::kBodyDataRead, TestLoaderEvent::kBodyDataRead}); @@ -2388,7 +2385,7 @@ // Clean the file up. test_helper->DestroySimpleURLLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_P(SimpleURLLoaderTest, RetryOn5xx) { @@ -2428,7 +2425,7 @@ }; for (const auto& test_case : kTestCases) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); for (int i = 0; i < test_case.num_5xx; i++) { loader_factory.AddEvents({TestLoaderEvent::kReceived501Response}); } @@ -2476,7 +2473,7 @@ // Test that when retrying on 5xx is enabled, there's no retry on a 4xx error. TEST_P(SimpleURLLoaderTest, NoRetryOn4xx) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents({TestLoaderEvent::kReceived401Response}); std::unique_ptr<SimpleLoaderTestHelper> test_helper = @@ -2497,7 +2494,7 @@ // re-requested. TEST_P(SimpleURLLoaderTest, RetryAfterRedirect) { const GURL kInitialURL("foo://bar/initial"); - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents({TestLoaderEvent::kReceivedRedirect, TestLoaderEvent::kReceived501Response}); loader_factory.AddEvents( @@ -2600,7 +2597,7 @@ for (const auto& network_events : kNetworkChangedEvents) { for (const auto& test_case : kTestCases) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); for (int i = 0; i < test_case.num_network_changes; i++) { loader_factory.AddEvents(network_events); } @@ -2655,7 +2652,7 @@ if (test_loader_event == TestLoaderEvent::kResponseCompleteNetworkChanged) test_loader_event = TestLoaderEvent::kResponseCompleteFailed; } - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents(modifed_network_events); std::unique_ptr<SimpleLoaderTestHelper> test_helper = @@ -2676,7 +2673,7 @@ // Check the case where the URLLoaderFactory has been disconnected before the // request is retried. TEST_P(SimpleURLLoaderTest, RetryWithUnboundFactory) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents({TestLoaderEvent::kResponseCompleteNetworkChanged}); // Since clone fails asynchronously, this shouldn't be any different from // the new URLLoaderFactory being disconnected in some other way. @@ -2699,7 +2696,7 @@ // with no intervening reads of the data on the pipe. TEST_P(SimpleURLLoaderTest, UploadLongStringStartReadTwice) { std::string long_string = GetLongUploadBody(); - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kStartReadLongUploadBody, TestLoaderEvent::kStartReadLongUploadBody, @@ -2726,7 +2723,7 @@ TEST_P(SimpleURLLoaderTest, UploadLongStringReadPartOfUploadBodyBeforeRestartBodyRead) { std::string long_string = GetLongUploadBody(); - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kStartReadLongUploadBody, TestLoaderEvent::kWaitForLongUploadBodySize, @@ -2851,7 +2848,7 @@ if (body_buffer_closed && client_pipe_closed) continue; - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); std::vector<TestLoaderEvent> events; events.push_back(TestLoaderEvent::kReceivedResponse); events.push_back(TestLoaderEvent::kBodyBufferReceived); @@ -2872,7 +2869,7 @@ false /* wait_for_completion */); // Wait for the request to advance as far as it's going to. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Destination file should have been created, and request should still // be in progress. @@ -2886,7 +2883,7 @@ // Destroying the SimpleURLLoader now should post a task to destroy the // file. test_helper->DestroySimpleURLLoader(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); { base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_FALSE(base::PathExists(dest_path)); @@ -2979,15 +2976,14 @@ } // Don't inherit from SimpleURLLoaderTestBase so that we can initialize our -// |scoped_task_environment_| different namely with TimeSource::MOCK_TIME. +// |task_environment_| different namely with TimeSource::MOCK_TIME. class SimpleURLLoaderMockTimeTest : public testing::Test { public: SimpleURLLoaderMockTimeTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), disallow_blocking_(std::make_unique<base::ScopedDisallowBlocking>()) { SimpleURLLoader::SetTimeoutTickClockForTest( - scoped_task_environment_.GetMockTickClock()); + task_environment_.GetMockTickClock()); } ~SimpleURLLoaderMockTimeTest() override {} @@ -3003,14 +2999,14 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::ScopedDisallowBlocking> disallow_blocking_; }; // The amount of time that's simulated passing is equal to the timeout value // specified, so the request should fail. TEST_F(SimpleURLLoaderMockTimeTest, TimeoutTriggered) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kAdvanceOneSecond, TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kBodyBufferReceived, TestLoaderEvent::kResponseComplete, @@ -3027,7 +3023,7 @@ // Less time is simulated passing than the timeout value, so this request should // succeed normally. TEST_F(SimpleURLLoaderMockTimeTest, TimeoutNotTriggered) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kAdvanceOneSecond, TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kBodyBufferReceived, TestLoaderEvent::kResponseComplete, @@ -3045,7 +3041,7 @@ // Simulate time passing, without setting the timeout. This should result in no // timer being started, and request should succeed. TEST_F(SimpleURLLoaderMockTimeTest, TimeNotSetAndTimeAdvanced) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kAdvanceOneSecond, TestLoaderEvent::kReceivedResponse, TestLoaderEvent::kBodyBufferReceived, TestLoaderEvent::kResponseComplete, @@ -3061,7 +3057,7 @@ // Simulate time passing before and after a redirect. The redirect should not // reset the timeout timer, and the request should timeout. TEST_F(SimpleURLLoaderMockTimeTest, TimeoutAfterRedirectTriggered) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents( {TestLoaderEvent::kAdvanceOneSecond, TestLoaderEvent::kReceivedRedirect, TestLoaderEvent::kAdvanceOneSecond, TestLoaderEvent::kReceivedResponse, @@ -3079,7 +3075,7 @@ // Simulate time passing after a failure. The retry restarts the timeout timer, // so the second attempt gets a full two seconds and it is not exhausted. TEST_F(SimpleURLLoaderMockTimeTest, TimeoutAfterRetryNotTriggered) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents({TestLoaderEvent::kAdvanceOneSecond, TestLoaderEvent::kReceived501Response}); loader_factory.AddEvents( @@ -3101,7 +3097,7 @@ // Trigger a failure and retry, and then simulate enough time passing to trigger // the timeout. The retry should have correctly started its timeout timer. TEST_F(SimpleURLLoaderMockTimeTest, TimeoutAfterRetryTriggered) { - MockURLLoaderFactory loader_factory(&scoped_task_environment_); + MockURLLoaderFactory loader_factory(&task_environment_); loader_factory.AddEvents({TestLoaderEvent::kAdvanceOneSecond, TestLoaderEvent::kReceived501Response}); loader_factory.AddEvents( @@ -3207,7 +3203,7 @@ base::RunLoop run_loop; auto callback = base::BindLambdaForTesting([&](uint64_t current) { test_helper->DestroySimpleURLLoader(); // cleanup files. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); test_helper.reset(); run_loop.Quit(); }); @@ -3232,7 +3228,7 @@ auto callback = base::BindLambdaForTesting([&](uint64_t current) { if (current == kResponseSize) { test_helper->DestroySimpleURLLoader(); // cleanup files. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); test_helper.reset(); run_loop.Quit(); }
diff --git a/services/network/public/mojom/cookie_manager.mojom b/services/network/public/mojom/cookie_manager.mojom index 2afbf44d..2860f779d 100644 --- a/services/network/public/mojom/cookie_manager.mojom +++ b/services/network/public/mojom/cookie_manager.mojom
@@ -28,6 +28,11 @@ // Whether or not to allow cookies for file:// URLs. Can be overridden by // CookieManager.AllowFileSchemeCookies(). bool allow_file_scheme_cookies = false; + + // Content settings for which domains are allowed to use legacy cookie + // access rules. + array<content_settings.mojom.ContentSettingPatternSource> + settings_for_legacy_cookie_access; }; enum CookiePriority { @@ -301,4 +306,9 @@ // Enables/Disables blocking of third-party cookies. BlockThirdPartyCookies(bool block); + + // Sets content settings for which domains are allowed to use legacy cookie + // access rules. + SetContentSettingsForLegacyCookieAccess( + array<content_settings.mojom.ContentSettingPatternSource> settings); };
diff --git a/services/network/public/mojom/restricted_cookie_manager.mojom b/services/network/public/mojom/restricted_cookie_manager.mojom index daf226d..8f487f1 100644 --- a/services/network/public/mojom/restricted_cookie_manager.mojom +++ b/services/network/public/mojom/restricted_cookie_manager.mojom
@@ -7,6 +7,7 @@ import "services/network/public/mojom/cookie_manager.mojom"; import "mojo/public/mojom/base/time.mojom"; import "url/mojom/url.mojom"; +import "url/mojom/origin.mojom"; enum CookieMatchType { EQUALS, @@ -56,19 +57,26 @@ // |url| is an URL capable of receiving HTTP requests. |site_for_cookies| is // the "site for cookies" values defined in RFC 6265bis, and roughly maps to // the URL of the top-level frame in Document contexts, and to the script URL - // in service workers. |options| filters the returned list of cookies. + // in service workers. |top_frame_origin| is the actual origin of the top + // level frame or the script url for service workers. |site_for_cookies| is + // used to determine if a cookie is accessed in a third-party context. + // |top_frame_origin| is used to check for content settings. + // |options| filters the returned list of cookies. GetAllForUrl( url.mojom.Url url, url.mojom.Url site_for_cookies, + url.mojom.Origin top_frame_origin, CookieManagerGetOptions options) => (array<CanonicalCookie> cookies); SetCanonicalCookie(CanonicalCookie cookie, url.mojom.Url url, - url.mojom.Url site_for_cookies) => (bool success); + url.mojom.Url site_for_cookies, + url.mojom.Origin top_frame_origin) => (bool success); // Subscribes to changes in the cookies transmitted in a request to an URL. // // The subscription is canceled by closing the pipe. AddChangeListener(url.mojom.Url url, url.mojom.Url site_for_cookies, + url.mojom.Origin top_frame_origin, CookieChangeListener listener) => (); // Sets a cookie. If setting of this cookie is not permitted either by web @@ -81,6 +89,7 @@ // to serialize with other operations. [Sync] SetCookieFromString(url.mojom.Url url, url.mojom.Url site_for_cookies, + url.mojom.Origin top_frame_origin, string cookie) => (); // Used to get cookies for the given URL. Cookies that are blocked by user @@ -92,7 +101,8 @@ // is bounded to will be treated as the renderer violating security rules. [Sync] GetCookiesString(url.mojom.Url url, - url.mojom.Url site_for_cookies) => (string cookies); + url.mojom.Url site_for_cookies, + url.mojom.Origin top_frame_origin) => (string cookies); // Used to check if cookies are enabled for the given URL in context of a // given site. @@ -100,6 +110,8 @@ // Passing in |url| that does not match the origin RestrictedCookieManager // is bounded to will be treated as the renderer violating security rules. [Sync] - CookiesEnabledFor(url.mojom.Url url, - url.mojom.Url site_for_cookies) => (bool cookies_enabled); + CookiesEnabledFor( + url.mojom.Url url, + url.mojom.Url site_for_cookies, + url.mojom.Origin top_frame_origin) => (bool cookies_enabled); };
diff --git a/services/network/resource_scheduler/resource_scheduler_unittest.cc b/services/network/resource_scheduler/resource_scheduler_unittest.cc index ca4ee5f..2f6a865 100644 --- a/services/network/resource_scheduler/resource_scheduler_unittest.cc +++ b/services/network/resource_scheduler/resource_scheduler_unittest.cc
@@ -495,7 +495,7 @@ ResourceScheduler* scheduler() { return scheduler_.get(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<ResourceScheduler> scheduler_; net::TestNetworkQualityEstimator network_quality_estimator_; net::TestURLRequestContext context_;
diff --git a/services/network/restricted_cookie_manager.cc b/services/network/restricted_cookie_manager.cc index d672065..29aafcdc 100644 --- a/services/network/restricted_cookie_manager.cc +++ b/services/network/restricted_cookie_manager.cc
@@ -79,11 +79,13 @@ const RestrictedCookieManager* restricted_cookie_manager, const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, net::CookieOptions options, mojom::CookieChangeListenerPtr mojo_listener) : restricted_cookie_manager_(restricted_cookie_manager), url_(url), site_for_cookies_(site_for_cookies), + top_frame_origin_(top_frame_origin), options_(options), mojo_listener_(std::move(mojo_listener)) { // TODO(pwnall): add a constructor w/options to net::CookieChangeDispatcher. @@ -120,7 +122,7 @@ // being deleted at a later time, which can happen due to eviction or due to // the user explicitly deleting all cookies. if (!restricted_cookie_manager_->cookie_settings()->IsCookieAccessAllowed( - url_, site_for_cookies_)) + url_, site_for_cookies_, top_frame_origin_)) return; mojo_listener_->OnCookieChange(cookie, ToCookieChangeCause(cause)); @@ -136,9 +138,13 @@ // The URL whose cookies this listener is interested in. const GURL url_; - // Site context in which we're used; used for permission-checking. + // Site context in which we're used; used to determine if a cookie is accessed + // in a third-party context. const GURL site_for_cookies_; + // Site context in which we're used; used to check content settings. + const url::Origin top_frame_origin_; + // CanonicalCookie::IncludeForRequestURL options for this listener's interest. const net::CookieOptions options_; @@ -184,6 +190,7 @@ void RestrictedCookieManager::GetAllForUrl( const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, mojom::CookieManagerGetOptionsPtr options, GetAllForUrlCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -205,12 +212,14 @@ url, net_options, base::BindOnce(&RestrictedCookieManager::CookieListToGetAllForUrlCallback, weak_ptr_factory_.GetWeakPtr(), url, site_for_cookies, - net_options, std::move(options), std::move(callback))); + top_frame_origin, net_options, std::move(options), + std::move(callback))); } void RestrictedCookieManager::CookieListToGetAllForUrlCallback( const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, const net::CookieOptions& net_options, mojom::CookieManagerGetOptionsPtr options, GetAllForUrlCallback callback, @@ -218,8 +227,8 @@ const net::CookieStatusList& excluded_cookies) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - bool blocked = - !cookie_settings_->IsCookieAccessAllowed(url, site_for_cookies); + bool blocked = !cookie_settings_->IsCookieAccessAllowed(url, site_for_cookies, + top_frame_origin); std::vector<net::CanonicalCookie> result; std::vector<net::CookieWithStatus> result_with_status; @@ -295,6 +304,7 @@ const net::CanonicalCookie& cookie, const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, SetCanonicalCookieCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!ValidateAccessToCookiesAt(url)) { @@ -303,8 +313,8 @@ } // TODO(morlovich): Try to validate site_for_cookies as well. - bool blocked = - !cookie_settings_->IsCookieAccessAllowed(url, site_for_cookies); + bool blocked = !cookie_settings_->IsCookieAccessAllowed(url, site_for_cookies, + top_frame_origin); if (blocked) { if (network_context_client_) { @@ -377,6 +387,7 @@ void RestrictedCookieManager::AddChangeListener( const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, mojom::CookieChangeListenerPtr mojo_listener, AddChangeListenerCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -387,9 +398,9 @@ net::CookieOptions net_options = MakeOptionsForGet(role_, url, site_for_cookies); - auto listener = - std::make_unique<Listener>(cookie_store_, this, url, site_for_cookies, - net_options, std::move(mojo_listener)); + auto listener = std::make_unique<Listener>( + cookie_store_, this, url, site_for_cookies, top_frame_origin, net_options, + std::move(mojo_listener)); listener->mojo_listener().set_connection_error_handler( base::BindOnce(&RestrictedCookieManager::RemoveChangeListener, @@ -407,6 +418,7 @@ void RestrictedCookieManager::SetCookieFromString( const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, const std::string& cookie, SetCookieFromStringCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -422,7 +434,7 @@ // Further checks (origin_, settings), as well as logging done by // SetCanonicalCookie() SetCanonicalCookie( - *parsed_cookie, url, site_for_cookies, + *parsed_cookie, url, site_for_cookies, top_frame_origin, base::BindOnce([](SetCookieFromStringCallback user_callback, bool success) { std::move(user_callback).Run(); }, std::move(callback))); @@ -431,6 +443,7 @@ void RestrictedCookieManager::GetCookiesString( const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, GetCookiesStringCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Checks done by GetAllForUrl. @@ -439,7 +452,8 @@ auto match_options = mojom::CookieManagerGetOptions::New(); match_options->name = ""; match_options->match_type = mojom::CookieMatchType::STARTS_WITH; - GetAllForUrl(url, site_for_cookies, std::move(match_options), + GetAllForUrl(url, site_for_cookies, top_frame_origin, + std::move(match_options), base::BindOnce( [](GetCookiesStringCallback user_callback, const std::vector<net::CanonicalCookie>& cookies) { @@ -452,14 +466,15 @@ void RestrictedCookieManager::CookiesEnabledFor( const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, CookiesEnabledForCallback callback) { if (!ValidateAccessToCookiesAt(url)) { std::move(callback).Run(false); return; } - std::move(callback).Run( - cookie_settings_->IsCookieAccessAllowed(url, site_for_cookies)); + std::move(callback).Run(cookie_settings_->IsCookieAccessAllowed( + url, site_for_cookies, top_frame_origin)); } void RestrictedCookieManager::RemoveChangeListener(Listener* listener) {
diff --git a/services/network/restricted_cookie_manager.h b/services/network/restricted_cookie_manager.h index 6f00581da..0eb1cc7 100644 --- a/services/network/restricted_cookie_manager.h +++ b/services/network/restricted_cookie_manager.h
@@ -60,29 +60,35 @@ void GetAllForUrl(const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, mojom::CookieManagerGetOptionsPtr options, GetAllForUrlCallback callback) override; void SetCanonicalCookie(const net::CanonicalCookie& cookie, const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, SetCanonicalCookieCallback callback) override; void AddChangeListener(const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, mojom::CookieChangeListenerPtr listener, AddChangeListenerCallback callback) override; void SetCookieFromString(const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, const std::string& cookie, SetCookieFromStringCallback callback) override; void GetCookiesString(const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, GetCookiesStringCallback callback) override; void CookiesEnabledFor(const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, CookiesEnabledForCallback callback) override; private: @@ -93,6 +99,7 @@ void CookieListToGetAllForUrlCallback( const GURL& url, const GURL& site_for_cookies, + const url::Origin& top_frame_origin, const net::CookieOptions& net_options, mojom::CookieManagerGetOptionsPtr options, GetAllForUrlCallback callback,
diff --git a/services/network/restricted_cookie_manager_unittest.cc b/services/network/restricted_cookie_manager_unittest.cc index 844379d..105b05c 100644 --- a/services/network/restricted_cookie_manager_unittest.cc +++ b/services/network/restricted_cookie_manager_unittest.cc
@@ -111,7 +111,8 @@ base::RunLoop run_loop; std::vector<net::CanonicalCookie> result; cookie_service_->GetAllForUrl( - url, site_for_cookies, std::move(options), + url, site_for_cookies, url::Origin::Create(site_for_cookies), + std::move(options), base::BindLambdaForTesting( [&run_loop, &result](const std::vector<net::CanonicalCookie>& backend_result) { @@ -128,7 +129,7 @@ base::RunLoop run_loop; bool result = false; cookie_service_->SetCanonicalCookie( - cookie, url, site_for_cookies, + cookie, url, site_for_cookies, url::Origin::Create(site_for_cookies), base::BindLambdaForTesting([&run_loop, &result](bool backend_result) { result = backend_result; run_loop.Quit(); @@ -142,7 +143,8 @@ mojom::CookieChangeListenerPtr listener) { base::RunLoop run_loop; cookie_service_->AddChangeListener( - url, site_for_cookies, std::move(listener), run_loop.QuitClosure()); + url, site_for_cookies, url::Origin::Create(site_for_cookies), + std::move(listener), run_loop.QuitClosure()); run_loop.Run(); } @@ -250,8 +252,8 @@ return recording_client_.recorded_activity(); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; net::CookieMonster cookie_monster_; CookieSettings cookie_settings_; RecordingNetworkContextClient recording_client_; @@ -296,9 +298,9 @@ // Can also use the document.cookie-style API to get the same info. std::string cookies_out; - EXPECT_TRUE(backend()->GetCookiesString(GURL("http://example.com/test/"), - GURL("http://example.com"), - &cookies_out)); + EXPECT_TRUE(backend()->GetCookiesString( + GURL("http://example.com/test/"), GURL("http://example.com"), + url::Origin::Create(GURL("http://example.com")), &cookies_out)); EXPECT_EQ("cookie-name=cookie-value; cookie-name-2=cookie-value-2", cookies_out); } @@ -408,9 +410,9 @@ ExpectBadMessage(); std::string cookies_out; - EXPECT_TRUE(backend()->GetCookiesString(GURL("http://notexample.com/test/"), - GURL("http://example.com"), - &cookies_out)); + EXPECT_TRUE(backend()->GetCookiesString( + GURL("http://notexample.com/test/"), GURL("http://example.com"), + url::Origin::Create(GURL("http://example.com")), &cookies_out)); EXPECT_TRUE(received_bad_message()); EXPECT_TRUE(cookies_out.empty()); } @@ -559,9 +561,10 @@ } TEST_P(RestrictedCookieManagerTest, SetCookieFromString) { - EXPECT_TRUE(backend()->SetCookieFromString(GURL("http://example.com/test/"), - GURL("http://example.com"), - "new-name=new-value;path=/")); + EXPECT_TRUE(backend()->SetCookieFromString( + GURL("http://example.com/test/"), GURL("http://example.com"), + url::Origin::Create(GURL("http://example.com")), + "new-name=new-value;path=/")); auto options = mojom::CookieManagerGetOptions::New(); options->name = "new-name"; options->match_type = mojom::CookieMatchType::EQUALS; @@ -591,6 +594,7 @@ ExpectBadMessage(); EXPECT_TRUE(backend()->SetCookieFromString( GURL("http://notexample.com/test/"), GURL("http://example.com"), + url::Origin::Create(GURL("http://example.com")), "new-name=new-value;path=/")); ASSERT_TRUE(received_bad_message()); } @@ -688,18 +692,21 @@ // Default, third-party access is OK. bool result = false; EXPECT_TRUE(backend()->CookiesEnabledFor( - GURL("http://example.com"), GURL("http://notexample.com"), &result)); + GURL("http://example.com"), GURL("http://notexample.com"), + url::Origin::Create(GURL("http://notexample.com")), &result)); EXPECT_TRUE(result); // Third-part cookies disabled. cookie_settings_.set_block_third_party_cookies(true); EXPECT_TRUE(backend()->CookiesEnabledFor( - GURL("http://example.com"), GURL("http://notexample.com"), &result)); + GURL("http://example.com"), GURL("http://notexample.com"), + url::Origin::Create(GURL("http://notexample.com")), &result)); EXPECT_FALSE(result); // First-party ones still OK. EXPECT_TRUE(backend()->CookiesEnabledFor( - GURL("http://example.com"), GURL("http://example.com"), &result)); + GURL("http://example.com"), GURL("http://example.com"), + url::Origin::Create(GURL("http://example.com")), &result)); EXPECT_TRUE(result); }
diff --git a/services/network/sec_header_helpers_unittest.cc b/services/network/sec_header_helpers_unittest.cc index 6dd79a9f..7273616 100644 --- a/services/network/sec_header_helpers_unittest.cc +++ b/services/network/sec_header_helpers_unittest.cc
@@ -32,8 +32,7 @@ class SecHeaderHelpersTest : public PlatformTest { public: SecHeaderHelpersTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), url_request_(context_.CreateRequest(GURL(kSecureSite), net::DEFAULT_PRIORITY, /*request_delegate=*/nullptr, @@ -42,7 +41,7 @@ net::URLRequest* url_request() const { return url_request_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::TestURLRequestContext context_; std::unique_ptr<net::URLRequest> url_request_; };
diff --git a/services/network/session_cleanup_cookie_store_unittest.cc b/services/network/session_cleanup_cookie_store_unittest.cc index 2da99e3..0aa5198e 100644 --- a/services/network/session_cleanup_cookie_store_unittest.cc +++ b/services/network/session_cleanup_cookie_store_unittest.cc
@@ -83,7 +83,7 @@ void TearDown() override { DestroyStore(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const scoped_refptr<base::SequencedTaskRunner> background_task_runner_ = base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock()}); base::ScopedTempDir temp_dir_; @@ -213,7 +213,7 @@ base::BindRepeating([](const std::string& domain, bool is_https) { return domain == "nonpersistent.com"; })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); DestroyStore(); cookies = CreateAndLoad(); @@ -251,7 +251,7 @@ base::BindRepeating([](const std::string& domain, bool is_https) { return domain == "nonpersistent.com"; })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); DestroyStore(); cookies = CreateAndLoad();
diff --git a/services/network/socket_data_pump_unittest.cc b/services/network/socket_data_pump_unittest.cc index 2112fab8..26d8ee93 100644 --- a/services/network/socket_data_pump_unittest.cc +++ b/services/network/socket_data_pump_unittest.cc
@@ -78,8 +78,7 @@ public ::testing::WithParamInterface<net::IoMode> { public: SocketDataPumpTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} ~SocketDataPumpTest() override {} // Initializes the test case with a socket data provider, which will be used @@ -130,7 +129,7 @@ mojo::ScopedDataPipeProducerHandle send_handle_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::MockClientSocketFactory mock_client_socket_factory_; TestSocketDataPumpDelegate test_delegate_; std::unique_ptr<net::StreamSocket> socket_;
diff --git a/services/network/ssl_config_service_mojo_unittest.cc b/services/network/ssl_config_service_mojo_unittest.cc index c1ca72ce..d659d28 100644 --- a/services/network/ssl_config_service_mojo_unittest.cc +++ b/services/network/ssl_config_service_mojo_unittest.cc
@@ -146,8 +146,7 @@ class NetworkServiceSSLConfigServiceTest : public testing::Test { public: NetworkServiceSSLConfigServiceTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), network_service_(NetworkService::CreateForTesting()) {} ~NetworkServiceSSLConfigServiceTest() override { NetworkContext::SetCertVerifierForTesting(nullptr); @@ -260,7 +259,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<NetworkService> network_service_; mojom::SSLConfigClientPtr ssl_config_client_; mojom::NetworkContextPtr network_context_ptr_;
diff --git a/services/network/tcp_bound_socket_unittest.cc b/services/network/tcp_bound_socket_unittest.cc index 143de24b..b3477cc 100644 --- a/services/network/tcp_bound_socket_unittest.cc +++ b/services/network/tcp_bound_socket_unittest.cc
@@ -38,8 +38,7 @@ class TCPBoundSocketTest : public testing::Test { public: TCPBoundSocketTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), factory_(nullptr /* net_log */, &url_request_context_) {} ~TCPBoundSocketTest() override {} @@ -170,7 +169,7 @@ MojoResult result = receive_handle.BeginReadData( &buffer, &num_bytes, MOJO_READ_DATA_FLAG_NONE); if (result == MOJO_RESULT_SHOULD_WAIT) { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); continue; } if (result != MOJO_RESULT_OK) { @@ -189,12 +188,10 @@ return net::IPEndPoint(net::IPAddress::IPv4Localhost(), 0 /* port */); } - base::test::ScopedTaskEnvironment* scoped_task_environment() { - return &scoped_task_environment_; - } + base::test::TaskEnvironment* task_environment() { return &task_environment_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::TestURLRequestContext url_request_context_; SocketFactory factory_; @@ -354,7 +351,7 @@ MojoResult result = client_socket_send_handle->BeginWriteData( &buffer, &buffer_num_bytes, MOJO_WRITE_DATA_FLAG_NONE); if (result == MOJO_RESULT_SHOULD_WAIT) { - scoped_task_environment()->RunUntilIdle(); + task_environment()->RunUntilIdle(); continue; } if (result != MOJO_RESULT_OK)
diff --git a/services/network/tcp_socket_unittest.cc b/services/network/tcp_socket_unittest.cc index 4fd78ff..4cdd188 100644 --- a/services/network/tcp_socket_unittest.cc +++ b/services/network/tcp_socket_unittest.cc
@@ -256,8 +256,7 @@ class TCPSocketTest : public testing::Test { public: TCPSocketTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), url_request_context_(true) {} ~TCPSocketTest() override {} @@ -343,7 +342,7 @@ SocketFactory* factory() { return factory_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::TestURLRequestContext url_request_context_; std::unique_ptr<SocketFactory> factory_; TestSocketObserver test_observer_; @@ -1428,8 +1427,8 @@ // net::ServerSocket::GetLocalAddress() fails. This should still be considered // as a failure. TEST(TCPServerSocketTest, GetLocalAddressFailedInListen) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); TCPServerSocket socket(nullptr /* delegate */, nullptr /* net_log */, TRAFFIC_ANNOTATION_FOR_TESTS);
diff --git a/services/network/test/test_cookie_manager.h b/services/network/test/test_cookie_manager.h index ce1811f8..1a9569bd 100644 --- a/services/network/test/test_cookie_manager.h +++ b/services/network/test/test_cookie_manager.h
@@ -49,6 +49,8 @@ const std::vector<::ContentSettingPatternSource>& settings) override {} void SetForceKeepSessionState() override {} void BlockThirdPartyCookies(bool block) override {} + void SetContentSettingsForLegacyCookieAccess( + const std::vector<::ContentSettingPatternSource>& settings) override {} void DispatchCookieChange(const net::CanonicalCookie& cookie, network::mojom::CookieChangeCause cause);
diff --git a/services/network/test/test_url_loader_factory_unittest.cc b/services/network/test/test_url_loader_factory_unittest.cc index 893f54d9..eb0726a 100644 --- a/services/network/test/test_url_loader_factory_unittest.cc +++ b/services/network/test/test_url_loader_factory_unittest.cc
@@ -51,7 +51,7 @@ TestURLLoaderClient* client() { return &client_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestURLLoaderFactory factory_; mojom::URLLoaderPtr loader_; TestURLLoaderClient client_;
diff --git a/services/network/throttling/throttling_controller_unittest.cc b/services/network/throttling/throttling_controller_unittest.cc index 367a9ea..2c9134fc 100644 --- a/services/network/throttling/throttling_controller_unittest.cc +++ b/services/network/throttling/throttling_controller_unittest.cc
@@ -143,12 +143,12 @@ ThrottlingNetworkTransaction* transaction() { return transaction_.get(); } void FastForwardUntilNoTasksRemain() { - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; MockNetworkLayer network_layer_; TestCallback callback_; net::CompletionRepeatingCallback completion_callback_;
diff --git a/services/network/tls_client_socket_unittest.cc b/services/network/tls_client_socket_unittest.cc index fbc6b18..95f1d78 100644 --- a/services/network/tls_client_socket_unittest.cc +++ b/services/network/tls_client_socket_unittest.cc
@@ -49,8 +49,7 @@ explicit TLSClientSocketTestBase(Mode mode) : mode_(mode), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + task_environment_(base::test::TaskEnvironment::MainThreadType::IO), url_request_context_(true) {} virtual ~TLSClientSocketTestBase() {} @@ -279,7 +278,7 @@ private: Mode mode_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Mojo data handles obtained from CreateTCPConnectedSocket. mojo::ScopedDataPipeConsumerHandle pre_tls_recv_handle_;
diff --git a/services/network/transitional_url_loader_factory_owner_unittest.cc b/services/network/transitional_url_loader_factory_owner_unittest.cc index 1930491..a86817a 100644 --- a/services/network/transitional_url_loader_factory_owner_unittest.cc +++ b/services/network/transitional_url_loader_factory_owner_unittest.cc
@@ -27,8 +27,7 @@ class TransitionalURLLoaderFactoryOwnerTest : public ::testing::Test { public: TransitionalURLLoaderFactoryOwnerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} void SetUp() override { net::test_server::RegisterDefaultHandlers(&test_server_); @@ -68,7 +67,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::EmbeddedTestServer test_server_; }; @@ -84,9 +83,9 @@ } TEST_F(TransitionalURLLoaderFactoryOwnerTest, SameThread) { - TestOnTaskRunner(scoped_task_environment_.GetMainThreadTaskRunner(), - base::BindLambdaForTesting( - [&]() { scoped_task_environment_.RunUntilIdle(); })); + TestOnTaskRunner( + task_environment_.GetMainThreadTaskRunner(), + base::BindLambdaForTesting([&]() { task_environment_.RunUntilIdle(); })); } } // namespace
diff --git a/services/network/udp_socket_unittest.cc b/services/network/udp_socket_unittest.cc index f07e22b..21ae7b8 100644 --- a/services/network/udp_socket_unittest.cc +++ b/services/network/udp_socket_unittest.cc
@@ -189,8 +189,7 @@ class UDPSocketTest : public testing::Test { public: UDPSocketTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), factory_(nullptr /*netlog*/, &url_request_context_) {} ~UDPSocketTest() override {} @@ -207,7 +206,7 @@ SocketFactory* factory() { return &factory_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::TestURLRequestContext url_request_context_; SocketFactory factory_;
diff --git a/services/network/url_loader_unittest.cc b/services/network/url_loader_unittest.cc index fc02494a..19ff275a 100644 --- a/services/network/url_loader_unittest.cc +++ b/services/network/url_loader_unittest.cc
@@ -384,8 +384,7 @@ class URLLoaderTest : public testing::Test { public: URLLoaderTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), resource_scheduler_(true) { net::TestRootCerts* root_certs = net::TestRootCerts::GetInstance(); root_certs->AddFromFile( @@ -727,7 +726,7 @@ return unowned_test_network_delegate_; } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } static constexpr int kProcessId = 4; static constexpr int kRouteId = 8; @@ -737,7 +736,7 @@ sent_request_ = request; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; net::EmbeddedTestServer test_server_; std::unique_ptr<net::ScopedDefaultHostResolverProc> mock_host_resolver_; net::TestNetworkDelegate*
diff --git a/services/network/websocket_throttler_unittest.cc b/services/network/websocket_throttler_unittest.cc index 5fdb003..79b3dcc 100644 --- a/services/network/websocket_throttler_unittest.cc +++ b/services/network/websocket_throttler_unittest.cc
@@ -16,7 +16,7 @@ class WebSocketThrottlerTest : public ::testing::Test { private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST(WebSocketPerProcessThrottlerTest, InitialState) {
diff --git a/services/preferences/persistent_pref_store_impl_unittest.cc b/services/preferences/persistent_pref_store_impl_unittest.cc index 208bbaeb..4329649b 100644 --- a/services/preferences/persistent_pref_store_impl_unittest.cc +++ b/services/preferences/persistent_pref_store_impl_unittest.cc
@@ -73,7 +73,7 @@ PersistentPrefStore* pref_store() { return pref_store_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<PersistentPrefStoreImpl> impl_;
diff --git a/services/preferences/pref_service_factory_unittest.cc b/services/preferences/pref_service_factory_unittest.cc index d3fd6ea..ab96f01b 100644 --- a/services/preferences/pref_service_factory_unittest.cc +++ b/services/preferences/pref_service_factory_unittest.cc
@@ -247,7 +247,7 @@ quit_closure.Run(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestServiceManager test_service_manager_; base::ScopedTempDir profile_dir_; scoped_refptr<WriteablePrefStore> above_user_prefs_pref_store_;
diff --git a/services/preferences/pref_store_consistency_unittest.cc b/services/preferences/pref_store_consistency_unittest.cc index 85d7ca58..289c602 100644 --- a/services/preferences/pref_store_consistency_unittest.cc +++ b/services/preferences/pref_store_consistency_unittest.cc
@@ -202,7 +202,7 @@ private: scoped_refptr<PersistentPrefStore> pref_store_; std::unique_ptr<PersistentPrefStoreImpl> pref_store_impl_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(PersistentPrefStoreConsistencyTest, TwoPrefs) {
diff --git a/services/preferences/pref_store_impl_unittest.cc b/services/preferences/pref_store_impl_unittest.cc index 486cb2c..b8f863a 100644 --- a/services/preferences/pref_store_impl_unittest.cc +++ b/services/preferences/pref_store_impl_unittest.cc
@@ -102,7 +102,7 @@ PrefStore* pref_store() { return pref_store_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<PrefStoreImpl> impl_;
diff --git a/services/preferences/public/cpp/tests/persistent_pref_store_client_unittest.cc b/services/preferences/public/cpp/tests/persistent_pref_store_client_unittest.cc index c28532e..2c3e0495 100644 --- a/services/preferences/public/cpp/tests/persistent_pref_store_client_unittest.cc +++ b/services/preferences/public/cpp/tests/persistent_pref_store_client_unittest.cc
@@ -102,7 +102,7 @@ void ClearMutableValues() override {} void OnStoreDeletionFromDisk() override {} - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<PrefService> pref_service_;
diff --git a/services/preferences/public/cpp/tests/pref_store_client_unittest.cc b/services/preferences/public/cpp/tests/pref_store_client_unittest.cc index dbb2f66..db0e8a10 100644 --- a/services/preferences/public/cpp/tests/pref_store_client_unittest.cc +++ b/services/preferences/public/cpp/tests/pref_store_client_unittest.cc
@@ -66,7 +66,7 @@ scoped_refptr<PrefStoreClient> store_; // Required by mojo binding code within PrefStoreClient. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(PrefStoreClientTest); };
diff --git a/services/preferences/tracked/pref_hash_filter_unittest.cc b/services/preferences/tracked/pref_hash_filter_unittest.cc index 969e581f..923ed698 100644 --- a/services/preferences/tracked/pref_hash_filter_unittest.cc +++ b/services/preferences/tracked/pref_hash_filter_unittest.cc
@@ -634,7 +634,7 @@ reset_recorded_ = true; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; MockValidationDelegate mock_validation_delegate_; mojo::BindingSet<prefs::mojom::ResetOnLoadObserver> reset_on_load_observer_bindings_;
diff --git a/services/preferences/tracked/segregated_pref_store_unittest.cc b/services/preferences/tracked/segregated_pref_store_unittest.cc index c69b798..f0370313 100644 --- a/services/preferences/tracked/segregated_pref_store_unittest.cc +++ b/services/preferences/tracked/segregated_pref_store_unittest.cc
@@ -98,7 +98,7 @@ return std::move(read_error_delegate_); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; PrefStoreObserverMock observer_;
diff --git a/services/proxy_resolver/host_resolver_mojo_unittest.cc b/services/proxy_resolver/host_resolver_mojo_unittest.cc index 3f8becd..1027d15 100644 --- a/services/proxy_resolver/host_resolver_mojo_unittest.cc +++ b/services/proxy_resolver/host_resolver_mojo_unittest.cc
@@ -162,7 +162,7 @@ return result; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; Waiter waiter_; MockMojoHostResolver mock_resolver_; HostResolverMojo resolver_;
diff --git a/services/proxy_resolver/proxy_resolver_factory_impl_unittest.cc b/services/proxy_resolver/proxy_resolver_factory_impl_unittest.cc index b886ff7b..20b63ec 100644 --- a/services/proxy_resolver/proxy_resolver_factory_impl_unittest.cc +++ b/services/proxy_resolver/proxy_resolver_factory_impl_unittest.cc
@@ -157,7 +157,7 @@ std::move(idle_callback_).Run(); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestProxyResolverFactoryImpl> mock_factory_impl_; TestProxyResolverFactory* mock_factory_; mojo::Remote<mojom::ProxyResolverFactory> factory_;
diff --git a/services/proxy_resolver/proxy_resolver_impl_unittest.cc b/services/proxy_resolver/proxy_resolver_impl_unittest.cc index de7bc5b..b842e1b 100644 --- a/services/proxy_resolver/proxy_resolver_impl_unittest.cc +++ b/services/proxy_resolver/proxy_resolver_impl_unittest.cc
@@ -211,7 +211,7 @@ ~ProxyResolverImplTest() override = default; protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; MockProxyResolverV8Tracing* mock_proxy_resolver_; std::unique_ptr<ProxyResolverImpl> resolver_impl_;
diff --git a/services/resource_coordinator/memory_instrumentation/coordinator_impl_unittest.cc b/services/resource_coordinator/memory_instrumentation/coordinator_impl_unittest.cc index 230a254..a3705628 100644 --- a/services/resource_coordinator/memory_instrumentation/coordinator_impl_unittest.cc +++ b/services/resource_coordinator/memory_instrumentation/coordinator_impl_unittest.cc
@@ -150,9 +150,9 @@ protected: std::unique_ptr<NiceMock<FakeCoordinatorImpl>> coordinator_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY, + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; }; class MockClientProcess : public mojom::ClientProcess { @@ -321,8 +321,8 @@ // This variable to be static as the lambda below has to convert to a function // pointer rather than a functor. - static base::test::ScopedTaskEnvironment* task_environment = nullptr; - task_environment = &scoped_task_environment_; + static base::test::TaskEnvironment* task_environment = nullptr; + task_environment = &task_environment_; NiceMock<MockClientProcess> client_process_1(this, 1, mojom::ProcessType::BROWSER);
diff --git a/services/service_manager/public/cpp/test/test_connector_factory.h b/services/service_manager/public/cpp/test/test_connector_factory.h index e8f55163..5a148d6 100644 --- a/services/service_manager/public/cpp/test/test_connector_factory.h +++ b/services/service_manager/public/cpp/test/test_connector_factory.h
@@ -26,7 +26,7 @@ // Service Manager machinery. Typical usage should look something like: // // TEST(MyTest, Foo) { -// base::test::ScopedTaskEnvironment task_environment; +// base::test::TaskEnvironment task_environment; // TestConnectorFactory connector_factory; // my_service::MyServiceImpl service(connector_factory.RegisterInstance( // my_service::mojom::kServiceName));
diff --git a/services/service_manager/public/cpp/test/test_service.h b/services/service_manager/public/cpp/test/test_service.h index c66db89a..95fd4603 100644 --- a/services/service_manager/public/cpp/test/test_service.h +++ b/services/service_manager/public/cpp/test/test_service.h
@@ -31,7 +31,7 @@ // } // // private: -// base::test::ScopedTaskEnvironment task_environment_; +// base::test::TaskEnvironment task_environment_; // service_manager::TestServiceManager test_service_manager_; // service_manager::TestService test_service_; // };
diff --git a/services/service_manager/public/cpp/test/test_service_manager.h b/services/service_manager/public/cpp/test/test_service_manager.h index 519f7b9..c3023cd 100644 --- a/services/service_manager/public/cpp/test/test_service_manager.h +++ b/services/service_manager/public/cpp/test/test_service_manager.h
@@ -22,7 +22,7 @@ // a |service_manager::ServiceManager| instance directly. // // NOTE: Using this object in tests requires a task execution environment, for -// example a live |base::test::ScopedTaskEnvironment| object. +// example a live |base::test::TaskEnvironment| object. class TestServiceManager { public: // Creates a TestServiceManager using the default global list of manifests.
diff --git a/services/service_manager/tests/background_service_manager_unittest.cc b/services/service_manager/tests/background_service_manager_unittest.cc index 144c87f..8088c41 100644 --- a/services/service_manager/tests/background_service_manager_unittest.cc +++ b/services/service_manager/tests/background_service_manager_unittest.cc
@@ -81,7 +81,7 @@ #define MAYBE_Basic Basic #endif TEST(BackgroundServiceManagerTest, MAYBE_Basic) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; BackgroundServiceManager background_service_manager(GetTestManifests()); mojom::ServicePtr service; ServiceImpl service_impl(mojo::MakeRequest(&service));
diff --git a/services/service_manager/tests/connect/connect_unittest.cc b/services/service_manager/tests/connect/connect_unittest.cc index 29576aa..fc3608d 100644 --- a/services/service_manager/tests/connect/connect_unittest.cc +++ b/services/service_manager/tests/connect/connect_unittest.cc
@@ -339,7 +339,7 @@ connection_state_ = std::move(state); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestServiceManager test_service_manager_; ServiceBinding service_binding_{this}; mojo::BindingSet<test::mojom::ExposedInterface> bindings_;
diff --git a/services/service_manager/tests/lifecycle/lifecycle_unittest.cc b/services/service_manager/tests/lifecycle/lifecycle_unittest.cc index e68e301e..c8419c2e 100644 --- a/services/service_manager/tests/lifecycle/lifecycle_unittest.cc +++ b/services/service_manager/tests/lifecycle/lifecycle_unittest.cc
@@ -255,7 +255,7 @@ return base::WrapUnique(state); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestServiceManager test_service_manager_; Service test_service_; ServiceBinding test_service_binding_;
diff --git a/services/service_manager/tests/service_manager/service_manager_listener_unittest.cc b/services/service_manager/tests/service_manager/service_manager_listener_unittest.cc index 73059a26..a383758 100644 --- a/services/service_manager/tests/service_manager/service_manager_listener_unittest.cc +++ b/services/service_manager/tests/service_manager/service_manager_listener_unittest.cc
@@ -142,7 +142,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; ServiceManager service_manager_; ServiceBinding service_binding_{this}; std::unique_ptr<TestListener> listener_;
diff --git a/services/service_manager/tests/service_manager/service_manager_unittest.cc b/services/service_manager/tests/service_manager/service_manager_unittest.cc index 3279e1c..a29b2d9 100644 --- a/services/service_manager/tests/service_manager/service_manager_unittest.cc +++ b/services/service_manager/tests/service_manager/service_manager_unittest.cc
@@ -380,7 +380,7 @@ service_pid_received_callback_.Run(identity, pid); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestServiceManager test_service_manager_; TestService test_service_;
diff --git a/services/service_manager/tests/service_process_launcher_unittest.cc b/services/service_manager/tests/service_process_launcher_unittest.cc index 4b0f080..e2d84e3 100644 --- a/services/service_manager/tests/service_process_launcher_unittest.cc +++ b/services/service_manager/tests/service_process_launcher_unittest.cc
@@ -72,7 +72,7 @@ #define MAYBE_StartJoin StartJoin #endif // defined(OS_ANDROID) TEST(ServiceProcessLauncherTest, MAYBE_StartJoin) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::FilePath test_service_path; #if defined(OS_FUCHSIA) @@ -95,7 +95,7 @@ run_loop.Run(); launcher.reset(); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); EXPECT_EQ(1u, service_process_launcher_delegate.get_and_clear_adjust_count()); } @@ -108,7 +108,7 @@ // launch child processes, since we won't fail until exec(), therefore the test // will see a valid child process-Id. We use posix_spawn() on Mac OS X. TEST(ServiceProcessLauncherTest, FailToLaunchProcess) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; // Pick a service path that could not possibly ever exist. base::FilePath test_service_path(FILE_PATH_LITERAL("rockot@_rules.service")); @@ -124,7 +124,7 @@ run_loop.Run(); launcher.reset(); - scoped_task_environment.RunUntilIdle(); + task_environment.RunUntilIdle(); } #endif // !defined(OS_POSIX) || defined(OS_MACOSX)
diff --git a/services/service_manager/tests/shutdown/shutdown_unittest.cc b/services/service_manager/tests/shutdown/shutdown_unittest.cc index 5dbb269f..e8078fd 100644 --- a/services/service_manager/tests/shutdown/shutdown_unittest.cc +++ b/services/service_manager/tests/shutdown/shutdown_unittest.cc
@@ -78,7 +78,7 @@ Connector* connector() { return test_service_binding_.GetConnector(); } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; TestServiceManager test_service_manager_; Service test_service_; ServiceBinding test_service_binding_;
diff --git a/services/service_manager/tests/test_support_unittest.cc b/services/service_manager/tests/test_support_unittest.cc index 0650d13..a2c5c2c 100644 --- a/services/service_manager/tests/test_support_unittest.cc +++ b/services/service_manager/tests/test_support_unittest.cc
@@ -109,7 +109,7 @@ } // namespace TEST(ServiceManagerTestSupport, TestConnectorFactoryUniqueService) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestConnectorFactory factory; TestCServiceImpl c_service(factory.RegisterInstance(kServiceCName)); @@ -123,7 +123,7 @@ } TEST(ServiceManagerTestSupport, TestConnectorFactoryMultipleServices) { - base::test::ScopedTaskEnvironment task_environment; + base::test::TaskEnvironment task_environment; TestConnectorFactory factory; TestBServiceImpl b_service(factory.RegisterInstance(kServiceBName));
diff --git a/services/shape_detection/barcode_detection_impl_mac_unittest.mm b/services/shape_detection/barcode_detection_impl_mac_unittest.mm index 8ad606a..d83b16b3 100644 --- a/services/shape_detection/barcode_detection_impl_mac_unittest.mm +++ b/services/shape_detection/barcode_detection_impl_mac_unittest.mm
@@ -120,7 +120,7 @@ MOCK_METHOD0(Detection, void(void)); std::unique_ptr<mojom::BarcodeDetection> impl_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; void* vision_framework_ = nullptr; };
diff --git a/services/shape_detection/barcode_detection_provider_mac_unittest.mm b/services/shape_detection/barcode_detection_provider_mac_unittest.mm index 5dc92d3..a5538772 100644 --- a/services/shape_detection/barcode_detection_provider_mac_unittest.mm +++ b/services/shape_detection/barcode_detection_provider_mac_unittest.mm
@@ -124,7 +124,7 @@ MOCK_METHOD0(OnEnumerateSupportedFormats, void(void)); std::unique_ptr<mojom::BarcodeDetectionProvider> provider_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; void* vision_framework_ = nullptr; bool is_vision_available_ = false; };
diff --git a/services/shape_detection/face_detection_impl_mac_unittest.mm b/services/shape_detection/face_detection_impl_mac_unittest.mm index 19c4d62..3fd4771 100644 --- a/services/shape_detection/face_detection_impl_mac_unittest.mm +++ b/services/shape_detection/face_detection_impl_mac_unittest.mm
@@ -137,7 +137,7 @@ MOCK_METHOD0(Detection, void(void)); std::unique_ptr<mojom::FaceDetection> impl_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; void* vision_framework_; };
diff --git a/services/shape_detection/face_detection_impl_win_unittest.cc b/services/shape_detection/face_detection_impl_win_unittest.cc index 014b3b85..65b0565 100644 --- a/services/shape_detection/face_detection_impl_win_unittest.cc +++ b/services/shape_detection/face_detection_impl_win_unittest.cc
@@ -83,7 +83,7 @@ private: std::unique_ptr<base::win::ScopedCOMInitializer> scoped_com_initializer_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(FaceDetectionImplWinTest); };
diff --git a/services/shape_detection/text_detection_impl_mac_unittest.mm b/services/shape_detection/text_detection_impl_mac_unittest.mm index 411adbec..e709425 100644 --- a/services/shape_detection/text_detection_impl_mac_unittest.mm +++ b/services/shape_detection/text_detection_impl_mac_unittest.mm
@@ -34,7 +34,7 @@ MOCK_METHOD1(Detection, void(size_t)); API_AVAILABLE(macosx(10.11)) std::unique_ptr<TextDetectionImplMac> impl_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(TextDetectionImplMacTest, CreateAndDestroy) {}
diff --git a/services/shape_detection/text_detection_impl_win_unittest.cc b/services/shape_detection/text_detection_impl_win_unittest.cc index 82cdcb7..9a21fa1 100644 --- a/services/shape_detection/text_detection_impl_win_unittest.cc +++ b/services/shape_detection/text_detection_impl_win_unittest.cc
@@ -48,7 +48,7 @@ private: std::unique_ptr<base::win::ScopedCOMInitializer> scoped_com_initializer_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(TextDetectionImplWinTest); };
diff --git a/services/tracing/coordinator_test_util.h b/services/tracing/coordinator_test_util.h index 21c08625..07a40b5 100644 --- a/services/tracing/coordinator_test_util.h +++ b/services/tracing/coordinator_test_util.h
@@ -57,7 +57,7 @@ std::unique_ptr<Coordinator> coordinator_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<AgentRegistry> agent_registry_; std::vector<std::unique_ptr<MockAgent>> agents_;
diff --git a/services/tracing/perfetto/consumer_host_unittest.cc b/services/tracing/perfetto/consumer_host_unittest.cc index a0c4fbf..22b3a6d 100644 --- a/services/tracing/perfetto/consumer_host_unittest.cc +++ b/services/tracing/perfetto/consumer_host_unittest.cc
@@ -400,7 +400,7 @@ bool IsTracingEnabled() { // Flush any other pending tasks on the perfetto task runner to ensure that // any pending data source start callbacks have propagated. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); return threaded_service_->IsTracingEnabled(); } @@ -413,7 +413,7 @@ private: std::unique_ptr<ThreadedPerfettoService> threaded_service_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::OnceClosure on_data_complete_; std::unique_ptr<mojo::DataPipeDrainer> drainer_; std::vector<uint8_t> received_data_;
diff --git a/services/tracing/perfetto/perfetto_integration_unittest.cc b/services/tracing/perfetto/perfetto_integration_unittest.cc index 1441d517..2eb5e03b 100644 --- a/services/tracing/perfetto/perfetto_integration_unittest.cc +++ b/services/tracing/perfetto/perfetto_integration_unittest.cc
@@ -48,12 +48,12 @@ void TearDown() override { perfetto_service_.reset(); } PerfettoService* perfetto_service() const { return perfetto_service_.get(); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } protected: std::unique_ptr<TestDataSource> data_source_; std::unique_ptr<PerfettoService> perfetto_service_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(PerfettoIntegrationTest, ProducerDatasourceInitialized) {
diff --git a/services/tracing/perfetto/system_perfetto_unittest.cc b/services/tracing/perfetto/system_perfetto_unittest.cc index 19443e8..1b43c71 100644 --- a/services/tracing/perfetto/system_perfetto_unittest.cc +++ b/services/tracing/perfetto/system_perfetto_unittest.cc
@@ -52,8 +52,7 @@ class SystemPerfettoTest : public testing::Test { public: SystemPerfettoTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { // Ensure system tracing is enabled for all tests. base::test::ScopedFeatureList feature_list; feature_list.InitAndEnableFeature(features::kEnablePerfettoSystemTracing); @@ -136,7 +135,7 @@ ~SystemPerfettoTest() override { // The real "AndroidSystemProducer" must be destroyed on the correct - // sequence however that sequence is tied to the |scoped_task_environment_| + // sequence however that sequence is tied to the |task_environment_| // which is being deleted now. Therefore to prevent it crashing a future // test we destroy it now. PerfettoTracedProcess::GetTaskRunner()->GetOrCreateTaskRunner()->PostTask( @@ -149,7 +148,7 @@ RunUntilIdle(); // The producer client will be destroyed in the next iteration of the test, // but the sequence it was used on disappears with the - // |scoped_task_environment_|. So we reset the sequence so it can be freely + // |task_environment_|. So we reset the sequence so it can be freely // destroyed. PerfettoTracedProcess::Get()->producer_client()->ResetSequenceForTesting(); if (old_tmp_dir_) { @@ -162,7 +161,7 @@ } PerfettoService* local_service() const { return perfetto_service_.get(); } - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } // Fork() + executes the perfetto cmdline client with the given args and // returns true if we exited with a success otherwise |stderr_| is populated @@ -215,7 +214,7 @@ std::string consumer_socket_; std::unique_ptr<PerfettoService> perfetto_service_; std::vector<std::unique_ptr<TestDataSource>> data_sources_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::string stderr_; const char* old_tmp_dir_ = nullptr; };
diff --git a/services/tracing/public/cpp/perfetto/task_runner_unittest.cc b/services/tracing/public/cpp/perfetto/task_runner_unittest.cc index ce93b41..af7bc32 100644 --- a/services/tracing/public/cpp/perfetto/task_runner_unittest.cc +++ b/services/tracing/public/cpp/perfetto/task_runner_unittest.cc
@@ -114,7 +114,7 @@ TaskDestination* destination() { return task_destination_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_; std::unique_ptr<PerfettoTaskRunner> task_runner_; std::unique_ptr<TaskDestination> task_destination_;
diff --git a/services/tracing/public/cpp/perfetto/trace_event_data_source_unittest.cc b/services/tracing/public/cpp/perfetto/trace_event_data_source_unittest.cc index 7ab0d7e..322facd 100644 --- a/services/tracing/public/cpp/perfetto/trace_event_data_source_unittest.cc +++ b/services/tracing/public/cpp/perfetto/trace_event_data_source_unittest.cc
@@ -217,7 +217,7 @@ PerfettoTracedProcess::ResetTaskRunnerForTesting(); PerfettoTracedProcess::GetTaskRunner()->GetOrCreateTaskRunner(); auto perfetto_wrapper = std::make_unique<PerfettoTaskRunner>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); producer_client_ = std::make_unique<MockProducerClient>(std::move(perfetto_wrapper)); base::ThreadIdNameManager::GetInstance()->SetName(kTestThread); @@ -436,7 +436,7 @@ protected: // Should be the first member. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockProducerClient> producer_client_; int64_t last_timestamp_ = 0;
diff --git a/services/tracing/public/cpp/stack_sampling/stack_unwinder_android_unittest.cc b/services/tracing/public/cpp/stack_sampling/stack_unwinder_android_unittest.cc index 7222fab..bf919a1 100644 --- a/services/tracing/public/cpp/stack_sampling/stack_unwinder_android_unittest.cc +++ b/services/tracing/public/cpp/stack_sampling/stack_unwinder_android_unittest.cc
@@ -34,7 +34,7 @@ private: StackUnwinderAndroid unwinder_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(StackUnwinderTest); };
diff --git a/services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler_unittest.cc b/services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler_unittest.cc index 3239d06..f38b849 100644 --- a/services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler_unittest.cc +++ b/services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler_unittest.cc
@@ -146,7 +146,7 @@ PerfettoTracedProcess::GetTaskRunner()->GetOrCreateTaskRunner(); auto perfetto_wrapper = std::make_unique<PerfettoTaskRunner>( - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); producer_ = std::make_unique<MockPerfettoProducer>(std::move(perfetto_wrapper)); @@ -154,7 +154,7 @@ void TearDown() override { // Be sure there is no pending/running tasks. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void BeginTrace() { @@ -213,7 +213,7 @@ const MockPerfettoProducer* producer() const { return producer_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // We want our singleton torn down after each test. base::ShadowingAtExitManager at_exit_manager_;
diff --git a/services/tracing/public/cpp/trace_event_agent_unittest.cc b/services/tracing/public/cpp/trace_event_agent_unittest.cc index 27ddafef..d1dce69 100644 --- a/services/tracing/public/cpp/trace_event_agent_unittest.cc +++ b/services/tracing/public/cpp/trace_event_agent_unittest.cc
@@ -112,7 +112,7 @@ MockRecorder* recorder() const { return recorder_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockRecorder> recorder_; };
diff --git a/services/tracing/tracing_service_unittest.cc b/services/tracing/tracing_service_unittest.cc index fad0c44..6a1dfc8 100644 --- a/services/tracing/tracing_service_unittest.cc +++ b/services/tracing/tracing_service_unittest.cc
@@ -34,7 +34,7 @@ } private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestConnectorFactory test_connector_factory_; TracingService service_;
diff --git a/services/video_capture/broadcasting_receiver_unittest.cc b/services/video_capture/broadcasting_receiver_unittest.cc index b3e05ea5..82cda91 100644 --- a/services/video_capture/broadcasting_receiver_unittest.cc +++ b/services/video_capture/broadcasting_receiver_unittest.cc
@@ -63,7 +63,7 @@ int32_t client_id_1_; int32_t client_id_2_; base::UnsafeSharedMemoryRegion shm_region_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(
diff --git a/services/video_capture/device_media_to_mojo_adapter_unittest.cc b/services/video_capture/device_media_to_mojo_adapter_unittest.cc index 7ae494eb..a016b53 100644 --- a/services/video_capture/device_media_to_mojo_adapter_unittest.cc +++ b/services/video_capture/device_media_to_mojo_adapter_unittest.cc
@@ -49,7 +49,7 @@ std::unique_ptr<DeviceMediaToMojoAdapter> adapter_; std::unique_ptr<MockReceiver> mock_receiver_; mojom::ReceiverPtr receiver_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(DeviceMediaToMojoAdapterTest,
diff --git a/services/video_capture/test/mock_device_shared_access_unittest.cc b/services/video_capture/test/mock_device_shared_access_unittest.cc index 4a05a9c..4817e436 100644 --- a/services/video_capture/test/mock_device_shared_access_unittest.cc +++ b/services/video_capture/test/mock_device_shared_access_unittest.cc
@@ -247,7 +247,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; media::MockDevice mock_device_; media::MockDeviceFactory* mock_device_factory_; std::unique_ptr<DeviceFactoryMediaToMojoAdapter> service_device_factory_;
diff --git a/services/video_capture/test/service_lifecycle_unittest.cc b/services/video_capture/test/service_lifecycle_unittest.cc index 46c715e4..c4b6353 100644 --- a/services/video_capture/test/service_lifecycle_unittest.cc +++ b/services/video_capture/test/service_lifecycle_unittest.cc
@@ -38,7 +38,7 @@ switches::kUseFakeDeviceForMediaStream); service_impl_ = std::make_unique<VideoCaptureServiceImpl>( service_remote_.BindNewPipeAndPassReceiver(), - scoped_task_environment_.GetMainThreadTaskRunner()); + task_environment_.GetMainThreadTaskRunner()); service_remote_.set_idle_handler( base::TimeDelta(), base::BindRepeating(&VideoCaptureServiceLifecycleTest::OnServiceIdle, @@ -46,7 +46,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<VideoCaptureServiceImpl> service_impl_; mojo::Remote<mojom::VideoCaptureService> service_remote_; base::MockCallback<mojom::DeviceFactory::GetDeviceInfosCallback>
diff --git a/services/video_capture/test/video_capture_service_test.h b/services/video_capture/test/video_capture_service_test.h index e641674..ea50588 100644 --- a/services/video_capture/test/video_capture_service_test.h +++ b/services/video_capture/test/video_capture_service_test.h
@@ -42,7 +42,7 @@ mojom::TextureVirtualDevicePtr AddTextureVirtualDevice( const std::string& device_id); - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<VideoCaptureServiceImpl> service_impl_; mojo::Remote<mojom::VideoCaptureService> service_remote_;
diff --git a/services/video_capture/test/virtual_device_unittest.cc b/services/video_capture/test/virtual_device_unittest.cc index 0b82327..fe122341 100644 --- a/services/video_capture/test/virtual_device_unittest.cc +++ b/services/video_capture/test/virtual_device_unittest.cc
@@ -95,7 +95,7 @@ std::unique_ptr<MockProducer> producer_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; media::VideoCaptureDeviceInfo device_info_; };
diff --git a/services/video_capture/texture_virtual_device_mojo_adapter_unittest.cc b/services/video_capture/texture_virtual_device_mojo_adapter_unittest.cc index f0774b7..1f5be8b 100644 --- a/services/video_capture/texture_virtual_device_mojo_adapter_unittest.cc +++ b/services/video_capture/texture_virtual_device_mojo_adapter_unittest.cc
@@ -60,7 +60,7 @@ std::unique_ptr<MockReceiver> mock_receiver_2_; private: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TextureVirtualDeviceMojoAdapter> adapter_; mojom::ReceiverPtr receiver_1_; mojom::ReceiverPtr receiver_2_;
diff --git a/services/viz/public/cpp/compositing/mojom_traits_unittest.cc b/services/viz/public/cpp/compositing/mojom_traits_unittest.cc index 1c2842d3..f9227b2 100644 --- a/services/viz/public/cpp/compositing/mojom_traits_unittest.cc +++ b/services/viz/public/cpp/compositing/mojom_traits_unittest.cc
@@ -221,7 +221,7 @@ } TEST_F(StructTraitsTest, CopyOutputRequest_BitmapRequest) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; const auto result_format = CopyOutputRequest::ResultFormat::RGBA_BITMAP; const gfx::Rect area(5, 7, 44, 55); @@ -277,7 +277,7 @@ } TEST_F(StructTraitsTest, CopyOutputRequest_MessagePipeBroken) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::RunLoop run_loop; auto request = std::make_unique<CopyOutputRequest>( @@ -299,7 +299,7 @@ } TEST_F(StructTraitsTest, CopyOutputRequest_TextureRequest) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; const auto result_format = CopyOutputRequest::ResultFormat::RGBA_TEXTURE; const int8_t mailbox_name[GL_MAILBOX_SIZE_CHROMIUM] = { @@ -356,7 +356,7 @@ } TEST_F(StructTraitsTest, CopyOutputRequest_CallbackRunsOnce) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; int n_called = 0; auto request = std::make_unique<CopyOutputRequest>( @@ -698,7 +698,7 @@ TEST_F(StructTraitsTest, RenderPass) { // The CopyOutputRequest struct traits require a TaskRunner. - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; const RenderPassId render_pass_id = 3u; const gfx::Rect output_rect(45, 22, 120, 13); @@ -1179,7 +1179,7 @@ } TEST_F(StructTraitsTest, CopyOutputResult_EmptyTexture) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; auto input = std::make_unique<CopyOutputResult>( CopyOutputResult::Format::RGBA_TEXTURE, gfx::Rect()); @@ -1230,7 +1230,7 @@ } TEST_F(StructTraitsTest, CopyOutputResult_Texture) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; const gfx::Rect result_rect(12, 34, 56, 78); const gfx::ColorSpace result_color_space =
diff --git a/services/viz/public/cpp/gpu/gpu_unittest.cc b/services/viz/public/cpp/gpu/gpu_unittest.cc index c3d32fd..621ece7a 100644 --- a/services/viz/public/cpp/gpu/gpu_unittest.cc +++ b/services/viz/public/cpp/gpu/gpu_unittest.cc
@@ -157,7 +157,7 @@ event.Wait(); } - base::test::ScopedTaskEnvironment env_; + base::test::TaskEnvironment env_; base::Thread io_thread_; std::unique_ptr<Gpu> gpu_; std::unique_ptr<TestGpuImpl> gpu_impl_;
diff --git a/skia/public/mojom/test/mojom_traits_unittest.cc b/skia/public/mojom/test/mojom_traits_unittest.cc index e4087ed3..8c507dc9 100644 --- a/skia/public/mojom/test/mojom_traits_unittest.cc +++ b/skia/public/mojom/test/mojom_traits_unittest.cc
@@ -46,7 +46,7 @@ std::move(callback).Run(t); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::BindingSet<TraitsTestService> traits_test_bindings_; DISALLOW_COPY_AND_ASSIGN(StructTraitsTest);
diff --git a/storage/browser/blob/blob_builder_from_stream_unittest.cc b/storage/browser/blob/blob_builder_from_stream_unittest.cc index 4f60ca2d..b75e4e0f 100644 --- a/storage/browser/blob/blob_builder_from_stream_unittest.cc +++ b/storage/browser/blob/blob_builder_from_stream_unittest.cc
@@ -176,7 +176,7 @@ const std::string kContentDisposition = "disposition"; base::ScopedTempDir data_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; BlobStorageLimits limits_; std::unique_ptr<BlobStorageContext> context_; };
diff --git a/storage/browser/blob/blob_flattener_unittest.cc b/storage/browser/blob/blob_flattener_unittest.cc index 553eb2bc..d0561a0 100644 --- a/storage/browser/blob/blob_flattener_unittest.cc +++ b/storage/browser/blob/blob_flattener_unittest.cc
@@ -117,7 +117,7 @@ base::ScopedTempDir temp_dir_; scoped_refptr<TestSimpleTaskRunner> file_runner_ = new TestSimpleTaskRunner(); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<BlobStorageContext> context_; };
diff --git a/storage/browser/blob/blob_impl_unittest.cc b/storage/browser/blob/blob_impl_unittest.cc index 964bd677..86014a88c 100644 --- a/storage/browser/blob/blob_impl_unittest.cc +++ b/storage/browser/blob/blob_impl_unittest.cc
@@ -103,7 +103,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<BlobStorageContext> context_; };
diff --git a/storage/browser/blob/blob_memory_controller_unittest.cc b/storage/browser/blob/blob_memory_controller_unittest.cc index d6aa1af..1bca8b9 100644 --- a/storage/browser/blob/blob_memory_controller_unittest.cc +++ b/storage/browser/blob/blob_memory_controller_unittest.cc
@@ -165,7 +165,7 @@ scoped_refptr<TestSimpleTaskRunner> file_runner_ = new TestSimpleTaskRunner(); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(BlobMemoryControllerTest, Strategy) {
diff --git a/storage/browser/blob/blob_reader_unittest.cc b/storage/browser/blob/blob_reader_unittest.cc index 5ce22762..c8030b0 100644 --- a/storage/browser/blob/blob_reader_unittest.cc +++ b/storage/browser/blob/blob_reader_unittest.cc
@@ -270,7 +270,7 @@ return reader_->total_size_calculated(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; BlobStorageContext context_; std::unique_ptr<BlobDataHandle> blob_handle_;
diff --git a/storage/browser/blob/blob_registry_impl_unittest.cc b/storage/browser/blob/blob_registry_impl_unittest.cc index adcfad05..09fada9 100644 --- a/storage/browser/blob/blob_registry_impl_unittest.cc +++ b/storage/browser/blob/blob_registry_impl_unittest.cc
@@ -177,7 +177,7 @@ protected: base::ScopedTempDir data_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<BlobStorageContext> context_; scoped_refptr<storage::FileSystemContext> file_system_context_; std::unique_ptr<BlobRegistryImpl> registry_impl_; @@ -967,7 +967,7 @@ // Now cause construction to complete, if it would still be going on. CreateBytesProvider(kData, std::move(request)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(0u, BlobsUnderConstruction()); } @@ -1003,7 +1003,7 @@ // Now cause construction to complete, if it would still be going on. CreateBytesProvider(kData, std::move(request)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(0u, BlobsUnderConstruction()); }
diff --git a/storage/browser/blob/blob_storage_context_unittest.cc b/storage/browser/blob/blob_storage_context_unittest.cc index 4e244926..5c20970 100644 --- a/storage/browser/blob/blob_storage_context_unittest.cc +++ b/storage/browser/blob/blob_storage_context_unittest.cc
@@ -115,7 +115,7 @@ base::ScopedTempDir temp_dir_; scoped_refptr<TestSimpleTaskRunner> file_runner_ = new TestSimpleTaskRunner(); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<BlobStorageContext> context_; };
diff --git a/storage/browser/blob/blob_transport_strategy_unittest.cc b/storage/browser/blob/blob_transport_strategy_unittest.cc index ef2c9cb..83b2d004 100644 --- a/storage/browser/blob/blob_transport_strategy_unittest.cc +++ b/storage/browser/blob/blob_transport_strategy_unittest.cc
@@ -96,7 +96,7 @@ protected: base::ScopedTempDir data_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::SequencedTaskRunner> bytes_provider_runner_; base::Time mock_time_; storage::BlobStorageLimits limits_;
diff --git a/storage/browser/blob/blob_url_store_impl_unittest.cc b/storage/browser/blob/blob_url_store_impl_unittest.cc index ffafe3d..7246d7d8 100644 --- a/storage/browser/blob/blob_url_store_impl_unittest.cc +++ b/storage/browser/blob/blob_url_store_impl_unittest.cc
@@ -101,7 +101,7 @@ const GURL kFragmentUrl = GURL("blob:id#fragment"); protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<BlobStorageContext> context_; MockBlobRegistryDelegate delegate_; std::vector<std::string> bad_messages_;
diff --git a/storage/browser/database/database_quota_client_unittest.cc b/storage/browser/database/database_quota_client_unittest.cc index d0635f3..6e07f4f 100644 --- a/storage/browser/database/database_quota_client_unittest.cc +++ b/storage/browser/database/database_quota_client_unittest.cc
@@ -198,7 +198,7 @@ delete_status_ = status; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; int64_t usage_; std::set<url::Origin> origins_; blink::mojom::QuotaStatusCode delete_status_;
diff --git a/storage/browser/database/database_tracker_unittest.cc b/storage/browser/database/database_tracker_unittest.cc index 2f578fbe..86eba1ae 100644 --- a/storage/browser/database/database_tracker_unittest.cc +++ b/storage/browser/database/database_tracker_unittest.cc
@@ -189,7 +189,7 @@ public: static void TestDeleteOpenDatabase(bool incognito_mode) { // Initialize the tracker database. - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); scoped_refptr<MockSpecialStoragePolicy> special_storage_policy = @@ -285,7 +285,7 @@ static void TestDatabaseTracker(bool incognito_mode) { // Initialize the tracker database. - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); scoped_refptr<MockSpecialStoragePolicy> special_storage_policy = @@ -426,7 +426,7 @@ const base::string16 kName = ASCIIToUTF16("name"); const base::string16 kDescription = ASCIIToUTF16("description"); - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -537,7 +537,7 @@ const base::string16 kDescription = ASCIIToUTF16("database_description"); // Initialize the tracker database. - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath origin1_db_dir; @@ -617,7 +617,7 @@ const base::string16 kDescription = ASCIIToUTF16("database_description"); // Initialize the tracker database. - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath origin1_db_dir; @@ -693,7 +693,7 @@ // Initialize a tracker database, no need to put it on disk. const bool kUseInMemoryTrackerDatabase = true; - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); scoped_refptr<DatabaseTracker> tracker( @@ -742,7 +742,7 @@ // Initialize a tracker database, no need to put it on disk. const bool kUseInMemoryTrackerDatabase = true; - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); scoped_refptr<DatabaseTracker> tracker(
diff --git a/storage/browser/fileapi/copy_or_move_file_validator_unittest.cc b/storage/browser/fileapi/copy_or_move_file_validator_unittest.cc index 89671a11..903c1a4c 100644 --- a/storage/browser/fileapi/copy_or_move_file_validator_unittest.cc +++ b/storage/browser/fileapi/copy_or_move_file_validator_unittest.cc
@@ -181,7 +181,7 @@ std::string src_fsid_; std::string dest_fsid_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<storage::FileSystemContext> file_system_context_; FileSystemURL copy_src_;
diff --git a/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc b/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc index 1f151700..9835d4f 100644 --- a/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc +++ b/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
@@ -182,15 +182,14 @@ : origin_(origin), src_type_(src_type), dest_type_(dest_type), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} ~CopyOrMoveOperationTestHelper() { file_system_context_ = nullptr; quota_manager_proxy_->SimulateQuotaManagerDestroyed(); quota_manager_ = nullptr; quota_manager_proxy_ = nullptr; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void SetUp() { @@ -239,7 +238,7 @@ base::FilePath()), storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, base::BindOnce(&ExpectOk)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Grant relatively big quota initially. quota_manager_->SetQuota( @@ -402,7 +401,7 @@ const storage::FileSystemType src_type_; const storage::FileSystemType dest_type_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<storage::FileSystemContext> file_system_context_; scoped_refptr<MockQuotaManagerProxy> quota_manager_proxy_; scoped_refptr<MockQuotaManager> quota_manager_; @@ -737,8 +736,8 @@ base::WriteFile(source_path, kTestData, base::size(kTestData) - 1); // Exclude trailing '\0'. - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); base::Thread file_thread("file_thread"); ASSERT_TRUE(file_thread.Start()); ScopedThreadStopper thread_stopper(&file_thread); @@ -795,8 +794,8 @@ base::WriteFile(source_path, kTestData, base::size(kTestData) - 1); // Exclude trailing '\0'. - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); base::Thread file_thread("file_thread"); ASSERT_TRUE(file_thread.Start()); ScopedThreadStopper thread_stopper(&file_thread); @@ -849,8 +848,8 @@ base::WriteFile(source_path, kTestData, base::size(kTestData) - 1); // Exclude trailing '\0'. - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::IO); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::IO); base::Thread file_thread("file_thread"); ASSERT_TRUE(file_thread.Start()); ScopedThreadStopper thread_stopper(&file_thread);
diff --git a/storage/browser/fileapi/dragged_file_util_unittest.cc b/storage/browser/fileapi/dragged_file_util_unittest.cc index bb35747..bc57462 100644 --- a/storage/browser/fileapi/dragged_file_util_unittest.cc +++ b/storage/browser/fileapi/dragged_file_util_unittest.cc
@@ -281,8 +281,8 @@ base::ScopedTempDir data_dir_; base::ScopedTempDir partition_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; std::string filesystem_id_; scoped_refptr<FileSystemContext> file_system_context_; std::map<base::FilePath, base::FilePath> toplevel_root_map_;
diff --git a/storage/browser/fileapi/file_system_context_unittest.cc b/storage/browser/fileapi/file_system_context_unittest.cc index b579dcd6..327ad85 100644 --- a/storage/browser/fileapi/file_system_context_unittest.cc +++ b/storage/browser/fileapi/file_system_context_unittest.cc
@@ -96,7 +96,7 @@ private: base::ScopedTempDir data_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<storage::SpecialStoragePolicy> storage_policy_; scoped_refptr<MockQuotaManager> mock_quota_manager_; };
diff --git a/storage/browser/fileapi/file_system_file_stream_reader_unittest.cc b/storage/browser/fileapi/file_system_file_stream_reader_unittest.cc index c3855bf..8d94f759 100644 --- a/storage/browser/fileapi/file_system_file_stream_reader_unittest.cc +++ b/storage/browser/fileapi/file_system_file_stream_reader_unittest.cc
@@ -116,8 +116,8 @@ base::FilePath().AppendASCII(file_name)); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; base::ScopedTempDir temp_dir_; scoped_refptr<FileSystemContext> file_system_context_; base::Time test_file_modification_time_;
diff --git a/storage/browser/fileapi/file_system_operation_impl_unittest.cc b/storage/browser/fileapi/file_system_operation_impl_unittest.cc index d87f7f34..3c1b645 100644 --- a/storage/browser/fileapi/file_system_operation_impl_unittest.cc +++ b/storage/browser/fileapi/file_system_operation_impl_unittest.cc
@@ -58,8 +58,7 @@ : public testing::Test { public: FileSystemOperationImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} protected: void SetUp() override { @@ -254,7 +253,7 @@ quota_manager_.get(), url::Origin::Create(sandbox_file_system_.origin()), sandbox_file_system_.type(), usage, quota); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_EQ(blink::mojom::QuotaStatusCode::kOk, status); } @@ -460,7 +459,7 @@ return status; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: scoped_refptr<QuotaManager> quota_manager_;
diff --git a/storage/browser/fileapi/file_system_operation_impl_write_unittest.cc b/storage/browser/fileapi/file_system_operation_impl_write_unittest.cc index 727d262..39303a6 100644 --- a/storage/browser/fileapi/file_system_operation_impl_write_unittest.cc +++ b/storage/browser/fileapi/file_system_operation_impl_write_unittest.cc
@@ -52,8 +52,7 @@ class FileSystemOperationImplWriteTest : public testing::Test { public: FileSystemOperationImplWriteTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), status_(base::File::FILE_OK), cancel_status_(base::File::FILE_ERROR_FAILED), bytes_written_(0), @@ -146,7 +145,7 @@ return blob_storage_context_.get(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<storage::FileSystemContext> file_system_context_; scoped_refptr<MockQuotaManager> quota_manager_;
diff --git a/storage/browser/fileapi/file_system_quota_client_unittest.cc b/storage/browser/fileapi/file_system_quota_client_unittest.cc index 354792ba..a80ecf6 100644 --- a/storage/browser/fileapi/file_system_quota_client_unittest.cc +++ b/storage/browser/fileapi/file_system_quota_client_unittest.cc
@@ -232,7 +232,7 @@ } base::ScopedTempDir data_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<storage::FileSystemContext> file_system_context_; int64_t usage_; int additional_callback_count_;
diff --git a/storage/browser/fileapi/file_system_usage_cache_unittest.cc b/storage/browser/fileapi/file_system_usage_cache_unittest.cc index 663fbf8..4970db49 100644 --- a/storage/browser/fileapi/file_system_usage_cache_unittest.cc +++ b/storage/browser/fileapi/file_system_usage_cache_unittest.cc
@@ -43,7 +43,7 @@ private: base::test::ScopedFeatureList feature_list_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir data_dir_; FileSystemUsageCache usage_cache_;
diff --git a/storage/browser/fileapi/file_writer_delegate_unittest.cc b/storage/browser/fileapi/file_writer_delegate_unittest.cc index cb4e4581..64e5cbb 100644 --- a/storage/browser/fileapi/file_writer_delegate_unittest.cc +++ b/storage/browser/fileapi/file_writer_delegate_unittest.cc
@@ -94,8 +94,7 @@ class FileWriterDelegateTest : public PlatformTest { public: FileWriterDelegateTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} protected: void SetUp() override; @@ -166,7 +165,7 @@ } // This should be alive until the very end of this instance. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<storage::FileSystemContext> file_system_context_; std::unique_ptr<storage::BlobStorageContext> blob_context_;
diff --git a/storage/browser/fileapi/local_file_stream_reader_unittest.cc b/storage/browser/fileapi/local_file_stream_reader_unittest.cc index 01f7ea5..27d3aad 100644 --- a/storage/browser/fileapi/local_file_stream_reader_unittest.cc +++ b/storage/browser/fileapi/local_file_stream_reader_unittest.cc
@@ -105,8 +105,8 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; base::Thread file_thread_; base::ScopedTempDir dir_; base::Time test_file_modification_time_;
diff --git a/storage/browser/fileapi/local_file_stream_writer_unittest.cc b/storage/browser/fileapi/local_file_stream_writer_unittest.cc index ccf3da6..e4b68ba 100644 --- a/storage/browser/fileapi/local_file_stream_writer_unittest.cc +++ b/storage/browser/fileapi/local_file_stream_writer_unittest.cc
@@ -73,8 +73,8 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::IO}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::IO}; base::Thread file_thread_; base::ScopedTempDir temp_dir_; };
diff --git a/storage/browser/fileapi/local_file_util_unittest.cc b/storage/browser/fileapi/local_file_util_unittest.cc index b0b58e6..eb45350 100644 --- a/storage/browser/fileapi/local_file_util_unittest.cc +++ b/storage/browser/fileapi/local_file_util_unittest.cc
@@ -122,7 +122,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<FileSystemContext> file_system_context_; base::ScopedTempDir data_dir_;
diff --git a/storage/browser/fileapi/obfuscated_file_util_unittest.cc b/storage/browser/fileapi/obfuscated_file_util_unittest.cc index 09b3fd6..2b0dac69 100644 --- a/storage/browser/fileapi/obfuscated_file_util_unittest.cc +++ b/storage/browser/fileapi/obfuscated_file_util_unittest.cc
@@ -169,8 +169,7 @@ public ::testing::WithParamInterface<TestMode> { public: ObfuscatedFileUtilTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::IO), + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO), origin_(GURL("http://www.example.com")), type_(storage::kFileSystemTypeTemporary), sandbox_file_system_(origin_, type_), @@ -234,7 +233,7 @@ ASSERT_TRUE(IsDirectoryEmpty(data_dir_.GetPath())); quota_manager_ = nullptr; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); sandbox_file_system_.TearDown(); } @@ -333,7 +332,7 @@ } int64_t SizeInUsageFile() { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); int64_t usage = 0; return usage_cache()->GetUsage( sandbox_file_system_.GetUsageCachePath(), &usage) ? usage : -1; @@ -474,7 +473,7 @@ test_(test) {} ~UsageVerifyHelper() { - test_->scoped_task_environment_.RunUntilIdle(); + test_->task_environment_.RunUntilIdle(); Check(); } @@ -750,7 +749,7 @@ // still alive. file_util->db_flush_delay_seconds_ = 0; file_util->MarkUsed(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(file_util->origin_database_ == nullptr); } @@ -767,7 +766,7 @@ } // At this point the callback is still in the message queue but OFU is gone. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void DestroyDirectoryDatabase_IsolatedTestBody() { @@ -835,7 +834,7 @@ bool is_incognito_; base::test::ScopedFeatureList feature_list_; std::unique_ptr<leveldb::Env> incognito_leveldb_environment_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir data_dir_; scoped_refptr<MockSpecialStoragePolicy> storage_policy_; scoped_refptr<storage::QuotaManager> quota_manager_;
diff --git a/storage/browser/fileapi/plugin_private_file_system_backend_unittest.cc b/storage/browser/fileapi/plugin_private_file_system_backend_unittest.cc index 53b33b4..a10fe55b 100644 --- a/storage/browser/fileapi/plugin_private_file_system_backend_unittest.cc +++ b/storage/browser/fileapi/plugin_private_file_system_backend_unittest.cc
@@ -69,7 +69,7 @@ const base::FilePath& base_path() const { return backend()->base_path(); } base::ScopedTempDir data_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<FileSystemContext> context_; };
diff --git a/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc b/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc index bbda5e9..18cf68e 100644 --- a/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc +++ b/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc
@@ -159,7 +159,7 @@ } base::test::ScopedFeatureList feature_list_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir data_dir_; std::unique_ptr<leveldb::Env> in_memory_env_; std::unique_ptr<ObfuscatedFileUtil> file_util_;
diff --git a/storage/browser/fileapi/quota/quota_reservation_manager_unittest.cc b/storage/browser/fileapi/quota/quota_reservation_manager_unittest.cc index 4a5dd3a5..8c19546 100644 --- a/storage/browser/fileapi/quota/quota_reservation_manager_unittest.cc +++ b/storage/browser/fileapi/quota/quota_reservation_manager_unittest.cc
@@ -211,7 +211,7 @@ const base::FilePath& file_path() const { return file_path_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir work_dir_; base::FilePath file_path_; std::unique_ptr<QuotaReservationManager> reservation_manager_;
diff --git a/storage/browser/fileapi/recursive_operation_delegate_unittest.cc b/storage/browser/fileapi/recursive_operation_delegate_unittest.cc index 37cc39dd..e1d56a93 100644 --- a/storage/browser/fileapi/recursive_operation_delegate_unittest.cc +++ b/storage/browser/fileapi/recursive_operation_delegate_unittest.cc
@@ -191,7 +191,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; // Common temp base for nondestructive uses. base::ScopedTempDir base_;
diff --git a/storage/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc b/storage/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc index baaf6c6..d26d6b9 100644 --- a/storage/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc +++ b/storage/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc
@@ -59,7 +59,7 @@ &SandboxFileSystemBackendDelegateTest::OpenFileSystemCallback, base::Unretained(this)), GURL()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } int callback_count() const { return callback_count_; } @@ -79,7 +79,7 @@ } base::ScopedTempDir data_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<MockQuotaManagerProxy> quota_manager_proxy_; std::unique_ptr<storage::SandboxFileSystemBackendDelegate> delegate_;
diff --git a/storage/browser/fileapi/sandbox_file_system_backend_unittest.cc b/storage/browser/fileapi/sandbox_file_system_backend_unittest.cc index 5bbf93bb..65d2ab0 100644 --- a/storage/browser/fileapi/sandbox_file_system_backend_unittest.cc +++ b/storage/browser/fileapi/sandbox_file_system_backend_unittest.cc
@@ -147,7 +147,7 @@ std::unique_ptr<leveldb::Env> incognito_env_override_; base::ScopedTempDir data_dir_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<storage::SandboxFileSystemBackendDelegate> delegate_; std::unique_ptr<storage::SandboxFileSystemBackend> backend_; base::test::ScopedFeatureList feature_list_;
diff --git a/storage/browser/fileapi/transient_file_util_unittest.cc b/storage/browser/fileapi/transient_file_util_unittest.cc index 4994ec5c..f25dae3 100644 --- a/storage/browser/fileapi/transient_file_util_unittest.cc +++ b/storage/browser/fileapi/transient_file_util_unittest.cc
@@ -69,7 +69,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir data_dir_; scoped_refptr<storage::FileSystemContext> file_system_context_; std::unique_ptr<storage::TransientFileUtil> transient_file_util_;
diff --git a/storage/browser/quota/quota_database_unittest.cc b/storage/browser/quota/quota_database_unittest.cc index a1911ff..f92e6a8 100644 --- a/storage/browser/quota/quota_database_unittest.cc +++ b/storage/browser/quota/quota_database_unittest.cc
@@ -575,7 +575,7 @@ db->CommitTransaction(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(QuotaDatabaseTest, LazyOpen) {
diff --git a/storage/browser/quota/quota_manager_unittest.cc b/storage/browser/quota/quota_manager_unittest.cc index 1c67424..4621a4e 100644 --- a/storage/browser/quota/quota_manager_unittest.cc +++ b/storage/browser/quota/quota_manager_unittest.cc
@@ -98,7 +98,7 @@ void TearDown() override { // Make sure the quota manager cleans up correctly. quota_manager_ = nullptr; - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } protected: @@ -479,7 +479,7 @@ protected: base::test::ScopedFeatureList scoped_feature_list_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; private: base::Time IncrementMockTime() { @@ -536,7 +536,7 @@ CreateClient(kData2, base::size(kData2), QuotaClient::kDatabase)); GetUsageInfo(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(4U, usage_info().size()); for (size_t i = 0; i < usage_info().size(); ++i) { @@ -565,20 +565,20 @@ CreateClient(kData, base::size(kData), QuotaClient::kFileSystem)); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(80, usage()); EXPECT_EQ(0, quota()); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10, usage()); EXPECT_LE(0, quota()); int64_t quota_returned_for_foo = quota(); GetUsageAndQuotaForWebApps(ToOrigin("http://bar.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(quota_returned_for_foo, quota()); @@ -586,30 +586,30 @@ TEST_F(QuotaManagerTest, GetUsage_NoClient) { GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, usage()); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, usage()); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, usage()); EXPECT_EQ(0, unlimited_usage()); GetGlobalUsage(kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, usage()); EXPECT_EQ(0, unlimited_usage()); } @@ -617,30 +617,30 @@ TEST_F(QuotaManagerTest, GetUsage_EmptyClient) { RegisterClient(CreateClient(nullptr, 0, QuotaClient::kFileSystem)); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, usage()); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, usage()); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, usage()); EXPECT_EQ(0, unlimited_usage()); GetGlobalUsage(kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, usage()); EXPECT_EQ(0, unlimited_usage()); } @@ -663,7 +663,7 @@ SetQuotaSettings(kPoolSize, kPerHostQuota, kMustRemainAvailableForSystem); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20, usage()); @@ -672,7 +672,7 @@ EXPECT_EQ(kPerHostQuota, quota()); GetUsageAndQuotaForWebApps(ToOrigin("http://bar.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(5 + 7, usage()); EXPECT_EQ(kPerHostQuota, quota()); @@ -702,37 +702,37 @@ SetQuotaSettings(kPoolSize, kPerHostQuota, kMustRemainAvailableForSystem); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(1 + 128, usage()); EXPECT_EQ(kPerHostQuota, quota()); GetUsageAndQuotaForWebApps(ToOrigin("http://bar.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(4, usage()); EXPECT_EQ(0, quota()); GetUsageAndQuotaForWebApps(ToOrigin("http://unlimited/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(512, usage()); EXPECT_EQ(available_space() + usage(), quota()); GetUsageAndQuotaForWebApps(ToOrigin("http://unlimited/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(8, usage()); EXPECT_EQ(available_space() + usage(), quota()); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(1 + 2 + 128 + 512, usage()); EXPECT_EQ(512, unlimited_usage()); GetGlobalUsage(kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(4 + 8 + 256, usage()); EXPECT_EQ(8, unlimited_usage()); @@ -761,7 +761,7 @@ RegisterClient(client3); GetUsageAndQuotaWithBreakdown(ToOrigin("http://foo.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(80, usage()); usage_breakdown_expected.fileSystem = 80; @@ -770,7 +770,7 @@ EXPECT_TRUE(usage_breakdown_expected.Equals(usage_breakdown())); GetUsageAndQuotaWithBreakdown(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(1 + 4 + 8, usage()); usage_breakdown_expected.fileSystem = 1; @@ -779,7 +779,7 @@ EXPECT_TRUE(usage_breakdown_expected.Equals(usage_breakdown())); GetUsageAndQuotaWithBreakdown(ToOrigin("http://bar.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); usage_breakdown_expected.fileSystem = 0; @@ -793,24 +793,24 @@ blink::mojom::UsageBreakdown(); GetUsageAndQuotaWithBreakdown(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_TRUE(usage_breakdown_expected.Equals(usage_breakdown())); GetUsageAndQuotaWithBreakdown(ToOrigin("http://foo.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_TRUE(usage_breakdown_expected.Equals(usage_breakdown())); GetHostUsageBreakdown("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, usage()); EXPECT_TRUE(usage_breakdown_expected.Equals(usage_breakdown())); GetHostUsageBreakdown("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, usage()); EXPECT_TRUE(usage_breakdown_expected.Equals(usage_breakdown())); } @@ -827,14 +827,14 @@ CreateClient(kData, base::size(kData), QuotaClient::kFileSystem)); GetUsageAndQuotaWithBreakdown(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20, usage()); usage_breakdown_expected.fileSystem = 10 + 20; EXPECT_TRUE(usage_breakdown_expected.Equals(usage_breakdown())); GetUsageAndQuotaWithBreakdown(ToOrigin("http://bar.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(5 + 7, usage()); usage_breakdown_expected.fileSystem = 5 + 7; @@ -862,7 +862,7 @@ CreateClient(kData2, base::size(kData2), QuotaClient::kDatabase)); GetUsageAndQuotaWithBreakdown(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(1 + 128, usage()); usage_breakdown_expected.fileSystem = 1; @@ -870,7 +870,7 @@ EXPECT_TRUE(usage_breakdown_expected.Equals(usage_breakdown())); GetUsageAndQuotaWithBreakdown(ToOrigin("http://bar.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(4, usage()); usage_breakdown_expected.fileSystem = 4; @@ -878,7 +878,7 @@ EXPECT_TRUE(usage_breakdown_expected.Equals(usage_breakdown())); GetUsageAndQuotaWithBreakdown(ToOrigin("http://unlimited/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(512, usage()); usage_breakdown_expected.fileSystem = 0; @@ -886,7 +886,7 @@ EXPECT_TRUE(usage_breakdown_expected.Equals(usage_breakdown())); GetUsageAndQuotaWithBreakdown(ToOrigin("http://unlimited/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(8, usage()); usage_breakdown_expected.fileSystem = 8; @@ -904,7 +904,7 @@ RegisterClient(client); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), type); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20, usage()); @@ -913,19 +913,19 @@ client->AddOriginAndNotify(ToOrigin("https://foo.com/"), type, 1); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), type); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20 + 30 - 5 + 1, usage()); int foo_usage = usage(); client->AddOriginAndNotify(ToOrigin("http://bar.com/"), type, 40); GetUsageAndQuotaForWebApps(ToOrigin("http://bar.com/"), type); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(40, usage()); GetGlobalUsage(type); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(foo_usage + 40, usage()); EXPECT_EQ(0, unlimited_usage()); } @@ -951,7 +951,7 @@ GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kTemp); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kTemp); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20, usage()); EXPECT_EQ(kPerHostQuota, quota()); @@ -960,7 +960,7 @@ RunAdditionalUsageAndQuotaTask(ToOrigin("http://foo.com/"), kTemp); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kTemp); RunAdditionalUsageAndQuotaTask(ToOrigin("http://bar.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20, usage()); EXPECT_EQ(kPerHostQuota, quota()); @@ -990,7 +990,7 @@ // Nuke before waiting for callbacks. set_quota_manager(nullptr); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kErrorAbort, status()); } @@ -1010,23 +1010,23 @@ // quota calculations for an individual origin, so despite global usage // in excess of our poolsize, we still get the nominal quota value. GetStorageCapacity(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_LE(kMustRemainAvailableForSystem, available_space()); GetUsageAndQuotaForWebApps(ToOrigin("http://usage1/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(1, usage()); EXPECT_EQ(kPerHostQuota, quota()); GetUsageAndQuotaForWebApps(ToOrigin("http://usage10/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10, usage()); EXPECT_EQ(kPerHostQuota, quota()); GetUsageAndQuotaForWebApps(ToOrigin("http://usage200/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(200, usage()); EXPECT_EQ(kPerHostQuota, quota()); // should be clamped to the nominal quota @@ -1048,30 +1048,30 @@ const int kPerHostQuotaFor1000 = 200; SetQuotaSettings(1000, kPerHostQuotaFor1000, kMustRemainAvailableForSystem); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(10 + 50 + 4000, usage()); EXPECT_EQ(4000, unlimited_usage()); GetUsageAndQuotaForWebApps(ToOrigin("http://usage10/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10, usage()); EXPECT_EQ(kPerHostQuotaFor1000, quota()); GetUsageAndQuotaForWebApps(ToOrigin("http://usage50/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(50, usage()); EXPECT_EQ(kPerHostQuotaFor1000, quota()); GetUsageAndQuotaForWebApps(ToOrigin("http://unlimited/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(4000, usage()); EXPECT_EQ(available_space() + usage(), quota()); GetUsageAndQuotaForStorageClient(ToOrigin("http://unlimited/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(QuotaManager::kNoLimit, quota()); @@ -1081,25 +1081,25 @@ SetQuotaSettings(100, kPerHostQuotaFor100, kMustRemainAvailableForSystem); GetUsageAndQuotaForWebApps(ToOrigin("http://usage10/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); GetUsageAndQuotaForWebApps(ToOrigin("http://usage50/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(50, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); GetUsageAndQuotaForWebApps(ToOrigin("http://unlimited/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(4000, usage()); EXPECT_EQ(available_space() + usage(), quota()); GetUsageAndQuotaForStorageClient(ToOrigin("http://unlimited/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(QuotaManager::kNoLimit, quota()); @@ -1109,30 +1109,30 @@ mock_special_storage_policy()->NotifyCleared(); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(10 + 50 + 4000, usage()); EXPECT_EQ(0, unlimited_usage()); GetUsageAndQuotaForWebApps(ToOrigin("http://usage10/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); GetUsageAndQuotaForWebApps(ToOrigin("http://usage50/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(50, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); GetUsageAndQuotaForWebApps(ToOrigin("http://unlimited/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(4000, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); GetUsageAndQuotaForStorageClient(ToOrigin("http://unlimited/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(4000, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); @@ -1164,11 +1164,11 @@ RegisterClient(CreateClient(nullptr, 0, QuotaClient::kFileSystem)); GetPersistentHostQuota("foo.com"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, quota()); SetPersistentHostQuota("foo.com", 100); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(100, quota()); GetPersistentHostQuota("foo.com"); @@ -1176,14 +1176,14 @@ GetPersistentHostQuota("foo.com"); SetPersistentHostQuota("foo.com", QuotaManager::kPerHostPersistentQuotaLimit); GetPersistentHostQuota("foo.com"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaManager::kPerHostPersistentQuotaLimit, quota()); // Persistent quota should be capped at the per-host quota limit. SetPersistentHostQuota("foo.com", QuotaManager::kPerHostPersistentQuotaLimit + 100); GetPersistentHostQuota("foo.com"); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaManager::kPerHostPersistentQuotaLimit, quota()); } @@ -1192,14 +1192,14 @@ RegisterClient(CreateClient(nullptr, 0, QuotaClient::kFileSystem)); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(0, quota()); SetPersistentHostQuota("foo.com", 100); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(100, quota()); @@ -1207,13 +1207,13 @@ // The actual space avaialble is given to 'unlimited' origins as their quota. mock_special_storage_policy()->AddUnlimited(GURL("http://unlimited/")); GetUsageAndQuotaForWebApps(ToOrigin("http://unlimited/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(available_space() + usage(), quota()); // GetUsageAndQuotaForStorageClient should just return 0 usage and // kNoLimit quota. GetUsageAndQuotaForStorageClient(ToOrigin("http://unlimited/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, usage()); EXPECT_EQ(QuotaManager::kNoLimit, quota()); } @@ -1243,7 +1243,7 @@ SetQuotaSettings(kPoolSize, kPerHostQuota, kMustRemainAvailable); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(100000, usage()); EXPECT_GT(kPerHostQuota, quota()); @@ -1275,7 +1275,7 @@ SetQuotaSettings(kPoolSize, kPerHostQuota, kMustRemainAvailable); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(100000, usage()); EXPECT_EQ(kPerHostQuota, quota()); @@ -1293,7 +1293,7 @@ // kAvailableSpaceForApp as syncable quota (because of the pre-condition). mock_special_storage_policy()->AddUnlimited(GURL("http://unlimited/")); GetUsageAndQuotaForWebApps(ToOrigin("http://unlimited/"), kSync); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(kAvailableSpaceForApp, quota()); @@ -1315,7 +1315,7 @@ SetPersistentHostQuota("foo.com", 100); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20 + 13 + 19, usage()); EXPECT_EQ(100, quota()); @@ -1339,7 +1339,7 @@ GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kPerm); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kPerm); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20, usage()); EXPECT_EQ(100, quota()); @@ -1348,7 +1348,7 @@ RunAdditionalUsageAndQuotaTask(ToOrigin("http://foo.com/"), kPerm); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kPerm); RunAdditionalUsageAndQuotaTask(ToOrigin("http://bar.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20, usage()); EXPECT_EQ(2, additional_callback_count()); @@ -1372,7 +1372,7 @@ // Nuke before waiting for callbacks. set_quota_manager(nullptr); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kErrorAbort, status()); } @@ -1390,21 +1390,21 @@ CreateClient(kData, base::size(kData), QuotaClient::kFileSystem)); GetGlobalUsage(kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(usage(), 1 + 20 + 600000); EXPECT_EQ(0, unlimited_usage()); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(usage(), 300 + 4000 + 50000 + 7000000); EXPECT_EQ(0, unlimited_usage()); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(usage(), 1 + 20); GetHostUsage("buz.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(usage(), 4000 + 50000); } @@ -1424,37 +1424,37 @@ RegisterClient(client); GetGlobalUsage(kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(usage(), 1 + 20 + 600000); EXPECT_EQ(0, unlimited_usage()); client->ModifyOriginAndNotify(ToOrigin("http://foo.com/"), kPerm, 80000000); GetGlobalUsage(kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(usage(), 1 + 20 + 600000 + 80000000); EXPECT_EQ(0, unlimited_usage()); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(usage(), 300 + 4000 + 50000 + 7000000); EXPECT_EQ(0, unlimited_usage()); client->ModifyOriginAndNotify(ToOrigin("http://foo.com/"), kTemp, 1); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(usage(), 300 + 4000 + 50000 + 7000000 + 1); EXPECT_EQ(0, unlimited_usage()); GetHostUsage("buz.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(usage(), 4000 + 50000); client->ModifyOriginAndNotify(ToOrigin("http://buz.com/"), kTemp, 900000000); GetHostUsage("buz.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(usage(), 4000 + 50000 + 900000000); } @@ -1470,37 +1470,37 @@ RegisterClient(client); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); int64_t predelete_global_tmp = usage(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); int64_t predelete_host_tmp = usage(); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); int64_t predelete_host_pers = usage(); DeleteClientOriginData(client, ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_global_tmp - 1, usage()); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_host_tmp - 1, usage()); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_host_pers, usage()); } TEST_F(QuotaManagerTest, GetStorageCapacity) { GetStorageCapacity(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_LE(0, total_space()); EXPECT_LE(0, available_space()); } @@ -1527,15 +1527,15 @@ RegisterClient(client2); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); int64_t predelete_global_tmp = usage(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); int64_t predelete_host_tmp = usage(); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); int64_t predelete_host_pers = usage(); for (size_t i = 0; i < base::size(kData1); ++i) @@ -1546,13 +1546,13 @@ quota_manager()->NotifyStorageAccessed( QuotaClient::kUnknown, url::Origin::Create(GURL(kData2[i].origin)), kData2[i].type); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EvictOriginData(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); DumpOriginInfoTable(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); for (const auto& entry : origin_info_entries()) { if (entry.type == kTemp) @@ -1560,15 +1560,15 @@ } GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_global_tmp - (1 + 50000), usage()); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_host_tmp - (1 + 50000), usage()); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_host_pers, usage()); } @@ -1584,10 +1584,10 @@ RegisterClient(client); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EvictOriginData(kOrigin, kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Ensure used count and time since access are recorded. histograms.ExpectTotalCount( @@ -1605,13 +1605,13 @@ // Change the used count of the origin. quota_manager()->NotifyStorageAccessed(QuotaClient::kUnknown, kOrigin, kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EvictOriginData(kOrigin, kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // The new used count should be logged. histograms.ExpectTotalCount( @@ -1628,7 +1628,7 @@ client->AddOriginAndNotify(kOrigin, kTemp, 100); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); DeleteOriginFromDatabase(kOrigin, kTemp); @@ -1650,21 +1650,21 @@ RegisterClient(client); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); int64_t predelete_global_tmp = usage(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); int64_t predelete_host_tmp = usage(); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); int64_t predelete_host_pers = usage(); for (size_t i = 0; i < base::size(kData); ++i) NotifyStorageAccessed(client, url::Origin::Create(GURL(kData[i].origin)), kData[i].type); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); client->AddOriginToErrorSet(ToOrigin("http://foo.com/"), kTemp); @@ -1672,12 +1672,12 @@ i < QuotaManager::kThresholdOfErrorsToBeBlacklisted + 1; ++i) { EvictOriginData(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kErrorInvalidModification, status()); } DumpOriginInfoTable(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); bool found_origin_in_database = false; for (const auto& entry : origin_info_entries()) { @@ -1691,32 +1691,32 @@ for (size_t i = 0; i < kNumberOfTemporaryOrigins - 1; ++i) { GetEvictionOrigin(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(eviction_origin().has_value()); // The origin "http://foo.com/" should not be in the LRU list. EXPECT_NE(std::string("http://foo.com/"), eviction_origin()->GetURL().spec()); DeleteOriginFromDatabase(*eviction_origin(), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Now the LRU list must be empty. GetEvictionOrigin(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(eviction_origin().has_value()); // Deleting origins from the database should not affect the results of the // following checks. GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_global_tmp, usage()); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_host_tmp, usage()); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_host_pers, usage()); } @@ -1738,7 +1738,7 @@ SetQuotaSettings(kPoolSize, kPerHostQuota, kMustRemainAvailableForSystem); GetEvictionRoundInfo(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(21, usage()); EXPECT_EQ(kPoolSize, settings().pool_size); @@ -1754,47 +1754,47 @@ RegisterClient(client); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_global_tmp = usage(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); int64_t predelete_host_tmp = usage(); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); int64_t predelete_host_pers = usage(); DeleteHostData(std::string(), kTemp, kAllClients); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_global_tmp, usage()); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_host_tmp, usage()); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_host_pers, usage()); DeleteHostData("foo.com", kTemp, kAllClients); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_global_tmp - 1, usage()); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_host_tmp - 1, usage()); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_host_pers, usage()); } @@ -1820,35 +1820,35 @@ RegisterClient(client2); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_global_tmp = usage(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_foo_tmp = usage(); GetHostUsage("bar.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_bar_tmp = usage(); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_foo_pers = usage(); GetHostUsage("bar.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_bar_pers = usage(); reset_status_callback_count(); DeleteHostData("foo.com", kTemp, kAllClients); DeleteHostData("bar.com", kTemp, kAllClients); DeleteHostData("foo.com", kTemp, kAllClients); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(3, status_callback_count()); DumpOriginInfoTable(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); for (const auto& entry : origin_info_entries()) { if (entry.type != kTemp) @@ -1861,24 +1861,24 @@ } GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_global_tmp - (1 + 20 + 4000 + 50000 + 6000 + 80 + 9), usage()); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - (1 + 20 + 50000 + 6000 + 80), usage()); GetHostUsage("bar.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_bar_tmp - (4000 + 9), usage()); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_pers, usage()); GetHostUsage("bar.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_bar_pers, usage()); } @@ -1906,23 +1906,23 @@ RegisterClient(client2); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_global_tmp = usage(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_foo_tmp = usage(); GetHostUsage("bar.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_bar_tmp = usage(); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_foo_pers = usage(); GetHostUsage("bar.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_bar_pers = usage(); for (size_t i = 0; i < base::size(kData1); ++i) { @@ -1935,18 +1935,18 @@ QuotaClient::kUnknown, url::Origin::Create(GURL(kData2[i].origin)), kData2[i].type); } - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); reset_status_callback_count(); DeleteOriginData(ToOrigin("http://foo.com/"), kTemp, kAllClients); DeleteOriginData(ToOrigin("http://bar.com/"), kTemp, kAllClients); DeleteOriginData(ToOrigin("http://foo.com/"), kTemp, kAllClients); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(3, status_callback_count()); DumpOriginInfoTable(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); for (const auto& entry : origin_info_entries()) { if (entry.type != kTemp) @@ -1957,23 +1957,23 @@ } GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_global_tmp - (1 + 4000 + 50000 + 9), usage()); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - (1 + 50000), usage()); GetHostUsage("bar.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_bar_tmp - (4000 + 9), usage()); GetHostUsage("foo.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_pers, usage()); GetHostUsage("bar.com", kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_bar_pers, usage()); } @@ -1995,17 +1995,17 @@ EXPECT_TRUE(origins.empty()); GetHostUsage("a.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetCachedOrigins(kTemp, &origins); EXPECT_EQ(2U, origins.size()); GetHostUsage("b.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetCachedOrigins(kTemp, &origins); EXPECT_EQ(2U, origins.size()); GetHostUsage("c.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetCachedOrigins(kTemp, &origins); EXPECT_EQ(3U, origins.size()); @@ -2013,7 +2013,7 @@ EXPECT_TRUE(origins.empty()); GetGlobalUsage(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetCachedOrigins(kTemp, &origins); EXPECT_EQ(3U, origins.size()); @@ -2037,29 +2037,29 @@ GURL origin; GetEvictionOrigin(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(eviction_origin().has_value()); NotifyStorageAccessed(client, ToOrigin("http://a.com/"), kTemp); GetEvictionOrigin(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ("http://a.com/", eviction_origin()->GetURL().spec()); NotifyStorageAccessed(client, ToOrigin("http://b.com/"), kPerm); NotifyStorageAccessed(client, ToOrigin("https://a.com/"), kTemp); NotifyStorageAccessed(client, ToOrigin("http://c.com/"), kTemp); GetEvictionOrigin(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ("http://a.com/", eviction_origin()->GetURL().spec()); DeleteOriginFromDatabase(*eviction_origin(), kTemp); GetEvictionOrigin(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ("https://a.com/", eviction_origin()->GetURL().spec()); DeleteOriginFromDatabase(*eviction_origin(), kTemp); GetEvictionOrigin(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ("http://c.com/", eviction_origin()->GetURL().spec()); } @@ -2077,7 +2077,7 @@ GURL origin; GetEvictionOrigin(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(eviction_origin().has_value()); NotifyStorageAccessed(client, ToOrigin("http://a.com/"), kTemp); @@ -2086,19 +2086,19 @@ NotifyStorageAccessed(client, ToOrigin("http://c.com/"), kTemp); GetEvictionOrigin(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(ToOrigin("http://a.com/"), *eviction_origin()); // Notify origin http://a.com is in use. NotifyOriginInUse(ToOrigin("http://a.com/")); GetEvictionOrigin(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(ToOrigin("https://a.com/"), *eviction_origin()); // Notify origin https://a.com is in use while GetEvictionOrigin is running. GetEvictionOrigin(kTemp); NotifyOriginInUse(ToOrigin("https://a.com/")); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Post-filtering must have excluded the returned origin, so we will // see empty result here. EXPECT_FALSE(eviction_origin().has_value()); @@ -2106,7 +2106,7 @@ // Notify access for http://c.com while GetEvictionOrigin is running. GetEvictionOrigin(kTemp); NotifyStorageAccessed(client, ToOrigin("http://c.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Post-filtering must have excluded the returned origin, so we will // see empty result here. EXPECT_FALSE(eviction_origin().has_value()); @@ -2114,7 +2114,7 @@ NotifyOriginNoLongerInUse(ToOrigin("http://a.com/")); NotifyOriginNoLongerInUse(ToOrigin("https://a.com/")); GetEvictionOrigin(kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(ToOrigin("http://a.com/"), *eviction_origin()); } @@ -2131,7 +2131,7 @@ RegisterClient(client); GetOriginsModifiedSince(kTemp, base::Time()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(modified_origins().empty()); EXPECT_EQ(modified_origins_type(), kTemp); @@ -2145,7 +2145,7 @@ base::Time time3 = client->IncrementMockTime(); GetOriginsModifiedSince(kTemp, time1); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(4U, modified_origins().size()); EXPECT_EQ(modified_origins_type(), kTemp); for (size_t i = 0; i < base::size(kData); ++i) { @@ -2154,18 +2154,18 @@ } GetOriginsModifiedSince(kTemp, time2); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(2U, modified_origins().size()); GetOriginsModifiedSince(kTemp, time3); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(modified_origins().empty()); EXPECT_EQ(modified_origins_type(), kTemp); client->ModifyOriginAndNotify(ToOrigin("http://a.com/"), kTemp, 10); GetOriginsModifiedSince(kTemp, time3); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(1U, modified_origins().size()); EXPECT_EQ(1U, modified_origins().count(ToOrigin("http://a.com/"))); EXPECT_EQ(modified_origins_type(), kTemp); @@ -2175,10 +2175,10 @@ SetPersistentHostQuota("example1.com", 1); SetPersistentHostQuota("example2.com", 20); SetPersistentHostQuota("example3.com", 300); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); DumpQuotaTable(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const QuotaTableEntry kEntries[] = { QuotaTableEntry("example1.com", kPerm, 1), @@ -2204,10 +2204,10 @@ QuotaClient::kUnknown, ToOrigin("http://example.com/"), kPerm); quota_manager()->NotifyStorageAccessed( QuotaClient::kUnknown, ToOrigin("http://example.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); DumpOriginInfoTable(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); using TypedOrigin = std::pair<GURL, StorageType>; using Entry = std::pair<TypedOrigin, int>; @@ -2231,12 +2231,12 @@ TEST_F(QuotaManagerTest, QuotaForEmptyHost) { GetPersistentHostQuota(std::string()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, quota()); SetPersistentHostQuota(std::string(), 10); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kErrorNotSupported, status()); } @@ -2267,33 +2267,33 @@ RegisterClient(client4); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_foo_tmp = usage(); DeleteOriginData(ToOrigin("http://foo.com/"), kTemp, QuotaClient::kFileSystem); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 1, usage()); DeleteOriginData(ToOrigin("http://foo.com/"), kTemp, QuotaClient::kAppcache); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); DeleteOriginData(ToOrigin("http://foo.com/"), kTemp, QuotaClient::kDatabase); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 4 - 2 - 1, usage()); DeleteOriginData(ToOrigin("http://foo.com/"), kTemp, QuotaClient::kIndexedDatabase); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); } @@ -2324,31 +2324,31 @@ RegisterClient(client4); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_foo_tmp = usage(); DeleteHostData("foo.com", kTemp, QuotaClient::kFileSystem); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 1, usage()); DeleteHostData("foo.com", kTemp, QuotaClient::kAppcache); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); DeleteHostData("foo.com", kTemp, QuotaClient::kDatabase); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 4 - 2 - 1, usage()); DeleteHostData("foo.com", kTemp, QuotaClient::kIndexedDatabase); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); } @@ -2379,21 +2379,21 @@ RegisterClient(client4); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_foo_tmp = usage(); DeleteOriginData(ToOrigin("http://foo.com/"), kTemp, QuotaClient::kFileSystem | QuotaClient::kDatabase); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 4 - 1, usage()); DeleteOriginData(ToOrigin("http://foo.com/"), kTemp, QuotaClient::kAppcache | QuotaClient::kIndexedDatabase); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); } @@ -2424,21 +2424,21 @@ RegisterClient(client4); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); const int64_t predelete_foo_tmp = usage(); DeleteHostData("foo.com", kTemp, QuotaClient::kFileSystem | QuotaClient::kAppcache); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); DeleteHostData("foo.com", kTemp, QuotaClient::kDatabase | QuotaClient::kIndexedDatabase); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetHostUsage("foo.com", kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); } @@ -2455,10 +2455,10 @@ // Query global usage to warmup the usage tracker caching. GetGlobalUsage(kTemp); GetGlobalUsage(kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(80, usage()); EXPECT_EQ(0, quota()); @@ -2468,25 +2468,25 @@ SetQuotaSettings(kPoolSize, kPerHostQuota, INT64_C(0)); GetStorageCapacity(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(kPoolSize, total_space()); EXPECT_EQ(kPoolSize - 80 - 10, available_space()); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10, usage()); EXPECT_LE(kPerHostQuota, quota()); mock_special_storage_policy()->AddUnlimited(GURL("http://foo.com/")); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(80, usage()); EXPECT_EQ(available_space() + usage(), quota()); GetUsageAndQuotaForWebApps(ToOrigin("http://foo.com/"), kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10, usage()); EXPECT_EQ(available_space() + usage(), quota()); @@ -2497,11 +2497,11 @@ mock_special_storage_policy()->AddSessionOnly(kEpheremalOrigin.GetURL()); GetUsageAndQuotaForWebApps(kEpheremalOrigin, kTemp); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(quota_manager()->settings().session_only_per_host_quota, quota()); GetUsageAndQuotaForWebApps(kEpheremalOrigin, kPerm); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(0, quota()); }
diff --git a/storage/browser/quota/quota_settings_unittest.cc b/storage/browser/quota/quota_settings_unittest.cc index f86bd31..67e64bc 100644 --- a/storage/browser/quota/quota_settings_unittest.cc +++ b/storage/browser/quota/quota_settings_unittest.cc
@@ -33,7 +33,7 @@ protected: base::test::ScopedFeatureList scoped_feature_list_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; const base::FilePath& profile_path() const { return data_dir_.GetPath(); } private: @@ -61,7 +61,7 @@ // 750 = 1500 * PerHostRatio EXPECT_EQ(settings->per_host_quota, 750); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_executed); } @@ -80,7 +80,7 @@ EXPECT_EQ(settings->pool_size, 2000); EXPECT_EQ(settings->per_host_quota, 2000); })); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(callback_executed); } } // namespace storage
diff --git a/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc b/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc index cf5f922..724c396 100644 --- a/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc +++ b/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc
@@ -214,7 +214,7 @@ return num_get_usage_and_quota_for_eviction_; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MockQuotaEvictionHandler> quota_eviction_handler_; std::unique_ptr<QuotaTemporaryStorageEvictor> temporary_storage_evictor_; int num_get_usage_and_quota_for_eviction_;
diff --git a/storage/browser/quota/usage_tracker_unittest.cc b/storage/browser/quota/usage_tracker_unittest.cc index 720d756..1030555 100644 --- a/storage/browser/quota/usage_tracker_unittest.cc +++ b/storage/browser/quota/usage_tracker_unittest.cc
@@ -228,7 +228,7 @@ return client_list; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<MockSpecialStoragePolicy> storage_policy_; MockQuotaClient quota_client_;
diff --git a/storage/browser/test/mock_quota_manager_unittest.cc b/storage/browser/test/mock_quota_manager_unittest.cc index 94e83fd..3b52fc5 100644 --- a/storage/browser/test/mock_quota_manager_unittest.cc +++ b/storage/browser/test/mock_quota_manager_unittest.cc
@@ -97,7 +97,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::ScopedTempDir data_dir_; scoped_refptr<MockQuotaManager> manager_; scoped_refptr<MockSpecialStoragePolicy> policy_;
diff --git a/testing/buildbot/filters/skia_renderer.browser_tests.filter b/testing/buildbot/filters/skia_renderer.browser_tests.filter index e2e76f9..9eab0e8c 100644 --- a/testing/buildbot/filters/skia_renderer.browser_tests.filter +++ b/testing/buildbot/filters/skia_renderer.browser_tests.filter
@@ -1,7 +1,6 @@ # These tests are all flaking after timing changes associated with # SkiaRenderer. We will need to determine the root causes, or update the tests # before beginning Finch trials. https://crbug.com/982933 --BluetoothLowEnergyApiTest.* -BrowserActionApiTest.* -BrowserViewTest.* -ChromeMainTest.* @@ -10,7 +9,6 @@ -InputImeApiTest.* -MediaRouterUIBrowserTest.* -ModernShowActionKey --NavigationPredictorBrowserTest.* -PaymentRequestCanMakePaymentMetricsTest.* -PlatformAppBrowserTest.* -PopupTrackerBrowserTest.*
diff --git a/third_party/blink/common/messaging/string_message_codec_unittest.cc b/third_party/blink/common/messaging/string_message_codec_unittest.cc index 1f858bce..b9354e09 100644 --- a/third_party/blink/common/messaging/string_message_codec_unittest.cc +++ b/third_party/blink/common/messaging/string_message_codec_unittest.cc
@@ -13,7 +13,7 @@ namespace { base::string16 DecodeWithV8(const std::vector<uint8_t>& encoded) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; base::string16 result; v8::Isolate::CreateParams params; @@ -46,7 +46,7 @@ } std::vector<uint8_t> EncodeWithV8(const base::string16& message) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; std::vector<uint8_t> result; v8::Isolate::CreateParams params;
diff --git a/third_party/blink/public/mojom/worker/shared_worker_factory.mojom b/third_party/blink/public/mojom/worker/shared_worker_factory.mojom index 67a8d12..0d653e04 100644 --- a/third_party/blink/public/mojom/worker/shared_worker_factory.mojom +++ b/third_party/blink/public/mojom/worker/shared_worker_factory.mojom
@@ -66,7 +66,7 @@ ControllerServiceWorkerInfo? controller_info, pending_remote<SharedWorkerHost> host, - SharedWorker& shared_worker, + pending_receiver<SharedWorker> shared_worker, // TODO(crbug.com/990845): remove when no longer used. service_manager.mojom.InterfaceProvider interface_provider,
diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h index 14cc7b5..07b68c4 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h
@@ -175,13 +175,13 @@ static void CreateMainThreadForTesting(); // These are dirty workaround for tests requiring the main thread task runner - // from a non-main thread. If your test needs base::ScopedTaskEnvironment + // from a non-main thread. If your test needs base::TaskEnvironment // and a non-main thread may call MainThread()->GetTaskRunner(), call // SetMainThreadTaskRunnerForTesting() in your test fixture's SetUp(), and // call UnsetMainThreadTaskRunnerForTesting() in TearDown(). // // TODO(yutak): Ideally, these should be packed in a custom test fixture - // along with ScopedTaskEnvironment for reusability. + // along with TaskEnvironment for reusability. static void SetMainThreadTaskRunnerForTesting(); static void UnsetMainThreadTaskRunnerForTesting();
diff --git a/third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h b/third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h index b5b1e80..bbfba8c 100644 --- a/third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h +++ b/third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h
@@ -25,7 +25,7 @@ // It allows creation of FrameSchedulers and PageSchedulers, but doesn't provide // any task running infrastructure, relying on the presence of // ThreadTaskRunnerHandle::Get() instead, meaning that the users also have to -// create base::debug::ScopedTaskEnvironment. +// create base::debug::TaskEnvironment. std::unique_ptr<WebThreadScheduler> CreateWebMainThreadSchedulerForTests(); // Simple scheduling infrastructure for unit tests, with the addition of mocked
diff --git a/third_party/blink/public/platform/web_mouse_wheel_event.h b/third_party/blink/public/platform/web_mouse_wheel_event.h index de57f24..a9f9523 100644 --- a/third_party/blink/public/platform/web_mouse_wheel_event.h +++ b/third_party/blink/public/platform/web_mouse_wheel_event.h
@@ -127,6 +127,17 @@ bool IsCancelable() const { return dispatch_type == kBlocking; } #endif }; + +inline bool operator==(const WebMouseWheelEvent& a, + const WebMouseWheelEvent& b) { + return memcmp(&a, &b, a.size()) == 0; +} + +inline bool operator!=(const WebMouseWheelEvent& a, + const WebMouseWheelEvent& b) { + return !(a == b); +} + #pragma pack(pop) } // namespace blink
diff --git a/third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h b/third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h index 297600e..5ffeb7e 100644 --- a/third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h +++ b/third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h
@@ -15,7 +15,6 @@ namespace blink { class MediaStreamDeviceObserver; -class UserMediaProcessor; class WebLocalFrame; class BLINK_MODULES_EXPORT WebMediaStreamDeviceObserver { @@ -25,10 +24,16 @@ MediaStreamDevices GetNonScreenCaptureDevices(); + using OnDeviceStoppedCb = + base::RepeatingCallback<void(const MediaStreamDevice& device)>; + using OnDeviceChangedCb = + base::RepeatingCallback<void(const MediaStreamDevice& old_device, + const MediaStreamDevice& new_device)>; void AddStream(const WebString& label, const MediaStreamDevices& audio_devices, const MediaStreamDevices& video_devices, - const base::WeakPtr<UserMediaProcessor>& event_handler); + OnDeviceStoppedCb on_device_stopped_cb, + OnDeviceChangedCb on_device_changed_cb); void AddStream(const WebString& label, const MediaStreamDevice& device); bool RemoveStream(const WebString& label); void RemoveStreamDevice(const MediaStreamDevice& device);
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn index 0884a73..b68cd538 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn
@@ -1312,7 +1312,6 @@ "intersection_observer/intersection_observer_test.cc", "layout/api/selection_state_test.cc", "layout/collapsed_border_value_test.cc", - "layout/custom/layout_worklet_test.cc", "layout/force_legacy_layout_test.cc", "layout/geometry/logical_offset_test.cc", "layout/geometry/logical_rect_test.cc", @@ -1354,6 +1353,7 @@ "layout/map_coordinates_test.cc", "layout/min_max_size_test.cc", "layout/multi_column_fragmentainer_group_test.cc", + "layout/ng/custom/layout_worklet_test.cc", "layout/ng/exclusions/ng_exclusion_space_test.cc", "layout/ng/geometry/ng_box_strut_test.cc", "layout/ng/geometry/ng_static_position_test.cc",
diff --git a/third_party/blink/renderer/core/animation/animation_effect.cc b/third_party/blink/renderer/core/animation/animation_effect.cc index a27cf06e..238faeb 100644 --- a/third_party/blink/renderer/core/animation/animation_effect.cc +++ b/third_party/blink/renderer/core/animation/animation_effect.cc
@@ -76,6 +76,10 @@ void AnimationEffect::UpdateInheritedTime(double inherited_time, TimingUpdateReason reason) const { + const Timing::AnimationDirection direction = + (GetAnimation() && GetAnimation()->playbackRate() < 0) + ? Timing::AnimationDirection::kBackwards + : Timing::AnimationDirection::kForwards; bool needs_update = needs_update_ || (last_update_time_ != inherited_time && @@ -85,77 +89,27 @@ last_update_time_ = inherited_time; const double local_time = inherited_time; - double time_to_next_iteration = std::numeric_limits<double>::infinity(); if (needs_update) { - const double active_duration = SpecifiedTiming().ActiveDuration(); - const AnimationDirection direction = - (GetAnimation() && GetAnimation()->playbackRate() < 0) ? kBackwards - : kForwards; + Timing::CalculatedTiming calculated = SpecifiedTiming().CalculateTimings( + local_time, direction, IsKeyframeEffect()); - const Timing::Phase current_phase = - CalculatePhase(active_duration, local_time, direction, timing_); - const double active_time = CalculateActiveTime( - active_duration, timing_.ResolvedFillMode(IsKeyframeEffect()), - local_time, current_phase, timing_); + const bool was_canceled = calculated.phase != calculated_.phase && + calculated.phase == Timing::kPhaseNone; - base::Optional<double> progress; - const double iteration_duration = - SpecifiedTiming().IterationDuration().InSecondsF(); - - const double overall_progress = CalculateOverallProgress( - current_phase, active_time, iteration_duration, timing_.iteration_count, - timing_.iteration_start); - const double simple_iteration_progress = CalculateSimpleIterationProgress( - current_phase, overall_progress, timing_.iteration_start, active_time, - active_duration, timing_.iteration_count); - const double current_iteration = CalculateCurrentIteration( - current_phase, active_time, timing_.iteration_count, overall_progress, - simple_iteration_progress); - const bool current_direction_is_forwards = - IsCurrentDirectionForwards(current_iteration, timing_.direction); - const double directed_progress = CalculateDirectedProgress( - simple_iteration_progress, current_iteration, timing_.direction); - - progress = CalculateTransformedProgress( - current_phase, directed_progress, iteration_duration, - current_direction_is_forwards, timing_.timing_function); - if (IsNull(progress.value())) { - progress.reset(); - } - - // Conditionally compute the time to next iteration, which is only - // applicable if the iteration duration is non-zero. - if (iteration_duration) { - const double start_offset = MultiplyZeroAlwaysGivesZero( - timing_.iteration_start, iteration_duration); - DCHECK_GE(start_offset, 0); - const double offset_active_time = - CalculateOffsetActiveTime(active_duration, active_time, start_offset); - const double iteration_time = CalculateIterationTime( - iteration_duration, active_duration, offset_active_time, start_offset, - current_phase, timing_); - if (!IsNull(iteration_time)) { - time_to_next_iteration = iteration_duration - iteration_time; - if (active_duration - active_time < time_to_next_iteration) - time_to_next_iteration = std::numeric_limits<double>::infinity(); - } - } - - const bool was_canceled = current_phase != calculated_.phase && - current_phase == Timing::kPhaseNone; - calculated_.phase = current_phase; // If the animation was canceled, we need to fire the event condition before // updating the timing so that the cancelation time can be determined. - if (was_canceled && event_delegate_) + if (was_canceled && event_delegate_) { + // TODO(jortaylo): OnEventCondition uses the new phase but the old current + // iterations. That is why we partially update *calculated_* here with the + // new phase. This pseudo state can be very confusing. It may be either a + // bug or required but at the very least instead of partially updating + // *calculated_* we should pass in current phase and the old "current + // iterations" more explicitly. https://crbug.com/994850 + calculated_.phase = calculated.phase; event_delegate_->OnEventCondition(*this); + } - calculated_.current_iteration = current_iteration; - calculated_.progress = progress; - - calculated_.is_in_effect = !IsNull(active_time); - calculated_.is_in_play = GetPhase() == Timing::kPhaseActive; - calculated_.is_current = GetPhase() == Timing::kPhaseBefore || IsInPlay(); - calculated_.local_time = last_update_time_; + calculated_ = calculated; } // Test for events even if timing didn't need an update as the animation may @@ -171,10 +125,10 @@ if (needs_update) { // FIXME: This probably shouldn't be recursive. UpdateChildrenAndEffects(); - calculated_.time_to_forwards_effect_change = - CalculateTimeToEffectChange(true, local_time, time_to_next_iteration); - calculated_.time_to_reverse_effect_change = - CalculateTimeToEffectChange(false, local_time, time_to_next_iteration); + calculated_.time_to_forwards_effect_change = CalculateTimeToEffectChange( + true, local_time, calculated_.time_to_next_iteration); + calculated_.time_to_reverse_effect_change = CalculateTimeToEffectChange( + false, local_time, calculated_.time_to_next_iteration); } } @@ -185,10 +139,8 @@ } const Timing::CalculatedTiming& AnimationEffect::EnsureCalculated() const { - if (!owner_) - return calculated_; - - owner_->UpdateIfNecessary(); + if (owner_) + owner_->UpdateIfNecessary(); return calculated_; }
diff --git a/third_party/blink/renderer/core/animation/animation_effect.h b/third_party/blink/renderer/core/animation/animation_effect.h index f1fb4a6e..746d085 100644 --- a/third_party/blink/renderer/core/animation/animation_effect.h +++ b/third_party/blink/renderer/core/animation/animation_effect.h
@@ -67,13 +67,6 @@ friend class EffectStack; public: - // Represents the animation direction from the Web Animations spec, see - // https://drafts.csswg.org/web-animations-1/#animation-direction. - enum AnimationDirection { - kForwards, - kBackwards, - }; - class EventDelegate : public GarbageCollectedFinalized<EventDelegate> { public: virtual ~EventDelegate() = default;
diff --git a/third_party/blink/renderer/core/animation/timing.cc b/third_party/blink/renderer/core/animation/timing.cc index a23f373..269caed 100644 --- a/third_party/blink/renderer/core/animation/timing.cc +++ b/third_party/blink/renderer/core/animation/timing.cc
@@ -106,7 +106,7 @@ } ComputedEffectTiming* Timing::getComputedTiming( - const Timing::CalculatedTiming& calculated_timing, + const CalculatedTiming& calculated_timing, bool is_keyframe_effect) const { ComputedEffectTiming* computed_timing = ComputedEffectTiming::Create(); @@ -149,4 +149,73 @@ return computed_timing; } +Timing::CalculatedTiming Timing::CalculateTimings( + double local_time, + AnimationDirection animation_direction, + bool is_keyframe_effect) const { + const double active_duration = ActiveDuration(); + + const Timing::Phase current_phase = + CalculatePhase(active_duration, local_time, animation_direction, *this); + const double active_time = + CalculateActiveTime(active_duration, ResolvedFillMode(is_keyframe_effect), + local_time, current_phase, *this); + + base::Optional<double> progress; + const double iteration_duration = IterationDuration().InSecondsF(); + + const double overall_progress = + CalculateOverallProgress(current_phase, active_time, iteration_duration, + iteration_count, iteration_start); + const double simple_iteration_progress = CalculateSimpleIterationProgress( + current_phase, overall_progress, iteration_start, active_time, + active_duration, iteration_count); + const double current_iteration = + CalculateCurrentIteration(current_phase, active_time, iteration_count, + overall_progress, simple_iteration_progress); + const bool current_direction_is_forwards = + IsCurrentDirectionForwards(current_iteration, direction); + const double directed_progress = CalculateDirectedProgress( + simple_iteration_progress, current_iteration, direction); + + progress = CalculateTransformedProgress( + current_phase, directed_progress, iteration_duration, + current_direction_is_forwards, timing_function); + if (IsNull(progress.value())) { + progress.reset(); + } + + double time_to_next_iteration = std::numeric_limits<double>::infinity(); + // Conditionally compute the time to next iteration, which is only + // applicable if the iteration duration is non-zero. + if (iteration_duration) { + const double start_offset = + MultiplyZeroAlwaysGivesZero(iteration_start, iteration_duration); + DCHECK_GE(start_offset, 0); + const double offset_active_time = + CalculateOffsetActiveTime(active_duration, active_time, start_offset); + const double iteration_time = CalculateIterationTime( + iteration_duration, active_duration, offset_active_time, start_offset, + current_phase, *this); + if (!IsNull(iteration_time)) { + time_to_next_iteration = iteration_duration - iteration_time; + if (active_duration - active_time < time_to_next_iteration) + time_to_next_iteration = std::numeric_limits<double>::infinity(); + } + } + + CalculatedTiming calculated = CalculatedTiming(); + calculated.phase = current_phase; + calculated.current_iteration = current_iteration; + calculated.progress = progress; + calculated.is_in_effect = !IsNull(active_time); + calculated.is_in_play = calculated.phase == Timing::kPhaseActive; + calculated.is_current = + calculated.phase == Timing::kPhaseBefore || calculated.is_in_play; + calculated.local_time = local_time; + calculated.time_to_next_iteration = time_to_next_iteration; + + return calculated; +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/animation/timing.h b/third_party/blink/renderer/core/animation/timing.h index 5d0cc8c..0a01bb5 100644 --- a/third_party/blink/renderer/core/animation/timing.h +++ b/third_party/blink/renderer/core/animation/timing.h
@@ -64,6 +64,12 @@ kPhaseAfter, kPhaseNone, }; + // Represents the animation direction from the Web Animations spec, see + // https://drafts.csswg.org/web-animations-1/#animation-direction. + enum AnimationDirection { + kForwards, + kBackwards, + }; using FillMode = CompositorKeyframeModel::FillMode; using PlaybackDirection = CompositorKeyframeModel::Direction; @@ -128,20 +134,25 @@ struct CalculatedTiming { DISALLOW_NEW(); - Phase phase; - double current_iteration; - base::Optional<double> progress; - bool is_current; - bool is_in_effect; - bool is_in_play; + Phase phase = Phase::kPhaseNone; + double current_iteration = 0; + base::Optional<double> progress = 0; + bool is_current = false; + bool is_in_effect = false; + bool is_in_play = false; double local_time = NullValue(); - double time_to_forwards_effect_change; - double time_to_reverse_effect_change; + double time_to_forwards_effect_change = + std::numeric_limits<double>::infinity(); + double time_to_reverse_effect_change = + std::numeric_limits<double>::infinity(); + double time_to_next_iteration = std::numeric_limits<double>::infinity(); }; - ComputedEffectTiming* getComputedTiming( - const Timing::CalculatedTiming& calculated_timing, - bool is_keyframe_effect) const; + CalculatedTiming CalculateTimings(double local_time, + AnimationDirection animation_direction, + bool is_keyframe_effect) const; + ComputedEffectTiming* getComputedTiming(const CalculatedTiming& calculated, + bool is_keyframe_effect) const; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/animation/timing_calculations.h b/third_party/blink/renderer/core/animation/timing_calculations.h index 362055d..c2cd033 100644 --- a/third_party/blink/renderer/core/animation/timing_calculations.h +++ b/third_party/blink/renderer/core/animation/timing_calculations.h
@@ -31,7 +31,6 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_TIMING_CALCULATIONS_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_TIMING_CALCULATIONS_H_ -#include "third_party/blink/renderer/core/animation/animation_effect.h" #include "third_party/blink/renderer/core/animation/timing.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h" @@ -68,11 +67,10 @@ } // https://drafts.csswg.org/web-animations-1/#animation-effect-phases-and-states -static inline Timing::Phase CalculatePhase( - double active_duration, - double local_time, - AnimationEffect::AnimationDirection direction, - const Timing& specified) { +static inline Timing::Phase CalculatePhase(double active_duration, + double local_time, + Timing::AnimationDirection direction, + const Timing& specified) { DCHECK_GE(active_duration, 0); if (IsNull(local_time)) return Timing::kPhaseNone; @@ -82,14 +80,14 @@ std::max(std::min(specified.start_delay, end_time), 0.0); if (local_time < before_active_boundary_time || (local_time == before_active_boundary_time && - direction == AnimationEffect::AnimationDirection::kBackwards)) { + direction == Timing::AnimationDirection::kBackwards)) { return Timing::kPhaseBefore; } double active_after_boundary_time = std::max( std::min(specified.start_delay + active_duration, end_time), 0.0); if (local_time > active_after_boundary_time || (local_time == active_after_boundary_time && - direction == AnimationEffect::AnimationDirection::kForwards)) { + direction == Timing::AnimationDirection::kForwards)) { return Timing::kPhaseAfter; } return Timing::kPhaseActive;
diff --git a/third_party/blink/renderer/core/core_idl_files.gni b/third_party/blink/renderer/core/core_idl_files.gni index 0035fba..5c9acba7 100644 --- a/third_party/blink/renderer/core/core_idl_files.gni +++ b/third_party/blink/renderer/core/core_idl_files.gni
@@ -310,10 +310,10 @@ "intersection_observer/intersection_observer.idl", "intersection_observer/intersection_observer_entry.idl", "invisible_dom/activate_invisible_event.idl", - "layout/custom/layout_constraints.idl", - "layout/custom/layout_fragment.idl", - "layout/custom/layout_child.idl", - "layout/custom/layout_worklet_global_scope.idl", + "layout/ng/custom/layout_constraints.idl", + "layout/ng/custom/layout_fragment.idl", + "layout/ng/custom/layout_child.idl", + "layout/ng/custom/layout_worklet_global_scope.idl", "loader/appcache/application_cache.idl", "messaging/message_channel.idl", "messaging/message_port.idl", @@ -558,7 +558,7 @@ "fullscreen/element_fullscreen.idl", "html/html_hyperlink_element_utils.idl", "html/portal/window_portal_host.idl", - "layout/custom/css_layout_worklet.idl", + "layout/ng/custom/css_layout_worklet.idl", "svg/svg_document.idl", "svg/svg_filter_primitive_standard_attributes.idl", "svg/svg_fit_to_view_box.idl", @@ -677,8 +677,8 @@ "input/input_device_capabilities_init.idl", "input/touch_init.idl", "intersection_observer/intersection_observer_init.idl", - "layout/custom/custom_layout_constraints_options.idl", - "layout/custom/fragment_result_options.idl", + "layout/ng/custom/custom_layout_constraints_options.idl", + "layout/ng/custom/fragment_result_options.idl", "messaging/post_message_options.idl", "mojo/mojo_create_data_pipe_options.idl", "mojo/mojo_create_data_pipe_result.idl",
diff --git a/third_party/blink/renderer/core/css/resolver/style_resolver.cc b/third_party/blink/renderer/core/css/resolver/style_resolver.cc index 124da78..e593094c 100644 --- a/third_party/blink/renderer/core/css/resolver/style_resolver.cc +++ b/third_party/blink/renderer/core/css/resolver/style_resolver.cc
@@ -1446,23 +1446,6 @@ } } -static bool ShouldIgnoreTextTrackAuthorStyle(const Document& document) { - Settings* settings = document.GetSettings(); - if (!settings) - return false; - // Ignore author specified settings for text tracks when any of the user - // settings are present. - if (!settings->GetTextTrackBackgroundColor().IsEmpty() || - !settings->GetTextTrackFontFamily().IsEmpty() || - !settings->GetTextTrackFontStyle().IsEmpty() || - !settings->GetTextTrackFontVariant().IsEmpty() || - !settings->GetTextTrackTextColor().IsEmpty() || - !settings->GetTextTrackTextShadow().IsEmpty() || - !settings->GetTextTrackTextSize().IsEmpty()) - return true; - return false; -} - static bool PassesPropertyFilter(ValidPropertyFilter valid_property_filter, CSSPropertyID property, const Document& document) { @@ -1472,8 +1455,7 @@ case ValidPropertyFilter::kFirstLetter: return IsValidFirstLetterStyleProperty(property); case ValidPropertyFilter::kCue: - return IsValidCueStyleProperty(property) && - !ShouldIgnoreTextTrackAuthorStyle(document); + return IsValidCueStyleProperty(property); } NOTREACHED(); return true;
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index 49484f1e..4c261d4 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -3144,15 +3144,17 @@ } void Document::UpdateUseShadowTreesIfNeeded() { - ScriptForbiddenScope forbid_script; - if (use_elements_needing_update_.IsEmpty()) return; + ScriptForbiddenScope forbid_script; + HeapHashSet<Member<SVGUseElement>> elements; use_elements_needing_update_.swap(elements); for (SVGUseElement* element : elements) element->BuildPendingResource(); + + DCHECK(use_elements_needing_update_.IsEmpty()); } StyleResolver* Document::GetStyleResolver() const {
diff --git a/third_party/blink/renderer/core/dom/document.idl b/third_party/blink/renderer/core/dom/document.idl index 942785dc..69af8b45 100644 --- a/third_party/blink/renderer/core/dom/document.idl +++ b/third_party/blink/renderer/core/dom/document.idl
@@ -183,7 +183,7 @@ // CORS and RFC1918 // https://wicg.github.io/cors-rfc1918/#feature-detect - [RuntimeEnabled=CorsRFC1918, ImplementedAs=addressSpaceForBindings] readonly attribute AddressSpace addressSpace; + [RuntimeEnabled=AddressSpace, ImplementedAs=addressSpaceForBindings] readonly attribute AddressSpace addressSpace; // Non-standard APIs [MeasureAs=DocumentCaretRangeFromPoint] Range caretRangeFromPoint([DefaultValue=Undefined] optional long x, [DefaultValue=Undefined] optional long y);
diff --git a/third_party/blink/renderer/core/editing/caret_display_item_client.cc b/third_party/blink/renderer/core/editing/caret_display_item_client.cc index 28186d9..020accc6 100644 --- a/third_party/blink/renderer/core/editing/caret_display_item_client.cc +++ b/third_party/blink/renderer/core/editing/caret_display_item_client.cc
@@ -38,6 +38,7 @@ #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_invalidator.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" +#include "third_party/blink/renderer/platform/graphics/dark_mode_filter.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" #include "third_party/blink/renderer/platform/graphics/paint/drawing_recorder.h" @@ -266,7 +267,7 @@ DrawingRecorder recorder(context, *this, display_item_type); IntRect paint_rect = PixelSnappedIntRect(drawing_rect); - context.FillRect(paint_rect, color_); + context.FillRect(paint_rect, color_, DarkModeFilter::ElementRole::kText); } String CaretDisplayItemClient::DebugName() const {
diff --git a/third_party/blink/renderer/core/frame/csp/content_security_policy.cc b/third_party/blink/renderer/core/frame/csp/content_security_policy.cc index 3bad077..9a85936 100644 --- a/third_party/blink/renderer/core/frame/csp/content_security_policy.cc +++ b/third_party/blink/renderer/core/frame/csp/content_security_policy.cc
@@ -873,7 +873,7 @@ } void ContentSecurityPolicy::TreatAsPublicAddress() { - if (!RuntimeEnabledFeatures::CorsRFC1918Enabled()) + if (!RuntimeEnabledFeatures::AddressSpaceEnabled()) return; treat_as_public_address_ = true; }
diff --git a/third_party/blink/renderer/core/frame/csp/content_security_policy_test.cc b/third_party/blink/renderer/core/frame/csp/content_security_policy_test.cc index 85bb02e0..603ef51 100644 --- a/third_party/blink/renderer/core/frame/csp/content_security_policy_test.cc +++ b/third_party/blink/renderer/core/frame/csp/content_security_policy_test.cc
@@ -100,7 +100,7 @@ } TEST_F(ContentSecurityPolicyTest, ParseEnforceTreatAsPublicAddressDisabled) { - ScopedCorsRFC1918ForTest cors_rfc1918(false); + ScopedAddressSpaceForTest address_space(false); execution_context->SetAddressSpace(network::mojom::IPAddressSpace::kPrivate); EXPECT_EQ(network::mojom::IPAddressSpace::kPrivate, execution_context->AddressSpace()); @@ -114,7 +114,7 @@ } TEST_F(ContentSecurityPolicyTest, ParseEnforceTreatAsPublicAddressEnabled) { - ScopedCorsRFC1918ForTest cors_rfc1918(true); + ScopedAddressSpaceForTest address_space(true); execution_context->SetAddressSpace(network::mojom::IPAddressSpace::kPrivate); EXPECT_EQ(network::mojom::IPAddressSpace::kPrivate, execution_context->AddressSpace());
diff --git a/third_party/blink/renderer/core/frame/frame_view.cc b/third_party/blink/renderer/core/frame/frame_view.cc index e1ca3f8..10f4101 100644 --- a/third_party/blink/renderer/core/frame/frame_view.cc +++ b/third_party/blink/renderer/core/frame/frame_view.cc
@@ -153,11 +153,12 @@ void FrameView::UpdateRenderThrottlingStatus(bool hidden_for_throttling, bool subtree_throttled, bool recurse) { - bool was_throttled = CanThrottleRendering(); + bool visibility_changed = (hidden_for_throttling_ || subtree_throttled_) != + (hidden_for_throttling || subtree_throttled || + DisplayLockedInParentFrame()); hidden_for_throttling_ = hidden_for_throttling; subtree_throttled_ = subtree_throttled || DisplayLockedInParentFrame(); - bool throttling_did_change = (was_throttled != CanThrottleRendering()); - if (throttling_did_change) + if (visibility_changed) RenderThrottlingStatusChanged(); if (recurse) { for (Frame* child = GetFrame().Tree().FirstChild(); child;
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.cc b/third_party/blink/renderer/core/frame/local_frame_view.cc index 91ffe0ca..f4f41ac4 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -3987,6 +3987,8 @@ InvalidateForThrottlingChange(); if (FrameScheduler* frame_scheduler = frame_->GetFrameScheduler()) { + // TODO(szager): Per crbug.com/994443, maybe this should be: + // SetFrameVisible(IsHiddenForThrottling() || IsSubtreeThrottled()); frame_scheduler->SetFrameVisible(!IsHiddenForThrottling()); frame_scheduler->SetCrossOrigin(frame_->IsCrossOriginSubframe()); frame_scheduler->TraceUrlChange(frame_->GetDocument()->Url().GetString());
diff --git a/third_party/blink/renderer/core/frame/visual_viewport.cc b/third_party/blink/renderer/core/frame/visual_viewport.cc index 05e32a61..3f137d01 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport.cc +++ b/third_party/blink/renderer/core/frame/visual_viewport.cc
@@ -102,11 +102,11 @@ } TransformPaintPropertyNode* VisualViewport::GetPageScaleNode() const { - return scale_transform_node_.get(); + return page_scale_node__.get(); } TransformPaintPropertyNode* VisualViewport::GetScrollTranslationNode() const { - return translation_transform_node_.get(); + return scroll_translation_node_.get(); } ScrollPaintPropertyNode* VisualViewport::GetScrollNode() const { @@ -152,8 +152,8 @@ } } - if (inner_viewport_container_layer_) { - inner_viewport_container_layer_->SetLayerState( + if (container_layer_) { + container_layer_->SetLayerState( PropertyTreeState(*transform_parent, *clip_parent, *effect_parent), IntPoint()); } @@ -183,12 +183,12 @@ state.flags.in_subtree_of_page_scale = false; state.compositor_element_id = GetCompositorElementId(); - if (!scale_transform_node_) { - scale_transform_node_ = TransformPaintPropertyNode::Create( + if (!page_scale_node__) { + page_scale_node__ = TransformPaintPropertyNode::Create( *overscroll_elasticity_transform_node_.get(), std::move(state)); change = PaintPropertyChangeType::kNodeAddedOrRemoved; } else { - auto effective_change_type = scale_transform_node_->Update( + auto effective_change_type = page_scale_node__->Update( *overscroll_elasticity_transform_node_.get(), std::move(state)); // As an optimization, attempt to directly update the compositor // scale translation node and return kChangedOnlyCompositedValues which @@ -201,11 +201,11 @@ if (auto* paint_artifact_compositor = GetPaintArtifactCompositor()) { bool updated = paint_artifact_compositor->DirectlyUpdatePageScaleTransform( - *scale_transform_node_); + *page_scale_node__); if (updated) { effective_change_type = PaintPropertyChangeType::kChangedOnlyCompositedValues; - scale_transform_node_->CompositorSimpleValuesUpdated(); + page_scale_node__->CompositorSimpleValuesUpdated(); } } } @@ -215,7 +215,7 @@ if (page_scale_layer_) { page_scale_layer_->SetLayerState( - PropertyTreeState(*scale_transform_node_, *clip_parent, *effect_parent), + PropertyTreeState(*page_scale_node__, *clip_parent, *effect_parent), IntPoint()); } @@ -252,13 +252,13 @@ TransformPaintPropertyNode::State state{ FloatSize(-scroll_position.Width(), -scroll_position.Height())}; state.scroll = scroll_node_; - if (!translation_transform_node_) { - translation_transform_node_ = TransformPaintPropertyNode::Create( - *scale_transform_node_, std::move(state)); + if (!scroll_translation_node_) { + scroll_translation_node_ = TransformPaintPropertyNode::Create( + *page_scale_node__, std::move(state)); change = PaintPropertyChangeType::kNodeAddedOrRemoved; } else { - auto effective_change_type = translation_transform_node_->Update( - *scale_transform_node_, std::move(state)); + auto effective_change_type = scroll_translation_node_->Update( + *page_scale_node__, std::move(state)); // As an optimization, attempt to directly update the compositor // translation node and return kChangedOnlyCompositedValues which avoids // an expensive PaintArtifactCompositor update. @@ -270,20 +270,20 @@ if (auto* paint_artifact_compositor = GetPaintArtifactCompositor()) { bool updated = paint_artifact_compositor->DirectlyUpdateScrollOffsetTransform( - *translation_transform_node_); + *scroll_translation_node_); if (updated) { effective_change_type = PaintPropertyChangeType::kChangedOnlyCompositedValues; - translation_transform_node_->CompositorSimpleValuesUpdated(); + scroll_translation_node_->CompositorSimpleValuesUpdated(); } } } } } - if (inner_viewport_scroll_layer_) { - inner_viewport_scroll_layer_->SetLayerState( - PropertyTreeState(*translation_transform_node_, *clip_parent, + if (scroll_layer_) { + scroll_layer_->SetLayerState( + PropertyTreeState(*scroll_translation_node_, *clip_parent, *effect_parent), IntPoint()); } @@ -376,10 +376,9 @@ TRACE_EVENT_INSTANT1("loading", "viewport", TRACE_EVENT_SCOPE_THREAD, "data", ViewportToTracedValue()); - if (inner_viewport_container_layer_) { - inner_viewport_container_layer_->SetSize(gfx::Size(size_)); - inner_viewport_scroll_layer_->CcLayer()->SetScrollable( - static_cast<gfx::Size>(size_)); + if (container_layer_) { + container_layer_->SetSize(gfx::Size(size_)); + scroll_layer_->CcLayer()->SetScrollable(static_cast<gfx::Size>(size_)); // Need to re-compute sizes for the overlay scrollbars. if (overlay_scrollbar_horizontal_) { @@ -403,8 +402,8 @@ TRACE_EVENT0("blink", "VisualViewport::mainFrameDidChangeSize"); // In unit tests we may not have initialized the layer tree. - if (inner_viewport_scroll_layer_) - inner_viewport_scroll_layer_->SetSize(gfx::Size(ContentsSize())); + if (scroll_layer_) + scroll_layer_->SetSize(gfx::Size(ContentsSize())); needs_paint_property_update_ = true; ClampToBoundaries(); @@ -580,39 +579,37 @@ if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) return; - if (inner_viewport_scroll_layer_) + if (scroll_layer_) return; DCHECK(!overlay_scrollbar_horizontal_ && !overlay_scrollbar_vertical_ && - !page_scale_layer_ && !inner_viewport_container_layer_); + !page_scale_layer_ && !container_layer_); needs_paint_property_update_ = true; - // FIXME: The root transform layer should only be created on demand. root_transform_layer_ = std::make_unique<GraphicsLayer>(*this); - inner_viewport_container_layer_ = std::make_unique<GraphicsLayer>(*this); + container_layer_ = std::make_unique<GraphicsLayer>(*this); page_scale_layer_ = std::make_unique<GraphicsLayer>(*this); - inner_viewport_scroll_layer_ = std::make_unique<GraphicsLayer>(*this); + scroll_layer_ = std::make_unique<GraphicsLayer>(*this); ScrollingCoordinator* coordinator = GetPage().GetScrollingCoordinator(); DCHECK(coordinator); // Set masks to bounds so the compositor doesn't clobber a manually // set inner viewport container layer size. - inner_viewport_container_layer_->SetMasksToBounds( + container_layer_->SetMasksToBounds( GetPage().GetSettings().GetMainFrameClipsContent()); - inner_viewport_container_layer_->SetSize(gfx::Size(size_)); + container_layer_->SetSize(gfx::Size(size_)); - inner_viewport_scroll_layer_->CcLayer()->SetScrollable( - static_cast<gfx::Size>(size_)); + scroll_layer_->CcLayer()->SetScrollable(static_cast<gfx::Size>(size_)); DCHECK(MainFrame()); DCHECK(MainFrame()->GetDocument()); - inner_viewport_scroll_layer_->SetElementId(GetCompositorScrollElementId()); + scroll_layer_->SetElementId(GetCompositorScrollElementId()); page_scale_layer_->SetElementId(GetCompositorElementId()); - root_transform_layer_->AddChild(inner_viewport_container_layer_.get()); - inner_viewport_container_layer_->AddChild(page_scale_layer_.get()); - page_scale_layer_->AddChild(inner_viewport_scroll_layer_.get()); + root_transform_layer_->AddChild(container_layer_.get()); + container_layer_->AddChild(page_scale_layer_.get()); + page_scale_layer_->AddChild(scroll_layer_.get()); // Ensure this class is set as the scroll layer's ScrollableArea. coordinator->ScrollableAreaScrollLayerDidChange(this); @@ -624,23 +621,23 @@ TRACE_EVENT1("blink", "VisualViewport::attachLayerTree", "currentLayerTreeRoot", (bool)current_layer_tree_root); if (!current_layer_tree_root) { - if (inner_viewport_scroll_layer_) - inner_viewport_scroll_layer_->RemoveAllChildren(); + if (scroll_layer_) + scroll_layer_->RemoveAllChildren(); return; } if (current_layer_tree_root->Parent() && - current_layer_tree_root->Parent() == inner_viewport_scroll_layer_.get()) + current_layer_tree_root->Parent() == scroll_layer_.get()) return; - DCHECK(inner_viewport_scroll_layer_); - inner_viewport_scroll_layer_->RemoveAllChildren(); - inner_viewport_scroll_layer_->AddChild(current_layer_tree_root); + DCHECK(scroll_layer_); + scroll_layer_->RemoveAllChildren(); + scroll_layer_->AddChild(current_layer_tree_root); } void VisualViewport::InitializeScrollbars() { // Do nothing if not attached to layer tree yet - will initialize upon attach. - if (!inner_viewport_container_layer_) + if (!container_layer_) return; needs_paint_property_update_ = true; @@ -675,20 +672,20 @@ IntSize VisualViewport::ScrollbarSize(ScrollbarOrientation orientation) const { if (orientation == kHorizontalScrollbar) { - int viewport_width = inner_viewport_container_layer_->Size().width(); + int viewport_width = container_layer_->Size().width(); return IntSize(viewport_width - ScrollbarThickness(), ScrollbarThickness()); } - int viewport_height = inner_viewport_container_layer_->Size().height(); + int viewport_height = container_layer_->Size().height(); return IntSize(ScrollbarThickness(), viewport_height - ScrollbarThickness()); } IntPoint VisualViewport::ScrollbarOffset( ScrollbarOrientation orientation) const { if (orientation == kHorizontalScrollbar) { - int viewport_height = inner_viewport_container_layer_->Size().height(); + int viewport_height = container_layer_->Size().height(); return IntPoint(0, viewport_height - ScrollbarThickness()); } - int viewport_width = inner_viewport_container_layer_->Size().width(); + int viewport_width = container_layer_->Size().width(); return IntPoint(viewport_width - ScrollbarThickness(), 0); } @@ -701,7 +698,7 @@ scrollbar_layer_group = is_horizontal ? scrollbar_layer_group_horizontal_ : scrollbar_layer_group_vertical_; if (!scrollbar_graphics_layer->Parent()) - inner_viewport_container_layer_->AddChild(scrollbar_graphics_layer); + container_layer_->AddChild(scrollbar_graphics_layer); if (!scrollbar_layer_group) { ScrollingCoordinator* coordinator = GetPage().GetScrollingCoordinator(); @@ -727,7 +724,7 @@ scrollbar_graphics_layer->SetDrawsContent(false); scrollbar_graphics_layer->SetHitTestable(false); scrollbar_layer_group->scrollbar_layer->SetScrollElementId( - inner_viewport_scroll_layer_->CcLayer()->element_id()); + scroll_layer_->CcLayer()->element_id()); } // Use the GraphicsLayer to position the scrollbars. @@ -958,11 +955,11 @@ } GraphicsLayer* VisualViewport::LayerForContainer() const { - return inner_viewport_container_layer_.get(); + return container_layer_.get(); } GraphicsLayer* VisualViewport::LayerForScrolling() const { - return inner_viewport_scroll_layer_.get(); + return scroll_layer_.get(); } GraphicsLayer* VisualViewport::LayerForHorizontalScrollbar() const { @@ -1178,11 +1175,11 @@ String VisualViewport::DebugName(const GraphicsLayer* graphics_layer) const { String name; - if (graphics_layer == inner_viewport_container_layer_.get()) { + if (graphics_layer == container_layer_.get()) { name = "Inner Viewport Container Layer"; } else if (graphics_layer == page_scale_layer_.get()) { name = "Page Scale Layer"; - } else if (graphics_layer == inner_viewport_scroll_layer_.get()) { + } else if (graphics_layer == scroll_layer_.get()) { name = "Inner Viewport Scroll Layer"; } else if (graphics_layer == overlay_scrollbar_horizontal_.get()) { name = "Overlay Scrollbar Horizontal Layer"; @@ -1199,7 +1196,7 @@ const ScrollableArea* VisualViewport::GetScrollableAreaForTesting( const GraphicsLayer* layer) const { - if (layer == inner_viewport_scroll_layer_.get()) + if (layer == scroll_layer_.get()) return this; return nullptr; } @@ -1218,9 +1215,9 @@ void VisualViewport::DisposeImpl() { root_transform_layer_.reset(); - inner_viewport_container_layer_.reset(); + container_layer_.reset(); page_scale_layer_.reset(); - inner_viewport_scroll_layer_.reset(); + scroll_layer_.reset(); // scrollbar_layer_group_* are referenced from overlay_scrollbar_*, thus // overlay_scrollbar_* must be destroyed before scrollbar_layer_group_*. overlay_scrollbar_horizontal_.reset(); @@ -1229,8 +1226,8 @@ scrollbar_layer_group_vertical_.reset(); device_emulation_transform_node_.reset(); overscroll_elasticity_transform_node_.reset(); - scale_transform_node_.reset(); - translation_transform_node_.reset(); + page_scale_node__.reset(); + scroll_translation_node_.reset(); scroll_node_.reset(); horizontal_scrollbar_effect_node_.reset(); vertical_scrollbar_effect_node_.reset();
diff --git a/third_party/blink/renderer/core/frame/visual_viewport.h b/third_party/blink/renderer/core/frame/visual_viewport.h index 5dfb13b..abd3bca 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport.h +++ b/third_party/blink/renderer/core/frame/visual_viewport.h
@@ -73,23 +73,31 @@ // to the outer viewport. The inner viewport is always contained in the outer // viewport and can pan within it. // -// When attached, the tree will look like this: +// When attached, the layer tree will look like this: +// (pre-CompositeAfterPaint only) // -// VV::m_rootTransformLayer -// +- VV::m_innerViewportContainerLayer -// +- VV::m_overscrollElasticityLayer -// | +- VV::m_pageScaleLayer -// | +- VV::m_innerViewportScrollLayer -// | +-- PLC::m_overflowControlsHostLayer -// | +-- PLC::m_containerLayer (fixed pos container) -// | +-- PLC::m_scrollLayer -// | +-- PLC::m_rootContentLayer -// | +-- LayoutView CompositedLayerMapping layers -// +- PageOverlay for InspectorOverlay -// +- PageOverlay for ColorOverlay -// +- PLC::m_layerForHorizontalScrollbar -// +- PLC::m_layerForVerticalScrollbar -// +- PLC::m_layerForScrollCorner (non-overlay only) +// root_transform_layer_ +// +- container_layer_ (transform: DET_or_parent) +// +- page_scale_layer_ (transform: page_scale_node_) +// | +- scroll_layer_ (transform: scroll_translation_node_) +// | +- LayoutView CompositedLayerMapping layers +// +- overlay_scrollbar_horizontal_ (optional, transform: DET_or_parent) +// +- overlay_scrollbar_vertical_ (optional, transform: DET_or_parent) +// (DET_or_parent: device_emulation_transform_node_ if exists, +// or the parent transform state) +// +// After PrePaint, the property trees will look like this: +// +// Transform tree: +// parent transform state +// +- device_emulation_transform_node_ (optional) +// +- overscroll_elasticity_transform_node_ +// +- page_scale_node__ +// +- scroll_translation_node_ (scroll: scroll_node_) +// Effect tree: +// parent effect state +// +- horizontal_scrollbar_effect_node_ +// +- vertical_scrollbar_effect_node_ // class CORE_EXPORT VisualViewport final : public GarbageCollectedFinalized<VisualViewport>, @@ -107,10 +115,8 @@ void AttachLayerTree(GraphicsLayer*); GraphicsLayer* RootGraphicsLayer() { return root_transform_layer_.get(); } - GraphicsLayer* ContainerLayer() { - return inner_viewport_container_layer_.get(); - } - GraphicsLayer* ScrollLayer() { return inner_viewport_scroll_layer_.get(); } + GraphicsLayer* ContainerLayer() { return container_layer_.get(); } + GraphicsLayer* ScrollLayer() { return scroll_layer_.get(); } GraphicsLayer* PageScaleLayer() { return page_scale_layer_.get(); } void InitializeScrollbars(); @@ -333,9 +339,9 @@ Member<Page> page_; std::unique_ptr<GraphicsLayer> root_transform_layer_; - std::unique_ptr<GraphicsLayer> inner_viewport_container_layer_; + std::unique_ptr<GraphicsLayer> container_layer_; std::unique_ptr<GraphicsLayer> page_scale_layer_; - std::unique_ptr<GraphicsLayer> inner_viewport_scroll_layer_; + std::unique_ptr<GraphicsLayer> scroll_layer_; // The layers of the ScrollbarLayerGroups are referenced from the // GraphicsLayers, so the GraphicsLayers must be destructed first (declared @@ -350,8 +356,8 @@ scoped_refptr<TransformPaintPropertyNode> device_emulation_transform_node_; scoped_refptr<TransformPaintPropertyNode> overscroll_elasticity_transform_node_; - scoped_refptr<TransformPaintPropertyNode> scale_transform_node_; - scoped_refptr<TransformPaintPropertyNode> translation_transform_node_; + scoped_refptr<TransformPaintPropertyNode> page_scale_node__; + scoped_refptr<TransformPaintPropertyNode> scroll_translation_node_; scoped_refptr<ScrollPaintPropertyNode> scroll_node_; scoped_refptr<EffectPaintPropertyNode> horizontal_scrollbar_effect_node_; scoped_refptr<EffectPaintPropertyNode> vertical_scrollbar_effect_node_;
diff --git a/third_party/blink/renderer/core/html/forms/resources/color_picker.css b/third_party/blink/renderer/core/html/forms/resources/color_picker.css index a54b79d..aa7cd80 100644 --- a/third_party/blink/renderer/core/html/forms/resources/color_picker.css +++ b/third_party/blink/renderer/core/html/forms/resources/color_picker.css
@@ -19,75 +19,6 @@ height: 59%; } -color-well { - border-radius: 2px 2px 0px 0px; - display: block; - height: 77%; - position: relative; - overflow: hidden; -} - -hue-slider { - height: 100%; - margin-left: 6%; - position: relative; - width: 130px; -} - -#visual-color-picker-strip { - display: flex; - height: 18%; - margin-top: 3%; - position: relative; -} - -eye-dropper { - height: 32px; - margin-left: 2%; - position: relative; - width: 32px; -} - -color-viewer { - border: 1px solid rgba(0, 0, 0, 0.19); - border-radius: 50%; - box-sizing: border-box; - height: 32px; - margin-left: 2%; - width: 32px; -} - -color-well > canvas { - height: 100%; - width: 100%; -} - -hue-slider > canvas { - border-radius: 2px; - height: 11px; - margin-top: 7%; - width: 100%; -} - -color-selection-ring { - border: 2px solid #FFFFFF; - border-radius: 50%; - box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.4); - box-sizing: border-box; - position: absolute; -} - -color-well > color-selection-ring { - height: 12px; - width: 12px; -} - -hue-slider > color-selection-ring { - height: 16px; - margin-top: 7%; - width: 16px; -} - manual-color-picker { height: 28%; }
diff --git a/third_party/blink/renderer/core/html/forms/resources/color_picker.js b/third_party/blink/renderer/core/html/forms/resources/color_picker.js index 0eb00142..218d8196 100644 --- a/third_party/blink/renderer/core/html/forms/resources/color_picker.js +++ b/third_party/blink/renderer/core/html/forms/resources/color_picker.js
@@ -158,7 +158,8 @@ Color.hexToRGB(this.hexValue_); } else if (this.hValue_ !== undefined) { [this.rValue_, this.gValue_, this.bValue_] = - Color.hslToRGB(this.hValue_, this.sValue_, this.lValue_); + Color.hslToRGB(this.hValue_, this.sValue_, this.lValue_) + .map(Math.round); } } @@ -199,10 +200,11 @@ // Already computed. } else if (this.rValue_ !== undefined) { [this.hValue_, this.sValue_, this.lValue_] = - Color.rgbToHSL(this.rValue_, this.gValue_, this.bValue_); + Color.rgbToHSL(this.rValue_, this.gValue_, this.bValue_) + .map(Math.round); } else if (this.hexValue_ !== undefined) { [this.hValue_, this.sValue_, this.lValue_] = - Color.hexToHSL(this.hexValue_); + Color.hexToHSL(this.hexValue_).map(Math.round); } } @@ -286,9 +288,9 @@ bValue = x; } } - rValue = Math.round((rValue + match) * 255); - gValue = Math.round((gValue + match) * 255); - bValue = Math.round((bValue + match) * 255); + rValue = (rValue + match) * 255; + gValue = (gValue + match) * 255; + bValue = (bValue + match) * 255; return [rValue, gValue, bValue]; } @@ -315,13 +317,13 @@ // max === bValue hValue = ((rValue - gValue) / diff) + 4; } - hValue = Math.round(hValue * 60); + hValue *= 60; if (hValue < 0) { hValue += 360; } - sValue = Math.round((diff / (1 - Math.abs(2 * lValue - 1))) * 100); + sValue = (diff / (1 - Math.abs(2 * lValue - 1))) * 100; } - lValue = Math.round(lValue * 100); + lValue *= 100; return [hValue, sValue, lValue]; } @@ -330,7 +332,7 @@ * @returns {string} */ static hslToHex(...hslValues) { - return Color.rgbToHex(...Color.hslToRGB(...hslValues)); + return Color.rgbToHex(...Color.hslToRGB(...hslValues).map(Math.round)); } /** @@ -340,61 +342,6 @@ static hexToHSL(hexValue) { return Color.rgbToHSL(...Color.hexToRGB(hexValue)); } - - /** - * @param {number[]} colorTripleA RGB or HSL values - * @param {number[]} colorTripleB RGB or HSL values - * Both color triples must be of the same color format. - */ - static distance(colorTripleA, colorTripleB) { - return Math.sqrt(Math.pow(colorTripleA[0] - colorTripleB[0], 2) - + Math.pow(colorTripleA[1] - colorTripleB[1], 2) - + Math.pow(colorTripleA[2] - colorTripleB[2], 2)); - } -} - -/** - * Point: Helper class to get/set coordinates for two dimensional points. - */ -class Point { - /** - * @param {number} x - * @param {number} y - */ - constructor(x, y) { - this.set(x, y); - } - - /** - * @param {number} x - * @param {number} y - */ - set(x, y) { - this.x = x; - this.y = y; - } - - get x() { - return this.x_; - } - - /** - * @param {number} x - */ - set x(x) { - this.x_ = x; - } - - get y() { - return this.y_; - } - - /** - * @param {number} y - */ - set y(y) { - this.y_ = y; - } } /** @@ -422,15 +369,8 @@ this.manualColorPicker_, this.submissionControls_); - this.visualColorPicker_.addEventListener('visual-color-picker-initialized', - this.initializeListeners_); - } - - initializeListeners_ = () => { this.manualColorPicker_ .addEventListener('manual-color-change', this.onManualColorChange_); - - this.addEventListener('visual-color-change', this.onVisualColorChange_); } get selectedColor() { @@ -451,36 +391,7 @@ const newColor = event.detail.color; if (!this.selectedColor.equals(newColor)) { this.selectedColor = newColor; - - // There may not be an exact match for newColor in the HueSlider or - // ColorWell, in which case we will display the closest match. When this - // happens though, we want the manually chosen values to remain the - // selected values (as they were explicitly specified by the user). - // Therefore, we need to prevent them from getting overwritten when - // onVisualColorChange_ runs. We do this by setting the - // processingManualColorChange_ flag here and checking for it inside - // onVisualColorChange_. If the flag is set, the manual color values - // will not be updated with the color shown in the visual color picker. - this.processingManualColorChange_ = true; - this.visualColorPicker_.color = newColor; - this.processingManualColorChange_ = false; - } - } - - /** - * @param {!Event} event - */ - onVisualColorChange_ = (event) => { - const newColor = event.detail.color; - if (!this.selectedColor.equals(newColor)) { - if (!this.processingManualColorChange_) { - this.selectedColor = newColor; - this.manualColorPicker_.color = newColor; - } else { - // We are making a visual color change in response to a manual color - // change. So we do not overwrite the manually specified values and do - // not change the selected color. - } + this.visualColorPicker_.setSelectedColor(newColor); } } @@ -500,6 +411,8 @@ /** * VisualColorPicker: Provides functionality to see the selected color and * select a different color visually. + * TODO(crbug.com/983311): Allow colors to be selected from within the visual + * color picker. */ class VisualColorPicker extends HTMLElement { /** @@ -508,675 +421,19 @@ constructor(initialColor) { super(); - let visualColorPickerStrip = document.createElement('span'); - visualColorPickerStrip.setAttribute('id', 'visual-color-picker-strip'); - this.eyeDropper_ = new EyeDropper(); - this.colorViewer_ = new ColorViewer(initialColor); - this.hueSlider_ = new HueSlider(initialColor); - visualColorPickerStrip.append(this.eyeDropper_, - this.colorViewer_, - this.hueSlider_); - this.append(visualColorPickerStrip); - - this.colorWell_ = new ColorWell(initialColor); - this.prepend(this.colorWell_); - - this.colorWell_.addEventListener('color-well-initialized', () => { - this.initializeListeners_(); - }); - - this.hueSlider_.addEventListener('hue-slider-initialized', () => { - this.initializeListeners_(); - }); - } - - initializeListeners_ = () => { - if (this.colorWell_.initialized && this.hueSlider_.initialized) { - this.addEventListener('hue-slider-update', this.onHueSliderUpdate_); - this.addEventListener('visual-color-change', this.onVisualColorChange_); - this.colorWell_ - .addEventListener('mousedown', this.onColorWellMouseDown_); - this.hueSlider_ - .addEventListener('mousedown', this.onHueSliderMouseDown_); - this.colorWell_ - .addEventListener('mousedown', (event) => event.preventDefault()); - this.hueSlider_ - .addEventListener('mousedown', (event) => event.preventDefault()); - document.documentElement - .addEventListener('mousemove', this.onMouseMove_); - document.documentElement.addEventListener('mouseup', this.onMouseUp_); - - this.dispatchEvent(new CustomEvent('visual-color-picker-initialized')); - } - } - - onHueSliderUpdate_ = () => { - this.colorWell_.fillColor = this.hueSlider_.color; - } - - /** - * @param {!Event} event - */ - onVisualColorChange_ = (event) => { - this.colorViewer_.color = event.detail.color; - } - - /** - * @param {!Event} event - */ - onColorWellMouseDown_ = (event) => { - this.colorWell_.mouseDown(new Point(event.clientX, event.clientY)); - } - - /** - * @param {!Event} event - */ - onMouseMove_ = (event) => { - var point = new Point(event.clientX, event.clientY); - this.colorWell_.mouseMove(point); - this.hueSlider_.mouseMove(point); - } - - onMouseUp_ = () => { - this.colorWell_.mouseUp(); - this.hueSlider_.mouseUp(); - } - - /** - * @param {!Event} event - */ - onHueSliderMouseDown_ = (event) => { - this.hueSlider_.mouseDown(new Point(event.clientX, event.clientY)); + this.setSelectedColor(initialColor); } /** * @param {!Color} newColor */ - set color(newColor) { - this.hueSlider_.color = newColor; - this.colorWell_.selectedColor = newColor; + setSelectedColor(newColor) { + this.style.backgroundColor = newColor.asHex(); } } window.customElements.define('visual-color-picker', VisualColorPicker); /** - * EyeDropper: Allows color selection from content outside the color picker. - * (This is currently just a placeholder for a future - * implementation.) - * TODO(http://crbug.com/992297): Implement eye dropper - */ -class EyeDropper extends HTMLElement { } -window.customElements.define('eye-dropper', EyeDropper); - -/** - * ColorViewer: Provides a view of the selected color. - */ -class ColorViewer extends HTMLElement { - /** - * @param {!Color} initialColor - */ - constructor(initialColor) { - super(); - - this.color = initialColor; - } - - get color() { - return this.color_; - } - - /** - * @param {!Color} color - */ - set color(color) { - if (this.color_ === undefined || !this.color_.equals(color)) { - this.color_ = color; - this.style.backgroundColor = color.asRGB(); - } - } -} -window.customElements.define('color-viewer', ColorViewer); - -/** - * ColorSelectionArea: Base class for ColorWell and HueSlider that encapsulates - * a ColorPalette and a ColorSelectionRing. - */ -class ColorSelectionArea extends HTMLElement { - constructor() { - super(); - - this.colorPalette_ = new ColorPalette(); - this.colorSelectionRing_ = new ColorSelectionRing(this.colorPalette_); - this.append(this.colorPalette_, this.colorSelectionRing_); - this.initialized_ = false; - } - - get initialized() { - return this.initialized_; - } - - /** - * @param {!Point} point - */ - mouseDown(point) { - this.colorSelectionRing_.drag = true; - this.moveColorSelectionRingTo_(point); - } - - /** - * @param {!Point} point - */ - mouseMove(point) { - if (this.colorSelectionRing_.drag) { - this.moveColorSelectionRingTo_(point); - } - } - - mouseUp() { - this.colorSelectionRing_.drag = false; - } -} -window.customElements.define('color-selection-area', ColorSelectionArea); - -/** - * ColorPalette: Displays a range of colors. - */ -class ColorPalette extends HTMLCanvasElement { - constructor() { - super(); - - this.gradients_ = []; - } - - /** - * @param {...CanvasGradient} gradients - */ - initialize(...gradients) { - this.width = this.offsetWidth; - this.height = this.offsetHeight; - this.renderingContext.rect(0, 0, this.width, this.height); - this.gradients_.push(...gradients); - this.fillColor = new Color('hsl(0, 100%, 50%)'); - } - - get hslImageData() { - if (this.pendingColorChange_) { - const rgbaImageData = this.renderingContext - .getImageData(0, 0, this.width, this.height).data; - this.hslImageData_ = rgbaImageData - .reduce((hslArray, {}, currentIndex, rgbaArray) => { - if ((currentIndex % 4) === 0) { - hslArray.push(...Color.rgbToHSL(rgbaArray[currentIndex], - rgbaArray[currentIndex + 1], - rgbaArray[currentIndex + 2])); - } - return hslArray; - }, []); - this.pendingColorChange_ = false; - } - if (this.pendingHueChange_) { - const hValueToSet = this.fillColor.hValue; - this.hslImageData_.forEach(({}, currentIndex, hslArray) => { - if ((currentIndex % 3) === 0) { - hslArray[currentIndex] = hValueToSet; - } - }); - - this.pendingHueChange_ = false; - } - return this.hslImageData_; - } - - /** - * @param {!Point} point - */ - colorAtPoint(point) { - const hslImageDataAtPoint = - this.hslImageDataAtPoint_(point.x - this.left, point.y - this.top); - return new Color(ColorFormat.HSL, hslImageDataAtPoint[0], - hslImageDataAtPoint[1], hslImageDataAtPoint[2]); - } - - /** - * @param {number} x - * @param {number} y - */ - hslImageDataAtPoint_(x, y) { - const offset = Math.round(y * this.width + x) * 3; - return this.hslImageData.slice(offset, offset + 3); - } - - get renderingContext() { - return this.getContext('2d'); - } - - get fillColor() { - return this.fillColor_; - } - - /** - * @param {!Color} color - */ - set fillColor(color) { - this.fillColor_ = color; - this.fillColorAndGradients_(); - this.pendingColorChange_ = true; - } - - /** - * @param {!Color} color - */ - fillHue(color) { - this.fillColor_ = new Color(ColorFormat.HSL, color.hValue, - this.fillColor_.sValue, this.fillColor_.lValue); - this.fillColorAndGradients_(); - this.pendingHueChange_ = true; - } - - fillColorAndGradients_() { - this.fillWithStyle_(this.fillColor_.asRGB()); - this.gradients_.forEach((gradient) => this.fillWithStyle_(gradient)); - } - - /** - * @param {string|!CanvasGradient} fillStyle - */ - fillWithStyle_(fillStyle) { - let colorPaletteCtx = this.renderingContext; - colorPaletteCtx.fillStyle = fillStyle; - colorPaletteCtx.fill(); - } - - /** - * @param {!Point} point - */ - nearestPointOnColorPalette(point) { - if (!this.isXCoordinateOnColorPalette_(point)) { - if (point.x >= this.right) { - point.x = this.right - 1; - } else if (point.x < this.left) { - point.x = this.left; - } - } - if (!this.isYCoordinateOnColorPalette_(point)) { - if (point.y >= this.bottom) { - point.y = this.bottom - 1; - } else if (point.y < this.top) { - point.y = this.top; - } - } - return point; - } - - /** - * @param {!Point} point - */ - isXCoordinateOnColorPalette_(point) { - return (point.x >= this.left) && (point.x < this.right); - } - - /** - * @param {!Point} point - */ - isYCoordinateOnColorPalette_(point) { - return (point.y >= this.top) && (point.y < this.bottom); - } - - get left() { - return this.getBoundingClientRect().left; - } - - get right() { - return this.getBoundingClientRect().right; - } - - get top() { - return this.getBoundingClientRect().top; - } - - get bottom() { - return this.getBoundingClientRect().bottom; - } -} -window.customElements.define('color-palette', - ColorPalette, - { extends: 'canvas' }); - -/** - * ColorSelectionRing: Provides movement and color selection functionality to - * pick colors from a given ColorPalette. - */ -class ColorSelectionRing extends HTMLElement { - /** - * @param {!ColorPalette} backingColorPalette - */ - constructor(backingColorPalette) { - super(); - - this.backingColorPalette_ = backingColorPalette; - this.position_ = new Point(0, 0); - this.drag_ = false; - } - - initialize() { - this.set(this.backingColorPalette_.left, this.backingColorPalette_.top); - } - - /** - * @param {!Point} newPosition - */ - moveTo(newPosition) { - this.set(newPosition.x, newPosition.y); - } - - /** - * @param {number} x - * @param {number} y - */ - set(x, y) { - if ((x !== this.position_.x) || (y !== this.position_.y)) { - this.position_.x = x; - this.position_.y = y; - this.onPositionChange_(); - } - } - - /** - * @param {number} x - */ - setX(x) { - if (x !== this.position_.x) { - this.position_.x = x; - this.onPositionChange_(); - } - } - - /** - * @param {number} shiftFactor - */ - shiftX(shiftFactor) { - this.setX(this.position_.x + shiftFactor); - } - - onPositionChange_() { - this.setElementPosition_(); - this.updateColor(); - } - - setElementPosition_() { - if (this.height > this.backingColorPalette_.height) { - this.style.top = this.top - - (this.height - this.backingColorPalette_.height) / 2 - - this.backingColorPalette_.top + 'px'; - } else { - this.style.top = this.top - this.radius - - this.backingColorPalette_.top + 'px'; - } - if (this.width > this.backingColorPalette_.width) { - this.style.left = this.left - - (this.width - this.backingColorPalette_.width) / 2 - - this.backingColorPalette_.left + 'px'; - } else { - this.style.left = this.left - this.radius - - this.backingColorPalette_.left + 'px'; - } - } - - updateColor() { - this.color = this.backingColorPalette_.colorAtPoint(this.position_); - this.dispatchEvent(new CustomEvent('color-selection-ring-update')); - } - - get color() { - return this.color_; - } - - /** - * @param {!Color} color - */ - set color(color) { - if (this.color_ === undefined || !this.color_.equals(color)) { - this.color_ = color; - this.style.backgroundColor = color.asRGB(); - } - } - - get drag() { - return this.drag_; - } - - /** - * @param {boolean} drag - */ - set drag(drag) { - this.drag_ = drag; - } - - get radius() { - return this.width / 2; - } - - get width() { - return this.getBoundingClientRect().width; - } - - get height() { - return this.getBoundingClientRect().height; - } - - get left() { - return this.position_.x; - } - - get top() { - return this.position_.y; - } -} -window.customElements.define('color-selection-ring', ColorSelectionRing); - -/** - * ColorWell: Allows selection from a range of colors, between black and white, - * that have the same hue value. - */ -class ColorWell extends ColorSelectionArea { - /** - * @param {!Color} initialColor - */ - constructor(initialColor) { - super(); - - this.fillColor_ = new Color(ColorFormat.HSL, initialColor.hValue, 100, 50); - this.selectedColor_ = initialColor; - - this.resizeObserver_ = new ResizeObserver(() => { - let whiteGradient = this.colorPalette_.renderingContext - .createLinearGradient(0, 0, this.colorPalette_.offsetWidth, 0); - whiteGradient.addColorStop(0.01, 'hsla(0, 0%, 100%, 1)'); - whiteGradient.addColorStop(0.99, 'hsla(0, 0%, 100%, 0)'); - let blackGradient = this.colorPalette_.renderingContext - .createLinearGradient(0, this.colorPalette_.offsetHeight, 0, 0); - blackGradient.addColorStop(0.01, 'hsla(0, 0%, 0%, 1)'); - blackGradient.addColorStop(0.99, 'hsla(0, 0%, 0%, 0)'); - this.colorPalette_.initialize(whiteGradient, blackGradient); - this.colorPalette_.fillHue(this.fillColor_); - this.colorSelectionRing_.initialize(); - - this.colorSelectionRing_.addEventListener('color-selection-ring-update', - this.onColorSelectionRingUpdate_); - - this.moveColorSelectionRingTo_(this.selectedColor_); - - this.resizeObserver_.disconnect(); - this.resizeObserver_ = null; - - this.initialized_ = true; - this.dispatchEvent(new CustomEvent('color-well-initialized')); - }); - this.resizeObserver_.observe(this); - } - - /** - * @param {!Point|!Color} newPositionOrColor - */ - moveColorSelectionRingTo_(newPositionOrColor) { - if (newPositionOrColor instanceof Point) { - const point = - this.colorPalette_.nearestPointOnColorPalette(newPositionOrColor); - this.colorSelectionRing_.moveTo(point); - } else { - const closestHSLValueIndex = this.colorPalette_.hslImageData - .reduce((closestSoFar, {}, index, array) => { - if ((index % 3) === 0) { - const currentHSLValueDistance = Color.distance([array[index], - array[index + 1], array[index + 2]], - newPositionOrColor.hslValues()); - const closestHSLValueDistance = - Color.distance([array[closestSoFar], array[closestSoFar + 1], - array[closestSoFar + 2]], newPositionOrColor.hslValues()); - if (currentHSLValueDistance < closestHSLValueDistance) { - return index; - } - } - return closestSoFar; - }, 0); - const offsetX = (closestHSLValueIndex / 3) % this.colorPalette_.width; - const offsetY = - Math.floor((closestHSLValueIndex / 3) / this.colorPalette_.width); - this.colorSelectionRing_.set(this.colorPalette_.left + offsetX, - this.colorPalette_.top + offsetY); - } - } - - get selectedColor() { - return this.selectedColor_; - } - - /** - * @param {!Color} newColor - */ - set selectedColor(newColor) { - if (!this.selectedColor_.equals(newColor)) { - this.selectedColor_ = newColor; - this.moveColorSelectionRingTo_(newColor); - } - } - - get fillColor() { - return this.fillColor_; - } - - /** - * @param {!Color} color - */ - set fillColor(color) { - if (!this.fillColor_.equals(color)) { - this.fillColor_ = color; - this.colorPalette_.fillHue(color); - this.colorSelectionRing_.updateColor(); - } - } - - onColorSelectionRingUpdate_ = () => { - this.selectedColor_ = this.colorSelectionRing_.color; - this.dispatchEvent(new CustomEvent('visual-color-change', { - bubbles: true, - detail: { - color: this.selectedColor - } - })); - } -} -window.customElements.define('color-well', ColorWell); - -/** - * HueSlider: Allows selection from a range of colors with distinct hue values. - */ -class HueSlider extends ColorSelectionArea { - /** - * @param {!Color} initialColor - */ - constructor(initialColor) { - super(); - - this.color_ = new Color(ColorFormat.HSL, initialColor.hValue, 100, 50); - - this.resizeObserver_ = new ResizeObserver(() => { - let hueSliderPaletteGradient = this.colorPalette_.renderingContext - .createLinearGradient(0, 0, this.colorPalette_.offsetWidth, 0); - hueSliderPaletteGradient.addColorStop(0.01, 'hsl(0, 100%, 50%)'); - hueSliderPaletteGradient.addColorStop(0.17, 'hsl(300, 100%, 50%)'); - hueSliderPaletteGradient.addColorStop(0.33, 'hsl(240, 100%, 50%)'); - hueSliderPaletteGradient.addColorStop(0.5, 'hsl(180, 100%, 50%)'); - hueSliderPaletteGradient.addColorStop(0.67, 'hsl(120, 100%, 50%)'); - hueSliderPaletteGradient.addColorStop(0.83, 'hsl(60, 100%, 50%)'); - hueSliderPaletteGradient.addColorStop(0.99, 'hsl(0, 100%, 50%)'); - this.colorPalette_.initialize(hueSliderPaletteGradient); - this.colorSelectionRing_.initialize(); - - this.colorSelectionRing_.addEventListener('color-selection-ring-update', - this.onColorSelectionRingUpdate_); - - this.moveColorSelectionRingTo_(this.color_); - - this.resizeObserver_.disconnect(); - this.resizeObserver_ = null; - - this.initialized_ = true; - this.dispatchEvent(new CustomEvent('hue-slider-initialized')); - }); - this.resizeObserver_.observe(this); - } - - /** - * @param {!Point|!Color} newPositionOrColor - */ - moveColorSelectionRingTo_(newPositionOrColor) { - if (newPositionOrColor instanceof Point) { - const point = - this.colorPalette_.nearestPointOnColorPalette(newPositionOrColor); - this.colorSelectionRing_.shiftX(point.x - this.colorSelectionRing_.left); - } else { - const targetHValue = newPositionOrColor.hValue; - if (targetHValue !== this.colorSelectionRing_.color.hValue) { - const closestHValueIndex = this.colorPalette_.hslImageData - .reduce((closestHValueIndexSoFar, currentHValue, index, array) => { - if ((index % 3 === 0) && - (Math.abs(currentHValue - targetHValue) < - Math.abs(array[closestHValueIndexSoFar] - targetHValue))) { - return index; - } - return closestHValueIndexSoFar; - }, 0); - const offsetX = (closestHValueIndex / 3) % this.colorPalette_.width; - this.colorSelectionRing_.setX(this.colorPalette_.left + offsetX); - } - } - } - - get color() { - return this.color_; - } - - /** - * @param {!Color} newColor - */ - set color(newColor) { - if (this.color_.hValue !== newColor.hValue) { - this.color_ = new Color(ColorFormat.HSL, newColor.hValue, 100, 50); - this.moveColorSelectionRingTo_(this.color_); - } - } - - onColorSelectionRingUpdate_ = () => { - this.color_ = this.colorSelectionRing_.color; - this.dispatchEvent(new CustomEvent('hue-slider-update', { - bubbles: true - })); - } -} -window.customElements.define('hue-slider', HueSlider); - -/** * ManualColorPicker: Provides functionality to change the selected color by * manipulating its numeric values. */ @@ -1231,13 +488,7 @@ * @param {!Event} event */ onManualColorChange_ = (event) => { - this.color = event.detail.color; - } - - /** - * @param {!Color} newColor - */ - set color(newColor) { + const newColor = event.detail.color; this.colorValueContainers_.forEach((colorValueContainer) => colorValueContainer.color = newColor); } @@ -1343,33 +594,19 @@ this.colorChannel_ = colorChannel; switch(colorChannel) { case ColorChannel.HEX: - this.setAttribute('id', 'hexValueContainer'); this.setAttribute('maxlength', '7'); break; case ColorChannel.R: - this.setAttribute('id', 'rValueContainer'); - this.setAttribute('maxlength', '3'); - break; case ColorChannel.G: - this.setAttribute('id', 'gValueContainer'); - this.setAttribute('maxlength', '3'); - break; case ColorChannel.B: - this.setAttribute('id', 'bValueContainer'); this.setAttribute('maxlength', '3'); break; case ColorChannel.H: - this.setAttribute('id', 'hValueContainer'); this.setAttribute('maxlength', '3'); break; case ColorChannel.S: - // up to 3 digits plus '%' - this.setAttribute('id', 'sValueContainer'); - this.setAttribute('maxlength', '4'); - break; case ColorChannel.L: // up to 3 digits plus '%' - this.setAttribute('id', 'lValueContainer'); this.setAttribute('maxlength', '4'); break; } @@ -1455,10 +692,10 @@ } break; case ColorChannel.H: - if (value.match(/^\d+$/) && (0 <= value) && (value < 360)) { - this.channelValue_ = Number(value); - } - break; + if (value.match(/^\d+$/) && (0 <= value) && (value < 360)) { + this.channelValue_ = Number(value); + } + break; case ColorChannel.S: case ColorChannel.L: if (value.endsWith('%')) {
diff --git a/third_party/blink/renderer/core/html/html_anchor_element.cc b/third_party/blink/renderer/core/html/html_anchor_element.cc index 799a5670..a74ab225 100644 --- a/third_party/blink/renderer/core/html/html_anchor_element.cc +++ b/third_party/blink/renderer/core/html/html_anchor_element.cc
@@ -442,6 +442,7 @@ } request.SetRequestContext(mojom::RequestContextType::HYPERLINK); + request.SetHasUserGesture(LocalFrame::HasTransientUserActivation(frame)); const AtomicString& target = getAttribute(kTargetAttr); FrameLoadRequest frame_request(&GetDocument(), request); frame_request.SetNavigationPolicy(NavigationPolicyFromEvent(&event));
diff --git a/third_party/blink/renderer/core/layout/BUILD.gn b/third_party/blink/renderer/core/layout/BUILD.gn index 5e82973..c2d5292 100644 --- a/third_party/blink/renderer/core/layout/BUILD.gn +++ b/third_party/blink/renderer/core/layout/BUILD.gn
@@ -39,30 +39,6 @@ "content_change_type.h", "counter_node.cc", "counter_node.h", - "custom/css_layout_definition.cc", - "custom/css_layout_definition.h", - "custom/css_layout_worklet.cc", - "custom/css_layout_worklet.h", - "custom/custom_layout_child.cc", - "custom/custom_layout_child.h", - "custom/custom_layout_constraints.cc", - "custom/custom_layout_constraints.h", - "custom/custom_layout_fragment.cc", - "custom/custom_layout_fragment.h", - "custom/custom_layout_scope.cc", - "custom/custom_layout_scope.h", - "custom/custom_layout_work_task.cc", - "custom/custom_layout_work_task.h", - "custom/document_layout_definition.cc", - "custom/document_layout_definition.h", - "custom/layout_worklet.cc", - "custom/layout_worklet.h", - "custom/layout_worklet_global_scope.cc", - "custom/layout_worklet_global_scope.h", - "custom/layout_worklet_global_scope_proxy.cc", - "custom/layout_worklet_global_scope_proxy.h", - "custom/pending_layout_registry.cc", - "custom/pending_layout_registry.h", "depth_ordered_layout_object_list.cc", "depth_ordered_layout_object_list.h", "flexible_box_algorithm.cc", @@ -299,10 +275,34 @@ "min_max_size.h", "multi_column_fragmentainer_group.cc", "multi_column_fragmentainer_group.h", + "ng/custom/css_layout_definition.cc", + "ng/custom/css_layout_definition.h", + "ng/custom/css_layout_worklet.cc", + "ng/custom/css_layout_worklet.h", + "ng/custom/custom_layout_child.cc", + "ng/custom/custom_layout_child.h", + "ng/custom/custom_layout_constraints.cc", + "ng/custom/custom_layout_constraints.h", + "ng/custom/custom_layout_fragment.cc", + "ng/custom/custom_layout_fragment.h", + "ng/custom/custom_layout_scope.cc", + "ng/custom/custom_layout_scope.h", + "ng/custom/custom_layout_work_task.cc", + "ng/custom/custom_layout_work_task.h", + "ng/custom/document_layout_definition.cc", + "ng/custom/document_layout_definition.h", "ng/custom/layout_ng_custom.cc", "ng/custom/layout_ng_custom.h", + "ng/custom/layout_worklet.cc", + "ng/custom/layout_worklet.h", + "ng/custom/layout_worklet_global_scope.cc", + "ng/custom/layout_worklet_global_scope.h", + "ng/custom/layout_worklet_global_scope_proxy.cc", + "ng/custom/layout_worklet_global_scope_proxy.h", "ng/custom/ng_custom_layout_algorithm.cc", "ng/custom/ng_custom_layout_algorithm.h", + "ng/custom/pending_layout_registry.cc", + "ng/custom/pending_layout_registry.h", "ng/exclusions/ng_exclusion.cc", "ng/exclusions/ng_exclusion.h", "ng/exclusions/ng_exclusion_space.cc",
diff --git a/third_party/blink/renderer/core/layout/layout_box.cc b/third_party/blink/renderer/core/layout/layout_box.cc index 90dd873..68db55eec 100644 --- a/third_party/blink/renderer/core/layout/layout_box.cc +++ b/third_party/blink/renderer/core/layout/layout_box.cc
@@ -47,8 +47,6 @@ #include "third_party/blink/renderer/core/layout/api/line_layout_block_flow.h" #include "third_party/blink/renderer/core/layout/api/line_layout_box.h" #include "third_party/blink/renderer/core/layout/box_layout_extra_input.h" -#include "third_party/blink/renderer/core/layout/custom/layout_worklet.h" -#include "third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.h" #include "third_party/blink/renderer/core/layout/hit_test_result.h" #include "third_party/blink/renderer/core/layout/layout_analyzer.h" #include "third_party/blink/renderer/core/layout/layout_deprecated_flexible_box.h" @@ -62,7 +60,10 @@ #include "third_party/blink/renderer/core/layout/layout_multi_column_spanner_placeholder.h" #include "third_party/blink/renderer/core/layout/layout_table_cell.h" #include "third_party/blink/renderer/core/layout/layout_view.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_child.h" #include "third_party/blink/renderer/core/layout/ng/custom/layout_ng_custom.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.h" #include "third_party/blink/renderer/core/layout/ng/geometry/ng_box_strut.h" #include "third_party/blink/renderer/core/layout/ng/ng_box_fragment.h" #include "third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.h" @@ -120,6 +121,19 @@ box.SetBoxLayoutExtraInput(nullptr); } +LayoutBoxRareData::LayoutBoxRareData() + : spanner_placeholder_(nullptr), + override_logical_width_(-1), + override_logical_height_(-1), + // TODO(rego): We should store these based on physical direction. + has_override_containing_block_content_logical_width_(false), + has_override_containing_block_content_logical_height_(false), + has_override_percentage_resolution_block_size_(false), + has_previous_content_box_rect_and_layout_overflow_rect_(false), + percent_height_container_(nullptr), + snap_container_(nullptr), + snap_areas_(nullptr) {} + LayoutBox::LayoutBox(ContainerNode* node) : LayoutBoxModelObject(node), intrinsic_content_logical_height_(-1), @@ -6230,7 +6244,7 @@ return; EnsureRareData().layout_child_ = - MakeGarbageCollected<CustomLayoutChild>(*definition, this); + MakeGarbageCollected<CustomLayoutChild>(*definition, NGBlockNode(this)); } void LayoutBox::ClearCustomLayoutChild() { @@ -6238,7 +6252,7 @@ return; if (rare_data_->layout_child_) - rare_data_->layout_child_->ClearLayoutBox(); + rare_data_->layout_child_->ClearLayoutNode(); rare_data_->layout_child_ = nullptr; }
diff --git a/third_party/blink/renderer/core/layout/layout_box.h b/third_party/blink/renderer/core/layout/layout_box.h index cc5cbd9..a371103e 100644 --- a/third_party/blink/renderer/core/layout/layout_box.h +++ b/third_party/blink/renderer/core/layout/layout_box.h
@@ -27,7 +27,6 @@ #include "base/macros.h" #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/core/layout/custom/custom_layout_child.h" #include "third_party/blink/renderer/core/layout/layout_box_model_object.h" #include "third_party/blink/renderer/core/layout/min_max_size.h" #include "third_party/blink/renderer/core/layout/overflow_model.h" @@ -35,6 +34,7 @@ namespace blink { +class CustomLayoutChild; class EventHandler; class LayoutBlockFlow; class LayoutMultiColumnSpannerPlaceholder; @@ -69,18 +69,7 @@ USING_FAST_MALLOC(LayoutBoxRareData); public: - LayoutBoxRareData() - : spanner_placeholder_(nullptr), - override_logical_width_(-1), - override_logical_height_(-1), - // TODO(rego): We should store these based on physical direction. - has_override_containing_block_content_logical_width_(false), - has_override_containing_block_content_logical_height_(false), - has_override_percentage_resolution_block_size_(false), - has_previous_content_box_rect_and_layout_overflow_rect_(false), - percent_height_container_(nullptr), - snap_container_(nullptr), - snap_areas_(nullptr) {} + LayoutBoxRareData(); // For spanners, the spanner placeholder that lays us out within the multicol // container.
diff --git a/third_party/blink/renderer/core/layout/layout_object.cc b/third_party/blink/renderer/core/layout/layout_object.cc index 53a5021..20aefcf 100644 --- a/third_party/blink/renderer/core/layout/layout_object.cc +++ b/third_party/blink/renderer/core/layout/layout_object.cc
@@ -255,7 +255,8 @@ case EDisplay::kWebkitBox: case EDisplay::kWebkitInlineBox: if (RuntimeEnabledFeatures::WebkitBoxLayoutUsesFlexLayoutEnabled() && - !style.HasLineClamp()) { + (!style.HasLineClamp() || + style.BoxOrient() == EBoxOrient::kHorizontal)) { return new LayoutFlexibleBox(element); } return new LayoutDeprecatedFlexibleBox(*element);
diff --git a/third_party/blink/renderer/core/layout/custom/OWNERS b/third_party/blink/renderer/core/layout/ng/custom/OWNERS similarity index 100% rename from third_party/blink/renderer/core/layout/custom/OWNERS rename to third_party/blink/renderer/core/layout/ng/custom/OWNERS
diff --git a/third_party/blink/renderer/core/layout/custom/README.md b/third_party/blink/renderer/core/layout/ng/custom/README.md similarity index 100% rename from third_party/blink/renderer/core/layout/custom/README.md rename to third_party/blink/renderer/core/layout/ng/custom/README.md
diff --git a/third_party/blink/renderer/core/layout/custom/css_layout_definition.cc b/third_party/blink/renderer/core/layout/ng/custom/css_layout_definition.cc similarity index 93% rename from third_party/blink/renderer/core/layout/custom/css_layout_definition.cc rename to third_party/blink/renderer/core/layout/ng/custom/css_layout_definition.cc index 6e961df4..0e8ed75 100644 --- a/third_party/blink/renderer/core/layout/custom/css_layout_definition.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/css_layout_definition.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/blink/renderer/core/layout/custom/css_layout_definition.h" +#include "third_party/blink/renderer/core/layout/ng/custom/css_layout_definition.h" #include <memory> @@ -18,10 +18,11 @@ #include "third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/inspector/console_message.h" -#include "third_party/blink/renderer/core/layout/custom/custom_layout_constraints.h" -#include "third_party/blink/renderer/core/layout/custom/custom_layout_fragment.h" -#include "third_party/blink/renderer/core/layout/custom/custom_layout_scope.h" -#include "third_party/blink/renderer/core/layout/custom/fragment_result_options.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_child.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_constraints.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_fragment.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_scope.h" +#include "third_party/blink/renderer/core/layout/ng/custom/fragment_result_options.h" #include "third_party/blink/renderer/core/layout/ng/ng_block_node.h" #include "third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h" #include "third_party/blink/renderer/platform/bindings/microtask.h" @@ -91,10 +92,9 @@ // TODO(ikilpatrick): Fill in layout edges. ScriptValue edges(script_state, v8::Undefined(isolate)); - // TODO(crbug.com/992950): Pass constraint data through a constraint space. CustomLayoutConstraints* constraints = MakeGarbageCollected<CustomLayoutConstraints>( - border_box_size, nullptr /* constraint_data */, isolate); + border_box_size, space.CustomLayoutData(), isolate); // TODO(ikilpatrick): Instead of creating a new style_map each time here, // store on LayoutCustom, and update when the style changes. @@ -129,12 +129,12 @@ // Run the work queue until exhaustion. while (!custom_layout_scope->Queue()->IsEmpty()) { + for (auto& task : *custom_layout_scope->Queue()) + task.Run(space, node.Style()); + custom_layout_scope->Queue()->clear(); { v8::MicrotasksScope microtasks_scope(isolate, microtask_queue, v8::MicrotasksScope::kRunMicrotasks); - for (auto& task : *custom_layout_scope->Queue()) - task.Run(space, node.Style()); - custom_layout_scope->Queue()->clear(); } }
diff --git a/third_party/blink/renderer/core/layout/custom/css_layout_definition.h b/third_party/blink/renderer/core/layout/ng/custom/css_layout_definition.h similarity index 94% rename from third_party/blink/renderer/core/layout/custom/css_layout_definition.h rename to third_party/blink/renderer/core/layout/ng/custom/css_layout_definition.h index b4806fd..202a16e3 100644 --- a/third_party/blink/renderer/core/layout/custom/css_layout_definition.h +++ b/third_party/blink/renderer/core/layout/ng/custom/css_layout_definition.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 THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CSS_LAYOUT_DEFINITION_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CSS_LAYOUT_DEFINITION_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CSS_LAYOUT_DEFINITION_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CSS_LAYOUT_DEFINITION_H_ #include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/cssom/css_style_value.h" @@ -117,4 +117,4 @@ } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CSS_LAYOUT_DEFINITION_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CSS_LAYOUT_DEFINITION_H_
diff --git a/third_party/blink/renderer/core/layout/custom/css_layout_worklet.cc b/third_party/blink/renderer/core/layout/ng/custom/css_layout_worklet.cc similarity index 78% rename from third_party/blink/renderer/core/layout/custom/css_layout_worklet.cc rename to third_party/blink/renderer/core/layout/ng/custom/css_layout_worklet.cc index 7f965f7..26f45cc 100644 --- a/third_party/blink/renderer/core/layout/custom/css_layout_worklet.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/css_layout_worklet.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/layout/custom/css_layout_worklet.h" +#include "third_party/blink/renderer/core/layout/ng/custom/css_layout_worklet.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" -#include "third_party/blink/renderer/core/layout/custom/layout_worklet.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" namespace blink {
diff --git a/third_party/blink/renderer/core/layout/custom/css_layout_worklet.h b/third_party/blink/renderer/core/layout/ng/custom/css_layout_worklet.h similarity index 69% rename from third_party/blink/renderer/core/layout/custom/css_layout_worklet.h rename to third_party/blink/renderer/core/layout/ng/custom/css_layout_worklet.h index b6e5be7..39ed21a 100644 --- a/third_party/blink/renderer/core/layout/custom/css_layout_worklet.h +++ b/third_party/blink/renderer/core/layout/ng/custom/css_layout_worklet.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 THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CSS_LAYOUT_WORKLET_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CSS_LAYOUT_WORKLET_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CSS_LAYOUT_WORKLET_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CSS_LAYOUT_WORKLET_H_ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -22,4 +22,4 @@ } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CSS_LAYOUT_WORKLET_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CSS_LAYOUT_WORKLET_H_
diff --git a/third_party/blink/renderer/core/layout/custom/css_layout_worklet.idl b/third_party/blink/renderer/core/layout/ng/custom/css_layout_worklet.idl similarity index 100% rename from third_party/blink/renderer/core/layout/custom/css_layout_worklet.idl rename to third_party/blink/renderer/core/layout/ng/custom/css_layout_worklet.idl
diff --git a/third_party/blink/renderer/core/layout/custom/custom_layout_child.cc b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_child.cc similarity index 78% rename from third_party/blink/renderer/core/layout/custom/custom_layout_child.cc rename to third_party/blink/renderer/core/layout/ng/custom/custom_layout_child.cc index bb70616..043110a 100644 --- a/third_party/blink/renderer/core/layout/custom/custom_layout_child.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_child.cc
@@ -2,25 +2,24 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/layout/custom/custom_layout_child.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_child.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" #include "third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.h" #include "third_party/blink/renderer/core/dom/dom_exception.h" -#include "third_party/blink/renderer/core/layout/custom/css_layout_definition.h" -#include "third_party/blink/renderer/core/layout/custom/custom_layout_fragment.h" -#include "third_party/blink/renderer/core/layout/custom/custom_layout_scope.h" -#include "third_party/blink/renderer/core/layout/custom/custom_layout_work_task.h" -#include "third_party/blink/renderer/core/layout/layout_box.h" +#include "third_party/blink/renderer/core/layout/ng/custom/css_layout_definition.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_fragment.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_scope.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_work_task.h" namespace blink { CustomLayoutChild::CustomLayoutChild(const CSSLayoutDefinition& definition, - LayoutBox* box) - : box_(box), + NGLayoutInputNode node) + : node_(node), style_map_(MakeGarbageCollected<PrepopulatedComputedStylePropertyMap>( - box->GetDocument(), - box->StyleRef(), + node.GetDocument(), + node.Style(), definition.ChildNativeInvalidationProperties(), definition.ChildCustomInvalidationProperties())) {} @@ -31,7 +30,7 @@ // A layout child may be invalid if it has been removed from the tree (it is // possible for a web developer to hold onto a LayoutChild object after its // underlying LayoutObject has been destroyed). - if (!box_ || !token_->IsValid()) { + if (!node_ || !token_->IsValid()) { return ScriptPromise::RejectWithDOMException( script_state, MakeGarbageCollected<DOMException>(DOMExceptionCode::kInvalidStateError,
diff --git a/third_party/blink/renderer/core/layout/custom/custom_layout_child.h b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_child.h similarity index 75% rename from third_party/blink/renderer/core/layout/custom/custom_layout_child.h rename to third_party/blink/renderer/core/layout/ng/custom/custom_layout_child.h index 911170e..5b7c1c43 100644 --- a/third_party/blink/renderer/core/layout/custom/custom_layout_child.h +++ b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_child.h
@@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_CHILD_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_CHILD_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_CHILD_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_CHILD_H_ #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.h" +#include "third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -15,7 +16,6 @@ class CSSLayoutDefinition; class CustomLayoutConstraintsOptions; class CustomLayoutToken; -class LayoutBox; // Represents a "CSS box" for use by a web developer. This is passed into the // web developer defined layout and intrinsicSizes functions so that they can @@ -27,7 +27,7 @@ DEFINE_WRAPPERTYPEINFO(); public: - CustomLayoutChild(const CSSLayoutDefinition&, LayoutBox*); + CustomLayoutChild(const CSSLayoutDefinition&, NGLayoutInputNode); ~CustomLayoutChild() override = default; // LayoutChild.idl @@ -36,18 +36,18 @@ const CustomLayoutConstraintsOptions*, ExceptionState&); - LayoutBox* GetLayoutBox() const { - DCHECK(box_); - return box_; + const NGLayoutInputNode& GetLayoutNode() const { + DCHECK(node_); + return node_; } - void ClearLayoutBox() { box_ = nullptr; } + void ClearLayoutNode() { node_ = nullptr; } void SetCustomLayoutToken(CustomLayoutToken* token) { token_ = token; } void Trace(blink::Visitor*) override; private: - LayoutBox* box_; + NGLayoutInputNode node_; Member<PrepopulatedComputedStylePropertyMap> style_map_; Member<CustomLayoutToken> token_; @@ -56,4 +56,4 @@ } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_CHILD_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_CHILD_H_
diff --git a/third_party/blink/renderer/core/layout/custom/custom_layout_constraints.cc b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_constraints.cc similarity index 95% rename from third_party/blink/renderer/core/layout/custom/custom_layout_constraints.cc rename to third_party/blink/renderer/core/layout/ng/custom/custom_layout_constraints.cc index 6478ae58..2bb3946 100644 --- a/third_party/blink/renderer/core/layout/custom/custom_layout_constraints.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_constraints.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/blink/renderer/core/layout/custom/custom_layout_constraints.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_constraints.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h"
diff --git a/third_party/blink/renderer/core/layout/custom/custom_layout_constraints.h b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_constraints.h similarity index 84% rename from third_party/blink/renderer/core/layout/custom/custom_layout_constraints.h rename to third_party/blink/renderer/core/layout/ng/custom/custom_layout_constraints.h index 77a43a5..1c66b7c 100644 --- a/third_party/blink/renderer/core/layout/custom/custom_layout_constraints.h +++ b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_constraints.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 THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_CONSTRAINTS_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_CONSTRAINTS_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_CONSTRAINTS_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_CONSTRAINTS_H_ #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" @@ -44,4 +44,4 @@ } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_CONSTRAINTS_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_CONSTRAINTS_H_
diff --git a/third_party/blink/renderer/core/layout/custom/custom_layout_constraints_options.idl b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_constraints_options.idl similarity index 100% rename from third_party/blink/renderer/core/layout/custom/custom_layout_constraints_options.idl rename to third_party/blink/renderer/core/layout/ng/custom/custom_layout_constraints_options.idl
diff --git a/third_party/blink/renderer/core/layout/custom/custom_layout_fragment.cc b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_fragment.cc similarity index 76% rename from third_party/blink/renderer/core/layout/custom/custom_layout_fragment.cc rename to third_party/blink/renderer/core/layout/ng/custom/custom_layout_fragment.cc index 4fa8706..83ea4e1 100644 --- a/third_party/blink/renderer/core/layout/custom/custom_layout_fragment.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_fragment.cc
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/layout/custom/custom_layout_fragment.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_fragment.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" -#include "third_party/blink/renderer/core/layout/layout_box.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_child.h" #include "third_party/blink/renderer/core/layout/ng/ng_layout_result.h" namespace blink { @@ -21,7 +21,10 @@ layout_result_(std::move(layout_result)), inline_size_(size.inline_size.ToDouble()), block_size_(size.block_size.ToDouble()) { - // TODO(crbug.com/992950): Pass constraint data through layout result. + // Immediately store the result data, so that it remains immutable between + // layout calls to the child. + if (SerializedScriptValue* data = layout_result_->CustomLayoutData()) + layout_worklet_world_v8_data_.Set(isolate, data->Deserialize(isolate)); } const NGLayoutResult& CustomLayoutFragment::GetLayoutResult() const { @@ -29,8 +32,8 @@ return *layout_result_; } -LayoutBox* CustomLayoutFragment::GetLayoutBox() const { - return child_->GetLayoutBox(); +const NGLayoutInputNode& CustomLayoutFragment::GetLayoutNode() const { + return child_->GetLayoutNode(); } ScriptValue CustomLayoutFragment::data(ScriptState* script_state) const {
diff --git a/third_party/blink/renderer/core/layout/custom/custom_layout_fragment.h b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_fragment.h similarity index 89% rename from third_party/blink/renderer/core/layout/custom/custom_layout_fragment.h rename to third_party/blink/renderer/core/layout/ng/custom/custom_layout_fragment.h index e9b7ff6..bc9cb8e 100644 --- a/third_party/blink/renderer/core/layout/custom/custom_layout_fragment.h +++ b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_fragment.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 THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_FRAGMENT_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_FRAGMENT_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_FRAGMENT_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_FRAGMENT_H_ -#include "third_party/blink/renderer/core/layout/custom/custom_layout_scope.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_scope.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" #include "third_party/blink/renderer/platform/geometry/layout_unit.h" @@ -13,6 +13,7 @@ namespace blink { +class NGLayoutInputNode; class CustomLayoutChild; class LayoutBox; struct LogicalSize; @@ -53,7 +54,7 @@ ScriptValue data(ScriptState*) const; const NGLayoutResult& GetLayoutResult() const; - LayoutBox* GetLayoutBox() const; + const NGLayoutInputNode& GetLayoutNode() const; bool IsValid() const { return token_->IsValid(); } @@ -94,4 +95,4 @@ } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_FRAGMENT_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_FRAGMENT_H_
diff --git a/third_party/blink/renderer/core/layout/custom/custom_layout_scope.cc b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_scope.cc similarity index 76% rename from third_party/blink/renderer/core/layout/custom/custom_layout_scope.cc rename to third_party/blink/renderer/core/layout/ng/custom/custom_layout_scope.cc index 03a507e..923fe5b2 100644 --- a/third_party/blink/renderer/core/layout/custom/custom_layout_scope.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_scope.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/blink/renderer/core/layout/custom/custom_layout_scope.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_scope.h" namespace blink {
diff --git a/third_party/blink/renderer/core/layout/custom/custom_layout_scope.h b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_scope.h similarity index 86% rename from third_party/blink/renderer/core/layout/custom/custom_layout_scope.h rename to third_party/blink/renderer/core/layout/ng/custom/custom_layout_scope.h index b7c031b..319ea6b 100644 --- a/third_party/blink/renderer/core/layout/custom/custom_layout_scope.h +++ b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_scope.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 THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_SCOPE_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_SCOPE_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_SCOPE_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_SCOPE_H_ -#include "third_party/blink/renderer/core/layout/custom/custom_layout_work_task.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_work_task.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -73,4 +73,4 @@ } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_SCOPE_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_SCOPE_H_
diff --git a/third_party/blink/renderer/core/layout/custom/custom_layout_work_task.cc b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_work_task.cc similarity index 88% rename from third_party/blink/renderer/core/layout/custom/custom_layout_work_task.cc rename to third_party/blink/renderer/core/layout/ng/custom/custom_layout_work_task.cc index 4389766..b23852b 100644 --- a/third_party/blink/renderer/core/layout/custom/custom_layout_work_task.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_work_task.cc
@@ -2,14 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/layout/custom/custom_layout_work_task.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_work_task.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" -#include "third_party/blink/renderer/core/layout/custom/custom_layout_child.h" -#include "third_party/blink/renderer/core/layout/custom/custom_layout_constraints_options.h" -#include "third_party/blink/renderer/core/layout/custom/custom_layout_fragment.h" -#include "third_party/blink/renderer/core/layout/layout_block.h" -#include "third_party/blink/renderer/core/layout/layout_box.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_child.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_constraints_options.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_fragment.h" #include "third_party/blink/renderer/core/layout/ng/ng_block_node.h" #include "third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h" #include "third_party/blink/renderer/core/layout/ng/ng_layout_result.h" @@ -34,7 +32,7 @@ void CustomLayoutWorkTask::Run(const NGConstraintSpace& parent_space, const ComputedStyle& parent_style) { DCHECK(token_->IsValid()); - NGBlockNode node(child_->GetLayoutBox()); + NGLayoutInputNode node = child_->GetLayoutNode(); NGConstraintSpaceBuilder builder(parent_space, node.Style().GetWritingMode(), /* is_new_fc */ true); SetOrthogonalFallbackInlineSizeIfNeeded(parent_style, node, &builder); @@ -97,6 +95,8 @@ builder.SetIsShrinkToFit(node.Style().LogicalWidth().IsAuto()); builder.SetIsFixedInlineSize(is_fixed_inline_size); builder.SetIsFixedBlockSize(is_fixed_block_size); + if (node.IsLayoutNGCustom()) + builder.SetCustomLayoutData(std::move(constraint_data_)); auto space = builder.ToConstraintSpace(); auto result = To<NGBlockNode>(node).Layout(space, nullptr /* break_token */);
diff --git a/third_party/blink/renderer/core/layout/custom/custom_layout_work_task.h b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_work_task.h similarity index 80% rename from third_party/blink/renderer/core/layout/custom/custom_layout_work_task.h rename to third_party/blink/renderer/core/layout/ng/custom/custom_layout_work_task.h index 2ab23b9..5038048 100644 --- a/third_party/blink/renderer/core/layout/custom/custom_layout_work_task.h +++ b/third_party/blink/renderer/core/layout/ng/custom/custom_layout_work_task.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 THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_WORK_TASK_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_WORK_TASK_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_WORK_TASK_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_WORK_TASK_H_ -#include "third_party/blink/renderer/core/layout/custom/custom_layout_constraints_options.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_constraints_options.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -43,4 +43,4 @@ } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_CUSTOM_LAYOUT_WORK_TASK_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_CUSTOM_LAYOUT_WORK_TASK_H_
diff --git a/third_party/blink/renderer/core/layout/custom/document_layout_definition.cc b/third_party/blink/renderer/core/layout/ng/custom/document_layout_definition.cc similarity index 93% rename from third_party/blink/renderer/core/layout/custom/document_layout_definition.cc rename to third_party/blink/renderer/core/layout/ng/custom/document_layout_definition.cc index 2d8984f..3d60b88 100644 --- a/third_party/blink/renderer/core/layout/custom/document_layout_definition.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/document_layout_definition.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/blink/renderer/core/layout/custom/document_layout_definition.h" +#include "third_party/blink/renderer/core/layout/ng/custom/document_layout_definition.h" namespace blink {
diff --git a/third_party/blink/renderer/core/layout/custom/document_layout_definition.h b/third_party/blink/renderer/core/layout/ng/custom/document_layout_definition.h similarity index 82% rename from third_party/blink/renderer/core/layout/custom/document_layout_definition.h rename to third_party/blink/renderer/core/layout/ng/custom/document_layout_definition.h index 6c880e5..b3b77ad 100644 --- a/third_party/blink/renderer/core/layout/custom/document_layout_definition.h +++ b/third_party/blink/renderer/core/layout/ng/custom/document_layout_definition.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 THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_DOCUMENT_LAYOUT_DEFINITION_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_DOCUMENT_LAYOUT_DEFINITION_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_DOCUMENT_LAYOUT_DEFINITION_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_DOCUMENT_LAYOUT_DEFINITION_H_ -#include "third_party/blink/renderer/core/layout/custom/css_layout_definition.h" +#include "third_party/blink/renderer/core/layout/ng/custom/css_layout_definition.h" namespace blink { @@ -48,4 +48,4 @@ } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_DOCUMENT_LAYOUT_DEFINITION_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_DOCUMENT_LAYOUT_DEFINITION_H_
diff --git a/third_party/blink/renderer/core/layout/custom/fragment_result_options.idl b/third_party/blink/renderer/core/layout/ng/custom/fragment_result_options.idl similarity index 100% rename from third_party/blink/renderer/core/layout/custom/fragment_result_options.idl rename to third_party/blink/renderer/core/layout/ng/custom/fragment_result_options.idl
diff --git a/third_party/blink/renderer/core/layout/custom/layout_child.idl b/third_party/blink/renderer/core/layout/ng/custom/layout_child.idl similarity index 100% rename from third_party/blink/renderer/core/layout/custom/layout_child.idl rename to third_party/blink/renderer/core/layout/ng/custom/layout_child.idl
diff --git a/third_party/blink/renderer/core/layout/custom/layout_constraints.idl b/third_party/blink/renderer/core/layout/ng/custom/layout_constraints.idl similarity index 100% rename from third_party/blink/renderer/core/layout/custom/layout_constraints.idl rename to third_party/blink/renderer/core/layout/ng/custom/layout_constraints.idl
diff --git a/third_party/blink/renderer/core/layout/custom/layout_fragment.idl b/third_party/blink/renderer/core/layout/ng/custom/layout_fragment.idl similarity index 100% rename from third_party/blink/renderer/core/layout/custom/layout_fragment.idl rename to third_party/blink/renderer/core/layout/ng/custom/layout_fragment.idl
diff --git a/third_party/blink/renderer/core/layout/ng/custom/layout_ng_custom.cc b/third_party/blink/renderer/core/layout/ng/custom/layout_ng_custom.cc index 446cb3a6..254c535 100644 --- a/third_party/blink/renderer/core/layout/ng/custom/layout_ng_custom.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/layout_ng_custom.cc
@@ -6,7 +6,7 @@ #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" -#include "third_party/blink/renderer/core/layout/custom/layout_worklet.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet.h" namespace blink {
diff --git a/third_party/blink/renderer/core/layout/custom/layout_worklet.cc b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet.cc similarity index 86% rename from third_party/blink/renderer/core/layout/custom/layout_worklet.cc rename to third_party/blink/renderer/core/layout/ng/custom/layout_worklet.cc index f04a404c..6986d303 100644 --- a/third_party/blink/renderer/core/layout/custom/layout_worklet.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet.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 "third_party/blink/renderer/core/layout/custom/layout_worklet.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" -#include "third_party/blink/renderer/core/layout/custom/document_layout_definition.h" -#include "third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.h" -#include "third_party/blink/renderer/core/layout/custom/pending_layout_registry.h" +#include "third_party/blink/renderer/core/layout/ng/custom/document_layout_definition.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.h" +#include "third_party/blink/renderer/core/layout/ng/custom/pending_layout_registry.h" namespace blink {
diff --git a/third_party/blink/renderer/core/layout/custom/layout_worklet.h b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet.h similarity index 83% rename from third_party/blink/renderer/core/layout/custom/layout_worklet.h rename to third_party/blink/renderer/core/layout/ng/custom/layout_worklet.h index 3760877..3c433e49 100644 --- a/third_party/blink/renderer/core/layout/custom/layout_worklet.h +++ b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet.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 THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_LAYOUT_WORKLET_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_LAYOUT_WORKLET_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_LAYOUT_WORKLET_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_LAYOUT_WORKLET_H_ #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/core/layout/custom/document_layout_definition.h" -#include "third_party/blink/renderer/core/layout/custom/pending_layout_registry.h" +#include "third_party/blink/renderer/core/layout/ng/custom/document_layout_definition.h" +#include "third_party/blink/renderer/core/layout/ng/custom/pending_layout_registry.h" #include "third_party/blink/renderer/core/workers/worklet.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -67,4 +67,4 @@ } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_LAYOUT_WORKLET_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_LAYOUT_WORKLET_H_
diff --git a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.cc b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope.cc similarity index 95% rename from third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.cc rename to third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope.cc index 6387c9c0..a953e2ef 100644 --- a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope.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/blink/renderer/core/layout/custom/layout_worklet_global_scope.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope.h" #include "third_party/blink/renderer/bindings/core/v8/v8_function.h" #include "third_party/blink/renderer/bindings/core/v8/v8_layout_callback.h" @@ -15,9 +15,9 @@ #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/inspector/main_thread_debugger.h" -#include "third_party/blink/renderer/core/layout/custom/css_layout_definition.h" -#include "third_party/blink/renderer/core/layout/custom/document_layout_definition.h" -#include "third_party/blink/renderer/core/layout/custom/layout_worklet.h" +#include "third_party/blink/renderer/core/layout/ng/custom/css_layout_definition.h" +#include "third_party/blink/renderer/core/layout/ng/custom/document_layout_definition.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet.h" #include "third_party/blink/renderer/core/origin_trials/origin_trial_context.h" #include "third_party/blink/renderer/core/workers/global_scope_creation_params.h" #include "third_party/blink/renderer/platform/bindings/callback_method_retriever.h"
diff --git a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.h b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope.h similarity index 86% rename from third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.h rename to third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope.h index 35d0abd..642e9af 100644 --- a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.h +++ b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope.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 THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_LAYOUT_WORKLET_GLOBAL_SCOPE_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_LAYOUT_WORKLET_GLOBAL_SCOPE_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_LAYOUT_WORKLET_GLOBAL_SCOPE_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_LAYOUT_WORKLET_GLOBAL_SCOPE_H_ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" -#include "third_party/blink/renderer/core/layout/custom/pending_layout_registry.h" +#include "third_party/blink/renderer/core/layout/ng/custom/pending_layout_registry.h" #include "third_party/blink/renderer/core/workers/worklet_global_scope.h" #include "third_party/blink/renderer/platform/wtf/casting.h" @@ -63,4 +63,4 @@ } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_LAYOUT_WORKLET_GLOBAL_SCOPE_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_LAYOUT_WORKLET_GLOBAL_SCOPE_H_
diff --git a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.idl b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope.idl similarity index 100% rename from third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.idl rename to third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope.idl
diff --git a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.cc b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.cc similarity index 97% rename from third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.cc rename to third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.cc index 342102e..9687b542 100644 --- a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.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/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.h" #include "third_party/blink/public/mojom/script/script_type.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/script_source_code.h"
diff --git a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.h b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.h similarity index 85% rename from third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.h rename to third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.h index ed8e228f0..77c4d3fe 100644 --- a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.h +++ b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.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 THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_LAYOUT_WORKLET_GLOBAL_SCOPE_PROXY_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_LAYOUT_WORKLET_GLOBAL_SCOPE_PROXY_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_LAYOUT_WORKLET_GLOBAL_SCOPE_PROXY_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_LAYOUT_WORKLET_GLOBAL_SCOPE_PROXY_H_ #include "base/single_thread_task_runner.h" #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope.h" #include "third_party/blink/renderer/core/workers/main_thread_worklet_reporting_proxy.h" #include "third_party/blink/renderer/core/workers/worklet_global_scope_proxy.h" @@ -55,4 +55,4 @@ } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_LAYOUT_WORKLET_GLOBAL_SCOPE_PROXY_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_LAYOUT_WORKLET_GLOBAL_SCOPE_PROXY_H_
diff --git a/third_party/blink/renderer/core/layout/custom/layout_worklet_test.cc b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_test.cc similarity index 95% rename from third_party/blink/renderer/core/layout/custom/layout_worklet_test.cc rename to third_party/blink/renderer/core/layout/ng/custom/layout_worklet_test.cc index fced59c..6d4e88f 100644 --- a/third_party/blink/renderer/core/layout/custom/layout_worklet_test.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_test.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/blink/renderer/core/layout/custom/layout_worklet.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet.h" #include <memory> #include "testing/gtest/include/gtest/gtest.h" @@ -11,9 +11,9 @@ #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" -#include "third_party/blink/renderer/core/layout/custom/css_layout_definition.h" -#include "third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.h" -#include "third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.h" +#include "third_party/blink/renderer/core/layout/ng/custom/css_layout_definition.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.h" #include "third_party/blink/renderer/core/testing/page_test_base.h" namespace blink {
diff --git a/third_party/blink/renderer/core/layout/ng/custom/ng_custom_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/custom/ng_custom_layout_algorithm.cc index 551a3f59..deba377 100644 --- a/third_party/blink/renderer/core/layout/ng/custom/ng_custom_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/ng_custom_layout_algorithm.cc
@@ -7,11 +7,11 @@ #include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" -#include "third_party/blink/renderer/core/layout/custom/custom_layout_fragment.h" -#include "third_party/blink/renderer/core/layout/custom/custom_layout_scope.h" -#include "third_party/blink/renderer/core/layout/custom/fragment_result_options.h" -#include "third_party/blink/renderer/core/layout/custom/layout_worklet.h" -#include "third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_fragment.h" +#include "third_party/blink/renderer/core/layout/ng/custom/custom_layout_scope.h" +#include "third_party/blink/renderer/core/layout/ng/custom/fragment_result_options.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.h" #include "third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.h" #include "third_party/blink/renderer/core/layout/ng/ng_length_utils.h" #include "third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.h" @@ -86,7 +86,7 @@ // TODO(ikilpatrick): Implement paint order. This should abort this loop, // and go into a "slow" loop which allows developers to control the paint // order of the children. - if (!child || child.GetLayoutBox() != fragment->GetLayoutBox()) { + if (!child || child != fragment->GetLayoutNode()) { // TODO(ikilpatrick): Report this error to the developer. return FallbackLayout(); } @@ -122,6 +122,7 @@ LayoutUnit block_size = ComputeBlockSizeForFragment( ConstraintSpace(), Style(), border_padding_, auto_block_size); + container_builder_.SetCustomLayoutData(std::move(fragment_result_data)); container_builder_.SetIntrinsicBlockSize(auto_block_size); container_builder_.SetBlockSize(block_size);
diff --git a/third_party/blink/renderer/core/layout/custom/pending_layout_registry.cc b/third_party/blink/renderer/core/layout/ng/custom/pending_layout_registry.cc similarity index 95% rename from third_party/blink/renderer/core/layout/custom/pending_layout_registry.cc rename to third_party/blink/renderer/core/layout/ng/custom/pending_layout_registry.cc index fe52968..4239b4da 100644 --- a/third_party/blink/renderer/core/layout/custom/pending_layout_registry.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/pending_layout_registry.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/blink/renderer/core/layout/custom/pending_layout_registry.h" +#include "third_party/blink/renderer/core/layout/ng/custom/pending_layout_registry.h" #include "third_party/blink/renderer/core/css/style_change_reason.h" #include "third_party/blink/renderer/core/dom/node.h"
diff --git a/third_party/blink/renderer/core/layout/custom/pending_layout_registry.h b/third_party/blink/renderer/core/layout/ng/custom/pending_layout_registry.h similarity index 87% rename from third_party/blink/renderer/core/layout/custom/pending_layout_registry.h rename to third_party/blink/renderer/core/layout/ng/custom/pending_layout_registry.h index 1fbfa3ee..ba74e988 100644 --- a/third_party/blink/renderer/core/layout/custom/pending_layout_registry.h +++ b/third_party/blink/renderer/core/layout/ng/custom/pending_layout_registry.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 THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_PENDING_LAYOUT_REGISTRY_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_PENDING_LAYOUT_REGISTRY_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_PENDING_LAYOUT_REGISTRY_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_PENDING_LAYOUT_REGISTRY_H_ #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" @@ -43,4 +43,4 @@ } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_PENDING_LAYOUT_REGISTRY_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_CUSTOM_PENDING_LAYOUT_REGISTRY_H_
diff --git a/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.h b/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.h index 7674ccf..096d157 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.h +++ b/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.h
@@ -189,6 +189,11 @@ // Either this function or SetBoxType must be called before ToBoxFragment(). void SetIsNewFormattingContext(bool is_new_fc) { is_new_fc_ = is_new_fc; } + void SetCustomLayoutData( + scoped_refptr<SerializedScriptValue> custom_layout_data) { + custom_layout_data_ = std::move(custom_layout_data); + } + // Layout algorithms should call this function for each baseline request in // the constraint space. // @@ -260,6 +265,8 @@ NGBorderEdges border_edges_; + scoped_refptr<SerializedScriptValue> custom_layout_data_; + friend class NGPhysicalBoxFragment; friend class NGLayoutResult; };
diff --git a/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h b/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h index 4df04c9..e1628c0 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h +++ b/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h
@@ -6,6 +6,7 @@ #define NGConstraintSpace_h #include "base/optional.h" +#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/layout/geometry/logical_size.h" #include "third_party/blink/renderer/core/layout/geometry/physical_size.h" @@ -421,6 +422,10 @@ OptimisticBfcBlockOffset().value_or(BfcOffset().block_offset)); } + SerializedScriptValue* CustomLayoutData() const { + return HasRareData() ? rare_data_->custom_layout_data.get() : nullptr; + } + // Returns the types of preceding adjoining objects. // See |NGAdjoiningObjectTypes|. // @@ -564,6 +569,8 @@ NGBoxStrut table_cell_borders; NGBoxStrut table_cell_intrinsic_padding; + scoped_refptr<SerializedScriptValue> custom_layout_data; + LayoutUnit fragmentainer_block_size = kIndefiniteSize; LayoutUnit fragmentainer_space_at_bfc_start = kIndefiniteSize;
diff --git a/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h b/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h index 57d44625..67c6994d 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h +++ b/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h
@@ -284,6 +284,18 @@ space_.exclusion_space_ = exclusion_space; } + void SetCustomLayoutData( + scoped_refptr<SerializedScriptValue> custom_layout_data) { +#if DCHECK_IS_ON() + DCHECK(!is_custom_layout_data_set_); + is_custom_layout_data_set_ = true; +#endif + if (custom_layout_data) { + space_.EnsureRareData()->custom_layout_data = + std::move(custom_layout_data); + } + } + void AddBaselineRequests(const NGBaselineRequestList requests) { DCHECK(baseline_requests_.IsEmpty()); baseline_requests_.AppendVector(requests); @@ -337,6 +349,7 @@ bool is_clearance_offset_set_ = false; bool is_table_cell_borders_set_ = false; bool is_table_cell_intrinsic_padding_set_ = false; + bool is_custom_layout_data_set_ = false; bool to_constraint_space_called_ = false; #endif
diff --git a/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h b/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h index 34ab075..4e15e60 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h +++ b/third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h
@@ -82,6 +82,9 @@ bool IsBlock() const { return type_ == kBlock; } bool IsBlockFlow() const { return IsBlock() && box_->IsLayoutBlockFlow(); } + bool IsLayoutNGCustom() const { + return IsBlock() && box_->IsLayoutNGCustom(); + } bool IsColumnSpanAll() const { return IsBlock() && box_->IsColumnSpanAll(); } bool IsFloating() const { return IsBlock() && box_->IsFloating(); } bool IsOutOfFlowPositioned() const {
diff --git a/third_party/blink/renderer/core/layout/ng/ng_layout_result.cc b/third_party/blink/renderer/core/layout/ng/ng_layout_result.cc index 2cec25d..d2a9219 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_layout_result.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_layout_result.cc
@@ -45,6 +45,10 @@ intrinsic_block_size_ = builder->intrinsic_block_size_; if (builder->minimal_space_shortage_ != LayoutUnit::Max()) EnsureRareData()->minimal_space_shortage = builder->minimal_space_shortage_; + if (builder->custom_layout_data_) { + EnsureRareData()->custom_layout_data = + std::move(builder->custom_layout_data_); + } bitfields_.initial_break_before = static_cast<unsigned>(builder->initial_break_before_); bitfields_.final_break_after =
diff --git a/third_party/blink/renderer/core/layout/ng/ng_layout_result.h b/third_party/blink/renderer/core/layout/ng/ng_layout_result.h index 126a2ec..f96f7946 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_layout_result.h +++ b/third_party/blink/renderer/core/layout/ng/ng_layout_result.h
@@ -6,6 +6,7 @@ #define NGLayoutResult_h #include "base/memory/scoped_refptr.h" +#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/layout/ng/exclusions/ng_exclusion_space.h" #include "third_party/blink/renderer/core/layout/ng/geometry/ng_bfc_offset.h" @@ -122,6 +123,10 @@ : LayoutUnit::Max(); } + SerializedScriptValue* CustomLayoutData() const { + return HasRareData() ? rare_data_->custom_layout_data.get() : nullptr; + } + // The break-before value on the first child needs to be propagated to the // container, in search of a valid class A break point. EBreakBetween InitialBreakBefore() const { @@ -280,6 +285,7 @@ NGUnpositionedListMarker unpositioned_list_marker; LayoutUnit minimal_space_shortage = LayoutUnit::Max(); NGExclusionSpace exclusion_space; + scoped_refptr<SerializedScriptValue> custom_layout_data; }; bool HasRareData() const { return bitfields_.has_rare_data; }
diff --git a/third_party/blink/renderer/core/loader/cookie_jar.cc b/third_party/blink/renderer/core/loader/cookie_jar.cc index 2445b749..5bb98eac 100644 --- a/third_party/blink/renderer/core/loader/cookie_jar.cc +++ b/third_party/blink/renderer/core/loader/cookie_jar.cc
@@ -22,7 +22,8 @@ RequestRestrictedCookieManagerIfNeeded(); SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.CookieJar.SyncCookiesSetTime"); - backend_->SetCookieFromString(cookie_url, document_->SiteForCookies(), value); + backend_->SetCookieFromString(cookie_url, document_->SiteForCookies(), + document_->TopFrameOrigin(), value); } String CookieJar::Cookies() { @@ -33,7 +34,8 @@ SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.CookieJar.SyncCookiesTime"); RequestRestrictedCookieManagerIfNeeded(); String value; - backend_->GetCookiesString(cookie_url, document_->SiteForCookies(), &value); + backend_->GetCookiesString(cookie_url, document_->SiteForCookies(), + document_->TopFrameOrigin(), &value); return value; } @@ -45,7 +47,7 @@ RequestRestrictedCookieManagerIfNeeded(); bool cookies_enabled = false; backend_->CookiesEnabledFor(cookie_url, document_->SiteForCookies(), - &cookies_enabled); + document_->TopFrameOrigin(), &cookies_enabled); return cookies_enabled; }
diff --git a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc index e4aad2ad..31648820 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc
@@ -315,7 +315,15 @@ PaintFloats(paint_info); } } else { - PaintBlockChildren(paint_info); + if (paint_phase != PaintPhase::kFloat) { + PaintBlockChildren(paint_info); + } + + if (paint_phase == PaintPhase::kFloat || + paint_phase == PaintPhase::kSelection || + paint_phase == PaintPhase::kTextClip) { + PaintFloats(paint_info); + } } } @@ -406,14 +414,14 @@ } } -void NGBoxFragmentPainter::PaintFloatingChildren( +void NGBoxFragmentPainter::PaintInlineFloatingChildren( NGPaintFragment::ChildList children, const PaintInfo& paint_info) { for (const NGPaintFragment* child : children) { - const NGPhysicalFragment& fragment = child->PhysicalFragment(); - if (child->HasSelfPaintingLayer()) + const NGPhysicalFragment& child_fragment = child->PhysicalFragment(); + if (child_fragment.HasSelfPaintingLayer()) continue; - if (fragment.IsFloating()) { + if (child_fragment.IsFloating()) { // TODO(kojii): The float is outside of the inline formatting context and // that it maybe another NG inline formatting context, NG block layout, or // legacy. NGBoxFragmentPainter can handle only the first case. In order @@ -421,31 +429,56 @@ // which will forward back to NGBoxFragmentPainter if the float is for // NGBoxFragmentPainter. We can shortcut this for the first case when // we're more stable. - ObjectPainter(*child->GetLayoutObject()) + ObjectPainter(*child_fragment.GetLayoutObject()) .PaintAllPhasesAtomically(paint_info); continue; } if (const auto* child_container = - DynamicTo<NGPhysicalContainerFragment>(fragment)) { + DynamicTo<NGPhysicalContainerFragment>(&child_fragment)) { if (child_container->HasFloatingDescendants()) - PaintFloatingChildren(child->Children(), paint_info); + PaintInlineFloatingChildren(child->Children(), paint_info); + } + } +} + +void NGBoxFragmentPainter::PaintBlockFloatingChildren( + const NGPhysicalContainerFragment& container, + const PaintInfo& paint_info) { + for (const NGLink& child : container.Children()) { + const NGPhysicalFragment& child_fragment = *child; + if (child_fragment.HasSelfPaintingLayer()) + continue; + if (child_fragment.IsFloating()) { + // TODO(kojii): The float is outside of the inline formatting context and + // that it maybe another NG inline formatting context, NG block layout, or + // legacy. NGBoxFragmentPainter can handle only the first case. In order + // to cover more tests for other two cases, we always fallback to legacy, + // which will forward back to NGBoxFragmentPainter if the float is for + // NGBoxFragmentPainter. We can shortcut this for the first case when + // we're more stable. + ObjectPainter(*child_fragment.GetLayoutObject()) + .PaintAllPhasesAtomically(paint_info); + continue; + } + if (const auto* child_container = + DynamicTo<NGPhysicalContainerFragment>(&child_fragment)) { + PaintBlockFloatingChildren(*child_container, paint_info); } } } void NGBoxFragmentPainter::PaintFloats(const PaintInfo& paint_info) { - DCHECK(PhysicalFragment().HasFloatingDescendants()); + DCHECK(PhysicalFragment().HasFloatingDescendants() || + !PhysicalFragment().ChildrenInline()); - // TODO(eae): The legacy paint code currently handles most floats, if they can - // be painted by PaintNG BlockFlowPainter::PaintFloats will then call - // NGBlockFlowPainter::Paint on each float. - // This code is currently only used for floats within a block within inline - // children. PaintInfo float_paint_info(paint_info); if (paint_info.phase == PaintPhase::kFloat) float_paint_info.phase = PaintPhase::kForeground; - DCHECK(paint_fragment_); - PaintFloatingChildren(paint_fragment_->Children(), float_paint_info); + if (paint_fragment_) { + PaintInlineFloatingChildren(paint_fragment_->Children(), float_paint_info); + return; + } + PaintBlockFloatingChildren(PhysicalFragment(), float_paint_info); } void NGBoxFragmentPainter::PaintMask(const PaintInfo& paint_info,
diff --git a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.h b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.h index 3cc1725..36206c53 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.h +++ b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.h
@@ -99,7 +99,10 @@ void PaintTextChild(const NGPaintFragment&, const PaintInfo&, const PhysicalOffset& paint_offset); - void PaintFloatingChildren(NGPaintFragment::ChildList, const PaintInfo&); + void PaintInlineFloatingChildren(NGPaintFragment::ChildList, + const PaintInfo&); + void PaintBlockFloatingChildren(const NGPhysicalContainerFragment&, + const PaintInfo&); void PaintFloats(const PaintInfo&); void PaintMask(const PaintInfo&, const PhysicalOffset& paint_offset); void PaintAtomicInline(const PaintInfo&);
diff --git a/third_party/blink/renderer/core/style/computed_style.cc b/third_party/blink/renderer/core/style/computed_style.cc index 71a3c95f9..db2d1c0 100644 --- a/third_party/blink/renderer/core/style/computed_style.cc +++ b/third_party/blink/renderer/core/style/computed_style.cc
@@ -40,8 +40,8 @@ #include "third_party/blink/renderer/core/css/resolver/style_resolver.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" -#include "third_party/blink/renderer/core/layout/custom/layout_worklet.h" #include "third_party/blink/renderer/core/layout/layout_theme.h" +#include "third_party/blink/renderer/core/layout/ng/custom/layout_worklet.h" #include "third_party/blink/renderer/core/layout/text_autosizer.h" #include "third_party/blink/renderer/core/style/applied_text_decoration.h" #include "third_party/blink/renderer/core/style/border_edge.h" @@ -211,6 +211,16 @@ return true; if (old_style->HasTextCombine() != new_style->HasTextCombine()) return true; + // line-clamping is currently only handled by LayoutDeprecatedFlexibleBox, + // so that if line-clamping changes then the LayoutObject needs to be + // recreated. + if (RuntimeEnabledFeatures::WebkitBoxLayoutUsesFlexLayoutEnabled() && + (new_style->Display() == EDisplay::kWebkitBox || + new_style->Display() == EDisplay::kWebkitInlineBox) && + (old_style->HasLineClamp() != new_style->HasLineClamp() && + new_style->BoxOrient() == EBoxOrient::kVertical)) { + return true; + } // We need to perform a reattach if a "display: layout(foo)" has changed to a // "display: layout(bar)". This is because one custom layout could be // registered and the other may not, affecting the box-tree construction.
diff --git a/third_party/blink/renderer/core/svg/svg_a_element.cc b/third_party/blink/renderer/core/svg/svg_a_element.cc index d3d7015..f44723c 100644 --- a/third_party/blink/renderer/core/svg/svg_a_element.cc +++ b/third_party/blink/renderer/core/svg/svg_a_element.cc
@@ -133,14 +133,18 @@ target = AtomicString("_blank"); event.SetDefaultHandled(); + if (!GetDocument().GetFrame()) + return; + FrameLoadRequest frame_request( &GetDocument(), ResourceRequest(GetDocument().CompleteURL(url))); frame_request.SetNavigationPolicy(NavigationPolicyFromEvent(&event)); frame_request.SetTriggeringEventInfo( event.isTrusted() ? WebTriggeringEventInfo::kFromTrustedEvent : WebTriggeringEventInfo::kFromUntrustedEvent); - if (!GetDocument().GetFrame()) - return; + frame_request.GetResourceRequest().SetHasUserGesture( + LocalFrame::HasTransientUserActivation(GetDocument().GetFrame())); + Frame* frame = GetDocument() .GetFrame() ->Tree()
diff --git a/third_party/blink/renderer/core/svg/svg_use_element.cc b/third_party/blink/renderer/core/svg/svg_use_element.cc index 2d5a2b3..0559b79e 100644 --- a/third_party/blink/renderer/core/svg/svg_use_element.cc +++ b/third_party/blink/renderer/core/svg/svg_use_element.cc
@@ -328,10 +328,8 @@ return; auto* target = DynamicTo<SVGElement>(ResolveTargetElement(kAddObserver)); // TODO(fs): Why would the Element not be "connected" at this point? - if (target && target->isConnected()) { + if (target && target->isConnected()) BuildShadowAndInstanceTree(*target); - InvalidateDependentShadowTrees(); - } DCHECK(!needs_shadow_tree_recreation_); }
diff --git a/third_party/blink/renderer/core/workers/worker_global_scope.idl b/third_party/blink/renderer/core/workers/worker_global_scope.idl index 4523572..23fb81b 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.idl +++ b/third_party/blink/renderer/core/workers/worker_global_scope.idl
@@ -53,7 +53,7 @@ // CORS and RFC1918 // https://wicg.github.io/cors-rfc1918/#feature-detect - [RuntimeEnabled=CorsRFC1918, ImplementedAs=addressSpaceForBindings] readonly attribute AddressSpace addressSpace; + [RuntimeEnabled=AddressSpace, ImplementedAs=addressSpaceForBindings] readonly attribute AddressSpace addressSpace; // Unhandled Promise Rejection Events attribute EventHandler onrejectionhandled;
diff --git a/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.cc b/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.cc index 205cf76..b94a202d 100644 --- a/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.cc +++ b/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.cc
@@ -1104,11 +1104,12 @@ if (async_) { UseCounter::Count(&execution_context, WebFeature::kXMLHttpRequestAsynchronous); - if (GetExecutionContext()->IsDocument()) { + if (execution_context.IsDocument()) { // Update histogram for usage of async xhr within pagedismissal. auto pagedismissal = GetDocument()->PageDismissalEventBeingDispatched(); if (pagedismissal != Document::kNoDismissal) { - UseCounter::Count(GetDocument(), WebFeature::kAsyncXhrInPageDismissal); + UseCounter::Count(&execution_context, + WebFeature::kAsyncXhrInPageDismissal); DEFINE_STATIC_LOCAL(EnumerationHistogram, asyncxhr_pagedismissal_histogram, ("XHR.Async.PageDismissal", 5)); @@ -1145,7 +1146,7 @@ // Disallow synchronous requests on page dismissal if (base::FeatureList::IsEnabled( features::kForbidSyncXHRInPageDismissal)) { - UseCounter::Count(GetDocument(), + UseCounter::Count(&execution_context, WebFeature::kForbiddenSyncXhrInPageDismissal); DEFINE_STATIC_LOCAL(EnumerationHistogram, forbidden_syncxhr_pagedismissal_histogram,
diff --git a/third_party/blink/renderer/modules/animationworklet/worklet_animation_effect.cc b/third_party/blink/renderer/modules/animationworklet/worklet_animation_effect.cc index d01a790a..fb79cdf 100644 --- a/third_party/blink/renderer/modules/animationworklet/worklet_animation_effect.cc +++ b/third_party/blink/renderer/modules/animationworklet/worklet_animation_effect.cc
@@ -13,7 +13,8 @@ const Timing& specified_timing) : local_time_(local_time), specified_timing_(specified_timing), - calculated_() { + calculated_(), + last_update_time_(NullValue()) { specified_timing_.AssertValid(); } @@ -22,72 +23,20 @@ } ComputedEffectTiming* WorkletAnimationEffect::getComputedTiming() const { - UpdateInheritedTime(local_time_.has_value() ? local_time_.value().InSecondsF() - : NullValue()); - return specified_timing_.getComputedTiming(calculated_, false); -} + double local_time = + local_time_.has_value() ? local_time_.value().InSecondsF() : NullValue(); -// TODO(jortaylo): This function is meant to replicate similar logic found in -// AnimationEffect::UpdateInheritedTime. It has been updated here only to remove -// unneeded sections of the code that don't apply within worklet scope. -// It needs to be moved to Timing so that it can be shared between -// AnimationEffect and WorkletAnimationEffect. https://crbug.com/915344. -void WorkletAnimationEffect::UpdateInheritedTime(double inherited_time) const { - bool needs_update = (last_update_time_ != inherited_time && - !(IsNull(last_update_time_) && IsNull(inherited_time))); + bool needs_update = last_update_time_ != local_time && + !(IsNull(last_update_time_) && IsNull(local_time)); + last_update_time_ = local_time; - if (!needs_update) - return; - - last_update_time_ = inherited_time; - const double local_time = inherited_time; - - const double active_duration = specified_timing_.ActiveDuration(); - const AnimationEffect::AnimationDirection direction = - AnimationEffect::kForwards; - const Timing::Phase current_phase = - CalculatePhase(active_duration, local_time, direction, specified_timing_); - - const double active_time = CalculateActiveTime( - active_duration, specified_timing_.ResolvedFillMode(false), local_time, - current_phase, specified_timing_); - base::Optional<double> progress; - const double iteration_duration = - specified_timing_.IterationDuration().InSecondsF(); - const double overall_progress = CalculateOverallProgress( - current_phase, active_time, iteration_duration, - specified_timing_.iteration_count, specified_timing_.iteration_start); - const double simple_iteration_progress = CalculateSimpleIterationProgress( - current_phase, overall_progress, specified_timing_.iteration_start, - active_time, active_duration, specified_timing_.iteration_count); - const double current_iteration = CalculateCurrentIteration( - current_phase, active_time, specified_timing_.iteration_count, - overall_progress, simple_iteration_progress); - const bool current_direction_is_forwards = IsCurrentDirectionForwards( - current_iteration, specified_timing_.direction); - const double directed_progress = - CalculateDirectedProgress(simple_iteration_progress, current_iteration, - specified_timing_.direction); - - progress = CalculateTransformedProgress( - current_phase, directed_progress, iteration_duration, - current_direction_is_forwards, specified_timing_.timing_function); - if (IsNull(progress.value())) { - progress.reset(); + if (needs_update) { + calculated_ = specified_timing_.CalculateTimings( + local_time, Timing::AnimationDirection::kForwards, false); } - if (iteration_duration) { - calculated_.phase = current_phase; - calculated_.current_iteration = current_iteration; - calculated_.progress = progress; - calculated_.is_in_effect = !IsNull(active_time); - calculated_.is_in_play = calculated_.phase == Timing::kPhaseActive; - calculated_.is_current = - calculated_.phase == Timing::kPhaseBefore || calculated_.is_in_play; - calculated_.local_time = last_update_time_; - } - - return; + return specified_timing_.getComputedTiming(calculated_, + /*is_keyframe_effect*/ false); } void WorkletAnimationEffect::setLocalTime(double time_ms, bool is_null) {
diff --git a/third_party/blink/renderer/modules/animationworklet/worklet_animation_effect.h b/third_party/blink/renderer/modules/animationworklet/worklet_animation_effect.h index 661b209..8f47a6e 100644 --- a/third_party/blink/renderer/modules/animationworklet/worklet_animation_effect.h +++ b/third_party/blink/renderer/modules/animationworklet/worklet_animation_effect.h
@@ -18,13 +18,6 @@ DEFINE_WRAPPERTYPEINFO(); public: - // Represents the animation direction from the Web Animations spec, see - // https://drafts.csswg.org/web-animations-1/#animation-direction. - enum AnimationDirection { - kForwards, - kBackwards, - }; - WorkletAnimationEffect(base::Optional<base::TimeDelta> local_time, const Timing& timing); @@ -49,7 +42,6 @@ // above function call getTiming() which returns a pointer to an EffectTiming // object, as is defined in worklet_animation_effect.idl. const Timing specified_timing_; - mutable Timing::CalculatedTiming calculated_; mutable double last_update_time_; };
diff --git a/third_party/blink/renderer/modules/cookie_store/cookie_store.cc b/third_party/blink/renderer/modules/cookie_store/cookie_store.cc index f78cdf9..3be8761 100644 --- a/third_party/blink/renderer/modules/cookie_store/cookie_store.cc +++ b/third_party/blink/renderer/modules/cookie_store/cookie_store.cc
@@ -227,6 +227,20 @@ return scope->Url(); } +scoped_refptr<SecurityOrigin> DefaultTopFrameOrigin( + ExecutionContext* execution_context) { + DCHECK(execution_context); + + if (auto* document = DynamicTo<Document>(execution_context)) { + // Can we avoid the copy? TopFrameOrigin is returned as const& but we need + // a scoped_refptr. + return document->TopFrameOrigin()->IsolatedCopy(); + } + + auto* scope = To<ServiceWorkerGlobalScope>(execution_context); + return scope->GetSecurityOrigin()->IsolatedCopy(); +} + } // namespace CookieStore::~CookieStore() = default; @@ -449,7 +463,8 @@ subscription_backend_(std::move(subscription_backend)), change_listener_binding_(this), default_cookie_url_(DefaultCookieURL(execution_context)), - default_site_for_cookies_(DefaultSiteForCookies(execution_context)) { + default_site_for_cookies_(DefaultSiteForCookies(execution_context)), + default_top_frame_origin_(DefaultTopFrameOrigin(execution_context)) { DCHECK(backend_); } @@ -473,7 +488,7 @@ auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); backend_->GetAllForUrl( - default_cookie_url_, default_site_for_cookies_, + default_cookie_url_, default_site_for_cookies_, default_top_frame_origin_, std::move(backend_options), WTF::Bind(backend_result_converter, WrapPersistent(resolver))); return resolver->Promise(); @@ -535,7 +550,7 @@ auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); backend_->SetCanonicalCookie( std::move(canonical_cookie.value()), default_cookie_url_, - default_site_for_cookies_, + default_site_for_cookies_, default_top_frame_origin_, WTF::Bind(&CookieStore::OnSetCanonicalCookieResult, WrapPersistent(resolver))); return resolver->Promise(); @@ -612,6 +627,7 @@ change_listener_binding_.Bind( mojo::MakeRequest(&change_listener, task_runner), task_runner); backend_->AddChangeListener(default_cookie_url_, default_site_for_cookies_, + default_top_frame_origin_, std::move(change_listener), {}); }
diff --git a/third_party/blink/renderer/modules/cookie_store/cookie_store.h b/third_party/blink/renderer/modules/cookie_store/cookie_store.h index a7b8277..7d468b4c 100644 --- a/third_party/blink/renderer/modules/cookie_store/cookie_store.h +++ b/third_party/blink/renderer/modules/cookie_store/cookie_store.h
@@ -171,6 +171,9 @@ // The RFC 6265bis "site for cookies" for this store's ExecutionContext. const KURL default_site_for_cookies_; + + // The context in which cookies are accessed. + const scoped_refptr<SecurityOrigin> default_top_frame_origin_; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc b/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc index dd0d6b2f..aaca436 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc
@@ -11,6 +11,7 @@ #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/core/css/css_syntax_definition.h" +#include "third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/layout/layout_object.h"
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.cc b/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.cc index 3f60ae7..1c1e9e04 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.cc
@@ -36,7 +36,8 @@ struct MediaStreamDeviceObserver::Stream { Stream() {} ~Stream() {} - base::WeakPtr<UserMediaProcessor> handler; + WebMediaStreamDeviceObserver::OnDeviceStoppedCb on_device_stopped_cb; + WebMediaStreamDeviceObserver::OnDeviceChangedCb on_device_changed_cb; MediaStreamDevices audio_devices; MediaStreamDevices video_devices; }; @@ -84,8 +85,8 @@ else RemoveStreamDeviceFromArray(device, &stream->video_devices); - if (stream->handler.get()) - stream->handler->OnDeviceStopped(device); + if (stream->on_device_stopped_cb) + stream->on_device_stopped_cb.Run(device); // |it| could have already been invalidated in the function call above. So we // need to check if |label| is still in |label_stream_map_| again. @@ -116,8 +117,8 @@ } Stream* stream = &it->value; - if (stream->handler.get()) - stream->handler->OnDeviceChanged(old_device, new_device); + if (stream->on_device_changed_cb) + stream->on_device_changed_cb.Run(old_device, new_device); // Update device list only for device changing. Removing device will be // handled in its own callback. @@ -140,13 +141,15 @@ void MediaStreamDeviceObserver::AddStream( const String& label, - const MediaStreamDevices& audio_devices, - const MediaStreamDevices& video_devices, - const base::WeakPtr<UserMediaProcessor>& event_handler) { + const blink::MediaStreamDevices& audio_devices, + const blink::MediaStreamDevices& video_devices, + WebMediaStreamDeviceObserver::OnDeviceStoppedCb on_device_stopped_cb, + WebMediaStreamDeviceObserver::OnDeviceChangedCb on_device_changed_cb) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); Stream stream; - stream.handler = event_handler; + stream.on_device_stopped_cb = std::move(on_device_stopped_cb); + stream.on_device_changed_cb = std::move(on_device_changed_cb); stream.audio_devices = audio_devices; stream.video_devices = video_devices;
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.h b/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.h index f56493f5..f66dd1b 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.h +++ b/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.h
@@ -18,6 +18,7 @@ #include "mojo/public/cpp/bindings/binding.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" #include "third_party/blink/public/mojom/mediastream/media_stream.mojom-blink.h" +#include "third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h" #include "third_party/blink/renderer/modules/modules_export.h" namespace blink { @@ -38,10 +39,12 @@ // being shown to the user. blink::MediaStreamDevices GetNonScreenCaptureDevices(); - void AddStream(const String& label, - const blink::MediaStreamDevices& audio_devices, - const blink::MediaStreamDevices& video_devices, - const base::WeakPtr<blink::UserMediaProcessor>& event_handler); + void AddStream( + const String& label, + const blink::MediaStreamDevices& audio_devices, + const blink::MediaStreamDevices& video_devices, + WebMediaStreamDeviceObserver::OnDeviceStoppedCb on_device_stopped_cb, + WebMediaStreamDeviceObserver::OnDeviceChangedCb on_device_changed_cb); void AddStream(const String& label, const blink::MediaStreamDevice& device); bool RemoveStream(const String& label); void RemoveStreamDevice(const blink::MediaStreamDevice& device);
diff --git a/third_party/blink/renderer/modules/mediastream/user_media_processor.cc b/third_party/blink/renderer/modules/mediastream/user_media_processor.cc index ec41b64..8a85b71 100644 --- a/third_party/blink/renderer/modules/mediastream/user_media_processor.cc +++ b/third_party/blink/renderer/modules/mediastream/user_media_processor.cc
@@ -1218,7 +1218,10 @@ blink::WebString(label), ToStdVector(current_request_info_->audio_devices()), ToStdVector(current_request_info_->video_devices()), - weak_factory_.GetWeakPtr()); + WTF::BindRepeating(&UserMediaProcessor::OnDeviceStopped, + weak_factory_.GetWeakPtr()), + WTF::BindRepeating(&UserMediaProcessor::OnDeviceChanged, + weak_factory_.GetWeakPtr())); Vector<blink::WebMediaStreamTrack> audio_tracks( current_request_info_->audio_devices().size());
diff --git a/third_party/blink/renderer/modules/mediastream/web_media_stream_device_observer.cc b/third_party/blink/renderer/modules/mediastream/web_media_stream_device_observer.cc index 63ff9e0..27ba74b 100644 --- a/third_party/blink/renderer/modules/mediastream/web_media_stream_device_observer.cc +++ b/third_party/blink/renderer/modules/mediastream/web_media_stream_device_observer.cc
@@ -21,8 +21,11 @@ const WebString& label, const MediaStreamDevices& audio_devices, const MediaStreamDevices& video_devices, - const base::WeakPtr<UserMediaProcessor>& event_handler) { - observer_->AddStream(label, audio_devices, video_devices, event_handler); + OnDeviceStoppedCb on_device_stopped_cb, + OnDeviceChangedCb on_device_changed_cb) { + observer_->AddStream(label, audio_devices, video_devices, + std::move(on_device_stopped_cb), + std::move(on_device_changed_cb)); } void WebMediaStreamDeviceObserver::AddStream(const WebString& label,
diff --git a/third_party/blink/renderer/modules/modules_idl_files.gni b/third_party/blink/renderer/modules/modules_idl_files.gni index b39250cc..b9e2676f 100644 --- a/third_party/blink/renderer/modules/modules_idl_files.gni +++ b/third_party/blink/renderer/modules/modules_idl_files.gni
@@ -470,6 +470,8 @@ "webgpu/gpu_out_of_memory_error.idl", "webgpu/gpu_pipeline_layout.idl", "webgpu/gpu_queue.idl", + "webgpu/gpu_render_bundle.idl", + "webgpu/gpu_render_bundle_encoder.idl", "webgpu/gpu_render_pass_encoder.idl", "webgpu/gpu_render_pipeline.idl", "webgpu/gpu_sampler.idl", @@ -840,6 +842,8 @@ "webgpu/gpu_pipeline_layout_descriptor.idl", "webgpu/gpu_pipeline_stage_descriptor.idl", "webgpu/gpu_rasterization_state_descriptor.idl", + "webgpu/gpu_render_bundle_descriptor.idl", + "webgpu/gpu_render_bundle_encoder_descriptor.idl", "webgpu/gpu_render_pass_color_attachment_descriptor.idl", "webgpu/gpu_render_pass_depth_stencil_attachment_descriptor.idl", "webgpu/gpu_render_pass_descriptor.idl",
diff --git a/third_party/blink/renderer/modules/webgpu/BUILD.gn b/third_party/blink/renderer/modules/webgpu/BUILD.gn index 989331c0..0837d1e3 100644 --- a/third_party/blink/renderer/modules/webgpu/BUILD.gn +++ b/third_party/blink/renderer/modules/webgpu/BUILD.gn
@@ -43,6 +43,10 @@ "gpu_pipeline_layout.h", "gpu_queue.cc", "gpu_queue.h", + "gpu_render_bundle.cc", + "gpu_render_bundle.h", + "gpu_render_bundle_encoder.cc", + "gpu_render_bundle_encoder.h", "gpu_render_pass_encoder.cc", "gpu_render_pass_encoder.h", "gpu_render_pipeline.cc",
diff --git a/third_party/blink/renderer/modules/webgpu/dawn_conversions.h b/third_party/blink/renderer/modules/webgpu/dawn_conversions.h index 816c18d..b86fa80 100644 --- a/third_party/blink/renderer/modules/webgpu/dawn_conversions.h +++ b/third_party/blink/renderer/modules/webgpu/dawn_conversions.h
@@ -72,6 +72,18 @@ return dawn_objects; } +template <typename DawnEnum, typename WebGPUEnum> +std::unique_ptr<DawnEnum[]> AsDawnEnum(const Vector<WebGPUEnum>& webgpu_enums) { + wtf_size_t count = webgpu_enums.size(); + // TODO(enga): Pass in temporary memory or an allocator so we don't make a + // separate memory allocation here. + std::unique_ptr<DawnEnum[]> dawn_enums(new DawnEnum[count]); + for (wtf_size_t i = 0; i < count; ++i) { + dawn_enums[i] = AsDawnEnum<DawnEnum>(webgpu_enums[i]); + } + return dawn_enums; +} + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_DAWN_CONVERSIONS_H_
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_device.cc b/third_party/blink/renderer/modules/webgpu/gpu_device.cc index e7d7f420..9ddcd48 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_device.cc +++ b/third_party/blink/renderer/modules/webgpu/gpu_device.cc
@@ -18,6 +18,7 @@ #include "third_party/blink/renderer/modules/webgpu/gpu_device_descriptor.h" #include "third_party/blink/renderer/modules/webgpu/gpu_pipeline_layout.h" #include "third_party/blink/renderer/modules/webgpu/gpu_queue.h" +#include "third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.h" #include "third_party/blink/renderer/modules/webgpu/gpu_render_pipeline.h" #include "third_party/blink/renderer/modules/webgpu/gpu_sampler.h" #include "third_party/blink/renderer/modules/webgpu/gpu_shader_module.h" @@ -178,6 +179,11 @@ return GPUCommandEncoder::Create(this, descriptor); } +GPURenderBundleEncoder* GPUDevice::createRenderBundleEncoder( + const GPURenderBundleEncoderDescriptor* descriptor) { + return GPURenderBundleEncoder::Create(this, descriptor); +} + GPUQueue* GPUDevice::getQueue() { return queue_; }
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_device.h b/third_party/blink/renderer/modules/webgpu/gpu_device.h index e0026831..7e6d2959 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_device.h +++ b/third_party/blink/renderer/modules/webgpu/gpu_device.h
@@ -29,6 +29,8 @@ class GPUPipelineLayout; class GPUPipelineLayoutDescriptor; class GPUQueue; +class GPURenderBundleEncoder; +class GPURenderBundleEncoderDescriptor; class GPURenderPipeline; class GPURenderPipelineDescriptor; class GPUSampler; @@ -86,6 +88,8 @@ GPUCommandEncoder* createCommandEncoder( const GPUCommandEncoderDescriptor* descriptor); + GPURenderBundleEncoder* createRenderBundleEncoder( + const GPURenderBundleEncoderDescriptor* descriptor); GPUQueue* getQueue();
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_device.idl b/third_party/blink/renderer/modules/webgpu/gpu_device.idl index 0fd79820..50ead88 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_device.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_device.idl
@@ -24,7 +24,7 @@ GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor); GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor); - + GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor); GPUQueue getQueue(); };
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_bundle.cc b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle.cc new file mode 100644 index 0000000..bc13ebd --- /dev/null +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle.cc
@@ -0,0 +1,28 @@ +// Copyright 2019 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 "third_party/blink/renderer/modules/webgpu/gpu_render_bundle.h" + +#include "third_party/blink/renderer/modules/webgpu/gpu_device.h" + +namespace blink { + +// static +GPURenderBundle* GPURenderBundle::Create(GPUDevice* device, + DawnRenderBundle render_bundle) { + return MakeGarbageCollected<GPURenderBundle>(device, render_bundle); +} + +GPURenderBundle::GPURenderBundle(GPUDevice* device, + DawnRenderBundle render_bundle) + : DawnObject<DawnRenderBundle>(device, render_bundle) {} + +GPURenderBundle::~GPURenderBundle() { + if (IsDawnControlClientDestroyed()) { + return; + } + GetProcs().renderBundleRelease(GetHandle()); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_bundle.h b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle.h new file mode 100644 index 0000000..b754e174 --- /dev/null +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle.h
@@ -0,0 +1,28 @@ +// Copyright 2019 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 THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_RENDER_BUNDLE_H_ +#define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_RENDER_BUNDLE_H_ + +#include "third_party/blink/renderer/modules/webgpu/dawn_object.h" + +namespace blink { + +class GPUDevice; + +class GPURenderBundle : public DawnObject<DawnRenderBundle> { + DEFINE_WRAPPERTYPEINFO(); + + public: + static GPURenderBundle* Create(GPUDevice* device, + DawnRenderBundle render_bundle); + explicit GPURenderBundle(GPUDevice* device, DawnRenderBundle render_bundle); + ~GPURenderBundle() override; + + DISALLOW_COPY_AND_ASSIGN(GPURenderBundle); +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_RENDER_BUNDLE_H_
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_bundle.idl b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle.idl new file mode 100644 index 0000000..6e093774 --- /dev/null +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle.idl
@@ -0,0 +1,10 @@ +// Copyright 2019 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. + +// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl + +[ + RuntimeEnabled=WebGPU +] interface GPURenderBundle { +};
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_descriptor.idl b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_descriptor.idl new file mode 100644 index 0000000..fb5c71eb --- /dev/null +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_descriptor.idl
@@ -0,0 +1,8 @@ +// Copyright 2019 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. + +// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl + +dictionary GPURenderBundleDescriptor { +};
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.cc b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.cc new file mode 100644 index 0000000..1bc0bb8 --- /dev/null +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.cc
@@ -0,0 +1,152 @@ +// Copyright 2019 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 "third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.h" + +#include "third_party/blink/renderer/modules/webgpu/dawn_conversions.h" +#include "third_party/blink/renderer/modules/webgpu/gpu_bind_group.h" +#include "third_party/blink/renderer/modules/webgpu/gpu_buffer.h" +#include "third_party/blink/renderer/modules/webgpu/gpu_color.h" +#include "third_party/blink/renderer/modules/webgpu/gpu_device.h" +#include "third_party/blink/renderer/modules/webgpu/gpu_render_bundle.h" +#include "third_party/blink/renderer/modules/webgpu/gpu_render_bundle_descriptor.h" +#include "third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder_descriptor.h" +#include "third_party/blink/renderer/modules/webgpu/gpu_render_pipeline.h" + +namespace blink { + +// static +GPURenderBundleEncoder* GPURenderBundleEncoder::Create( + GPUDevice* device, + const GPURenderBundleEncoderDescriptor* webgpu_desc) { + uint32_t color_formats_count = + static_cast<uint32_t>(webgpu_desc->colorFormats().size()); + + std::unique_ptr<DawnTextureFormat[]> color_formats = + AsDawnEnum<DawnTextureFormat>(webgpu_desc->colorFormats()); + + DawnTextureFormat depth_stencil_format = {}; + const DawnTextureFormat* depth_stencil_format_ptr = nullptr; + if (webgpu_desc->hasDepthStencilFormat()) { + depth_stencil_format = + AsDawnEnum<DawnTextureFormat>(webgpu_desc->depthStencilFormat()); + depth_stencil_format_ptr = &depth_stencil_format; + } + + DawnRenderBundleEncoderDescriptor dawn_desc = {}; + dawn_desc.nextInChain = nullptr; + dawn_desc.colorFormatsCount = color_formats_count; + dawn_desc.colorFormats = color_formats.get(); + dawn_desc.depthStencilFormat = depth_stencil_format_ptr; + dawn_desc.sampleCount = webgpu_desc->sampleCount(); + + return MakeGarbageCollected<GPURenderBundleEncoder>( + device, device->GetProcs().deviceCreateRenderBundleEncoder( + device->GetHandle(), &dawn_desc)); +} + +GPURenderBundleEncoder::GPURenderBundleEncoder( + GPUDevice* device, + DawnRenderBundleEncoder render_bundle_encoder) + : DawnObject<DawnRenderBundleEncoder>(device, render_bundle_encoder) {} + +GPURenderBundleEncoder::~GPURenderBundleEncoder() { + if (IsDawnControlClientDestroyed()) { + return; + } + GetProcs().renderBundleEncoderRelease(GetHandle()); +} + +void GPURenderBundleEncoder::setBindGroup( + uint32_t index, + GPUBindGroup* bindGroup, + const Vector<uint64_t>& dynamicOffsets) { + GetProcs().renderBundleEncoderSetBindGroup( + GetHandle(), index, bindGroup->GetHandle(), dynamicOffsets.size(), + dynamicOffsets.data()); +} + +void GPURenderBundleEncoder::pushDebugGroup(String groupLabel) { + GetProcs().renderBundleEncoderPushDebugGroup(GetHandle(), + groupLabel.Utf8().data()); +} + +void GPURenderBundleEncoder::popDebugGroup() { + GetProcs().renderBundleEncoderPopDebugGroup(GetHandle()); +} + +void GPURenderBundleEncoder::insertDebugMarker(String markerLabel) { + GetProcs().renderBundleEncoderInsertDebugMarker(GetHandle(), + markerLabel.Utf8().data()); +} + +void GPURenderBundleEncoder::setPipeline(GPURenderPipeline* pipeline) { + GetProcs().renderBundleEncoderSetPipeline(GetHandle(), pipeline->GetHandle()); +} + +void GPURenderBundleEncoder::setIndexBuffer(GPUBuffer* buffer, + uint64_t offset) { + GetProcs().renderBundleEncoderSetIndexBuffer(GetHandle(), buffer->GetHandle(), + offset); +} + +void GPURenderBundleEncoder::setVertexBuffers( + uint32_t startSlot, + const HeapVector<Member<GPUBuffer>>& buffers, + const Vector<uint64_t>& offsets, + ExceptionState& exception_state) { + if (buffers.size() != offsets.size()) { + exception_state.ThrowRangeError( + "buffers array and offsets array must be the same length"); + return; + } + + std::unique_ptr<DawnBuffer[]> dawn_buffers = AsDawnType(buffers); + + GetProcs().renderBundleEncoderSetVertexBuffers( + GetHandle(), startSlot, buffers.size(), dawn_buffers.get(), + offsets.data()); +} + +void GPURenderBundleEncoder::draw(uint32_t vertexCount, + uint32_t instanceCount, + uint32_t firstVertex, + uint32_t firstInstance) { + GetProcs().renderBundleEncoderDraw(GetHandle(), vertexCount, instanceCount, + firstVertex, firstInstance); +} + +void GPURenderBundleEncoder::drawIndexed(uint32_t indexCount, + uint32_t instanceCount, + uint32_t firstIndex, + int32_t baseVertex, + uint32_t firstInstance) { + GetProcs().renderBundleEncoderDrawIndexed(GetHandle(), indexCount, + instanceCount, firstIndex, + baseVertex, firstInstance); +} + +void GPURenderBundleEncoder::drawIndirect(GPUBuffer* indirectBuffer, + uint64_t indirectOffset) { + GetProcs().renderBundleEncoderDrawIndirect( + GetHandle(), indirectBuffer->GetHandle(), indirectOffset); +} + +void GPURenderBundleEncoder::drawIndexedIndirect(GPUBuffer* indirectBuffer, + uint64_t indirectOffset) { + GetProcs().renderBundleEncoderDrawIndexedIndirect( + GetHandle(), indirectBuffer->GetHandle(), indirectOffset); +} + +GPURenderBundle* GPURenderBundleEncoder::finish( + const GPURenderBundleDescriptor* webgpu_desc) { + DawnRenderBundleDescriptor dawn_desc = {}; + dawn_desc.nextInChain = nullptr; + + DawnRenderBundle render_bundle = + GetProcs().renderBundleEncoderFinish(GetHandle(), &dawn_desc); + return GPURenderBundle::Create(device_, render_bundle); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.h b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.h new file mode 100644 index 0000000..39f8b79 --- /dev/null +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.h
@@ -0,0 +1,66 @@ +// Copyright 2019 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 THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_RENDER_BUNDLE_ENCODER_H_ +#define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_RENDER_BUNDLE_ENCODER_H_ + +#include "third_party/blink/renderer/modules/webgpu/dawn_object.h" +#include "third_party/blink/renderer/platform/bindings/exception_state.h" + +namespace blink { + +class GPUBindGroup; +class GPUBuffer; +class GPURenderBundle; +class GPURenderBundleDescriptor; +class GPURenderBundleEncoderDescriptor; +class GPURenderPipeline; + +class GPURenderBundleEncoder : public DawnObject<DawnRenderBundleEncoder> { + DEFINE_WRAPPERTYPEINFO(); + + public: + static GPURenderBundleEncoder* Create( + GPUDevice* device, + const GPURenderBundleEncoderDescriptor* webgpu_desc); + explicit GPURenderBundleEncoder( + GPUDevice* device, + DawnRenderBundleEncoder render_bundle_encoder); + ~GPURenderBundleEncoder() override; + + // gpu_render_bundle_encoder.idl + void setBindGroup(uint32_t index, + GPUBindGroup* bindGroup, + const Vector<uint64_t>& dynamicOffsets); + void pushDebugGroup(String groupLabel); + void popDebugGroup(); + void insertDebugMarker(String markerLabel); + void setPipeline(GPURenderPipeline* pipeline); + + void setIndexBuffer(GPUBuffer* buffer, uint64_t offset); + void setVertexBuffers(uint32_t startSlot, + const HeapVector<Member<GPUBuffer>>& buffers, + const Vector<uint64_t>& offsets, + ExceptionState& exception_state); + void draw(uint32_t vertexCount, + uint32_t instanceCount, + uint32_t firstVertex, + uint32_t firstInstance); + void drawIndexed(uint32_t indexCount, + uint32_t instanceCount, + uint32_t firstIndex, + int32_t baseVertex, + uint32_t firstInstance); + void drawIndirect(GPUBuffer* indirectBuffer, uint64_t indirectOffset); + void drawIndexedIndirect(GPUBuffer* indirectBuffer, uint64_t indirectOffset); + + GPURenderBundle* finish(const GPURenderBundleDescriptor* webgpu_desc); + + private: + DISALLOW_COPY_AND_ASSIGN(GPURenderBundleEncoder); +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_RENDER_BUNDLE_ENCODER_H_
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.idl b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.idl new file mode 100644 index 0000000..fbba5ee --- /dev/null +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.idl
@@ -0,0 +1,38 @@ +// Copyright 2019 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. + +// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl + +[ + RuntimeEnabled=WebGPU +] interface GPURenderBundleEncoder { + // GPUProgrammablePassEncoder methods + void setBindGroup(unsigned long index, + GPUBindGroup bindGroup, + optional sequence<unsigned long long> dynamicOffsets = []); + void pushDebugGroup(DOMString groupLabel); + void popDebugGroup(); + void insertDebugMarker(DOMString markerLabel); + + // GPURenderEncoderBase methods + void setPipeline(GPURenderPipeline pipeline); + void setIndexBuffer(GPUBuffer buffer, unsigned long long offset); + [RaisesException] void setVertexBuffers(unsigned long startSlot, + sequence<GPUBuffer> buffers, + sequence<unsigned long long> offsets); + void draw(unsigned long vertexCount, unsigned long instanceCount, + unsigned long firstVertex, + unsigned long firstInstance); + void drawIndexed(unsigned long indexCount, unsigned long instanceCount, + unsigned long firstIndex, + long baseVertex, + unsigned long firstInstance); + void drawIndirect(GPUBuffer indirectBuffer, + unsigned long long indirectOffset); + void drawIndexedIndirect(GPUBuffer indirectBuffer, + unsigned long long indirectOffset); + + // GPURenderBundleEncoder methods + GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor); +};
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder_descriptor.idl b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder_descriptor.idl new file mode 100644 index 0000000..6f2cb8a --- /dev/null +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder_descriptor.idl
@@ -0,0 +1,11 @@ +// Copyright 2019 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. + +// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl + +dictionary GPURenderBundleEncoderDescriptor { + required sequence<GPUTextureFormat> colorFormats; + GPUTextureFormat depthStencilFormat; + unsigned long sampleCount = 1; +};
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.cc b/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.cc index deaf3646..4378f95b 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.cc +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.cc
@@ -9,6 +9,7 @@ #include "third_party/blink/renderer/modules/webgpu/gpu_buffer.h" #include "third_party/blink/renderer/modules/webgpu/gpu_color.h" #include "third_party/blink/renderer/modules/webgpu/gpu_device.h" +#include "third_party/blink/renderer/modules/webgpu/gpu_render_bundle.h" #include "third_party/blink/renderer/modules/webgpu/gpu_render_pipeline.h" namespace blink { @@ -139,6 +140,14 @@ GetHandle(), indirectBuffer->GetHandle(), indirectOffset); } +void GPURenderPassEncoder::executeBundles( + const HeapVector<Member<GPURenderBundle>>& bundles) { + std::unique_ptr<DawnRenderBundle[]> dawn_bundles = AsDawnType(bundles); + + GetProcs().renderPassEncoderExecuteBundles(GetHandle(), bundles.size(), + dawn_bundles.get()); +} + void GPURenderPassEncoder::endPass() { GetProcs().renderPassEncoderEndPass(GetHandle()); }
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.h b/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.h index af3389e..f270ea8d 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.h +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.h
@@ -13,6 +13,7 @@ class GPUBindGroup; class GPUBuffer; class GPUColor; +class GPURenderBundle; class GPURenderPipeline; class GPURenderPassEncoder : public DawnObject<DawnRenderPassEncoder> { @@ -60,7 +61,7 @@ uint32_t firstInstance); void drawIndirect(GPUBuffer* indirectBuffer, uint64_t indirectOffset); void drawIndexedIndirect(GPUBuffer* indirectBuffer, uint64_t indirectOffset); - + void executeBundles(const HeapVector<Member<GPURenderBundle>>& bundles); void endPass(); private:
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.idl b/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.idl index 20deb2c..7ee5b463 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.idl
@@ -40,5 +40,6 @@ void drawIndexedIndirect(GPUBuffer indirectBuffer, unsigned long long indirectOffset); + void executeBundles(sequence<GPURenderBundle> bundles); void endPass(); };
diff --git a/third_party/blink/renderer/platform/bindings/parkable_string_test.cc b/third_party/blink/renderer/platform/bindings/parkable_string_test.cc index b07f73b..c5b6f069 100644 --- a/third_party/blink/renderer/platform/bindings/parkable_string_test.cc +++ b/third_party/blink/renderer/platform/bindings/parkable_string_test.cc
@@ -21,7 +21,7 @@ #include "third_party/blink/renderer/platform/instrumentation/memory_pressure_listener.h" using ThreadPoolExecutionMode = - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode; + base::test::TaskEnvironment::ThreadPoolExecutionMode; namespace blink { @@ -44,12 +44,11 @@ ParkableStringTest(ThreadPoolExecutionMode thread_pool_execution_mode = ThreadPoolExecutionMode::DEFAULT) : ::testing::Test(), - scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - thread_pool_execution_mode) {} + task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME, + thread_pool_execution_mode) {} protected: - void RunPostedTasks() { scoped_task_environment_.RunUntilIdle(); } + void RunPostedTasks() { task_environment_.RunUntilIdle(); } bool ParkAndWait(const ParkableString& string) { bool success = @@ -59,8 +58,8 @@ } void WaitForAging() { - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); - scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds( + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds( ParkableStringManager::kAgingIntervalInSeconds)); } @@ -76,7 +75,7 @@ expected_count = 1; } EXPECT_EQ(expected_count, - scoped_task_environment_.GetPendingMainThreadTaskCount()); + task_environment_.GetPendingMainThreadTaskCount()); } void SetUp() override { ParkableStringManager::Instance().ResetForTesting(); } @@ -85,7 +84,7 @@ // No leaks. CHECK_EQ(0u, ParkableStringManager::Instance().Size()); // Delayed tasks may remain, clear the queues. - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } @@ -101,7 +100,7 @@ return parkable; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // The main aim of this test is to check that the compressed size of a string @@ -526,7 +525,7 @@ ParkableString parkable(MakeLargeString().ReleaseImpl()); EXPECT_TRUE(parkable.Impl()->Park(ParkableStringImpl::ParkingMode::kAlways)); // A main thread task is posted once compression is done. - while (scoped_task_environment_.GetPendingMainThreadTaskCount() == 0) { + while (task_environment_.GetPendingMainThreadTaskCount() == 0) { parkable.Lock(); parkable.ToString(); parkable.Unlock(); @@ -575,7 +574,7 @@ // No waiting, synchronous compression. manager.ParkAll(ParkableStringImpl::ParkingMode::kIfCompressedDataExists); EXPECT_TRUE(parkable.Impl()->is_parked()); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } TEST_F(ParkableStringTest, OnPurgeMemoryInBackground) { @@ -729,9 +728,9 @@ TEST_F(ParkableStringTest, AgingTicksStopsAndRestarts) { ParkableString parkable(MakeLargeString().ReleaseImpl()); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); WaitForAging(); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); WaitForAging(); // Nothing more to do, the tick is not re-scheduled. WaitForAging(); @@ -739,7 +738,7 @@ // Unparking, the tick restarts. parkable.ToString(); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); WaitForAging(); WaitForAging(); // And stops again. 2 ticks to park the string (age, then park), and one @@ -758,18 +757,18 @@ ParkableString parkable(MakeLargeString('a').ReleaseImpl()); String retained = parkable.ToString(); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); WaitForAging(); // The only string is referenced externally, nothing aging can change. CheckOnlyCpuCostTaskRemains(); ParkableString parkable2(MakeLargeString('b').ReleaseImpl()); WaitForAging(); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); WaitForAging(); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); EXPECT_TRUE(parkable2.Impl()->is_parked()); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); WaitForAging(); // Once |parkable2| has been parked, back to the case where the only // remaining strings are referenced externally. @@ -790,9 +789,9 @@ parkable1.ToString(); parkable2.ToString(); - EXPECT_GT(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u); + EXPECT_GT(task_environment_.GetPendingMainThreadTaskCount(), 0u); // Aging task + stats. - EXPECT_EQ(2u, scoped_task_environment_.GetPendingMainThreadTaskCount()); + EXPECT_EQ(2u, task_environment_.GetPendingMainThreadTaskCount()); } TEST_F(ParkableStringTest, ReportTotalUnparkingTime) { @@ -823,7 +822,7 @@ } const size_t compressed_size = parkable.Impl()->compressed_size(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); // The string is unparked kNumIterations times. histogram_tester.ExpectUniqueSample( @@ -878,7 +877,7 @@ run_loop.Run(); // The aging task is rescheduled. - EXPECT_EQ(2u, scoped_task_environment_.GetPendingMainThreadTaskCount()); + EXPECT_EQ(2u, task_environment_.GetPendingMainThreadTaskCount()); // Complete asynchronous work. RunPostedTasks();
diff --git a/third_party/blink/renderer/platform/blob/blob_bytes_provider_test.cc b/third_party/blink/renderer/platform/blob/blob_bytes_provider_test.cc index f0ad17e8..2216a220 100644 --- a/third_party/blink/renderer/platform/blob/blob_bytes_provider_test.cc +++ b/third_party/blink/renderer/platform/blob/blob_bytes_provider_test.cc
@@ -46,7 +46,7 @@ } void TearDown() override { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Platform::UnsetMainThreadTaskRunnerForTesting(); } @@ -60,7 +60,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<RawData> test_data1_; Vector<uint8_t> test_bytes1_;
diff --git a/third_party/blink/renderer/platform/blob/blob_data_test.cc b/third_party/blink/renderer/platform/blob/blob_data_test.cc index 4d88214..39e9768 100644 --- a/third_party/blink/renderer/platform/blob/blob_data_test.cc +++ b/third_party/blink/renderer/platform/blob/blob_data_test.cc
@@ -131,7 +131,7 @@ } void TearDown() override { - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); Platform::UnsetMainThreadTaskRunnerForTesting(); } @@ -220,7 +220,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FakeBlobRegistry mock_blob_registry_; BlobRegistryPtr blob_registry_ptr_; mojo::Binding<BlobRegistry> blob_registry_binding_;
diff --git a/third_party/blink/renderer/platform/exported/mediastream/media_stream_audio_test.cc b/third_party/blink/renderer/platform/exported/mediastream/media_stream_audio_test.cc index 7cb47ded..fdbffbf9 100644 --- a/third_party/blink/renderer/platform/exported/mediastream/media_stream_audio_test.cc +++ b/third_party/blink/renderer/platform/exported/mediastream/media_stream_audio_test.cc
@@ -264,7 +264,7 @@ WebMediaStreamSource blink_audio_source_; WebMediaStreamTrack blink_audio_track_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; // Tests that a simple source-->track-->sink connection and audio data flow
diff --git a/third_party/blink/renderer/platform/exported/video_capture/web_video_capture_impl_manager_test.cc b/third_party/blink/renderer/platform/exported/video_capture/web_video_capture_impl_manager_test.cc index 0bfbce3..9ecf6dd1 100644 --- a/third_party/blink/renderer/platform/exported/video_capture/web_video_capture_impl_manager_test.cc +++ b/third_party/blink/renderer/platform/exported/video_capture/web_video_capture_impl_manager_test.cc
@@ -221,7 +221,7 @@ base::Unretained(this))); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ScopedTestingPlatformSupport<IOTaskRunnerTestingPlatformSupport> platform_; base::RunLoop cleanup_run_loop_; std::unique_ptr<MockVideoCaptureImplManager> manager_;
diff --git a/third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper_test.cc b/third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper_test.cc index 2f1f95b8..0f64b9c 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper_test.cc +++ b/third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper_test.cc
@@ -28,7 +28,7 @@ cache = std::make_unique<ShapeCache>(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FontCachePurgePreventer font_cache_purge_preventer; FontDescription font_description; Font font;
diff --git a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper_test.cc b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper_test.cc index b5770d0..03623b5 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper_test.cc +++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper_test.cc
@@ -130,7 +130,7 @@ return result; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; FontCachePurgePreventer font_cache_purge_preventer; FontDescription font_description; Font font;
diff --git a/third_party/blink/renderer/platform/fonts/win/font_cache_skia_win.cc b/third_party/blink/renderer/platform/fonts/win/font_cache_skia_win.cc index 84f739d2..cabb176c 100644 --- a/third_party/blink/renderer/platform/fonts/win/font_cache_skia_win.cc +++ b/third_party/blink/renderer/platform/fonts/win/font_cache_skia_win.cc
@@ -31,6 +31,10 @@ #include "third_party/blink/renderer/platform/fonts/font_cache.h" +#include <ft2build.h> +#include <freetype/freetype.h> +#include <unicode/uscript.h> + #include <memory> #include <utility> @@ -52,8 +56,6 @@ #include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/ports/SkTypeface_win.h" -#include <ft2build.h> -#include <freetype/freetype.h> namespace blink { @@ -151,6 +153,40 @@ return return_typeface; } +static const char kColorEmojiLocale[] = "und-Zsye"; +static const char kChineseSimplified[] = "zh-Hant"; + +// For Windows out-of-process fallback calls, there is a limiation: only one +// passed locale is taken into account when requesting a fallback font from the +// DWrite API via Skia API. If we request fallback for a Han ideograph without a +// disambiguating locale, results from DWrite are unpredictable and caching such +// a font under the ambiguous locale leads to returning wrong fonts for +// subsequent requests in font_fallback_win, hence prioritize a +// Han-disambiguating locale for CJK characters. +const LayoutLocale* FallbackLocaleForCharacter( + const FontDescription& font_description, + const FontFallbackPriority& fallback_priority, + const UChar32 codepoint) { + if (fallback_priority == FontFallbackPriority::kEmojiEmoji) + return LayoutLocale::Get(kColorEmojiLocale); + + UErrorCode error_code = U_ZERO_ERROR; + const UScriptCode char_script = uscript_getScript(codepoint, &error_code); + if (U_SUCCESS(error_code) && char_script == USCRIPT_HAN) { + // If we were unable to disambiguate the requested Han ideograph from the + // content locale, the Accept-Language headers or system locale, assume it's + // simplified Chinese. It's important to pass a CJK locale to the fallback + // call in order to avoid priming the browser side cache incorrectly with an + // ambiguous locale for Han fallback requests. + const LayoutLocale* han_locale = + LayoutLocale::LocaleForHan(font_description.Locale()); + return han_locale ? han_locale : LayoutLocale::Get(kChineseSimplified); + } + + return font_description.Locale() ? font_description.Locale() + : &LayoutLocale::GetDefault(); +} + } // namespace // static @@ -275,6 +311,10 @@ const FontDescription& font_description, UChar32 codepoint, FontFallbackPriority fallback_priority) { + const LayoutLocale* fallback_locale = FallbackLocaleForCharacter( + font_description, fallback_priority, codepoint); + DCHECK(fallback_locale); + // On Pre Windows 8.1 (where use_skia_font_fallback_ is false) we cannot call // the Skia version, as there is no IDWriteFontFallback (which is // proxyable). If no IDWriteFontFallback API exists in the DWrite Skia @@ -289,15 +329,15 @@ // side, where we can do that. if (!use_skia_font_fallback_) { EnsureServiceConnected(); - Bcp47Vector bcp_tags = - GetBcp47LocaleForRequest(font_description, fallback_priority); - // TODO(drott): After Mojo IPC, on the browser side, this ultimately reaches + + // After Mojo IPC, on the browser side, this ultimately reaches // Skia's matchFamilyStyleCharacter for Windows, which does not implement // traversing the language tag stack but only processes the most important - // one, so we only pass the one with highest priority as a string here. + // one, so we use FallbackLocaleForCharacter() to determine what locale to + // choose to achieve the best possible result. AtomicString family(GetOutOfProcessFallbackFamily( codepoint, font_description.GenericFamily(), - bcp_tags[bcp_tags.size() - 1], fallback_priority, service_)); + fallback_locale->LocaleForSkFontMgr(), fallback_priority, service_)); if (family.IsEmpty()) return nullptr; @@ -310,8 +350,9 @@ return FontDataFromFontPlatformData(data, kDoNotRetain); } else { std::string family_name = font_description.Family().Family().Utf8(); - Bcp47Vector locales = - GetBcp47LocaleForRequest(font_description, fallback_priority); + + Bcp47Vector locales; + locales.push_back(fallback_locale->LocaleForSkFontMgr()); SkTypeface* typeface = font_manager_->matchFamilyStyleCharacter( family_name.c_str(), font_description.SkiaFontStyle(), locales.data(), locales.size(), codepoint);
diff --git a/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image_test.cc b/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image_test.cc index 42f4fab..26739466 100644 --- a/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image_test.cc +++ b/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image_test.cc
@@ -57,7 +57,7 @@ void TearDown() override { SharedGpuContext::ResetForTesting(); } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; MockGLES2InterfaceWithSyncTokenSupport gl_; };
diff --git a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc index 8d28592b..9b389a6 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc
@@ -4036,10 +4036,10 @@ cc::TransformNode* cc_transform_node = transform_tree.FindNodeFromElementId( transform_state.compositor_element_id); EXPECT_TRUE(cc_transform_node); - EXPECT_EQ(TransformationMatrix::ToTransform(matrix), - cc_transform_node->post_local); - EXPECT_TRUE(cc_transform_node->local.IsIdentity()); EXPECT_TRUE(cc_transform_node->pre_local.IsIdentity()); + EXPECT_EQ(TransformationMatrix::ToTransform(matrix), + cc_transform_node->local); + EXPECT_TRUE(cc_transform_node->post_local.IsIdentity()); } // Test that |cc::TransformNode::in_subtree_of_page_scale_layer| is not set on
diff --git a/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer_test.cc b/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer_test.cc index e7aaa29..e1b0ea13 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer_test.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer_test.cc
@@ -586,8 +586,8 @@ cc::DisplayItemList::kTopLevelDisplayItemList); PaintChunksToCcLayer::ConvertInto( chunks.chunks, PropertyTreeState(*layer_transform, c0(), e0()), - gfx::Vector2dF(100, 200), FloatSize(), chunks.items, *cc_list); - EXPECT_EQ(gfx::Rect(-50, -100, 100, 100), cc_list->VisualRectForTesting(4)); + gfx::Vector2dF(10, 20), FloatSize(), chunks.items, *cc_list); + EXPECT_EQ(gfx::Rect(40, 80, 100, 100), cc_list->VisualRectForTesting(4)); EXPECT_THAT(*cc_list->ReleaseAsRecord(), PaintRecordMatcher::Make(
diff --git a/third_party/blink/renderer/platform/graphics/compositing/property_tree_manager.cc b/third_party/blink/renderer/platform/graphics/compositing/property_tree_manager.cc index 19638b3..9e8eaa7 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/property_tree_manager.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/property_tree_manager.cc
@@ -109,27 +109,11 @@ compositor_node.needs_local_transform_update = true; } -static void AdjustPageScaleToUsePostLocal(cc::TransformNode& page_scale) { - // The page scale node is special because its transform matrix is assumed to - // be in the post_local matrix by the compositor. There should be no - // translation from the origin so we clear the other matrices. - DCHECK(page_scale.local.IsScale2d()); - DCHECK(page_scale.pre_local.IsIdentity()); - page_scale.post_local.matrix() = page_scale.local.matrix(); - page_scale.pre_local.matrix().setIdentity(); - page_scale.local.matrix().setIdentity(); -} - static void SetTransformTreePageScaleFactor( cc::TransformTree* transform_tree, cc::TransformNode* page_scale_node) { - // |AdjustPageScaleToUsePostLocal| should have been called already so that the - // scale component is in the post_local transform. - DCHECK(page_scale_node->local.IsIdentity()); - DCHECK(page_scale_node->pre_local.IsIdentity()); - - DCHECK(page_scale_node->post_local.IsScale2d()); - auto page_scale = page_scale_node->post_local.Scale2d(); + DCHECK(page_scale_node->local.IsScale2d()); + auto page_scale = page_scale_node->local.Scale2d(); DCHECK_EQ(page_scale.x(), page_scale.y()); transform_tree->set_page_scale_factor(page_scale.x()); } @@ -218,8 +202,6 @@ return false; UpdateCcTransformLocalMatrix(*cc_transform, transform); - AdjustPageScaleToUsePostLocal(*cc_transform); - SetTransformTreePageScaleFactor(&property_trees->transform_tree, cc_transform); cc_transform->transform_changed = true; @@ -503,8 +485,6 @@ int id = EnsureCompositorTransformNode(node); DCHECK(GetTransformTree().Node(id)); cc::TransformNode& compositor_node = *GetTransformTree().Node(id); - AdjustPageScaleToUsePostLocal(compositor_node); - SetTransformTreePageScaleFactor(&GetTransformTree(), &compositor_node); GetTransformTree().set_needs_update(true); return id;
diff --git a/third_party/blink/renderer/platform/graphics/graphics_context.cc b/third_party/blink/renderer/platform/graphics/graphics_context.cc index 78f12a67..f7fc0ef0 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_context.cc +++ b/third_party/blink/renderer/platform/graphics/graphics_context.cc
@@ -1092,9 +1092,16 @@ DrawRect(rect, ImmutableState()->FillFlags()); } +void GraphicsContext::FillRect(const IntRect& rect, + const Color& color, + DarkModeFilter::ElementRole role) { + FillRect(FloatRect(rect), color, SkBlendMode::kSrcOver, role); +} + void GraphicsContext::FillRect(const FloatRect& rect, const Color& color, - SkBlendMode xfer_mode) { + SkBlendMode xfer_mode, + DarkModeFilter::ElementRole role) { if (ContextDisabled()) return; @@ -1102,7 +1109,7 @@ flags.setColor(color.Rgb()); flags.setBlendMode(xfer_mode); - DrawRect(rect, flags); + DrawRect(rect, flags, role); } void GraphicsContext::FillRoundedRect(const FloatRoundedRect& rrect,
diff --git a/third_party/blink/renderer/platform/graphics/graphics_context.h b/third_party/blink/renderer/platform/graphics/graphics_context.h index bf271c5..76c9346 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_context.h +++ b/third_party/blink/renderer/platform/graphics/graphics_context.h
@@ -196,10 +196,15 @@ void FillRect(const IntRect&, const Color&, SkBlendMode = SkBlendMode::kSrcOver); + void FillRect(const IntRect& rect, + const Color& color, + DarkModeFilter::ElementRole role); void FillRect(const FloatRect&); - void FillRect(const FloatRect&, - const Color&, - SkBlendMode = SkBlendMode::kSrcOver); + void FillRect( + const FloatRect&, + const Color&, + SkBlendMode = SkBlendMode::kSrcOver, + DarkModeFilter::ElementRole = DarkModeFilter::ElementRole::kBackground); void FillRoundedRect(const FloatRoundedRect&, const Color&); void FillDRRect(const FloatRoundedRect&, const FloatRoundedRect&,
diff --git a/third_party/blink/renderer/platform/graphics/video_frame_submitter_test.cc b/third_party/blink/renderer/platform/graphics/video_frame_submitter_test.cc index cc6c0f4b..ef23d9d 100644 --- a/third_party/blink/renderer/platform/graphics/video_frame_submitter_test.cc +++ b/third_party/blink/renderer/platform/graphics/video_frame_submitter_test.cc
@@ -159,7 +159,7 @@ context_provider_(viz::TestContextProvider::Create()) { context_provider_->BindToCurrentThread(); MakeSubmitter(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } void MakeSubmitter() { @@ -218,7 +218,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::SimpleTestTickClock> now_src_; std::unique_ptr<viz::FakeExternalBeginFrameSource> begin_frame_source_; std::unique_ptr<StrictMock<VideoMockCompositorFrameSink>> sink_; @@ -264,7 +264,7 @@ submitter_->StartRendering(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(IsRendering()); } @@ -275,7 +275,7 @@ submitter_->StartRendering(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(IsRendering()); @@ -284,20 +284,20 @@ viz::BeginFrameArgs args = begin_frame_source_->CreateBeginFrameArgs( BEGINFRAME_FROM_HERE, now_src_.get()); submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // StopRendering submits one more frame. EXPECT_SUBMISSION(SubmissionType::kStateChange); EXPECT_CALL(*sink_, SetNeedsBeginFrame(false)); submitter_->StopRendering(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // No frames should be produced after StopRendering(). EXPECT_CALL(*sink_, DidNotProduceFrame(_)); begin_frame_source_->CreateBeginFrameArgs(BEGINFRAME_FROM_HERE, now_src_.get()); submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(VideoFrameSubmitterTest, StopUsingProviderNullsProvider) { @@ -313,7 +313,7 @@ StopUsingProviderSubmitsFrameAndStopsRendering) { EXPECT_CALL(*sink_, SetNeedsBeginFrame(true)); submitter_->StartRendering(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(IsRendering()); @@ -321,7 +321,7 @@ EXPECT_SUBMISSION(SubmissionType::kStateChange); submitter_->StopUsingProvider(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(IsRendering()); } @@ -330,13 +330,13 @@ EXPECT_CALL(*sink_, SetNeedsBeginFrame(true)); submitter_->StartRendering(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(IsRendering()); EXPECT_SUBMISSION(SubmissionType::kManual); submitter_->DidReceiveFrame(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(VideoFrameSubmitterTest, DidReceiveFrameSubmitsFrame) { @@ -344,31 +344,31 @@ EXPECT_SUBMISSION(SubmissionType::kManual); submitter_->DidReceiveFrame(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(VideoFrameSubmitterTest, ShouldSubmitPreventsSubmission) { EXPECT_CALL(*sink_, SetNeedsBeginFrame(false)); submitter_->SetIsSurfaceVisible(false); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(ShouldSubmit()); EXPECT_CALL(*sink_, SetNeedsBeginFrame(false)); submitter_->StartRendering(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_SUBMISSION(SubmissionType::kStateChange); EXPECT_CALL(*sink_, SetNeedsBeginFrame(true)); submitter_->SetIsSurfaceVisible(true); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(ShouldSubmit()); EXPECT_CALL(*sink_, SetNeedsBeginFrame(false)); EXPECT_CALL(*video_frame_provider_, GetCurrentFrame()).Times(0); submitter_->SetIsSurfaceVisible(false); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(ShouldSubmit()); EXPECT_GET_PUT_FRAME(); @@ -380,7 +380,7 @@ TEST_F(VideoFrameSubmitterTest, SetForceSubmitForcesSubmission) { EXPECT_CALL(*sink_, SetNeedsBeginFrame(false)); submitter_->SetIsSurfaceVisible(false); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(ShouldSubmit()); @@ -390,23 +390,23 @@ EXPECT_CALL(*sink_, SetNeedsBeginFrame(true)); submitter_->StartRendering(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_CALL(*sink_, SetNeedsBeginFrame(true)); EXPECT_SUBMISSION(SubmissionType::kStateChange); submitter_->SetIsSurfaceVisible(true); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(ShouldSubmit()); EXPECT_CALL(*sink_, SetNeedsBeginFrame(true)); EXPECT_SUBMISSION(SubmissionType::kStateChange); submitter_->SetIsSurfaceVisible(false); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_TRUE(ShouldSubmit()); EXPECT_SUBMISSION(SubmissionType::kManual); SubmitSingleFrame(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(VideoFrameSubmitterTest, RotationInformationPassedToResourceProvider) { @@ -427,7 +427,7 @@ EXPECT_CALL(*resource_provider_, ReleaseFrameResources()); submitter_->DidReceiveFrame(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); { WTF::Vector<viz::ReturnedResource> resources; @@ -441,7 +441,7 @@ EXPECT_CALL(*sink_, SetNeedsBeginFrame(true)); submitter_->StartRendering(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); { WTF::Vector<viz::ReturnedResource> resources; @@ -465,7 +465,7 @@ viz::BeginFrameArgs args = begin_frame_source_->CreateBeginFrameArgs( BEGINFRAME_FROM_HERE, now_src_.get()); submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); { WTF::Vector<viz::ReturnedResource> resources; @@ -490,20 +490,20 @@ EXPECT_CALL(*resource_provider_, ReleaseFrameResources()); submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(VideoFrameSubmitterTest, OnBeginFrameSubmitsFrame) { EXPECT_CALL(*sink_, SetNeedsBeginFrame(true)); submitter_->StartRendering(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_SUBMISSION(SubmissionType::kBeginFrame); viz::BeginFrameArgs args = begin_frame_source_->CreateBeginFrameArgs( BEGINFRAME_FROM_HERE, now_src_.get()); submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(VideoFrameSubmitterTest, MissedFrameArgDoesNotProduceFrame) { @@ -513,7 +513,7 @@ BEGINFRAME_FROM_HERE, now_src_.get()); args.type = viz::BeginFrameArgs::MISSED; submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(VideoFrameSubmitterTest, MissingProviderDoesNotProduceFrame) { @@ -524,7 +524,7 @@ viz::BeginFrameArgs args = begin_frame_source_->CreateBeginFrameArgs( BEGINFRAME_FROM_HERE, now_src_.get()); submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(VideoFrameSubmitterTest, NoUpdateOnFrameDoesNotProduceFrame) { @@ -538,7 +538,7 @@ viz::BeginFrameArgs args = begin_frame_source_->CreateBeginFrameArgs( BEGINFRAME_FROM_HERE, now_src_.get()); submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(VideoFrameSubmitterTest, NotRenderingDoesNotProduceFrame) { @@ -551,14 +551,14 @@ viz::BeginFrameArgs args = begin_frame_source_->CreateBeginFrameArgs( BEGINFRAME_FROM_HERE, now_src_.get()); submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(VideoFrameSubmitterTest, ReturnsResourceOnCompositorAck) { WTF::Vector<viz::ReturnedResource> resources; EXPECT_CALL(*resource_provider_, ReceiveReturnsFromParent(_)); submitter_->DidReceiveCompositorFrameAck(resources); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Tests that after submitting a frame, no frame will be submitted until an ACK @@ -567,13 +567,13 @@ EXPECT_CALL(*sink_, SetNeedsBeginFrame(true)); submitter_->StartRendering(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_SUBMISSION(SubmissionType::kBeginFrame); viz::BeginFrameArgs args = begin_frame_source_->CreateBeginFrameArgs( BEGINFRAME_FROM_HERE, now_src_.get()); submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // DidNotProduceFrame should be called because no frame will be submitted // given that the ACK is still pending. @@ -588,7 +588,7 @@ args = begin_frame_source_->CreateBeginFrameArgs(BEGINFRAME_FROM_HERE, new_time.get()); submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Test that after context is lost, the CompositorFrameSink is recreated but the @@ -608,7 +608,7 @@ .Times(1); submitter_->OnContextLost(); OnReceivedContextProvider(true, context_provider_); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // This test simulates a race condition in which the |video_frame_provider_| is @@ -617,19 +617,19 @@ EXPECT_CALL(*sink_, SetNeedsBeginFrame(true)); submitter_->StartRendering(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_SUBMISSION(SubmissionType::kStateChange); EXPECT_CALL(*sink_, SetNeedsBeginFrame(false)); submitter_->StopUsingProvider(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // OnReceivedContextProvider returns. We don't run the actual function // because it would overwrite our fake |sink_| with a real one. SubmitSingleFrame(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } // Test the behaviour of the ChildLocalSurfaceIdAllocator instance. It checks @@ -651,11 +651,11 @@ EXPECT_CALL(*sink_, SetNeedsBeginFrame(true)); submitter_->StartRendering(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_SUBMISSION(SubmissionType::kManual); SubmitSingleFrame(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); { viz::LocalSurfaceId local_surface_id = @@ -680,7 +680,7 @@ EXPECT_CALL(*resource_provider_, ReleaseFrameResources()); SubmitSingleFrame(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); { viz::LocalSurfaceId local_surface_id = @@ -724,7 +724,7 @@ viz::BeginFrameArgs args = begin_frame_source_->CreateBeginFrameArgs( BEGINFRAME_FROM_HERE, now_src_.get()); submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(sink_->last_submitted_compositor_frame().size_in_pixels(), rotated_size); @@ -755,7 +755,7 @@ viz::BeginFrameArgs args = begin_frame_source_->CreateBeginFrameArgs( BEGINFRAME_FROM_HERE, now_src_.get()); submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // 180 deg rotation has same size. EXPECT_EQ(sink_->last_submitted_compositor_frame().size_in_pixels(), @@ -785,7 +785,7 @@ viz::BeginFrameArgs args = begin_frame_source_->CreateBeginFrameArgs( BEGINFRAME_FROM_HERE, now_src_.get()); submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(sink_->last_submitted_compositor_frame().size_in_pixels(), rotated_size); @@ -800,26 +800,26 @@ // Hide the page and ensure no begin frames are issued. EXPECT_CALL(*sink_, SetNeedsBeginFrame(false)); submitter_->SetIsPageVisible(false); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(ShouldSubmit()); // Start rendering, but since page is hidden nothing should start yet. EXPECT_CALL(*sink_, SetNeedsBeginFrame(false)); submitter_->StartRendering(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Mark the page as visible and confirm frame submission. EXPECT_CALL(*sink_, SetNeedsBeginFrame(true)); EXPECT_SUBMISSION(SubmissionType::kStateChange); submitter_->SetIsPageVisible(true); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Transition back to the page being hidden and ensure begin frames stop. EXPECT_TRUE(ShouldSubmit()); EXPECT_CALL(*sink_, SetNeedsBeginFrame(false)); EXPECT_CALL(*video_frame_provider_, GetCurrentFrame()).Times(0); submitter_->SetIsPageVisible(false); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); } TEST_F(VideoFrameSubmitterTest, PreferredInterval) { @@ -828,13 +828,13 @@ EXPECT_CALL(*sink_, SetNeedsBeginFrame(true)); submitter_->StartRendering(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_SUBMISSION(SubmissionType::kBeginFrame); viz::BeginFrameArgs args = begin_frame_source_->CreateBeginFrameArgs( BEGINFRAME_FROM_HERE, now_src_.get()); submitter_->OnBeginFrame(args, {}); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(sink_->last_submitted_compositor_frame() .metadata.preferred_frame_interval,
diff --git a/third_party/blink/renderer/platform/heap/heap_test_utilities.h b/third_party/blink/renderer/platform/heap/heap_test_utilities.h index deee600..dd6da9e9 100644 --- a/third_party/blink/renderer/platform/heap/heap_test_utilities.h +++ b/third_party/blink/renderer/platform/heap/heap_test_utilities.h
@@ -38,7 +38,7 @@ void CompleteSweepingIfNeeded(); protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; template <typename T>
diff --git a/third_party/blink/renderer/platform/loader/fetch/buffering_bytes_consumer_test.cc b/third_party/blink/renderer/platform/loader/fetch/buffering_bytes_consumer_test.cc index bd09b46c..5497f35 100644 --- a/third_party/blink/renderer/platform/loader/fetch/buffering_bytes_consumer_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/buffering_bytes_consumer_test.cc
@@ -20,8 +20,7 @@ class BufferingBytesConsumerTest : public testing::Test { public: BufferingBytesConsumerTest() - : task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} using Command = ReplayingBytesConsumer::Command; using Result = BytesConsumer::Result; @@ -40,7 +39,7 @@ return consumer_handle; } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(BufferingBytesConsumerTest, Read) {
diff --git a/third_party/blink/renderer/platform/media/webaudiosourceprovider_impl_test.cc b/third_party/blink/renderer/platform/media/webaudiosourceprovider_impl_test.cc index e67e1f8..c27ce2ba 100644 --- a/third_party/blink/renderer/platform/media/webaudiosourceprovider_impl_test.cc +++ b/third_party/blink/renderer/platform/media/webaudiosourceprovider_impl_test.cc
@@ -106,7 +106,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; media::AudioParameters params_; media::FakeAudioRenderCallback fake_callback_;
diff --git a/third_party/blink/renderer/platform/mojo/geometry_mojom_traits_test.cc b/third_party/blink/renderer/platform/mojo/geometry_mojom_traits_test.cc index fdb5cf8..7f1f45e 100644 --- a/third_party/blink/renderer/platform/mojo/geometry_mojom_traits_test.cc +++ b/third_party/blink/renderer/platform/mojo/geometry_mojom_traits_test.cc
@@ -96,7 +96,7 @@ mojo::BindingSet<gfx::mojom::blink::GeometryTraitsTestService> traits_test_bindings_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(GeometryStructTraitsTest); };
diff --git a/third_party/blink/renderer/platform/mojo/interface_invalidator_test.cc b/third_party/blink/renderer/platform/mojo/interface_invalidator_test.cc index 8bbc5cc..5c293c1 100644 --- a/third_party/blink/renderer/platform/mojo/interface_invalidator_test.cc +++ b/third_party/blink/renderer/platform/mojo/interface_invalidator_test.cc
@@ -97,7 +97,7 @@ ~InterfaceInvalidatorTest() override {} private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(InterfaceInvalidatorTest); };
diff --git a/third_party/blink/renderer/platform/mojo/kurl_security_origin_test.cc b/third_party/blink/renderer/platform/mojo/kurl_security_origin_test.cc index f41ec14..b3eb003 100644 --- a/third_party/blink/renderer/platform/mojo/kurl_security_origin_test.cc +++ b/third_party/blink/renderer/platform/mojo/kurl_security_origin_test.cc
@@ -35,7 +35,7 @@ // Mojo version of chrome IPC test in url/ipc/url_param_traits_unittest.cc. TEST(KURLSecurityOriginStructTraitsTest, Basic) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; url::mojom::blink::UrlTestPtr proxy; UrlTestImpl impl(MakeRequest(&proxy));
diff --git a/third_party/blink/renderer/platform/network/encoded_form_data_test.cc b/third_party/blink/renderer/platform/network/encoded_form_data_test.cc index 85c172a1..202b813a 100644 --- a/third_party/blink/renderer/platform/network/encoded_form_data_test.cc +++ b/third_party/blink/renderer/platform/network/encoded_form_data_test.cc
@@ -50,7 +50,7 @@ class EncodedFormDataMojomTraitsTest : public testing::Test { protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(EncodedFormDataTest, DeepCopy) {
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index d753804..9165b5aa 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -99,6 +99,11 @@ status: "experimental", }, { + name: "AddressSpace", + status: "experimental", + implied_by: ["CorsRFC1918"], + }, + { name: "AdTagging", status: "test", }, @@ -309,6 +314,7 @@ }, { name: "CorsRFC1918", + depends_on: ["AddressSpace"], }, { name: "CSS3Text",
diff --git a/third_party/blink/renderer/platform/scheduler/common/scheduler_helper_unittest.cc b/third_party/blink/renderer/platform/scheduler/common/scheduler_helper_unittest.cc index bee56594..bae463a 100644 --- a/third_party/blink/renderer/platform/scheduler/common/scheduler_helper_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/common/scheduler_helper_unittest.cc
@@ -52,9 +52,8 @@ public: SchedulerHelperTest() : task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) { + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) { sequence_manager_ = base::sequence_manager::SequenceManagerForTest::Create( nullptr, task_environment_.GetMainThreadTaskRunner(), task_environment_.GetMockTickClock()); @@ -82,7 +81,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::sequence_manager::SequenceManagerForTest> sequence_manager_; std::unique_ptr<NonMainThreadSchedulerHelper> scheduler_helper_;
diff --git a/third_party/blink/renderer/platform/scheduler/common/worker_pool_unittest.cc b/third_party/blink/renderer/platform/scheduler/common/worker_pool_unittest.cc index 7474aa3..2dc46f9 100644 --- a/third_party/blink/renderer/platform/scheduler/common/worker_pool_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/common/worker_pool_unittest.cc
@@ -21,7 +21,7 @@ } // namespace TEST(BackgroundSchedulerTest, RunOnBackgroundThread) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; std::unique_ptr<base::WaitableEvent> done_event = std::make_unique<base::WaitableEvent>(); worker_pool::PostTask(
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/deadline_task_runner_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/deadline_task_runner_unittest.cc index 5f5f869..73586ec0 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/deadline_task_runner_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/deadline_task_runner_unittest.cc
@@ -19,9 +19,8 @@ public: DeadlineTaskRunnerTest() : task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) {} + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} ~DeadlineTaskRunnerTest() override = default; void SetUp() override { @@ -38,7 +37,7 @@ void TestTask() { run_times_.push_back(Now()); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<DeadlineTaskRunner> deadline_task_runner_; std::vector<base::TimeTicks> run_times_; };
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/frame_interference_recorder_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/frame_interference_recorder_unittest.cc index b7aa797..fcf1908 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/frame_interference_recorder_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/frame_interference_recorder_unittest.cc
@@ -72,12 +72,10 @@ } void FastForwardBy(base::TimeDelta delta) { - scoped_task_environment_.FastForwardBy(delta); + task_environment_.FastForwardBy(delta); } - base::TimeTicks NowTicks() const { - return scoped_task_environment_.NowTicks(); - } + base::TimeTicks NowTicks() const { return task_environment_.NowTicks(); } void OnTaskReady(FrameScheduler* frame_scheduler, base::sequence_manager::EnqueueOrder enqueue_order) { @@ -86,7 +84,7 @@ } const base::TickClock* GetMockTickClock() const { - return scoped_task_environment_.GetMockTickClock(); + return task_environment_.GetMockTickClock(); } testing::StrictMock<MockFrameInterferenceRecorder> recorder_{this}; @@ -104,8 +102,8 @@ scoped_refptr<MainThreadTaskQueue> queue_no_frame_ = CreateMainThreadTaskQueue(); - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; private: scoped_refptr<MainThreadTaskQueue> CreateMainThreadTaskQueue() {
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc index e654b79e..5c20095 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc
@@ -63,9 +63,8 @@ public: FrameSchedulerImplTest() : task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) {} + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} FrameSchedulerImplTest(std::vector<base::Feature> features_to_enable, std::vector<base::Feature> features_to_disable) @@ -226,7 +225,7 @@ base::test::ScopedFeatureList& scoped_feature_list() { return feature_list_; } base::test::ScopedFeatureList feature_list_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MainThreadSchedulerImpl> scheduler_; std::unique_ptr<PageSchedulerImpl> page_scheduler_; std::unique_ptr<FrameSchedulerImpl> frame_scheduler_; @@ -317,7 +316,7 @@ // Simulate running a task of a particular length by fast forwarding the task // environment clock, which is used to determine the wall time of a task. -void RunTaskOfLength(base::test::ScopedTaskEnvironment* task_environment, +void RunTaskOfLength(base::test::TaskEnvironment* task_environment, base::TimeDelta length) { task_environment->FastForwardBy(length); }
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller_unittest.cc index abc2179..ac37955 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller_unittest.cc
@@ -36,8 +36,8 @@ public: FrameTaskQueueControllerTest() : task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED), + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED), task_queue_created_count_(0) {} ~FrameTaskQueueControllerTest() override = default; @@ -91,7 +91,7 @@ size_t task_queue_created_count() const { return task_queue_created_count_; } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MainThreadSchedulerImpl> scheduler_; std::unique_ptr<PageSchedulerImpl> page_scheduler_; std::unique_ptr<FrameSchedulerImpl> frame_scheduler_;
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/idle_time_estimator_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/idle_time_estimator_unittest.cc index 8ec25e228..1a313a08 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/idle_time_estimator_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/idle_time_estimator_unittest.cc
@@ -37,8 +37,8 @@ public: IdleTimeEstimatorTest() : task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED), + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED), frame_length_(base::TimeDelta::FromMilliseconds(16)) {} ~IdleTimeEstimatorTest() override = default; @@ -87,7 +87,7 @@ task_environment_.FastForwardBy(idle_time); } - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::sequence_manager::SequenceManager> manager_; scoped_refptr<base::sequence_manager::TaskQueue> compositor_task_queue_; std::unique_ptr<IdleTimeEstimatorForTest> estimator_;
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_metrics_helper_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_metrics_helper_unittest.cc index cd716509..14f4530 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_metrics_helper_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_metrics_helper_unittest.cc
@@ -50,9 +50,8 @@ public: MainThreadMetricsHelperTest() : task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: - QUEUED) {} + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {} ~MainThreadMetricsHelperTest() override = default; @@ -234,7 +233,7 @@ } base::test::ScopedFeatureList scoped_feature_list_; - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MainThreadSchedulerImplForTest> scheduler_; MainThreadMetricsHelper* metrics_helper_; // NOT OWNED std::unique_ptr<base::HistogramTester> histogram_tester_;
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/memory_purge_manager_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/memory_purge_manager_unittest.cc index 64b813e..7b604df 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/memory_purge_manager_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/memory_purge_manager_unittest.cc
@@ -23,11 +23,9 @@ class MemoryPurgeManagerTest : public testing::Test { public: MemoryPurgeManagerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI, - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), - memory_purge_manager_( - scoped_task_environment_.GetMainThreadTaskRunner()), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI, + base::test::TaskEnvironment::TimeSource::MOCK_TIME), + memory_purge_manager_(task_environment_.GetMainThreadTaskRunner()), observed_memory_pressure_(false) {} void SetUp() override { @@ -39,7 +37,7 @@ void TearDown() override { memory_pressure_listener_.reset(); - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); } protected: @@ -65,11 +63,11 @@ } void FastForwardBy(base::TimeDelta delta) { - scoped_task_environment_.FastForwardBy(delta); + task_environment_.FastForwardBy(delta); } base::test::ScopedFeatureList scoped_feature_list_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; MemoryPurgeManager memory_purge_manager_;
diff --git a/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy_unittest.cc b/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy_unittest.cc index ed49f69..81a66a2 100644 --- a/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/worker_scheduler_proxy_unittest.cc
@@ -103,8 +103,8 @@ public: WorkerSchedulerProxyTest() : task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED), + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED), main_thread_scheduler_(std::make_unique<MainThreadSchedulerImpl>( base::sequence_manager::SequenceManagerForTest::Create( nullptr, @@ -127,7 +127,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<MainThreadSchedulerImpl> main_thread_scheduler_; std::unique_ptr<PageSchedulerImpl> page_scheduler_; std::unique_ptr<FrameSchedulerImpl> frame_scheduler_;
diff --git a/third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler_unittest.cc b/third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler_unittest.cc index 1b4c4b2..3eafdb9 100644 --- a/third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler_unittest.cc
@@ -140,8 +140,8 @@ public: WorkerThreadSchedulerTest() : task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED), + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED), sequence_manager_( base::sequence_manager::SequenceManagerForTest::Create( nullptr, @@ -207,7 +207,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; // Needs to be initialized immediately after |task_environment_|, specifically // before |scheduler_|. ScopedSaveStartTicks save_start_ticks_{task_environment_.NowTicks()}; @@ -427,10 +427,10 @@ base::TimeTicks start_time = task_environment_.NowTicks(); default_task_runner_->PostTask( - FROM_HERE, WTF::Bind(&base::test::ScopedTaskEnvironment::FastForwardBy, + FROM_HERE, WTF::Bind(&base::test::TaskEnvironment::FastForwardBy, base::Unretained(&task_environment_), kTaskTime)); scheduler_->set_on_microtask_checkpoint( - WTF::Bind(&base::test::ScopedTaskEnvironment::FastForwardBy, + WTF::Bind(&base::test::TaskEnvironment::FastForwardBy, base::Unretained(&task_environment_), kMicrotaskTime)); RecordingTaskTimeObserver observer; @@ -474,8 +474,8 @@ public: WorkerThreadSchedulerWithProxyTest() : task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED), + base::test::TaskEnvironment::TimeSource::MOCK_TIME, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED), sequence_manager_( base::sequence_manager::SequenceManagerForTest::Create( nullptr, @@ -510,7 +510,7 @@ } protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::sequence_manager::SequenceManagerForTest> sequence_manager_; Vector<String> timeline_;
diff --git a/third_party/blink/renderer/platform/timer_test.cc b/third_party/blink/renderer/platform/timer_test.cc index 0c6df2ca..25b0d545 100644 --- a/third_party/blink/renderer/platform/timer_test.cc +++ b/third_party/blink/renderer/platform/timer_test.cc
@@ -84,7 +84,7 @@ platform_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; class OnHeapTimerOwner final
diff --git a/third_party/blink/renderer/platform/video_capture/video_capture_impl_test.cc b/third_party/blink/renderer/platform/video_capture/video_capture_impl_test.cc index e5e7375..0f632dbd 100644 --- a/third_party/blink/renderer/platform/video_capture/video_capture_impl_test.cc +++ b/third_party/blink/renderer/platform/video_capture/video_capture_impl_test.cc
@@ -210,7 +210,7 @@ } const base::UnguessableToken session_id_ = base::UnguessableToken::Create(); - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ScopedTestingPlatformSupport<IOTaskRunnerTestingPlatformSupport> platform_; const std::unique_ptr<VideoCaptureImpl> video_capture_impl_; MockMojoVideoCaptureHost mock_video_capture_host_;
diff --git a/third_party/blink/tools/blinkpy/web_tests/run_web_tests.py b/third_party/blink/tools/blinkpy/web_tests/run_web_tests.py index 0b169dc..11c92e5 100644 --- a/third_party/blink/tools/blinkpy/web_tests/run_web_tests.py +++ b/third_party/blink/tools/blinkpy/web_tests/run_web_tests.py
@@ -308,8 +308,6 @@ optparse.make_option( '--iterations', '--isolated-script-test-repeat', - # TODO(crbug.com/893235): Remove the gtest alias when FindIt no longer uses it. - '--gtest_repeat', type='int', default=1, help='Number of times to run the set of tests (e.g. ABCABCABC)'), @@ -408,8 +406,6 @@ '"always" == always skip, even if listed on the command line.')), optparse.make_option( '--isolated-script-test-also-run-disabled-tests', - # TODO(crbug.com/893235): Remove the gtest alias when FindIt no longer uses it. - '--gtest_also_run_disabled_tests', action='store_const', const='ignore', dest='skipped', @@ -441,13 +437,6 @@ type='string', help='A list of tests to run separated by TWO colons, e.g. fast::css/test.html, ' 'same as listing them as positional arguments'), - # TODO(crbug.com/893235): Remove gtest_filter when FindIt no longer uses it. - optparse.make_option( - '--gtest_filter', - type='string', - help='A colon-separated list of tests to run. Wildcards are ' - 'NOT supported. It is the same as listing the tests as ' - 'positional arguments.'), optparse.make_option( '--time-out-ms', help='Set the timeout for each test'), @@ -589,9 +578,6 @@ if options.isolated_script_test_filter: args.extend(options.isolated_script_test_filter.split('::')) - if options.gtest_filter: - args.extend(options.gtest_filter.split(':')) - if not options.total_shards and 'GTEST_TOTAL_SHARDS' in port.host.environ: options.total_shards = int(port.host.environ['GTEST_TOTAL_SHARDS']) if not options.shard_index and 'GTEST_SHARD_INDEX' in port.host.environ:
diff --git a/third_party/blink/tools/blinkpy/web_tests/run_web_tests_unittest.py b/third_party/blink/tools/blinkpy/web_tests/run_web_tests_unittest.py index 5e779d1..312f4dfb 100644 --- a/third_party/blink/tools/blinkpy/web_tests/run_web_tests_unittest.py +++ b/third_party/blink/tools/blinkpy/web_tests/run_web_tests_unittest.py
@@ -398,16 +398,6 @@ tests_run = get_tests_run(['--repeat-each', '2', '--order', 'natural'] + tests_to_run) self.assertEqual(tests_run, ['passes/image.html', 'passes/image.html', 'passes/text.html', 'passes/text.html']) - def test_gtest_repeat(self): - tests_to_run = ['passes/image.html', 'passes/text.html'] - tests_run = get_tests_run(['--gtest_repeat', '2', '--order', 'natural'] + tests_to_run) - self.assertEqual(tests_run, ['passes/image.html', 'passes/text.html', 'passes/image.html', 'passes/text.html']) - - def test_gtest_repeat_overrides_iterations(self): - tests_to_run = ['passes/image.html', 'passes/text.html'] - tests_run = get_tests_run(['--iterations', '4', '--gtest_repeat', '2', '--order', 'natural'] + tests_to_run) - self.assertEqual(tests_run, ['passes/image.html', 'passes/text.html', 'passes/image.html', 'passes/text.html']) - def test_ignore_flag(self): # Note that passes/image.html is expected to be run since we specified it directly. tests_run = get_tests_run(['-i', 'passes', 'passes/image.html']) @@ -440,12 +430,6 @@ sorted(get_tests_run(['--skipped=ignore', 'passes'])) ) - def test_gtest_also_run_disabled_tests(self): - self.assertEqual( - sorted(get_tests_run(['--gtest_also_run_disabled_tests', 'passes'])), - sorted(get_tests_run(['--skipped=ignore', 'passes'])) - ) - def test_iterations(self): tests_to_run = ['passes/image.html', 'passes/text.html'] tests_run = get_tests_run(['--iterations', '2', '--order', 'natural'] + tests_to_run) @@ -521,11 +505,6 @@ ) self.assertEqual(sorted(tests_run), ['passes/error.html', 'passes/image.html', 'passes/text.html']) - def test_gtest_filter(self): - host = MockHost() - tests_run = get_tests_run(['--gtest_filter=passes/text.html:passes/image.html', 'passes/error.html'], host=host) - self.assertEqual(sorted(tests_run), ['passes/error.html', 'passes/image.html', 'passes/text.html']) - def test_sharding_even(self): # Test that we actually select the right part tests_to_run = ['passes/error.html', 'passes/image.html', 'passes/platform_image.html', 'passes/text.html']
diff --git a/third_party/blink/web_tests/FlagExpectations/enable-gpu-rasterization b/third_party/blink/web_tests/FlagExpectations/enable-gpu-rasterization index 73eb04a..0b03168 100644 --- a/third_party/blink/web_tests/FlagExpectations/enable-gpu-rasterization +++ b/third_party/blink/web_tests/FlagExpectations/enable-gpu-rasterization
@@ -26,6 +26,9 @@ crbug.com/972621 css3/filters/effect-brightness-clamping.html [ Skip ] crbug.com/972621 css3/filters/effect-combined.html [ Skip ] crbug.com/972621 css3/filters/effect-drop-shadow.html [ Skip ] +crbug.com/972621 css3/filters/filter-repaint-blur.html [ Skip ] +crbug.com/972621 css3/filters/filter-repaint-child-layers.html [ Skip ] +crbug.com/972621 css3/filters/filter-repaint.html [ Skip ] crbug.com/972621 css3/filters/regions-expanding.html [ Skip ] crbug.com/972621 images/rgb-png-with-cmyk-color-profile.html [ Skip ] crbug.com/972621 images/ycbcr-with-cmyk-color-profile.html [ Skip ] @@ -81,17 +84,6 @@ crbug.com/935970 media/audio-delete-while-slider-thumb-clicked.html [ Skip ] # Tests fail even with a fuzzy pixel diff. They require a re-baseline. -crbug.com/954328 css3/filters/filter-change-repaint.html [ Failure ] -crbug.com/954328 css3/filters/filter-repaint-blur.html [ Failure ] -crbug.com/954328 css3/filters/filter-repaint-child-layers.html [ Failure ] -crbug.com/954328 css3/filters/filter-repaint-shadow.html [ Failure ] -crbug.com/954328 css3/filters/filter-repaint.html [ Failure ] -crbug.com/954328 css3/masking/mask-luminance-png.html [ Failure ] -crbug.com/954328 css3/masking/mask-repeat-round-auto1.html [ Failure ] -crbug.com/954328 css3/masking/mask-repeat-round-border.html [ Failure ] -crbug.com/954328 css3/masking/mask-repeat-round-content.html [ Failure ] -crbug.com/954328 css3/masking/mask-repeat-round-padding.html [ Failure ] -crbug.com/954328 css3/masking/mask-repeat-space-border.html [ Failure ] crbug.com/954328 images/color-profile-animate-rotate.html [ Failure ] crbug.com/954328 images/color-profile-animate.html [ Failure ] crbug.com/954328 images/color-profile-background-image-cover.html [ Failure ]
diff --git a/third_party/blink/web_tests/FlagExpectations/use-gl=any b/third_party/blink/web_tests/FlagExpectations/use-gl=any index 5d39dea..8619997 100644 --- a/third_party/blink/web_tests/FlagExpectations/use-gl=any +++ b/third_party/blink/web_tests/FlagExpectations/use-gl=any
@@ -8,3 +8,4 @@ crbug.com/993384 css3/blending/background-blend-mode-tiled-gradient.html [ Skip ] crbug.com/993384 css3/blending/effect-background-blend-mode-tiled.html [ Skip ] crbug.com/993384 css3/blending/effect-background-blend-mode.html [ Skip ] +crbug.com/993384 css3/masking/mask-repeat-space-border.html [ Skip ]
diff --git a/third_party/blink/web_tests/FlagExpectations/use-vulkan=native b/third_party/blink/web_tests/FlagExpectations/use-vulkan=native index 69b5ce5..fb372a3 100644 --- a/third_party/blink/web_tests/FlagExpectations/use-vulkan=native +++ b/third_party/blink/web_tests/FlagExpectations/use-vulkan=native
@@ -39,16 +39,10 @@ crbug.com/972621 css3/filters/effect-brightness-clamping.html [ Skip ] crbug.com/972621 css3/filters/effect-combined.html [ Skip ] crbug.com/972621 css3/filters/effect-drop-shadow.html [ Skip ] -crbug.com/972621 css3/filters/filter-change-repaint.html [ Skip ] crbug.com/972621 css3/filters/filter-repaint-blur.html [ Skip ] crbug.com/972621 css3/filters/filter-repaint-child-layers.html [ Skip ] -crbug.com/972621 css3/filters/filter-repaint-shadow.html [ Skip ] crbug.com/972621 css3/filters/filter-repaint.html [ Skip ] crbug.com/972621 css3/filters/regions-expanding.html [ Skip ] -crbug.com/972621 css3/masking/mask-repeat-round-auto1.html [ Skip ] -crbug.com/972621 css3/masking/mask-repeat-round-border.html [ Skip ] -crbug.com/972621 css3/masking/mask-repeat-round-content.html [ Skip ] -crbug.com/972621 css3/masking/mask-repeat-round-padding.html [ Skip ] crbug.com/972621 images/optimize-contrast-canvas.html [ Skip ] crbug.com/972621 images/optimize-contrast-image.html [ Skip ] crbug.com/972621 images/rgb-png-with-cmyk-color-profile.html [ Skip ] @@ -102,8 +96,6 @@ crbug.com/963542 media/alpha-video-playback.html [ Skip ] # Rebaseline -crbug.com/972637 css3/masking/mask-luminance-png.html [ Skip ] -crbug.com/972637 css3/masking/mask-repeat-space-border.html [ Skip ] crbug.com/972637 images/color-profile-animate-rotate.html [ Skip ] crbug.com/972637 images/color-profile-animate.html [ Skip ] crbug.com/972637 images/color-profile-background-image-cover.html [ Skip ] @@ -138,3 +130,4 @@ crbug.com/993384 css3/blending/background-blend-mode-tiled-gradient.html [ Skip ] crbug.com/993384 css3/blending/effect-background-blend-mode-tiled.html [ Skip ] crbug.com/993384 css3/blending/effect-background-blend-mode.html [ Skip ] +crbug.com/993384 css3/masking/mask-repeat-space-border.html [ Skip ]
diff --git a/third_party/blink/web_tests/FlagExpectations/use-vulkan=swiftshader b/third_party/blink/web_tests/FlagExpectations/use-vulkan=swiftshader index 43684b4..7ca4439 100644 --- a/third_party/blink/web_tests/FlagExpectations/use-vulkan=swiftshader +++ b/third_party/blink/web_tests/FlagExpectations/use-vulkan=swiftshader
@@ -47,18 +47,11 @@ crbug.com/972621 css3/filters/effect-grayscale-hw.html [ Skip ] crbug.com/972621 css3/filters/effect-reference-colorspace.html [ Skip ] crbug.com/972621 css3/filters/filter-change-repaint-composited.html [ Skip ] -crbug.com/972621 css3/filters/filter-change-repaint.html [ Skip ] crbug.com/972621 css3/filters/filter-repaint-blur.html [ Skip ] crbug.com/972621 css3/filters/filter-repaint-child-layers.html [ Skip ] crbug.com/972621 css3/filters/filter-repaint-composited-fallback-crash.html [ Skip ] -crbug.com/972621 css3/filters/filter-repaint-shadow.html [ Skip ] crbug.com/972621 css3/filters/filter-repaint.html [ Skip ] crbug.com/972621 css3/filters/regions-expanding.html [ Skip ] -crbug.com/972621 css3/masking/mask-luminance-png.html [ Skip ] -crbug.com/972621 css3/masking/mask-repeat-round-auto1.html [ Skip ] -crbug.com/972621 css3/masking/mask-repeat-round-border.html [ Skip ] -crbug.com/972621 css3/masking/mask-repeat-round-content.html [ Skip ] -crbug.com/972621 css3/masking/mask-repeat-round-padding.html [ Skip ] crbug.com/972621 media/controls/paint-controls-webkit-appearance-none-custom-bg.html [ Skip ] crbug.com/972621 media/controls/paint-controls-webkit-appearance-none.html [ Skip ] crbug.com/972621 media/video-no-audio.html [ Skip ] @@ -77,7 +70,6 @@ crbug.com/972684 css3/filters/effect-blur.html [ Skip ] crbug.com/972684 css3/filters/effect-brightness-clamping.html [ Skip ] crbug.com/972684 css3/filters/effect-combined.html [ Skip ] -crbug.com/972684 css3/masking/mask-repeat-space-border.html [ Skip ] crbug.com/972684 images/color-profile-animate-rotate.html [ Skip ] crbug.com/972684 images/color-profile-animate.html [ Skip ] crbug.com/972684 images/color-profile-background-image-cover.html [ Skip ]
diff --git a/third_party/blink/web_tests/SlowTests b/third_party/blink/web_tests/SlowTests index 325bb37..b99674d 100644 --- a/third_party/blink/web_tests/SlowTests +++ b/third_party/blink/web_tests/SlowTests
@@ -685,8 +685,11 @@ crbug.com/980804 virtual/main_thread_scrollbar_gestures/fast/scrolling/scrollbars/mouse-autoscrolling-on-scrollbar.html [ Slow ] crbug.com/983642 virtual/gpu/fast/canvas/canvas-composite-alpha.html [ Slow ] +crbug.com/983642 [ Mac Debug ] fast/canvas/canvas-composite-alpha.html [ Slow ] crbug.com/983642 virtual/gpu/fast/canvas/canvas-composite-text-alpha.html [ Slow ] +crbug.com/983642 [ Debug ] fast/canvas/canvas-composite-text-alpha.html [ Slow ] crbug.com/983642 virtual/gpu/fast/canvas/color-space/canvas-createImageBitmap-e_srgb.html [ Slow ] +crbug.com/983642 [ Mac ] fast/canvas/color-space/canvas-createImageBitmap-e_srgb.html [ Slow ] crbug.com/983642 [ Win ] virtual/gpu/fast/canvas/color-space/canvas-createImageBitmap-p3.html [ Slow ] crbug.com/983642 [ Win ] virtual/gpu/fast/canvas/color-space/canvas-createImageBitmap-rec2020.html [ Slow ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index f44c6e8..de421ad 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -336,10 +336,6 @@ # ====== Layout team owned tests from here ====== -crbug.com/992950 external/wpt/css/css-layout-api/constraints-data.https.html [ Failure ] -crbug.com/992950 external/wpt/css/css-layout-api/fragment-data-immutable.https.html [ Failure ] -crbug.com/992950 external/wpt/css/css-layout-api/fragment-data.https.html [ Failure ] - crbug.com/711704 external/wpt/css/CSS2/floats/floats-rule3-outside-left-002.xht [ Failure ] crbug.com/711704 external/wpt/css/CSS2/floats/floats-rule3-outside-right-002.xht [ Failure ] crbug.com/711704 external/wpt/css/CSS2/floats/floats-rule7-outside-left-001.xht [ Failure ] @@ -2019,12 +2015,13 @@ # Fieldset in NG # crbug.com/875235 virtual/layout_ng_experimental/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-overflow.html [ Failure ] -crbug.com/875235 virtual/layout_ng_experimental/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-painting-order.html [ Failure ] +crbug.com/875235 virtual/layout_ng_experimental/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-painting-order.html [ Failure Crash ] crbug.com/875235 virtual/layout_ng_experimental/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-percentage-block-size.html [ Failure ] crbug.com/875235 virtual/layout_ng_experimental/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-transform-translatez.html [ Failure ] crbug.com/875235 virtual/layout_ng_experimental/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-vertical.html [ Failure ] crbug.com/875235 virtual/layout_ng_experimental/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align.html [ Failure ] crbug.com/875235 virtual/layout_ng_experimental/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-auto-margins.html [ Failure ] +crbug.com/875235 virtual/layout_ng_experimental/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-formatting-context.html [ Crash ] crbug.com/875235 virtual/layout_ng_experimental/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins.html [ Failure ] crbug.com/875235 virtual/layout_ng_experimental/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins-2.html [ Failure ] crbug.com/875235 virtual/layout_ng_experimental/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-rendering.html [ Failure ] @@ -2444,6 +2441,12 @@ crbug.com/991413 external/wpt/css/css-text/white-space/trailing-other-space-separators-break-spaces-014.html [ Skip ] crbug.com/991413 external/wpt/css/css-text/white-space/trailing-other-space-separators-break-spaces-015.html [ Skip ] +# Sheriff 2019-08-19 +crbug.com/626703 [ Win7 ] external/wpt/xhr/responsexml-document-properties.htm [ Failure ] +crbug.com/626703 [ Win7 ] external/wpt/html/dom/documents/resource-metadata-management/document-lastModified-01.html [ Failure ] +crbug.com/626703 [ Win7 ] virtual/blink-cors/external/wpt/xhr/responsexml-document-properties.htm [ Failure ] +crbug.com/626703 [ Win7 ] virtual/omt-worker-fetch/external/wpt/xhr/responsexml-document-properties.htm [ Failure ] + # The 'overflow-wrap: anywhere' feature is not implemented yet crbug.com/905315 external/wpt/css/css-text/overflow-wrap/overflow-wrap-anywhere-001.html [ Skip ] crbug.com/905315 external/wpt/css/css-text/overflow-wrap/overflow-wrap-anywhere-002.html [ Skip ] @@ -4603,10 +4606,12 @@ crbug.com/626703 [ Win10 ] external/wpt/preload/delaying-onload-link-preload-after-discovery.html [ Timeout ] crbug.com/626703 [ Win ] external/wpt/css/css-writing-modes/box-offsets-rel-pos-vlr-005.xht [ Failure ] crbug.com/626703 [ Win ] external/wpt/css/css-writing-modes/box-offsets-rel-pos-vrl-004.xht [ Failure ] -# Sheriff 2019-09-19: + +# Sheriff 2019-08-19: crbug.com/626703 external/wpt/html/cross-origin-embedder-policy/none.https.html [ Failure ] crbug.com/626703 external/wpt/html/cross-origin-embedder-policy/require-corp.https.html [ Failure ] crbug.com/626703 external/wpt/html/cross-origin-opener-policy/coop-sandbox.https.html [ Failure ] +crbug.com/626703 [ Linux Mac10.10 ] virtual/cross-origin-embedder-policy/external/wpt/html/cross-origin-embedder-policy/require-corp.https.html [ Pass Failure ] # Failure due to on-going off-thread paint worklet project. crbug.com/957457 virtual/threaded/external/wpt/css/css-paint-api/invalid-image-pending-script.https.html [ Crash ] @@ -6275,7 +6280,6 @@ crbug.com/971319 [ Mac ] virtual/audio-service/media/audio-garbage-collect.html [ Pass Timeout ] # Sheriff 2019-06-06 -crbug.com/971590 fast/dom/timer-throttling-out-of-view-cross-origin-page.html [ Pass Failure ] crbug.com/971590 [ Mac ] fast/dom/timer-throttling-hidden-page.html [ Pass Failure ] crbug.com/971612 fast/canvas/OffscreenCanvas-MessageChannel-transfer.html [ Pass Failure ] @@ -6485,3 +6489,5 @@ crbug.com/979298 [ Mac ] virtual/audio-service/media/controls/volumechange-muted-attribute.html [ Pass Failure ] crbug.com/979298 [ Mac ] virtual/audio-service/media/video-persistence.html [ Pass Failure ] crbug.com/979298 [ Mac ] virtual/audio-service/media/video-zoom.html [ Pass Failure ] + +crbug.com/986019 virtual/threaded/animations/play-state.html [ Pass Failure ]
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites index 91691f0d..7cd3c2d 100644 --- a/third_party/blink/web_tests/VirtualTestSuites +++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -978,6 +978,13 @@ "args": ["--enable-features=FormControlsRefresh"] }, { + "prefix": "controls-refresh-high-contrast", + "base": "fast/forms/controls-new-ui-high-contrast", + "args": ["--enable-features=FormControlsRefresh", + "--force-high-contrast", + "--enable-blink-features=ForcedColors"] + }, + { "prefix": "user-timing-l2", "base": "external/wpt/user-timing", "args": ["--disable-blink-features=CustomUserTiming"]
diff --git a/third_party/blink/web_tests/animations/interpolation/background-color-interpolation.html b/third_party/blink/web_tests/animations/interpolation/background-color-interpolation.html deleted file mode 100644 index 692d6042..0000000 --- a/third_party/blink/web_tests/animations/interpolation/background-color-interpolation.html +++ /dev/null
@@ -1,115 +0,0 @@ -<!DOCTYPE html> -<meta charset="UTF-8"> -<style> -.parent { - background-color: #eee; -} -.target { - width: 60px; - height: 60px; - display: inline-block; - border: 2px solid black; - margin-right: 2px; - color: rgba(0, 0, 255, 0.5); - background-color: black; -} -.expected { - margin-right: 15px; -} -</style> -<body> -<script src="resources/interpolation-test.js"></script> -<script> -assertInterpolation({ - property: 'background-color', - from: neutralKeyframe, - to: 'green', -}, [ - {at: -0.3, is: 'rgb(0, 0, 0)'}, - {at: 0, is: 'rgb(0, 0, 0)'}, - {at: 0.3, is: 'rgb(0, 38, 0)'}, - {at: 0.6, is: 'rgb(0, 77, 0)'}, - {at: 1, is: 'rgb(0, 128, 0)'}, - {at: 1.5, is: 'rgb(0, 192, 0)'}, -]); - -assertInterpolation({ - property: 'background-color', - from: 'initial', - to: 'green', -}, [ - {at: -0.3, is: 'rgba(0, 0, 0, 0)'}, - {at: 0, is: 'rgba(0, 0, 0, 0)'}, - {at: 0.3, is: 'rgba(0, 128, 0, 0.3)'}, - {at: 0.6, is: 'rgba(0, 128, 0, 0.6)'}, - {at: 1, is: 'rgb(0, 128, 0)'}, - {at: 1.5, is: 'rgb(0, 192, 0)'}, -]); - -assertInterpolation({ - property: 'background-color', - from: 'inherit', - to: 'green', -}, [ - {at: -0.3, is: 'rgb(255, 255, 255)'}, - {at: 0, is: 'rgb(238, 238, 238)'}, - {at: 0.3, is: 'rgb(167, 205, 167)'}, - {at: 0.6, is: 'rgb(95, 172, 95)'}, - {at: 1, is: 'rgb(0, 128, 0)'}, - {at: 1.5, is: 'rgb(0, 73, 0)'}, -]); - -assertInterpolation({ - property: 'background-color', - from: 'unset', - to: 'green', -}, [ - {at: -0.3, is: 'rgba(0, 0, 0, 0)'}, - {at: 0, is: 'rgba(0, 0, 0, 0)'}, - {at: 0.3, is: 'rgba(0, 128, 0, 0.3)'}, - {at: 0.6, is: 'rgba(0, 128, 0, 0.6)'}, - {at: 1, is: 'rgb(0, 128, 0)'}, - {at: 1.5, is: 'rgb(0, 192, 0)'}, -]); - -assertInterpolation({ - property: 'background-color', - from: 'white', - to: 'orange', -}, [ - {at: -0.3, is: 'white'}, - {at: 0, is: 'white'}, - {at: 0.3, is: 'rgb(255, 228, 179)'}, - {at: 0.6, is: 'rgb(255, 201, 102)'}, - {at: 1, is: 'orange'}, - {at: 1.5, is: 'rgb(255, 120, 0)'}, -]); - -assertInterpolation({ - property: 'background-color', - from: 'transparent', - to: 'green', -}, [ - {at: -0.3, is: 'rgba(0, 0, 0, 0)'}, - {at: 0, is: 'rgba(0, 0, 0, 0)'}, - {at: 0.3, is: 'rgba(0, 128, 0, 0.3)'}, - {at: 0.6, is: 'rgba(0, 128, 0, 0.6)'}, - {at: 1, is: 'rgb(0, 128, 0)'}, - {at: 1.5, is: 'rgb(0, 192, 0)'}, -]); - -assertInterpolation({ - property: 'background-color', - from: 'currentcolor', - to: 'rgba(0, 255, 0, 0.75)', -}, [ - {at: -0.5, is: 'rgba(0, 0, 255, 0.38)'}, - {at: 0, is: 'rgba(0, 0, 255, 0.5)'}, - {at: 0.25, is: 'rgba(0, 85, 170, 0.56)'}, - {at: 0.5, is: 'rgba(0, 153, 102, 0.63)'}, - {at: 0.75, is: 'rgba(0, 208, 47, 0.69)'}, - {at: 1, is: 'rgba(0, 255, 0, 0.75)'}, - {at: 1.5, is: 'rgba(0, 255, 0, 0.88)'}, -]); -</script> -</body>
diff --git a/third_party/blink/web_tests/animations/interpolation/background-position-interpolation.html b/third_party/blink/web_tests/animations/interpolation/background-position-interpolation.html deleted file mode 100644 index 0276755..0000000 --- a/third_party/blink/web_tests/animations/interpolation/background-position-interpolation.html +++ /dev/null
@@ -1,127 +0,0 @@ -<!DOCTYPE html> -<meta charset="UTF-8"> -<style> -.parent { - background-position: 60px 60px; -} -.target { - width: 120px; - height: 120px; - display: inline-block; - border: 2px solid black; - background-repeat: no-repeat; - background-image: radial-gradient(20px circle at 20px 20px, red 18px, transparent), - radial-gradient(20px circle at 20px 20px, yellow 18px, transparent), - radial-gradient(20px circle at 20px 20px, lime 18px, transparent), - radial-gradient(20px circle at 20px 20px, blue 18px, transparent); - background-position: 40px 40px; -} -.expected { - margin-right: 10px; -} -</style> -<body> -<script src="resources/interpolation-test.js"></script> -<script> -assertInterpolation({ - property: 'background-position', - from: neutralKeyframe, - to: '80px 80px, 80px 80px, 80px 80px, 80px 80px', -}, [ - {at: -0.25, is: '30px 30px, 30px 30px, 30px 30px, 30px 30px'}, - {at: 0, is: '40px 40px, 40px 40px, 40px 40px, 40px 40px'}, - {at: 0.25, is: '50px 50px, 50px 50px, 50px 50px, 50px 50px'}, - {at: 0.5, is: '60px 60px, 60px 60px, 60px 60px, 60px 60px'}, - {at: 0.75, is: '70px 70px, 70px 70px, 70px 70px, 70px 70px'}, - {at: 1, is: '80px 80px, 80px 80px, 80px 80px, 80px 80px'}, - {at: 1.25, is: '90px 90px, 90px 90px, 90px 90px, 90px 90px'}, -]); - -assertInterpolation({ - property: 'background-position', - from: 'initial', - to: '80px 80px, 80px 80px, 80px 80px, 80px 80px', -}, [ - {at: -0.25, is: '-20px -20px, -20px -20px, -20px -20px, -20px -20px'}, - {at: 0, is: ' 0% 0% , 0% 0% , 0% 0% , 0% 0% '}, // TODO(alancutter): Should these be 0px? - {at: 0.25, is: ' 20px 20px, 20px 20px, 20px 20px, 20px 20px'}, - {at: 0.5, is: ' 40px 40px, 40px 40px, 40px 40px, 40px 40px'}, - {at: 0.75, is: ' 60px 60px, 60px 60px, 60px 60px, 60px 60px'}, - {at: 1, is: ' 80px 80px, 80px 80px, 80px 80px, 80px 80px'}, - {at: 1.25, is: '100px 100px, 100px 100px, 100px 100px, 100px 100px'}, -]); - -assertInterpolation({ - property: 'background-position', - from: 'inherit', - to: '80px 80px, 80px 80px, 80px 80px, 80px 80px', -}, [ - {at: -0.25, is: '55px 55px, 55px 55px, 55px 55px, 55px 55px'}, - {at: 0, is: '60px 60px, 60px 60px, 60px 60px, 60px 60px'}, - {at: 0.25, is: '65px 65px, 65px 65px, 65px 65px, 65px 65px'}, - {at: 0.5, is: '70px 70px, 70px 70px, 70px 70px, 70px 70px'}, - {at: 0.75, is: '75px 75px, 75px 75px, 75px 75px, 75px 75px'}, - {at: 1, is: '80px 80px, 80px 80px, 80px 80px, 80px 80px'}, - {at: 1.25, is: '85px 85px, 85px 85px, 85px 85px, 85px 85px'}, -]); - -assertInterpolation({ - property: 'background-position', - from: 'unset', - to: '80px 80px, 80px 80px, 80px 80px, 80px 80px', -}, [ - {at: -0.25, is: '-20px -20px, -20px -20px, -20px -20px, -20px -20px'}, - {at: 0, is: ' 0% 0% , 0% 0% , 0% 0% , 0% 0% '}, - {at: 0.25, is: ' 20px 20px, 20px 20px, 20px 20px, 20px 20px'}, - {at: 0.5, is: ' 40px 40px, 40px 40px, 40px 40px, 40px 40px'}, - {at: 0.75, is: ' 60px 60px, 60px 60px, 60px 60px, 60px 60px'}, - {at: 1, is: ' 80px 80px, 80px 80px, 80px 80px, 80px 80px'}, - {at: 1.25, is: '100px 100px, 100px 100px, 100px 100px, 100px 100px'}, -]); - -// Test equal number of position values as background images. -assertInterpolation({ - property: 'background-position', - from: '0px 0px, 0px 0px, 0px 0px, 0px 0px', - to: '80px 80px, 80px 80px, 80px 80px, 80px 80px', -}, [ - {at: -0.25, is: '-20px -20px, -20px -20px, -20px -20px, -20px -20px'}, - {at: 0, is: ' 0px 0px, 0px 0px, 0px 0px, 0px 0px'}, - {at: 0.25, is: ' 20px 20px, 20px 20px, 20px 20px, 20px 20px'}, - {at: 0.5, is: ' 40px 40px, 40px 40px, 40px 40px, 40px 40px'}, - {at: 0.75, is: ' 60px 60px, 60px 60px, 60px 60px, 60px 60px'}, - {at: 1, is: ' 80px 80px, 80px 80px, 80px 80px, 80px 80px'}, - {at: 1.25, is: '100px 100px, 100px 100px, 100px 100px, 100px 100px'}, -]); - -// Test single position value repeated over background images. -assertInterpolation({ - property: 'background-position', - from: 'top 0px left 0px', - to: 'left 80px top 80px', -}, [ - {at: -0.25, is: '-20px -20px, -20px -20px, -20px -20px, -20px -20px'}, - {at: 0, is: ' 0px 0px, 0px 0px, 0px 0px, 0px 0px'}, - {at: 0.25, is: ' 20px 20px, 20px 20px, 20px 20px, 20px 20px'}, - {at: 0.5, is: ' 40px 40px, 40px 40px, 40px 40px, 40px 40px'}, - {at: 0.75, is: ' 60px 60px, 60px 60px, 60px 60px, 60px 60px'}, - {at: 1, is: ' 80px 80px, 80px 80px, 80px 80px, 80px 80px'}, - {at: 1.25, is: '100px 100px, 100px 100px, 100px 100px, 100px 100px'}, -]); - -// Test mismatched numbers of position values. -assertInterpolation({ - property: 'background-position', - from: '0px 0px, 80px 0px', - to: '40px 40px, 80px 80px, 0px 80px', -}, [ - {at: -0.25, is: '-10px -10px, 80px -20px, 0px -20px, 90px -10px'}, - {at: 0, is: ' 0px 0px, 80px 0px, 0px 0px, 80px 0px'}, - {at: 0.25, is: ' 10px 10px, 80px 20px, 0px 20px, 70px 10px'}, - {at: 0.5, is: ' 20px 20px, 80px 40px, 0px 40px, 60px 20px'}, - {at: 0.75, is: ' 30px 30px, 80px 60px, 0px 60px, 50px 30px'}, - {at: 1, is: ' 40px 40px, 80px 80px, 0px 80px, 40px 40px'}, - {at: 1.25, is: ' 50px 50px, 80px 100px, 0px 100px, 30px 50px'}, -]); -</script> -</body>
diff --git a/third_party/blink/web_tests/animations/interpolation/background-position-origin-interpolation.html b/third_party/blink/web_tests/animations/interpolation/background-position-origin-interpolation.html deleted file mode 100644 index fb54deae..0000000 --- a/third_party/blink/web_tests/animations/interpolation/background-position-origin-interpolation.html +++ /dev/null
@@ -1,210 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<style> -.parent { - background-position: 80px 80px; -} -.target { - border: 3px solid skyblue; - width: 100px; - height: 100px; - background-image: linear-gradient(to right, green, green); - background-size: 20px 20px; - background-repeat: no-repeat; - background-position: 10px 10px; - display: inline-block; -} - -.actual { - background-image: linear-gradient(to right, red, red); -} -.expected { - margin-left: -106px; -} -</style> -<body> -<script src="resources/interpolation-test.js"></script> -<script> -// neutral -assertInterpolation({ - property: 'background-position', - from: neutralKeyframe, - to: 'left 20px top 20px', -}, [ - {at: 0, is: '10px 10px'}, - {at: 0.25, is: '12.5px 12.5px'}, - {at: 0.5, is: '15px 15px'}, - {at: 0.75, is: '17.5px 17.5px'}, - {at: 1, is: '20px 20px'}, -]); - -// initial -assertInterpolation({ - property: 'background-position', - from: 'initial', - to: 'left 20px top 20px', -}, [ - {at: 0, is: '0% 0%'}, - {at: 0.25, is: '5px 5px'}, - {at: 0.5, is: '10px 10px'}, - {at: 0.75, is: '15px 15px'}, - {at: 1, is: '20px 20px'}, -]); - -// inherit -assertInterpolation({ - property: 'background-position', - from: 'inherit', - to: 'left 20px top 20px', -}, [ - {at: 0, is: '80px 80px'}, - {at: 0.25, is: '65px 65px'}, - {at: 0.5, is: '50px 50px'}, - {at: 0.75, is: '35px 35px'}, - {at: 1, is: '20px 20px'}, -]); - -// unset -assertInterpolation({ - property: 'background-position', - from: 'unset', - to: 'left 20px top 20px', -}, [ - {at: 0, is: '0% 0%'}, - {at: 0.25, is: '5px 5px'}, - {at: 0.5, is: '10px 10px'}, - {at: 0.75, is: '15px 15px'}, - {at: 1, is: '20px 20px'}, -]); - -// left-top -assertInterpolation({ - property: 'background-position', - from: 'center center', - to: 'left 20px top 20px', -}, [ - {at: 0, is: '50% 50%'}, - {at: 0.25, is: 'calc(5px + 37.5%) calc(5px + 37.5%)'}, - {at: 0.5, is: 'calc(10px + 25%) calc(10px + 25%)'}, - {at: 0.75, is: 'calc(15px + 12.5%) calc(15px + 12.5%)'}, - {at: 1, is: '20px 20px'}, -]); - -// center-top -assertInterpolation({ - property: 'background-position', - from: 'center center', - to: 'center top 20px', -}, [ - {at: 0, is: '50% 50%'}, - {at: 0.25, is: '50% calc(5px + 37.5%)'}, - {at: 0.5, is: '50% calc(10px + 25%)'}, - {at: 0.75, is: '50% calc(15px + 12.5%)'}, - {at: 1, is: '50% 20px'}, -]); - -// right-top -assertInterpolation({ - property: 'background-position', - from: 'center center', - to: 'right 20px top 20px', -}, [ - {at: 0, is: '50% 50%'}, - {at: 0.25, is: 'calc(-5px + 62.5%) calc(5px + 37.5%)'}, - {at: 0.5, is: 'calc(-10px + 75%) calc(10px + 25%)'}, - {at: 0.75, is: 'calc(-15px + 87.5%) calc(15px + 12.5%)'}, - {at: 1, is: 'calc(-20px + 100%) 20px'}, -]); - -// left-center -assertInterpolation({ - property: 'background-position', - from: 'center center', - to: 'left 20px center', -}, [ - {at: 0, is: '50% 50%'}, - {at: 0.25, is: 'calc(5px + 37.5%) 50%'}, - {at: 0.5, is: 'calc(10px + 25%) 50%'}, - {at: 0.75, is: 'calc(15px + 12.5%) 50%'}, - {at: 1, is: '20px 50%'}, -]); - -// center-center -assertInterpolation({ - property: 'background-position', - from: 'center center', - to: 'center center', -}, [ - {at: 0, is: '50% 50%'}, - {at: 0.25, is: '50% 50%'}, - {at: 0.5, is: '50% 50%'}, - {at: 0.75, is: '50% 50%'}, - {at: 1, is: '50% 50%'}, -]); - -// right-center -assertInterpolation({ - property: 'background-position', - from: 'center center', - to: 'right 20px center', -}, [ - {at: 0, is: '50% 50%'}, - {at: 0.25, is: 'calc(-5px + 62.5%) 50%'}, - {at: 0.5, is: 'calc(-10px + 75%) 50%'}, - {at: 0.75, is: 'calc(-15px + 87.5%) 50%'}, - {at: 1, is: 'calc(-20px + 100%) 50%'}, -]); - -// left-bottom -assertInterpolation({ - property: 'background-position', - from: 'center center', - to: 'left 20px bottom 20px', -}, [ - {at: 0, is: '50% 50%'}, - {at: 0.25, is: 'calc(5px + 37.5%) calc(-5px + 62.5%)'}, - {at: 0.5, is: 'calc(10px + 25%) calc(-10px + 75%)'}, - {at: 0.75, is: 'calc(15px + 12.5%) calc(-15px + 87.5%)'}, - {at: 1, is: '20px calc(-20px + 100%)'}, -]); - -// center-bottom -assertInterpolation({ - property: 'background-position', - from: 'center center', - to: 'center bottom 20px', -}, [ - {at: 0, is: '50% 50%'}, - {at: 0.25, is: '50% calc(-5px + 62.5%)'}, - {at: 0.5, is: '50% calc(-10px + 75%)'}, - {at: 0.75, is: '50% calc(-15px + 87.5%)'}, - {at: 1, is: '50% calc(-20px + 100%)'}, -]); - -// right-bottom -assertInterpolation({ - property: 'background-position', - from: 'center center', - to: 'right 20px bottom 20px', -}, [ - {at: 0, is: '50% 50%'}, - {at: 0.25, is: 'calc(-5px + 62.5%) calc(-5px + 62.5%)'}, - {at: 0.5, is: 'calc(-10px + 75%) calc(-10px + 75%)'}, - {at: 0.75, is: 'calc(-15px + 87.5%) calc(-15px + 87.5%)'}, - {at: 1, is: 'calc(-20px + 100%) calc(-20px + 100%)'}, -]); - -// Single values -assertInterpolation({ - property: 'background-position', - from: 'center', - to: 'bottom', -}, [ - {at: 0, is: '50% 50%'}, - {at: 0.25, is: '50% 62.5%'}, - {at: 0.5, is: '50% 75%'}, - {at: 0.75, is: '50% 87.5%'}, - {at: 1, is: '50% 100%'}, -]); -</script> -</body>
diff --git a/third_party/blink/web_tests/animations/interpolation/background-size-interpolation.html b/third_party/blink/web_tests/animations/interpolation/background-size-interpolation.html deleted file mode 100644 index 51d07e9..0000000 --- a/third_party/blink/web_tests/animations/interpolation/background-size-interpolation.html +++ /dev/null
@@ -1,159 +0,0 @@ -<!DOCTYPE html> -<meta charset="UTF-8"> -<style> -.parent { - background-size: 100px 100px; -} -.target { - width: 80px; - height: 100px; - display: inline-block; - border: 10px solid black; - background-repeat: no-repeat; - background-image: url(../resources/stripes-100.png), - url(../resources/stripes-100.png), - url(../resources/blue-100.png), - url(../resources/green-100.png); - background-position: left top, right top, left bottom, right bottom; - background-size: 10px 10px; -} -.expected { - margin-right: 10px; - border-color: green; -} -</style> -<body> -<script src="resources/interpolation-test.js"></script> -<script> -// neutral -assertInterpolation({ - property: 'background-size', - from: neutralKeyframe, - to: '20px 20px, 0px 0px', -}, [ - {at: -0.25, is: ' 7.5px 7.5px, 12.5px 12.5px, 7.5px 7.5px, 12.5px 12.5px'}, - {at: 0, is: '10.0px 10.0px, 10.0px 10.0px, 10.0px 10.0px, 10.0px 10.0px'}, - {at: 0.25, is: '12.5px 12.5px, 7.5px 7.5px, 12.5px 12.5px, 7.5px 7.5px'}, - {at: 0.5, is: '15.0px 15.0px, 5.0px 5.0px, 15.0px 15.0px, 5.0px 5.0px'}, - {at: 0.75, is: '17.5px 17.5px, 2.5px 2.5px, 17.5px 17.5px, 2.5px 2.5px'}, - {at: 1, is: '20.0px 20.0px, 0.0px 0.0px, 20.0px 20.0px, 0.0px 0.0px'}, - {at: 1.25, is: '22.5px 22.5px, 0.0px 0.0px, 22.5px 22.5px, 0.0px 0.0px'}, -]); - -// initial -assertNoInterpolation({ - property: 'background-size', - from: 'initial', - to: '20px 20px, 0px 0px', -}); - -// inherit -assertInterpolation({ - property: 'background-size', - from: 'inherit', - to: '20px 20px, 0px 0px', -}, [ - {at: -0.25, is: '120px 120px, 125px 125px, 120px 120px, 125px 125px'}, - {at: 0, is: '100px 100px, 100px 100px, 100px 100px, 100px 100px'}, - {at: 0.25, is: ' 80px 80px, 75px 75px, 80px 80px, 75px 75px'}, - {at: 0.5, is: ' 60px 60px, 50px 50px, 60px 60px, 50px 50px'}, - {at: 0.75, is: ' 40px 40px, 25px 25px, 40px 40px, 25px 25px'}, - {at: 1, is: ' 20px 20px, 0px 0px, 20px 20px, 0px 0px'}, - {at: 1.25, is: ' 0px 0px, 0px 0px, 0px 0px, 0px 0px'}, -]); - -// unset -assertNoInterpolation({ - property: 'background-size', - from: 'unset', - to: '20px 20px, 0px 0px', -}); - -// Matched keywords in size value list. -assertInterpolation({ - property: 'background-size', - from: '0px auto, 0px 0px, contain, cover', - to: '40px auto, 40px 40px, contain, cover', -}, [ - {at: -0.25, is: ' 0px auto, 0px 0px, contain, cover'}, - {at: 0, is: ' 0px auto, 0px 0px, contain, cover'}, - {at: 0.25, is: '10px auto, 10px 10px, contain, cover'}, - {at: 0.5, is: '20px auto, 20px 20px, contain, cover'}, - {at: 0.75, is: '30px auto, 30px 30px, contain, cover'}, - {at: 1, is: '40px auto, 40px 40px, contain, cover'}, - {at: 1.25, is: '50px auto, 50px 50px, contain, cover'}, -]); - -// Mismatched keywords in size value list. -assertNoInterpolation({ - property: 'background-size', - from: '0px 0px, 0px 0px, contain, cover', - to: '40px 40px, 40px 40px, cover, contain', -}); - -assertNoInterpolation({ - property: 'background-size', - from: '0px auto, 0px 0px', - to: 'auto 40px, 40px 40px', -}); - -// Equal number of size values as background images. -assertInterpolation({ - property: 'background-size', - from: '0px 0px, 0px 0px, 0px 0px, 0px 0px', - to: '20px 20px, 40px 40px, 60px 60px, 100px 100px', -}, [ - {at: -0.25, is: ' 0px 0px, 0px 0px, 0px 0px, 0px 0px'}, - {at: 0, is: ' 0px 0px, 0px 0px, 0px 0px, 0px 0px'}, - {at: 0.25, is: ' 5px 5px, 10px 10px, 15px 15px, 25px 25px'}, - {at: 0.5, is: '10px 10px, 20px 20px, 30px 30px, 50px 50px'}, - {at: 0.75, is: '15px 15px, 30px 30px, 45px 45px, 75px 75px'}, - {at: 1, is: '20px 20px, 40px 40px, 60px 60px, 100px 100px'}, - {at: 1.25, is: '25px 25px, 50px 50px, 75px 75px, 125px 125px'}, -]); - -// Single size value repeated over background images. -assertInterpolation({ - property: 'background-size', - from: '0px 0px', - to: '80px 80px', -}, [ - {at: -0.25, is: ' 0px 0px, 0px 0px, 0px 0px, 0px 0px'}, - {at: 0, is: ' 0px 0px, 0px 0px, 0px 0px, 0px 0px'}, - {at: 0.25, is: ' 20px 20px, 20px 20px, 20px 20px, 20px 20px'}, - {at: 0.5, is: ' 40px 40px, 40px 40px, 40px 40px, 40px 40px'}, - {at: 0.75, is: ' 60px 60px, 60px 60px, 60px 60px, 60px 60px'}, - {at: 1, is: ' 80px 80px, 80px 80px, 80px 80px, 80px 80px'}, - {at: 1.25, is: '100px 100px, 100px 100px, 100px 100px, 100px 100px'}, -]); - -assertInterpolation({ - property: 'background-size', - from: '0px', - to: '80px', -}, [ - {at: -0.25, is: ' 0px, 0px, 0px, 0px'}, - {at: 0, is: ' 0px, 0px, 0px, 0px'}, - {at: 0.25, is: ' 20px, 20px, 20px, 20px'}, - {at: 0.5, is: ' 40px, 40px, 40px, 40px'}, - {at: 0.75, is: ' 60px, 60px, 60px, 60px'}, - {at: 1, is: ' 80px, 80px, 80px, 80px'}, - {at: 1.25, is: '100px, 100px, 100px, 100px'}, -]); - -// Mismatched numbers of size values. -assertInterpolation({ - property: 'background-size', - from: '0px 0px, 80px 0px', - to: '40px 40px, 80px 80px, 0px 80px', -}, [ - {at: -0.25, is: ' 0px 0px, 80px 0px, 0px 0px, 90px 0px'}, - {at: 0, is: ' 0px 0px, 80px 0px, 0px 0px, 80px 0px'}, - {at: 0.25, is: '10px 10px, 80px 20px, 0px 20px, 70px 10px'}, - {at: 0.5, is: '20px 20px, 80px 40px, 0px 40px, 60px 20px'}, - {at: 0.75, is: '30px 30px, 80px 60px, 0px 60px, 50px 30px'}, - {at: 1, is: '40px 40px, 80px 80px, 0px 80px, 40px 40px'}, - {at: 1.25, is: '50px 50px, 80px 100px, 0px 100px, 30px 50px'}, -]); -</script> -</body>
diff --git a/third_party/blink/web_tests/animations/interpolation/filter-interpolation-001.html b/third_party/blink/web_tests/animations/interpolation/filter-interpolation-001.html deleted file mode 100644 index f514287..0000000 --- a/third_party/blink/web_tests/animations/interpolation/filter-interpolation-001.html +++ /dev/null
@@ -1,118 +0,0 @@ -<!DOCTYPE html> -<meta charset="UTF-8"> -<style> -.parent { - -webkit-filter: hue-rotate(30deg); -} -.target { - display: inline-block; - width: 50px; - height: 50px; - background-color: green; - color: white; - margin-right: 2px; - -webkit-filter: hue-rotate(10deg); -} -.expected { - margin-right: 20px; -} -.test { - padding-bottom: 10px; -} -</style> -<body> -<svg style="display:none"> - <filter id="svgfilter"> - <feGaussianBlur stdDeviation="5"></feGaussianBlur> - </filter> -</svg> -<script src="resources/interpolation-test.js"></script> -<script> -assertInterpolation({ - property: '-webkit-filter', - from: neutralKeyframe, - to: 'hue-rotate(20deg)', -}, [ - {at: -0.5, is: 'hue-rotate(5deg)'}, - {at: 0, is: 'hue-rotate(10deg)'}, - {at: 0.3, is: 'hue-rotate(13deg)'}, - {at: 0.6, is: 'hue-rotate(16deg)'}, - {at: 1, is: 'hue-rotate(20deg)'}, - {at: 1.5, is: 'hue-rotate(25deg)'}, -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'initial', - to: 'hue-rotate(20deg)', -}, [ - {at: -0.5, is: 'hue-rotate(-10deg)'}, - {at: 0, is: 'none'}, - {at: 0.3, is: 'hue-rotate(6deg)'}, - {at: 0.6, is: 'hue-rotate(12deg)'}, - {at: 1, is: 'hue-rotate(20deg)'}, - {at: 1.5, is: 'hue-rotate(30deg)'}, -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'inherit', - to: 'hue-rotate(20deg)', -}, [ - {at: -0.5, is: 'hue-rotate(35deg)'}, - {at: 0, is: 'hue-rotate(30deg)'}, - {at: 0.3, is: 'hue-rotate(27deg)'}, - {at: 0.6, is: 'hue-rotate(24deg)'}, - {at: 1, is: 'hue-rotate(20deg)'}, - {at: 1.5, is: 'hue-rotate(15deg)'}, -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'unset', - to: 'hue-rotate(20deg)', -}, [ - {at: -0.5, is: 'hue-rotate(-10deg)'}, - {at: 0, is: 'none'}, - {at: 0.3, is: 'hue-rotate(6deg)'}, - {at: 0.6, is: 'hue-rotate(12deg)'}, - {at: 1, is: 'hue-rotate(20deg)'}, - {at: 1.5, is: 'hue-rotate(30deg)'}, -]); - -// Matching lists: -assertInterpolation({ - property: '-webkit-filter', - from: 'hue-rotate(0deg) blur(6px)', - to: 'hue-rotate(180deg) blur(10px)' -}, [ - {at: -0.5, is: 'hue-rotate(-90deg) blur(4px)'}, - {at: 0, is: 'hue-rotate(0deg) blur(6px)'}, - {at: 0.25, is: 'hue-rotate(45deg) blur(7px)'}, - {at: 0.5, is: 'hue-rotate(90deg) blur(8px)'}, - {at: 1, is: 'hue-rotate(180deg) blur(10px)'}, - {at: 1.5, is: 'hue-rotate(270deg) blur(12px)'} -]); - -// Matching lists with differing units: -assertInterpolation({ - property: '-webkit-filter', - from: 'hue-rotate(80deg) blur(6mm)', - to: 'hue-rotate(100grad) blur(1cm)' -}, [ - {at: -0.5, is: 'hue-rotate(75deg) blur(4mm)'}, - {at: 0, is: 'hue-rotate(80deg) blur(6mm)'}, - {at: 0.25, is: 'hue-rotate(82.5deg) blur(7mm)'}, - {at: 0.5, is: 'hue-rotate(85deg) blur(8mm)'}, - {at: 1, is: 'hue-rotate(90deg) blur(10mm)'}, - {at: 1.5, is: 'hue-rotate(95deg) blur(12mm)'} -]); - -// Mismatched lists: -assertNoInterpolation({ - property: '-webkit-filter', - from: 'grayscale(0) blur(0px)', - to: 'blur(10px)' -}); -</script> -</body>
diff --git a/third_party/blink/web_tests/animations/interpolation/filter-interpolation-002.html b/third_party/blink/web_tests/animations/interpolation/filter-interpolation-002.html deleted file mode 100644 index d4f3696..0000000 --- a/third_party/blink/web_tests/animations/interpolation/filter-interpolation-002.html +++ /dev/null
@@ -1,151 +0,0 @@ -<!DOCTYPE html> -<meta charset="UTF-8"> -<style> -.target { - display: inline-block; - width: 50px; - height: 50px; - background-color: green; - color: white; - margin-right: 2px; -} -.expected { - margin-right: 20px; -} -.test { - padding-bottom: 10px; -} -</style> -<body> -<svg style="display:none"> - <filter id="svgfilter"> - <feGaussianBlur stdDeviation="5"></feGaussianBlur> - </filter> -</svg> -<script src="resources/interpolation-test.js"></script> -<script> - -// Partially matching lists: -assertInterpolation({ - property: '-webkit-filter', - from: 'none', - to: 'opacity(0.5) hue-rotate(180deg)', -}, [ - {at: -0.5, is: 'opacity(1) hue-rotate(-90deg)'}, - {at: 0, is: 'none'}, - {at: 0.25, is: 'opacity(0.875) hue-rotate(45deg)'}, - {at: 0.5, is: 'opacity(0.75) hue-rotate(90deg)'}, - {at: 1, is: 'opacity(0.5) hue-rotate(180deg)'}, - {at: 1.5, is: 'opacity(0.25) hue-rotate(270deg)'}, -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'blur(6px)', - to: 'blur(10px) hue-rotate(180deg)' -}, [ - {at: -0.5, is: 'blur(4px) hue-rotate(-90deg)'}, - {at: 0, is: 'blur(6px)'}, - {at: 0.25, is: 'blur(7px) hue-rotate(45deg)'}, - {at: 0.5, is: 'blur(8px) hue-rotate(90deg)'}, - {at: 1, is: 'blur(10px) hue-rotate(180deg)'}, - {at: 1.5, is: 'blur(12px) hue-rotate(270deg)'}, -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'none', - to: 'hue-rotate(180deg)' -}, [ - {at: -0.5, is: 'hue-rotate(-90deg)'}, - {at: 0, is: 'none'}, - {at: 0.25, is: 'hue-rotate(45deg)'}, - {at: 0.5, is: 'hue-rotate(90deg)'}, - {at: 1, is: 'hue-rotate(180deg)'}, - {at: 1.5, is: 'hue-rotate(270deg)'}, -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'hue-rotate(180deg)', - to: 'none' -}, [ - {at: -0.5, is: 'hue-rotate(270deg)'}, - {at: 0, is: 'hue-rotate(180deg)'}, - {at: 0.25, is: 'hue-rotate(135deg)'}, - {at: 0.5, is: 'hue-rotate(90deg)'}, - {at: 1, is: 'none'}, - {at: 1.5, is: 'hue-rotate(-90deg)'}, -]); - -// Filter functions (tests lacuna and clamping): -assertInterpolation({ - property: '-webkit-filter', - from: 'none', // lacuna is 0px - to: 'blur(10px)' -}, [ - {at: -1, is: 'blur(0px)'}, // Negative values are not allowed. - {at: 0, is: 'none'}, - {at: 0.5, is: 'blur(5px)'}, - {at: 1, is: 'blur(10px)'}, - {at: 1.5, is: 'blur(15px)'} -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'brightness(0)', - to: 'none' // lacuna is 1 -}, [ - {at: -1, is: 'brightness(0)'}, // Negative values are not allowed. - {at: 0, is: 'brightness(0)'}, - {at: 0.5, is: 'brightness(0.5)'}, - {at: 1, is: 'none'}, - {at: 1.5, is: 'brightness(1.5)'} -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'contrast(0)', - to: 'none' // lacuna is 1 -}, [ - {at: -1, is: 'contrast(0)'}, // Negative values are not allowed. - {at: 0, is: 'contrast(0)'}, - {at: 0.5, is: 'contrast(0.5)'}, - {at: 1, is: 'none'}, - {at: 1.5, is: 'contrast(1.5)'} -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'none', // lacuna is drop-shadow(0px 0px 0px transparent) - to: 'drop-shadow(20px 10px green)' -}, [ - {at: -1, is: 'drop-shadow(-20px -10px transparent)'}, - {at: 0, is: 'none'}, - {at: 0.5, is: 'drop-shadow(10px 5px rgba(0, 128, 0, 0.5))'}, - {at: 1, is: 'drop-shadow(20px 10px green)'}, - {at: 1.5, is: 'drop-shadow(30px 15px #00C000)'} -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'drop-shadow(0px 0px 0px currentcolor)', - to: 'drop-shadow(20px 10px green)' -}, [ - {at: -1, is: 'drop-shadow(-20px -10px white)'}, - {at: 0, is: 'drop-shadow(0px 0px 0px currentcolor)'}, - {at: 0.5, is: 'drop-shadow(10px 5px #80C080)'}, - {at: 1, is: 'drop-shadow(20px 10px green)'}, - {at: 1.5, is: 'drop-shadow(30px 15px #004100)'} -]); - -// crbug.com/904333: Test that ResolveInterpolableColor doesn't overflow. -assertInterpolation({ - property: '-webkit-filter', - from: 'drop-shadow(20px 10px blue)', - to: 'drop-shadow(20px 10px green)' -}, [ - {at: 2147483648, is: 'drop-shadow(20px 10px #00FF00'} -]); -</script> -</body>
diff --git a/third_party/blink/web_tests/animations/interpolation/filter-interpolation-003.html b/third_party/blink/web_tests/animations/interpolation/filter-interpolation-003.html deleted file mode 100644 index 4f9d71ee..0000000 --- a/third_party/blink/web_tests/animations/interpolation/filter-interpolation-003.html +++ /dev/null
@@ -1,125 +0,0 @@ -<!DOCTYPE html> -<meta charset="UTF-8"> -<style> -.target { - display: inline-block; - width: 50px; - height: 50px; - background-color: green; - color: white; - margin-right: 2px; - -webkit-filter: hue-rotate(10deg); -} -.expected { - margin-right: 20px; -} -.test { - padding-bottom: 10px; -} -</style> -<body> -<svg style="display:none"> - <filter id="svgfilter"> - <feGaussianBlur stdDeviation="5"></feGaussianBlur> - </filter> -</svg> -<script src="resources/interpolation-test.js"></script> -<script> - -assertInterpolation({ - property: '-webkit-filter', - from: 'none', // lacuna is 0 - to: 'grayscale(1)' -}, [ - {at: -1, is: 'grayscale(0)'}, // Negative values are not allowed. - {at: 0, is: 'none'}, - {at: 0.5, is: 'grayscale(0.5)'}, - {at: 1, is: 'grayscale(1)'}, - {at: 1.5, is: 'grayscale(1)'} // Should clamp values to 1. -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'none', // lacuna is 0deg - to: 'hue-rotate(360deg)' -}, [ - {at: -1, is: 'hue-rotate(-360deg)'}, - {at: 0, is: 'none'}, - {at: 0.5, is: 'hue-rotate(180deg)'}, - {at: 1, is: 'hue-rotate(360deg)'}, - {at: 1.5, is: 'hue-rotate(540deg)'} -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'none', // lacuna is 0 - to: 'invert(1)' -}, [ - {at: -1, is: 'invert(0)'}, // Negative values are not allowed. - {at: 0, is: 'none'}, - {at: 0.5, is: 'invert(0.5)'}, - {at: 1, is: 'invert(1)'}, - {at: 1.5, is: 'invert(1)'} // Should clamp values to 1. -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'opacity(0)', - to: 'none' // lacuna is 1 -}, [ - {at: -1, is: 'opacity(0)'}, // Negative values are not allowed. - {at: 0, is: 'opacity(0)'}, - {at: 0.5, is: 'opacity(0.5)'}, - {at: 1, is: 'none'}, - {at: 1.5, is: 'opacity(1)'} // Should clamp values to 1. -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'saturate(0)', - to: 'none' // lacuna is 1 -}, [ - {at: -1, is: 'saturate(0)'}, // Negative values are not allowed. - {at: 0, is: 'saturate(0)'}, - {at: 0.5, is: 'saturate(0.5)'}, - {at: 1, is: 'none'}, - {at: 1.5, is: 'saturate(1.5)'} -]); - -assertInterpolation({ - property: '-webkit-filter', - from: 'none', // lacuna is 0 - to: 'sepia(1)' -}, [ - {at: -1, is: 'sepia(0)'}, // Negative values are not allowed. - {at: 0, is: 'none'}, - {at: 0.5, is: 'sepia(0.5)'}, - {at: 1, is: 'sepia(1)'}, - {at: 1.5, is: 'sepia(1)'} // Should clamp values to 1. -]); - -assertNoInterpolation({ - property: '-webkit-filter', - from: 'url("#svgfilter")', - to: 'none', // lacuna is not defined -}); - -assertNoInterpolation({ - property: '-webkit-filter', - from: 'url("#svgfilter")', - to: 'blur(5px)', -}); - -assertInterpolation({ - property: '-webkit-filter', - from: 'initial', // lacuna is 0 - to: 'sepia(1)' -}, [ - {at: -1, is: 'sepia(0)'}, // Negative values are not allowed. - {at: 0, is: 'none'}, // Equivalent to sepia(0) - {at: 0.5, is: 'sepia(0.5)'}, - {at: 1, is: 'sepia(1)'}, - {at: 1.5, is: 'sepia(1)'} // Should clamp values to 1. -]); -</script> -</body>
diff --git a/third_party/blink/web_tests/animations/interpolation/filter-interpolation-004.html b/third_party/blink/web_tests/animations/interpolation/filter-interpolation-004.html deleted file mode 100644 index fb293da..0000000 --- a/third_party/blink/web_tests/animations/interpolation/filter-interpolation-004.html +++ /dev/null
@@ -1,131 +0,0 @@ -<!DOCTYPE html> -<meta charset="UTF-8"> -<style> -.target { - color: blue; -} -</style> -<body> -<script src="resources/interpolation-test.js"></script> -<script> -assertInterpolation({ - property: 'filter', - from: 'blur()', // Default value when omitted is 0px. - to: 'blur(10px)' -}, [ - {at: -1, is: 'blur(0px)'}, // Negative values are not allowed. - {at: 0, is: 'blur()'}, - {at: 0.5, is: 'blur(5px)'}, - {at: 1, is: 'blur(10px)'}, - {at: 1.5, is: 'blur(15px)'} -]); - -assertInterpolation({ - property: 'filter', - from: 'brightness(0)', - to: 'brightness()' // Default value when omitted is 1. -}, [ - {at: -1, is: 'brightness(0)'}, // Negative values are not allowed. - {at: 0, is: 'brightness(0)'}, - {at: 0.5, is: 'brightness(0.5)'}, - {at: 1, is: 'brightness()'}, - {at: 1.5, is: 'brightness(1.5)'} -]); - -assertInterpolation({ - property: 'filter', - from: 'contrast(0)', - to: 'contrast()' // Default value when omitted is 1. -}, [ - {at: -1, is: 'contrast(0)'}, // Negative values are not allowed. - {at: 0, is: 'contrast(0)'}, - {at: 0.5, is: 'contrast(0.5)'}, - {at: 1, is: 'contrast()'}, - {at: 1.5, is: 'contrast(1.5)'} -]); - -assertInterpolation({ - property: 'filter', - from: 'drop-shadow(0px 0px)', // The default value for omitted values is missing length values set to 0 and the missing used color is taken from the color property. - to: 'drop-shadow(20px 10px 30px green)' -}, [ - {at: -1, is: 'drop-shadow(-20px -10px blue)'}, - {at: 0, is: 'drop-shadow(0px 0px blue)'}, - {at: 0.5, is: 'drop-shadow(10px 5px 15px rgb(0, 64, 128))'}, - {at: 1, is: 'drop-shadow(20px 10px 30px green)'}, - {at: 1.5, is: 'drop-shadow(30px 15px 45px rgb(0, 192, 0))'} -]); - -assertInterpolation({ - property: 'filter', - from: 'grayscale(0)', - to: 'grayscale()' // Default value when omitted is 1. -}, [ - {at: -1, is: 'grayscale(0)'}, // Negative values are not allowed. - {at: 0, is: 'grayscale(0)'}, - {at: 0.5, is: 'grayscale(0.5)'}, - {at: 1, is: 'grayscale()'}, - {at: 1.5, is: 'grayscale(1)'} // Should clamp values to 1. -]); - -assertInterpolation({ - property: 'filter', - from: 'hue-rotate()', // Default value when omitted is 0deg. - to: 'hue-rotate(360deg)' -}, [ - {at: -1, is: 'hue-rotate(-360deg)'}, - {at: 0, is: 'hue-rotate()'}, - {at: 0.5, is: 'hue-rotate(180deg)'}, - {at: 1, is: 'hue-rotate(360deg)'}, - {at: 1.5, is: 'hue-rotate(540deg)'} -]); - -assertInterpolation({ - property: 'filter', - from: 'invert(0)', - to: 'invert()' // Default value when omitted is 1. -}, [ - {at: -1, is: 'invert(0)'}, // Negative values are not allowed. - {at: 0, is: 'invert(0)'}, - {at: 0.5, is: 'invert(0.5)'}, - {at: 1, is: 'invert()'}, - {at: 1.5, is: 'invert(1)'} // Should clamp values to 1. -]); - -assertInterpolation({ - property: 'filter', - from: 'opacity(0)', - to: 'opacity()' // Default value when omitted is 1. -}, [ - {at: -1, is: 'opacity(0)'}, // Negative values are not allowed. - {at: 0, is: 'opacity(0)'}, - {at: 0.5, is: 'opacity(0.5)'}, - {at: 1, is: 'opacity()'}, - {at: 1.5, is: 'opacity(1)'} // Should clamp values to 1. -]); - -assertInterpolation({ - property: 'filter', - from: 'saturate(0)', - to: 'saturate()' // Default value when omitted is 1. -}, [ - {at: -1, is: 'saturate(0)'}, // Negative values are not allowed. - {at: 0, is: 'saturate(0)'}, - {at: 0.5, is: 'saturate(0.5)'}, - {at: 1, is: 'saturate()'}, - {at: 1.5, is: 'saturate(1.5)'} -]); - -assertInterpolation({ - property: 'filter', - from: 'sepia(0)', - to: 'sepia()' // Default value when omitted is 1. -}, [ - {at: -1, is: 'sepia(0)'}, // Negative values are not allowed. - {at: 0, is: 'sepia(0)'}, - {at: 0.5, is: 'sepia(0.5)'}, - {at: 1, is: 'sepia()'}, - {at: 1.5, is: 'sepia(1)'} // Should clamp values to 1. -]); -</script> -</body>
diff --git a/third_party/blink/web_tests/animations/interpolation/font-size-adjust-interpolation.html b/third_party/blink/web_tests/animations/interpolation/font-size-adjust-interpolation.html deleted file mode 100644 index 30b64b2..0000000 --- a/third_party/blink/web_tests/animations/interpolation/font-size-adjust-interpolation.html +++ /dev/null
@@ -1,118 +0,0 @@ -<!DOCTYPE html> -<style type="text/css"> -.container { - font-size: 20px; - line-height: 1; -} - -@font-face { - font-family : 'testFont'; - src : url('../../resources/opensans/OpenSans-Regular.woff') format("woff"); -} - -.parent { - font-size-adjust: 3; -} - -.target { - display: inline-block; - font-family: testFont; - font-size-adjust: 1; -} - -.expected { - color: green; - margin-right: 30px; -} -</style> - -<template id="target-template"> - <span class="container"> - <div class="target">x</span> - </div> -</template> -<script src="resources/interpolation-test.js"></script> -<script> -assertInterpolation({ - property: 'font-size-adjust', - from: neutralKeyframe, - to: '2', -}, [ - {at: -2, is: '0'}, - {at: -0.3, is: '0.7'}, - {at: 0, is: '1'}, - {at: 0.3, is: '1.3'}, - {at: 0.6, is: '1.6'}, - {at: 1, is: '2'}, - {at: 1.5, is: '2.5'}, -]); - -assertNoInterpolation({ - property: 'font-size-adjust', - from: 'initial', - to: '2', -}); - -assertInterpolation({ - property: 'font-size-adjust', - from: 'inherit', - to: '2', -}, [ - {at: -2, is: '5'}, - {at: -0.3, is: '3.3'}, - {at: 0, is: '3'}, - {at: 0.3, is: '2.7'}, - {at: 0.6, is: '2.4'}, - {at: 1, is: '2'}, - {at: 1.5, is: '1.5'}, -]); - -assertInterpolation({ - property: 'font-size-adjust', - from: 'unset', - to: '2', -}, [ - {at: -2, is: '5'}, - {at: -0.3, is: '3.3'}, - {at: 0, is: '3'}, - {at: 0.3, is: '2.7'}, - {at: 0.6, is: '2.4'}, - {at: 1, is: '2'}, - {at: 1.5, is: '1.5'}, -]); - - -assertInterpolation({ - property: 'font-size-adjust', - from: '0', - to: '1.2' -}, [ - {at: -2, is: '0'}, - {at: -0.3, is: '0'}, - {at: 0, is: '0'}, - {at: 0.3, is: '0.36'}, - {at: 0.6, is: '0.72'}, - {at: 1, is: '1.2'}, - {at: 1.5, is: '1.8'}, -]); - -assertNoInterpolation({ - property: 'font-size-adjust', - from: 'none', - to: '1.2' -}); - -assertInterpolation({ - property: 'font-size-adjust', - from: '0.2', - to: '1.2' -}, [ - {at: -2, is: '0'}, // CSS font-size-adjust can't be negative. - {at: -0.3, is: '0'}, - {at: 0, is: '0.2'}, - {at: 0.3, is: '0.5'}, - {at: 0.6, is: '0.8'}, - {at: 1, is: '1.2'}, - {at: 1.5, is: '1.7'}, -]); -</script>
diff --git a/third_party/blink/web_tests/animations/interpolation/font-size-interpolation-unset.html b/third_party/blink/web_tests/animations/interpolation/font-size-interpolation-unset.html deleted file mode 100644 index a56249b..0000000 --- a/third_party/blink/web_tests/animations/interpolation/font-size-interpolation-unset.html +++ /dev/null
@@ -1,39 +0,0 @@ -<!DOCTYPE html> -<meta charset="UTF-8"> -<style> -.container { - font-size: 10px; -} -.target { - display: inline-block; - font: 100px sans-serif; - font-size: 20px; -} -.expected { - color: green; - margin-right: 30px; -} -</style> -<body> -<template id="target-template"> - <span class="container"> - <div class="target">TT</div> - </span> -</template> -<script src="resources/interpolation-test.js"></script> -<script> -assertInterpolation({ - property: 'font-size', - from: 'unset', - to: '20px' -}, [ - {at: -2, is: '0px'}, // CSS font-size can't be negative. - {at: -0.3, is: '7px'}, - {at: 0, is: '10px'}, - {at: 0.3, is: '13px'}, - {at: 0.6, is: '16px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '25px'}, -]); -</script> -</body>
diff --git a/third_party/blink/web_tests/animations/interpolation/font-size-interpolation.html b/third_party/blink/web_tests/animations/interpolation/font-size-interpolation.html deleted file mode 100644 index d194789..0000000 --- a/third_party/blink/web_tests/animations/interpolation/font-size-interpolation.html +++ /dev/null
@@ -1,94 +0,0 @@ -<!DOCTYPE html> -<meta charset="UTF-8"> -<style> -.parent { - font-size: 30px; -} -.target { - display: inline-block; - font: 10px sans-serif; -} -.expected { - color: green; - margin-right: 30px; -} -</style> -<body> -<template id="target-template"> - <span> - <div class="target">Test Text</div> - </span> -</template> -<script src="resources/interpolation-test.js"></script> -<script> -assertInterpolation({ - property: 'font-size', - from: neutralKeyframe, - to: '20px', -}, [ - {at: -2, is: '0px'}, - {at: -0.3, is: '7px'}, - {at: 0, is: '10px'}, - {at: 0.3, is: '13px'}, - {at: 0.6, is: '16px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '25px'}, -]); - -assertInterpolation({ - property: 'font-size', - from: 'initial', - to: '20px', -}, [ - {at: -2, is: '8px'}, - {at: -0.3, is: '14.8px'}, - {at: 0, is: '16px'}, - {at: 0.3, is: '17.2px'}, - {at: 0.6, is: '18.4px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '22px'}, -]); - -assertInterpolation({ - property: 'font-size', - from: 'inherit', - to: '20px', -}, [ - {at: -2, is: '50px'}, - {at: -0.3, is: '33px'}, - {at: 0, is: '30px'}, - {at: 0.3, is: '27px'}, - {at: 0.6, is: '24px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '15px'}, -]); - -assertInterpolation({ - property: 'font-size', - from: 'unset', - to: '20px', -}, [ - {at: -2, is: '50px'}, - {at: -0.3, is: '33px'}, - {at: 0, is: '30px'}, - {at: 0.3, is: '27px'}, - {at: 0.6, is: '24px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '15px'}, -]); - -assertInterpolation({ - property: 'font-size', - from: '4px', - to: '14px' -}, [ - {at: -2, is: '0px'}, // CSS font-size can't be negative. - {at: -0.3, is: '1px'}, - {at: 0, is: '4px'}, - {at: 0.3, is: '7px'}, - {at: 0.6, is: '10px'}, - {at: 1, is: '14px'}, - {at: 1.5, is: '19px'}, -]); -</script> -</body>
diff --git a/third_party/blink/web_tests/animations/interpolation/font-size-zoom-interpolation.html b/third_party/blink/web_tests/animations/interpolation/font-size-zoom-interpolation.html deleted file mode 100644 index c69c8df4..0000000 --- a/third_party/blink/web_tests/animations/interpolation/font-size-zoom-interpolation.html +++ /dev/null
@@ -1,34 +0,0 @@ -<!DOCTYPE html> -<style> -.container { - zoom: 2; -} -.target { - display: inline-block; -} -.expected { - color: green; - margin-right: 30px; -} -</style> -<template id="target-template"> - <span class="container"> - <div class="target">TT</div> - </span> -</template> -<script src="resources/interpolation-test.js"></script> -<script> -assertInterpolation({ - property: 'font-size', - from: '10px', - to: '20px' -}, [ - {at: -2, is: '0px'}, // CSS font-size can't be negative. - {at: -0.3, is: '7px'}, - {at: 0, is: '10px'}, - {at: 0.3, is: '13px'}, - {at: 0.6, is: '16px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '25px'}, -]); -</script>
diff --git a/third_party/blink/web_tests/animations/interpolation/font-variation-settings-interpolation.html b/third_party/blink/web_tests/animations/interpolation/font-variation-settings-interpolation.html deleted file mode 100644 index c0b90ce..0000000 --- a/third_party/blink/web_tests/animations/interpolation/font-variation-settings-interpolation.html +++ /dev/null
@@ -1,122 +0,0 @@ -<!DOCTYPE html> -<body> -<style> -.parent { - font-variation-settings: "test" 30; -} -.target { - font-variation-settings: "test" 10; -} -</style> -<script src="resources/interpolation-test.js"></script> -<script> -assertInterpolation({ - property: 'font-variation-settings', - from: neutralKeyframe, - to: '"test" 20', -}, [ - {at: -0.5, is: "'test' 5"}, - {at: 0, is: "'test' 10"}, - {at: 0.3, is: "'test' 13"}, - {at: 0.7, is: "'test' 17"}, - {at: 1, is: "'test' 20"}, - {at: 1.5, is: "'test' 25"}, -]); - -assertNoInterpolation({ - property: 'font-variation-settings', - from: 'initial', - to: "'test' 50", -}); - -assertInterpolation({ - property: 'font-variation-settings', - from: 'inherit', - to: "'test' 20", -}, [ - {at: -0.5, is: "'test' 35"}, - {at: 0, is: "'test' 30"}, - {at: 0.3, is: "'test' 27"}, - {at: 0.7, is: "'test' 23"}, - {at: 1, is: "'test' 20"}, - {at: 1.5, is: "'test' 15"}, -]); - -assertInterpolation({ - property: 'font-variation-settings', - from: 'unset', - to: "'test' 20", -}, [ - {at: -0.5, is: "'test' 35"}, - {at: 0, is: "'test' 30"}, - {at: 0.3, is: "'test' 27"}, - {at: 0.7, is: "'test' 23"}, - {at: 1, is: "'test' 20"}, - {at: 1.5, is: "'test' 15"}, -]); - -assertNoInterpolation({ - property: 'font-variation-settings', - from: "'test' 20", - to: "normal", -}); - -assertInterpolation({ - property: 'font-variation-settings', - from: "'test' 20", - to: "'test' 30", -}, [ - {at: -0.5, is: "'test' 15"}, - {at: 0, is: "'test' 20"}, - {at: 0.3, is: "'test' 23"}, - {at: 0.7, is: "'test' 27"}, - {at: 1, is: "'test' 30"}, - {at: 1.5, is: "'test' 35"}, -]); - -assertInterpolation({ - property: 'font-variation-settings', - from: "'aaaa' 0, 'bbbb' 10, 'cccc' 20", - to: "'aaaa' 10, 'bbbb' 20, 'cccc' 30", -}, [ - {at: -0.5, is: "'aaaa' -5, 'bbbb' 5, 'cccc' 15"}, - {at: 0, is: "'aaaa' 0, 'bbbb' 10, 'cccc' 20"}, - {at: 0.3, is: "'aaaa' 3, 'bbbb' 13, 'cccc' 23"}, - {at: 0.7, is: "'aaaa' 7, 'bbbb' 17, 'cccc' 27"}, - {at: 1, is: "'aaaa' 10, 'bbbb' 20, 'cccc' 30"}, - {at: 1.5, is: "'aaaa' 15, 'bbbb' 25, 'cccc' 35"}, -]); - -assertNoInterpolation({ - property: 'font-variation-settings', - from: "'aaaa' 0, 'bbbb' 10", - to: "'aaaa' 10, 'bbbb' 20, 'cccc' 30", -}); - -assertNoInterpolation({ - property: 'font-variation-settings', - from: "'aaaa' 10, 'bbbb' 20, 'cccc' 30", - to: "'aaaa' 0, 'bbbb' 10", -}); - -assertNoInterpolation({ - property: 'font-variation-settings', - from: "'aaaa' 0, 'bbbb' 10, 'cccc' 20", - to: "'cccc' 10, 'bbbb' 20, 'aaaa' 30", -}); - -assertNoInterpolation({ - property: 'font-variation-settings', - from: "'aaaa' 0, 'bbbb' 10, 'cccc' 20", - to: "'dddd' 10, 'eeee' 20, 'ffff' 30", -}); - -// crbug.com/910118: Test that ApplyStandardPropertyValue doesn't overflow. -assertInterpolation({ - property: 'font-variation-settings', - from: "'aaaa' 30, 'bbbb' 20", - to: "'aaaa' 20, 'bbbb' 30", -}, [ - {at: 3.40282e+38, is: "'aaaa' -3.40282e+38, 'bbbb' 3.40282e+38"}, -]); -</script>
diff --git a/third_party/blink/web_tests/animations/interpolation/letter-spacing-interpolation.html b/third_party/blink/web_tests/animations/interpolation/letter-spacing-interpolation.html deleted file mode 100644 index ac2a7a9..0000000 --- a/third_party/blink/web_tests/animations/interpolation/letter-spacing-interpolation.html +++ /dev/null
@@ -1,99 +0,0 @@ -<!DOCTYPE html> -<meta charset="UTF-8"> -<style> -.parent { - letter-spacing: 2px; -} -.target { - font: 10px sans-serif; - font-weight: bold; - letter-spacing: 30px; -} -.expected { - color: green; - margin-right: 30px; -} -</style> -<body> -<template id="target-template">TT</template> -<script src="resources/interpolation-test.js"></script> -<script> -assertInterpolation({ - property: 'letter-spacing', - from: neutralKeyframe, - to: '20px', -}, [ - {at: -0.3, is: '33px'}, - {at: 0, is: '30px'}, - {at: 0.3, is: '27px'}, - {at: 0.6, is: '24px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '15px'}, -]); - -assertInterpolation({ - property: 'letter-spacing', - from: 'initial', - to: '20px', -}, [ - {at: -0.3, is: '-6px'}, - {at: 0, is: 'normal'}, - {at: 0.3, is: '6px'}, - {at: 0.6, is: '12px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '30px'}, -]); - -assertInterpolation({ - property: 'letter-spacing', - from: 'inherit', - to: '20px', -}, [ - {at: -0.3, is: '-3.4px'}, - {at: 0, is: '2px'}, - {at: 0.3, is: '7.4px'}, - {at: 0.6, is: '12.8px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '29px'}, -]); - -assertInterpolation({ - property: 'letter-spacing', - from: 'unset', - to: '20px', -}, [ - {at: -0.3, is: '-3.4px'}, - {at: 0, is: '2px'}, - {at: 0.3, is: '7.4px'}, - {at: 0.6, is: '12.8px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '29px'}, -]); - -assertInterpolation({ - property: 'letter-spacing', - from: '-10px', - to: '10px', -}, [ - {at: -0.3, is: '-16px'}, - {at: 0, is: '-10px'}, - {at: 0.3, is: '-4px'}, - {at: 0.6, is: '2px'}, - {at: 1, is: '10px'}, - {at: 1.5, is: '20px'}, -]); - -assertInterpolation({ - property: 'letter-spacing', - from: 'normal', - to: '10px', -}, [ - {at: -0.3, is: '-3px'}, - {at: 0, is: 'normal'}, - {at: 0.3, is: '3px'}, - {at: 0.6, is: '6px'}, - {at: 1, is: '10px'}, - {at: 1.5, is: '15px'}, -]); -</script> -</body>
diff --git a/third_party/blink/web_tests/animations/interpolation/text-indent-interpolation.html b/third_party/blink/web_tests/animations/interpolation/text-indent-interpolation.html deleted file mode 100644 index a1508194f..0000000 --- a/third_party/blink/web_tests/animations/interpolation/text-indent-interpolation.html +++ /dev/null
@@ -1,123 +0,0 @@ -<!DOCTYPE html> -<meta charset="UTF-8"> -<style> -.parent { - text-indent: 70px; -} -.target { - font: 10px sans-serif; - text-indent: 10px; - margin-left: 20px; -} -.expected { - color: green; -} -</style> -<body> -<script src="resources/interpolation-test.js"></script> -<template id="target-template">T</template> -<script> -assertInterpolation({ - property: 'text-indent', - from: neutralKeyframe, - to: '40px', -}, [ - {at: -0.3, is: '1px'}, - {at: 0, is: '10px'}, - {at: 0.3, is: '19px'}, - {at: 0.6, is: '28px'}, - {at: 1, is: '40px'}, - {at: 1.5, is: '55px'}, -]); - -assertInterpolation({ - property: 'text-indent', - from: 'initial', - to: '20px', -}, [ - {at: -0.3, is: '-6px'}, - {at: 0, is: '0px'}, - {at: 0.3, is: '6px'}, - {at: 0.6, is: '12px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '30px'}, -]); - -assertInterpolation({ - property: 'text-indent', - from: 'inherit', - to: '20px', -}, [ - {at: -0.3, is: '85px'}, - {at: 0, is: '70px'}, - {at: 0.3, is: '55px'}, - {at: 0.6, is: '40px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '-5px'}, -]); - -assertInterpolation({ - property: 'text-indent', - from: 'unset', - to: '20px', -}, [ - {at: -0.3, is: '85px'}, - {at: 0, is: '70px'}, - {at: 0.3, is: '55px'}, - {at: 0.6, is: '40px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '-5px'}, -]); - -assertInterpolation({ - property: 'text-indent', - from: '0px', - to: '50px' -}, [ - {at: -0.3, is: '-15px'}, - {at: 0, is: '0'}, - {at: 0.3, is: '15px'}, - {at: 0.6, is: '30px'}, - {at: 1, is: '50px'}, - {at: 1.5, is: '75px'}, -]); - -assertInterpolation({ - property: 'text-indent', - from: '0px hanging', - to: '50px hanging', -}, [ - {at: -0.3, is: '-15px hanging'}, - {at: 0, is: '0 hanging'}, - {at: 0.3, is: '15px hanging'}, - {at: 0.6, is: '30px hanging'}, - {at: 1, is: '50px hanging'}, - {at: 1.5, is: '75px hanging'}, -]); - -assertInterpolation({ - property: 'text-indent', - from: '0px hanging each-line', - to: '50px each-line hanging', -}, [ - {at: -0.3, is: '-15px hanging each-line'}, - {at: 0, is: '0 hanging each-line'}, - {at: 0.3, is: '15px hanging each-line'}, - {at: 0.6, is: '30px hanging each-line'}, - {at: 1, is: '50px hanging each-line'}, - {at: 1.5, is: '75px hanging each-line'}, -]); - -assertNoInterpolation({ - property: 'text-indent', - from: '0px each-line', - to: '50px hanging', -}); - -assertNoInterpolation({ - property: 'text-indent', - from: '0px', - to: '50px each-line hanging', -}); -</script> -</body>
diff --git a/third_party/blink/web_tests/animations/interpolation/word-spacing-interpolation.html b/third_party/blink/web_tests/animations/interpolation/word-spacing-interpolation.html deleted file mode 100644 index d04d3b3..0000000 --- a/third_party/blink/web_tests/animations/interpolation/word-spacing-interpolation.html +++ /dev/null
@@ -1,96 +0,0 @@ -<!DOCTYPE html> -<meta charset="UTF-8"> -<style> -.parent { - word-spacing: 30px; -} -.target { - font: 10px sans-serif; - word-spacing: 10px; -} -.expected { - color: green; -} -</style> -<body> -<template id="target-template">A B C D</template> -<script src="resources/interpolation-test.js"></script> -<script> -assertInterpolation({ - property: 'word-spacing', - from: neutralKeyframe, - to: '20px', -}, [ - {at: -0.3, is: '7px'}, - {at: 0, is: '10px'}, - {at: 0.3, is: '13px'}, - {at: 0.6, is: '16px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '25px'}, -]); - -assertInterpolation({ - property: 'word-spacing', - from: 'initial', - to: '20px', -}, [ - {at: -0.3, is: '-6px'}, - {at: 0, is: '0px'}, - {at: 0.3, is: '6px'}, - {at: 0.6, is: '12px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '30px'}, -]); - -assertInterpolation({ - property: 'word-spacing', - from: 'inherit', - to: '20px', -}, [ - {at: -0.3, is: '33px'}, - {at: 0, is: '30px'}, - {at: 0.3, is: '27px'}, - {at: 0.6, is: '24px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '15px'}, -]); - -assertInterpolation({ - property: 'word-spacing', - from: 'unset', - to: '20px', -}, [ - {at: -0.3, is: '33px'}, - {at: 0, is: '30px'}, - {at: 0.3, is: '27px'}, - {at: 0.6, is: '24px'}, - {at: 1, is: '20px'}, - {at: 1.5, is: '15px'}, -]); - -assertInterpolation({ - property: 'word-spacing', - from: '-10px', - to: '40px' -}, [ - {at: -0.3, is: '-25px'}, - {at: 0, is: '-10px'}, - {at: 0.3, is: '5px'}, - {at: 0.6, is: '20px'}, - {at: 1, is: '40px'}, - {at: 1.5, is: '65px'}, -]); -assertInterpolation({ - property: 'word-spacing', - from: 'normal', - to: '10px' -}, [ - {at: -0.3, is: '-3px'}, - {at: 0, is: '0px'}, - {at: 0.3, is: '3px'}, - {at: 0.6, is: '6px'}, - {at: 1, is: '10px'}, - {at: 1.5, is: '15px'}, -]); -</script> -</body>
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json index 4ab41be..26c8af2a 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json
@@ -154455,18 +154455,6 @@ "fetch/corb/resources/subframe-that-posts-html-containing-blob-url-to-parent.html": [ [] ], - "fetch/cors-rfc1918/idlharness.tentative.any-expected.txt": [ - [] - ], - "fetch/cors-rfc1918/idlharness.tentative.any.serviceworker-expected.txt": [ - [] - ], - "fetch/cors-rfc1918/idlharness.tentative.any.sharedworker-expected.txt": [ - [] - ], - "fetch/cors-rfc1918/idlharness.tentative.any.worker-expected.txt": [ - [] - ], "fetch/cross-origin-resource-policy/OWNERS": [ [] ], @@ -155424,9 +155412,6 @@ "html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/post_name_on_load.html": [ [] ], - "html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin-expected.txt": [ - [] - ], "html/browsers/browsing-the-web/history-traversal/resources/a.html": [ [] ], @@ -209552,6 +209537,36 @@ {} ] ], + "css/css-sizing/animation/height-interpolation.html": [ + [ + "css/css-sizing/animation/height-interpolation.html", + {} + ] + ], + "css/css-sizing/animation/max-height-interpolation.html": [ + [ + "css/css-sizing/animation/max-height-interpolation.html", + {} + ] + ], + "css/css-sizing/animation/max-width-interpolation.html": [ + [ + "css/css-sizing/animation/max-width-interpolation.html", + {} + ] + ], + "css/css-sizing/animation/min-height-interpolation.html": [ + [ + "css/css-sizing/animation/min-height-interpolation.html", + {} + ] + ], + "css/css-sizing/animation/min-width-interpolation.html": [ + [ + "css/css-sizing/animation/min-width-interpolation.html", + {} + ] + ], "css/css-sizing/animation/width-interpolation.html": [ [ "css/css-sizing/animation/width-interpolation.html", @@ -210680,6 +210695,24 @@ {} ] ], + "css/css-text/animations/letter-spacing-interpolation.html": [ + [ + "css/css-text/animations/letter-spacing-interpolation.html", + {} + ] + ], + "css/css-text/animations/text-indent-interpolation.html": [ + [ + "css/css-text/animations/text-indent-interpolation.html", + {} + ] + ], + "css/css-text/animations/word-spacing-interpolation.html": [ + [ + "css/css-text/animations/word-spacing-interpolation.html", + {} + ] + ], "css/css-text/i18n/css3-text-line-break-baspglwj-001.html": [ [ "css/css-text/i18n/css3-text-line-break-baspglwj-001.html", @@ -243759,6 +243792,12 @@ {} ] ], + "html/semantics/embedded-content/the-img-element/historical-progress-event.window.js": [ + [ + "html/semantics/embedded-content/the-img-element/historical-progress-event.window.html", + {} + ] + ], "html/semantics/embedded-content/the-img-element/img.complete.html": [ [ "html/semantics/embedded-content/the-img-element/img.complete.html", @@ -244021,9 +244060,9 @@ {} ] ], - "html/semantics/forms/autofocus/no-cross-origin-autofocus.sub.html": [ + "html/semantics/forms/autofocus/no-cross-origin-autofocus.html": [ [ - "html/semantics/forms/autofocus/no-cross-origin-autofocus.sub.html", + "html/semantics/forms/autofocus/no-cross-origin-autofocus.html", { "testdriver": true } @@ -252232,6 +252271,18 @@ {} ] ], + "largest-contentful-paint/larger-image.html": [ + [ + "largest-contentful-paint/larger-image.html", + {} + ] + ], + "largest-contentful-paint/larger-text.html": [ + [ + "largest-contentful-paint/larger-text.html", + {} + ] + ], "largest-contentful-paint/loadTime-after-appendChild.html": [ [ "largest-contentful-paint/loadTime-after-appendChild.html", @@ -291263,12 +291314,6 @@ {} ] ], - "trusted-types/TrustedTypePolicy-exposed.tentative.html": [ - [ - "trusted-types/TrustedTypePolicy-exposed.tentative.html", - {} - ] - ], "trusted-types/TrustedTypePolicy-name.tentative.html": [ [ "trusted-types/TrustedTypePolicy-name.tentative.html", @@ -291305,24 +291350,18 @@ {} ] ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-defaultTests.tentative.html": [ - [ - "trusted-types/TrustedTypePolicyFactory-createPolicy-defaultTests.tentative.html", - {} - ] - ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-exposedTests.tentative.html": [ - [ - "trusted-types/TrustedTypePolicyFactory-createPolicy-exposedTests.tentative.html", - {} - ] - ], "trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html": [ [ "trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html", {} ] ], + "trusted-types/TrustedTypePolicyFactory-defaultPolicy.tentative.html": [ + [ + "trusted-types/TrustedTypePolicyFactory-defaultPolicy.tentative.html", + {} + ] + ], "trusted-types/TrustedTypePolicyFactory-isXXX.tentative.html": [ [ "trusted-types/TrustedTypePolicyFactory-isXXX.tentative.html", @@ -377623,8 +377662,28 @@ "086e654a8e039f259b5e828d024f808c2e95016b", "support" ], + "css/css-sizing/animation/height-interpolation.html": [ + "10ceed5b2cc0d5511b8020aeaced36be39834c3a", + "testharness" + ], + "css/css-sizing/animation/max-height-interpolation.html": [ + "c4cab0e1cf4534d3705801f3159b6b8724977b66", + "testharness" + ], + "css/css-sizing/animation/max-width-interpolation.html": [ + "111199baa7ed89c6023d43b56313413cc5aeeeeb", + "testharness" + ], + "css/css-sizing/animation/min-height-interpolation.html": [ + "6fd5b4e2f5366f6b18678f60b982e82905558e51", + "testharness" + ], + "css/css-sizing/animation/min-width-interpolation.html": [ + "d11fb3d5cb139f870d1eb40618bf547176f109b1", + "testharness" + ], "css/css-sizing/animation/width-interpolation.html": [ - "33bc1b14c83f45afbea4cdfadbe3959ac829e615", + "16b67c5ed66b769359e24df7c17f9d7baf0a46e9", "testharness" ], "css/css-sizing/aspect-ratio-affects-container-width-when-height-changes.html": [ @@ -380199,6 +380258,18 @@ "9b2e5be0a19c48f73b57fe0ad8bbeea81238a1d1", "support" ], + "css/css-text/animations/letter-spacing-interpolation.html": [ + "7d4958113915913bb8a3a5af13f5cee90b080825", + "testharness" + ], + "css/css-text/animations/text-indent-interpolation.html": [ + "2269fdfa5b60f6f4a8d63a7f777e6abbf499c4b7", + "testharness" + ], + "css/css-text/animations/word-spacing-interpolation.html": [ + "ffd6bb476ad87976a1183cde70a10892bab77982", + "testharness" + ], "css/css-text/boundary-shaping/boundary-shaping-001.html": [ "d6c8fa2b236f56e11f07b15c491321e062972ca3", "reftest" @@ -402156,11 +402227,11 @@ "reftest" ], "css/css-writing-modes/reference/available-size-001-ref.html": [ - "84252946946d4e444f8b0dd69381a1bd04554c80", + "d59cde45f6e3be71762ca4acf2711f8d3b0bc50e", "support" ], "css/css-writing-modes/reference/available-size-002-ref.html": [ - "6fdbf9a2e34173722e69e23f17d1e477bfe8b651", + "ddebe938189a6aea77066747cbe537fbd9e87719", "support" ], "css/css-writing-modes/reference/available-size-011-ref.html": [ @@ -405348,23 +405419,23 @@ "manual" ], "css/css-writing-modes/writing-mode-vlr-forms-001-manual.html": [ - "a3878d148b2c9ce87ddf7f622ef8c976fbd58cad", + "a6ce755f712b74cc093eb6accb0c9cf4a71d0656", "manual" ], "css/css-writing-modes/writing-mode-vlr-forms-002-manual.html": [ - "751057dc77c2b9ab6ee2e5041d4232f415ad7e74", + "9f331a0ec87f69c17557f12f986e6a1318f8a284", "manual" ], "css/css-writing-modes/writing-mode-vlr-forms-003-manual.html": [ - "bf3d839ec40febcbac6247e70a80d1278fdb539f", + "624cd242cb5663a555b3e2930c7dd5574950cdb8", "manual" ], "css/css-writing-modes/writing-mode-vlr-forms-004-manual.html": [ - "91f991f5285fc93f90b5e64fba7df9f62aef610f", + "ce11f1fcb6288f22020a777e66152c39e7cd11ab", "manual" ], "css/css-writing-modes/writing-mode-vlr-forms-005-manual.html": [ - "361f9dbec22857e792b61045e3b6b90ed1dae339", + "c2bf8bb00b4c068206d04d947e34c2389bd4b23b", "manual" ], "css/css-writing-modes/writing-mode-vlr-forms-006-manual.html": [ @@ -405424,23 +405495,23 @@ "manual" ], "css/css-writing-modes/writing-mode-vrl-forms-001-manual.html": [ - "20dea4fbc36e93bd6dc80164083096cb2c0ec5cc", + "6963541d38ec93d7c5c3bbb0468b83006e4faabd", "manual" ], "css/css-writing-modes/writing-mode-vrl-forms-002-manual.html": [ - "5d7db3e2a38664862a763b2abe6dd5cdc59bcf44", + "f7c1b0f69a6a5be9acd524afbd3179447a30d54e", "manual" ], "css/css-writing-modes/writing-mode-vrl-forms-003-manual.html": [ - "3dfe1d61bf5166307eacba477ffa7a469b2b7a63", + "6e960b876f8364c2e75789596fd8d618330b3ab8", "manual" ], "css/css-writing-modes/writing-mode-vrl-forms-004-manual.html": [ - "074603d5811d1a653213f1c2c73c6de417a19076", + "bebdf9ca160409904030eba58f4ec80ed669b6d3", "manual" ], "css/css-writing-modes/writing-mode-vrl-forms-005-manual.html": [ - "2ce63cd5664044e6a3f25600fc8586258d84fd99", + "dfad4e00f8b083ccaa1da3ba0b4b2b230f02a236", "manual" ], "css/css-writing-modes/writing-mode-vrl-forms-006-manual.html": [ @@ -410564,7 +410635,7 @@ "support" ], "css/selectors/selectors-empty-001.xml": [ - "baf6bddef632e030ebe3a86f3feb9cb3ec660de3", + "3b882debcc717c3e85de8695476eca3fd5238e8a", "reftest" ], "css/selectors/selectors-namespace-001-ref.xml": [ @@ -423815,26 +423886,10 @@ "c99eb053d61862260891ebdf04338a841f49d2cf", "testharness" ], - "fetch/cors-rfc1918/idlharness.tentative.any-expected.txt": [ - "afd0947a6b40aef29a680c83164e3389416de8e7", - "support" - ], "fetch/cors-rfc1918/idlharness.tentative.any.js": [ "88468dc19a38a64e6ebdb19b4e92ddf23a3247fc", "testharness" ], - "fetch/cors-rfc1918/idlharness.tentative.any.serviceworker-expected.txt": [ - "8558fae4a9e5dd1078f39f63c19c2d34931b8bb4", - "support" - ], - "fetch/cors-rfc1918/idlharness.tentative.any.sharedworker-expected.txt": [ - "8558fae4a9e5dd1078f39f63c19c2d34931b8bb4", - "support" - ], - "fetch/cors-rfc1918/idlharness.tentative.any.worker-expected.txt": [ - "8558fae4a9e5dd1078f39f63c19c2d34931b8bb4", - "support" - ], "fetch/cross-origin-resource-policy/OWNERS": [ "42d5155b66317b0067f81189e31a9168d13ca2f0", "support" @@ -425983,12 +426038,8 @@ "e47cd9c3833299348d8b4e5876452eaaabbb6c10", "testharness" ], - "html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin-expected.txt": [ - "1c8ca5314b4e2bfb4874a23c92d8c164e904dbd7", - "support" - ], "html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin.html": [ - "4b81c7c44f94c42680a812e9bf5b8eddbe7055a7", + "fec801e94babfcb3b2072842394547f1f3a8c5f9", "testharness" ], "html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-samedoc.html": [ @@ -438947,6 +438998,10 @@ "f6ae65708c661c5ff1a957c3a8606d75a44827fb", "testharness" ], + "html/semantics/embedded-content/the-img-element/historical-progress-event.window.js": [ + "7c4e121b7c34741fa3fd64e323b65a1388790b5a", + "testharness" + ], "html/semantics/embedded-content/the-img-element/image-1.jpg": [ "2fb0255609adc25a3394ae3edbd75ce4a43cb06d", "support" @@ -439303,8 +439358,8 @@ "de56cf74eda506c55460cc6da85923b5b7001381", "testharness" ], - "html/semantics/forms/autofocus/no-cross-origin-autofocus.sub.html": [ - "cc018814c922534d57e3945bd3990444853a5131", + "html/semantics/forms/autofocus/no-cross-origin-autofocus.html": [ + "c3974bd02a3655cef5513258e81f65e2f86e07d3", "testharness" ], "html/semantics/forms/autofocus/not-on-first-task.html": [ @@ -448011,6 +448066,14 @@ "84a49f7ea2220c43c083f91057763ae161035532", "testharness" ], + "largest-contentful-paint/larger-image.html": [ + "7ff38cf2be10c6e20fc5f2ad3d1578755cfbb903", + "testharness" + ], + "largest-contentful-paint/larger-text.html": [ + "973832ca6c864aff084b7db7880efb981c2bfecf", + "testharness" + ], "largest-contentful-paint/loadTime-after-appendChild.html": [ "43ec9f6085d605098faeddce311b5ccbc626b073", "testharness" @@ -486523,10 +486586,6 @@ "475a264790482aedf714958f63a4d47d69661941", "testharness" ], - "trusted-types/TrustedTypePolicy-exposed.tentative.html": [ - "e671c6fb61dcb58392c9fb0ac3f4fb37a67698bf", - "testharness" - ], "trusted-types/TrustedTypePolicy-name.tentative.html": [ "c121fe4cab50ab52a7159184bfa012e85d555768", "testharness" @@ -486551,18 +486610,14 @@ "1293493ec1f7780b297d2040274150f0aba32adc", "testharness" ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-defaultTests.tentative.html": [ - "a6dd2d1317aa4df94e693e1ad7d0d0684ea0bbc2", - "testharness" - ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-exposedTests.tentative.html": [ - "137d0f54c8228645aaf184cc64654e1d66ffbaa6", - "testharness" - ], "trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html": [ "6d43e0bafc61f34c17d7d7b751bf69f12d035adf", "testharness" ], + "trusted-types/TrustedTypePolicyFactory-defaultPolicy.tentative.html": [ + "ea00566854d12cbd6d2610aafdac44fd549ffbe7", + "testharness" + ], "trusted-types/TrustedTypePolicyFactory-isXXX.tentative.html": [ "854f69ed1e550bd660b8cf7a18b4a81a666072fd", "testharness" @@ -486692,7 +486747,7 @@ "support" ], "trusted-types/trusted-types-reporting.tentative.https.html": [ - "8dda8b23c8f06bfa375b6c6de874c7de0fbfc3c3", + "16e6d2a7d8d3e01c1cc469ea67b9e0361658495d", "testharness" ], "trusted-types/trusted-types-reporting.tentative.https.html.headers": [
diff --git a/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-color-interpolation.html b/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-color-interpolation.html new file mode 100644 index 0000000..bb727d8 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-color-interpolation.html
@@ -0,0 +1,122 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#background-color"> +<meta name="test" content="background-color supports animation as a <color>"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + background-color: #eee; +} +.target { + width: 60px; + height: 60px; + display: inline-block; + border: 2px solid black; + margin-right: 2px; + color: rgba(0, 0, 255, 0.5); + background-color: black; +} +.expected { + margin-right: 15px; +} +</style> + +<body></body> + +<script> +test_interpolation({ + property: 'background-color', + from: neutralKeyframe, + to: 'green', +}, [ + {at: -0.3, expect: 'rgb(0, 0, 0)'}, + {at: 0, expect: 'rgb(0, 0, 0)'}, + {at: 0.3, expect: 'rgb(0, 38, 0)'}, + {at: 0.6, expect: 'rgb(0, 77, 0)'}, + {at: 1, expect: 'rgb(0, 128, 0)'}, + {at: 1.5, expect: 'rgb(0, 192, 0)'}, +]); + +test_interpolation({ + property: 'background-color', + from: 'initial', + to: 'green', +}, [ + {at: -0.3, expect: 'rgba(0, 0, 0, 0)'}, + {at: 0, expect: 'rgba(0, 0, 0, 0)'}, + {at: 0.3, expect: 'rgba(0, 128, 0, 0.3)'}, + {at: 0.6, expect: 'rgba(0, 128, 0, 0.6)'}, + {at: 1, expect: 'rgb(0, 128, 0)'}, + {at: 1.5, expect: 'rgb(0, 192, 0)'}, +]); + +test_interpolation({ + property: 'background-color', + from: 'inherit', + to: 'green', +}, [ + {at: -0.3, expect: 'rgb(255, 255, 255)'}, + {at: 0, expect: 'rgb(238, 238, 238)'}, + {at: 0.3, expect: 'rgb(167, 205, 167)'}, + {at: 0.6, expect: 'rgb(95, 172, 95)'}, + {at: 1, expect: 'rgb(0, 128, 0)'}, + {at: 1.5, expect: 'rgb(0, 73, 0)'}, +]); + +test_interpolation({ + property: 'background-color', + from: 'unset', + to: 'green', +}, [ + {at: -0.3, expect: 'rgba(0, 0, 0, 0)'}, + {at: 0, expect: 'rgba(0, 0, 0, 0)'}, + {at: 0.3, expect: 'rgba(0, 128, 0, 0.3)'}, + {at: 0.6, expect: 'rgba(0, 128, 0, 0.6)'}, + {at: 1, expect: 'rgb(0, 128, 0)'}, + {at: 1.5, expect: 'rgb(0, 192, 0)'}, +]); + +test_interpolation({ + property: 'background-color', + from: 'white', + to: 'orange', +}, [ + {at: -0.3, expect: 'white'}, + {at: 0, expect: 'white'}, + {at: 0.3, expect: 'rgb(255, 228, 179)'}, + {at: 0.6, expect: 'rgb(255, 201, 102)'}, + {at: 1, expect: 'orange'}, + {at: 1.5, expect: 'rgb(255, 120, 0)'}, +]); + +test_interpolation({ + property: 'background-color', + from: 'transparent', + to: 'green', +}, [ + {at: -0.3, expect: 'rgba(0, 0, 0, 0)'}, + {at: 0, expect: 'rgba(0, 0, 0, 0)'}, + {at: 0.3, expect: 'rgba(0, 128, 0, 0.3)'}, + {at: 0.6, expect: 'rgba(0, 128, 0, 0.6)'}, + {at: 1, expect: 'rgb(0, 128, 0)'}, + {at: 1.5, expect: 'rgb(0, 192, 0)'}, +]); + +test_interpolation({ + property: 'background-color', + from: 'currentcolor', + to: 'rgba(0, 255, 0, 0.75)', +}, [ + {at: -0.5, expect: 'rgba(0, 0, 255, 0.38)'}, + {at: 0, expect: 'rgba(0, 0, 255, 0.5)'}, + {at: 0.25, expect: 'rgba(0, 85, 170, 0.56)'}, + {at: 0.5, expect: 'rgba(0, 153, 102, 0.63)'}, + {at: 0.75, expect: 'rgba(0, 208, 47, 0.69)'}, + {at: 1, expect: 'rgba(0, 255, 0, 0.75)'}, + {at: 1.5, expect: 'rgba(0, 255, 0, 0.88)'}, +]); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-position-interpolation.html b/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-position-interpolation.html new file mode 100644 index 0000000..35100fb --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-position-interpolation.html
@@ -0,0 +1,134 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#background-position"> +<meta name="test" content="background-position supports animation as a repeatable list"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + background-position: 60px 60px; +} +.target { + width: 120px; + height: 120px; + display: inline-block; + border: 2px solid black; + background-repeat: no-repeat; + background-image: radial-gradient(20px circle at 20px 20px, red 18px, transparent), + radial-gradient(20px circle at 20px 20px, yellow 18px, transparent), + radial-gradient(20px circle at 20px 20px, lime 18px, transparent), + radial-gradient(20px circle at 20px 20px, blue 18px, transparent); + background-position: 40px 40px; +} +.expected { + margin-right: 10px; +} +</style> + +<body></body> + +<script> +test_interpolation({ + property: 'background-position', + from: neutralKeyframe, + to: '80px 80px, 80px 80px, 80px 80px, 80px 80px', +}, [ + {at: -0.25, expect: '30px 30px, 30px 30px, 30px 30px, 30px 30px'}, + {at: 0, expect: '40px 40px, 40px 40px, 40px 40px, 40px 40px'}, + {at: 0.25, expect: '50px 50px, 50px 50px, 50px 50px, 50px 50px'}, + {at: 0.5, expect: '60px 60px, 60px 60px, 60px 60px, 60px 60px'}, + {at: 0.75, expect: '70px 70px, 70px 70px, 70px 70px, 70px 70px'}, + {at: 1, expect: '80px 80px, 80px 80px, 80px 80px, 80px 80px'}, + {at: 1.25, expect: '90px 90px, 90px 90px, 90px 90px, 90px 90px'}, +]); + +test_interpolation({ + property: 'background-position', + from: 'initial', + to: '80px 80px, 80px 80px, 80px 80px, 80px 80px', +}, [ + {at: -0.25, expect: '-20px -20px, -20px -20px, -20px -20px, -20px -20px'}, + {at: 0, expect: ' 0% 0% , 0% 0% , 0% 0% , 0% 0% '}, // TODO(alancutter): Should these be 0px? + {at: 0.25, expect: ' 20px 20px, 20px 20px, 20px 20px, 20px 20px'}, + {at: 0.5, expect: ' 40px 40px, 40px 40px, 40px 40px, 40px 40px'}, + {at: 0.75, expect: ' 60px 60px, 60px 60px, 60px 60px, 60px 60px'}, + {at: 1, expect: ' 80px 80px, 80px 80px, 80px 80px, 80px 80px'}, + {at: 1.25, expect: '100px 100px, 100px 100px, 100px 100px, 100px 100px'}, +]); + +test_interpolation({ + property: 'background-position', + from: 'inherit', + to: '80px 80px, 80px 80px, 80px 80px, 80px 80px', +}, [ + {at: -0.25, expect: '55px 55px, 55px 55px, 55px 55px, 55px 55px'}, + {at: 0, expect: '60px 60px, 60px 60px, 60px 60px, 60px 60px'}, + {at: 0.25, expect: '65px 65px, 65px 65px, 65px 65px, 65px 65px'}, + {at: 0.5, expect: '70px 70px, 70px 70px, 70px 70px, 70px 70px'}, + {at: 0.75, expect: '75px 75px, 75px 75px, 75px 75px, 75px 75px'}, + {at: 1, expect: '80px 80px, 80px 80px, 80px 80px, 80px 80px'}, + {at: 1.25, expect: '85px 85px, 85px 85px, 85px 85px, 85px 85px'}, +]); + +test_interpolation({ + property: 'background-position', + from: 'unset', + to: '80px 80px, 80px 80px, 80px 80px, 80px 80px', +}, [ + {at: -0.25, expect: '-20px -20px, -20px -20px, -20px -20px, -20px -20px'}, + {at: 0, expect: ' 0% 0% , 0% 0% , 0% 0% , 0% 0% '}, + {at: 0.25, expect: ' 20px 20px, 20px 20px, 20px 20px, 20px 20px'}, + {at: 0.5, expect: ' 40px 40px, 40px 40px, 40px 40px, 40px 40px'}, + {at: 0.75, expect: ' 60px 60px, 60px 60px, 60px 60px, 60px 60px'}, + {at: 1, expect: ' 80px 80px, 80px 80px, 80px 80px, 80px 80px'}, + {at: 1.25, expect: '100px 100px, 100px 100px, 100px 100px, 100px 100px'}, +]); + +// Test equal number of position values as background images. +test_interpolation({ + property: 'background-position', + from: '0px 0px, 0px 0px, 0px 0px, 0px 0px', + to: '80px 80px, 80px 80px, 80px 80px, 80px 80px', +}, [ + {at: -0.25, expect: '-20px -20px, -20px -20px, -20px -20px, -20px -20px'}, + {at: 0, expect: ' 0px 0px, 0px 0px, 0px 0px, 0px 0px'}, + {at: 0.25, expect: ' 20px 20px, 20px 20px, 20px 20px, 20px 20px'}, + {at: 0.5, expect: ' 40px 40px, 40px 40px, 40px 40px, 40px 40px'}, + {at: 0.75, expect: ' 60px 60px, 60px 60px, 60px 60px, 60px 60px'}, + {at: 1, expect: ' 80px 80px, 80px 80px, 80px 80px, 80px 80px'}, + {at: 1.25, expect: '100px 100px, 100px 100px, 100px 100px, 100px 100px'}, +]); + +// Test single position value repeated over background images. +test_interpolation({ + property: 'background-position', + from: 'top 0px left 0px', + to: 'left 80px top 80px', +}, [ + {at: -0.25, expect: '-20px -20px, -20px -20px, -20px -20px, -20px -20px'}, + {at: 0, expect: ' 0px 0px, 0px 0px, 0px 0px, 0px 0px'}, + {at: 0.25, expect: ' 20px 20px, 20px 20px, 20px 20px, 20px 20px'}, + {at: 0.5, expect: ' 40px 40px, 40px 40px, 40px 40px, 40px 40px'}, + {at: 0.75, expect: ' 60px 60px, 60px 60px, 60px 60px, 60px 60px'}, + {at: 1, expect: ' 80px 80px, 80px 80px, 80px 80px, 80px 80px'}, + {at: 1.25, expect: '100px 100px, 100px 100px, 100px 100px, 100px 100px'}, +]); + +// Test mismatched numbers of position values. +test_interpolation({ + property: 'background-position', + from: '0px 0px, 80px 0px', + to: '40px 40px, 80px 80px, 0px 80px', +}, [ + {at: -0.25, expect: '-10px -10px, 80px -20px, 0px -20px, 90px -10px'}, + {at: 0, expect: ' 0px 0px, 80px 0px, 0px 0px, 80px 0px'}, + {at: 0.25, expect: ' 10px 10px, 80px 20px, 0px 20px, 70px 10px'}, + {at: 0.5, expect: ' 20px 20px, 80px 40px, 0px 40px, 60px 20px'}, + {at: 0.75, expect: ' 30px 30px, 80px 60px, 0px 60px, 50px 30px'}, + {at: 1, expect: ' 40px 40px, 80px 80px, 0px 80px, 40px 40px'}, + {at: 1.25, expect: ' 50px 50px, 80px 100px, 0px 100px, 30px 50px'}, +]); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-position-origin-interpolation.html b/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-position-origin-interpolation.html new file mode 100644 index 0000000..c6b84ca --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-position-origin-interpolation.html
@@ -0,0 +1,217 @@ +<!doctype html> +<meta charset="utf-8"> +<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#background-position"> +<meta name="test" content="background-position animation handles origin parameters"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + background-position: 80px 80px; +} +.target { + border: 3px solid skyblue; + width: 100px; + height: 100px; + background-image: linear-gradient(to right, green, green); + background-size: 20px 20px; + background-repeat: no-repeat; + background-position: 10px 10px; + display: inline-block; +} + +.actual { + background-image: linear-gradient(to right, red, red); +} +.expected { + margin-left: -106px; +} +</style> + +<body></body> + +<script> +// neutral +test_interpolation({ + property: 'background-position', + from: neutralKeyframe, + to: 'left 20px top 20px', +}, [ + {at: 0, expect: '10px 10px'}, + {at: 0.25, expect: '12.5px 12.5px'}, + {at: 0.5, expect: '15px 15px'}, + {at: 0.75, expect: '17.5px 17.5px'}, + {at: 1, expect: '20px 20px'}, +]); + +// initial +test_interpolation({ + property: 'background-position', + from: 'initial', + to: 'left 20px top 20px', +}, [ + {at: 0, expect: '0% 0%'}, + {at: 0.25, expect: '5px 5px'}, + {at: 0.5, expect: '10px 10px'}, + {at: 0.75, expect: '15px 15px'}, + {at: 1, expect: '20px 20px'}, +]); + +// inherit +test_interpolation({ + property: 'background-position', + from: 'inherit', + to: 'left 20px top 20px', +}, [ + {at: 0, expect: '80px 80px'}, + {at: 0.25, expect: '65px 65px'}, + {at: 0.5, expect: '50px 50px'}, + {at: 0.75, expect: '35px 35px'}, + {at: 1, expect: '20px 20px'}, +]); + +// unset +test_interpolation({ + property: 'background-position', + from: 'unset', + to: 'left 20px top 20px', +}, [ + {at: 0, expect: '0% 0%'}, + {at: 0.25, expect: '5px 5px'}, + {at: 0.5, expect: '10px 10px'}, + {at: 0.75, expect: '15px 15px'}, + {at: 1, expect: '20px 20px'}, +]); + +// left-top +test_interpolation({ + property: 'background-position', + from: 'center center', + to: 'left 20px top 20px', +}, [ + {at: 0, expect: '50% 50%'}, + {at: 0.25, expect: 'calc(5px + 37.5%) calc(5px + 37.5%)'}, + {at: 0.5, expect: 'calc(10px + 25%) calc(10px + 25%)'}, + {at: 0.75, expect: 'calc(15px + 12.5%) calc(15px + 12.5%)'}, + {at: 1, expect: '20px 20px'}, +]); + +// center-top +test_interpolation({ + property: 'background-position', + from: 'center center', + to: 'center top 20px', +}, [ + {at: 0, expect: '50% 50%'}, + {at: 0.25, expect: '50% calc(5px + 37.5%)'}, + {at: 0.5, expect: '50% calc(10px + 25%)'}, + {at: 0.75, expect: '50% calc(15px + 12.5%)'}, + {at: 1, expect: '50% 20px'}, +]); + +// right-top +test_interpolation({ + property: 'background-position', + from: 'center center', + to: 'right 20px top 20px', +}, [ + {at: 0, expect: '50% 50%'}, + {at: 0.25, expect: 'calc(-5px + 62.5%) calc(5px + 37.5%)'}, + {at: 0.5, expect: 'calc(-10px + 75%) calc(10px + 25%)'}, + {at: 0.75, expect: 'calc(-15px + 87.5%) calc(15px + 12.5%)'}, + {at: 1, expect: 'calc(-20px + 100%) 20px'}, +]); + +// left-center +test_interpolation({ + property: 'background-position', + from: 'center center', + to: 'left 20px center', +}, [ + {at: 0, expect: '50% 50%'}, + {at: 0.25, expect: 'calc(5px + 37.5%) 50%'}, + {at: 0.5, expect: 'calc(10px + 25%) 50%'}, + {at: 0.75, expect: 'calc(15px + 12.5%) 50%'}, + {at: 1, expect: '20px 50%'}, +]); + +// center-center +test_interpolation({ + property: 'background-position', + from: 'center center', + to: 'center center', +}, [ + {at: 0, expect: '50% 50%'}, + {at: 0.25, expect: '50% 50%'}, + {at: 0.5, expect: '50% 50%'}, + {at: 0.75, expect: '50% 50%'}, + {at: 1, expect: '50% 50%'}, +]); + +// right-center +test_interpolation({ + property: 'background-position', + from: 'center center', + to: 'right 20px center', +}, [ + {at: 0, expect: '50% 50%'}, + {at: 0.25, expect: 'calc(-5px + 62.5%) 50%'}, + {at: 0.5, expect: 'calc(-10px + 75%) 50%'}, + {at: 0.75, expect: 'calc(-15px + 87.5%) 50%'}, + {at: 1, expect: 'calc(-20px + 100%) 50%'}, +]); + +// left-bottom +test_interpolation({ + property: 'background-position', + from: 'center center', + to: 'left 20px bottom 20px', +}, [ + {at: 0, expect: '50% 50%'}, + {at: 0.25, expect: 'calc(5px + 37.5%) calc(-5px + 62.5%)'}, + {at: 0.5, expect: 'calc(10px + 25%) calc(-10px + 75%)'}, + {at: 0.75, expect: 'calc(15px + 12.5%) calc(-15px + 87.5%)'}, + {at: 1, expect: '20px calc(-20px + 100%)'}, +]); + +// center-bottom +test_interpolation({ + property: 'background-position', + from: 'center center', + to: 'center bottom 20px', +}, [ + {at: 0, expect: '50% 50%'}, + {at: 0.25, expect: '50% calc(-5px + 62.5%)'}, + {at: 0.5, expect: '50% calc(-10px + 75%)'}, + {at: 0.75, expect: '50% calc(-15px + 87.5%)'}, + {at: 1, expect: '50% calc(-20px + 100%)'}, +]); + +// right-bottom +test_interpolation({ + property: 'background-position', + from: 'center center', + to: 'right 20px bottom 20px', +}, [ + {at: 0, expect: '50% 50%'}, + {at: 0.25, expect: 'calc(-5px + 62.5%) calc(-5px + 62.5%)'}, + {at: 0.5, expect: 'calc(-10px + 75%) calc(-10px + 75%)'}, + {at: 0.75, expect: 'calc(-15px + 87.5%) calc(-15px + 87.5%)'}, + {at: 1, expect: 'calc(-20px + 100%) calc(-20px + 100%)'}, +]); + +// Single values +test_interpolation({ + property: 'background-position', + from: 'center', + to: 'bottom', +}, [ + {at: 0, expect: '50% 50%'}, + {at: 0.25, expect: '50% 62.5%'}, + {at: 0.5, expect: '50% 75%'}, + {at: 0.75, expect: '50% 87.5%'}, + {at: 1, expect: '50% 100%'}, +]); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-size-interpolation.html b/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-size-interpolation.html new file mode 100644 index 0000000..f6a480c --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-size-interpolation.html
@@ -0,0 +1,166 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#background-size"> +<meta name="test" content="background-size supports animation as a repeatable list"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + background-size: 100px 100px; +} +.target { + width: 80px; + height: 100px; + display: inline-block; + border: 10px solid black; + background-repeat: no-repeat; + background-image: url(../resources/stripes-100.png), + url(../resources/stripes-100.png), + url(../resources/blue-100.png), + url(../resources/green-100.png); + background-position: left top, right top, left bottom, right bottom; + background-size: 10px 10px; +} +.expected { + margin-right: 10px; + border-color: green; +} +</style> + +<body></body> + +<script> +// neutral +test_interpolation({ + property: 'background-size', + from: neutralKeyframe, + to: '20px 20px, 0px 0px', +}, [ + {at: -0.25, expect: ' 7.5px 7.5px, 12.5px 12.5px, 7.5px 7.5px, 12.5px 12.5px'}, + {at: 0, expect: '10.0px 10.0px, 10.0px 10.0px, 10.0px 10.0px, 10.0px 10.0px'}, + {at: 0.25, expect: '12.5px 12.5px, 7.5px 7.5px, 12.5px 12.5px, 7.5px 7.5px'}, + {at: 0.5, expect: '15.0px 15.0px, 5.0px 5.0px, 15.0px 15.0px, 5.0px 5.0px'}, + {at: 0.75, expect: '17.5px 17.5px, 2.5px 2.5px, 17.5px 17.5px, 2.5px 2.5px'}, + {at: 1, expect: '20.0px 20.0px, 0.0px 0.0px, 20.0px 20.0px, 0.0px 0.0px'}, + {at: 1.25, expect: '22.5px 22.5px, 0.0px 0.0px, 22.5px 22.5px, 0.0px 0.0px'}, +]); + +// initial +test_no_interpolation({ + property: 'background-size', + from: 'initial', + to: '20px 20px, 0px 0px', +}); + +// inherit +test_interpolation({ + property: 'background-size', + from: 'inherit', + to: '20px 20px, 0px 0px', +}, [ + {at: -0.25, expect: '120px 120px, 125px 125px, 120px 120px, 125px 125px'}, + {at: 0, expect: '100px 100px, 100px 100px, 100px 100px, 100px 100px'}, + {at: 0.25, expect: ' 80px 80px, 75px 75px, 80px 80px, 75px 75px'}, + {at: 0.5, expect: ' 60px 60px, 50px 50px, 60px 60px, 50px 50px'}, + {at: 0.75, expect: ' 40px 40px, 25px 25px, 40px 40px, 25px 25px'}, + {at: 1, expect: ' 20px 20px, 0px 0px, 20px 20px, 0px 0px'}, + {at: 1.25, expect: ' 0px 0px, 0px 0px, 0px 0px, 0px 0px'}, +]); + +// unset +test_no_interpolation({ + property: 'background-size', + from: 'unset', + to: '20px 20px, 0px 0px', +}); + +// Matched keywords in size value list. +test_interpolation({ + property: 'background-size', + from: '0px auto, 0px 0px, contain, cover', + to: '40px auto, 40px 40px, contain, cover', +}, [ + {at: -0.25, expect: ' 0px auto, 0px 0px, contain, cover'}, + {at: 0, expect: ' 0px auto, 0px 0px, contain, cover'}, + {at: 0.25, expect: '10px auto, 10px 10px, contain, cover'}, + {at: 0.5, expect: '20px auto, 20px 20px, contain, cover'}, + {at: 0.75, expect: '30px auto, 30px 30px, contain, cover'}, + {at: 1, expect: '40px auto, 40px 40px, contain, cover'}, + {at: 1.25, expect: '50px auto, 50px 50px, contain, cover'}, +]); + +// Mismatched keywords in size value list. +test_no_interpolation({ + property: 'background-size', + from: '0px 0px, 0px 0px, contain, cover', + to: '40px 40px, 40px 40px, cover, contain', +}); + +test_no_interpolation({ + property: 'background-size', + from: '0px auto, 0px 0px', + to: 'auto 40px, 40px 40px', +}); + +// Equal number of size values as background images. +test_interpolation({ + property: 'background-size', + from: '0px 0px, 0px 0px, 0px 0px, 0px 0px', + to: '20px 20px, 40px 40px, 60px 60px, 100px 100px', +}, [ + {at: -0.25, expect: ' 0px 0px, 0px 0px, 0px 0px, 0px 0px'}, + {at: 0, expect: ' 0px 0px, 0px 0px, 0px 0px, 0px 0px'}, + {at: 0.25, expect: ' 5px 5px, 10px 10px, 15px 15px, 25px 25px'}, + {at: 0.5, expect: '10px 10px, 20px 20px, 30px 30px, 50px 50px'}, + {at: 0.75, expect: '15px 15px, 30px 30px, 45px 45px, 75px 75px'}, + {at: 1, expect: '20px 20px, 40px 40px, 60px 60px, 100px 100px'}, + {at: 1.25, expect: '25px 25px, 50px 50px, 75px 75px, 125px 125px'}, +]); + +// Single size value repeated over background images. +test_interpolation({ + property: 'background-size', + from: '0px 0px', + to: '80px 80px', +}, [ + {at: -0.25, expect: ' 0px 0px, 0px 0px, 0px 0px, 0px 0px'}, + {at: 0, expect: ' 0px 0px, 0px 0px, 0px 0px, 0px 0px'}, + {at: 0.25, expect: ' 20px 20px, 20px 20px, 20px 20px, 20px 20px'}, + {at: 0.5, expect: ' 40px 40px, 40px 40px, 40px 40px, 40px 40px'}, + {at: 0.75, expect: ' 60px 60px, 60px 60px, 60px 60px, 60px 60px'}, + {at: 1, expect: ' 80px 80px, 80px 80px, 80px 80px, 80px 80px'}, + {at: 1.25, expect: '100px 100px, 100px 100px, 100px 100px, 100px 100px'}, +]); + +test_interpolation({ + property: 'background-size', + from: '0px', + to: '80px', +}, [ + {at: -0.25, expect: ' 0px, 0px, 0px, 0px'}, + {at: 0, expect: ' 0px, 0px, 0px, 0px'}, + {at: 0.25, expect: ' 20px, 20px, 20px, 20px'}, + {at: 0.5, expect: ' 40px, 40px, 40px, 40px'}, + {at: 0.75, expect: ' 60px, 60px, 60px, 60px'}, + {at: 1, expect: ' 80px, 80px, 80px, 80px'}, + {at: 1.25, expect: '100px, 100px, 100px, 100px'}, +]); + +// Mismatched numbers of size values. +test_interpolation({ + property: 'background-size', + from: '0px 0px, 80px 0px', + to: '40px 40px, 80px 80px, 0px 80px', +}, [ + {at: -0.25, expect: ' 0px 0px, 80px 0px, 0px 0px, 90px 0px'}, + {at: 0, expect: ' 0px 0px, 80px 0px, 0px 0px, 80px 0px'}, + {at: 0.25, expect: '10px 10px, 80px 20px, 0px 20px, 70px 10px'}, + {at: 0.5, expect: '20px 20px, 80px 40px, 0px 40px, 60px 20px'}, + {at: 0.75, expect: '30px 30px, 80px 60px, 0px 60px, 50px 30px'}, + {at: 1, expect: '40px 40px, 80px 80px, 0px 80px, 40px 40px'}, + {at: 1.25, expect: '50px 50px, 80px 100px, 0px 100px, 30px 50px'}, +]); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-size-adjust-interpolation.html b/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-size-adjust-interpolation.html new file mode 100644 index 0000000..fd89da3 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-size-adjust-interpolation.html
@@ -0,0 +1,123 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>font-size-adjust interpolation</title> +<link rel="help" href="https://drafts.csswg.org/css-fonts-3/#propdef-font-size-adjust"> +<meta name="assert" content="font-size-adjust supports animation as a number"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style type="text/css"> +.container { + font-size: 20px; + line-height: 1; +} + +.parent { + font-size-adjust: 3; +} + +.target { + display: inline-block; + font-size-adjust: 1; +} + +.expected { + color: green; + margin-right: 30px; +} +</style> + +<body> +<template id="target-template"> + <span class="container"> + <div class="target">x</span> + </div> +</template> +</body> + +<script> +test_interpolation({ + property: 'font-size-adjust', + from: neutralKeyframe, + to: '2', +}, [ + {at: -2, expect: '0'}, + {at: -0.3, expect: '0.7'}, + {at: 0, expect: '1'}, + {at: 0.3, expect: '1.3'}, + {at: 0.6, expect: '1.6'}, + {at: 1, expect: '2'}, + {at: 1.5, expect: '2.5'}, +]); + +test_no_interpolation({ + property: 'font-size-adjust', + from: 'initial', + to: '2', +}); + +test_interpolation({ + property: 'font-size-adjust', + from: 'inherit', + to: '2', +}, [ + {at: -2, expect: '5'}, + {at: -0.3, expect: '3.3'}, + {at: 0, expect: '3'}, + {at: 0.3, expect: '2.7'}, + {at: 0.6, expect: '2.4'}, + {at: 1, expect: '2'}, + {at: 1.5, expect: '1.5'}, +]); + +test_interpolation({ + property: 'font-size-adjust', + from: 'unset', + to: '2', +}, [ + {at: -2, expect: '5'}, + {at: -0.3, expect: '3.3'}, + {at: 0, expect: '3'}, + {at: 0.3, expect: '2.7'}, + {at: 0.6, expect: '2.4'}, + {at: 1, expect: '2'}, + {at: 1.5, expect: '1.5'}, +]); + + +test_interpolation({ + property: 'font-size-adjust', + from: '0', + to: '1.2' +}, [ + {at: -2, expect: '0'}, + {at: -0.3, expect: '0'}, + {at: 0, expect: '0'}, + {at: 0.3, expect: '0.36'}, + {at: 0.6, expect: '0.72'}, + {at: 1, expect: '1.2'}, + {at: 1.5, expect: '1.8'}, +]); + +test_no_interpolation({ + property: 'font-size-adjust', + from: 'none', + to: '1.2' +}); + +test_interpolation({ + property: 'font-size-adjust', + from: '0.2', + to: '1.2' +}, [ + {at: -2, expect: '0'}, // CSS font-size-adjust can't be negative. + {at: -0.3, expect: '0'}, + {at: 0, expect: '0.2'}, + {at: 0.3, expect: '0.5'}, + {at: 0.6, expect: '0.8'}, + {at: 1, expect: '1.2'}, + {at: 1.5, expect: '1.7'}, +]); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-size-interpolation-001.html b/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-size-interpolation-001.html new file mode 100644 index 0000000..0f60018 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-size-interpolation-001.html
@@ -0,0 +1,103 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>font-size interpolation</title> +<link rel="help" href="https://drafts.csswg.org/css-fonts-3/#propdef-font-size"> +<meta name="assert" content="font-size supports animation as length"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + font-size: 30px; +} +.target { + display: inline-block; + font: 10px sans-serif; +} +.expected { + color: green; + margin-right: 30px; +} +</style> + +<body> +<template id="target-template"> + <span> + <div class="target">Test Text</div> + </span> +</template> +</body> + +<script> +test_interpolation({ + property: 'font-size', + from: neutralKeyframe, + to: '20px', +}, [ + {at: -2, expect: '0px'}, + {at: -0.3, expect: '7px'}, + {at: 0, expect: '10px'}, + {at: 0.3, expect: '13px'}, + {at: 0.6, expect: '16px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); + +test_interpolation({ + property: 'font-size', + from: 'initial', + to: '20px', +}, [ + {at: -2, expect: '8px'}, + {at: -0.3, expect: '14.8px'}, + {at: 0, expect: '16px'}, + {at: 0.3, expect: '17.2px'}, + {at: 0.6, expect: '18.4px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '22px'}, +]); + +test_interpolation({ + property: 'font-size', + from: 'inherit', + to: '20px', +}, [ + {at: -2, expect: '50px'}, + {at: -0.3, expect: '33px'}, + {at: 0, expect: '30px'}, + {at: 0.3, expect: '27px'}, + {at: 0.6, expect: '24px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '15px'}, +]); + +test_interpolation({ + property: 'font-size', + from: 'unset', + to: '20px', +}, [ + {at: -2, expect: '50px'}, + {at: -0.3, expect: '33px'}, + {at: 0, expect: '30px'}, + {at: 0.3, expect: '27px'}, + {at: 0.6, expect: '24px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '15px'}, +]); + +test_interpolation({ + property: 'font-size', + from: '4px', + to: '14px' +}, [ + {at: -2, expect: '0px'}, // CSS font-size can't be negative. + {at: -0.3, expect: '1px'}, + {at: 0, expect: '4px'}, + {at: 0.3, expect: '7px'}, + {at: 0.6, expect: '10px'}, + {at: 1, expect: '14px'}, + {at: 1.5, expect: '19px'}, +]); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-size-interpolation-002.html b/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-size-interpolation-002.html new file mode 100644 index 0000000..d6f2f19 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-size-interpolation-002.html
@@ -0,0 +1,49 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>font-size interpolation</title> +<link rel="help" href="https://drafts.csswg.org/css-fonts-3/#propdef-font-size"> +<meta name="assert" content="font-size supports animation as length"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.container { + font-size: 10px; +} +.target { + display: inline-block; + font: 100px sans-serif; + font-size: 20px; +} +.expected { + color: green; + margin-right: 30px; +} +</style> + +<body> +<template id="target-template"> + <span class="container"> + <div class="target">TT</div> + </span> +</template> +</body> + +<script> +// Test the 'unset' case. +test_interpolation({ + property: 'font-size', + from: 'unset', + to: '20px' +}, [ + {at: -2, expect: '0px'}, // CSS font-size can't be negative. + {at: -0.3, expect: '7px'}, + {at: 0, expect: '10px'}, + {at: 0.3, expect: '13px'}, + {at: 0.6, expect: '16px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-size-interpolation-003.html b/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-size-interpolation-003.html new file mode 100644 index 0000000..d84ff7e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-size-interpolation-003.html
@@ -0,0 +1,47 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>font-size interpolation with zoom</title> +<link rel="help" href="https://drafts.csswg.org/css-fonts-3/#propdef-font-size"> +<meta name="assert" content="font-size supports animation as a length, respecting zoom"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.container { + zoom: 2; +} +.target { + display: inline-block; +} +.expected { + color: green; + margin-right: 30px; +} +</style> + +<body> +<template id="target-template"> + <span class="container"> + <div class="target">TT</div> + </span> +</template> +</body> + +<script> +// The container has zoom: 2 applied to it. +test_interpolation({ + property: 'font-size', + from: '10px', + to: '20px' +}, [ + {at: -2, expect: '0px'}, // CSS font-size can't be negative. + {at: -0.3, expect: '7px'}, + {at: 0, expect: '10px'}, + {at: 0.3, expect: '13px'}, + {at: 0.6, expect: '16px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-variation-settings-interpolation.html b/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-variation-settings-interpolation.html new file mode 100644 index 0000000..e11079c --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-fonts/animations/font-variation-settings-interpolation.html
@@ -0,0 +1,132 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>font-variation-settings interpolation</title> +<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#propdef-font-variation-settings"> +<meta name="assert" content="font-variation-settings supports animation pairwise by 'like' properties"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + font-variation-settings: "test" 30; +} +.target { + font-variation-settings: "test" 10; +} +</style> + +<body></body> + +<script> +test_interpolation({ + property: 'font-variation-settings', + from: neutralKeyframe, + to: '"test" 20', +}, [ + {at: -0.5, expect: "'test' 5"}, + {at: 0, expect: "'test' 10"}, + {at: 0.3, expect: "'test' 13"}, + {at: 0.7, expect: "'test' 17"}, + {at: 1, expect: "'test' 20"}, + {at: 1.5, expect: "'test' 25"}, +]); + +test_no_interpolation({ + property: 'font-variation-settings', + from: 'initial', + to: "'test' 50", +}); + +test_interpolation({ + property: 'font-variation-settings', + from: 'inherit', + to: "'test' 20", +}, [ + {at: -0.5, expect: "'test' 35"}, + {at: 0, expect: "'test' 30"}, + {at: 0.3, expect: "'test' 27"}, + {at: 0.7, expect: "'test' 23"}, + {at: 1, expect: "'test' 20"}, + {at: 1.5, expect: "'test' 15"}, +]); + +test_interpolation({ + property: 'font-variation-settings', + from: 'unset', + to: "'test' 20", +}, [ + {at: -0.5, expect: "'test' 35"}, + {at: 0, expect: "'test' 30"}, + {at: 0.3, expect: "'test' 27"}, + {at: 0.7, expect: "'test' 23"}, + {at: 1, expect: "'test' 20"}, + {at: 1.5, expect: "'test' 15"}, +]); + +test_no_interpolation({ + property: 'font-variation-settings', + from: "'test' 20", + to: "normal", +}); + +test_interpolation({ + property: 'font-variation-settings', + from: "'test' 20", + to: "'test' 30", +}, [ + {at: -0.5, expect: "'test' 15"}, + {at: 0, expect: "'test' 20"}, + {at: 0.3, expect: "'test' 23"}, + {at: 0.7, expect: "'test' 27"}, + {at: 1, expect: "'test' 30"}, + {at: 1.5, expect: "'test' 35"}, +]); + +test_interpolation({ + property: 'font-variation-settings', + from: "'aaaa' 0, 'bbbb' 10, 'cccc' 20", + to: "'aaaa' 10, 'bbbb' 20, 'cccc' 30", +}, [ + {at: -0.5, expect: "'aaaa' -5, 'bbbb' 5, 'cccc' 15"}, + {at: 0, expect: "'aaaa' 0, 'bbbb' 10, 'cccc' 20"}, + {at: 0.3, expect: "'aaaa' 3, 'bbbb' 13, 'cccc' 23"}, + {at: 0.7, expect: "'aaaa' 7, 'bbbb' 17, 'cccc' 27"}, + {at: 1, expect: "'aaaa' 10, 'bbbb' 20, 'cccc' 30"}, + {at: 1.5, expect: "'aaaa' 15, 'bbbb' 25, 'cccc' 35"}, +]); + +test_no_interpolation({ + property: 'font-variation-settings', + from: "'aaaa' 0, 'bbbb' 10", + to: "'aaaa' 10, 'bbbb' 20, 'cccc' 30", +}); + +test_no_interpolation({ + property: 'font-variation-settings', + from: "'aaaa' 10, 'bbbb' 20, 'cccc' 30", + to: "'aaaa' 0, 'bbbb' 10", +}); + +test_no_interpolation({ + property: 'font-variation-settings', + from: "'aaaa' 0, 'bbbb' 10, 'cccc' 20", + to: "'cccc' 10, 'bbbb' 20, 'aaaa' 30", +}); + +test_no_interpolation({ + property: 'font-variation-settings', + from: "'aaaa' 0, 'bbbb' 10, 'cccc' 20", + to: "'dddd' 10, 'eeee' 20, 'ffff' 30", +}); + +// crbug.com/910118: Test that ApplyStandardPropertyValue doesn't overflow. +test_interpolation({ + property: 'font-variation-settings', + from: "'aaaa' 30, 'bbbb' 20", + to: "'aaaa' 20, 'bbbb' 30", +}, [ + {at: 3.40282e+38, expect: "'aaaa' -3.40282e+38, 'bbbb' 3.40282e+38"}, +]); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/animations/letter-spacing-interpolation.html b/third_party/blink/web_tests/external/wpt/css/css-text/animations/letter-spacing-interpolation.html new file mode 100644 index 0000000..7d495811 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/animations/letter-spacing-interpolation.html
@@ -0,0 +1,107 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#letter-spacing-property"> +<meta name="test" content="letter-spacing supports animation by computed value type"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + letter-spacing: 2px; +} +.target { + font: 10px sans-serif; + font-weight: bold; + letter-spacing: 30px; +} +.expected { + color: green; + margin-right: 30px; +} +</style> + +<body> + <template id="target-template">TT</template> +</body> + +<script> +test_interpolation({ + property: 'letter-spacing', + from: neutralKeyframe, + to: '20px', +}, [ + {at: -0.3, expect: '33px'}, + {at: 0, expect: '30px'}, + {at: 0.3, expect: '27px'}, + {at: 0.6, expect: '24px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '15px'}, +]); + +test_interpolation({ + property: 'letter-spacing', + from: 'initial', + to: '20px', +}, [ + {at: -0.3, expect: '-6px'}, + {at: 0, expect: 'normal'}, + {at: 0.3, expect: '6px'}, + {at: 0.6, expect: '12px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '30px'}, +]); + +test_interpolation({ + property: 'letter-spacing', + from: 'inherit', + to: '20px', +}, [ + {at: -0.3, expect: '-3.4px'}, + {at: 0, expect: '2px'}, + {at: 0.3, expect: '7.4px'}, + {at: 0.6, expect: '12.8px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '29px'}, +]); + +test_interpolation({ + property: 'letter-spacing', + from: 'unset', + to: '20px', +}, [ + {at: -0.3, expect: '-3.4px'}, + {at: 0, expect: '2px'}, + {at: 0.3, expect: '7.4px'}, + {at: 0.6, expect: '12.8px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '29px'}, +]); + +test_interpolation({ + property: 'letter-spacing', + from: '-10px', + to: '10px', +}, [ + {at: -0.3, expect: '-16px'}, + {at: 0, expect: '-10px'}, + {at: 0.3, expect: '-4px'}, + {at: 0.6, expect: '2px'}, + {at: 1, expect: '10px'}, + {at: 1.5, expect: '20px'}, +]); + +test_interpolation({ + property: 'letter-spacing', + from: 'normal', + to: '10px', +}, [ + {at: -0.3, expect: '-3px'}, + {at: 0, expect: 'normal'}, + {at: 0.3, expect: '3px'}, + {at: 0.6, expect: '6px'}, + {at: 1, expect: '10px'}, + {at: 1.5, expect: '15px'}, +]); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/animations/text-indent-interpolation.html b/third_party/blink/web_tests/external/wpt/css/css-text/animations/text-indent-interpolation.html new file mode 100644 index 0000000..2269fdf --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/animations/text-indent-interpolation.html
@@ -0,0 +1,131 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#text-indent-property"> +<meta name="test" content="text-indent supports animation by computed value type"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + text-indent: 70px; +} +.target { + font: 10px sans-serif; + text-indent: 10px; + margin-left: 20px; +} +.expected { + color: green; +} +</style> + +<body> + <template id="target-template">T</template> +</body> + +<script> +test_interpolation({ + property: 'text-indent', + from: neutralKeyframe, + to: '40px', +}, [ + {at: -0.3, expect: '1px'}, + {at: 0, expect: '10px'}, + {at: 0.3, expect: '19px'}, + {at: 0.6, expect: '28px'}, + {at: 1, expect: '40px'}, + {at: 1.5, expect: '55px'}, +]); + +test_interpolation({ + property: 'text-indent', + from: 'initial', + to: '20px', +}, [ + {at: -0.3, expect: '-6px'}, + {at: 0, expect: '0px'}, + {at: 0.3, expect: '6px'}, + {at: 0.6, expect: '12px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '30px'}, +]); + +test_interpolation({ + property: 'text-indent', + from: 'inherit', + to: '20px', +}, [ + {at: -0.3, expect: '85px'}, + {at: 0, expect: '70px'}, + {at: 0.3, expect: '55px'}, + {at: 0.6, expect: '40px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '-5px'}, +]); + +test_interpolation({ + property: 'text-indent', + from: 'unset', + to: '20px', +}, [ + {at: -0.3, expect: '85px'}, + {at: 0, expect: '70px'}, + {at: 0.3, expect: '55px'}, + {at: 0.6, expect: '40px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '-5px'}, +]); + +test_interpolation({ + property: 'text-indent', + from: '0px', + to: '50px' +}, [ + {at: -0.3, expect: '-15px'}, + {at: 0, expect: '0'}, + {at: 0.3, expect: '15px'}, + {at: 0.6, expect: '30px'}, + {at: 1, expect: '50px'}, + {at: 1.5, expect: '75px'}, +]); + +test_interpolation({ + property: 'text-indent', + from: '0px hanging', + to: '50px hanging', +}, [ + {at: -0.3, expect: '-15px hanging'}, + {at: 0, expect: '0 hanging'}, + {at: 0.3, expect: '15px hanging'}, + {at: 0.6, expect: '30px hanging'}, + {at: 1, expect: '50px hanging'}, + {at: 1.5, expect: '75px hanging'}, +]); + +test_interpolation({ + property: 'text-indent', + from: '0px hanging each-line', + to: '50px each-line hanging', +}, [ + {at: -0.3, expect: '-15px hanging each-line'}, + {at: 0, expect: '0 hanging each-line'}, + {at: 0.3, expect: '15px hanging each-line'}, + {at: 0.6, expect: '30px hanging each-line'}, + {at: 1, expect: '50px hanging each-line'}, + {at: 1.5, expect: '75px hanging each-line'}, +]); + +test_no_interpolation({ + property: 'text-indent', + from: '0px each-line', + to: '50px hanging', +}); + +test_no_interpolation({ + property: 'text-indent', + from: '0px', + to: '50px each-line hanging', +}); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/animations/word-spacing-interpolation.html b/third_party/blink/web_tests/external/wpt/css/css-text/animations/word-spacing-interpolation.html new file mode 100644 index 0000000..ffd6bb47 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/animations/word-spacing-interpolation.html
@@ -0,0 +1,104 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#word-spacing-property"> +<meta name="test" content="word-spacing supports animation by computed value type"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + word-spacing: 30px; +} +.target { + font: 10px sans-serif; + word-spacing: 10px; +} +.expected { + color: green; +} +</style> + +<body> + <template id="target-template">A B C D</template> +</body> + +<script> +test_interpolation({ + property: 'word-spacing', + from: neutralKeyframe, + to: '20px', +}, [ + {at: -0.3, expect: '7px'}, + {at: 0, expect: '10px'}, + {at: 0.3, expect: '13px'}, + {at: 0.6, expect: '16px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); + +test_interpolation({ + property: 'word-spacing', + from: 'initial', + to: '20px', +}, [ + {at: -0.3, expect: '-6px'}, + {at: 0, expect: '0px'}, + {at: 0.3, expect: '6px'}, + {at: 0.6, expect: '12px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '30px'}, +]); + +test_interpolation({ + property: 'word-spacing', + from: 'inherit', + to: '20px', +}, [ + {at: -0.3, expect: '33px'}, + {at: 0, expect: '30px'}, + {at: 0.3, expect: '27px'}, + {at: 0.6, expect: '24px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '15px'}, +]); + +test_interpolation({ + property: 'word-spacing', + from: 'unset', + to: '20px', +}, [ + {at: -0.3, expect: '33px'}, + {at: 0, expect: '30px'}, + {at: 0.3, expect: '27px'}, + {at: 0.6, expect: '24px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '15px'}, +]); + +test_interpolation({ + property: 'word-spacing', + from: '-10px', + to: '40px' +}, [ + {at: -0.3, expect: '-25px'}, + {at: 0, expect: '-10px'}, + {at: 0.3, expect: '5px'}, + {at: 0.6, expect: '20px'}, + {at: 1, expect: '40px'}, + {at: 1.5, expect: '65px'}, +]); +test_interpolation({ + property: 'word-spacing', + from: 'normal', + to: '10px' +}, [ + {at: -0.3, expect: '-3px'}, + {at: 0, expect: '0px'}, + {at: 0.3, expect: '3px'}, + {at: 0.6, expect: '6px'}, + {at: 1, expect: '10px'}, + {at: 1.5, expect: '15px'}, +]); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-values/minmax-time-computed.html b/third_party/blink/web_tests/external/wpt/css/css-values/minmax-time-computed.html new file mode 100644 index 0000000..36bcf601 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-values/minmax-time-computed.html
@@ -0,0 +1,53 @@ +<!DOCTYPE html> +<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func"> +<link rel="help" href="https://drafts.csswg.org/css-values-4/#time"> +<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking"> +<link rel="author" title="Xiaocheng Hu" href="mailto:xiaochengh@chromium.org"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../support/computed-testcommon.js"></script> +<div id="target"></div> +<div id="reference"></div> +<script> +const property = 'transition-delay'; + +function test_time_equals(value, expected) { + const reference = document.getElementById('reference'); + reference.style[property] = ''; + reference.style[property] = expected; + const computed = getComputedStyle(reference)[property]; + test_computed_value(property, value, computed); +} + +// Identity tests +test_time_equals('min(1s)', '1s'); +test_time_equals('min(1ms)', '1ms'); +test_time_equals('max(1s)', '1s'); +test_time_equals('max(1ms)', '1ms'); + +// Comparisons between same units +test_time_equals('min(1s, 2s)', '1s'); +test_time_equals('min(1ms, 2ms)', '1ms'); +test_time_equals('max(1s, 2s)', '2s'); +test_time_equals('max(1ms, 2ms)', '2ms'); + +// Comparisons between different units +test_time_equals('min(1s, 1100ms)', '1s'); +test_time_equals('max(0.9s, 1000ms)', '1000ms'); + +// Nestings +test_time_equals('min(2s, max(1s, 1500ms))', '1500ms'); +test_time_equals('max(1000ms, min(2000ms, 1.5s))', '1.5s'); + +// General calculations +test_time_equals('calc(min(0.5s, 600ms) + 500ms)', '1s'); +test_time_equals('calc(min(0.5s, 600ms) - 500ms)', '0s'); +test_time_equals('calc(min(0.5s, 600ms) * 2)', '1s'); +test_time_equals('calc(min(0.5s, 600ms) / 2)', '0.25s'); +test_time_equals('calc(max(0.5s, 400ms) + 500ms)', '1s'); +test_time_equals('calc(max(0.5s, 400ms) - 500ms)', '0s'); +test_time_equals('calc(max(0.5s, 400ms) * 2)', '1s'); +test_time_equals('calc(max(0.5s, 400ms) / 2)', '0.25s'); +test_time_equals('calc(min(0.5s, 600ms) + max(500ms, 0.4s))', '1s'); +test_time_equals('calc(min(0.5s, 600ms) - max(500ms, 0.4s))', '0s'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-values/minmax-time-invalid.html b/third_party/blink/web_tests/external/wpt/css/css-values/minmax-time-invalid.html new file mode 100644 index 0000000..bebe674 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-values/minmax-time-invalid.html
@@ -0,0 +1,69 @@ +<!DOCTYPE html> +<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func"> +<link rel="help" href="https://drafts.csswg.org/css-values-4/#time"> +<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking"> +<link rel="author" title="Xiaocheng Hu" href="mailto:xiaochengh@chromium.org"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../support/parsing-testcommon.js"></script> +<script> +function test_invalid_time(value) { + test_invalid_value('transition-delay', value); +} + +// Syntax checking +test_invalid_time('min()'); +test_invalid_time('min( )'); +test_invalid_time('min(,)'); +test_invalid_time('min(1mt)'); +test_invalid_time('min(1s, )'); +test_invalid_time('min(, 1s)'); +test_invalid_time('min(1s + )'); +test_invalid_time('min(1s - )'); +test_invalid_time('min(1s * )'); +test_invalid_time('min(1s / )'); +test_invalid_time('min(1s 2s)'); +test_invalid_time('min(1s, , 2s)'); +test_invalid_time('max()'); +test_invalid_time('max( )'); +test_invalid_time('max(,)'); +test_invalid_time('max(1dag)'); +test_invalid_time('max(1s, )'); +test_invalid_time('max(, 1s)'); +test_invalid_time('max(1s + )'); +test_invalid_time('max(1s - )'); +test_invalid_time('max(1s * )'); +test_invalid_time('max(1s / )'); +test_invalid_time('max(1s 2s)'); +test_invalid_time('max(1s, , 2s)'); + +// Type checking +test_invalid_time('min(0)'); +test_invalid_time('min(0%)'); +test_invalid_time('min(0px)'); +test_invalid_time('min(0deg)'); +test_invalid_time('min(0Hz)'); +test_invalid_time('min(0dpi)'); +test_invalid_time('min(0fr)'); +test_invalid_time('min(1s, 0)'); +test_invalid_time('min(1s, 0%)'); +test_invalid_time('min(1s, 0px)'); +test_invalid_time('min(1s, 0deg)'); +test_invalid_time('min(1s, 0Hz)'); +test_invalid_time('min(1s, 0dpi)'); +test_invalid_time('min(1s, 0fr)'); +test_invalid_time('max(0)'); +test_invalid_time('max(0%)'); +test_invalid_time('max(0px)'); +test_invalid_time('max(0deg)'); +test_invalid_time('max(0Hz)'); +test_invalid_time('max(0dpi)'); +test_invalid_time('max(0fr)'); +test_invalid_time('max(1s, 0)'); +test_invalid_time('max(1s, 0%)'); +test_invalid_time('max(1s, 0px)'); +test_invalid_time('max(1s, 0deg)'); +test_invalid_time('max(1s, 0Hz)'); +test_invalid_time('max(1s, 0dpi)'); +test_invalid_time('max(1s, 0fr)'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/reference/available-size-001-ref.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/reference/available-size-001-ref.html index 8425294..d59cde45 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/reference/available-size-001-ref.html +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/reference/available-size-001-ref.html
@@ -10,6 +10,7 @@ writing-mode: vertical-rl; background: green; border-top: 1ch solid white; + height: 1ch; } </style>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/reference/available-size-002-ref.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/reference/available-size-002-ref.html index 6fdbf9a..ddebe938 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/reference/available-size-002-ref.html +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/reference/available-size-002-ref.html
@@ -9,6 +9,7 @@ color: transparent; writing-mode: vertical-rl; background: green; + height: 1ch; } </style>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-001-manual.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-001-manual.html index a3878d1..a6ce755 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-001-manual.html +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-001-manual.html
@@ -5,6 +5,7 @@ <title>writing mode:vertical-lr, input type=text</title> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"/> <link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#block-flow"/> +<meta name="flags" content="should"/> <meta name="assert" content="writing-mode:vertical-lr will display an input field for text vertically, and with vertical text inside."/> <style type="text/css"> @font-face {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-002-manual.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-002-manual.html index 751057dc..9f331a0 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-002-manual.html +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-002-manual.html
@@ -5,6 +5,7 @@ <title>writing mode:vertical-lr, input type=text placeholder</title> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"/> <link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#block-flow"/> +<meta name="flags" content="should"/> <meta name="assert" content="writing-mode:vertical-lr will display an input field for text vertically, and with vertical placeholder text inside."/> <style type="text/css"> @font-face {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-003-manual.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-003-manual.html index bf3d839..624cd24 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-003-manual.html +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-003-manual.html
@@ -5,6 +5,7 @@ <title>writing mode:vertical-lr, textarea</title> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"/> <link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#block-flow"/> +<meta name="flags" content="should"/> <meta name="assert" content="writing-mode:vertical-lr will display a textarea field vertically, and with vertical text inside."/> <style type="text/css"> @font-face {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-004-manual.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-004-manual.html index 91f991f..ce11f1f 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-004-manual.html +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-004-manual.html
@@ -5,6 +5,7 @@ <title>writing mode:vertical-lr, textarea placeholder</title> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"/> <link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#block-flow"/> +<meta name="flags" content="should"/> <meta name="assert" content="writing-mode:vertical-lr will display a textarea field vertically, and with vertical placeholder text inside."/> <style type="text/css"> @font-face {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-005-manual.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-005-manual.html index 361f9db..c2bf8bb0 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-005-manual.html +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vlr-forms-005-manual.html
@@ -5,6 +5,7 @@ <title>writing mode:vertical-lr, select, selected item</title> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"/> <link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#block-flow"/> +<meta name="flags" content="should"/> <meta name="assert" content="writing-mode:vertical-lr will display a select box vertically, and the selected item will be displayed vertically."/> <style type="text/css"> @font-face {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-001-manual.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-001-manual.html index 20dea4f..6963541d 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-001-manual.html +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-001-manual.html
@@ -5,6 +5,7 @@ <title>writing mode:vertical-rl, input type=text</title> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"/> <link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#block-flow"/> +<meta name="flags" content="should"/> <meta name="assert" content="writing-mode:vertical-rl will display an input field for text vertically, and with vertical text inside."/> <style type="text/css"> @font-face {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-002-manual.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-002-manual.html index 5d7db3e..f7c1b0f 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-002-manual.html +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-002-manual.html
@@ -5,6 +5,7 @@ <title>writing mode:vertical-rl, input type=text placeholder</title> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"/> <link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#block-flow"/> +<meta name="flags" content="should"/> <meta name="assert" content="writing-mode:vertical-rl will display an input field for text vertically, and with vertical placeholder text inside."/> <style type="text/css"> @font-face {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-003-manual.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-003-manual.html index 3dfe1d61..6e960b8 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-003-manual.html +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-003-manual.html
@@ -5,6 +5,7 @@ <title>writing mode:vertical-rl, textarea</title> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"/> <link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#block-flow"/> +<meta name="flags" content="should"/> <meta name="assert" content="writing-mode:vertical-rl will display a textarea field vertically, and with vertical text inside."/> <style type="text/css"> @font-face {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-004-manual.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-004-manual.html index 074603d..bebdf9ca 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-004-manual.html +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-004-manual.html
@@ -5,6 +5,7 @@ <title>writing mode:vertical-rl, textarea placeholder</title> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"/> <link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#block-flow"/> +<meta name="flags" content="should"/> <meta name="assert" content="writing-mode:vertical-rl will display a textarea field vertically, and with vertical placeholder text inside."/> <style type="text/css"> @font-face {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-005-manual.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-005-manual.html index 2ce63cd..dfad4e00 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-005-manual.html +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/writing-mode-vrl-forms-005-manual.html
@@ -5,6 +5,7 @@ <title>writing mode:vertical-rl, select, selected item</title> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"/> <link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#block-flow"/> +<meta name="flags" content="should"/> <meta name="assert" content="writing-mode:vertical-rl will display a select box vertically, and the selected item will be displayed vertically."/> <style type="text/css"> @font-face {
diff --git a/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-001-expected.txt b/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-001-expected.txt new file mode 100644 index 0000000..3823e2f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-001-expected.txt
@@ -0,0 +1,148 @@ +This is a testharness.js-based test. +Found 144 tests; 136 PASS, 8 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS CSS Transitions: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (-0.5) should be [hue-rotate(-90deg) blur(4px)] +PASS CSS Transitions: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (0) should be [hue-rotate(0deg) blur(6px)] +PASS CSS Transitions: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (0.25) should be [hue-rotate(45deg) blur(7px)] +PASS CSS Transitions: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (0.5) should be [hue-rotate(90deg) blur(8px)] +PASS CSS Transitions: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (1) should be [hue-rotate(180deg) blur(10px)] +PASS CSS Transitions: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (1.5) should be [hue-rotate(270deg) blur(12px)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (-0.5) should be [hue-rotate(-90deg) blur(4px)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (0) should be [hue-rotate(0deg) blur(6px)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (0.25) should be [hue-rotate(45deg) blur(7px)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (0.5) should be [hue-rotate(90deg) blur(8px)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (1) should be [hue-rotate(180deg) blur(10px)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (1.5) should be [hue-rotate(270deg) blur(12px)] +PASS CSS Animations: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (-0.5) should be [hue-rotate(-90deg) blur(4px)] +PASS CSS Animations: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (0) should be [hue-rotate(0deg) blur(6px)] +PASS CSS Animations: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (0.25) should be [hue-rotate(45deg) blur(7px)] +PASS CSS Animations: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (0.5) should be [hue-rotate(90deg) blur(8px)] +PASS CSS Animations: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (1) should be [hue-rotate(180deg) blur(10px)] +PASS CSS Animations: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (1.5) should be [hue-rotate(270deg) blur(12px)] +PASS Web Animations: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (-0.5) should be [hue-rotate(-90deg) blur(4px)] +PASS Web Animations: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (0) should be [hue-rotate(0deg) blur(6px)] +PASS Web Animations: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (0.25) should be [hue-rotate(45deg) blur(7px)] +PASS Web Animations: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (0.5) should be [hue-rotate(90deg) blur(8px)] +PASS Web Animations: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (1) should be [hue-rotate(180deg) blur(10px)] +PASS Web Animations: property <filter> from [hue-rotate(0deg) blur(6px)] to [hue-rotate(180deg) blur(10px)] at (1.5) should be [hue-rotate(270deg) blur(12px)] +PASS CSS Transitions: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (-0.5) should be [hue-rotate(75deg) blur(15.1181px)] +PASS CSS Transitions: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (0) should be [hue-rotate(80deg) blur(22.6772px)] +PASS CSS Transitions: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (0.25) should be [hue-rotate(82.5deg) blur(26.4567px)] +PASS CSS Transitions: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (0.5) should be [hue-rotate(85deg) blur(30.2362px)] +PASS CSS Transitions: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (1) should be [hue-rotate(90deg) blur(37.7953px)] +PASS CSS Transitions: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (1.5) should be [hue-rotate(95deg) blur(45.3543px)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (-0.5) should be [hue-rotate(75deg) blur(15.1181px)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (0) should be [hue-rotate(80deg) blur(22.6772px)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (0.25) should be [hue-rotate(82.5deg) blur(26.4567px)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (0.5) should be [hue-rotate(85deg) blur(30.2362px)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (1) should be [hue-rotate(90deg) blur(37.7953px)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (1.5) should be [hue-rotate(95deg) blur(45.3543px)] +PASS CSS Animations: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (-0.5) should be [hue-rotate(75deg) blur(15.1181px)] +PASS CSS Animations: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (0) should be [hue-rotate(80deg) blur(22.6772px)] +PASS CSS Animations: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (0.25) should be [hue-rotate(82.5deg) blur(26.4567px)] +PASS CSS Animations: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (0.5) should be [hue-rotate(85deg) blur(30.2362px)] +PASS CSS Animations: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (1) should be [hue-rotate(90deg) blur(37.7953px)] +PASS CSS Animations: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (1.5) should be [hue-rotate(95deg) blur(45.3543px)] +PASS Web Animations: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (-0.5) should be [hue-rotate(75deg) blur(15.1181px)] +PASS Web Animations: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (0) should be [hue-rotate(80deg) blur(22.6772px)] +PASS Web Animations: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (0.25) should be [hue-rotate(82.5deg) blur(26.4567px)] +PASS Web Animations: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (0.5) should be [hue-rotate(85deg) blur(30.2362px)] +PASS Web Animations: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (1) should be [hue-rotate(90deg) blur(37.7953px)] +PASS Web Animations: property <filter> from [hue-rotate(80deg) blur(6mm)] to [hue-rotate(100grad) blur(1cm)] at (1.5) should be [hue-rotate(95deg) blur(45.3543px)] +PASS CSS Transitions: property <filter> from neutral to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(5deg)] +PASS CSS Transitions: property <filter> from neutral to [hue-rotate(20deg)] at (0) should be [hue-rotate(10deg)] +PASS CSS Transitions: property <filter> from neutral to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(13deg)] +PASS CSS Transitions: property <filter> from neutral to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(16deg)] +PASS CSS Transitions: property <filter> from neutral to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS CSS Transitions: property <filter> from neutral to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(25deg)] +PASS CSS Transitions with transition: all: property <filter> from neutral to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(5deg)] +PASS CSS Transitions with transition: all: property <filter> from neutral to [hue-rotate(20deg)] at (0) should be [hue-rotate(10deg)] +PASS CSS Transitions with transition: all: property <filter> from neutral to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(13deg)] +PASS CSS Transitions with transition: all: property <filter> from neutral to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(16deg)] +PASS CSS Transitions with transition: all: property <filter> from neutral to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS CSS Transitions with transition: all: property <filter> from neutral to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(25deg)] +PASS CSS Animations: property <filter> from neutral to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(5deg)] +PASS CSS Animations: property <filter> from neutral to [hue-rotate(20deg)] at (0) should be [hue-rotate(10deg)] +PASS CSS Animations: property <filter> from neutral to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(13deg)] +PASS CSS Animations: property <filter> from neutral to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(16deg)] +PASS CSS Animations: property <filter> from neutral to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS CSS Animations: property <filter> from neutral to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(25deg)] +PASS Web Animations: property <filter> from neutral to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(5deg)] +PASS Web Animations: property <filter> from neutral to [hue-rotate(20deg)] at (0) should be [hue-rotate(10deg)] +PASS Web Animations: property <filter> from neutral to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(13deg)] +PASS Web Animations: property <filter> from neutral to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(16deg)] +PASS Web Animations: property <filter> from neutral to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS Web Animations: property <filter> from neutral to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(25deg)] +PASS CSS Transitions: property <filter> from [initial] to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(-10deg)] +FAIL CSS Transitions: property <filter> from [initial] to [hue-rotate(20deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Transitions: property <filter> from [initial] to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(6deg)] +PASS CSS Transitions: property <filter> from [initial] to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(12deg)] +PASS CSS Transitions: property <filter> from [initial] to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS CSS Transitions: property <filter> from [initial] to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(30deg)] +PASS CSS Transitions with transition: all: property <filter> from [initial] to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(-10deg)] +FAIL CSS Transitions with transition: all: property <filter> from [initial] to [hue-rotate(20deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [initial] to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(6deg)] +PASS CSS Transitions with transition: all: property <filter> from [initial] to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(12deg)] +PASS CSS Transitions with transition: all: property <filter> from [initial] to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS CSS Transitions with transition: all: property <filter> from [initial] to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(30deg)] +PASS CSS Animations: property <filter> from [initial] to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(-10deg)] +FAIL CSS Animations: property <filter> from [initial] to [hue-rotate(20deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Animations: property <filter> from [initial] to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(6deg)] +PASS CSS Animations: property <filter> from [initial] to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(12deg)] +PASS CSS Animations: property <filter> from [initial] to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS CSS Animations: property <filter> from [initial] to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(30deg)] +PASS Web Animations: property <filter> from [initial] to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(-10deg)] +FAIL Web Animations: property <filter> from [initial] to [hue-rotate(20deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS Web Animations: property <filter> from [initial] to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(6deg)] +PASS Web Animations: property <filter> from [initial] to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(12deg)] +PASS Web Animations: property <filter> from [initial] to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS Web Animations: property <filter> from [initial] to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(30deg)] +PASS CSS Transitions: property <filter> from [inherit] to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(35deg)] +PASS CSS Transitions: property <filter> from [inherit] to [hue-rotate(20deg)] at (0) should be [hue-rotate(30deg)] +PASS CSS Transitions: property <filter> from [inherit] to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(27deg)] +PASS CSS Transitions: property <filter> from [inherit] to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(24deg)] +PASS CSS Transitions: property <filter> from [inherit] to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS CSS Transitions: property <filter> from [inherit] to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(15deg)] +PASS CSS Transitions with transition: all: property <filter> from [inherit] to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(35deg)] +PASS CSS Transitions with transition: all: property <filter> from [inherit] to [hue-rotate(20deg)] at (0) should be [hue-rotate(30deg)] +PASS CSS Transitions with transition: all: property <filter> from [inherit] to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(27deg)] +PASS CSS Transitions with transition: all: property <filter> from [inherit] to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(24deg)] +PASS CSS Transitions with transition: all: property <filter> from [inherit] to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS CSS Transitions with transition: all: property <filter> from [inherit] to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(15deg)] +PASS CSS Animations: property <filter> from [inherit] to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(35deg)] +PASS CSS Animations: property <filter> from [inherit] to [hue-rotate(20deg)] at (0) should be [hue-rotate(30deg)] +PASS CSS Animations: property <filter> from [inherit] to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(27deg)] +PASS CSS Animations: property <filter> from [inherit] to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(24deg)] +PASS CSS Animations: property <filter> from [inherit] to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS CSS Animations: property <filter> from [inherit] to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(15deg)] +PASS Web Animations: property <filter> from [inherit] to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(35deg)] +PASS Web Animations: property <filter> from [inherit] to [hue-rotate(20deg)] at (0) should be [hue-rotate(30deg)] +PASS Web Animations: property <filter> from [inherit] to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(27deg)] +PASS Web Animations: property <filter> from [inherit] to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(24deg)] +PASS Web Animations: property <filter> from [inherit] to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS Web Animations: property <filter> from [inherit] to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(15deg)] +PASS CSS Transitions: property <filter> from [unset] to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(-10deg)] +FAIL CSS Transitions: property <filter> from [unset] to [hue-rotate(20deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Transitions: property <filter> from [unset] to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(6deg)] +PASS CSS Transitions: property <filter> from [unset] to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(12deg)] +PASS CSS Transitions: property <filter> from [unset] to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS CSS Transitions: property <filter> from [unset] to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(30deg)] +PASS CSS Transitions with transition: all: property <filter> from [unset] to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(-10deg)] +FAIL CSS Transitions with transition: all: property <filter> from [unset] to [hue-rotate(20deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [unset] to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(6deg)] +PASS CSS Transitions with transition: all: property <filter> from [unset] to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(12deg)] +PASS CSS Transitions with transition: all: property <filter> from [unset] to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS CSS Transitions with transition: all: property <filter> from [unset] to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(30deg)] +PASS CSS Animations: property <filter> from [unset] to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(-10deg)] +FAIL CSS Animations: property <filter> from [unset] to [hue-rotate(20deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Animations: property <filter> from [unset] to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(6deg)] +PASS CSS Animations: property <filter> from [unset] to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(12deg)] +PASS CSS Animations: property <filter> from [unset] to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS CSS Animations: property <filter> from [unset] to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(30deg)] +PASS Web Animations: property <filter> from [unset] to [hue-rotate(20deg)] at (-0.5) should be [hue-rotate(-10deg)] +FAIL Web Animations: property <filter> from [unset] to [hue-rotate(20deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS Web Animations: property <filter> from [unset] to [hue-rotate(20deg)] at (0.3) should be [hue-rotate(6deg)] +PASS Web Animations: property <filter> from [unset] to [hue-rotate(20deg)] at (0.6) should be [hue-rotate(12deg)] +PASS Web Animations: property <filter> from [unset] to [hue-rotate(20deg)] at (1) should be [hue-rotate(20deg)] +PASS Web Animations: property <filter> from [unset] to [hue-rotate(20deg)] at (1.5) should be [hue-rotate(30deg)] +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-001.html b/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-001.html index b4a4b3f..62fcbf0a 100644 --- a/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-001.html +++ b/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-001.html
@@ -9,8 +9,23 @@ <script src="/resources/testharnessreport.js"></script> <script src="/css/support/interpolation-testcommon.js"></script> <style> - body { - color: blue; + .parent { + filter: hue-rotate(30deg); + } + .target { + display: inline-block; + width: 50px; + height: 50px; + background-color: green; + color: white; + margin-right: 2px; + filter: hue-rotate(10deg); + } + .expected { + margin-right: 20px; + } + .test { + padding-bottom: 10px; } </style> </head> @@ -44,6 +59,58 @@ {at: 1, expect: 'hue-rotate(90deg) blur(10mm)'}, {at: 1.5, expect: 'hue-rotate(95deg) blur(12mm)'} ]); + + test_interpolation({ + property: 'filter', + from: neutralKeyframe, + to: 'hue-rotate(20deg)', + }, [ + {at: -0.5, expect: 'hue-rotate(5deg)'}, + {at: 0, expect: 'hue-rotate(10deg)'}, + {at: 0.3, expect: 'hue-rotate(13deg)'}, + {at: 0.6, expect: 'hue-rotate(16deg)'}, + {at: 1, expect: 'hue-rotate(20deg)'}, + {at: 1.5, expect: 'hue-rotate(25deg)'}, + ]); + + test_interpolation({ + property: 'filter', + from: 'initial', + to: 'hue-rotate(20deg)', + }, [ + {at: -0.5, expect: 'hue-rotate(-10deg)'}, + {at: 0, expect: 'hue-rotate(0deg)'}, + {at: 0.3, expect: 'hue-rotate(6deg)'}, + {at: 0.6, expect: 'hue-rotate(12deg)'}, + {at: 1, expect: 'hue-rotate(20deg)'}, + {at: 1.5, expect: 'hue-rotate(30deg)'}, + ]); + + test_interpolation({ + property: 'filter', + from: 'inherit', + to: 'hue-rotate(20deg)', + }, [ + {at: -0.5, expect: 'hue-rotate(35deg)'}, + {at: 0, expect: 'hue-rotate(30deg)'}, + {at: 0.3, expect: 'hue-rotate(27deg)'}, + {at: 0.6, expect: 'hue-rotate(24deg)'}, + {at: 1, expect: 'hue-rotate(20deg)'}, + {at: 1.5, expect: 'hue-rotate(15deg)'}, + ]); + + test_interpolation({ + property: 'filter', + from: 'unset', + to: 'hue-rotate(20deg)', + }, [ + {at: -0.5, expect: 'hue-rotate(-10deg)'}, + {at: 0, expect: 'hue-rotate(0deg)'}, + {at: 0.3, expect: 'hue-rotate(6deg)'}, + {at: 0.6, expect: 'hue-rotate(12deg)'}, + {at: 1, expect: 'hue-rotate(20deg)'}, + {at: 1.5, expect: 'hue-rotate(30deg)'}, + ]); </script> </body> </html>
diff --git a/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-002-expected.txt b/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-002-expected.txt new file mode 100644 index 0000000..19f208e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-002-expected.txt
@@ -0,0 +1,152 @@ +This is a testharness.js-based test. +Found 148 tests; 132 PASS, 16 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS CSS Transitions: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (-0.5) should be [opacity(1) hue-rotate(-90deg)] +FAIL CSS Transitions: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (0) should be [opacity(1) hue-rotate(0deg)] assert_equals: expected "opacity ( 1 ) hue - rotate ( 0deg ) " but got "none " +PASS CSS Transitions: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (0.25) should be [opacity(0.875) hue-rotate(45deg)] +PASS CSS Transitions: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (0.5) should be [opacity(0.75) hue-rotate(90deg)] +PASS CSS Transitions: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (1) should be [opacity(0.5) hue-rotate(180deg)] +PASS CSS Transitions: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (1.5) should be [opacity(0.25) hue-rotate(270deg)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (-0.5) should be [opacity(1) hue-rotate(-90deg)] +FAIL CSS Transitions with transition: all: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (0) should be [opacity(1) hue-rotate(0deg)] assert_equals: expected "opacity ( 1 ) hue - rotate ( 0deg ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (0.25) should be [opacity(0.875) hue-rotate(45deg)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (0.5) should be [opacity(0.75) hue-rotate(90deg)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (1) should be [opacity(0.5) hue-rotate(180deg)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (1.5) should be [opacity(0.25) hue-rotate(270deg)] +PASS CSS Animations: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (-0.5) should be [opacity(1) hue-rotate(-90deg)] +FAIL CSS Animations: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (0) should be [opacity(1) hue-rotate(0deg)] assert_equals: expected "opacity ( 1 ) hue - rotate ( 0deg ) " but got "none " +PASS CSS Animations: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (0.25) should be [opacity(0.875) hue-rotate(45deg)] +PASS CSS Animations: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (0.5) should be [opacity(0.75) hue-rotate(90deg)] +PASS CSS Animations: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (1) should be [opacity(0.5) hue-rotate(180deg)] +PASS CSS Animations: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (1.5) should be [opacity(0.25) hue-rotate(270deg)] +PASS Web Animations: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (-0.5) should be [opacity(1) hue-rotate(-90deg)] +FAIL Web Animations: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (0) should be [opacity(1) hue-rotate(0deg)] assert_equals: expected "opacity ( 1 ) hue - rotate ( 0deg ) " but got "none " +PASS Web Animations: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (0.25) should be [opacity(0.875) hue-rotate(45deg)] +PASS Web Animations: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (0.5) should be [opacity(0.75) hue-rotate(90deg)] +PASS Web Animations: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (1) should be [opacity(0.5) hue-rotate(180deg)] +PASS Web Animations: property <filter> from [none] to [opacity(0.5) hue-rotate(180deg)] at (1.5) should be [opacity(0.25) hue-rotate(270deg)] +PASS CSS Transitions: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (-0.5) should be [blur(4px) hue-rotate(-90deg)] +FAIL CSS Transitions: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (0) should be [blur(6px) hue-rotate(0deg)] assert_equals: expected "blur ( 6px ) hue - rotate ( 0deg ) " but got "blur ( 6px ) " +PASS CSS Transitions: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (0.25) should be [blur(7px) hue-rotate(45deg)] +PASS CSS Transitions: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (0.5) should be [blur(8px) hue-rotate(90deg)] +PASS CSS Transitions: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (1) should be [blur(10px) hue-rotate(180deg)] +PASS CSS Transitions: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (1.5) should be [blur(12px) hue-rotate(270deg)] +PASS CSS Transitions with transition: all: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (-0.5) should be [blur(4px) hue-rotate(-90deg)] +FAIL CSS Transitions with transition: all: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (0) should be [blur(6px) hue-rotate(0deg)] assert_equals: expected "blur ( 6px ) hue - rotate ( 0deg ) " but got "blur ( 6px ) " +PASS CSS Transitions with transition: all: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (0.25) should be [blur(7px) hue-rotate(45deg)] +PASS CSS Transitions with transition: all: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (0.5) should be [blur(8px) hue-rotate(90deg)] +PASS CSS Transitions with transition: all: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (1) should be [blur(10px) hue-rotate(180deg)] +PASS CSS Transitions with transition: all: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (1.5) should be [blur(12px) hue-rotate(270deg)] +PASS CSS Animations: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (-0.5) should be [blur(4px) hue-rotate(-90deg)] +FAIL CSS Animations: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (0) should be [blur(6px) hue-rotate(0deg)] assert_equals: expected "blur ( 6px ) hue - rotate ( 0deg ) " but got "blur ( 6px ) " +PASS CSS Animations: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (0.25) should be [blur(7px) hue-rotate(45deg)] +PASS CSS Animations: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (0.5) should be [blur(8px) hue-rotate(90deg)] +PASS CSS Animations: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (1) should be [blur(10px) hue-rotate(180deg)] +PASS CSS Animations: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (1.5) should be [blur(12px) hue-rotate(270deg)] +PASS Web Animations: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (-0.5) should be [blur(4px) hue-rotate(-90deg)] +FAIL Web Animations: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (0) should be [blur(6px) hue-rotate(0deg)] assert_equals: expected "blur ( 6px ) hue - rotate ( 0deg ) " but got "blur ( 6px ) " +PASS Web Animations: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (0.25) should be [blur(7px) hue-rotate(45deg)] +PASS Web Animations: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (0.5) should be [blur(8px) hue-rotate(90deg)] +PASS Web Animations: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (1) should be [blur(10px) hue-rotate(180deg)] +PASS Web Animations: property <filter> from [blur(6px)] to [blur(10px) hue-rotate(180deg)] at (1.5) should be [blur(12px) hue-rotate(270deg)] +PASS CSS Transitions: property <filter> from [none] to [hue-rotate(180deg)] at (-0.5) should be [hue-rotate(-90deg)] +FAIL CSS Transitions: property <filter> from [none] to [hue-rotate(180deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Transitions: property <filter> from [none] to [hue-rotate(180deg)] at (0.25) should be [hue-rotate(45deg)] +PASS CSS Transitions: property <filter> from [none] to [hue-rotate(180deg)] at (0.5) should be [hue-rotate(90deg)] +PASS CSS Transitions: property <filter> from [none] to [hue-rotate(180deg)] at (1) should be [hue-rotate(180deg)] +PASS CSS Transitions: property <filter> from [none] to [hue-rotate(180deg)] at (1.5) should be [hue-rotate(270deg)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [hue-rotate(180deg)] at (-0.5) should be [hue-rotate(-90deg)] +FAIL CSS Transitions with transition: all: property <filter> from [none] to [hue-rotate(180deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [none] to [hue-rotate(180deg)] at (0.25) should be [hue-rotate(45deg)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [hue-rotate(180deg)] at (0.5) should be [hue-rotate(90deg)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [hue-rotate(180deg)] at (1) should be [hue-rotate(180deg)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [hue-rotate(180deg)] at (1.5) should be [hue-rotate(270deg)] +PASS CSS Animations: property <filter> from [none] to [hue-rotate(180deg)] at (-0.5) should be [hue-rotate(-90deg)] +FAIL CSS Animations: property <filter> from [none] to [hue-rotate(180deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Animations: property <filter> from [none] to [hue-rotate(180deg)] at (0.25) should be [hue-rotate(45deg)] +PASS CSS Animations: property <filter> from [none] to [hue-rotate(180deg)] at (0.5) should be [hue-rotate(90deg)] +PASS CSS Animations: property <filter> from [none] to [hue-rotate(180deg)] at (1) should be [hue-rotate(180deg)] +PASS CSS Animations: property <filter> from [none] to [hue-rotate(180deg)] at (1.5) should be [hue-rotate(270deg)] +PASS Web Animations: property <filter> from [none] to [hue-rotate(180deg)] at (-0.5) should be [hue-rotate(-90deg)] +FAIL Web Animations: property <filter> from [none] to [hue-rotate(180deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS Web Animations: property <filter> from [none] to [hue-rotate(180deg)] at (0.25) should be [hue-rotate(45deg)] +PASS Web Animations: property <filter> from [none] to [hue-rotate(180deg)] at (0.5) should be [hue-rotate(90deg)] +PASS Web Animations: property <filter> from [none] to [hue-rotate(180deg)] at (1) should be [hue-rotate(180deg)] +PASS Web Animations: property <filter> from [none] to [hue-rotate(180deg)] at (1.5) should be [hue-rotate(270deg)] +PASS CSS Transitions: property <filter> from [hue-rotate(180deg)] to [none] at (-0.5) should be [hue-rotate(270deg)] +PASS CSS Transitions: property <filter> from [hue-rotate(180deg)] to [none] at (0) should be [hue-rotate(180deg)] +PASS CSS Transitions: property <filter> from [hue-rotate(180deg)] to [none] at (0.25) should be [hue-rotate(135deg)] +PASS CSS Transitions: property <filter> from [hue-rotate(180deg)] to [none] at (0.5) should be [hue-rotate(90deg)] +FAIL CSS Transitions: property <filter> from [hue-rotate(180deg)] to [none] at (1) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Transitions: property <filter> from [hue-rotate(180deg)] to [none] at (1.5) should be [hue-rotate(-90deg)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(180deg)] to [none] at (-0.5) should be [hue-rotate(270deg)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(180deg)] to [none] at (0) should be [hue-rotate(180deg)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(180deg)] to [none] at (0.25) should be [hue-rotate(135deg)] +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(180deg)] to [none] at (0.5) should be [hue-rotate(90deg)] +FAIL CSS Transitions with transition: all: property <filter> from [hue-rotate(180deg)] to [none] at (1) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [hue-rotate(180deg)] to [none] at (1.5) should be [hue-rotate(-90deg)] +PASS CSS Animations: property <filter> from [hue-rotate(180deg)] to [none] at (-0.5) should be [hue-rotate(270deg)] +PASS CSS Animations: property <filter> from [hue-rotate(180deg)] to [none] at (0) should be [hue-rotate(180deg)] +PASS CSS Animations: property <filter> from [hue-rotate(180deg)] to [none] at (0.25) should be [hue-rotate(135deg)] +PASS CSS Animations: property <filter> from [hue-rotate(180deg)] to [none] at (0.5) should be [hue-rotate(90deg)] +FAIL CSS Animations: property <filter> from [hue-rotate(180deg)] to [none] at (1) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Animations: property <filter> from [hue-rotate(180deg)] to [none] at (1.5) should be [hue-rotate(-90deg)] +PASS Web Animations: property <filter> from [hue-rotate(180deg)] to [none] at (-0.5) should be [hue-rotate(270deg)] +PASS Web Animations: property <filter> from [hue-rotate(180deg)] to [none] at (0) should be [hue-rotate(180deg)] +PASS Web Animations: property <filter> from [hue-rotate(180deg)] to [none] at (0.25) should be [hue-rotate(135deg)] +PASS Web Animations: property <filter> from [hue-rotate(180deg)] to [none] at (0.5) should be [hue-rotate(90deg)] +FAIL Web Animations: property <filter> from [hue-rotate(180deg)] to [none] at (1) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS Web Animations: property <filter> from [hue-rotate(180deg)] to [none] at (1.5) should be [hue-rotate(-90deg)] +PASS CSS Transitions: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (-1) should be [drop-shadow(rgb(255, 255, 255) -20px -10px 0px)] +PASS CSS Transitions: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (0) should be [drop-shadow(rgb(255, 255, 255) 0px 0px 0px)] +PASS CSS Transitions: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (0.5) should be [drop-shadow(rgb(128, 192, 128) 10px 5px 0px)] +PASS CSS Transitions: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (1) should be [drop-shadow(rgb(0, 128, 0) 20px 10px 0px)] +PASS CSS Transitions: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (1.5) should be [drop-shadow(rgb(0, 65, 0) 30px 15px 0px)] +PASS CSS Transitions with transition: all: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (-1) should be [drop-shadow(rgb(255, 255, 255) -20px -10px 0px)] +PASS CSS Transitions with transition: all: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (0) should be [drop-shadow(rgb(255, 255, 255) 0px 0px 0px)] +PASS CSS Transitions with transition: all: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (0.5) should be [drop-shadow(rgb(128, 192, 128) 10px 5px 0px)] +PASS CSS Transitions with transition: all: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (1) should be [drop-shadow(rgb(0, 128, 0) 20px 10px 0px)] +PASS CSS Transitions with transition: all: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (1.5) should be [drop-shadow(rgb(0, 65, 0) 30px 15px 0px)] +PASS CSS Animations: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (-1) should be [drop-shadow(rgb(255, 255, 255) -20px -10px 0px)] +PASS CSS Animations: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (0) should be [drop-shadow(rgb(255, 255, 255) 0px 0px 0px)] +PASS CSS Animations: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (0.5) should be [drop-shadow(rgb(128, 192, 128) 10px 5px 0px)] +PASS CSS Animations: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (1) should be [drop-shadow(rgb(0, 128, 0) 20px 10px 0px)] +PASS CSS Animations: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (1.5) should be [drop-shadow(rgb(0, 65, 0) 30px 15px 0px)] +PASS Web Animations: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (-1) should be [drop-shadow(rgb(255, 255, 255) -20px -10px 0px)] +PASS Web Animations: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (0) should be [drop-shadow(rgb(255, 255, 255) 0px 0px 0px)] +PASS Web Animations: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (0.5) should be [drop-shadow(rgb(128, 192, 128) 10px 5px 0px)] +PASS Web Animations: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (1) should be [drop-shadow(rgb(0, 128, 0) 20px 10px 0px)] +PASS Web Animations: property <filter> from [drop-shadow(0px 0px 0px currentcolor)] to [drop-shadow(20px 10px green)] at (1.5) should be [drop-shadow(rgb(0, 65, 0) 30px 15px 0px)] +PASS CSS Transitions: property <filter> from [drop-shadow(20px 10px blue)] to [drop-shadow(20px 10px green)] at (2147483648) should be [drop-shadow(rgb(0, 255, 0) 20px 10px 0px)] +PASS CSS Transitions with transition: all: property <filter> from [drop-shadow(20px 10px blue)] to [drop-shadow(20px 10px green)] at (2147483648) should be [drop-shadow(rgb(0, 255, 0) 20px 10px 0px)] +PASS CSS Animations: property <filter> from [drop-shadow(20px 10px blue)] to [drop-shadow(20px 10px green)] at (2147483648) should be [drop-shadow(rgb(0, 255, 0) 20px 10px 0px)] +PASS Web Animations: property <filter> from [drop-shadow(20px 10px blue)] to [drop-shadow(20px 10px green)] at (2147483648) should be [drop-shadow(rgb(0, 255, 0) 20px 10px 0px)] +PASS CSS Transitions: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (-0.3) should be [blur(10px)] +PASS CSS Transitions: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0) should be [blur(10px)] +PASS CSS Transitions: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0.3) should be [blur(10px)] +PASS CSS Transitions: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0.5) should be [blur(10px)] +PASS CSS Transitions: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0.6) should be [blur(10px)] +PASS CSS Transitions: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (1) should be [blur(10px)] +PASS CSS Transitions: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (1.5) should be [blur(10px)] +PASS CSS Transitions with transition: all: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (-0.3) should be [blur(10px)] +PASS CSS Transitions with transition: all: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0) should be [blur(10px)] +PASS CSS Transitions with transition: all: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0.3) should be [blur(10px)] +PASS CSS Transitions with transition: all: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0.5) should be [blur(10px)] +PASS CSS Transitions with transition: all: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0.6) should be [blur(10px)] +PASS CSS Transitions with transition: all: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (1) should be [blur(10px)] +PASS CSS Transitions with transition: all: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (1.5) should be [blur(10px)] +PASS CSS Animations: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (-0.3) should be [grayscale(0) blur(0px)] +PASS CSS Animations: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0) should be [grayscale(0) blur(0px)] +PASS CSS Animations: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0.3) should be [grayscale(0) blur(0px)] +PASS CSS Animations: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0.5) should be [blur(10px)] +PASS CSS Animations: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0.6) should be [blur(10px)] +PASS CSS Animations: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (1) should be [blur(10px)] +PASS CSS Animations: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (1.5) should be [blur(10px)] +PASS Web Animations: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (-0.3) should be [grayscale(0) blur(0px)] +PASS Web Animations: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0) should be [grayscale(0) blur(0px)] +PASS Web Animations: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0.3) should be [grayscale(0) blur(0px)] +PASS Web Animations: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0.5) should be [blur(10px)] +PASS Web Animations: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (0.6) should be [blur(10px)] +PASS Web Animations: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (1) should be [blur(10px)] +PASS Web Animations: property <filter> from [grayscale(0) blur(0px)] to [blur(10px)] at (1.5) should be [blur(10px)] +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-002.html b/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-002.html index 1b66c275..6ef25a7 100644 --- a/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-002.html +++ b/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-002.html
@@ -9,8 +9,19 @@ <script src="/resources/testharnessreport.js"></script> <script src="/css/support/interpolation-testcommon.js"></script> <style> - body { - color: blue; + .target { + display: inline-block; + width: 50px; + height: 50px; + background-color: green; + color: white; + margin-right: 2px; + } + .expected { + margin-right: 20px; + } + .test { + padding-bottom: 10px; } </style> </head> @@ -24,6 +35,7 @@ to: 'opacity(0.5) hue-rotate(180deg)', }, [ {at: -0.5, expect: 'opacity(1) hue-rotate(-90deg)'}, + {at: 0, expect: 'opacity(1) hue-rotate(0deg)'}, {at: 0.25, expect: 'opacity(0.875) hue-rotate(45deg)'}, {at: 0.5, expect: 'opacity(0.75) hue-rotate(90deg)'}, {at: 1, expect: 'opacity(0.5) hue-rotate(180deg)'}, @@ -36,12 +48,60 @@ to: 'blur(10px) hue-rotate(180deg)' }, [ {at: -0.5, expect: 'blur(4px) hue-rotate(-90deg)'}, + {at: 0, expect: 'blur(6px) hue-rotate(0deg)'}, {at: 0.25, expect: 'blur(7px) hue-rotate(45deg)'}, {at: 0.5, expect: 'blur(8px) hue-rotate(90deg)'}, {at: 1, expect: 'blur(10px) hue-rotate(180deg)'}, {at: 1.5, expect: 'blur(12px) hue-rotate(270deg)'}, ]); + test_interpolation({ + property: 'filter', + from: 'none', + to: 'hue-rotate(180deg)' + }, [ + {at: -0.5, expect: 'hue-rotate(-90deg)'}, + {at: 0, expect: 'hue-rotate(0deg)'}, + {at: 0.25, expect: 'hue-rotate(45deg)'}, + {at: 0.5, expect: 'hue-rotate(90deg)'}, + {at: 1, expect: 'hue-rotate(180deg)'}, + {at: 1.5, expect: 'hue-rotate(270deg)'}, + ]); + + test_interpolation({ + property: 'filter', + from: 'hue-rotate(180deg)', + to: 'none' + }, [ + {at: -0.5, expect: 'hue-rotate(270deg)'}, + {at: 0, expect: 'hue-rotate(180deg)'}, + {at: 0.25, expect: 'hue-rotate(135deg)'}, + {at: 0.5, expect: 'hue-rotate(90deg)'}, + {at: 1, expect: 'hue-rotate(0deg)'}, + {at: 1.5, expect: 'hue-rotate(-90deg)'}, + ]); + + test_interpolation({ + property: 'filter', + from: 'drop-shadow(0px 0px 0px currentcolor)', + to: 'drop-shadow(20px 10px green)' + }, [ + {at: -1, expect: 'drop-shadow(-20px -10px white)'}, + {at: 0, expect: 'drop-shadow(0px 0px 0px currentcolor)'}, + {at: 0.5, expect: 'drop-shadow(10px 5px #80C080)'}, + {at: 1, expect: 'drop-shadow(20px 10px green)'}, + {at: 1.5, expect: 'drop-shadow(30px 15px #004100)'} + ]); + + // crbug.com/904333: Test that ResolveInterpolableColor doesn't overflow. + test_interpolation({ + property: 'filter', + from: 'drop-shadow(20px 10px blue)', + to: 'drop-shadow(20px 10px green)' + }, [ + {at: 2147483648, expect: 'drop-shadow(20px 10px #00FF00'} + ]); + // Mismatched lists: test_no_interpolation({ property: 'filter',
diff --git a/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-003-expected.txt b/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-003-expected.txt new file mode 100644 index 0000000..92ca741 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-003-expected.txt
@@ -0,0 +1,280 @@ +This is a testharness.js-based test. +Found 276 tests; 232 PASS, 44 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS CSS Transitions: property <filter> from [none] to [blur(10px)] at (-1) should be [blur(0px)] +FAIL CSS Transitions: property <filter> from [none] to [blur(10px)] at (0) should be [blur(0px)] assert_equals: expected "blur ( 0px ) " but got "none " +PASS CSS Transitions: property <filter> from [none] to [blur(10px)] at (0.5) should be [blur(5px)] +PASS CSS Transitions: property <filter> from [none] to [blur(10px)] at (1) should be [blur(10px)] +PASS CSS Transitions: property <filter> from [none] to [blur(10px)] at (1.5) should be [blur(15px)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [blur(10px)] at (-1) should be [blur(0px)] +FAIL CSS Transitions with transition: all: property <filter> from [none] to [blur(10px)] at (0) should be [blur(0px)] assert_equals: expected "blur ( 0px ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [none] to [blur(10px)] at (0.5) should be [blur(5px)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [blur(10px)] at (1) should be [blur(10px)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [blur(10px)] at (1.5) should be [blur(15px)] +PASS CSS Animations: property <filter> from [none] to [blur(10px)] at (-1) should be [blur(0px)] +FAIL CSS Animations: property <filter> from [none] to [blur(10px)] at (0) should be [blur(0px)] assert_equals: expected "blur ( 0px ) " but got "none " +PASS CSS Animations: property <filter> from [none] to [blur(10px)] at (0.5) should be [blur(5px)] +PASS CSS Animations: property <filter> from [none] to [blur(10px)] at (1) should be [blur(10px)] +PASS CSS Animations: property <filter> from [none] to [blur(10px)] at (1.5) should be [blur(15px)] +PASS Web Animations: property <filter> from [none] to [blur(10px)] at (-1) should be [blur(0px)] +FAIL Web Animations: property <filter> from [none] to [blur(10px)] at (0) should be [blur(0px)] assert_equals: expected "blur ( 0px ) " but got "none " +PASS Web Animations: property <filter> from [none] to [blur(10px)] at (0.5) should be [blur(5px)] +PASS Web Animations: property <filter> from [none] to [blur(10px)] at (1) should be [blur(10px)] +PASS Web Animations: property <filter> from [none] to [blur(10px)] at (1.5) should be [blur(15px)] +PASS CSS Transitions: property <filter> from [brightness(0)] to [none] at (-1) should be [brightness(0)] +PASS CSS Transitions: property <filter> from [brightness(0)] to [none] at (0) should be [brightness(0)] +PASS CSS Transitions: property <filter> from [brightness(0)] to [none] at (0.5) should be [brightness(0.5)] +FAIL CSS Transitions: property <filter> from [brightness(0)] to [none] at (1) should be [brightness(1)] assert_equals: expected "brightness ( 1 ) " but got "none " +PASS CSS Transitions: property <filter> from [brightness(0)] to [none] at (1.5) should be [brightness(1.5)] +PASS CSS Transitions with transition: all: property <filter> from [brightness(0)] to [none] at (-1) should be [brightness(0)] +PASS CSS Transitions with transition: all: property <filter> from [brightness(0)] to [none] at (0) should be [brightness(0)] +PASS CSS Transitions with transition: all: property <filter> from [brightness(0)] to [none] at (0.5) should be [brightness(0.5)] +FAIL CSS Transitions with transition: all: property <filter> from [brightness(0)] to [none] at (1) should be [brightness(1)] assert_equals: expected "brightness ( 1 ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [brightness(0)] to [none] at (1.5) should be [brightness(1.5)] +PASS CSS Animations: property <filter> from [brightness(0)] to [none] at (-1) should be [brightness(0)] +PASS CSS Animations: property <filter> from [brightness(0)] to [none] at (0) should be [brightness(0)] +PASS CSS Animations: property <filter> from [brightness(0)] to [none] at (0.5) should be [brightness(0.5)] +FAIL CSS Animations: property <filter> from [brightness(0)] to [none] at (1) should be [brightness(1)] assert_equals: expected "brightness ( 1 ) " but got "none " +PASS CSS Animations: property <filter> from [brightness(0)] to [none] at (1.5) should be [brightness(1.5)] +PASS Web Animations: property <filter> from [brightness(0)] to [none] at (-1) should be [brightness(0)] +PASS Web Animations: property <filter> from [brightness(0)] to [none] at (0) should be [brightness(0)] +PASS Web Animations: property <filter> from [brightness(0)] to [none] at (0.5) should be [brightness(0.5)] +FAIL Web Animations: property <filter> from [brightness(0)] to [none] at (1) should be [brightness(1)] assert_equals: expected "brightness ( 1 ) " but got "none " +PASS Web Animations: property <filter> from [brightness(0)] to [none] at (1.5) should be [brightness(1.5)] +PASS CSS Transitions: property <filter> from [contrast(0)] to [none] at (-1) should be [contrast(0)] +PASS CSS Transitions: property <filter> from [contrast(0)] to [none] at (0) should be [contrast(0)] +PASS CSS Transitions: property <filter> from [contrast(0)] to [none] at (0.5) should be [contrast(0.5)] +FAIL CSS Transitions: property <filter> from [contrast(0)] to [none] at (1) should be [contrast(1)] assert_equals: expected "contrast ( 1 ) " but got "none " +PASS CSS Transitions: property <filter> from [contrast(0)] to [none] at (1.5) should be [contrast(1.5)] +PASS CSS Transitions with transition: all: property <filter> from [contrast(0)] to [none] at (-1) should be [contrast(0)] +PASS CSS Transitions with transition: all: property <filter> from [contrast(0)] to [none] at (0) should be [contrast(0)] +PASS CSS Transitions with transition: all: property <filter> from [contrast(0)] to [none] at (0.5) should be [contrast(0.5)] +FAIL CSS Transitions with transition: all: property <filter> from [contrast(0)] to [none] at (1) should be [contrast(1)] assert_equals: expected "contrast ( 1 ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [contrast(0)] to [none] at (1.5) should be [contrast(1.5)] +PASS CSS Animations: property <filter> from [contrast(0)] to [none] at (-1) should be [contrast(0)] +PASS CSS Animations: property <filter> from [contrast(0)] to [none] at (0) should be [contrast(0)] +PASS CSS Animations: property <filter> from [contrast(0)] to [none] at (0.5) should be [contrast(0.5)] +FAIL CSS Animations: property <filter> from [contrast(0)] to [none] at (1) should be [contrast(1)] assert_equals: expected "contrast ( 1 ) " but got "none " +PASS CSS Animations: property <filter> from [contrast(0)] to [none] at (1.5) should be [contrast(1.5)] +PASS Web Animations: property <filter> from [contrast(0)] to [none] at (-1) should be [contrast(0)] +PASS Web Animations: property <filter> from [contrast(0)] to [none] at (0) should be [contrast(0)] +PASS Web Animations: property <filter> from [contrast(0)] to [none] at (0.5) should be [contrast(0.5)] +FAIL Web Animations: property <filter> from [contrast(0)] to [none] at (1) should be [contrast(1)] assert_equals: expected "contrast ( 1 ) " but got "none " +PASS Web Animations: property <filter> from [contrast(0)] to [none] at (1.5) should be [contrast(1.5)] +PASS CSS Transitions: property <filter> from [none] to [drop-shadow(20px 10px green)] at (-1) should be [drop-shadow(rgba(0, 0, 0, 0) -20px -10px 0px)] +FAIL CSS Transitions: property <filter> from [none] to [drop-shadow(20px 10px green)] at (0) should be [drop-shadow(rgba(0, 0, 0, 0) 0px 0px 0px)] assert_equals: expected "drop - shadow ( rgba ( 0 , 0 , 0 , 0 ) 0px 0px 0px ) " but got "none " +PASS CSS Transitions: property <filter> from [none] to [drop-shadow(20px 10px green)] at (0.5) should be [drop-shadow(rgba(0, 128, 0, 0.5) 10px 5px 0px)] +PASS CSS Transitions: property <filter> from [none] to [drop-shadow(20px 10px green)] at (1) should be [drop-shadow(rgb(0, 128, 0) 20px 10px 0px)] +PASS CSS Transitions: property <filter> from [none] to [drop-shadow(20px 10px green)] at (1.5) should be [drop-shadow(rgb(0, 192, 0) 30px 15px 0px)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [drop-shadow(20px 10px green)] at (-1) should be [drop-shadow(rgba(0, 0, 0, 0) -20px -10px 0px)] +FAIL CSS Transitions with transition: all: property <filter> from [none] to [drop-shadow(20px 10px green)] at (0) should be [drop-shadow(rgba(0, 0, 0, 0) 0px 0px 0px)] assert_equals: expected "drop - shadow ( rgba ( 0 , 0 , 0 , 0 ) 0px 0px 0px ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [none] to [drop-shadow(20px 10px green)] at (0.5) should be [drop-shadow(rgba(0, 128, 0, 0.5) 10px 5px 0px)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [drop-shadow(20px 10px green)] at (1) should be [drop-shadow(rgb(0, 128, 0) 20px 10px 0px)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [drop-shadow(20px 10px green)] at (1.5) should be [drop-shadow(rgb(0, 192, 0) 30px 15px 0px)] +PASS CSS Animations: property <filter> from [none] to [drop-shadow(20px 10px green)] at (-1) should be [drop-shadow(rgba(0, 0, 0, 0) -20px -10px 0px)] +FAIL CSS Animations: property <filter> from [none] to [drop-shadow(20px 10px green)] at (0) should be [drop-shadow(rgba(0, 0, 0, 0) 0px 0px 0px)] assert_equals: expected "drop - shadow ( rgba ( 0 , 0 , 0 , 0 ) 0px 0px 0px ) " but got "none " +PASS CSS Animations: property <filter> from [none] to [drop-shadow(20px 10px green)] at (0.5) should be [drop-shadow(rgba(0, 128, 0, 0.5) 10px 5px 0px)] +PASS CSS Animations: property <filter> from [none] to [drop-shadow(20px 10px green)] at (1) should be [drop-shadow(rgb(0, 128, 0) 20px 10px 0px)] +PASS CSS Animations: property <filter> from [none] to [drop-shadow(20px 10px green)] at (1.5) should be [drop-shadow(rgb(0, 192, 0) 30px 15px 0px)] +PASS Web Animations: property <filter> from [none] to [drop-shadow(20px 10px green)] at (-1) should be [drop-shadow(rgba(0, 0, 0, 0) -20px -10px 0px)] +FAIL Web Animations: property <filter> from [none] to [drop-shadow(20px 10px green)] at (0) should be [drop-shadow(rgba(0, 0, 0, 0) 0px 0px 0px)] assert_equals: expected "drop - shadow ( rgba ( 0 , 0 , 0 , 0 ) 0px 0px 0px ) " but got "none " +PASS Web Animations: property <filter> from [none] to [drop-shadow(20px 10px green)] at (0.5) should be [drop-shadow(rgba(0, 128, 0, 0.5) 10px 5px 0px)] +PASS Web Animations: property <filter> from [none] to [drop-shadow(20px 10px green)] at (1) should be [drop-shadow(rgb(0, 128, 0) 20px 10px 0px)] +PASS Web Animations: property <filter> from [none] to [drop-shadow(20px 10px green)] at (1.5) should be [drop-shadow(rgb(0, 192, 0) 30px 15px 0px)] +PASS CSS Transitions: property <filter> from [none] to [grayscale(1)] at (-1) should be [grayscale(0)] +FAIL CSS Transitions: property <filter> from [none] to [grayscale(1)] at (0) should be [grayscale(0)] assert_equals: expected "grayscale ( 0 ) " but got "none " +PASS CSS Transitions: property <filter> from [none] to [grayscale(1)] at (0.5) should be [grayscale(0.5)] +PASS CSS Transitions: property <filter> from [none] to [grayscale(1)] at (1) should be [grayscale(1)] +PASS CSS Transitions: property <filter> from [none] to [grayscale(1)] at (1.5) should be [grayscale(1)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [grayscale(1)] at (-1) should be [grayscale(0)] +FAIL CSS Transitions with transition: all: property <filter> from [none] to [grayscale(1)] at (0) should be [grayscale(0)] assert_equals: expected "grayscale ( 0 ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [none] to [grayscale(1)] at (0.5) should be [grayscale(0.5)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [grayscale(1)] at (1) should be [grayscale(1)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [grayscale(1)] at (1.5) should be [grayscale(1)] +PASS CSS Animations: property <filter> from [none] to [grayscale(1)] at (-1) should be [grayscale(0)] +FAIL CSS Animations: property <filter> from [none] to [grayscale(1)] at (0) should be [grayscale(0)] assert_equals: expected "grayscale ( 0 ) " but got "none " +PASS CSS Animations: property <filter> from [none] to [grayscale(1)] at (0.5) should be [grayscale(0.5)] +PASS CSS Animations: property <filter> from [none] to [grayscale(1)] at (1) should be [grayscale(1)] +PASS CSS Animations: property <filter> from [none] to [grayscale(1)] at (1.5) should be [grayscale(1)] +PASS Web Animations: property <filter> from [none] to [grayscale(1)] at (-1) should be [grayscale(0)] +FAIL Web Animations: property <filter> from [none] to [grayscale(1)] at (0) should be [grayscale(0)] assert_equals: expected "grayscale ( 0 ) " but got "none " +PASS Web Animations: property <filter> from [none] to [grayscale(1)] at (0.5) should be [grayscale(0.5)] +PASS Web Animations: property <filter> from [none] to [grayscale(1)] at (1) should be [grayscale(1)] +PASS Web Animations: property <filter> from [none] to [grayscale(1)] at (1.5) should be [grayscale(1)] +PASS CSS Transitions: property <filter> from [none] to [hue-rotate(360deg)] at (-1) should be [hue-rotate(-360deg)] +FAIL CSS Transitions: property <filter> from [none] to [hue-rotate(360deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Transitions: property <filter> from [none] to [hue-rotate(360deg)] at (0.5) should be [hue-rotate(180deg)] +PASS CSS Transitions: property <filter> from [none] to [hue-rotate(360deg)] at (1) should be [hue-rotate(360deg)] +PASS CSS Transitions: property <filter> from [none] to [hue-rotate(360deg)] at (1.5) should be [hue-rotate(540deg)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [hue-rotate(360deg)] at (-1) should be [hue-rotate(-360deg)] +FAIL CSS Transitions with transition: all: property <filter> from [none] to [hue-rotate(360deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [none] to [hue-rotate(360deg)] at (0.5) should be [hue-rotate(180deg)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [hue-rotate(360deg)] at (1) should be [hue-rotate(360deg)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [hue-rotate(360deg)] at (1.5) should be [hue-rotate(540deg)] +PASS CSS Animations: property <filter> from [none] to [hue-rotate(360deg)] at (-1) should be [hue-rotate(-360deg)] +FAIL CSS Animations: property <filter> from [none] to [hue-rotate(360deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS CSS Animations: property <filter> from [none] to [hue-rotate(360deg)] at (0.5) should be [hue-rotate(180deg)] +PASS CSS Animations: property <filter> from [none] to [hue-rotate(360deg)] at (1) should be [hue-rotate(360deg)] +PASS CSS Animations: property <filter> from [none] to [hue-rotate(360deg)] at (1.5) should be [hue-rotate(540deg)] +PASS Web Animations: property <filter> from [none] to [hue-rotate(360deg)] at (-1) should be [hue-rotate(-360deg)] +FAIL Web Animations: property <filter> from [none] to [hue-rotate(360deg)] at (0) should be [hue-rotate(0deg)] assert_equals: expected "hue - rotate ( 0deg ) " but got "none " +PASS Web Animations: property <filter> from [none] to [hue-rotate(360deg)] at (0.5) should be [hue-rotate(180deg)] +PASS Web Animations: property <filter> from [none] to [hue-rotate(360deg)] at (1) should be [hue-rotate(360deg)] +PASS Web Animations: property <filter> from [none] to [hue-rotate(360deg)] at (1.5) should be [hue-rotate(540deg)] +PASS CSS Transitions: property <filter> from [none] to [invert(1)] at (-1) should be [invert(0)] +FAIL CSS Transitions: property <filter> from [none] to [invert(1)] at (0) should be [invert(0)] assert_equals: expected "invert ( 0 ) " but got "none " +PASS CSS Transitions: property <filter> from [none] to [invert(1)] at (0.5) should be [invert(0.5)] +PASS CSS Transitions: property <filter> from [none] to [invert(1)] at (1) should be [invert(1)] +PASS CSS Transitions: property <filter> from [none] to [invert(1)] at (1.5) should be [invert(1)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [invert(1)] at (-1) should be [invert(0)] +FAIL CSS Transitions with transition: all: property <filter> from [none] to [invert(1)] at (0) should be [invert(0)] assert_equals: expected "invert ( 0 ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [none] to [invert(1)] at (0.5) should be [invert(0.5)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [invert(1)] at (1) should be [invert(1)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [invert(1)] at (1.5) should be [invert(1)] +PASS CSS Animations: property <filter> from [none] to [invert(1)] at (-1) should be [invert(0)] +FAIL CSS Animations: property <filter> from [none] to [invert(1)] at (0) should be [invert(0)] assert_equals: expected "invert ( 0 ) " but got "none " +PASS CSS Animations: property <filter> from [none] to [invert(1)] at (0.5) should be [invert(0.5)] +PASS CSS Animations: property <filter> from [none] to [invert(1)] at (1) should be [invert(1)] +PASS CSS Animations: property <filter> from [none] to [invert(1)] at (1.5) should be [invert(1)] +PASS Web Animations: property <filter> from [none] to [invert(1)] at (-1) should be [invert(0)] +FAIL Web Animations: property <filter> from [none] to [invert(1)] at (0) should be [invert(0)] assert_equals: expected "invert ( 0 ) " but got "none " +PASS Web Animations: property <filter> from [none] to [invert(1)] at (0.5) should be [invert(0.5)] +PASS Web Animations: property <filter> from [none] to [invert(1)] at (1) should be [invert(1)] +PASS Web Animations: property <filter> from [none] to [invert(1)] at (1.5) should be [invert(1)] +PASS CSS Transitions: property <filter> from [opacity(0)] to [none] at (-1) should be [opacity(0)] +PASS CSS Transitions: property <filter> from [opacity(0)] to [none] at (0) should be [opacity(0)] +PASS CSS Transitions: property <filter> from [opacity(0)] to [none] at (0.5) should be [opacity(0.5)] +FAIL CSS Transitions: property <filter> from [opacity(0)] to [none] at (1) should be [opacity(1)] assert_equals: expected "opacity ( 1 ) " but got "none " +PASS CSS Transitions: property <filter> from [opacity(0)] to [none] at (1.5) should be [opacity(1)] +PASS CSS Transitions with transition: all: property <filter> from [opacity(0)] to [none] at (-1) should be [opacity(0)] +PASS CSS Transitions with transition: all: property <filter> from [opacity(0)] to [none] at (0) should be [opacity(0)] +PASS CSS Transitions with transition: all: property <filter> from [opacity(0)] to [none] at (0.5) should be [opacity(0.5)] +FAIL CSS Transitions with transition: all: property <filter> from [opacity(0)] to [none] at (1) should be [opacity(1)] assert_equals: expected "opacity ( 1 ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [opacity(0)] to [none] at (1.5) should be [opacity(1)] +PASS CSS Animations: property <filter> from [opacity(0)] to [none] at (-1) should be [opacity(0)] +PASS CSS Animations: property <filter> from [opacity(0)] to [none] at (0) should be [opacity(0)] +PASS CSS Animations: property <filter> from [opacity(0)] to [none] at (0.5) should be [opacity(0.5)] +FAIL CSS Animations: property <filter> from [opacity(0)] to [none] at (1) should be [opacity(1)] assert_equals: expected "opacity ( 1 ) " but got "none " +PASS CSS Animations: property <filter> from [opacity(0)] to [none] at (1.5) should be [opacity(1)] +PASS Web Animations: property <filter> from [opacity(0)] to [none] at (-1) should be [opacity(0)] +PASS Web Animations: property <filter> from [opacity(0)] to [none] at (0) should be [opacity(0)] +PASS Web Animations: property <filter> from [opacity(0)] to [none] at (0.5) should be [opacity(0.5)] +FAIL Web Animations: property <filter> from [opacity(0)] to [none] at (1) should be [opacity(1)] assert_equals: expected "opacity ( 1 ) " but got "none " +PASS Web Animations: property <filter> from [opacity(0)] to [none] at (1.5) should be [opacity(1)] +PASS CSS Transitions: property <filter> from [saturate(0)] to [none] at (-1) should be [saturate(0)] +PASS CSS Transitions: property <filter> from [saturate(0)] to [none] at (0) should be [saturate(0)] +PASS CSS Transitions: property <filter> from [saturate(0)] to [none] at (0.5) should be [saturate(0.5)] +FAIL CSS Transitions: property <filter> from [saturate(0)] to [none] at (1) should be [saturate(1)] assert_equals: expected "saturate ( 1 ) " but got "none " +PASS CSS Transitions: property <filter> from [saturate(0)] to [none] at (1.5) should be [saturate(1.5)] +PASS CSS Transitions with transition: all: property <filter> from [saturate(0)] to [none] at (-1) should be [saturate(0)] +PASS CSS Transitions with transition: all: property <filter> from [saturate(0)] to [none] at (0) should be [saturate(0)] +PASS CSS Transitions with transition: all: property <filter> from [saturate(0)] to [none] at (0.5) should be [saturate(0.5)] +FAIL CSS Transitions with transition: all: property <filter> from [saturate(0)] to [none] at (1) should be [saturate(1)] assert_equals: expected "saturate ( 1 ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [saturate(0)] to [none] at (1.5) should be [saturate(1.5)] +PASS CSS Animations: property <filter> from [saturate(0)] to [none] at (-1) should be [saturate(0)] +PASS CSS Animations: property <filter> from [saturate(0)] to [none] at (0) should be [saturate(0)] +PASS CSS Animations: property <filter> from [saturate(0)] to [none] at (0.5) should be [saturate(0.5)] +FAIL CSS Animations: property <filter> from [saturate(0)] to [none] at (1) should be [saturate(1)] assert_equals: expected "saturate ( 1 ) " but got "none " +PASS CSS Animations: property <filter> from [saturate(0)] to [none] at (1.5) should be [saturate(1.5)] +PASS Web Animations: property <filter> from [saturate(0)] to [none] at (-1) should be [saturate(0)] +PASS Web Animations: property <filter> from [saturate(0)] to [none] at (0) should be [saturate(0)] +PASS Web Animations: property <filter> from [saturate(0)] to [none] at (0.5) should be [saturate(0.5)] +FAIL Web Animations: property <filter> from [saturate(0)] to [none] at (1) should be [saturate(1)] assert_equals: expected "saturate ( 1 ) " but got "none " +PASS Web Animations: property <filter> from [saturate(0)] to [none] at (1.5) should be [saturate(1.5)] +PASS CSS Transitions: property <filter> from [none] to [sepia(1)] at (-1) should be [sepia(0)] +FAIL CSS Transitions: property <filter> from [none] to [sepia(1)] at (0) should be [sepia(0)] assert_equals: expected "sepia ( 0 ) " but got "none " +PASS CSS Transitions: property <filter> from [none] to [sepia(1)] at (0.5) should be [sepia(0.5)] +PASS CSS Transitions: property <filter> from [none] to [sepia(1)] at (1) should be [sepia(1)] +PASS CSS Transitions: property <filter> from [none] to [sepia(1)] at (1.5) should be [sepia(1)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [sepia(1)] at (-1) should be [sepia(0)] +FAIL CSS Transitions with transition: all: property <filter> from [none] to [sepia(1)] at (0) should be [sepia(0)] assert_equals: expected "sepia ( 0 ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [none] to [sepia(1)] at (0.5) should be [sepia(0.5)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [sepia(1)] at (1) should be [sepia(1)] +PASS CSS Transitions with transition: all: property <filter> from [none] to [sepia(1)] at (1.5) should be [sepia(1)] +PASS CSS Animations: property <filter> from [none] to [sepia(1)] at (-1) should be [sepia(0)] +FAIL CSS Animations: property <filter> from [none] to [sepia(1)] at (0) should be [sepia(0)] assert_equals: expected "sepia ( 0 ) " but got "none " +PASS CSS Animations: property <filter> from [none] to [sepia(1)] at (0.5) should be [sepia(0.5)] +PASS CSS Animations: property <filter> from [none] to [sepia(1)] at (1) should be [sepia(1)] +PASS CSS Animations: property <filter> from [none] to [sepia(1)] at (1.5) should be [sepia(1)] +PASS Web Animations: property <filter> from [none] to [sepia(1)] at (-1) should be [sepia(0)] +FAIL Web Animations: property <filter> from [none] to [sepia(1)] at (0) should be [sepia(0)] assert_equals: expected "sepia ( 0 ) " but got "none " +PASS Web Animations: property <filter> from [none] to [sepia(1)] at (0.5) should be [sepia(0.5)] +PASS Web Animations: property <filter> from [none] to [sepia(1)] at (1) should be [sepia(1)] +PASS Web Animations: property <filter> from [none] to [sepia(1)] at (1.5) should be [sepia(1)] +PASS CSS Transitions: property <filter> from [url("#svgfilter")] to [none] at (-0.3) should be [none] +PASS CSS Transitions: property <filter> from [url("#svgfilter")] to [none] at (0) should be [none] +PASS CSS Transitions: property <filter> from [url("#svgfilter")] to [none] at (0.3) should be [none] +PASS CSS Transitions: property <filter> from [url("#svgfilter")] to [none] at (0.5) should be [none] +PASS CSS Transitions: property <filter> from [url("#svgfilter")] to [none] at (0.6) should be [none] +PASS CSS Transitions: property <filter> from [url("#svgfilter")] to [none] at (1) should be [none] +PASS CSS Transitions: property <filter> from [url("#svgfilter")] to [none] at (1.5) should be [none] +PASS CSS Transitions with transition: all: property <filter> from [url("#svgfilter")] to [none] at (-0.3) should be [none] +PASS CSS Transitions with transition: all: property <filter> from [url("#svgfilter")] to [none] at (0) should be [none] +PASS CSS Transitions with transition: all: property <filter> from [url("#svgfilter")] to [none] at (0.3) should be [none] +PASS CSS Transitions with transition: all: property <filter> from [url("#svgfilter")] to [none] at (0.5) should be [none] +PASS CSS Transitions with transition: all: property <filter> from [url("#svgfilter")] to [none] at (0.6) should be [none] +PASS CSS Transitions with transition: all: property <filter> from [url("#svgfilter")] to [none] at (1) should be [none] +PASS CSS Transitions with transition: all: property <filter> from [url("#svgfilter")] to [none] at (1.5) should be [none] +PASS CSS Animations: property <filter> from [url("#svgfilter")] to [none] at (-0.3) should be [url("#svgfilter")] +PASS CSS Animations: property <filter> from [url("#svgfilter")] to [none] at (0) should be [url("#svgfilter")] +PASS CSS Animations: property <filter> from [url("#svgfilter")] to [none] at (0.3) should be [url("#svgfilter")] +PASS CSS Animations: property <filter> from [url("#svgfilter")] to [none] at (0.5) should be [none] +PASS CSS Animations: property <filter> from [url("#svgfilter")] to [none] at (0.6) should be [none] +PASS CSS Animations: property <filter> from [url("#svgfilter")] to [none] at (1) should be [none] +PASS CSS Animations: property <filter> from [url("#svgfilter")] to [none] at (1.5) should be [none] +PASS Web Animations: property <filter> from [url("#svgfilter")] to [none] at (-0.3) should be [url("#svgfilter")] +PASS Web Animations: property <filter> from [url("#svgfilter")] to [none] at (0) should be [url("#svgfilter")] +PASS Web Animations: property <filter> from [url("#svgfilter")] to [none] at (0.3) should be [url("#svgfilter")] +PASS Web Animations: property <filter> from [url("#svgfilter")] to [none] at (0.5) should be [none] +PASS Web Animations: property <filter> from [url("#svgfilter")] to [none] at (0.6) should be [none] +PASS Web Animations: property <filter> from [url("#svgfilter")] to [none] at (1) should be [none] +PASS Web Animations: property <filter> from [url("#svgfilter")] to [none] at (1.5) should be [none] +PASS CSS Transitions: property <filter> from [url("#svgfilter")] to [blur(5px)] at (-0.3) should be [blur(5px)] +PASS CSS Transitions: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0) should be [blur(5px)] +PASS CSS Transitions: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0.3) should be [blur(5px)] +PASS CSS Transitions: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0.5) should be [blur(5px)] +PASS CSS Transitions: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0.6) should be [blur(5px)] +PASS CSS Transitions: property <filter> from [url("#svgfilter")] to [blur(5px)] at (1) should be [blur(5px)] +PASS CSS Transitions: property <filter> from [url("#svgfilter")] to [blur(5px)] at (1.5) should be [blur(5px)] +PASS CSS Transitions with transition: all: property <filter> from [url("#svgfilter")] to [blur(5px)] at (-0.3) should be [blur(5px)] +PASS CSS Transitions with transition: all: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0) should be [blur(5px)] +PASS CSS Transitions with transition: all: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0.3) should be [blur(5px)] +PASS CSS Transitions with transition: all: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0.5) should be [blur(5px)] +PASS CSS Transitions with transition: all: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0.6) should be [blur(5px)] +PASS CSS Transitions with transition: all: property <filter> from [url("#svgfilter")] to [blur(5px)] at (1) should be [blur(5px)] +PASS CSS Transitions with transition: all: property <filter> from [url("#svgfilter")] to [blur(5px)] at (1.5) should be [blur(5px)] +PASS CSS Animations: property <filter> from [url("#svgfilter")] to [blur(5px)] at (-0.3) should be [url("#svgfilter")] +PASS CSS Animations: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0) should be [url("#svgfilter")] +PASS CSS Animations: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0.3) should be [url("#svgfilter")] +PASS CSS Animations: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0.5) should be [blur(5px)] +PASS CSS Animations: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0.6) should be [blur(5px)] +PASS CSS Animations: property <filter> from [url("#svgfilter")] to [blur(5px)] at (1) should be [blur(5px)] +PASS CSS Animations: property <filter> from [url("#svgfilter")] to [blur(5px)] at (1.5) should be [blur(5px)] +PASS Web Animations: property <filter> from [url("#svgfilter")] to [blur(5px)] at (-0.3) should be [url("#svgfilter")] +PASS Web Animations: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0) should be [url("#svgfilter")] +PASS Web Animations: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0.3) should be [url("#svgfilter")] +PASS Web Animations: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0.5) should be [blur(5px)] +PASS Web Animations: property <filter> from [url("#svgfilter")] to [blur(5px)] at (0.6) should be [blur(5px)] +PASS Web Animations: property <filter> from [url("#svgfilter")] to [blur(5px)] at (1) should be [blur(5px)] +PASS Web Animations: property <filter> from [url("#svgfilter")] to [blur(5px)] at (1.5) should be [blur(5px)] +PASS CSS Transitions: property <filter> from [initial] to [sepia(1)] at (-1) should be [sepia(0)] +FAIL CSS Transitions: property <filter> from [initial] to [sepia(1)] at (0) should be [sepia(0)] assert_equals: expected "sepia ( 0 ) " but got "none " +PASS CSS Transitions: property <filter> from [initial] to [sepia(1)] at (0.5) should be [sepia(0.5)] +PASS CSS Transitions: property <filter> from [initial] to [sepia(1)] at (1) should be [sepia(1)] +PASS CSS Transitions: property <filter> from [initial] to [sepia(1)] at (1.5) should be [sepia(1)] +PASS CSS Transitions with transition: all: property <filter> from [initial] to [sepia(1)] at (-1) should be [sepia(0)] +FAIL CSS Transitions with transition: all: property <filter> from [initial] to [sepia(1)] at (0) should be [sepia(0)] assert_equals: expected "sepia ( 0 ) " but got "none " +PASS CSS Transitions with transition: all: property <filter> from [initial] to [sepia(1)] at (0.5) should be [sepia(0.5)] +PASS CSS Transitions with transition: all: property <filter> from [initial] to [sepia(1)] at (1) should be [sepia(1)] +PASS CSS Transitions with transition: all: property <filter> from [initial] to [sepia(1)] at (1.5) should be [sepia(1)] +PASS CSS Animations: property <filter> from [initial] to [sepia(1)] at (-1) should be [sepia(0)] +FAIL CSS Animations: property <filter> from [initial] to [sepia(1)] at (0) should be [sepia(0)] assert_equals: expected "sepia ( 0 ) " but got "none " +PASS CSS Animations: property <filter> from [initial] to [sepia(1)] at (0.5) should be [sepia(0.5)] +PASS CSS Animations: property <filter> from [initial] to [sepia(1)] at (1) should be [sepia(1)] +PASS CSS Animations: property <filter> from [initial] to [sepia(1)] at (1.5) should be [sepia(1)] +PASS Web Animations: property <filter> from [initial] to [sepia(1)] at (-1) should be [sepia(0)] +FAIL Web Animations: property <filter> from [initial] to [sepia(1)] at (0) should be [sepia(0)] assert_equals: expected "sepia ( 0 ) " but got "none " +PASS Web Animations: property <filter> from [initial] to [sepia(1)] at (0.5) should be [sepia(0.5)] +PASS Web Animations: property <filter> from [initial] to [sepia(1)] at (1) should be [sepia(1)] +PASS Web Animations: property <filter> from [initial] to [sepia(1)] at (1.5) should be [sepia(1)] +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-003.html b/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-003.html index 5ca1229..1d51248 100644 --- a/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-003.html +++ b/third_party/blink/web_tests/external/wpt/css/filter-effects/animation/filter-interpolation-003.html
@@ -9,8 +9,20 @@ <script src="/resources/testharnessreport.js"></script> <script src="/css/support/interpolation-testcommon.js"></script> <style> - body { - color: blue; + .target { + display: inline-block; + width: 50px; + height: 50px; + background-color: green; + color: white; + margin-right: 2px; + filter: hue-rotate(10deg); + } + .expected { + margin-right: 20px; + } + .test { + padding-bottom: 10px; } </style> </head> @@ -24,6 +36,7 @@ to: 'blur(10px)' }, [ {at: -1, expect: 'blur(0px)'}, // Negative values are not allowed. + {at: 0, expect: 'blur(0px)'}, {at: 0.5, expect: 'blur(5px)'}, {at: 1, expect: 'blur(10px)'}, {at: 1.5, expect: 'blur(15px)'} @@ -37,6 +50,7 @@ {at: -1, expect: 'brightness(0)'}, // Negative values are not allowed. {at: 0, expect: 'brightness(0)'}, {at: 0.5, expect: 'brightness(0.5)'}, + {at: 1, expect: 'brightness(1)'}, {at: 1.5, expect: 'brightness(1.5)'} ]); @@ -48,6 +62,7 @@ {at: -1, expect: 'contrast(0)'}, // Negative values are not allowed. {at: 0, expect: 'contrast(0)'}, {at: 0.5, expect: 'contrast(0.5)'}, + {at: 1, expect: 'contrast(1)'}, {at: 1.5, expect: 'contrast(1.5)'} ]); @@ -57,6 +72,7 @@ to: 'drop-shadow(20px 10px green)' }, [ {at: -1, expect: 'drop-shadow(-20px -10px transparent)'}, + {at: 0, expect: 'drop-shadow(0px 0px 0px transparent)'}, {at: 0.5, expect: 'drop-shadow(10px 5px rgba(0, 128, 0, 0.5))'}, {at: 1, expect: 'drop-shadow(20px 10px green)'}, {at: 1.5, expect: 'drop-shadow(30px 15px #00C000)'} @@ -68,6 +84,7 @@ to: 'grayscale(1)' }, [ {at: -1, expect: 'grayscale(0)'}, // Negative values are not allowed. + {at: 0, expect: 'grayscale(0)'}, {at: 0.5, expect: 'grayscale(0.5)'}, {at: 1, expect: 'grayscale(1)'}, {at: 1.5, expect: 'grayscale(1)'} // Should clamp values to 1. @@ -79,6 +96,7 @@ to: 'hue-rotate(360deg)' }, [ {at: -1, expect: 'hue-rotate(-360deg)'}, + {at: 0, expect: 'hue-rotate(0deg)'}, {at: 0.5, expect: 'hue-rotate(180deg)'}, {at: 1, expect: 'hue-rotate(360deg)'}, {at: 1.5, expect: 'hue-rotate(540deg)'} @@ -90,6 +108,7 @@ to: 'invert(1)' }, [ {at: -1, expect: 'invert(0)'}, // Negative values are not allowed. + {at: 0, expect: 'invert(0)'}, {at: 0.5, expect: 'invert(0.5)'}, {at: 1, expect: 'invert(1)'}, {at: 1.5, expect: 'invert(1)'} // Should clamp values to 1. @@ -103,6 +122,7 @@ {at: -1, expect: 'opacity(0)'}, // Negative values are not allowed. {at: 0, expect: 'opacity(0)'}, {at: 0.5, expect: 'opacity(0.5)'}, + {at: 1, expect: 'opacity(1)'}, {at: 1.5, expect: 'opacity(1)'} // Should clamp values to 1. ]); @@ -114,6 +134,7 @@ {at: -1, expect: 'saturate(0)'}, // Negative values are not allowed. {at: 0, expect: 'saturate(0)'}, {at: 0.5, expect: 'saturate(0.5)'}, + {at: 1, expect: 'saturate(1)'}, {at: 1.5, expect: 'saturate(1.5)'} ]); @@ -123,6 +144,7 @@ to: 'sepia(1)' }, [ {at: -1, expect: 'sepia(0)'}, // Negative values are not allowed. + {at: 0, expect: 'sepia(0)'}, {at: 0.5, expect: 'sepia(0.5)'}, {at: 1, expect: 'sepia(1)'}, {at: 1.5, expect: 'sepia(1)'} // Should clamp values to 1. @@ -133,6 +155,24 @@ from: 'url("#svgfilter")', to: 'none', // lacuna is not defined }); + + test_no_interpolation({ + property: 'filter', + from: 'url("#svgfilter")', + to: 'blur(5px)', + }); + + test_interpolation({ + property: 'filter', + from: 'initial', // lacuna is 0 + to: 'sepia(1)' + }, [ + {at: -1, expect: 'sepia(0)'}, // Negative values are not allowed. + {at: 0, expect: 'sepia(0)'}, // Equivalent to sepia(0) + {at: 0.5, expect: 'sepia(0.5)'}, + {at: 1, expect: 'sepia(1)'}, + {at: 1.5, expect: 'sepia(1)'} // Should clamp values to 1. + ]); </script> </body> </html>
diff --git a/third_party/blink/web_tests/external/wpt/css/selectors/selectors-empty-001.xml b/third_party/blink/web_tests/external/wpt/css/selectors/selectors-empty-001.xml index baf6bdd..3b882deb 100644 --- a/third_party/blink/web_tests/external/wpt/css/selectors/selectors-empty-001.xml +++ b/third_party/blink/web_tests/external/wpt/css/selectors/selectors-empty-001.xml
@@ -35,7 +35,7 @@ <test1><test1> </test1></test1> <test2>green!</test2> <test3>><</test3> - <test4>☃</test4> + <test4>∑</test4> <test5><test5/></test5> <test6> </test6> <test7> <!-- --></test7>
diff --git a/third_party/blink/web_tests/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any-expected.txt b/third_party/blink/web_tests/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any-expected.txt deleted file mode 100644 index afd0947..0000000 --- a/third_party/blink/web_tests/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any-expected.txt +++ /dev/null
@@ -1,9 +0,0 @@ -This is a testharness.js-based test. -PASS idl_test setup -PASS Partial interface Document: original interface defined -PASS Partial interface WorkerGlobalScope: original interface defined -PASS WorkerGlobalScope interface: existence and properties of interface object -FAIL Document interface: attribute addressSpace assert_true: The prototype object must have a property "addressSpace" expected true got false -FAIL Document interface: document must inherit property "addressSpace" with the proper type assert_inherits: property "addressSpace" not found in prototype chain -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any.serviceworker-expected.txt deleted file mode 100644 index 8558fae..0000000 --- a/third_party/blink/web_tests/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any.serviceworker-expected.txt +++ /dev/null
@@ -1,10 +0,0 @@ -This is a testharness.js-based test. -PASS idl_test setup -PASS Partial interface Document: original interface defined -PASS Partial interface WorkerGlobalScope: original interface defined -FAIL WorkerGlobalScope interface: attribute addressSpace assert_true: The prototype object must have a property "addressSpace" expected true got false -FAIL WorkerGlobalScope interface: self must inherit property "addressSpace" with the proper type assert_inherits: property "addressSpace" not found in prototype chain -PASS Node interface: existence and properties of interface object -PASS Document interface: existence and properties of interface object -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any.sharedworker-expected.txt deleted file mode 100644 index 8558fae..0000000 --- a/third_party/blink/web_tests/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any.sharedworker-expected.txt +++ /dev/null
@@ -1,10 +0,0 @@ -This is a testharness.js-based test. -PASS idl_test setup -PASS Partial interface Document: original interface defined -PASS Partial interface WorkerGlobalScope: original interface defined -FAIL WorkerGlobalScope interface: attribute addressSpace assert_true: The prototype object must have a property "addressSpace" expected true got false -FAIL WorkerGlobalScope interface: self must inherit property "addressSpace" with the proper type assert_inherits: property "addressSpace" not found in prototype chain -PASS Node interface: existence and properties of interface object -PASS Document interface: existence and properties of interface object -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any.worker-expected.txt deleted file mode 100644 index 8558fae..0000000 --- a/third_party/blink/web_tests/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any.worker-expected.txt +++ /dev/null
@@ -1,10 +0,0 @@ -This is a testharness.js-based test. -PASS idl_test setup -PASS Partial interface Document: original interface defined -PASS Partial interface WorkerGlobalScope: original interface defined -FAIL WorkerGlobalScope interface: attribute addressSpace assert_true: The prototype object must have a property "addressSpace" expected true got false -FAIL WorkerGlobalScope interface: self must inherit property "addressSpace" with the proper type assert_inherits: property "addressSpace" not found in prototype chain -PASS Node interface: existence and properties of interface object -PASS Document interface: existence and properties of interface object -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin-expected.txt b/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin-expected.txt deleted file mode 100644 index 1c8ca5314..0000000 --- a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Precedence of scroll restoration mode over fragment scrolling in cross-origin history traversal Uncaught ReferenceError: dump is not defined -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin.html b/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin.html index 4b81c7c..fec801e 100644 --- a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin.html +++ b/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin.html
@@ -18,9 +18,7 @@ function frameOnload() { if (next) { next(); - dump("next \n"); } else { - dump("no next \n"); // The test does the following navigation steps for iframe // 1. load page-with-fragment.html#fragment // 2. load blank1
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/historical-progress-event.window.js b/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/historical-progress-event.window.js new file mode 100644 index 0000000..7c4e121 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/historical-progress-event.window.js
@@ -0,0 +1,16 @@ +async_test(t => { + const img = new Image(); + t.add_cleanup(() => img.remove()); + img.onloadstart = img.onprogress = img.onloadend = t.unreached_func("progress event fired"); + img.onload = t.step_func_done(e => { + assert_true(e instanceof Event); + assert_false(e instanceof ProgressEvent); + }); + img.src = "/images/rrgg-256x256.png"; + document.body.append(img); +}, "<img> does not support ProgressEvent or loadstart/progress/loadend"); + +test(t => { + assert_equals(document.body.onloadend, undefined); + assert_equals(window.onloadend, undefined); +}, "onloadend is not exposed");
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.sub.html b/third_party/blink/web_tests/external/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.html similarity index 88% rename from third_party/blink/web_tests/external/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.sub.html rename to third_party/blink/web_tests/external/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.html index cc01881..c3974bd 100644 --- a/third_party/blink/web_tests/external/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.sub.html +++ b/third_party/blink/web_tests/external/wpt/html/semantics/forms/autofocus/no-cross-origin-autofocus.html
@@ -5,6 +5,7 @@ <script src="/resources/testharnessreport.js"></script> <script src="/resources/testdriver.js"></script> <script src="/resources/testdriver-vendor.js"></script> +<script src="/common/get-host-info.sub.js"></script> </head> <body> <h1>Autofocus shouldn't work in cross-origin iframe.</h1> @@ -36,7 +37,7 @@ } })); document.getElementById("child").src = - "http://{{domains[www]}}:{{ports[http][0]}}/html/semantics/forms/autofocus/resources/child-autofocus.html"; + get_host_info().HTTP_REMOTE_ORIGIN + "/html/semantics/forms/autofocus/resources/child-autofocus.html"; }, "Autofocus shouldn't work in cross-origin iframe"); </script> </body>
diff --git a/third_party/blink/web_tests/external/wpt/largest-contentful-paint/larger-image.html b/third_party/blink/web_tests/external/wpt/largest-contentful-paint/larger-image.html new file mode 100644 index 0000000..7ff38cf --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/largest-contentful-paint/larger-image.html
@@ -0,0 +1,49 @@ +<!DOCTYPE HTML> +<meta charset=utf-8> +<title>Largest Contentful Paint: largest image is reported.</title> +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<!-- There is some text and some images. We care about blue.png being reported, as it is the largest. --> +<p>This is some text! :)</p> +<img src='/images/red.png' id='red'/> +<img src='/images/blue.png' id='blue'/> +<img src='/images/black-rectangle.png' id='black'/> +<p>More text!</p> +<script> + async_test(function (t) { + if (!window.LargestContentfulPaint) { + assert_unreached("LargestContentfulPaint is not implemented"); + } + const beforeRender = performance.now(); + const observer = new PerformanceObserver( + t.step_func(entryList => { + entryList.getEntries().forEach(entry => { + // The text or other image could be reported as LCP if it is rendered before the blue image. + if (entry.id !== 'blue') + return; + + assert_equals(entry.entryType, 'largest-contentful-paint'); + assert_greater_than_equal(entry.renderTime, beforeRender, + 'The rendering timestamp should occur after script starts running.'); + assert_greater_than_equal(performance.now(), entry.renderTime, + 'The rendering timestamp should occur before the entry is dispatched to the observer.'); + assert_equals(entry.startTime, entry.renderTime, 'startTime should equal renderTime'); + assert_equals(entry.duration, 0); + // blue.png is 133 x 106. + assert_equals(entry.size, 133 * 106); + assert_equals(entry.id, 'blue'); + assert_equals(entry.url, window.location.origin + '/images/blue.png'); + assert_greater_than(entry.loadTime, beforeRender, + 'The load timestamp should occur after script starts running.'); + assert_less_than(entry.loadTime, entry.renderTime, + 'The load timestamp should occur before the render timestamp.') + assert_equals(entry.element, document.getElementById('blue')); + t.done(); + }) + }) + ); + observer.observe({type: 'largest-contentful-paint', buffered: true}); + }, 'Largest Contentful Paint: largest image is reported.'); +</script> +</body>
diff --git a/third_party/blink/web_tests/external/wpt/largest-contentful-paint/larger-text.html b/third_party/blink/web_tests/external/wpt/largest-contentful-paint/larger-text.html new file mode 100644 index 0000000..973832ca --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/largest-contentful-paint/larger-text.html
@@ -0,0 +1,53 @@ +<!DOCTYPE HTML> +<meta charset=utf-8> +<title>Largest Contentful Paint: largest text is reported.</title> +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style type="text/css"> +#text2 { + position: absolute; + width: auto; + white-space: nowrap; +} +</style> +<!-- There is some text and some tiny images. We care about the largest text. --> +<img src='/images/green-1x1.png'/> +<div id='text1'>This is some text.</div> +<div id='text2'>This is more text so it will be the Largest Contentful Paint!</div> +<img src='/images/green-2x2.png'/> +<script> + async_test(function (t) { + if (!window.LargestContentfulPaint) { + assert_unreached("LargestContentfulPaint is not implemented"); + } + let beforeRender; + const observer = new PerformanceObserver( + t.step_func(entryList => { + entryList.getEntries().forEach(entry => { + // The tiny images or text1 could be reported as LCP if it is rendered before text2. + if (entry.id !== 'text2') + return; + + assert_equals(entry.entryType, 'largest-contentful-paint'); + assert_greater_than_equal(entry.renderTime, beforeRender); + assert_greater_than_equal(performance.now(), entry.renderTime); + assert_equals(entry.startTime, entry.renderTime, 'startTime should equal renderTime'); + assert_equals(entry.duration, 0); + const div = document.getElementById('text2'); + // The div styling makes it approximate the text size. + assert_greater_than_equal(entry.size, (div.clientHeight - 5) * (div.clientWidth - 5)); + assert_less_than_equal(entry.size, (div.clientHeight + 1) * (div.clientWidth + 1)); + assert_equals(entry.loadTime, 0); + assert_equals(entry.id, 'text2'); + assert_equals(entry.url, ''); + assert_equals(entry.element, div); + t.done(); + }) + }) + ); + observer.observe({type: 'largest-contentful-paint', buffered: true}); + beforeRender = performance.now(); + }, 'Largest Contentful Paint: largest text is reported.'); +</script> +</body>
diff --git a/third_party/blink/web_tests/external/wpt/resources/chromium/nfc-mock.js b/third_party/blink/web_tests/external/wpt/resources/chromium/nfc-mock.js index 83bd6b8..9722f8ee 100644 --- a/third_party/blink/web_tests/external/wpt/resources/chromium/nfc-mock.js +++ b/third_party/blink/web_tests/external/wpt/resources/chromium/nfc-mock.js
@@ -273,13 +273,11 @@ this.watchers_.push({id: id, options: options}); // Triggers onWatch if the new watcher matches existing messages - if (this.reading_messages_.length !== 0) { - for(let message of this.reading_messages_) { - if (matchesWatchOptions(message.message, - message.compatibility, options)) { - this.client_.onWatch([id], fake_tag_serial_number, - toMojoNDEFMessage(message.message)); - } + for (let message of this.reading_messages_) { + if (matchesWatchOptions( + message.message, message.compatibility, options)) { + this.client_.onWatch( + [id], fake_tag_serial_number, toMojoNDEFMessage(message.message)); } } @@ -362,13 +360,12 @@ this.reading_messages_.push({message: message, compatibility: toMojoNDEFCompatibility(compatibility)}); // Triggers onWatch if the new message matches existing watchers - if (this.watchers_.length !== 0) { - for (let watcher of this.watchers_) { - if (matchesWatchOptions(message, - message.compatibility, watcher.options)) { - this.client_.onWatch([watcher.id], fake_tag_serial_number, - toMojoNDEFMessage(message.message)); - } + for (let watcher of this.watchers_) { + if (matchesWatchOptions( + message, message.compatibility, watcher.options)) { + this.client_.onWatch( + [watcher.id], fake_tag_serial_number, + toMojoNDEFMessage(message.message)); } } }
diff --git a/third_party/blink/web_tests/fast/deprecated-flexbox/dynamically-change-line-clamp-expected.html b/third_party/blink/web_tests/fast/deprecated-flexbox/dynamically-change-line-clamp-expected.html new file mode 100644 index 0000000..e231e76 --- /dev/null +++ b/third_party/blink/web_tests/fast/deprecated-flexbox/dynamically-change-line-clamp-expected.html
@@ -0,0 +1,8 @@ +<!DOCTYPE html> +<script src="../../resources/ahem.js"></script> +<p>There should only be two lines below as the third line is hidden via -webkit-line-clamp.</p> +<div style="font: 20px/1 Ahem; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; -webkit-line-clamp: 2" id="webkitbox"> + xxx<br> + xxx<br> + xxx<br> +</div>
diff --git a/third_party/blink/web_tests/fast/deprecated-flexbox/dynamically-change-line-clamp.html b/third_party/blink/web_tests/fast/deprecated-flexbox/dynamically-change-line-clamp.html new file mode 100644 index 0000000..8ef3677 --- /dev/null +++ b/third_party/blink/web_tests/fast/deprecated-flexbox/dynamically-change-line-clamp.html
@@ -0,0 +1,15 @@ +<!DOCTYPE html> +<script src="../../resources/ahem.js"></script> +<p>There should only be two lines below as the third line is hidden via -webkit-line-clamp.</p> +<div style="font: 20px/1 Ahem; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden" id="webkitbox"> + xxx<br> + xxx<br> + xxx<br> +</div> +<script> + var webkitbox = document.getElementById("webkitbox"); + // Referencing |offsetWidth| ensures a layout happens before changing the + // line-clamp. This is done to ensure toggling line-clamp works. + webkitbox.offsetWidth; + webkitbox.style.webkitLineClamp = 2; +</script>
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui-high-contrast/radio_checkbox-expected.png b/third_party/blink/web_tests/fast/forms/controls-new-ui-high-contrast/radio_checkbox-expected.png new file mode 100644 index 0000000..3cc5d68 --- /dev/null +++ b/third_party/blink/web_tests/fast/forms/controls-new-ui-high-contrast/radio_checkbox-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui-high-contrast/radio_checkbox.html b/third_party/blink/web_tests/fast/forms/controls-new-ui-high-contrast/radio_checkbox.html new file mode 100644 index 0000000..32fdc75 --- /dev/null +++ b/third_party/blink/web_tests/fast/forms/controls-new-ui-high-contrast/radio_checkbox.html
@@ -0,0 +1,16 @@ +<input type=radio> +<input type=radio disabled> +<input type=radio checked> +<input type=radio checked disabled> +<input type=checkbox> +<input type=checkbox disabled> +<input type=checkbox checked> +<input type=checkbox checked disabled> +<input type=checkbox id="indeterminateCheckbox"> +<input type=checkbox id="indeterminateDisabledCheckbox" disabled> +<script> + if (window.testRunner) + testRunner.setUseMockTheme(false); + indeterminateCheckbox.indeterminate = true; + indeterminateDisabledCheckbox.indeterminate = true; +</script> \ No newline at end of file
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png deleted file mode 100644 index 01646946..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click.html b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click.html deleted file mode 100644 index 78a992aa..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click.html +++ /dev/null
@@ -1,31 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script> -testRunner.setUseMockTheme(false); -testRunner.waitUntilDone(); -</script> -<script src='../../../forms/resources/picker-common.js'></script> -</head> -<body> -<input type='color' id='color' value='#80D9FF'> - -<p id='description' style='opacity: 0'></p> -<div id='console' style='opacity: 0'></div> - -<script> -openPicker(document.getElementById('color'), openPickerSuccessfulCallback, () => testRunner.notifyDone()); - -function openPickerSuccessfulCallback() { - popupWindow.focus(); - const popupDocument = popupWindow.document; - const colorWell = popupDocument.querySelector('color-well'); - const colorWellRect = colorWell.getBoundingClientRect(); - eventSender.mouseMoveTo(colorWellRect.left + (colorWellRect.width * 4 / 10), colorWellRect.top + (colorWellRect.height * 6 / 10)); - eventSender.mouseDown(); - eventSender.mouseUp(); - testRunner.notifyDone(); -} -</script> -</body> -</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png deleted file mode 100644 index 01646946..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag.html b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag.html deleted file mode 100644 index 68580ee..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag.html +++ /dev/null
@@ -1,32 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script> -testRunner.setUseMockTheme(false); -testRunner.waitUntilDone(); -</script> -<script src='../../../forms/resources/picker-common.js'></script> -</head> -<body> -<input type='color' id='color' value='#80D9FF'> - -<p id='description' style='opacity: 0'></p> -<div id='console' style='opacity: 0'></div> - -<script> -openPicker(document.getElementById('color'), openPickerSuccessfulCallback, () => testRunner.notifyDone()); - -function openPickerSuccessfulCallback() { - popupWindow.focus(); - const popupDocument = popupWindow.document; - const colorWell = popupDocument.querySelector('color-well'); - const colorWellRect = colorWell.getBoundingClientRect(); - eventSender.mouseMoveTo(colorWellRect.left, colorWellRect.top); - eventSender.mouseDown(); - eventSender.mouseMoveTo(colorWellRect.left + (colorWellRect.width * 4 / 10), colorWellRect.top + (colorWellRect.height * 6 / 10)); - eventSender.mouseUp(); - testRunner.notifyDone(); -} -</script> -</body> -</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png deleted file mode 100644 index d5370777..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click.html b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click.html deleted file mode 100644 index b24aad3e..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click.html +++ /dev/null
@@ -1,31 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script> -testRunner.setUseMockTheme(false); -testRunner.waitUntilDone(); -</script> -<script src='../../../forms/resources/picker-common.js'></script> -</head> -<body> -<input type='color' id='color'> - -<p id='description' style='opacity: 0'></p> -<div id='console' style='opacity: 0'></div> - -<script> -openPicker(document.getElementById('color'), openPickerSuccessfulCallback, () => testRunner.notifyDone()); - -function openPickerSuccessfulCallback() { - popupWindow.focus(); - const popupDocument = popupWindow.document; - const hueSlider = popupDocument.querySelector('hue-slider'); - const hueSliderRect = hueSlider.getBoundingClientRect(); - eventSender.mouseMoveTo(hueSliderRect.left + (hueSliderRect.width / 2), hueSliderRect.top); - eventSender.mouseDown(); - eventSender.mouseUp(); - testRunner.notifyDone(); -} -</script> -</body> -</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png deleted file mode 100644 index d5370777..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag.html b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag.html deleted file mode 100644 index 2bc9ad4..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag.html +++ /dev/null
@@ -1,32 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script> -testRunner.setUseMockTheme(false); -testRunner.waitUntilDone(); -</script> -<script src='../../../forms/resources/picker-common.js'></script> -</head> -<body> -<input type='color' id='color'> - -<p id='description' style='opacity: 0'></p> -<div id='console' style='opacity: 0'></div> - -<script> -openPicker(document.getElementById('color'), openPickerSuccessfulCallback, () => testRunner.notifyDone()); - -function openPickerSuccessfulCallback() { - popupWindow.focus(); - const popupDocument = popupWindow.document; - const hueSlider = popupDocument.querySelector('hue-slider'); - const hueSliderRect = hueSlider.getBoundingClientRect(); - eventSender.mouseMoveTo(hueSliderRect.left, hueSliderRect.top); - eventSender.mouseDown(); - eventSender.mouseMoveTo(hueSliderRect.left + (hueSliderRect.width / 2), hueSliderRect.top); - eventSender.mouseUp(); - testRunner.notifyDone(); -} -</script> -</body> -</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png deleted file mode 100644 index dae8a211..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue.html b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue.html deleted file mode 100644 index a15d319f0..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue.html +++ /dev/null
@@ -1,28 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script> -testRunner.setUseMockTheme(false); -testRunner.waitUntilDone(); -</script> -<script src='../../../forms/resources/picker-common.js'></script> -</head> -<body> -<input type='color' id='color' value='#FF0000'> - -<p id='description' style='opacity: 0'></p> -<div id='console' style='opacity: 0'></div> - -<script> -openPicker(document.getElementById('color'), openPickerSuccessfulCallback, () => testRunner.notifyDone()); - -function openPickerSuccessfulCallback() { - popupWindow.focus(); - const popupDocument = popupWindow.document; - const formatToggler = popupDocument.querySelector('format-toggler'); - formatToggler.click(); - testRunner.notifyDone(); -} -</script> -</body> -</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png deleted file mode 100644 index dae8a211..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue.html b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue.html deleted file mode 100644 index a0d8e771..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue.html +++ /dev/null
@@ -1,35 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script> -testRunner.setUseMockTheme(false); -testRunner.waitUntilDone(); -</script> -<script src='../../../forms/resources/picker-common.js'></script> -</head> -<body> -<input type='color' id='color' value='#FF0000'> - -<p id='description' style='opacity: 0'></p> -<div id='console' style='opacity: 0'></div> - -<script> -openPicker(document.getElementById('color'), openPickerSuccessfulCallback, () => testRunner.notifyDone()); - -function openPickerSuccessfulCallback() { - popupWindow.focus(); - const popupDocument = popupWindow.document; - const formatToggler = popupDocument.querySelector('format-toggler'); - formatToggler.click(); - const hueSlider = popupDocument.querySelector('hue-slider'); - const hueSliderRect = hueSlider.getBoundingClientRect(); - eventSender.mouseMoveTo(hueSliderRect.left, hueSliderRect.top); - eventSender.mouseDown(); - eventSender.mouseMoveTo(hueSliderRect.right - 1, hueSliderRect.top); - eventSender.mouseUp(); - testRunner.notifyDone(); - testRunner.notifyDone(); -} -</script> -</body> -</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png deleted file mode 100644 index b846542..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match.html b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match.html deleted file mode 100644 index 2653fcf..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match.html +++ /dev/null
@@ -1,35 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script> -testRunner.setUseMockTheme(false); -testRunner.waitUntilDone(); -</script> -<script src='../../../forms/resources/picker-common.js'></script> -</head> -<body> -<input type='color' id='color' value='#EA5FB0'> - -<p id='description' style='opacity: 0'></p> -<div id='console' style='opacity: 0'></div> - -<script> -openPicker(document.getElementById('color'), openPickerSuccessfulCallback, () => testRunner.notifyDone()); - -function openPickerSuccessfulCallback() { - popupWindow.focus(); - const popupDocument = popupWindow.document; - const formatToggler = popupDocument.querySelector('format-toggler'); - formatToggler.click(); - const hValueContainer = popupDocument.getElementById('hValueContainer'); - const hValueContainerRect = hValueContainer.getBoundingClientRect(); - eventSender.mouseMoveTo(hValueContainerRect.right - 1, hValueContainerRect.bottom - 1); - eventSender.mouseDown(); - eventSender.mouseUp(); - eventSender.keyDown('Backspace'); - eventSender.keyDown('1'); - testRunner.notifyDone(); -} -</script> -</body> -</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png deleted file mode 100644 index b846542..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change.html b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change.html deleted file mode 100644 index 8b40fdd2..0000000 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change.html +++ /dev/null
@@ -1,39 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script> -testRunner.setUseMockTheme(false); -testRunner.waitUntilDone(); -</script> -<script src='../../../forms/resources/picker-common.js'></script> -</head> -<body> -<input type='color' id='color' value='#EA5FB0'> - -<p id='description' style='opacity: 0'></p> -<div id='console' style='opacity: 0'></div> - -<script> -openPicker(document.getElementById('color'), openPickerSuccessfulCallback, () => testRunner.notifyDone()); - -function openPickerSuccessfulCallback() { - popupWindow.focus(); - const popupDocument = popupWindow.document; - const formatToggler = popupDocument.querySelector('format-toggler'); - formatToggler.click(); - const hValueContainer = popupDocument.getElementById('hValueContainer'); - const hValueContainerRect = hValueContainer.getBoundingClientRect(); - eventSender.mouseMoveTo(hValueContainerRect.right - 1, hValueContainerRect.top); - eventSender.mouseDown(); - eventSender.mouseUp(); - eventSender.keyDown('Backspace'); - eventSender.keyDown('Backspace'); - eventSender.keyDown('Backspace'); - eventSender.keyDown('2'); - eventSender.keyDown('7'); - eventSender.keyDown('6'); - testRunner.notifyDone(); -} -</script> -</body> -</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-color-class.html b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-color-class.html index 91838d31..b8df01c 100644 --- a/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-color-class.html +++ b/third_party/blink/web_tests/fast/forms/controls-new-ui/color/color-picker-color-class.html
@@ -29,7 +29,6 @@ testAsHex(); testAsRGB(); testAsHSL(); -testDistance(); function testEquals() { test(() => { @@ -480,29 +479,6 @@ assert_equals('hsl(307,64%,54%)', new Color(ColorFormat.HSL, 307, 64, 54).asHSL()); }, 'new Color(ColorFormat.HSL, 307, 64, 54).asHSL()'); } - -function testDistance() { - test(() => { - assert_equals(Color.distance([255, 255, 255], [255, 255, 255]), 0); - }, 'Color.distance([255,255,255], [255,255,255])'); - - test(() => { - assert_equals(Color.distance([120, 100, 50], [120, 100, 50]), 0); - }, 'Color.distance([120, 100, 50], [120, 100, 50])'); - - test(() => { - assert_equals(Color.distance([120, 100, 50], [0, 100, 50]), 120); - }, 'Color.distance([120, 100, 50], [0, 100, 50])'); - - test(() => { - assert_equals(Math.round(Color.distance([255, 255, 255], [0, 0, 0])), 442); - }, 'Color.distance([255,255,255], [0, 0, 0])'); - - test(() => { - assert_equals(Math.round(Color.distance([235, 77, 65], [234, 84, 59])), 9); - }, 'Color.distance([235, 77, 65], [234, 84, 59])'); - -} </script> </body> </html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/filters/filter-change-repaint-expected.png b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/filters/filter-change-repaint-expected.png new file mode 100644 index 0000000..358543cd --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/filters/filter-change-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/filters/filter-repaint-shadow-expected.png b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/filters/filter-repaint-shadow-expected.png new file mode 100644 index 0000000..c630f90 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/filters/filter-repaint-shadow-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-luminance-png-expected.png b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-luminance-png-expected.png new file mode 100644 index 0000000..b7477e5d --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-luminance-png-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-round-auto1-expected.png b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-round-auto1-expected.png new file mode 100644 index 0000000..6bd6dd0 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-round-auto1-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-round-border-expected.png b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-round-border-expected.png new file mode 100644 index 0000000..862ab52f --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-round-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-round-content-expected.png b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-round-content-expected.png new file mode 100644 index 0000000..2809c0b --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-round-content-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-round-padding-expected.png b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-round-padding-expected.png new file mode 100644 index 0000000..5231c90 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-round-padding-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-space-border-expected.png b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-space-border-expected.png new file mode 100644 index 0000000..f235a71 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/enable-gpu-rasterization/css3/masking/mask-repeat-space-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/http/tests/priorities/resource-load-priorities-service-worker.https.html b/third_party/blink/web_tests/http/tests/priorities/resource-load-priorities-service-worker.https.html index e7806b2c..4c77e52 100644 --- a/third_party/blink/web_tests/http/tests/priorities/resource-load-priorities-service-worker.https.html +++ b/third_party/blink/web_tests/http/tests/priorities/resource-load-priorities-service-worker.https.html
@@ -11,6 +11,12 @@ t.add_cleanup(() => win.close()); } +window.onmessage = function(message) { + if (message.data.hasOwnProperty('Status')) { + window.onRequestStatusChanged(message.data['Status']); + } +} + // This test creates a window controlled by the server worker, which makes a // request for some subresource. The service worker intercepts the request and // issues a fetch() for it. The service worker retrieves the priority of the @@ -24,8 +30,8 @@ }); const subresourceFinishedLoading = new Promise(resolve => { - window.onmessage = e => { - assert_equals(e.data, 'LOADED', + window.onRequestStatusChanged = e => { + assert_equals(e, 'LOADED', `Resources requested in the test window ${url} loaded successfully`); resolve(); }
diff --git a/third_party/blink/web_tests/http/tests/priorities/resource-load-priorities.html b/third_party/blink/web_tests/http/tests/priorities/resource-load-priorities.html index 151171e..f06af7e 100644 --- a/third_party/blink/web_tests/http/tests/priorities/resource-load-priorities.html +++ b/third_party/blink/web_tests/http/tests/priorities/resource-load-priorities.html
@@ -11,18 +11,32 @@ return win; } +window.onmessage = function(message) { + if (message.data.hasOwnProperty('Priority')) { + window.onRequestPriorityUpdated(message.data['Priority']); + } + if (message.data.hasOwnProperty('Status')) { + window.onRequestStatusChanged(message.data['Status']); + } +} + function resource_load_priority_test(windowURL, expected_priority, description) { promise_test(async () => { openWindow('resources/' + windowURL); - const priority_event = - await new Promise(resolve => window.onmessage = resolve); - assert_equals(priority_event.data, expected_priority); + // The order in which these two events are sent can't be relied upon. + const priority_event_promise = + new Promise(resolve => window.onRequestPriorityUpdated = resolve); + const subresource_finished_loading_event_promise = + new Promise(resolve => window.onRequestStatusChanged = resolve); - const subresource_finished_loading_event = - await new Promise(resolve => window.onmessage = resolve); - assert_equals(subresource_finished_loading_event.data, 'LOADED', + const priority_event = await priority_event_promise; + assert_equals(priority_event, expected_priority); + + const subresource_finished_loading_event = + await subresource_finished_loading_event_promise; + assert_equals(subresource_finished_loading_event, 'LOADED', 'The resource loaded successfully'); }, description);
diff --git a/third_party/blink/web_tests/http/tests/priorities/resources/common.js b/third_party/blink/web_tests/http/tests/priorities/resources/common.js index 2d87106d..d7f8652 100644 --- a/third_party/blink/web_tests/http/tests/priorities/resources/common.js +++ b/third_party/blink/web_tests/http/tests/priorities/resources/common.js
@@ -18,13 +18,13 @@ } function reportPriority(priority) { - window.opener.postMessage(priority, '*'); + window.opener.postMessage({'Priority': priority}, '*'); } function reportLoaded() { - window.opener.postMessage('LOADED', '*'); + window.opener.postMessage({'Status': 'LOADED'}, '*'); } function reportFailure() { - window.opener.postMessage('FAILED', '*'); + window.opener.postMessage({'Status': 'FAILED'}, '*'); }
diff --git a/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index 92aaa0b..131bc839 100644 --- a/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -3602,6 +3602,7 @@ method navigate interface WorkerGlobalScope : EventTarget attribute @@toStringTag + getter addressSpace getter caches getter crypto getter fonts
diff --git a/third_party/blink/web_tests/media/track/track-css-user-settings-override-author-settings.html b/third_party/blink/web_tests/media/track/track-css-author-settings-override-user-settings.html similarity index 78% rename from third_party/blink/web_tests/media/track/track-css-user-settings-override-author-settings.html rename to third_party/blink/web_tests/media/track/track-css-author-settings-override-user-settings.html index 52dad36..1548ba9 100644 --- a/third_party/blink/web_tests/media/track/track-css-user-settings-override-author-settings.html +++ b/third_party/blink/web_tests/media/track/track-css-author-settings-override-user-settings.html
@@ -1,5 +1,5 @@ <!DOCTYPE html> -<title>Test that WebVTT objects are being styled correctly based on user settings that should override author settings.</title> +<title>Test that WebVTT objects are being styled correctly based on author settings that should override user settings.</title> <script src="../media-controls.js"></script> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> @@ -11,8 +11,6 @@ text-shadow: 3px 3px #00ff00; font-size: 20px; font-family: arial; - font-style: normal; - font-variant: normal; } </style> <video> @@ -31,10 +29,8 @@ assert_equals(cueStyle.textShadow, "rgb(0, 255, 0) 3px 3px 0px"); assert_equals(cueStyle.fontSize, "20px"); assert_equals(cueStyle.fontFamily, "arial"); - assert_equals(cueStyle.fontStyle, "normal"); - assert_equals(cueStyle.fontVariant, "normal"); - // Apply user settings and verify they override author-specified settings + // Apply user settings and verify they are overriden by author-specified settings, when the author settings exist. internals.settings.setTextTrackTextColor("cyan"); internals.settings.setTextTrackBackgroundColor("green"); internals.settings.setTextTrackTextShadow("2px 2px #ff0000") @@ -47,13 +43,13 @@ cue = textTrackCueElementByIndex(video, 0).firstChild.firstElementChild; cueStyle = getComputedStyle(cue); - assert_equals(cueStyle.color, "rgb(0, 255, 255)"); + assert_equals(cueStyle.color, "rgb(255, 0, 0)"); assert_equals(cueStyle.backgroundColor, "rgb(0, 128, 0)"); - assert_equals(cueStyle.textShadow, "rgb(255, 0, 0) 2px 2px 0px"); - assert_equals(cueStyle.fontSize, "14px"); - assert_equals(cueStyle.fontFamily, "fantasy"); + assert_equals(cueStyle.textShadow, "rgb(0, 255, 0) 3px 3px 0px"); + assert_equals(cueStyle.fontSize, "20px"); + assert_equals(cueStyle.fontFamily, "arial"); assert_equals(cueStyle.fontStyle, "italic"); assert_equals(cueStyle.fontVariant, "small-caps"); }); }); -</script> \ No newline at end of file +</script>
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png deleted file mode 100644 index 290ef86..0000000 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png deleted file mode 100644 index 290ef86..0000000 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png index 1cc4653..eff0693 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png index 95e7fb7..f2b6ebf1 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png index 992eb05..75be482 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png deleted file mode 100644 index bb11078..0000000 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png deleted file mode 100644 index bb11078..0000000 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png deleted file mode 100644 index 68afb4c..0000000 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png deleted file mode 100644 index 367c418..0000000 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png deleted file mode 100644 index 2bb26e3e..0000000 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png deleted file mode 100644 index cd360e0a..0000000 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png index 38548ef..31a8f882 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png index fd75baf..fe0d28c 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png index 10ca19c..98c4d4d 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png index 5dd9dcd8..b1a44cc 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png index 2ce807c0..6cfffe6 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/fast/forms/controls-new-ui-high-contrast/radio_checkbox-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/fast/forms/controls-new-ui-high-contrast/radio_checkbox-expected.png new file mode 100644 index 0000000..e6579a8d --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.10/fast/forms/controls-new-ui-high-contrast/radio_checkbox-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png deleted file mode 100644 index 738581f3..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png deleted file mode 100644 index 738581f3..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png index 931c3dc..428e9e1 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png index 96977e89..8e139ac0 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png index 85c0c18..15fd22a 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png deleted file mode 100644 index bad041a..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png deleted file mode 100644 index bad041a..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png deleted file mode 100644 index 79c64c4..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png deleted file mode 100644 index 5c2ed2f..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png deleted file mode 100644 index 0c1d55d..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png deleted file mode 100644 index c91d2b4..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png index 2b60317..7ef12e6b 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png index 191dc5f..d095cf4 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png index cde0033..ab54c65 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png index b4a394e..c7c3da6 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png index dfdcdb9..efc72e6 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.10/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png deleted file mode 100644 index 0c155fd..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png deleted file mode 100644 index 0c155fd..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png index c9117799..aa9a8ee3 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png index 39eef19f..36b4fae2 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png index b345ddb..60517cf 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png deleted file mode 100644 index 06892439..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png deleted file mode 100644 index 06892439..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png deleted file mode 100644 index 1a1024a..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png deleted file mode 100644 index b68a872..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png deleted file mode 100644 index 7e57edb..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png deleted file mode 100644 index a1266f7..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png index 1191997..1600d5e 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png index 84dfa2ae..c44f918e 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png index b3ea6e3..01ac0b5c 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png index ae551468..8b3b494a 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png index 72d216c..be33806 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.11/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png deleted file mode 100644 index 788a23f3..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png deleted file mode 100644 index 788a23f3..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png index 766d9ba88d..f0101ea 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png index 90e4da6..1543fa6 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png index 5957af2..9c29df10 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png deleted file mode 100644 index b2742697..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png deleted file mode 100644 index b2742697..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png deleted file mode 100644 index 70eee753..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png deleted file mode 100644 index f3bdb57..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png deleted file mode 100644 index 9e40a9e..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png deleted file mode 100644 index d598b1d0..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png index 6e339c48..ef3eef6 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png index ae52f7f..fd24e3e 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png index 8706e72..89bc04eb 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png index 1b0f72e..33bba57 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png index 214405ee..0b44a91b 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png deleted file mode 100644 index 788a23f3..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png deleted file mode 100644 index 788a23f3..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png index 766d9ba88d..f0101ea 100644 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png +++ b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png index a14781d..7551ba1 100644 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png +++ b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png index ae4e9be..23a92111 100644 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png +++ b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png deleted file mode 100644 index b2742697..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png deleted file mode 100644 index b2742697..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png deleted file mode 100644 index 92f01c09..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png deleted file mode 100644 index 343fa20..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png deleted file mode 100644 index c4bb77f..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png deleted file mode 100644 index 7ba66d2..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png index 6e339c48..ef3eef6 100644 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png +++ b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png index ae52f7f..fd24e3e 100644 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png +++ b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png index acf3815..8361990 100644 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png +++ b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png index 1b0f72e..33bba57 100644 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png +++ b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png index 6c2851a..5f654118 100644 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png +++ b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui-high-contrast/radio_checkbox-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui-high-contrast/radio_checkbox-expected.png new file mode 100644 index 0000000..41a62bdc --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui-high-contrast/radio_checkbox-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png deleted file mode 100644 index aa39c2e9..0000000 --- a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png deleted file mode 100644 index aa39c2e9..0000000 --- a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png deleted file mode 100644 index adb12a9..0000000 --- a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png deleted file mode 100644 index adb12a9..0000000 --- a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png deleted file mode 100644 index 26bdee1..0000000 --- a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png deleted file mode 100644 index 26bdee1..0000000 --- a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png deleted file mode 100644 index 1a45db0e..0000000 --- a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png deleted file mode 100644 index 1a45db0e..0000000 --- a/third_party/blink/web_tests/platform/mac/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png deleted file mode 100644 index 788a23f3..0000000 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png deleted file mode 100644 index 788a23f3..0000000 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png index 766d9ba88d..f0101ea 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png index a14781d..7551ba1 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png index ae4e9be..23a92111 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png deleted file mode 100644 index b2742697..0000000 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png deleted file mode 100644 index b2742697..0000000 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png deleted file mode 100644 index 92f01c09..0000000 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png deleted file mode 100644 index 343fa20..0000000 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png deleted file mode 100644 index c4bb77f..0000000 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png deleted file mode 100644 index 7ba66d2..0000000 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png index 6e339c48..ef3eef6 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png index ae52f7f..fd24e3e 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png index acf3815..8361990 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png index 1b0f72e..33bba57 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png index 6c2851a..5f654118 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png deleted file mode 100644 index 722790d8..0000000 --- a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png deleted file mode 100644 index 722790d8..0000000 --- a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png index 91e7d3b3..9919e26 100644 --- a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png +++ b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png index 328e495..1c958d81 100644 --- a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png +++ b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png index bb57d96..48752054 100644 --- a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png +++ b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png deleted file mode 100644 index 1d189a8..0000000 --- a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png deleted file mode 100644 index 4313e595..0000000 --- a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png deleted file mode 100644 index 39ef1e76..0000000 --- a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png deleted file mode 100644 index 516552d..0000000 --- a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png index 8b7e83a..0cd7913 100644 --- a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png +++ b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png index 8ddbaa95..2df3add8f0 100644 --- a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png +++ b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png index 1d2d4714..27f9fa4 100644 --- a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png +++ b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png index 8776a9ec..ac0aac1 100644 --- a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png +++ b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png index 53358e2..e4f88b4 100644 --- a/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png +++ b/third_party/blink/web_tests/platform/win7/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh-high-contrast/fast/forms/controls-new-ui-high-contrast/README.txt b/third_party/blink/web_tests/virtual/controls-refresh-high-contrast/fast/forms/controls-new-ui-high-contrast/README.txt new file mode 100644 index 0000000..c9df5a8 --- /dev/null +++ b/third_party/blink/web_tests/virtual/controls-refresh-high-contrast/fast/forms/controls-new-ui-high-contrast/README.txt
@@ -0,0 +1 @@ +# This suite runs tests with --enable-features=FormControlsRefresh, --enable-blink-features=ForcedColors, and --force-high-contrast
diff --git a/third_party/blink/web_tests/virtual/controls-refresh-high-contrast/fast/forms/controls-new-ui-high-contrast/radio_checkbox-expected.png b/third_party/blink/web_tests/virtual/controls-refresh-high-contrast/fast/forms/controls-new-ui-high-contrast/radio_checkbox-expected.png new file mode 100644 index 0000000..bfc39c2 --- /dev/null +++ b/third_party/blink/web_tests/virtual/controls-refresh-high-contrast/fast/forms/controls-new-ui-high-contrast/radio_checkbox-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png deleted file mode 100644 index bae2cb7..0000000 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png deleted file mode 100644 index bae2cb7..0000000 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-color-well-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png index 91e7d3b3..9919e26 100644 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png +++ b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png index ef58dfc..7efa2e0 100644 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png +++ b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hex-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png index 099af98..c388a509 100644 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png +++ b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hsl-format-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png deleted file mode 100644 index 277dd65..0000000 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-click-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png deleted file mode 100644 index 277dd65..0000000 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-drag-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png deleted file mode 100644 index 05ea0a59..0000000 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-left-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png deleted file mode 100644 index d20976d..0000000 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-hue-slider-right-edge-zero-hue-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png deleted file mode 100644 index 12a1f6ec..0000000 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-imperfect-match-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png deleted file mode 100644 index 1f84122..0000000 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-manual-color-change-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png index 8b7e83a..0cd7913 100644 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png +++ b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-type-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png index 8ddbaa95..2df3add8f0 100644 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png +++ b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-set-value-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png index 6b2cc8ae..6b5de5d 100644 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png +++ b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-value-attribute-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png index 8776a9ec..ac0aac1 100644 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png +++ b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom125-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png index 53358e2..e4f88b4 100644 --- a/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png +++ b/third_party/blink/web_tests/virtual/controls-refresh/fast/forms/controls-new-ui/color/color-picker-appearance-zoom200-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt index 2a0efca..5f06c2e 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -3667,6 +3667,7 @@ [Worker] setter onmessage [Worker] interface WorkerGlobalScope : EventTarget [Worker] attribute @@toStringTag +[Worker] getter addressSpace [Worker] getter caches [Worker] getter crypto [Worker] getter fonts
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt index f515c97..7afdcea 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt
@@ -1560,6 +1560,7 @@ attribute @@unscopables getter URL getter activeElement + getter addressSpace getter adoptedStyleSheets getter alinkColor getter all
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt index cd3b593..f18b9a6f 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -3516,6 +3516,7 @@ [Worker] setter onopen [Worker] interface WorkerGlobalScope : EventTarget [Worker] attribute @@toStringTag +[Worker] getter addressSpace [Worker] getter caches [Worker] getter crypto [Worker] getter fonts
diff --git a/third_party/feed/README.chromium b/third_party/feed/README.chromium index 33216ae..77e91ca4 100644 --- a/third_party/feed/README.chromium +++ b/third_party/feed/README.chromium
@@ -2,7 +2,7 @@ Short name: feed URL: https://chromium.googlesource.com/feed Version: 0 -Revision: f4372718f4cabd57efeab02f5726ed147f29768f +Revision: 3c1942092f8caddf60396c2529d684b0374d94de License: Apache 2.0 License File: LICENSE Security Critical: yes
diff --git a/tools/flags/list-flags.py b/tools/flags/list_flags.py similarity index 100% rename from tools/flags/list-flags.py rename to tools/flags/list_flags.py
diff --git a/tools/infra/builder-cache-clobber.py b/tools/infra/builder-cache-clobber.py new file mode 100755 index 0000000..f74ccb8 --- /dev/null +++ b/tools/infra/builder-cache-clobber.py
@@ -0,0 +1,38 @@ +#!/usr/bin/env python +# Copyright 2019 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. + +"""Clobbers all builder caches for a specific builder. + +Note that this currently does not support windows. +""" + +import argparse +import hashlib +import sys + +import clobber_cache_utils + + +def main(raw_args): + parser = argparse.ArgumentParser() + clobber_cache_utils.add_common_args(parser) + parser.add_argument('--builder', required=True) + parser.add_argument('--bucket', required=True) + parser.add_argument('--project', default='chromium') + args = parser.parse_args(raw_args) + + # Matches http://bit.ly/2WZO33P + h = hashlib.sha256('%s/%s/%s' % (args.project, args.bucket, args.builder)) + cache = 'builder_%s_v2' % (h.hexdigest()) + pool = 'luci.%s.%s' % (args.project, args.bucket) + + clobber_cache_utils.clobber_caches(args.swarming_server, pool, cache, + 'cache/builder', args.dry_run) + + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:]))
diff --git a/tools/infra/clobber.py b/tools/infra/clobber.py deleted file mode 100755 index f26b16b..0000000 --- a/tools/infra/clobber.py +++ /dev/null
@@ -1,105 +0,0 @@ -#!/usr/bin/env python -# Copyright 2019 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. - -"""Clobbers all builder caches for a specific builder. - -Note that this currently does not support windows. -""" - -from __future__ import print_function - -import argparse -import hashlib -import os -import subprocess -import sys - -_SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) -_SWARMING_CLIENT = os.path.join(_SRC_ROOT, 'tools', 'swarming_client', - 'swarming.py') -_SWARMING_SERVER = 'chromium-swarm.appspot.com' - - -def _get_bots(pool, cache): - cmd = [ - sys.executable, - _SWARMING_CLIENT, - 'bots', - '-b', - '-S', - _SWARMING_SERVER, - '-d', - 'caches', - cache, - '-d', - 'pool', - pool, - ] - return subprocess.check_output(cmd).splitlines() - - -def _trigger_clobber(pool, cache, bot, dry_run): - cmd = [ - sys.executable, - _SWARMING_CLIENT, - 'trigger', - '-S', - _SWARMING_SERVER, - '-d', - 'pool', - pool, - '-d', - 'id', - bot, - '--named-cache', - cache, - 'cache/builder', - '--priority=10', - '--raw-cmd', - '--', - # TODO(jbudorick): Generalize this for windows. - '/bin/rm', - '-rf', - 'cache/builder', - ] - if dry_run: - print('Would run `%s`' % ' '.join(cmd)) - else: - subprocess.check_call(cmd) - - -def main(raw_args): - parser = argparse.ArgumentParser() - parser.add_argument('--builder', required=True) - parser.add_argument('--pool', required=True) - parser.add_argument( - '--project', default='chromium', choices=['chromium', 'infra']) - parser.add_argument('-n', '--dry-run', action='store_true') - args = parser.parse_args(raw_args) - - # Matches http://bit.ly/2WZO33P - h = hashlib.sha256('%s/%s/%s' % (args.project, args.pool, args.builder)) - cache_name = 'builder_%s_v2' % (h.hexdigest()) - swarming_pool = 'luci.%s.%s' % (args.project, args.pool) - - bots = _get_bots(swarming_pool, cache_name) - - print('The following bots will be clobbered:') - print() - for bot in bots: - print(' %s' % bot) - print() - val = raw_input('Proceed? [Y/n] ') - if val and not val[0] in ('Y', 'y'): - print('Cancelled.') - return 1 - - for bot in bots: - _trigger_clobber(swarming_pool, cache_name, bot, args.dry_run) - return 0 - - -if __name__ == '__main__': - sys.exit(main(sys.argv[1:]))
diff --git a/tools/infra/clobber_cache_utils.py b/tools/infra/clobber_cache_utils.py new file mode 100644 index 0000000..c3d2c572 --- /dev/null +++ b/tools/infra/clobber_cache_utils.py
@@ -0,0 +1,115 @@ +# Copyright 2019 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. + +"""Utility functions for cache clobbering scripts.""" + +from __future__ import print_function + +import os +import subprocess +import sys + +_SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) +_SWARMING_CLIENT = os.path.join(_SRC_ROOT, 'tools', 'swarming_client', + 'swarming.py') +_SWARMING_SERVER = 'chromium-swarm.appspot.com' + + +def _get_bots(swarming_server, pool, cache): + cmd = [ + sys.executable, + _SWARMING_CLIENT, + 'bots', + '-b', + '-S', + swarming_server, + '-d', + 'caches', + cache, + '-d', + 'pool', + pool, + ] + return subprocess.check_output(cmd).splitlines() + + +def _trigger_clobber(swarming_server, pool, cache, bot, mount_rel_path, + dry_run): + cmd = [ + sys.executable, + _SWARMING_CLIENT, + 'trigger', + '-S', + swarming_server, + '-d', + 'pool', + pool, + '-d', + 'id', + bot, + '--named-cache', + cache, + mount_rel_path, + '--priority=10', + '--raw-cmd', + '--', + # TODO(jbudorick): Generalize this for windows. + '/bin/rm', + '-rf', + mount_rel_path, + ] + if dry_run: + print('Would run `%s`' % ' '.join(cmd)) + else: + subprocess.check_call(cmd) + + +def add_common_args(argument_parser): + """Add common arguments to the argument parser used for cache clobber scripts. + + The following arguments will be added to the argument parser: + * swarming_server (-S/--swarming-server) - The swarming server instance to + lookup bots to clobber caches on, with a default of the + chromium-swarm.appspot.com. + * dry_run (-n/--dry-run) - Whether a dry-run should be performed rather than + actually clobbering caches, defaults to False. + """ + argument_parser.add_argument( + '-S', '--swarming-server', default=_SWARMING_SERVER) + argument_parser.add_argument('-n', '--dry-run', action='store_true') + + +def clobber_caches(swarming_server, pool, cache, mount_rel_path, dry_run): + """Clobber caches on bots. + + The set of bots in `pool` in `swarming_server` with a cache named `cache` will + be looked up and printed out then the user will be asked to confirm that the + caches should be clobbered. If the user confirms, tasks that clobber the cache + will be triggered on each bot or if `dry_run` is true, the command that would + trigger such a task is printed instead. + + Args: + * swarming_server - The swarming_server instance to lookup bots to clobber + caches on. + * pool - The pool of machines to lookup bots to clobber caches on. + * cache - The name of the cache to clobber. + * mount_rel_path - The relative path to mount the cache to when clobbering. + * dry_run - Whether a dry-run should be performed where the commands that + would be executed to trigger the clobber task are printed rather than + actually triggering the clobber task. + """ + bots = _get_bots(swarming_server, pool, cache) + + print('The following bots will be clobbered:') + print() + for bot in bots: + print(' %s' % bot) + print() + val = raw_input('Proceed? [Y/n] ') + if val and not val[0] in ('Y', 'y'): + print('Cancelled.') + return 1 + + for bot in bots: + _trigger_clobber(swarming_server, pool, cache, bot, mount_rel_path, dry_run)
diff --git a/tools/infra/named-cache-clobber.py b/tools/infra/named-cache-clobber.py new file mode 100755 index 0000000..e507a9d --- /dev/null +++ b/tools/infra/named-cache-clobber.py
@@ -0,0 +1,36 @@ +#!/usr/bin/env python +# Copyright 2019 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. + +"""Clobbers all instances of a named cache. + +Note that this currently does not support windows. +""" + +import argparse +import sys + +import clobber_cache_utils + + +def main(raw_args): + parser = argparse.ArgumentParser() + clobber_cache_utils.add_common_args(parser) + parser.add_argument('--pool', required=True) + parser.add_argument('--cache', required=True) + parser.add_argument('--mount-rel-path') + args = parser.parse_args(raw_args) + + mount_rel_path = args.mount_rel_path + if mount_rel_path is None: + mount_rel_path = 'cache/%s' % args.cache + + clobber_cache_utils.clobber_caches(args.swarming_server, args.pool, + args.cache, mount_rel_path, args.dry_run) + + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:]))
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 5661aba..65cb8bf4 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -35635,6 +35635,7 @@ <int value="-143819280" label="google-password-manager:disabled"/> <int value="-143382681" label="InstantTethering:enabled"/> <int value="-141516902" label="UseModernMediaControls:enabled"/> + <int value="-140168253" label="ProfileMenuRevamp:enabled"/> <int value="-138983372" label="DesktopPWAWindowing:disabled"/> <int value="-138773929" label="PassiveDocumentEventListeners:enabled"/> <int value="-138760381" label="AutofillManualFallbackAndroid:enabled"/> @@ -36127,6 +36128,7 @@ <int value="562979188" label="DesktopIOSPromotion:enabled"/> <int value="564522013" label="Av1Decoder:disabled"/> <int value="565406673" label="EnableVirtualKeyboardMdUi:enabled"/> + <int value="565611833" label="ProfileMenuRevamp:disabled"/> <int value="567368307" label="enable-experimental-canvas-features"/> <int value="573385109" label="SharedClipboardUI:enabled"/> <int value="575380532" label="ExperimentalAccessibilityLabels:disabled"/>
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 03fa8ba..bd21124a 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -95602,9 +95602,7 @@ </histogram> <histogram name="PageLoad.PaintTiming.ParseStartToFirstContentfulPaint" - units="ms" expires_after="never"> -<!-- expires-never: "heartbeat" metric (internal: go/uma-heartbeats) --> - + units="ms" expires_after="2020-08-14"> <owner>bmcquade@chromium.org</owner> <owner>csharrison@chromium.org</owner> <owner>speed-metrics-dev@chromium.org</owner> @@ -142475,6 +142473,9 @@ </histogram> <histogram base="true" name="ThreadPool.NumTasksBetweenWaits" units="tasks"> + <obsolete> + Deprecated 8/2019. Not used in active investigations. + </obsolete> <owner>fdoray@chromium.org</owner> <owner>gab@chromium.org</owner> <owner>robliao@chromium.org</owner>
diff --git a/tools/perf/convert_legacy_wpr_archive b/tools/perf/convert_legacy_wpr_archive deleted file mode 100755 index 93281ab8..0000000 --- a/tools/perf/convert_legacy_wpr_archive +++ /dev/null
@@ -1,203 +0,0 @@ -#!/usr/bin/env vpython -# 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. - -""" -Takes in a page set json file. Iterate through all .wpr archives and convert -them to .wprgo archive format. - -Instructions: http://bit.ly/wpr-go-migration - -(1) Generate .wprgo archives from a page set json file -tools/perf/convert_legacy_wpr_archive /path/to/page_sets_json_file - -(2) Test that benchmarks pass with the new page set json file. -tools/perf/run_benchmark ... - -(3) Upload new .wprgo files to cloudstorage -tools/perf/convert_legacy_wpr_archive --upload /path/to/page_sets_json_file - -(4) Create a CL to upload generated .wprgo.sha1 and page_sets_json_file for review - -""" - -import base64 -import json -import optparse -import os -import re -import subprocess -import sys -import time - -from core import path_util -from core import benchmark_finders - -path_util.AddTelemetryToPath() -from telemetry.internal.util import binary_manager -import py_utils - -path_util.AddWprToPath() -import httparchive - -class JsonObject: - def toJSON(self): - return json.dumps(self, default=lambda o: o.__dict__, sort_keys=True, indent=4) - -def dump_requests(wpr_archive): - """List all URLs that match given params.""" - requests = '[' - requests_added = False - for r in wpr_archive.get_requests(): - requests_added = True - req = JsonObject() - scheme = 'https' if r.is_ssl else 'http' - req.url = '%s://%s%s' % (scheme, r.host, r.full_path) - req.method = r.command - req.headers = [] - for k in r.headers: - h = JsonObject() - h.key = k - h.val = r.headers[k] - req.headers.append(h) - if r.request_body: - req.body = base64.encodestring(r.request_body) - requests += req.toJSON() + ',\n' - if requests_added: - requests = requests[:-2] - requests += ']' - return requests - -def upload(page_sets_json_file, bucket): - print "uploading to bucket %s\n" % bucket - dir_path = os.path.abspath(os.path.dirname(page_sets_json_file)) - count = 0 - with open(page_sets_json_file, 'r+') as json_file: - content = json_file.read() - m = re.findall(r'"([a-zA-Z0-9_\.\-]+).wprgo"', content) - if not m: - raise Exception("No .wprgo files to upload in ", page_sets_json_file) - # get rid of duplicates. - m = list(set(m)) - for f in m: - wprgo_file = os.path.join(dir_path, f + ".wprgo") - wprsha1_file = os.path.join(dir_path, f + ".wpr.sha1") - if not os.path.exists(wprgo_file): - raise Exception('file "%s" does not exist' % wprgo_file) - cmd = ['third_party/depot_tools/upload_to_google_storage.py', '--bucket', - bucket, wprgo_file] - print cmd - return_code = subprocess.call(cmd) - if return_code != 0: - raise Exception("fail to upload wprgo file %s\n" % wprgo_file) - subprocess.call(['rm', wprsha1_file]) - count += 1 - print "successfully upload %d wprgo files in %s to buckets: %s\n" % (count, - page_sets_json_file, bucket) - print ('Also run \"git add *.wprgo.sha1\" to include them in your CL? ' - '(Press Enter to continue or ctrl+C to skip this step)\n') - raw_input() - subprocess.check_call(['git', 'add', '*.wprgo.sha1']) - -def GetStorySet(benchmark): - # Create a dummy options object which hold default values that are expected - # by Benchmark.CreateStorySet(options) method. - parser = optparse.OptionParser() - benchmark.AddBenchmarkCommandLineArgs(parser) - options, _ = parser.parse_args([]) - return benchmark().CreateStorySet(options) - -def main(): - option_parser = optparse.OptionParser() - option_parser.add_option("--upload", action="store_true", default=False, - help='Upload wprgo files to cloud storage bucket') - options, args = option_parser.parse_args() - - if len(args) < 1: - print 'args: %s' % args - option_parser.error('Must specify page_sets_json_file') - - page_sets_json_file = args[0] - - if not os.path.exists(page_sets_json_file): - option_parser.error('file "%s" does not exist' % page_sets_json_file) - - if options.upload: - buckets = [] - benchmarks_to_skip = ['skpicture_printer_ct', - 'screenshot_ct', - 'repaint_ct', - 'rasterize_and_record_micro_ct', - 'multipage_skpicture_printer_ct', - 'loading.cluster_telemetry', - 'skpicture_printer', - 'cros_tab_switching.typical_24', - 'multipage_skpicture_printer'] - for b in benchmark_finders.GetAllBenchmarks(): - if b.Name() in benchmarks_to_skip: - continue - story_set = GetStorySet(b) - if not story_set.bucket or not story_set.archive_data_file: - continue - if story_set.archive_data_file.split('/')[-1] == page_sets_json_file.split('/')[-1]: - buckets.append(story_set.bucket) - buckets = list(set(buckets)) - assert len(buckets) == 1 - upload(page_sets_json_file, buckets[0]) - return 0 - - dir_path = os.path.abspath(os.path.dirname(page_sets_json_file)) - cert_file = os.path.join(path_util.GetWprGoDir(), 'wpr_cert.pem') - key_file = os.path.join(path_util.GetWprGoDir(), 'wpr_key.pem') - binary_manager.InitDependencyManager(None) - go_binary_path = binary_manager.FetchPath('wpr_go', - py_utils.GetHostArchName(), - py_utils.GetHostOsName()) - with open(page_sets_json_file, 'r+') as json_file: - content = json_file.read() - m = re.findall(r'"([a-zA-Z0-9_\.\-]+).wpr"', content) - if not m: - raise Exception("No .wpr files found in ", page_sets_json_file) - # get rid of duplicates. - m = list(set(m)) - for f in m: - wpr_file = os.path.join(dir_path, f + ".wpr") - temp_file = os.path.join(dir_path, f + ".wprgotemp") - wprgo_file = os.path.join(dir_path, f + ".wprgo") - if not os.path.exists(wpr_file): - option_parser.error('file "%s" does not exist' % wpr_file) - - archive = httparchive.HttpArchive.Load(wpr_file) - with open(temp_file, 'w') as output: - output.write(dump_requests(archive)) - wpr_cmd = [path_util.GetWprDir() + '/replay.py', - '--port=8080', '--ssl_port=8089', '--no-dns_forwarding', - '--inject_scripts=', - wpr_file] - print wpr_cmd - wpr_server = subprocess.Popen(' '.join(wpr_cmd), shell=True) - time.sleep(10) - go_cmd = [go_binary_path, - 'convert', - '--input_file=%s' % temp_file, - '--output_file=%s' % wprgo_file, - '--http_port=8080', - '--https_port=8089', - '--https_cert_file=%s' % cert_file, - '--https_key_file=%s' % key_file] - return_code = subprocess.call(go_cmd) - wpr_server.terminate() - if return_code != 0: - print "fail to start wpr go\n" - return 1 - content = content.replace(f + ".wpr", f + ".wprgo") - print "successfully written %s \n" % f + ".wprgo" - os.remove(temp_file) - json_file.seek(0) - json_file.write(content) - json_file.truncate() - return 0 - -if __name__ == '__main__': - sys.exit(main())
diff --git a/tools/perf/core/path_util.py b/tools/perf/core/path_util.py index 1976811..8f66398 100644 --- a/tools/perf/core/path_util.py +++ b/tools/perf/core/path_util.py
@@ -64,27 +64,11 @@ sys.path.insert(1, py_utils_dir) -def GetWprDir(): - return os.path.join( - GetChromiumSrcDir(), 'third_party', 'catapult', 'telemetry', - 'third_party', 'web-page-replay') - - -def AddWprToPath(): - wpr_path = GetWprDir() - if wpr_path not in sys.path: - sys.path.insert(1, wpr_path) - - -def GetWprGoDir(): - return os.path.join( - GetChromiumSrcDir(), 'third_party', 'catapult', 'web_page_replay_go') - - def AddAndroidPylibToPath(): android_pylib_path = GetAndroidPylibDir() if android_pylib_path not in sys.path: sys.path.insert(1, android_pylib_path) + def GetExpectationsPath(): return os.path.join(GetPerfDir(), 'expectations.config')
diff --git a/ui/accessibility/platform/ax_platform_node_auralinux.cc b/ui/accessibility/platform/ax_platform_node_auralinux.cc index 25b079c..f2db5e11 100644 --- a/ui/accessibility/platform/ax_platform_node_auralinux.cc +++ b/ui/accessibility/platform/ax_platform_node_auralinux.cc
@@ -3587,6 +3587,64 @@ return delegate_->AccessibilityPerformAction(action_data); } +bool AXPlatformNodeAuraLinux::FocusFirstFocusableAncestorInWebContent() { + if (!GetDelegate()->IsWebContent()) + return false; + + // Don't cross document boundaries in order to avoid having this operation + // cross iframe boundaries or escape to non-document UI elements. + if (GetAtkRole() == ATK_ROLE_DOCUMENT_WEB) + return false; + + if (GetData().HasState(ax::mojom::State::kFocusable) || + SelectionAndFocusAreTheSame()) { + if (g_current_focused != GetOrCreateAtkObject()) + GrabFocus(); + return true; + } + + auto* parent = AtkObjectToAXPlatformNodeAuraLinux(GetParent()); + if (!parent) + return false; + + // If any of the siblings of this element are focusable, focusing the parent + // would be like moving the focus position backward, so we should fall back + // to setting the sequential focus navigation starting point. + for (auto child_iterator_ptr = parent->GetDelegate()->ChildrenBegin(); + *child_iterator_ptr != *parent->GetDelegate()->ChildrenEnd(); + ++(*child_iterator_ptr)) { + auto* child = AtkObjectToAXPlatformNodeAuraLinux( + child_iterator_ptr->GetNativeViewAccessible()); + if (!child || child == this) + continue; + + if (child->GetData().HasState(ax::mojom::State::kFocusable) || + child->SelectionAndFocusAreTheSame()) { + return false; + } + } + + return parent->FocusFirstFocusableAncestorInWebContent(); +} + +bool AXPlatformNodeAuraLinux::SetSequentialFocusNavigationStartingPoint() { + AXActionData action_data; + action_data.action = + ax::mojom::Action::kSetSequentialFocusNavigationStartingPoint; + return delegate_->AccessibilityPerformAction(action_data); +} + +bool AXPlatformNodeAuraLinux:: + GrabFocusOrSetSequentialFocusNavigationStartingPoint() { + // First we try to grab focus on this node if any ancestor in the same + // document is focusable. Otherwise we set the sequential navigation starting + // point. + if (!FocusFirstFocusableAncestorInWebContent()) + return SetSequentialFocusNavigationStartingPoint(); + else + return true; +} + bool AXPlatformNodeAuraLinux:: GrabFocusOrSetSequentialFocusNavigationStartingPointAtOffset(int offset) { int child_count = delegate_->GetChildCount(); @@ -3613,38 +3671,14 @@ // If the offset is larger than our size, try to work with the last child, // which is also the behavior of SetCaretOffset. - if (offset <= current_offset || i == child_count - 1) { - // When deciding to do this on the parent or the child we want to err - // toward doing it on a focusable node. If neither node is focusable, we - // should call GrabFocusOrSetSequentialFocusNavigationStartingPoint on - // the child. - bool can_focus_node = GetData().HasState(ax::mojom::State::kFocusable); - bool can_focus_child = - child->GetData().HasState(ax::mojom::State::kFocusable); - if (can_focus_node && !can_focus_child) - return GrabFocusOrSetSequentialFocusNavigationStartingPoint(); - else - return child->GrabFocusOrSetSequentialFocusNavigationStartingPoint(); - } + if (offset <= current_offset || i == child_count - 1) + return child->GrabFocusOrSetSequentialFocusNavigationStartingPoint(); } NOTREACHED(); return false; } -bool AXPlatformNodeAuraLinux:: - GrabFocusOrSetSequentialFocusNavigationStartingPoint() { - if (GetData().HasState(ax::mojom::State::kFocusable) || - SelectionAndFocusAreTheSame()) { - return GrabFocus(); - } - - AXActionData action_data; - action_data.action = - ax::mojom::Action::kSetSequentialFocusNavigationStartingPoint; - return delegate_->AccessibilityPerformAction(action_data); -} - bool AXPlatformNodeAuraLinux::DoDefaultAction() { AXActionData action_data; action_data.action = ax::mojom::Action::kDoDefault;
diff --git a/ui/accessibility/platform/ax_platform_node_auralinux.h b/ui/accessibility/platform/ax_platform_node_auralinux.h index aacd8b72..02c35be 100644 --- a/ui/accessibility/platform/ax_platform_node_auralinux.h +++ b/ui/accessibility/platform/ax_platform_node_auralinux.h
@@ -116,8 +116,10 @@ gint y, AtkCoordType coord_type); bool GrabFocus(); + bool FocusFirstFocusableAncestorInWebContent(); bool GrabFocusOrSetSequentialFocusNavigationStartingPointAtOffset(int offset); bool GrabFocusOrSetSequentialFocusNavigationStartingPoint(); + bool SetSequentialFocusNavigationStartingPoint(); bool DoDefaultAction(); const gchar* GetDefaultActionName(); AtkAttributeSet* GetAtkAttributes();
diff --git a/ui/android/resources/resource_manager_impl_unittest.cc b/ui/android/resources/resource_manager_impl_unittest.cc index 051aea2d..bfe1b66 100644 --- a/ui/android/resources/resource_manager_impl_unittest.cc +++ b/ui/android/resources/resource_manager_impl_unittest.cc
@@ -113,7 +113,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; WindowAndroid* window_android_; protected:
diff --git a/ui/aura/test/aura_test_base.cc b/ui/aura/test/aura_test_base.cc index b7a1ca4..e25d65e6 100644 --- a/ui/aura/test/aura_test_base.cc +++ b/ui/aura/test/aura_test_base.cc
@@ -24,8 +24,7 @@ namespace test { AuraTestBase::AuraTestBase() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} AuraTestBase::~AuraTestBase() { CHECK(setup_called_)
diff --git a/ui/aura/test/aura_test_base.h b/ui/aura/test/aura_test_base.h index bcfd970..21b70265 100644 --- a/ui/aura/test/aura_test_base.h +++ b/ui/aura/test/aura_test_base.h
@@ -66,7 +66,7 @@ client::FocusClient* focus_client() { return helper_->focus_client(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; #if defined(OS_WIN) base::win::ScopedCOMInitializer com_initializer_;
diff --git a/ui/base/accelerators/global_media_keys_listener_win_interactive_test.cc b/ui/base/accelerators/global_media_keys_listener_win_interactive_test.cc index c15b5cb..e7c7cbe 100644 --- a/ui/base/accelerators/global_media_keys_listener_win_interactive_test.cc +++ b/ui/base/accelerators/global_media_keys_listener_win_interactive_test.cc
@@ -67,8 +67,7 @@ class GlobalMediaKeysListenerWinInteractiveTest : public testing::Test { public: GlobalMediaKeysListenerWinInteractiveTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} protected: void SendKeyDown(KeyboardCode code) { @@ -90,7 +89,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DWORD time_stamp_ = 0; DISALLOW_COPY_AND_ASSIGN(GlobalMediaKeysListenerWinInteractiveTest); @@ -149,4 +148,4 @@ delegate.ExpectReceivedEvent(/*index=*/1, ui::VKEY_MEDIA_STOP); } -} // namespace ui \ No newline at end of file +} // namespace ui
diff --git a/ui/base/clipboard/clipboard_unittest.cc b/ui/base/clipboard/clipboard_unittest.cc index 3c6eb93..d3cc37c 100644 --- a/ui/base/clipboard/clipboard_unittest.cc +++ b/ui/base/clipboard/clipboard_unittest.cc
@@ -15,7 +15,7 @@ namespace { -base::test::ScopedTaskEnvironment* g_task_environment = nullptr; +base::test::TaskEnvironment* g_task_environment = nullptr; } // namespace @@ -28,8 +28,8 @@ static Clipboard* Create() { DCHECK(!g_task_environment); - g_task_environment = new base::test::ScopedTaskEnvironment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + g_task_environment = new base::test::TaskEnvironment( + base::test::TaskEnvironment::MainThreadType::UI); return Clipboard::GetForCurrentThread(); }
diff --git a/ui/base/clipboard/test/test_clipboard_unittest.cc b/ui/base/clipboard/test/test_clipboard_unittest.cc index 021a85c..1d9d1a3 100644 --- a/ui/base/clipboard/test/test_clipboard_unittest.cc +++ b/ui/base/clipboard/test/test_clipboard_unittest.cc
@@ -15,7 +15,7 @@ namespace { -base::test::ScopedTaskEnvironment* g_task_environment = nullptr; +base::test::TaskEnvironment* g_task_environment = nullptr; } // namespace @@ -28,8 +28,8 @@ static Clipboard* Create() { DCHECK(!g_task_environment); - g_task_environment = new base::test::ScopedTaskEnvironment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + g_task_environment = new base::test::TaskEnvironment( + base::test::TaskEnvironment::MainThreadType::UI); return TestClipboard::CreateForCurrentThread(); }
diff --git a/ui/base/cocoa/menu_controller_unittest.mm b/ui/base/cocoa/menu_controller_unittest.mm index c36ba6b..ecc086b 100644 --- a/ui/base/cocoa/menu_controller_unittest.mm +++ b/ui/base/cocoa/menu_controller_unittest.mm
@@ -377,8 +377,8 @@ // hidden, then the submenu should hide. TEST_F(MenuControllerTest, HiddenSubmenu) { // SimpleMenuModel posts a task that calls Delegate::MenuClosed. - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); // Create the model. Delegate delegate; @@ -424,8 +424,8 @@ TEST_F(MenuControllerTest, DisabledSubmenu) { // SimpleMenuModel posts a task that calls Delegate::MenuClosed. - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); // Create the model. Delegate delegate; @@ -619,8 +619,8 @@ TEST_F(MenuControllerTest, OpenClose) { // SimpleMenuModel posts a task that calls Delegate::MenuClosed. - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); // Create the model. Delegate delegate; @@ -689,8 +689,8 @@ if (![NSMenuItem instancesRespondToSelector:@selector(_sendItemSelectedNote)]) return; - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); Delegate delegate; delegate.auto_close_ = false; @@ -795,8 +795,8 @@ // MenuControllerCocoa and destroys itself. Note this usually needs asan to // actually crash (before it was fixed). TEST_F(MenuControllerTest, OwningDelegate) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); bool did_delete = false; BOOL did_dealloc = NO; OwningDelegate* delegate;
diff --git a/ui/base/dragdrop/os_exchange_data_provider_aurax11_unittest.cc b/ui/base/dragdrop/os_exchange_data_provider_aurax11_unittest.cc index ac42a4d..8e47f558 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_aurax11_unittest.cc +++ b/ui/base/dragdrop/os_exchange_data_provider_aurax11_unittest.cc
@@ -24,8 +24,7 @@ class OSExchangeDataProviderAuraX11Test : public testing::Test { public: OSExchangeDataProviderAuraX11Test() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), event_source(gfx::GetXDisplay()) {} void AddURLList(const std::string& list_contents) { @@ -37,7 +36,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; X11EventSourceGlib event_source; ui::OSExchangeDataProviderAuraX11 provider; };
diff --git a/ui/base/dragdrop/os_exchange_data_unittest.cc b/ui/base/dragdrop/os_exchange_data_unittest.cc index 7ee364b..ef69948 100644 --- a/ui/base/dragdrop/os_exchange_data_unittest.cc +++ b/ui/base/dragdrop/os_exchange_data_unittest.cc
@@ -23,12 +23,11 @@ class OSExchangeDataTest : public PlatformTest { public: OSExchangeDataTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), event_source_(PlatformEventSource::CreateDefault()) {} private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<PlatformEventSource> event_source_; };
diff --git a/ui/base/dragdrop/os_exchange_data_win_unittest.cc b/ui/base/dragdrop/os_exchange_data_win_unittest.cc index 641bfff..4b751c0 100644 --- a/ui/base/dragdrop/os_exchange_data_win_unittest.cc +++ b/ui/base/dragdrop/os_exchange_data_win_unittest.cc
@@ -34,8 +34,7 @@ class OSExchangeDataWinTest : public ::testing::Test { public: OSExchangeDataWinTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void OnGotVirtualFilesAsTempFiles( const std::vector<std::pair<base::FilePath, base::FilePath>>& @@ -52,7 +51,7 @@ protected: std::vector<FileInfo> retrieved_virtual_files_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Test getting using the IDataObject COM API @@ -381,7 +380,7 @@ EXPECT_TRUE(copy.GetVirtualFilesAsTempFiles(std::move(callback))); // RunUntilIdle assures all async tasks are run. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(kTestFilenamesAndContents.size(), retrieved_virtual_files_.size()); @@ -457,7 +456,7 @@ EXPECT_FALSE(copy.GetVirtualFilesAsTempFiles(std::move(callback))); // RunUntilIdle assures all async tasks are run. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(static_cast<size_t>(0), retrieved_virtual_files_.size()); } @@ -506,7 +505,7 @@ EXPECT_TRUE(copy.GetVirtualFilesAsTempFiles(std::move(callback))); // RunUntilIdle assures all async tasks are run. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(kTestFilenamesAndContents.size(), file_infos.size()); for (size_t i = 0; i < retrieved_virtual_files_.size(); i++) { @@ -589,7 +588,7 @@ EXPECT_TRUE(copy.GetVirtualFilesAsTempFiles(std::move(callback))); // RunUntilIdle assures all async tasks are run. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(kTestFilenamesAndContents.size(), file_infos.size()); for (size_t i = 0; i < retrieved_virtual_files_.size(); i++) { @@ -700,7 +699,7 @@ EXPECT_TRUE(copy.GetVirtualFilesAsTempFiles(std::move(callback))); // RunUntilIdle assures all async tasks are run. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(kTestFilenamesAndContents.size(), file_infos.size()); for (size_t i = 0; i < retrieved_virtual_files_.size(); i++) { @@ -785,7 +784,7 @@ EXPECT_TRUE(copy.GetVirtualFilesAsTempFiles(std::move(callback))); // RunUntilIdle assures all async tasks are run. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_EQ(kTestFilenamesAndContents.size(), retrieved_virtual_files_.size());
diff --git a/ui/base/ime/chromeos/input_method_chromeos_unittest.cc b/ui/base/ime/chromeos/input_method_chromeos_unittest.cc index f1ff1de..ebf1e6c3 100644 --- a/ui/base/ime/chromeos/input_method_chromeos_unittest.cc +++ b/ui/base/ime/chromeos/input_method_chromeos_unittest.cc
@@ -366,7 +366,7 @@ TestInputMethodManager* input_method_manager_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(InputMethodChromeOSTest); };
diff --git a/ui/base/ime/input_method_base_unittest.cc b/ui/base/ime/input_method_base_unittest.cc index 157da3b..217c977c 100644 --- a/ui/base/ime/input_method_base_unittest.cc +++ b/ui/base/ime/input_method_base_unittest.cc
@@ -111,8 +111,8 @@ class InputMethodBaseTest : public testing::Test { private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; }; class MockInputMethodBase : public InputMethodBase {
diff --git a/ui/base/ime/mojom/ime_mojom_traits_unittest.cc b/ui/base/ime/mojom/ime_mojom_traits_unittest.cc index 2bbc9875..67dc9de 100644 --- a/ui/base/ime/mojom/ime_mojom_traits_unittest.cc +++ b/ui/base/ime/mojom/ime_mojom_traits_unittest.cc
@@ -35,9 +35,8 @@ std::move(callback).Run(in); } - base::test::ScopedTaskEnvironment - scoped_task_environment_; // A MessageLoop is needed for Mojo IPC to - // work. + base::test::TaskEnvironment task_environment_; // A MessageLoop is needed for + // Mojo IPC to work. mojo::BindingSet<mojom::IMEStructTraitsTest> traits_test_bindings_; DISALLOW_COPY_AND_ASSIGN(IMEStructTraitsTest);
diff --git a/ui/base/ime/win/on_screen_keyboard_display_manager_unittest.cc b/ui/base/ime/win/on_screen_keyboard_display_manager_unittest.cc index 3887fb1..997f4f9 100644 --- a/ui/base/ime/win/on_screen_keyboard_display_manager_unittest.cc +++ b/ui/base/ime/win/on_screen_keyboard_display_manager_unittest.cc
@@ -108,8 +108,7 @@ class OnScreenKeyboardTest : public ::testing::Test { protected: OnScreenKeyboardTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} std::unique_ptr<OnScreenKeyboardDisplayManagerTabTip> CreateTabTip() { return std::unique_ptr<OnScreenKeyboardDisplayManagerTabTip>( @@ -123,14 +122,14 @@ void WaitForEventsWithTimeDelay(int64_t time_delta_ms = 10) { base::RunLoop run_loop; - scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( + task_environment_.GetMainThreadTaskRunner()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromMilliseconds(time_delta_ms)); run_loop.Run(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(OnScreenKeyboardTest); };
diff --git a/ui/base/l10n/OWNERS b/ui/base/l10n/OWNERS index d717b8d..b2ce105 100644 --- a/ui/base/l10n/OWNERS +++ b/ui/base/l10n/OWNERS
@@ -1 +1,2 @@ jshin@chromium.org +# COMPONENT: UI>Internationalization
diff --git a/ui/base/mpris/mpris_service_impl_unittest.cc b/ui/base/mpris/mpris_service_impl_unittest.cc index 5ee9b87..aecd2d5 100644 --- a/ui/base/mpris/mpris_service_impl_unittest.cc +++ b/ui/base/mpris/mpris_service_impl_unittest.cc
@@ -51,8 +51,7 @@ class MprisServiceImplTest : public testing::Test, public MprisServiceObserver { public: MprisServiceImplTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~MprisServiceImplTest() override = default; void SetUp() override { StartMprisServiceAndWaitForReady(); } @@ -153,7 +152,7 @@ service_wait_loop_->Quit(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> service_wait_loop_; std::unique_ptr<base::RunLoop> response_wait_loop_; std::unique_ptr<MprisServiceImpl> service_;
diff --git a/ui/base/test/scoped_fake_nswindow_fullscreen_unittest.mm b/ui/base/test/scoped_fake_nswindow_fullscreen_unittest.mm index c848882..a2a92ede 100644 --- a/ui/base/test/scoped_fake_nswindow_fullscreen_unittest.mm +++ b/ui/base/test/scoped_fake_nswindow_fullscreen_unittest.mm
@@ -41,8 +41,8 @@ // Test the order of notifications sent when faking fullscreen transitions. TEST(ScopedFakeNSWindowFullscreenTest, TestOrdering) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); NSUInteger style_mask = NSTexturedBackgroundWindowMask | NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask |
diff --git a/ui/base/test/skia_gold_pixel_diff.h b/ui/base/test/skia_gold_pixel_diff.h index 290803a..a19bc6125 100644 --- a/ui/base/test/skia_gold_pixel_diff.h +++ b/ui/base/test/skia_gold_pixel_diff.h
@@ -19,7 +19,7 @@ class SkiaGoldPixelDiff { public: SkiaGoldPixelDiff(); - ~SkiaGoldPixelDiff(); + virtual ~SkiaGoldPixelDiff(); // Call Init method before using this class. // Args: // screenshot_prefix The prefix for your screenshot name on GCS.
diff --git a/ui/base/x/selection_requestor_unittest.cc b/ui/base/x/selection_requestor_unittest.cc index 2954b66..2902e8c 100644 --- a/ui/base/x/selection_requestor_unittest.cc +++ b/ui/base/x/selection_requestor_unittest.cc
@@ -89,8 +89,8 @@ std::unique_ptr<PlatformEventSource> event_source_; std::unique_ptr<SelectionRequestor> requestor_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; private: DISALLOW_COPY_AND_ASSIGN(SelectionRequestorTest);
diff --git a/ui/compositor/compositor_unittest.cc b/ui/compositor/compositor_unittest.cc index f963db85..5ae602f 100644 --- a/ui/compositor/compositor_unittest.cc +++ b/ui/compositor/compositor_unittest.cc
@@ -82,8 +82,7 @@ class CompositorTestWithMessageLoop : public CompositorTest { public: CompositorTestWithMessageLoop() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~CompositorTestWithMessageLoop() override = default; protected: @@ -95,7 +94,7 @@ base::SequencedTaskRunner* task_runner() { return task_runner_.get(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; };
diff --git a/ui/compositor/layer_animator_unittest.cc b/ui/compositor/layer_animator_unittest.cc index 8337c4ae..de080ec 100644 --- a/ui/compositor/layer_animator_unittest.cc +++ b/ui/compositor/layer_animator_unittest.cc
@@ -3253,8 +3253,8 @@ } TEST(LayerAnimatorTest, LayerMovedBetweenCompositorsDuringAnimation) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::UI); const bool enable_pixel_output = false; TestContextFactories context_factories(enable_pixel_output); const gfx::Rect bounds(10, 10, 100, 100); @@ -3317,8 +3317,8 @@ } TEST(LayerAnimatorTest, ThreadedAnimationSurvivesIfLayerRemovedAdded) { - base::test::ScopedTaskEnvironment scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment_( + base::test::TaskEnvironment::MainThreadType::UI); const bool enable_pixel_output = false; TestContextFactories context_factories(enable_pixel_output); const gfx::Rect bounds(10, 10, 100, 100);
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc index 6e464c5..dbeec073 100644 --- a/ui/compositor/layer_unittest.cc +++ b/ui/compositor/layer_unittest.cc
@@ -141,8 +141,7 @@ class LayerWithRealCompositorTest : public testing::TestWithParam<bool> { public: LayerWithRealCompositorTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) { gfx::FontList::SetDefaultFontDescription("Segoe UI, 15px"); } ~LayerWithRealCompositorTest() override {} @@ -285,7 +284,7 @@ std::unique_ptr<base::RunLoop> run_loop_; }; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestContextFactories> context_factories_; std::unique_ptr<TestCompositorHost> compositor_host_; @@ -515,8 +514,7 @@ class LayerWithDelegateTest : public testing::Test { public: LayerWithDelegateTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~LayerWithDelegateTest() override {} // Overridden from testing::Test: @@ -582,7 +580,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestContextFactories> context_factories_; std::unique_ptr<TestCompositorHost> compositor_host_;
diff --git a/ui/display/manager/configure_displays_task_unittest.cc b/ui/display/manager/configure_displays_task_unittest.cc index b89205ce..1f4aabe 100644 --- a/ui/display/manager/configure_displays_task_unittest.cc +++ b/ui/display/manager/configure_displays_task_unittest.cc
@@ -48,7 +48,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; ActionLogger log_; TestNativeDisplayDelegate delegate_;
diff --git a/ui/display/manager/display_configurator_unittest.cc b/ui/display/manager/display_configurator_unittest.cc index 474b267..6b5a70f 100644 --- a/ui/display/manager/display_configurator_unittest.cc +++ b/ui/display/manager/display_configurator_unittest.cc
@@ -312,7 +312,7 @@ return result; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestStateController state_controller_; TestMirroringController mirroring_controller_; DisplayConfigurator configurator_;
diff --git a/ui/events/blink/input_handler_proxy_unittest.cc b/ui/events/blink/input_handler_proxy_unittest.cc index c062dfa0..9f531521 100644 --- a/ui/events/blink/input_handler_proxy_unittest.cc +++ b/ui/events/blink/input_handler_proxy_unittest.cc
@@ -517,7 +517,7 @@ uint64_t next_begin_frame_number_ = viz::BeginFrameArgs::kStartingFrameNumber; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::WeakPtrFactory<InputHandlerProxyEventQueueTest> weak_ptr_factory_{this}; };
diff --git a/ui/events/gesture_detection/filtered_gesture_provider_unittest.cc b/ui/events/gesture_detection/filtered_gesture_provider_unittest.cc index da9d317..50650a7d 100644 --- a/ui/events/gesture_detection/filtered_gesture_provider_unittest.cc +++ b/ui/events/gesture_detection/filtered_gesture_provider_unittest.cc
@@ -13,8 +13,7 @@ public testing::Test { public: FilteredGestureProviderTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~FilteredGestureProviderTest() override {} // GestureProviderClient implementation. @@ -22,7 +21,7 @@ bool RequiresDoubleTapGestureEvents() const override { return false; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Single touch drag test: After touch-start, the moved_beyond_slop_region bit
diff --git a/ui/events/gesture_detection/gesture_provider_unittest.cc b/ui/events/gesture_detection/gesture_provider_unittest.cc index 3451986..6c74af3 100644 --- a/ui/events/gesture_detection/gesture_provider_unittest.cc +++ b/ui/events/gesture_detection/gesture_provider_unittest.cc
@@ -66,8 +66,7 @@ class GestureProviderTest : public testing::Test, public GestureProviderClient { public: GestureProviderTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~GestureProviderTest() override {} static MockMotionEvent ObtainMotionEvent(base::TimeTicks event_time, @@ -438,7 +437,7 @@ std::vector<GestureEventData> gestures_; std::unique_ptr<GestureProvider> gesture_provider_; std::unique_ptr<GestureEventData> active_scroll_begin_event_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; bool should_process_double_tap_events_ = true; };
diff --git a/ui/events/gestures/gesture_provider_aura_unittest.cc b/ui/events/gestures/gesture_provider_aura_unittest.cc index 256cf27..d10aa3c 100644 --- a/ui/events/gestures/gesture_provider_aura_unittest.cc +++ b/ui/events/gestures/gesture_provider_aura_unittest.cc
@@ -17,8 +17,7 @@ public GestureProviderAuraClient { public: GestureProviderAuraTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} ~GestureProviderAuraTest() override {} @@ -37,7 +36,7 @@ private: std::unique_ptr<GestureConsumer> consumer_; std::unique_ptr<GestureProviderAura> provider_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; TEST_F(GestureProviderAuraTest, IgnoresExtraPressEvents) {
diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc b/ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc index a123285..aef0568 100644 --- a/ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc +++ b/ui/events/ozone/evdev/event_converter_evdev_impl_unittest.cc
@@ -128,8 +128,8 @@ dispatched_events_.push_back(std::move(cloned_event)); } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; std::unique_ptr<ui::FakeCursorDelegateEvdev> cursor_; std::unique_ptr<ui::DeviceManager> device_manager_; std::unique_ptr<ui::EventFactoryEvdev> event_factory_;
diff --git a/ui/events/ozone/evdev/input_injector_evdev_unittest.cc b/ui/events/ozone/evdev/input_injector_evdev_unittest.cc index 5821aea..87a092b8 100644 --- a/ui/events/ozone/evdev/input_injector_evdev_unittest.cc +++ b/ui/events/ozone/evdev/input_injector_evdev_unittest.cc
@@ -88,7 +88,7 @@ InputInjectorEvdev injector_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop run_loop_; private:
diff --git a/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc b/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc index f480391e..1805dde6 100644 --- a/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc +++ b/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc
@@ -304,8 +304,8 @@ base::HistogramTester histogram_tester_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; std::unique_ptr<ui::MockTouchEventConverterEvdev> device_; std::unique_ptr<ui::MockDeviceEventDispatcherEvdev> dispatcher_; std::unique_ptr<ui::test::ScopedEventTestTickClock> test_clock_;
diff --git a/ui/events/platform/platform_event_source_unittest.cc b/ui/events/platform/platform_event_source_unittest.cc index 3be3623..9ed5aea 100644 --- a/ui/events/platform/platform_event_source_unittest.cc +++ b/ui/events/platform/platform_event_source_unittest.cc
@@ -498,7 +498,7 @@ ~PlatformEventTestWithMessageLoop() override {} void Run() { - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&PlatformEventTestWithMessageLoop::RunTestImpl, base::Unretained(this))); @@ -509,8 +509,8 @@ virtual void RunTestImpl() = 0; private: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; DISALLOW_COPY_AND_ASSIGN(PlatformEventTestWithMessageLoop); };
diff --git a/ui/events/win/media_keyboard_hook_win_interactive_test.cc b/ui/events/win/media_keyboard_hook_win_interactive_test.cc index 18a2df9..f15322ae 100644 --- a/ui/events/win/media_keyboard_hook_win_interactive_test.cc +++ b/ui/events/win/media_keyboard_hook_win_interactive_test.cc
@@ -15,8 +15,7 @@ class MediaKeyboardHookWinInteractiveTest : public testing::Test { public: MediaKeyboardHookWinInteractiveTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} protected: void SetUp() override { @@ -81,7 +80,7 @@ std::vector<KeyEvent> key_events_; std::unique_ptr<KeyboardHook> keyboard_hook_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop key_event_wait_loop_; uint32_t num_key_events_to_wait_for_ = 0; DWORD time_stamp_ = 0; @@ -117,4 +116,4 @@ ExpectReceivedEvent(/*index=*/1, ui::VKEY_MEDIA_PLAY_PAUSE, ET_KEY_RELEASED); } -} // namespace ui \ No newline at end of file +} // namespace ui
diff --git a/ui/gfx/animation/animation_container_unittest.cc b/ui/gfx/animation/animation_container_unittest.cc index 6213e98..60934c8 100644 --- a/ui/gfx/animation/animation_container_unittest.cc +++ b/ui/gfx/animation/animation_container_unittest.cc
@@ -62,11 +62,10 @@ class AnimationContainerTest: public testing::Test { protected: AnimationContainerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Makes sure the animation ups the ref count of the container and releases it
diff --git a/ui/gfx/animation/animation_unittest.cc b/ui/gfx/animation/animation_unittest.cc index 8658d56..7676738a 100644 --- a/ui/gfx/animation/animation_unittest.cc +++ b/ui/gfx/animation/animation_unittest.cc
@@ -19,11 +19,10 @@ class AnimationTest: public testing::Test { protected: AnimationTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; namespace {
diff --git a/ui/gfx/animation/slide_animation_unittest.cc b/ui/gfx/animation/slide_animation_unittest.cc index bd6c66e..bd66a15 100644 --- a/ui/gfx/animation/slide_animation_unittest.cc +++ b/ui/gfx/animation/slide_animation_unittest.cc
@@ -30,14 +30,13 @@ protected: SlideAnimationTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) { slide_animation_.reset(new SlideAnimation(nullptr)); animation_api_.reset(new AnimationTestApi(slide_animation_.get())); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; }; // Tests animation construction.
diff --git a/ui/gfx/font_fallback_win_unittest.cc b/ui/gfx/font_fallback_win_unittest.cc index 77a3bda..a098b9f 100644 --- a/ui/gfx/font_fallback_win_unittest.cc +++ b/ui/gfx/font_fallback_win_unittest.cc
@@ -36,8 +36,8 @@ private: // Needed to bypass DCHECK in GetFallbackFont. - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; DISALLOW_COPY_AND_ASSIGN(FontFallbackWinTest); }; @@ -125,8 +125,8 @@ private: // Needed to bypass DCHECK in GetFallbackFont. - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; DISALLOW_COPY_AND_ASSIGN(GetFallbackFontTest); };
diff --git a/ui/gfx/geometry/mojom/geometry_mojom_traits_unittest.cc b/ui/gfx/geometry/mojom/geometry_mojom_traits_unittest.cc index 363cf31..c1f0ee1 100644 --- a/ui/gfx/geometry/mojom/geometry_mojom_traits_unittest.cc +++ b/ui/gfx/geometry/mojom/geometry_mojom_traits_unittest.cc
@@ -84,7 +84,7 @@ std::move(callback).Run(q); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::BindingSet<GeometryTraitsTestService> traits_test_bindings_; DISALLOW_COPY_AND_ASSIGN(GeometryStructTraitsTest);
diff --git a/ui/gfx/image/mojom/image_traits_unittest.cc b/ui/gfx/image/mojom/image_traits_unittest.cc index 12172ce..b44340ae 100644 --- a/ui/gfx/image/mojom/image_traits_unittest.cc +++ b/ui/gfx/image/mojom/image_traits_unittest.cc
@@ -63,7 +63,7 @@ std::move(callback).Run(in); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::BindingSet<ImageTraitsTestService> bindings_; mojom::ImageTraitsTestServicePtr service_;
diff --git a/ui/gfx/mojom/mojom_traits_unittest.cc b/ui/gfx/mojom/mojom_traits_unittest.cc index ada3dca6..d1366f0 100644 --- a/ui/gfx/mojom/mojom_traits_unittest.cc +++ b/ui/gfx/mojom/mojom_traits_unittest.cc
@@ -64,7 +64,7 @@ std::move(callback).Run(r); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::BindingSet<TraitsTestService> traits_test_bindings_; DISALLOW_COPY_AND_ASSIGN(StructTraitsTest);
diff --git a/ui/gfx/range/mojom/range_mojom_traits_unittest.cc b/ui/gfx/range/mojom/range_mojom_traits_unittest.cc index c121711..e55fdf8 100644 --- a/ui/gfx/range/mojom/range_mojom_traits_unittest.cc +++ b/ui/gfx/range/mojom/range_mojom_traits_unittest.cc
@@ -35,7 +35,7 @@ std::move(callback).Run(p); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::BindingSet<RangeTraitsTestService> traits_test_bindings_; DISALLOW_COPY_AND_ASSIGN(RangeStructTraitsTest);
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc index 2dfd4fe..10605c7 100644 --- a/ui/gfx/render_text_harfbuzz.cc +++ b/ui/gfx/render_text_harfbuzz.cc
@@ -1061,10 +1061,15 @@ full_range.end() - context_start); text = full_text.substr(context_start, context_end - context_start); - // Pre-compute the hash to avoid having to re-hash text at every comparison. - // Attempt to minimize collisions by including the font and text in the - // hash. - hash = (uintptr_t)skia_face.get() ^ base::Hash(text); + // Pre-compute the hash to avoid having to re-hash at every comparison. + // Attempt to minimize collisions by including the typeface, script, font + // size, text and the text range. + hash = base::HashInts(hash, skia_face->uniqueID()); + hash = base::HashInts(hash, script); + hash = base::HashInts(hash, font_size); + hash = base::Hash(text); + hash = base::HashInts(hash, range.start()); + hash = base::HashInts(hash, range.length()); } bool operator==(const ShapeRunWithFontInput& other) const {
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc index 4158ce5..52f01fd 100644 --- a/ui/gfx/render_text_unittest.cc +++ b/ui/gfx/render_text_unittest.cc
@@ -362,8 +362,7 @@ class RenderTextTest : public testing::Test { public: RenderTextTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), render_text_(std::make_unique<RenderTextHarfBuzz>()), test_api_(new test::RenderTextTestApi(render_text_.get())), renderer_(canvas()) {} @@ -536,7 +535,7 @@ private: // Needed to bypass DCHECK in GetFallbackFont. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<RenderTextHarfBuzz> render_text_; std::unique_ptr<test::RenderTextTestApi> test_api_;
diff --git a/ui/gfx/text_elider_unittest.cc b/ui/gfx/text_elider_unittest.cc index 655c7d1..d2ad1ef 100644 --- a/ui/gfx/text_elider_unittest.cc +++ b/ui/gfx/text_elider_unittest.cc
@@ -294,8 +294,8 @@ TEST(TextEliderTest, ElideTextAtomicSequences) { #if defined(OS_WIN) // Needed to bypass DCHECK in GetFallbackFont. - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); #endif const FontList font_list; // The below is 'MUSICAL SYMBOL G CLEF' (U+1D11E), which is represented in
diff --git a/ui/gl/test/run_all_unittests.cc b/ui/gl/test/run_all_unittests.cc index 46bc39e..36444bc 100644 --- a/ui/gl/test/run_all_unittests.cc +++ b/ui/gl/test/run_all_unittests.cc
@@ -33,13 +33,12 @@ #if defined(OS_MACOSX) && !defined(OS_IOS) // This registers a custom NSApplication. It must be done before - // ScopedTaskEnvironment registers a regular NSApplication. + // TaskEnvironment registers a regular NSApplication. mock_cr_app::RegisterMockCrApp(); #endif - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + task_environment_ = std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::MainThreadType::UI); #if defined(USE_OZONE) // Make Ozone run in single-process mode, where it doesn't expect a GPU @@ -50,7 +49,7 @@ params.single_process = true; params.using_mojo = true; - // This initialization must be done after ScopedTaskEnvironment has + // This initialization must be done after TaskEnvironment has // initialized the UI thread. ui::OzonePlatform::InitializeForUI(params); #endif @@ -61,7 +60,7 @@ } private: - std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_; + std::unique_ptr<base::test::TaskEnvironment> task_environment_; DISALLOW_COPY_AND_ASSIGN(GlTestSuite); };
diff --git a/ui/latency/mojom/mojom_traits_unittest.cc b/ui/latency/mojom/mojom_traits_unittest.cc index 7d03368..7edc5f36 100644 --- a/ui/latency/mojom/mojom_traits_unittest.cc +++ b/ui/latency/mojom/mojom_traits_unittest.cc
@@ -32,7 +32,7 @@ std::move(callback).Run(info); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; mojo::BindingSet<TraitsTestService> traits_test_bindings_; DISALLOW_COPY_AND_ASSIGN(StructTraitsTest); };
diff --git a/ui/message_center/views/notification_header_view_unittest.cc b/ui/message_center/views/notification_header_view_unittest.cc index b11a61b..a0131db 100644 --- a/ui/message_center/views/notification_header_view_unittest.cc +++ b/ui/message_center/views/notification_header_view_unittest.cc
@@ -17,7 +17,7 @@ public: NotificationHeaderViewTest() : views::ViewsTestBase( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} ~NotificationHeaderViewTest() override = default; // ViewsTestBase: @@ -60,22 +60,22 @@ IDS_MESSAGE_NOTIFICATION_DURATION_HOURS_SHORTEST_FUTURE, 3), notification_header_view_->timestamp_for_testing()); - scoped_task_environment_->FastForwardBy(base::TimeDelta::FromHours(3)); - scoped_task_environment_->RunUntilIdle(); + task_environment_->FastForwardBy(base::TimeDelta::FromHours(3)); + task_environment_->RunUntilIdle(); EXPECT_EQ(l10n_util::GetPluralStringFUTF16( IDS_MESSAGE_NOTIFICATION_DURATION_MINUTES_SHORTEST_FUTURE, 30), notification_header_view_->timestamp_for_testing()); - scoped_task_environment_->FastForwardBy(base::TimeDelta::FromMinutes(30)); - scoped_task_environment_->RunUntilIdle(); + task_environment_->FastForwardBy(base::TimeDelta::FromMinutes(30)); + task_environment_->RunUntilIdle(); EXPECT_EQ( l10n_util::GetStringUTF16(IDS_MESSAGE_NOTIFICATION_NOW_STRING_SHORTEST), notification_header_view_->timestamp_for_testing()); - scoped_task_environment_->FastForwardBy(base::TimeDelta::FromDays(2)); - scoped_task_environment_->RunUntilIdle(); + task_environment_->FastForwardBy(base::TimeDelta::FromDays(2)); + task_environment_->RunUntilIdle(); EXPECT_EQ(l10n_util::GetPluralStringFUTF16( IDS_MESSAGE_NOTIFICATION_DURATION_DAYS_SHORTEST, 2),
diff --git a/ui/native_theme/native_theme_aura.cc b/ui/native_theme/native_theme_aura.cc index 6c1f6f7d..86732d3 100644 --- a/ui/native_theme/native_theme_aura.cc +++ b/ui/native_theme/native_theme_aura.cc
@@ -148,9 +148,22 @@ return s_native_theme_for_web.get(); } -// This implementation returns hardcoded colors. SkColor NativeThemeAura::GetSystemColor(ColorId color_id, ColorScheme color_scheme) const { + if (UsesHighContrastColors() && features::IsFormControlsRefreshEnabled() && + !system_colors_.empty()) { + switch (color_id) { + case kColorId_ButtonDisabledColor: + return system_colors_[SystemThemeColor::kGrayText]; + case kColorId_ButtonEnabledColor: + return system_colors_[SystemThemeColor::kButtonText]; + case kColorId_WindowBackground: + return system_colors_[SystemThemeColor::kWindow]; + default: + break; + } + } + return GetAuraColor(color_id, this, color_scheme); } @@ -406,10 +419,17 @@ cc::PaintFlags flags; flags.setAntiAlias(true); - if (state == kDisabled) { - flags.setColor(kCheckboxAndRadioStrokeDisabledColor); + if (UsesHighContrastColors()) { + ColorId color_id = (state == kDisabled) + ? NativeTheme::kColorId_ButtonDisabledColor + : NativeTheme::kColorId_ButtonEnabledColor; + flags.setColor(GetSystemColor(color_id, color_scheme)); } else { - flags.setColor(kCheckboxAndRadioStrokeColor); + if (state == kDisabled) { + flags.setColor(kCheckboxAndRadioStrokeDisabledColor); + } else { + flags.setColor(kCheckboxAndRadioStrokeColor); + } } if (button.indeterminate) { @@ -453,11 +473,20 @@ cc::PaintFlags flags; flags.setAntiAlias(true); flags.setStyle(cc::PaintFlags::kFill_Style); - if (state == kDisabled) { - flags.setColor(kCheckboxAndRadioStrokeDisabledColor); + + if (UsesHighContrastColors()) { + ColorId color_id = (state == kDisabled) + ? NativeTheme::kColorId_ButtonDisabledColor + : NativeTheme::kColorId_ButtonEnabledColor; + flags.setColor(GetSystemColor(color_id, color_scheme)); } else { - flags.setColor(kCheckboxAndRadioStrokeColor); + if (state == kDisabled) { + flags.setColor(kCheckboxAndRadioStrokeDisabledColor); + } else { + flags.setColor(kCheckboxAndRadioStrokeColor); + } } + skrect.inset(skrect.width() * 0.2, skrect.height() * 0.2); // Use drawRoundedRect instead of drawOval to be completely consistent // with the border in PaintCheckboxRadioNewCommon. @@ -489,7 +518,14 @@ // or underflow. if (skrect.width() <= 2) { cc::PaintFlags flags; - flags.setColor(kCheckboxAndRadioTinyColor); + + if (UsesHighContrastColors()) { + flags.setColor(GetSystemColor(NativeTheme::kColorId_ButtonEnabledColor, + color_scheme)); + } else { + flags.setColor(kCheckboxAndRadioTinyColor); + } + flags.setStyle(cc::PaintFlags::kFill_Style); canvas->drawRect(skrect, flags); // Too small to draw anything more. @@ -503,18 +539,33 @@ // Paint the background (is not visible behind the rounded corners). skrect.inset(borderWidth / 2, borderWidth / 2); - flags.setColor(kCkeckboxAndRadioBackgroundColor); + + if (UsesHighContrastColors()) { + flags.setColor( + GetSystemColor(NativeTheme::kColorId_WindowBackground, color_scheme)); + } else { + flags.setColor(kCkeckboxAndRadioBackgroundColor); + } + flags.setStyle(cc::PaintFlags::kFill_Style); canvas->drawRoundRect(skrect, borderRadius, borderRadius, flags); // Draw the border. - if (state == kHovered) { - flags.setColor(kCheckboxAndRadioBorderHoveredColor); - } else if (state == kDisabled) { - flags.setColor(kCheckboxAndRadioBorderDisabledColor); + if (UsesHighContrastColors()) { + ColorId color_id = (state == kDisabled) + ? NativeTheme::kColorId_ButtonDisabledColor + : NativeTheme::kColorId_ButtonEnabledColor; + flags.setColor(GetSystemColor(color_id, color_scheme)); } else { - flags.setColor(kCheckboxAndRadioBorderColor); + if (state == kHovered) { + flags.setColor(kCheckboxAndRadioBorderHoveredColor); + } else if (state == kDisabled) { + flags.setColor(kCheckboxAndRadioBorderDisabledColor); + } else { + flags.setColor(kCheckboxAndRadioBorderColor); + } } + flags.setStyle(cc::PaintFlags::kStroke_Style); flags.setStrokeWidth(borderWidth); canvas->drawRoundRect(skrect, borderRadius, borderRadius, flags);
diff --git a/ui/ozone/platform/drm/gpu/drm_overlay_validator_unittest.cc b/ui/ozone/platform/drm/gpu/drm_overlay_validator_unittest.cc index 97c5d14..edc0c880 100644 --- a/ui/ozone/platform/drm/gpu/drm_overlay_validator_unittest.cc +++ b/ui/ozone/platform/drm/gpu/drm_overlay_validator_unittest.cc
@@ -87,8 +87,8 @@ void InitializeDrmState(const std::vector<CrtcState>& crtc_states); - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; scoped_refptr<ui::MockDrmDevice> drm_; ui::MockGbmDevice* gbm_ = nullptr; std::unique_ptr<ui::ScreenManager> screen_manager_;
diff --git a/ui/ozone/platform/drm/gpu/drm_thread_unittest.cc b/ui/ozone/platform/drm/gpu/drm_thread_unittest.cc index a1e2611..3c2c087 100644 --- a/ui/ozone/platform/drm/gpu/drm_thread_unittest.cc +++ b/ui/ozone/platform/drm/gpu/drm_thread_unittest.cc
@@ -75,7 +75,7 @@ drm_device_ptr_->AddGraphicsDevice(file_path, std::move(file)); } - base::test::ScopedTaskEnvironment env_; + base::test::TaskEnvironment env_; DrmThread drm_thread_; ozone::mojom::DrmDevicePtr drm_device_ptr_; };
diff --git a/ui/ozone/platform/drm/gpu/drm_window_unittest.cc b/ui/ozone/platform/drm/gpu/drm_window_unittest.cc index 2a725b3..c93d2c4 100644 --- a/ui/ozone/platform/drm/gpu/drm_window_unittest.cc +++ b/ui/ozone/platform/drm/gpu/drm_window_unittest.cc
@@ -84,8 +84,8 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; scoped_refptr<ui::MockDrmDevice> drm_; std::unique_ptr<ui::ScreenManager> screen_manager_; std::unique_ptr<ui::DrmDeviceManager> drm_device_manager_;
diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_unittest.cc b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_unittest.cc index d9beab5..fe58d9f 100644 --- a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_unittest.cc +++ b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_unittest.cc
@@ -868,9 +868,9 @@ scoped_refptr<ui::MockDrmDevice> fake_drm_; std::unique_ptr<ui::HardwareDisplayPlaneManager> plane_manager_; bool callback_called = false; - base::test::ScopedTaskEnvironment task_env_{ - base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, - base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::QUEUED}; + base::test::TaskEnvironment task_env_{ + base::test::TaskEnvironment::MainThreadType::DEFAULT, + base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED}; scoped_refptr<ui::DrmFramebuffer> drm_framebuffer_; const FakeFenceFD fake_fence_fd1_; const FakeFenceFD fake_fence_fd2_;
diff --git a/ui/ozone/platform/drm/gpu/proxy_helpers_unittest.cc b/ui/ozone/platform/drm/gpu/proxy_helpers_unittest.cc index d8b077e..325f2e4 100644 --- a/ui/ozone/platform/drm/gpu/proxy_helpers_unittest.cc +++ b/ui/ozone/platform/drm/gpu/proxy_helpers_unittest.cc
@@ -32,7 +32,7 @@ void QuitFunction(int a) { EXPECT_TRUE(drm_checker_.CalledOnValidThread()); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( + task_environment_.GetMainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&ProxyHelpersTest::QuitFunctionCallback, base::Unretained(this), 8)); } @@ -42,8 +42,7 @@ EXPECT_TRUE(main_checker_.CalledOnValidThread()); auto quitter = run_loop_.QuitWhenIdleClosure(); - scoped_task_environment_.GetMainThreadTaskRunner()->PostTask(FROM_HERE, - quitter); + task_environment_.GetMainThreadTaskRunner()->PostTask(FROM_HERE, quitter); } void SetDrmChecker() { drm_checker_.DetachFromThread(); } @@ -91,7 +90,7 @@ protected: // Main thread message loop. - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; base::RunLoop run_loop_; // Thread to simulate the drm thread in ozone viz process.
diff --git a/ui/ozone/platform/wayland/host/wayland_connection_unittest.cc b/ui/ozone/platform/wayland/host/wayland_connection_unittest.cc index 61080566..983023c 100644 --- a/ui/ozone/platform/wayland/host/wayland_connection_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_connection_unittest.cc
@@ -18,8 +18,8 @@ } TEST(WaylandConnectionTest, UseUnstableVersion) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); wl::TestWaylandServerThread server; EXPECT_CALL(*server.xdg_shell(), UseUnstableVersion(XDG_SHELL_VERSION_CURRENT)); @@ -33,8 +33,8 @@ } TEST(WaylandConnectionTest, Ping) { - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); wl::TestWaylandServerThread server; ASSERT_TRUE(server.Start(kXdgVersion5)); WaylandConnection connection;
diff --git a/ui/ozone/platform/wayland/test/wayland_test.cc b/ui/ozone/platform/wayland/test/wayland_test.cc index 1da8b15..2df04017 100644 --- a/ui/ozone/platform/wayland/test/wayland_test.cc +++ b/ui/ozone/platform/wayland/test/wayland_test.cc
@@ -23,8 +23,7 @@ namespace ui { WaylandTest::WaylandTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) { + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) { #if BUILDFLAG(USE_XKBCOMMON) KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( std::make_unique<XkbKeyboardLayoutEngine>(xkb_evdev_code_converter_));
diff --git a/ui/ozone/platform/wayland/test/wayland_test.h b/ui/ozone/platform/wayland/test/wayland_test.h index 85a095df..e0e30ea 100644 --- a/ui/ozone/platform/wayland/test/wayland_test.h +++ b/ui/ozone/platform/wayland/test/wayland_test.h
@@ -46,7 +46,7 @@ void Sync(); protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; wl::TestWaylandServerThread server_; wl::MockSurface* surface_;
diff --git a/ui/ozone/platform/x11/x11_screen_ozone_unittest.cc b/ui/ozone/platform/x11/x11_screen_ozone_unittest.cc index ca45b913..694402d7b 100644 --- a/ui/ozone/platform/x11/x11_screen_ozone_unittest.cc +++ b/ui/ozone/platform/x11/x11_screen_ozone_unittest.cc
@@ -50,8 +50,8 @@ class X11ScreenOzoneTest : public testing::Test { public: X11ScreenOzoneTest() - : task_env_(std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::MainThreadType::UI)) {} + : task_env_(std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::MainThreadType::UI)) {} ~X11ScreenOzoneTest() override = default; void SetUp() override { @@ -114,7 +114,7 @@ std::unique_ptr<display::Display> primary_display_; std::unique_ptr<X11ScreenOzone> screen_; std::unique_ptr<X11EventSourceDefault> event_source_; - std::unique_ptr<base::test::ScopedTaskEnvironment> task_env_; + std::unique_ptr<base::test::TaskEnvironment> task_env_; DISALLOW_COPY_AND_ASSIGN(X11ScreenOzoneTest); };
diff --git a/ui/ozone/platform/x11/x11_window_ozone_unittest.cc b/ui/ozone/platform/x11/x11_window_ozone_unittest.cc index d2e19ef3..3018631 100644 --- a/ui/ozone/platform/x11/x11_window_ozone_unittest.cc +++ b/ui/ozone/platform/x11/x11_window_ozone_unittest.cc
@@ -40,8 +40,8 @@ class X11WindowOzoneTest : public testing::Test { public: X11WindowOzoneTest() - : task_env_(std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::MainThreadType::UI)) {} + : task_env_(std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::MainThreadType::UI)) {} ~X11WindowOzoneTest() override = default; @@ -79,7 +79,7 @@ } private: - std::unique_ptr<base::test::ScopedTaskEnvironment> task_env_; + std::unique_ptr<base::test::TaskEnvironment> task_env_; std::unique_ptr<X11WindowManagerOzone> window_manager_; std::unique_ptr<X11EventSourceDefault> event_source_;
diff --git a/ui/shell_dialogs/select_file_dialog_mac_unittest.mm b/ui/shell_dialogs/select_file_dialog_mac_unittest.mm index e3185db..41ce840c 100644 --- a/ui/shell_dialogs/select_file_dialog_mac_unittest.mm +++ b/ui/shell_dialogs/select_file_dialog_mac_unittest.mm
@@ -93,7 +93,7 @@ void* params) override {} protected: - base::test::ScopedTaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_; // Helper method to launch a dialog with the given |args|. void SelectFileWithParams(FileDialogArguments args) {
diff --git a/ui/shell_dialogs/select_file_dialog_win_unittest.cc b/ui/shell_dialogs/select_file_dialog_win_unittest.cc index 2f8d4f3..f7621b5 100644 --- a/ui/shell_dialogs/select_file_dialog_win_unittest.cc +++ b/ui/shell_dialogs/select_file_dialog_win_unittest.cc
@@ -147,7 +147,7 @@ void FileSelectionCanceled(void* params) override { was_cancelled_ = true; } // Runs the scheduler until no tasks are executing anymore. - void RunUntilIdle() { scoped_task_environment_.RunUntilIdle(); } + void RunUntilIdle() { task_environment_.RunUntilIdle(); } const std::vector<base::FilePath>& selected_paths() { return selected_paths_; @@ -169,7 +169,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::vector<base::FilePath> selected_paths_; bool was_cancelled_ = false;
diff --git a/ui/snapshot/snapshot_aura_unittest.cc b/ui/snapshot/snapshot_aura_unittest.cc index d7b9131..7f0f9a3 100644 --- a/ui/snapshot/snapshot_aura_unittest.cc +++ b/ui/snapshot/snapshot_aura_unittest.cc
@@ -99,9 +99,8 @@ void SetUp() override { testing::Test::SetUp(); - scoped_task_environment_ = - std::make_unique<base::test::ScopedTaskEnvironment>( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + task_environment_ = std::make_unique<base::test::TaskEnvironment>( + base::test::TaskEnvironment::MainThreadType::UI); // The ContextFactory must exist before any Compositors are created. // Snapshot test tests real drawing and readback, so needs pixel output. @@ -121,7 +120,7 @@ helper_->RunAllPendingInMessageLoop(); helper_->TearDown(); context_factories_.reset(); - scoped_task_environment_.reset(); + task_environment_.reset(); testing::Test::TearDown(); } @@ -182,7 +181,7 @@ bool completed_; }; - std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_; + std::unique_ptr<base::test::TaskEnvironment> task_environment_; std::unique_ptr<ui::TestContextFactories> context_factories_; std::unique_ptr<aura::test::AuraTestHelper> helper_; std::unique_ptr<aura::Window> test_window_;
diff --git a/ui/views/animation/bounds_animator_unittest.cc b/ui/views/animation/bounds_animator_unittest.cc index 896cf5c..f55ec5b 100644 --- a/ui/views/animation/bounds_animator_unittest.cc +++ b/ui/views/animation/bounds_animator_unittest.cc
@@ -77,8 +77,7 @@ class BoundsAnimatorTest : public testing::Test { public: BoundsAnimatorTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), child_(new TestView()), animator_(&parent_) { parent_.AddChildView(child_); @@ -90,7 +89,7 @@ BoundsAnimator* animator() { return &animator_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; TestView parent_; TestView* child_; // Owned by |parent_|. BoundsAnimator animator_;
diff --git a/ui/views/animation/installable_ink_drop_animator_unittest.cc b/ui/views/animation/installable_ink_drop_animator_unittest.cc index 09ab889e..3d86498 100644 --- a/ui/views/animation/installable_ink_drop_animator_unittest.cc +++ b/ui/views/animation/installable_ink_drop_animator_unittest.cc
@@ -32,7 +32,7 @@ &callback_called_)) {} protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; scoped_refptr<gfx::AnimationContainer> animation_container_; gfx::AnimationContainerTestApi animation_tester_;
diff --git a/ui/views/animation/installable_ink_drop_unittest.cc b/ui/views/animation/installable_ink_drop_unittest.cc index b6d27e2e..26dad7d 100644 --- a/ui/views/animation/installable_ink_drop_unittest.cc +++ b/ui/views/animation/installable_ink_drop_unittest.cc
@@ -27,7 +27,7 @@ View* root_view() { return &root_view_; } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; View root_view_; };
diff --git a/ui/views/cocoa/bridged_native_widget_unittest.mm b/ui/views/cocoa/bridged_native_widget_unittest.mm index ebe176a..4e0adda 100644 --- a/ui/views/cocoa/bridged_native_widget_unittest.mm +++ b/ui/views/cocoa/bridged_native_widget_unittest.mm
@@ -511,8 +511,8 @@ HandleKeyEventCallback handle_key_event_callback_; - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::MainThreadType::UI}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::MainThreadType::UI}; private: DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidgetTest);
diff --git a/ui/views/controls/menu/menu_closure_animation_mac_unittest.cc b/ui/views/controls/menu/menu_closure_animation_mac_unittest.cc index ef40b47..055bac6 100644 --- a/ui/views/controls/menu/menu_closure_animation_mac_unittest.cc +++ b/ui/views/controls/menu/menu_closure_animation_mac_unittest.cc
@@ -11,7 +11,7 @@ TEST(MenuClosureAnimationMacTest, DestructCancelsCleanly) { views::test::DisableMenuClosureAnimations(); - base::test::ScopedTaskEnvironment environment; + base::test::TaskEnvironment environment; bool called = false; auto animation = std::make_unique<views::MenuClosureAnimationMac>(
diff --git a/ui/views/controls/textfield/textfield_model.cc b/ui/views/controls/textfield/textfield_model.cc index 9a71347..7492eee 100644 --- a/ui/views/controls/textfield/textfield_model.cc +++ b/ui/views/controls/textfield/textfield_model.cc
@@ -669,7 +669,7 @@ } void TextfieldModel::SetCompositionFromExistingText(const gfx::Range& range) { - if (range.is_empty()) { + if (range.is_empty() || !gfx::Range(0, text().length()).Contains(range)) { ClearComposition(); return; }
diff --git a/ui/views/controls/textfield/textfield_model.h b/ui/views/controls/textfield/textfield_model.h index 19c77773..9efa1f3 100644 --- a/ui/views/controls/textfield/textfield_model.h +++ b/ui/views/controls/textfield/textfield_model.h
@@ -224,6 +224,8 @@ // Puts the text in the specified range into composition mode. // This method should not be called with composition text or an invalid range. + // The provided range is checked against the string's length, if |range| is + // out of bounds, the composition will be cleared. void SetCompositionFromExistingText(const gfx::Range& range); // Converts current composition text into final content.
diff --git a/ui/views/controls/textfield/textfield_model_unittest.cc b/ui/views/controls/textfield/textfield_model_unittest.cc index b3888b8..38174b5 100644 --- a/ui/views/controls/textfield/textfield_model_unittest.cc +++ b/ui/views/controls/textfield/textfield_model_unittest.cc
@@ -1978,4 +1978,16 @@ EXPECT_STR_EQ("abc", model.text()); } +TEST_F(TextfieldModelTest, SetCompositionFromExistingText_OutOfBounds) { + TextfieldModel model(nullptr); + model.SetText(base::string16()); + + model.SetCompositionFromExistingText(gfx::Range(0, 2)); + EXPECT_FALSE(model.HasCompositionText()); + + model.SetText(base::ASCIIToUTF16("abc")); + model.SetCompositionFromExistingText(gfx::Range(1, 4)); + EXPECT_FALSE(model.HasCompositionText()); +} + } // namespace views
diff --git a/ui/views/examples/examples_main.cc b/ui/views/examples/examples_main.cc index 65ba7c8..797ed8f 100644 --- a/ui/views/examples/examples_main.cc +++ b/ui/views/examples/examples_main.cc
@@ -79,7 +79,7 @@ gl::init::InitializeGLOneOff(); - // The use of base::test::ScopedTaskEnvironment below relies on the timeout + // The use of base::test::TaskEnvironment below relies on the timeout // values from TestTimeouts. This ensures they're properly initialized. TestTimeouts::Initialize(); @@ -93,8 +93,8 @@ &host_frame_sink_manager, &frame_sink_manager); context_factory->set_use_test_surface(false); - base::test::ScopedTaskEnvironment scoped_task_environment( - base::test::ScopedTaskEnvironment::MainThreadType::UI); + base::test::TaskEnvironment task_environment( + base::test::TaskEnvironment::MainThreadType::UI); base::i18n::InitializeICU();
diff --git a/ui/views/test/views_test_base.cc b/ui/views/test/views_test_base.cc index e5d1e81..f31b2e0 100644 --- a/ui/views/test/views_test_base.cc +++ b/ui/views/test/views_test_base.cc
@@ -65,7 +65,7 @@ ViewsTestBase::ViewsTestBase( ViewsTestBase::SubclassManagesTaskEnvironment /* tag */) - : scoped_task_environment_(base::nullopt) { + : task_environment_(base::nullopt) { // MaterialDesignController is initialized here instead of in SetUp because // a subclass might construct a MaterialDesignControllerTestAPI as a member to // override the value, and this must happen first.
diff --git a/ui/views/test/views_test_base.h b/ui/views/test/views_test_base.h index 69919a2..d0cf2735 100644 --- a/ui/views/test/views_test_base.h +++ b/ui/views/test/views_test_base.h
@@ -42,14 +42,13 @@ }; // Constructs a ViewsTestBase with |traits| being forwarded to its - // ScopedTaskEnvironment. MainThreadType always defaults to UI and must not be + // TaskEnvironment. MainThreadType always defaults to UI and must not be // specified. template <typename... TaskEnvironmentTraits> NOINLINE explicit ViewsTestBase(TaskEnvironmentTraits... traits) - : scoped_task_environment_( - base::in_place, - base::test::ScopedTaskEnvironment::MainThreadType::UI, - traits...) { + : task_environment_(base::in_place, + base::test::TaskEnvironment::MainThreadType::UI, + traits...) { // MaterialDesignController is initialized here instead of in SetUp because // a subclass might construct a MaterialDesignControllerTestAPI as a member // to override the value, and this must happen first. @@ -57,7 +56,7 @@ } // Alternatively a subclass may pass this tag to ask this ViewsTestBase not to - // instantiate a ScopedTaskEnvironment. The subclass is then responsible to + // instantiate a TaskEnvironment. The subclass is then responsible to // instantiate one before ViewsTestBase::SetUp(). struct SubclassManagesTaskEnvironment {}; explicit ViewsTestBase(SubclassManagesTaskEnvironment tag); @@ -126,7 +125,7 @@ protected: // Initialized first, destroyed last. Use this protected member directly from // the test body to drive tasks posted within a ViewsTestBase-based test. - base::Optional<base::test::ScopedTaskEnvironment> scoped_task_environment_; + base::Optional<base::test::TaskEnvironment> task_environment_; private: // Controls what type of widget will be created by default for a test (i.e.
diff --git a/ui/views/test/widget_test.h b/ui/views/test/widget_test.h index 81e0b5fa..d021ebcb 100644 --- a/ui/views/test/widget_test.h +++ b/ui/views/test/widget_test.h
@@ -46,7 +46,7 @@ using WidgetAutoclosePtr = std::unique_ptr<Widget, WidgetCloser>; // Constructs an AshTestBase with |traits| being forwarded to its - // ScopedTaskEnvironment. |ViewsTestBase::SubclassManagesTaskEnvironment()| + // TaskEnvironment. |ViewsTestBase::SubclassManagesTaskEnvironment()| // can also be passed as a sole trait to indicate that this WidgetTest's // subclass will manage the task environment. template <typename... TaskEnvironmentTraits>
diff --git a/url/mojom/url_gurl_mojom_traits_unittest.cc b/url/mojom/url_gurl_mojom_traits_unittest.cc index 1e44fc64..667578a6 100644 --- a/url/mojom/url_gurl_mojom_traits_unittest.cc +++ b/url/mojom/url_gurl_mojom_traits_unittest.cc
@@ -33,7 +33,7 @@ // Mojo version of chrome IPC test in url/ipc/url_param_traits_unittest.cc. TEST(MojoGURLStructTraitsTest, Basic) { - base::test::ScopedTaskEnvironment scoped_task_environment; + base::test::TaskEnvironment task_environment; mojom::UrlTestPtr proxy; UrlTestImpl impl(MakeRequest(&proxy));