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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // Defined in the implementation file corresponding to this test. | 29 // Defined in the implementation file corresponding to this test. |
30 void GetFingerprintInternal( | 30 void GetFingerprintInternal( |
31 uint64 obfuscated_gaia_id, | 31 uint64 obfuscated_gaia_id, |
32 const gfx::Rect& window_bounds, | 32 const gfx::Rect& window_bounds, |
33 const gfx::Rect& content_bounds, | 33 const gfx::Rect& content_bounds, |
34 const WebKit::WebScreenInfo& screen_info, | 34 const WebKit::WebScreenInfo& screen_info, |
35 const std::string& version, | 35 const std::string& version, |
36 const std::string& charset, | 36 const std::string& charset, |
37 const std::string& accept_languages, | 37 const std::string& accept_languages, |
38 const base::Time& install_time, | 38 const base::Time& install_time, |
39 DialogType dialog_type, | |
40 const std::string& app_locale, | 39 const std::string& app_locale, |
41 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback); | 40 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback); |
42 | 41 |
43 } // namespace internal | 42 } // namespace internal |
44 | 43 |
45 // Constants that are passed verbatim to the fingerprinter code and should be | 44 // Constants that are passed verbatim to the fingerprinter code and should be |
46 // serialized into the resulting protocol buffer. | 45 // serialized into the resulting protocol buffer. |
47 const uint64 kObfuscatedGaiaId = GG_UINT64_C(16571487432910023183); | 46 const uint64 kObfuscatedGaiaId = GG_UINT64_C(16571487432910023183); |
48 const char kCharset[] = "UTF-8"; | 47 const char kCharset[] = "UTF-8"; |
49 const char kAcceptLanguages[] = "en-US,en"; | 48 const char kAcceptLanguages[] = "en-US,en"; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 EXPECT_TRUE(fingerprint->metadata().has_fingerprinter_version()); | 126 EXPECT_TRUE(fingerprint->metadata().has_fingerprinter_version()); |
128 | 127 |
129 // Some values have exact known (mocked out) values: | 128 // Some values have exact known (mocked out) values: |
130 EXPECT_THAT(machine.requested_language(), ElementsAre("en-US", "en")); | 129 EXPECT_THAT(machine.requested_language(), ElementsAre("en-US", "en")); |
131 EXPECT_EQ(kCharset, machine.charset()); | 130 EXPECT_EQ(kCharset, machine.charset()); |
132 EXPECT_EQ(kScreenColorDepth, machine.screen_color_depth()); | 131 EXPECT_EQ(kScreenColorDepth, machine.screen_color_depth()); |
133 EXPECT_EQ(unavailable_screen_bounds_.width(), | 132 EXPECT_EQ(unavailable_screen_bounds_.width(), |
134 machine.unavailable_screen_size().width()); | 133 machine.unavailable_screen_size().width()); |
135 EXPECT_EQ(unavailable_screen_bounds_.height(), | 134 EXPECT_EQ(unavailable_screen_bounds_.height(), |
136 machine.unavailable_screen_size().height()); | 135 machine.unavailable_screen_size().height()); |
137 EXPECT_EQ(Fingerprint::MachineCharacteristics::FEATURE_AUTOCHECKOUT, | 136 EXPECT_EQ(Fingerprint::MachineCharacteristics::FEATURE_REQUEST_AUTOCOMPLETE, |
138 machine.browser_feature()); | 137 machine.browser_feature()); |
139 EXPECT_EQ(content_bounds_.width(), | 138 EXPECT_EQ(content_bounds_.width(), |
140 transient_state.inner_window_size().width()); | 139 transient_state.inner_window_size().width()); |
141 EXPECT_EQ(content_bounds_.height(), | 140 EXPECT_EQ(content_bounds_.height(), |
142 transient_state.inner_window_size().height()); | 141 transient_state.inner_window_size().height()); |
143 EXPECT_EQ(window_bounds_.width(), | 142 EXPECT_EQ(window_bounds_.width(), |
144 transient_state.outer_window_size().width()); | 143 transient_state.outer_window_size().width()); |
145 EXPECT_EQ(window_bounds_.height(), | 144 EXPECT_EQ(window_bounds_.height(), |
146 transient_state.outer_window_size().height()); | 145 transient_state.outer_window_size().height()); |
147 EXPECT_EQ(kObfuscatedGaiaId, fingerprint->metadata().obfuscated_gaia_id()); | 146 EXPECT_EQ(kObfuscatedGaiaId, fingerprint->metadata().obfuscated_gaia_id()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 runner->Run(); | 185 runner->Run(); |
187 | 186 |
188 WebKit::WebScreenInfo screen_info; | 187 WebKit::WebScreenInfo screen_info; |
189 screen_info.depth = kScreenColorDepth; | 188 screen_info.depth = kScreenColorDepth; |
190 screen_info.rect = WebKit::WebRect(screen_bounds_); | 189 screen_info.rect = WebKit::WebRect(screen_bounds_); |
191 screen_info.availableRect = WebKit::WebRect(available_screen_bounds_); | 190 screen_info.availableRect = WebKit::WebRect(available_screen_bounds_); |
192 | 191 |
193 internal::GetFingerprintInternal( | 192 internal::GetFingerprintInternal( |
194 kObfuscatedGaiaId, window_bounds_, content_bounds_, screen_info, | 193 kObfuscatedGaiaId, window_bounds_, content_bounds_, screen_info, |
195 "25.0.0.123", kCharset, kAcceptLanguages, base::Time::Now(), | 194 "25.0.0.123", kCharset, kAcceptLanguages, base::Time::Now(), |
196 DIALOG_TYPE_AUTOCHECKOUT, g_browser_process->GetApplicationLocale(), | 195 g_browser_process->GetApplicationLocale(), |
197 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback, | 196 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback, |
198 base::Unretained(this))); | 197 base::Unretained(this))); |
199 | 198 |
200 // Wait for the callback to be called. | 199 // Wait for the callback to be called. |
201 message_loop_.Run(); | 200 message_loop_.Run(); |
202 } | 201 } |
203 | 202 |
204 } // namespace risk | 203 } // namespace risk |
205 } // namespace autofill | 204 } // namespace autofill |
OLD | NEW |