| OLD | NEW |
| 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 22 matching lines...) Expand all Loading... |
| 33 const int kGeolocationTime = 87; | 33 const int kGeolocationTime = 87; |
| 34 | 34 |
| 35 class AutofillRiskFingerprintTest : public InProcessBrowserTest { | 35 class AutofillRiskFingerprintTest : public InProcessBrowserTest { |
| 36 public: | 36 public: |
| 37 AutofillRiskFingerprintTest() | 37 AutofillRiskFingerprintTest() |
| 38 : kWindowBounds(2, 3, 5, 7), | 38 : kWindowBounds(2, 3, 5, 7), |
| 39 kContentBounds(11, 13, 17, 37), | 39 kContentBounds(11, 13, 17, 37), |
| 40 kScreenBounds(0, 0, 101, 71), | 40 kScreenBounds(0, 0, 101, 71), |
| 41 kAvailableScreenBounds(0, 11, 101, 60), | 41 kAvailableScreenBounds(0, 11, 101, 60), |
| 42 kUnavailableScreenBounds(0, 0, 101, 11), | 42 kUnavailableScreenBounds(0, 0, 101, 11), |
| 43 message_loop_(MessageLoop::TYPE_UI) {} | 43 message_loop_(base::MessageLoop::TYPE_UI) {} |
| 44 | 44 |
| 45 void GetFingerprintTestCallback(scoped_ptr<Fingerprint> fingerprint) { | 45 void GetFingerprintTestCallback(scoped_ptr<Fingerprint> fingerprint) { |
| 46 // Verify that all fields Chrome can fill have been filled. | 46 // Verify that all fields Chrome can fill have been filled. |
| 47 ASSERT_TRUE(fingerprint->has_machine_characteristics()); | 47 ASSERT_TRUE(fingerprint->has_machine_characteristics()); |
| 48 const Fingerprint_MachineCharacteristics& machine = | 48 const Fingerprint_MachineCharacteristics& machine = |
| 49 fingerprint->machine_characteristics(); | 49 fingerprint->machine_characteristics(); |
| 50 ASSERT_TRUE(machine.has_operating_system_build()); | 50 ASSERT_TRUE(machine.has_operating_system_build()); |
| 51 ASSERT_TRUE(machine.has_browser_install_time_hours()); | 51 ASSERT_TRUE(machine.has_browser_install_time_hours()); |
| 52 ASSERT_GT(machine.font_size(), 0); | 52 ASSERT_GT(machine.font_size(), 0); |
| 53 ASSERT_GT(machine.plugin_size(), 0); | 53 ASSERT_GT(machine.plugin_size(), 0); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 message_loop_.Quit(); | 132 message_loop_.Quit(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 protected: | 135 protected: |
| 136 const gfx::Rect kWindowBounds; | 136 const gfx::Rect kWindowBounds; |
| 137 const gfx::Rect kContentBounds; | 137 const gfx::Rect kContentBounds; |
| 138 const gfx::Rect kScreenBounds; | 138 const gfx::Rect kScreenBounds; |
| 139 const gfx::Rect kAvailableScreenBounds; | 139 const gfx::Rect kAvailableScreenBounds; |
| 140 const gfx::Rect kUnavailableScreenBounds; | 140 const gfx::Rect kUnavailableScreenBounds; |
| 141 MessageLoop message_loop_; | 141 base::MessageLoop message_loop_; |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 // This test is flaky on Windows. See http://crbug.com/178356. | 144 // This test is flaky on Windows. See http://crbug.com/178356. |
| 145 #if defined(OS_WIN) | 145 #if defined(OS_WIN) |
| 146 #define MAYBE_GetFingerprint DISABLED_GetFingerprint | 146 #define MAYBE_GetFingerprint DISABLED_GetFingerprint |
| 147 #else | 147 #else |
| 148 #define MAYBE_GetFingerprint GetFingerprint | 148 #define MAYBE_GetFingerprint GetFingerprint |
| 149 #endif | 149 #endif |
| 150 // Test that getting a fingerprint works on some basic level. | 150 // Test that getting a fingerprint works on some basic level. |
| 151 IN_PROC_BROWSER_TEST_F(AutofillRiskFingerprintTest, MAYBE_GetFingerprint) { | 151 IN_PROC_BROWSER_TEST_F(AutofillRiskFingerprintTest, MAYBE_GetFingerprint) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 174 DIALOG_TYPE_AUTOCHECKOUT, g_browser_process->GetApplicationLocale(), | 174 DIALOG_TYPE_AUTOCHECKOUT, g_browser_process->GetApplicationLocale(), |
| 175 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback, | 175 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback, |
| 176 base::Unretained(this))); | 176 base::Unretained(this))); |
| 177 | 177 |
| 178 // Wait for the callback to be called. | 178 // Wait for the callback to be called. |
| 179 message_loop_.Run(); | 179 message_loop_.Run(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace risk | 182 } // namespace risk |
| 183 } // namespace autofill | 183 } // namespace autofill |
| OLD | NEW |