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

Side by Side Diff: components/autofill/content/browser/risk/fingerprint_browsertest.cc

Issue 1859453002: components/autofill: scoped_ptr -> unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed Created 4 years, 8 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
OLDNEW
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>
10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
11 #include "build/build_config.h" 13 #include "build/build_config.h"
12 #include "components/autofill/content/browser/risk/proto/fingerprint.pb.h" 14 #include "components/autofill/content/browser/risk/proto/fingerprint.pb.h"
13 #include "content/public/browser/geolocation_provider.h" 15 #include "content/public/browser/geolocation_provider.h"
14 #include "content/public/browser/gpu_data_manager.h" 16 #include "content/public/browser/gpu_data_manager.h"
15 #include "content/public/common/geoposition.h" 17 #include "content/public/common/geoposition.h"
16 #include "content/public/test/content_browser_test.h" 18 #include "content/public/test/content_browser_test.h"
17 #include "content/public/test/test_utils.h" 19 #include "content/public/test/test_utils.h"
18 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 15 matching lines...) Expand all
34 const gfx::Rect& window_bounds, 36 const gfx::Rect& window_bounds,
35 const gfx::Rect& content_bounds, 37 const gfx::Rect& content_bounds,
36 const blink::WebScreenInfo& screen_info, 38 const blink::WebScreenInfo& screen_info,
37 const std::string& version, 39 const std::string& version,
38 const std::string& charset, 40 const std::string& charset,
39 const std::string& accept_languages, 41 const std::string& accept_languages,
40 const base::Time& install_time, 42 const base::Time& install_time,
41 const std::string& app_locale, 43 const std::string& app_locale,
42 const std::string& user_agent, 44 const std::string& user_agent,
43 const base::TimeDelta& timeout, 45 const base::TimeDelta& timeout,
44 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback); 46 const base::Callback<void(std::unique_ptr<Fingerprint>)>& callback);
45 47
46 } // namespace internal 48 } // namespace internal
47 49
48 // Constants that are passed verbatim to the fingerprinter code and should be 50 // Constants that are passed verbatim to the fingerprinter code and should be
49 // serialized into the resulting protocol buffer. 51 // serialized into the resulting protocol buffer.
50 const uint64_t kObfuscatedGaiaId = UINT64_C(16571487432910023183); 52 const uint64_t kObfuscatedGaiaId = UINT64_C(16571487432910023183);
51 const char kCharset[] = "UTF-8"; 53 const char kCharset[] = "UTF-8";
52 const char kAcceptLanguages[] = "en-US,en"; 54 const char kAcceptLanguages[] = "en-US,en";
53 const int kScreenColorDepth = 53; 55 const int kScreenColorDepth = 53;
54 const char kLocale[] = "en-GB"; 56 const char kLocale[] = "en-GB";
55 const char kUserAgent[] = "TestUserAgent"; 57 const char kUserAgent[] = "TestUserAgent";
56 58
57 // Geolocation constants that are passed verbatim to the fingerprinter code and 59 // Geolocation constants that are passed verbatim to the fingerprinter code and
58 // should be serialized into the resulting protocol buffer. 60 // should be serialized into the resulting protocol buffer.
59 const double kLatitude = -42.0; 61 const double kLatitude = -42.0;
60 const double kLongitude = 17.3; 62 const double kLongitude = 17.3;
61 const double kAltitude = 123.4; 63 const double kAltitude = 123.4;
62 const double kAccuracy = 73.7; 64 const double kAccuracy = 73.7;
63 const int kGeolocationTime = 87; 65 const int kGeolocationTime = 87;
64 66
65 class AutofillRiskFingerprintTest : public content::ContentBrowserTest { 67 class AutofillRiskFingerprintTest : public content::ContentBrowserTest {
66 public: 68 public:
67 AutofillRiskFingerprintTest() 69 AutofillRiskFingerprintTest()
68 : window_bounds_(2, 3, 5, 7), 70 : window_bounds_(2, 3, 5, 7),
69 content_bounds_(11, 13, 17, 37), 71 content_bounds_(11, 13, 17, 37),
70 screen_bounds_(0, 0, 101, 71), 72 screen_bounds_(0, 0, 101, 71),
71 available_screen_bounds_(0, 11, 101, 60), 73 available_screen_bounds_(0, 11, 101, 60),
72 unavailable_screen_bounds_(0, 0, 101, 11) {} 74 unavailable_screen_bounds_(0, 0, 101, 11) {}
73 75
74 void GetFingerprintTestCallback(scoped_ptr<Fingerprint> fingerprint) { 76 void GetFingerprintTestCallback(std::unique_ptr<Fingerprint> fingerprint) {
75 // Verify that all fields Chrome can fill have been filled. 77 // Verify that all fields Chrome can fill have been filled.
76 ASSERT_TRUE(fingerprint->has_machine_characteristics()); 78 ASSERT_TRUE(fingerprint->has_machine_characteristics());
77 const Fingerprint::MachineCharacteristics& machine = 79 const Fingerprint::MachineCharacteristics& machine =
78 fingerprint->machine_characteristics(); 80 fingerprint->machine_characteristics();
79 EXPECT_TRUE(machine.has_operating_system_build()); 81 EXPECT_TRUE(machine.has_operating_system_build());
80 EXPECT_TRUE(machine.has_browser_install_time_hours()); 82 EXPECT_TRUE(machine.has_browser_install_time_hours());
81 EXPECT_GT(machine.font_size(), 0); 83 EXPECT_GT(machine.font_size(), 0);
82 84
83 // TODO(isherman): http://crbug.com/358548 and EXPECT_EQ. 85 // TODO(isherman): http://crbug.com/358548 and EXPECT_EQ.
84 EXPECT_GE(machine.plugin_size(), 0); 86 EXPECT_GE(machine.plugin_size(), 0);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 base::TimeDelta::FromDays(1), // Ought to be longer than any test run. 216 base::TimeDelta::FromDays(1), // Ought to be longer than any test run.
215 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback, 217 base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback,
216 base::Unretained(this))); 218 base::Unretained(this)));
217 219
218 // Wait for the callback to be called. 220 // Wait for the callback to be called.
219 message_loop_.Run(); 221 message_loop_.Run();
220 } 222 }
221 223
222 } // namespace risk 224 } // namespace risk
223 } // namespace autofill 225 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/browser/risk/fingerprint.cc ('k') | components/autofill/content/browser/wallet/full_wallet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698