| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "components/autofill/content/browser/risk/proto/fingerprint.pb.h" | 15 #include "components/autofill/content/browser/risk/proto/fingerprint.pb.h" |
| 16 #include "content/public/browser/gpu_data_manager.h" | 16 #include "content/public/browser/gpu_data_manager.h" |
| 17 #include "content/public/common/screen_info.h" |
| 17 #include "content/public/test/content_browser_test.h" | 18 #include "content/public/test/content_browser_test.h" |
| 18 #include "content/public/test/test_utils.h" | 19 #include "content/public/test/test_utils.h" |
| 19 #include "device/geolocation/geolocation_provider.h" | 20 #include "device/geolocation/geolocation_provider.h" |
| 20 #include "device/geolocation/geoposition.h" | 21 #include "device/geolocation/geoposition.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include "third_party/WebKit/public/platform/WebRect.h" | 24 #include "third_party/WebKit/public/platform/WebRect.h" |
| 24 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | |
| 25 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
| 26 | 26 |
| 27 using testing::ElementsAre; | 27 using testing::ElementsAre; |
| 28 | 28 |
| 29 namespace autofill { | 29 namespace autofill { |
| 30 namespace risk { | 30 namespace risk { |
| 31 | 31 |
| 32 namespace internal { | 32 namespace internal { |
| 33 | 33 |
| 34 // Defined in the implementation file corresponding to this test. | 34 // Defined in the implementation file corresponding to this test. |
| 35 void GetFingerprintInternal( | 35 void GetFingerprintInternal( |
| 36 uint64_t obfuscated_gaia_id, | 36 uint64_t obfuscated_gaia_id, |
| 37 const gfx::Rect& window_bounds, | 37 const gfx::Rect& window_bounds, |
| 38 const gfx::Rect& content_bounds, | 38 const gfx::Rect& content_bounds, |
| 39 const blink::WebScreenInfo& screen_info, | 39 const content::ScreenInfo& screen_info, |
| 40 const std::string& version, | 40 const std::string& version, |
| 41 const std::string& charset, | 41 const std::string& charset, |
| 42 const std::string& accept_languages, | 42 const std::string& accept_languages, |
| 43 const base::Time& install_time, | 43 const base::Time& install_time, |
| 44 const std::string& app_locale, | 44 const std::string& app_locale, |
| 45 const std::string& user_agent, | 45 const std::string& user_agent, |
| 46 const base::TimeDelta& timeout, | 46 const base::TimeDelta& timeout, |
| 47 const base::Callback<void(std::unique_ptr<Fingerprint>)>& callback); | 47 const base::Callback<void(std::unique_ptr<Fingerprint>)>& callback); |
| 48 | 48 |
| 49 } // namespace internal | 49 } // namespace internal |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 position.latitude = kLatitude; | 191 position.latitude = kLatitude; |
| 192 position.longitude = kLongitude; | 192 position.longitude = kLongitude; |
| 193 position.altitude = kAltitude; | 193 position.altitude = kAltitude; |
| 194 position.accuracy = kAccuracy; | 194 position.accuracy = kAccuracy; |
| 195 position.timestamp = | 195 position.timestamp = |
| 196 base::Time::UnixEpoch() + | 196 base::Time::UnixEpoch() + |
| 197 base::TimeDelta::FromMilliseconds(kGeolocationTime); | 197 base::TimeDelta::FromMilliseconds(kGeolocationTime); |
| 198 device::GeolocationProvider::GetInstance()->OverrideLocationForTesting( | 198 device::GeolocationProvider::GetInstance()->OverrideLocationForTesting( |
| 199 position); | 199 position); |
| 200 | 200 |
| 201 blink::WebScreenInfo screen_info; | 201 content::ScreenInfo screen_info; |
| 202 screen_info.depth = kScreenColorDepth; | 202 screen_info.depth = kScreenColorDepth; |
| 203 screen_info.rect = blink::WebRect(screen_bounds_); | 203 screen_info.rect = screen_bounds_; |
| 204 screen_info.availableRect = blink::WebRect(available_screen_bounds_); | 204 screen_info.available_rect = available_screen_bounds_; |
| 205 | 205 |
| 206 internal::GetFingerprintInternal( | 206 internal::GetFingerprintInternal( |
| 207 kObfuscatedGaiaId, window_bounds_, content_bounds_, screen_info, | 207 kObfuscatedGaiaId, window_bounds_, content_bounds_, screen_info, |
| 208 "25.0.0.123", kCharset, kAcceptLanguages, base::Time::Now(), kLocale, | 208 "25.0.0.123", kCharset, kAcceptLanguages, base::Time::Now(), kLocale, |
| 209 kUserAgent, | 209 kUserAgent, |
| 210 base::TimeDelta::FromDays(1), // Ought to be longer than any test run. | 210 base::TimeDelta::FromDays(1), // Ought to be longer than any test run. |
| 211 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback, | 211 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback, |
| 212 base::Unretained(this))); | 212 base::Unretained(this))); |
| 213 | 213 |
| 214 // Wait for the callback to be called. | 214 // Wait for the callback to be called. |
| 215 base::RunLoop().Run(); | 215 base::RunLoop().Run(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 } // namespace risk | 218 } // namespace risk |
| 219 } // namespace autofill | 219 } // namespace autofill |
| OLD | NEW |