Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: chrome/browser/autofill/risk/fingerprint_browsertest.cc

Issue 191093002: Simplify the user agent code some more since after r255534 it's not affected by the site's URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: patchset 15 which works Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « android_webview/native/aw_settings.cc ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "chrome/test/base/in_process_browser_test.h" 12 #include "chrome/test/base/in_process_browser_test.h"
12 #include "components/autofill/content/browser/risk/proto/fingerprint.pb.h" 13 #include "components/autofill/content/browser/risk/proto/fingerprint.pb.h"
13 #include "content/public/browser/geolocation_provider.h" 14 #include "content/public/browser/geolocation_provider.h"
14 #include "content/public/browser/gpu_data_manager.h" 15 #include "content/public/browser/gpu_data_manager.h"
15 #include "content/public/common/geoposition.h" 16 #include "content/public/common/geoposition.h"
16 #include "content/public/test/test_utils.h" 17 #include "content/public/test/test_utils.h"
17 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 #include "third_party/WebKit/public/platform/WebRect.h" 20 #include "third_party/WebKit/public/platform/WebRect.h"
20 #include "third_party/WebKit/public/platform/WebScreenInfo.h" 21 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
(...skipping 10 matching lines...) Expand all
31 void GetFingerprintInternal( 32 void GetFingerprintInternal(
32 uint64 obfuscated_gaia_id, 33 uint64 obfuscated_gaia_id,
33 const gfx::Rect& window_bounds, 34 const gfx::Rect& window_bounds,
34 const gfx::Rect& content_bounds, 35 const gfx::Rect& content_bounds,
35 const blink::WebScreenInfo& screen_info, 36 const blink::WebScreenInfo& screen_info,
36 const std::string& version, 37 const std::string& version,
37 const std::string& charset, 38 const std::string& charset,
38 const std::string& accept_languages, 39 const std::string& accept_languages,
39 const base::Time& install_time, 40 const base::Time& install_time,
40 const std::string& app_locale, 41 const std::string& app_locale,
42 const std::string& user_agent,
41 const base::TimeDelta& timeout, 43 const base::TimeDelta& timeout,
42 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback); 44 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback);
43 45
44 } // namespace internal 46 } // namespace internal
45 47
46 // Constants that are passed verbatim to the fingerprinter code and should be 48 // Constants that are passed verbatim to the fingerprinter code and should be
47 // serialized into the resulting protocol buffer. 49 // serialized into the resulting protocol buffer.
48 const uint64 kObfuscatedGaiaId = GG_UINT64_C(16571487432910023183); 50 const uint64 kObfuscatedGaiaId = GG_UINT64_C(16571487432910023183);
49 const char kCharset[] = "UTF-8"; 51 const char kCharset[] = "UTF-8";
50 const char kAcceptLanguages[] = "en-US,en"; 52 const char kAcceptLanguages[] = "en-US,en";
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 runner->Run(); 193 runner->Run();
192 194
193 blink::WebScreenInfo screen_info; 195 blink::WebScreenInfo screen_info;
194 screen_info.depth = kScreenColorDepth; 196 screen_info.depth = kScreenColorDepth;
195 screen_info.rect = blink::WebRect(screen_bounds_); 197 screen_info.rect = blink::WebRect(screen_bounds_);
196 screen_info.availableRect = blink::WebRect(available_screen_bounds_); 198 screen_info.availableRect = blink::WebRect(available_screen_bounds_);
197 199
198 internal::GetFingerprintInternal( 200 internal::GetFingerprintInternal(
199 kObfuscatedGaiaId, window_bounds_, content_bounds_, screen_info, 201 kObfuscatedGaiaId, window_bounds_, content_bounds_, screen_info,
200 "25.0.0.123", kCharset, kAcceptLanguages, base::Time::Now(), 202 "25.0.0.123", kCharset, kAcceptLanguages, base::Time::Now(),
201 g_browser_process->GetApplicationLocale(), 203 g_browser_process->GetApplicationLocale(), GetUserAgent(),
202 base::TimeDelta::FromDays(1), // Ought to be longer than any test run. 204 base::TimeDelta::FromDays(1), // Ought to be longer than any test run.
203 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback, 205 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback,
204 base::Unretained(this))); 206 base::Unretained(this)));
205 207
206 // Wait for the callback to be called. 208 // Wait for the callback to be called.
207 message_loop_.Run(); 209 message_loop_.Run();
208 } 210 }
209 211
210 } // namespace risk 212 } // namespace risk
211 } // namespace autofill 213 } // namespace autofill
OLDNEW
« no previous file with comments | « android_webview/native/aw_settings.cc ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698