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 "chrome/browser/extensions/extension_gcm_app_handler.h" | 5 #include "chrome/browser/extensions/extension_gcm_app_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 DISALLOW_COPY_AND_ASSIGN(FakeExtensionGCMAppHandler); | 164 DISALLOW_COPY_AND_ASSIGN(FakeExtensionGCMAppHandler); |
165 }; | 165 }; |
166 | 166 |
167 class ExtensionGCMAppHandlerTest : public testing::Test { | 167 class ExtensionGCMAppHandlerTest : public testing::Test { |
168 public: | 168 public: |
169 static KeyedService* BuildGCMProfileService( | 169 static KeyedService* BuildGCMProfileService( |
170 content::BrowserContext* context) { | 170 content::BrowserContext* context) { |
171 return new gcm::GCMProfileService( | 171 return new gcm::GCMProfileService( |
172 Profile::FromBrowserContext(context), | 172 Profile::FromBrowserContext(context), |
173 scoped_ptr<gcm::GCMClientFactory>( | 173 scoped_ptr<gcm::GCMClientFactory>(new gcm::FakeGCMClientFactory( |
174 new gcm::FakeGCMClientFactory(gcm::FakeGCMClient::NO_DELAY_START))); | 174 gcm::FakeGCMClient::NO_DELAY_START, |
| 175 content::BrowserThread::GetMessageLoopProxyForThread( |
| 176 content::BrowserThread::UI), |
| 177 content::BrowserThread::GetMessageLoopProxyForThread( |
| 178 content::BrowserThread::IO)))); |
175 } | 179 } |
176 | 180 |
177 ExtensionGCMAppHandlerTest() | 181 ExtensionGCMAppHandlerTest() |
178 : extension_service_(NULL), | 182 : extension_service_(NULL), |
179 registration_result_(gcm::GCMClient::UNKNOWN_ERROR), | 183 registration_result_(gcm::GCMClient::UNKNOWN_ERROR), |
180 unregistration_result_(gcm::GCMClient::UNKNOWN_ERROR) { | 184 unregistration_result_(gcm::GCMClient::UNKNOWN_ERROR) { |
181 } | 185 } |
182 | 186 |
183 virtual ~ExtensionGCMAppHandlerTest() { | 187 virtual ~ExtensionGCMAppHandlerTest() { |
184 } | 188 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 EXPECT_EQ(gcm::GCMClient::SUCCESS, registration_result()); | 382 EXPECT_EQ(gcm::GCMClient::SUCCESS, registration_result()); |
379 | 383 |
380 // Unregistration should be triggered when the extension is uninstalled. | 384 // Unregistration should be triggered when the extension is uninstalled. |
381 UninstallExtension(extension); | 385 UninstallExtension(extension); |
382 waiter()->WaitUntilCompleted(); | 386 waiter()->WaitUntilCompleted(); |
383 EXPECT_EQ(gcm::GCMClient::SUCCESS, | 387 EXPECT_EQ(gcm::GCMClient::SUCCESS, |
384 gcm_app_handler()->unregistration_result()); | 388 gcm_app_handler()->unregistration_result()); |
385 } | 389 } |
386 | 390 |
387 } // namespace extensions | 391 } // namespace extensions |
OLD | NEW |