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 <memory> | 5 #include <memory> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "chrome/browser/services/gcm/gcm_product_util.h" | |
15 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 16 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
17 #include "chrome/browser/signin/signin_manager_factory.h" | 18 #include "chrome/browser/signin/signin_manager_factory.h" |
18 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 19 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
19 #include "chrome/common/channel_info.h" | 20 #include "chrome/common/channel_info.h" |
21 #include "chrome/common/chrome_version.h" | |
Lei Zhang
2016/08/05 15:37:08
ditto
johnme
2016/08/08 18:22:05
Done.
| |
20 #include "chrome/test/base/testing_profile.h" | 22 #include "chrome/test/base/testing_profile.h" |
21 #include "components/gcm_driver/gcm_profile_service.h" | 23 #include "components/gcm_driver/gcm_profile_service.h" |
22 #if defined(OS_CHROMEOS) | 24 #if defined(OS_CHROMEOS) |
23 #include "chromeos/dbus/dbus_thread_manager.h" | 25 #include "chromeos/dbus/dbus_thread_manager.h" |
24 #endif | 26 #endif |
25 #include "components/gcm_driver/fake_gcm_app_handler.h" | 27 #include "components/gcm_driver/fake_gcm_app_handler.h" |
26 #include "components/gcm_driver/fake_gcm_client.h" | 28 #include "components/gcm_driver/fake_gcm_client.h" |
27 #include "components/gcm_driver/fake_gcm_client_factory.h" | 29 #include "components/gcm_driver/fake_gcm_client_factory.h" |
28 #include "components/gcm_driver/gcm_client.h" | 30 #include "components/gcm_driver/gcm_client.h" |
29 #include "components/gcm_driver/gcm_client_factory.h" | 31 #include "components/gcm_driver/gcm_client_factory.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
47 Profile* profile = Profile::FromBrowserContext(context); | 49 Profile* profile = Profile::FromBrowserContext(context); |
48 base::SequencedWorkerPool* worker_pool = | 50 base::SequencedWorkerPool* worker_pool = |
49 content::BrowserThread::GetBlockingPool(); | 51 content::BrowserThread::GetBlockingPool(); |
50 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( | 52 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( |
51 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( | 53 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( |
52 worker_pool->GetSequenceToken(), | 54 worker_pool->GetSequenceToken(), |
53 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 55 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
54 return base::WrapUnique(new gcm::GCMProfileService( | 56 return base::WrapUnique(new gcm::GCMProfileService( |
55 profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(), | 57 profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(), |
56 chrome::GetChannel(), | 58 chrome::GetChannel(), |
59 gcm::GetProductCategoryForSubtypes(profile->GetPrefs()), | |
57 std::unique_ptr<ProfileIdentityProvider>(new ProfileIdentityProvider( | 60 std::unique_ptr<ProfileIdentityProvider>(new ProfileIdentityProvider( |
58 SigninManagerFactory::GetForProfile(profile), | 61 SigninManagerFactory::GetForProfile(profile), |
59 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 62 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
60 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile))), | 63 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile))), |
61 std::unique_ptr<gcm::GCMClientFactory>(new gcm::FakeGCMClientFactory( | 64 std::unique_ptr<gcm::GCMClientFactory>(new gcm::FakeGCMClientFactory( |
62 content::BrowserThread::GetTaskRunnerForThread( | 65 content::BrowserThread::GetTaskRunnerForThread( |
63 content::BrowserThread::UI), | 66 content::BrowserThread::UI), |
64 content::BrowserThread::GetTaskRunnerForThread( | 67 content::BrowserThread::GetTaskRunnerForThread( |
65 content::BrowserThread::IO))), | 68 content::BrowserThread::IO))), |
66 content::BrowserThread::GetTaskRunnerForThread( | 69 content::BrowserThread::GetTaskRunnerForThread( |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 OutgoingMessage message; | 245 OutgoingMessage message; |
243 message.id = "1"; | 246 message.id = "1"; |
244 message.data["key1"] = "value1"; | 247 message.data["key1"] = "value1"; |
245 SendAndWaitForCompletion(message); | 248 SendAndWaitForCompletion(message); |
246 | 249 |
247 EXPECT_EQ(message.id, send_message_id()); | 250 EXPECT_EQ(message.id, send_message_id()); |
248 EXPECT_EQ(GCMClient::SUCCESS, send_result()); | 251 EXPECT_EQ(GCMClient::SUCCESS, send_result()); |
249 } | 252 } |
250 | 253 |
251 } // namespace gcm | 254 } // namespace gcm |
OLD | NEW |