Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: components/autofill/content/browser/risk/fingerprint_browsertest.cc

Issue 2846723005: Use ScopedTaskEnvironment instead of MessageLoopForUI in components tests. (Closed)
Patch Set: self-review Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/content/browser/risk/fingerprint_browsertest.cc
diff --git a/components/autofill/content/browser/risk/fingerprint_browsertest.cc b/components/autofill/content/browser/risk/fingerprint_browsertest.cc
index 302599f70cfff5e2d729ecb8f7f9f4c59250d438..692bc5e970a5803bc123a90839e95d5204b47af8 100644
--- a/components/autofill/content/browser/risk/fingerprint_browsertest.cc
+++ b/components/autofill/content/browser/risk/fingerprint_browsertest.cc
@@ -11,6 +11,7 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
+#include "base/test/scoped_task_environment.h"
#include "build/build_config.h"
#include "components/autofill/content/browser/risk/proto/fingerprint.pb.h"
#include "content/public/browser/gpu_data_manager.h"
@@ -68,7 +69,9 @@ const int kGeolocationTime = 87;
class AutofillRiskFingerprintTest : public content::ContentBrowserTest {
public:
AutofillRiskFingerprintTest()
- : window_bounds_(2, 3, 5, 7),
+ : scoped_task_environment_(
+ base::test::ScopedTaskEnvironment::MainThreadType::UI),
+ window_bounds_(2, 3, 5, 7),
content_bounds_(11, 13, 17, 37),
screen_bounds_(0, 0, 101, 71),
available_screen_bounds_(0, 11, 101, 60),
@@ -167,10 +170,12 @@ class AutofillRiskFingerprintTest : public content::ContentBrowserTest {
EXPECT_EQ(kAccuracy, location.accuracy());
EXPECT_EQ(kGeolocationTime, location.time_in_ms());
- message_loop_.QuitWhenIdle();
+ base::MessageLoop::current()->QuitWhenIdle();
sdefresne 2017/04/28 10:00:23 Shouldn't this use base::RunLoop().RunUntilIdle()?
fdoray 2017/05/01 17:16:50 Removed this file from this CL since it requires n
}
protected:
+ base::test::ScopedTaskEnvironment scoped_task_environment_;
+
// Constants defining bounds in the screen coordinate system that are passed
// verbatim to the fingerprinter code and should be serialized into the
// resulting protocol buffer. Declared as class members because gfx::Rect is
@@ -180,9 +185,6 @@ class AutofillRiskFingerprintTest : public content::ContentBrowserTest {
const gfx::Rect screen_bounds_;
const gfx::Rect available_screen_bounds_;
const gfx::Rect unavailable_screen_bounds_;
-
- // A message loop to block on the asynchronous loading of the fingerprint.
- base::MessageLoopForUI message_loop_;
};
// Test that getting a fingerprint works on some basic level.

Powered by Google App Engine
This is Rietveld 408576698