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

Unified Diff: chrome/browser/autofill/risk/fingerprint_browsertest.cc

Issue 14619006: [Autofill] Add geolocation data to Risk fingerprint. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't use high accuracy for now Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/autofill/browser/risk/fingerprint.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/risk/fingerprint_browsertest.cc
diff --git a/chrome/browser/autofill/risk/fingerprint_browsertest.cc b/chrome/browser/autofill/risk/fingerprint_browsertest.cc
index 5394ea7b89091cace148ef4accbac43e11a3e80a..fa64cf65e3da1a10543ff7a238f1f5594cf36591 100644
--- a/chrome/browser/autofill/risk/fingerprint_browsertest.cc
+++ b/chrome/browser/autofill/risk/fingerprint_browsertest.cc
@@ -10,6 +10,9 @@
#include "chrome/browser/browser_process.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "components/autofill/browser/risk/proto/fingerprint.pb.h"
+#include "content/public/browser/geolocation_provider.h"
+#include "content/public/common/geoposition.h"
+#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebScreenInfo.h"
@@ -23,6 +26,12 @@ const char kCharset[] = "UTF-8";
const char kAcceptLanguages[] = "en-US,en";
const int kScreenColorDepth = 53;
+const double kLatitude = -42.0;
+const double kLongitude = 17.3;
+const double kAltitude = 123.4;
+const double kAccuracy = 73.7;
+const int kGeolocationTime = 87;
+
class AutofillRiskFingerprintTest : public InProcessBrowserTest {
public:
AutofillRiskFingerprintTest()
@@ -75,6 +84,18 @@ class AutofillRiskFingerprintTest : public InProcessBrowserTest {
ASSERT_TRUE(transient_state.outer_window_size().has_width());
ASSERT_TRUE(transient_state.outer_window_size().has_height());
+ ASSERT_TRUE(fingerprint->has_user_characteristics());
+ const Fingerprint_UserCharacteristics& user_characteristics =
+ fingerprint->user_characteristics();
+ ASSERT_TRUE(user_characteristics.has_location());
+ const Fingerprint_UserCharacteristics_Location& location =
+ user_characteristics.location();
+ ASSERT_TRUE(location.has_altitude());
+ ASSERT_TRUE(location.has_latitude());
+ ASSERT_TRUE(location.has_longitude());
+ ASSERT_TRUE(location.has_accuracy());
+ ASSERT_TRUE(location.has_time_in_ms());
+
ASSERT_TRUE(fingerprint->has_metadata());
ASSERT_TRUE(fingerprint->metadata().has_timestamp_ms());
ASSERT_TRUE(fingerprint->metadata().has_gaia_id());
@@ -102,6 +123,11 @@ class AutofillRiskFingerprintTest : public InProcessBrowserTest {
EXPECT_EQ(kWindowBounds.height(),
transient_state.outer_window_size().height());
EXPECT_EQ(kGaiaId, fingerprint->metadata().gaia_id());
+ EXPECT_EQ(kAltitude, location.altitude());
+ EXPECT_EQ(kLatitude, location.latitude());
+ EXPECT_EQ(kLongitude, location.longitude());
+ EXPECT_EQ(kAccuracy, location.accuracy());
+ EXPECT_EQ(kGeolocationTime, location.time_in_ms());
message_loop_.Quit();
}
@@ -123,6 +149,20 @@ class AutofillRiskFingerprintTest : public InProcessBrowserTest {
#endif
// Test that getting a fingerprint works on some basic level.
IN_PROC_BROWSER_TEST_F(AutofillRiskFingerprintTest, MAYBE_GetFingerprint) {
+ content::Geoposition position;
+ position.latitude = kLatitude;
+ position.longitude = kLongitude;
+ position.altitude = kAltitude;
+ position.accuracy = kAccuracy;
+ position.timestamp =
+ base::Time::UnixEpoch() +
+ base::TimeDelta::FromMilliseconds(kGeolocationTime);
+ scoped_refptr<content::MessageLoopRunner> runner =
+ new content::MessageLoopRunner;
+ content::GeolocationProvider::OverrideLocationForTesting(
+ position, runner->QuitClosure());
+ runner->Run();
+
WebKit::WebScreenInfo screen_info;
screen_info.depth = kScreenColorDepth;
screen_info.rect = WebKit::WebRect(kScreenBounds);
« no previous file with comments | « no previous file | components/autofill/browser/risk/fingerprint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698