| OLD | NEW |
| 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/sync/device_info/local_device_info_provider_impl.h" | 5 #include "components/sync/device_info/local_device_info_provider_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" |
| 8 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 10 #include "components/sync/base/get_session_name.h" | 11 #include "components/sync/base/get_session_name.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 namespace syncer { | 14 namespace syncer { |
| 14 | 15 |
| 15 const char kLocalDeviceGuid[] = "foo"; | 16 const char kLocalDeviceGuid[] = "foo"; |
| 16 const char kSigninScopedDeviceId[] = "device_id"; | 17 const char kSigninScopedDeviceId[] = "device_id"; |
| 17 | 18 |
| 18 class LocalDeviceInfoProviderImplTest : public testing::Test { | 19 class LocalDeviceInfoProviderImplTest : public testing::Test { |
| 19 public: | 20 public: |
| 20 LocalDeviceInfoProviderImplTest() : called_back_(false) {} | 21 LocalDeviceInfoProviderImplTest() : called_back_(false) {} |
| 21 ~LocalDeviceInfoProviderImplTest() override {} | 22 ~LocalDeviceInfoProviderImplTest() override {} |
| 22 | 23 |
| 23 void SetUp() override { | 24 void SetUp() override { |
| 24 provider_.reset(new LocalDeviceInfoProviderImpl( | 25 provider_ = base::MakeUnique<LocalDeviceInfoProviderImpl>( |
| 25 version_info::Channel::UNKNOWN, | 26 version_info::Channel::UNKNOWN, |
| 26 version_info::GetVersionStringWithModifier("UNKNOWN"), false)); | 27 version_info::GetVersionStringWithModifier("UNKNOWN"), false); |
| 27 } | 28 } |
| 28 | 29 |
| 29 void TearDown() override { | 30 void TearDown() override { |
| 30 provider_.reset(); | 31 provider_.reset(); |
| 31 called_back_ = false; | 32 called_back_ = false; |
| 32 } | 33 } |
| 33 | 34 |
| 34 protected: | 35 protected: |
| 35 void StartInitializeProvider() { StartInitializeProvider(kLocalDeviceGuid); } | 36 void StartInitializeProvider() { StartInitializeProvider(kLocalDeviceGuid); } |
| 36 | 37 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 EXPECT_EQ(guid2, provider_->GetLocalSyncCacheGUID()); | 135 EXPECT_EQ(guid2, provider_->GetLocalSyncCacheGUID()); |
| 135 | 136 |
| 136 FinishInitializeProvider(); | 137 FinishInitializeProvider(); |
| 137 const DeviceInfo* local_device_info = provider_->GetLocalDeviceInfo(); | 138 const DeviceInfo* local_device_info = provider_->GetLocalDeviceInfo(); |
| 138 ASSERT_NE(nullptr, local_device_info); | 139 ASSERT_NE(nullptr, local_device_info); |
| 139 EXPECT_EQ(guid2, local_device_info->guid()); | 140 EXPECT_EQ(guid2, local_device_info->guid()); |
| 140 EXPECT_EQ(guid2, provider_->GetLocalSyncCacheGUID()); | 141 EXPECT_EQ(guid2, provider_->GetLocalSyncCacheGUID()); |
| 141 } | 142 } |
| 142 | 143 |
| 143 } // namespace syncer | 144 } // namespace syncer |
| OLD | NEW |