OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/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 "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/common/chrome_content_client.h" | |
12 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
13 #include "components/autofill/content/browser/risk/proto/fingerprint.pb.h" | 12 #include "components/autofill/content/browser/risk/proto/fingerprint.pb.h" |
14 #include "content/public/browser/geolocation_provider.h" | 13 #include "content/public/browser/geolocation_provider.h" |
15 #include "content/public/browser/gpu_data_manager.h" | 14 #include "content/public/browser/gpu_data_manager.h" |
16 #include "content/public/common/geoposition.h" | 15 #include "content/public/common/geoposition.h" |
17 #include "content/public/test/test_utils.h" | 16 #include "content/public/test/test_utils.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "third_party/WebKit/public/platform/WebRect.h" | 19 #include "third_party/WebKit/public/platform/WebRect.h" |
21 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 20 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
(...skipping 10 matching lines...) Expand all Loading... |
32 void GetFingerprintInternal( | 31 void GetFingerprintInternal( |
33 uint64 obfuscated_gaia_id, | 32 uint64 obfuscated_gaia_id, |
34 const gfx::Rect& window_bounds, | 33 const gfx::Rect& window_bounds, |
35 const gfx::Rect& content_bounds, | 34 const gfx::Rect& content_bounds, |
36 const blink::WebScreenInfo& screen_info, | 35 const blink::WebScreenInfo& screen_info, |
37 const std::string& version, | 36 const std::string& version, |
38 const std::string& charset, | 37 const std::string& charset, |
39 const std::string& accept_languages, | 38 const std::string& accept_languages, |
40 const base::Time& install_time, | 39 const base::Time& install_time, |
41 const std::string& app_locale, | 40 const std::string& app_locale, |
42 const std::string& user_agent, | |
43 const base::TimeDelta& timeout, | 41 const base::TimeDelta& timeout, |
44 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback); | 42 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback); |
45 | 43 |
46 } // namespace internal | 44 } // namespace internal |
47 | 45 |
48 // Constants that are passed verbatim to the fingerprinter code and should be | 46 // Constants that are passed verbatim to the fingerprinter code and should be |
49 // serialized into the resulting protocol buffer. | 47 // serialized into the resulting protocol buffer. |
50 const uint64 kObfuscatedGaiaId = GG_UINT64_C(16571487432910023183); | 48 const uint64 kObfuscatedGaiaId = GG_UINT64_C(16571487432910023183); |
51 const char kCharset[] = "UTF-8"; | 49 const char kCharset[] = "UTF-8"; |
52 const char kAcceptLanguages[] = "en-US,en"; | 50 const char kAcceptLanguages[] = "en-US,en"; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 runner->Run(); | 191 runner->Run(); |
194 | 192 |
195 blink::WebScreenInfo screen_info; | 193 blink::WebScreenInfo screen_info; |
196 screen_info.depth = kScreenColorDepth; | 194 screen_info.depth = kScreenColorDepth; |
197 screen_info.rect = blink::WebRect(screen_bounds_); | 195 screen_info.rect = blink::WebRect(screen_bounds_); |
198 screen_info.availableRect = blink::WebRect(available_screen_bounds_); | 196 screen_info.availableRect = blink::WebRect(available_screen_bounds_); |
199 | 197 |
200 internal::GetFingerprintInternal( | 198 internal::GetFingerprintInternal( |
201 kObfuscatedGaiaId, window_bounds_, content_bounds_, screen_info, | 199 kObfuscatedGaiaId, window_bounds_, content_bounds_, screen_info, |
202 "25.0.0.123", kCharset, kAcceptLanguages, base::Time::Now(), | 200 "25.0.0.123", kCharset, kAcceptLanguages, base::Time::Now(), |
203 g_browser_process->GetApplicationLocale(), GetUserAgent(), | 201 g_browser_process->GetApplicationLocale(), |
204 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. |
205 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback, | 203 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback, |
206 base::Unretained(this))); | 204 base::Unretained(this))); |
207 | 205 |
208 // Wait for the callback to be called. | 206 // Wait for the callback to be called. |
209 message_loop_.Run(); | 207 message_loop_.Run(); |
210 } | 208 } |
211 | 209 |
212 } // namespace risk | 210 } // namespace risk |
213 } // namespace autofill | 211 } // namespace autofill |
OLD | NEW |