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/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
6 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
7 #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" |
8 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
9 | 12 |
10 namespace browser_sync { | 13 namespace browser_sync { |
11 | 14 |
12 const char kLocalDeviceGuid[] = "foo"; | 15 const char kLocalDeviceGuid[] = "foo"; |
13 const char kSigninScopedDeviceId[] = "device_id"; | 16 const char kSigninScopedDeviceId[] = "device_id"; |
14 | 17 |
15 class LocalDeviceInfoProviderTest : public testing::Test { | 18 class LocalDeviceInfoProviderTest : public testing::Test { |
16 public: | 19 public: |
17 LocalDeviceInfoProviderTest() | 20 LocalDeviceInfoProviderTest() |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 TEST_F(LocalDeviceInfoProviderTest, GetLocalDeviceInfo) { | 68 TEST_F(LocalDeviceInfoProviderTest, GetLocalDeviceInfo) { |
66 ASSERT_EQ(NULL, provider_->GetLocalDeviceInfo()); | 69 ASSERT_EQ(NULL, provider_->GetLocalDeviceInfo()); |
67 | 70 |
68 InitializeProvider(); | 71 InitializeProvider(); |
69 | 72 |
70 const DeviceInfo* local_device_info = provider_->GetLocalDeviceInfo(); | 73 const DeviceInfo* local_device_info = provider_->GetLocalDeviceInfo(); |
71 EXPECT_TRUE(!!local_device_info); | 74 EXPECT_TRUE(!!local_device_info); |
72 EXPECT_EQ(std::string(kLocalDeviceGuid), local_device_info->guid()); | 75 EXPECT_EQ(std::string(kLocalDeviceGuid), local_device_info->guid()); |
73 EXPECT_EQ(std::string(kSigninScopedDeviceId), | 76 EXPECT_EQ(std::string(kSigninScopedDeviceId), |
74 local_device_info->signin_scoped_device_id()); | 77 local_device_info->signin_scoped_device_id()); |
| 78 EXPECT_EQ(syncer::GetSessionNameSynchronouslyForTesting(), |
| 79 local_device_info->client_name()); |
| 80 |
| 81 chrome::VersionInfo version_info; |
| 82 EXPECT_EQ(browser_sync::LocalDeviceInfoProviderImpl::MakeUserAgentForSyncApi( |
| 83 version_info), |
| 84 local_device_info->sync_user_agent()); |
75 } | 85 } |
76 | 86 |
77 TEST_F(LocalDeviceInfoProviderTest, GetLocalSyncCacheGUID) { | 87 TEST_F(LocalDeviceInfoProviderTest, GetLocalSyncCacheGUID) { |
78 ASSERT_EQ(std::string(), provider_->GetLocalSyncCacheGUID()); | 88 ASSERT_EQ(std::string(), provider_->GetLocalSyncCacheGUID()); |
79 | 89 |
80 InitializeProvider(); | 90 InitializeProvider(); |
81 | 91 |
82 EXPECT_EQ(std::string(kLocalDeviceGuid), provider_->GetLocalSyncCacheGUID()); | 92 EXPECT_EQ(std::string(kLocalDeviceGuid), provider_->GetLocalSyncCacheGUID()); |
83 } | 93 } |
84 | 94 |
85 } // namespace browser_sync | 95 } // namespace browser_sync |
OLD | NEW |