| 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" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 std::unique_ptr<KeyedService> BuildGCMProfileService( | 46 std::unique_ptr<KeyedService> BuildGCMProfileService( |
| 47 content::BrowserContext* context) { | 47 content::BrowserContext* context) { |
| 48 Profile* profile = Profile::FromBrowserContext(context); | 48 Profile* profile = Profile::FromBrowserContext(context); |
| 49 base::SequencedWorkerPool* worker_pool = | 49 base::SequencedWorkerPool* worker_pool = |
| 50 content::BrowserThread::GetBlockingPool(); | 50 content::BrowserThread::GetBlockingPool(); |
| 51 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( | 51 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( |
| 52 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( | 52 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( |
| 53 worker_pool->GetSequenceToken(), | 53 worker_pool->GetSequenceToken(), |
| 54 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 54 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 55 return base::WrapUnique(new gcm::GCMProfileService( | 55 return base::MakeUnique<gcm::GCMProfileService>( |
| 56 profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(), | 56 profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(), |
| 57 chrome::GetChannel(), | 57 chrome::GetChannel(), |
| 58 gcm::GetProductCategoryForSubtypes(profile->GetPrefs()), | 58 gcm::GetProductCategoryForSubtypes(profile->GetPrefs()), |
| 59 std::unique_ptr<ProfileIdentityProvider>(new ProfileIdentityProvider( | 59 std::unique_ptr<ProfileIdentityProvider>(new ProfileIdentityProvider( |
| 60 SigninManagerFactory::GetForProfile(profile), | 60 SigninManagerFactory::GetForProfile(profile), |
| 61 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 61 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 62 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile))), | 62 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile))), |
| 63 std::unique_ptr<gcm::GCMClientFactory>(new gcm::FakeGCMClientFactory( | 63 std::unique_ptr<gcm::GCMClientFactory>(new gcm::FakeGCMClientFactory( |
| 64 content::BrowserThread::GetTaskRunnerForThread( | 64 content::BrowserThread::GetTaskRunnerForThread( |
| 65 content::BrowserThread::UI), | 65 content::BrowserThread::UI), |
| 66 content::BrowserThread::GetTaskRunnerForThread( | 66 content::BrowserThread::GetTaskRunnerForThread( |
| 67 content::BrowserThread::IO))), | 67 content::BrowserThread::IO))), |
| 68 content::BrowserThread::GetTaskRunnerForThread( | 68 content::BrowserThread::GetTaskRunnerForThread( |
| 69 content::BrowserThread::UI), | 69 content::BrowserThread::UI), |
| 70 content::BrowserThread::GetTaskRunnerForThread( | 70 content::BrowserThread::GetTaskRunnerForThread( |
| 71 content::BrowserThread::IO), | 71 content::BrowserThread::IO), |
| 72 blocking_task_runner)); | 72 blocking_task_runner); |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace | 75 } // namespace |
| 76 | 76 |
| 77 class GCMProfileServiceTest : public testing::Test { | 77 class GCMProfileServiceTest : public testing::Test { |
| 78 protected: | 78 protected: |
| 79 GCMProfileServiceTest(); | 79 GCMProfileServiceTest(); |
| 80 ~GCMProfileServiceTest() override; | 80 ~GCMProfileServiceTest() override; |
| 81 | 81 |
| 82 // testing::Test: | 82 // testing::Test: |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 OutgoingMessage message; | 244 OutgoingMessage message; |
| 245 message.id = "1"; | 245 message.id = "1"; |
| 246 message.data["key1"] = "value1"; | 246 message.data["key1"] = "value1"; |
| 247 SendAndWaitForCompletion(message); | 247 SendAndWaitForCompletion(message); |
| 248 | 248 |
| 249 EXPECT_EQ(message.id, send_message_id()); | 249 EXPECT_EQ(message.id, send_message_id()); |
| 250 EXPECT_EQ(GCMClient::SUCCESS, send_result()); | 250 EXPECT_EQ(GCMClient::SUCCESS, send_result()); |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace gcm | 253 } // namespace gcm |
| OLD | NEW |