OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <algorithm> | 5 #include <algorithm> |
6 #include <map> | 6 #include <map> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/signin/signin_manager_base.h" | 22 #include "chrome/browser/signin/signin_manager_base.h" |
23 #include "chrome/browser/signin/signin_manager_factory.h" | 23 #include "chrome/browser/signin/signin_manager_factory.h" |
24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
25 #include "chrome/common/extensions/features/feature_channel.h" | 25 #include "chrome/common/extensions/features/feature_channel.h" |
26 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
27 #include "chrome/test/base/testing_profile.h" | 27 #include "chrome/test/base/testing_profile.h" |
28 #include "components/encryptor/os_crypt.h" | 28 #include "components/encryptor/os_crypt.h" |
29 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
30 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
31 #include "content/public/test/test_browser_thread_bundle.h" | 31 #include "content/public/test/test_browser_thread_bundle.h" |
| 32 #include "extensions/browser/event_router.h" |
| 33 #include "extensions/browser/extension_prefs.h" |
32 #include "extensions/common/extension.h" | 34 #include "extensions/common/extension.h" |
33 #include "extensions/common/manifest_constants.h" | 35 #include "extensions/common/manifest_constants.h" |
34 #include "testing/gtest/include/gtest/gtest.h" | 36 #include "testing/gtest/include/gtest/gtest.h" |
35 | 37 |
36 #if defined(OS_CHROMEOS) | 38 #if defined(OS_CHROMEOS) |
37 #include "chrome/browser/chromeos/login/user_manager.h" | 39 #include "chrome/browser/chromeos/login/user_manager.h" |
38 #include "chrome/browser/chromeos/settings/cros_settings.h" | 40 #include "chrome/browser/chromeos/settings/cros_settings.h" |
39 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 41 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
40 #endif | 42 #endif |
41 | 43 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 profile(), &GCMProfileServiceTestConsumer::BuildFakeSigninManager)); | 278 profile(), &GCMProfileServiceTestConsumer::BuildFakeSigninManager)); |
277 | 279 |
278 // Create extension service in order to uninstall the extension. | 280 // Create extension service in order to uninstall the extension. |
279 extensions::TestExtensionSystem* extension_system( | 281 extensions::TestExtensionSystem* extension_system( |
280 static_cast<extensions::TestExtensionSystem*>( | 282 static_cast<extensions::TestExtensionSystem*>( |
281 extensions::ExtensionSystem::Get(profile()))); | 283 extensions::ExtensionSystem::Get(profile()))); |
282 extension_system->CreateExtensionService( | 284 extension_system->CreateExtensionService( |
283 CommandLine::ForCurrentProcess(), base::FilePath(), false); | 285 CommandLine::ForCurrentProcess(), base::FilePath(), false); |
284 extension_service_ = extension_system->Get(profile())->extension_service(); | 286 extension_service_ = extension_system->Get(profile())->extension_service(); |
285 | 287 |
| 288 // EventRouter is needed for GcmJsEventRouter. |
| 289 if (!extension_system->event_router()) { |
| 290 extension_system->SetEventRouter(scoped_ptr<EventRouter>( |
| 291 new EventRouter(profile(), ExtensionPrefs::Get(profile())))); |
| 292 } |
| 293 |
286 // Enable GCM such that tests could be run on all channels. | 294 // Enable GCM such that tests could be run on all channels. |
287 profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, true); | 295 profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, true); |
288 | 296 |
289 // Mock a GCMEventRouter. | 297 // Mock a GCMEventRouter. |
290 gcm_event_router_.reset(new FakeGCMEventRouter(waiter_)); | 298 gcm_event_router_.reset(new FakeGCMEventRouter(waiter_)); |
291 } | 299 } |
292 | 300 |
293 virtual ~GCMProfileServiceTestConsumer() { | 301 virtual ~GCMProfileServiceTestConsumer() { |
294 } | 302 } |
295 | 303 |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 consumer()->gcm_event_router()->clear_results(); | 1426 consumer()->gcm_event_router()->clear_results(); |
1419 WaitUntilCompleted(); | 1427 WaitUntilCompleted(); |
1420 | 1428 |
1421 EXPECT_EQ(FakeGCMEventRouter::MESSAGE_EVENT, | 1429 EXPECT_EQ(FakeGCMEventRouter::MESSAGE_EVENT, |
1422 consumer()->gcm_event_router()->received_event()); | 1430 consumer()->gcm_event_router()->received_event()); |
1423 EXPECT_TRUE( | 1431 EXPECT_TRUE( |
1424 in_message5.data == consumer()->gcm_event_router()->message().data); | 1432 in_message5.data == consumer()->gcm_event_router()->message().data); |
1425 } | 1433 } |
1426 | 1434 |
1427 } // namespace gcm | 1435 } // namespace gcm |
OLD | NEW |