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

Side by Side Diff: chrome/browser/autofill/risk/fingerprint_browsertest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/browser/risk/fingerprint.h" 5 #include "components/autofill/browser/risk/fingerprint.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/port.h" 9 #include "base/port.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 13 matching lines...) Expand all
24 const int kScreenColorDepth = 53; 24 const int kScreenColorDepth = 53;
25 25
26 class AutofillRiskFingerprintTest : public InProcessBrowserTest { 26 class AutofillRiskFingerprintTest : public InProcessBrowserTest {
27 public: 27 public:
28 AutofillRiskFingerprintTest() 28 AutofillRiskFingerprintTest()
29 : kWindowBounds(2, 3, 5, 7), 29 : kWindowBounds(2, 3, 5, 7),
30 kContentBounds(11, 13, 17, 37), 30 kContentBounds(11, 13, 17, 37),
31 kScreenBounds(0, 0, 101, 71), 31 kScreenBounds(0, 0, 101, 71),
32 kAvailableScreenBounds(0, 11, 101, 60), 32 kAvailableScreenBounds(0, 11, 101, 60),
33 kUnavailableScreenBounds(0, 0, 101, 11), 33 kUnavailableScreenBounds(0, 0, 101, 11),
34 message_loop_(MessageLoop::TYPE_UI) {} 34 message_loop_(base::MessageLoop::TYPE_UI) {}
35 35
36 void GetFingerprintTestCallback(scoped_ptr<Fingerprint> fingerprint) { 36 void GetFingerprintTestCallback(scoped_ptr<Fingerprint> fingerprint) {
37 // Verify that all fields Chrome can fill have been filled. 37 // Verify that all fields Chrome can fill have been filled.
38 ASSERT_TRUE(fingerprint->has_machine_characteristics()); 38 ASSERT_TRUE(fingerprint->has_machine_characteristics());
39 const Fingerprint_MachineCharacteristics& machine = 39 const Fingerprint_MachineCharacteristics& machine =
40 fingerprint->machine_characteristics(); 40 fingerprint->machine_characteristics();
41 ASSERT_TRUE(machine.has_operating_system_build()); 41 ASSERT_TRUE(machine.has_operating_system_build());
42 ASSERT_TRUE(machine.has_browser_install_time_hours()); 42 ASSERT_TRUE(machine.has_browser_install_time_hours());
43 ASSERT_GT(machine.font_size(), 0); 43 ASSERT_GT(machine.font_size(), 0);
44 ASSERT_GT(machine.plugin_size(), 0); 44 ASSERT_GT(machine.plugin_size(), 0);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 message_loop_.Quit(); 106 message_loop_.Quit();
107 } 107 }
108 108
109 protected: 109 protected:
110 const gfx::Rect kWindowBounds; 110 const gfx::Rect kWindowBounds;
111 const gfx::Rect kContentBounds; 111 const gfx::Rect kContentBounds;
112 const gfx::Rect kScreenBounds; 112 const gfx::Rect kScreenBounds;
113 const gfx::Rect kAvailableScreenBounds; 113 const gfx::Rect kAvailableScreenBounds;
114 const gfx::Rect kUnavailableScreenBounds; 114 const gfx::Rect kUnavailableScreenBounds;
115 MessageLoop message_loop_; 115 base::MessageLoop message_loop_;
116 }; 116 };
117 117
118 // This test is flaky on Windows. See http://crbug.com/178356. 118 // This test is flaky on Windows. See http://crbug.com/178356.
119 #if defined(OS_WIN) 119 #if defined(OS_WIN)
120 #define MAYBE_GetFingerprint DISABLED_GetFingerprint 120 #define MAYBE_GetFingerprint DISABLED_GetFingerprint
121 #else 121 #else
122 #define MAYBE_GetFingerprint GetFingerprint 122 #define MAYBE_GetFingerprint GetFingerprint
123 #endif 123 #endif
124 // Test that getting a fingerprint works on some basic level. 124 // Test that getting a fingerprint works on some basic level.
125 IN_PROC_BROWSER_TEST_F(AutofillRiskFingerprintTest, MAYBE_GetFingerprint) { 125 IN_PROC_BROWSER_TEST_F(AutofillRiskFingerprintTest, MAYBE_GetFingerprint) {
126 WebKit::WebScreenInfo screen_info; 126 WebKit::WebScreenInfo screen_info;
127 screen_info.depth = kScreenColorDepth; 127 screen_info.depth = kScreenColorDepth;
128 screen_info.rect = WebKit::WebRect(kScreenBounds); 128 screen_info.rect = WebKit::WebRect(kScreenBounds);
129 screen_info.availableRect = WebKit::WebRect(kAvailableScreenBounds); 129 screen_info.availableRect = WebKit::WebRect(kAvailableScreenBounds);
130 130
131 internal::GetFingerprintInternal( 131 internal::GetFingerprintInternal(
132 kGaiaId, kWindowBounds, kContentBounds, screen_info, "25.0.0.123", 132 kGaiaId, kWindowBounds, kContentBounds, screen_info, "25.0.0.123",
133 kCharset, kAcceptLanguages, base::Time::Now(), DIALOG_TYPE_AUTOCHECKOUT, 133 kCharset, kAcceptLanguages, base::Time::Now(), DIALOG_TYPE_AUTOCHECKOUT,
134 g_browser_process->GetApplicationLocale(), 134 g_browser_process->GetApplicationLocale(),
135 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback, 135 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback,
136 base::Unretained(this))); 136 base::Unretained(this)));
137 137
138 // Wait for the callback to be called. 138 // Wait for the callback to be called.
139 message_loop_.Run(); 139 message_loop_.Run();
140 } 140 }
141 141
142 } // namespace risk 142 } // namespace risk
143 } // namespace autofill 143 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698