OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/content/browser/risk/fingerprint.h" | 5 #include "components/autofill/content/browser/risk/fingerprint.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/port.h" | 9 #include "base/port.h" |
10 #include "components/autofill/content/browser/risk/proto/fingerprint.pb.h" | 10 #include "components/autofill/content/browser/risk/proto/fingerprint.pb.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // Test that getting a fingerprint works on some basic level. | 180 // Test that getting a fingerprint works on some basic level. |
181 IN_PROC_BROWSER_TEST_F(AutofillRiskFingerprintTest, GetFingerprint) { | 181 IN_PROC_BROWSER_TEST_F(AutofillRiskFingerprintTest, GetFingerprint) { |
182 content::Geoposition position; | 182 content::Geoposition position; |
183 position.latitude = kLatitude; | 183 position.latitude = kLatitude; |
184 position.longitude = kLongitude; | 184 position.longitude = kLongitude; |
185 position.altitude = kAltitude; | 185 position.altitude = kAltitude; |
186 position.accuracy = kAccuracy; | 186 position.accuracy = kAccuracy; |
187 position.timestamp = | 187 position.timestamp = |
188 base::Time::UnixEpoch() + | 188 base::Time::UnixEpoch() + |
189 base::TimeDelta::FromMilliseconds(kGeolocationTime); | 189 base::TimeDelta::FromMilliseconds(kGeolocationTime); |
190 scoped_refptr<content::MessageLoopRunner> runner = | 190 content::GeolocationProvider::GetInstance()->OverrideLocationForTesting( |
191 new content::MessageLoopRunner; | 191 position); |
192 content::GeolocationProvider::OverrideLocationForTesting( | |
193 position, runner->QuitClosure()); | |
194 runner->Run(); | |
195 | 192 |
196 blink::WebScreenInfo screen_info; | 193 blink::WebScreenInfo screen_info; |
197 screen_info.depth = kScreenColorDepth; | 194 screen_info.depth = kScreenColorDepth; |
198 screen_info.rect = blink::WebRect(screen_bounds_); | 195 screen_info.rect = blink::WebRect(screen_bounds_); |
199 screen_info.availableRect = blink::WebRect(available_screen_bounds_); | 196 screen_info.availableRect = blink::WebRect(available_screen_bounds_); |
200 | 197 |
201 internal::GetFingerprintInternal( | 198 internal::GetFingerprintInternal( |
202 kObfuscatedGaiaId, window_bounds_, content_bounds_, screen_info, | 199 kObfuscatedGaiaId, window_bounds_, content_bounds_, screen_info, |
203 "25.0.0.123", kCharset, kAcceptLanguages, base::Time::Now(), kLocale, | 200 "25.0.0.123", kCharset, kAcceptLanguages, base::Time::Now(), kLocale, |
204 kUserAgent, | 201 kUserAgent, |
205 base::TimeDelta::FromDays(1), // Ought to be longer than any test run. | 202 base::TimeDelta::FromDays(1), // Ought to be longer than any test run. |
206 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback, | 203 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback, |
207 base::Unretained(this))); | 204 base::Unretained(this))); |
208 | 205 |
209 // Wait for the callback to be called. | 206 // Wait for the callback to be called. |
210 message_loop_.Run(); | 207 message_loop_.Run(); |
211 } | 208 } |
212 | 209 |
213 } // namespace risk | 210 } // namespace risk |
214 } // namespace autofill | 211 } // namespace autofill |
OLD | NEW |