| 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" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/extensions/state_store.h" | 14 #include "chrome/browser/extensions/state_store.h" |
| 15 #include "chrome/browser/extensions/test_extension_service.h" | 15 #include "chrome/browser/extensions/test_extension_service.h" |
| 16 #include "chrome/browser/extensions/test_extension_system.h" | 16 #include "chrome/browser/extensions/test_extension_system.h" |
| 17 #include "chrome/browser/services/gcm/gcm_client_factory.h" | 17 #include "chrome/browser/services/gcm/gcm_client_factory.h" |
| 18 #include "chrome/browser/services/gcm/gcm_client_mock.h" | 18 #include "chrome/browser/services/gcm/gcm_client_mock.h" |
| 19 #include "chrome/browser/services/gcm/gcm_event_router.h" | 19 #include "chrome/browser/services/gcm/gcm_event_router.h" |
| 20 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 20 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
| 21 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 21 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
| 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/encryptor.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/common/extension.h" | 32 #include "extensions/common/extension.h" |
| 33 #include "extensions/common/manifest_constants.h" | 33 #include "extensions/common/manifest_constants.h" |
| 34 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
| 35 | 35 |
| 36 #if defined(OS_CHROMEOS) | 36 #if defined(OS_CHROMEOS) |
| 37 #include "chrome/browser/chromeos/login/user_manager.h" | 37 #include "chrome/browser/chromeos/login/user_manager.h" |
| 38 #include "chrome/browser/chromeos/settings/cros_settings.h" | 38 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 virtual void SetUp() OVERRIDE { | 490 virtual void SetUp() OVERRIDE { |
| 491 // Make BrowserThread work in unittest. | 491 // Make BrowserThread work in unittest. |
| 492 thread_bundle_.reset(new content::TestBrowserThreadBundle( | 492 thread_bundle_.reset(new content::TestBrowserThreadBundle( |
| 493 content::TestBrowserThreadBundle::REAL_IO_THREAD)); | 493 content::TestBrowserThreadBundle::REAL_IO_THREAD)); |
| 494 | 494 |
| 495 // This is needed to create extension service under CrOS. | 495 // This is needed to create extension service under CrOS. |
| 496 #if defined(OS_CHROMEOS) | 496 #if defined(OS_CHROMEOS) |
| 497 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); | 497 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); |
| 498 #endif | 498 #endif |
| 499 | 499 |
| 500 // Encryptor ends up needing access to the keychain on OS X. So use the mock | 500 // OSCrypt ends up needing access to the keychain on OS X. So use the mock |
| 501 // keychain to prevent prompts. | 501 // keychain to prevent prompts. |
| 502 #if defined(OS_MACOSX) | 502 #if defined(OS_MACOSX) |
| 503 Encryptor::UseMockKeychain(true); | 503 OSCrypt::UseMockKeychain(true); |
| 504 #endif | 504 #endif |
| 505 | 505 |
| 506 // Create a main profile consumer. | 506 // Create a main profile consumer. |
| 507 consumer_.reset(new GCMProfileServiceTestConsumer(&waiter_)); | 507 consumer_.reset(new GCMProfileServiceTestConsumer(&waiter_)); |
| 508 } | 508 } |
| 509 | 509 |
| 510 virtual void TearDown() OVERRIDE { | 510 virtual void TearDown() OVERRIDE { |
| 511 #if defined(OS_CHROMEOS) | 511 #if defined(OS_CHROMEOS) |
| 512 test_user_manager_.reset(); | 512 test_user_manager_.reset(); |
| 513 #endif | 513 #endif |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 consumer()->gcm_event_router()->clear_results(); | 1262 consumer()->gcm_event_router()->clear_results(); |
| 1263 WaitUntilCompleted(); | 1263 WaitUntilCompleted(); |
| 1264 | 1264 |
| 1265 EXPECT_EQ(FakeGCMEventRouter::MESSAGE_EVENT, | 1265 EXPECT_EQ(FakeGCMEventRouter::MESSAGE_EVENT, |
| 1266 consumer()->gcm_event_router()->received_event()); | 1266 consumer()->gcm_event_router()->received_event()); |
| 1267 EXPECT_TRUE( | 1267 EXPECT_TRUE( |
| 1268 in_message5.data == consumer()->gcm_event_router()->message().data); | 1268 in_message5.data == consumer()->gcm_event_router()->message().data); |
| 1269 } | 1269 } |
| 1270 | 1270 |
| 1271 } // namespace gcm | 1271 } // namespace gcm |
| OLD | NEW |