summaryrefslogtreecommitdiff
path: root/chromium/components/cryptauth/cryptauth_device_manager_unittest.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-09-18 14:34:04 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-10-04 11:15:27 +0000
commite6430e577f105ad8813c92e75c54660c4985026e (patch)
tree88115e5d1fb471fea807111924dcccbeadbf9e4f /chromium/components/cryptauth/cryptauth_device_manager_unittest.cc
parent53d399fe6415a96ea6986ec0d402a9c07da72453 (diff)
downloadqtwebengine-chromium-e6430e577f105ad8813c92e75c54660c4985026e.tar.gz
BASELINE: Update Chromium to 61.0.3163.99
Change-Id: I8452f34574d88ca2b27af9bd56fc9ff3f16b1367 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/components/cryptauth/cryptauth_device_manager_unittest.cc')
-rw-r--r--chromium/components/cryptauth/cryptauth_device_manager_unittest.cc29
1 files changed, 17 insertions, 12 deletions
diff --git a/chromium/components/cryptauth/cryptauth_device_manager_unittest.cc b/chromium/components/cryptauth/cryptauth_device_manager_unittest.cc
index 7dcd284349e..ec960e085f1 100644
--- a/chromium/components/cryptauth/cryptauth_device_manager_unittest.cc
+++ b/chromium/components/cryptauth/cryptauth_device_manager_unittest.cc
@@ -21,6 +21,7 @@
#include "components/cryptauth/pref_names.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/prefs/testing_pref_service.h"
+#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -52,7 +53,7 @@ const bool kStoredMobileHotspotSupported = true;
// ExternalDeviceInfo fields for the synced unlock key.
const char kPublicKey1[] = "GOOG";
-const char kDeviceName1[] = "Nexus 5";
+const char kDeviceName1[] = "Pixel XL";
const char kBluetoothAddress1[] = "aa:bb:cc:ee:dd:ff";
const bool kUnlockKey1 = true;
const bool kUnlockable1 = false;
@@ -63,6 +64,8 @@ const int64_t kBeaconSeed1EndTime = 123457;
const char kBeaconSeed2Data[] = "beaconSeed2Data";
const int64_t kBeaconSeed2StartTime = 234567;
const int64_t kBeaconSeed2EndTime = 234568;
+const bool kArcPlusPlus1 = true;
+const bool kPixelPhone1 = true;
// ExternalDeviceInfo fields for a non-synced unlockable device.
const char kPublicKey2[] = "MSFT";
@@ -76,6 +79,8 @@ const int64_t kBeaconSeed3EndTime = 123457;
const char kBeaconSeed4Data[] = "beaconSeed4Data";
const int64_t kBeaconSeed4StartTime = 234567;
const int64_t kBeaconSeed4EndTime = 234568;
+const bool kArcPlusPlus2 = false;
+const bool kPixelPhone2 = false;
// Validates that |devices| is equal to |expected_devices|.
void ExpectSyncedDevicesAreEqual(
@@ -297,23 +302,20 @@ class TestCryptAuthDeviceManager : public CryptAuthDeviceManager {
gcm_manager,
pref_service),
scoped_sync_scheduler_(new NiceMock<MockSyncScheduler>()),
- weak_sync_scheduler_factory_(scoped_sync_scheduler_.get()) {}
+ weak_sync_scheduler_factory_(scoped_sync_scheduler_) {
+ SetSyncSchedulerForTest(base::WrapUnique(scoped_sync_scheduler_));
+ }
~TestCryptAuthDeviceManager() override {}
- std::unique_ptr<SyncScheduler> CreateSyncScheduler() override {
- EXPECT_TRUE(scoped_sync_scheduler_);
- return std::move(scoped_sync_scheduler_);
- }
-
base::WeakPtr<MockSyncScheduler> GetSyncScheduler() {
return weak_sync_scheduler_factory_.GetWeakPtr();
}
private:
// Ownership is passed to |CryptAuthDeviceManager| super class when
- // |CreateSyncScheduler()| is called.
- std::unique_ptr<MockSyncScheduler> scoped_sync_scheduler_;
+ // SetSyncSchedulerForTest() is called.
+ MockSyncScheduler* scoped_sync_scheduler_;
// Stores the pointer of |scoped_sync_scheduler_| after ownership is passed to
// the super class.
@@ -353,6 +355,8 @@ class CryptAuthDeviceManagerTest
seed2->set_data(kBeaconSeed2Data);
seed2->set_start_time_millis(kBeaconSeed2StartTime);
seed2->set_end_time_millis(kBeaconSeed2EndTime);
+ unlock_key.set_arc_plus_plus(kArcPlusPlus1);
+ unlock_key.set_pixel_phone(kPixelPhone1);
devices_in_response_.push_back(unlock_key);
ExternalDeviceInfo unlockable_device;
@@ -369,6 +373,8 @@ class CryptAuthDeviceManagerTest
seed4->set_data(kBeaconSeed4Data);
seed4->set_start_time_millis(kBeaconSeed4StartTime);
seed4->set_end_time_millis(kBeaconSeed4EndTime);
+ unlockable_device.set_arc_plus_plus(kArcPlusPlus2);
+ unlockable_device.set_pixel_phone(kPixelPhone2);
devices_in_response_.push_back(unlockable_device);
}
@@ -411,8 +417,7 @@ class CryptAuthDeviceManagerTest
bluetooth_address_b64);
device_dictionary->SetBoolean("unlock_key", kStoredUnlockKey);
device_dictionary->SetBoolean("unlockable", kStoredUnlockable);
- device_dictionary->Set("beacon_seeds",
- base::WrapUnique(new base::ListValue()));
+ device_dictionary->Set("beacon_seeds", base::MakeUnique<base::ListValue>());
device_dictionary->SetBoolean("mobile_hotspot_supported",
kStoredMobileHotspotSupported);
{
@@ -473,7 +478,7 @@ class CryptAuthDeviceManagerTest
// MockCryptAuthClientFactory::Observer:
void OnCryptAuthClientCreated(MockCryptAuthClient* client) override {
- EXPECT_CALL(*client, GetMyDevices(_, _, _))
+ EXPECT_CALL(*client, GetMyDevices(_, _, _, _))
.WillOnce(DoAll(SaveArg<0>(&get_my_devices_request_),
SaveArg<1>(&success_callback_),
SaveArg<2>(&error_callback_)));