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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" | 8 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" |
9 #include "chrome/common/chrome_version_info.h" | |
10 #include "sync/util/get_session_name.h" | 9 #include "sync/util/get_session_name.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
12 | 11 |
13 using sync_driver::DeviceInfo; | 12 using sync_driver::DeviceInfo; |
14 using sync_driver::LocalDeviceInfoProvider; | 13 using sync_driver::LocalDeviceInfoProvider; |
15 | 14 |
16 namespace browser_sync { | 15 namespace browser_sync { |
17 | 16 |
18 const char kLocalDeviceGuid[] = "foo"; | 17 const char kLocalDeviceGuid[] = "foo"; |
19 const char kSigninScopedDeviceId[] = "device_id"; | 18 const char kSigninScopedDeviceId[] = "device_id"; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 InitializeProvider(); | 71 InitializeProvider(); |
73 | 72 |
74 const DeviceInfo* local_device_info = provider_->GetLocalDeviceInfo(); | 73 const DeviceInfo* local_device_info = provider_->GetLocalDeviceInfo(); |
75 EXPECT_TRUE(local_device_info); | 74 EXPECT_TRUE(local_device_info); |
76 EXPECT_EQ(std::string(kLocalDeviceGuid), local_device_info->guid()); | 75 EXPECT_EQ(std::string(kLocalDeviceGuid), local_device_info->guid()); |
77 EXPECT_EQ(std::string(kSigninScopedDeviceId), | 76 EXPECT_EQ(std::string(kSigninScopedDeviceId), |
78 local_device_info->signin_scoped_device_id()); | 77 local_device_info->signin_scoped_device_id()); |
79 EXPECT_EQ(syncer::GetSessionNameSynchronouslyForTesting(), | 78 EXPECT_EQ(syncer::GetSessionNameSynchronouslyForTesting(), |
80 local_device_info->client_name()); | 79 local_device_info->client_name()); |
81 | 80 |
82 chrome::VersionInfo version_info; | 81 EXPECT_EQ( |
83 EXPECT_EQ(browser_sync::LocalDeviceInfoProviderImpl::MakeUserAgentForSyncApi( | 82 browser_sync::LocalDeviceInfoProviderImpl::MakeUserAgentForSyncApi(), |
84 version_info), | 83 local_device_info->sync_user_agent()); |
85 local_device_info->sync_user_agent()); | |
86 } | 84 } |
87 | 85 |
88 TEST_F(LocalDeviceInfoProviderTest, GetLocalSyncCacheGUID) { | 86 TEST_F(LocalDeviceInfoProviderTest, GetLocalSyncCacheGUID) { |
89 ASSERT_EQ(std::string(), provider_->GetLocalSyncCacheGUID()); | 87 ASSERT_EQ(std::string(), provider_->GetLocalSyncCacheGUID()); |
90 | 88 |
91 InitializeProvider(); | 89 InitializeProvider(); |
92 | 90 |
93 EXPECT_EQ(std::string(kLocalDeviceGuid), provider_->GetLocalSyncCacheGUID()); | 91 EXPECT_EQ(std::string(kLocalDeviceGuid), provider_->GetLocalSyncCacheGUID()); |
94 } | 92 } |
95 | 93 |
96 } // namespace browser_sync | 94 } // namespace browser_sync |
OLD | NEW |