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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 virtual void SetUp() OVERRIDE { | 497 virtual void SetUp() OVERRIDE { |
498 // Make BrowserThread work in unittest. | 498 // Make BrowserThread work in unittest. |
499 thread_bundle_.reset(new content::TestBrowserThreadBundle( | 499 thread_bundle_.reset(new content::TestBrowserThreadBundle( |
500 content::TestBrowserThreadBundle::REAL_IO_THREAD)); | 500 content::TestBrowserThreadBundle::REAL_IO_THREAD)); |
501 | 501 |
502 // This is needed to create extension service under CrOS. | 502 // This is needed to create extension service under CrOS. |
503 #if defined(OS_CHROMEOS) | 503 #if defined(OS_CHROMEOS) |
504 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); | 504 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); |
505 #endif | 505 #endif |
506 | 506 |
507 // Encryptor ends up needing access to the keychain on OS X. So use the mock | 507 // OSCrypt ends up needing access to the keychain on OS X. So use the mock |
508 // keychain to prevent prompts. | 508 // keychain to prevent prompts. |
509 #if defined(OS_MACOSX) | 509 #if defined(OS_MACOSX) |
510 Encryptor::UseMockKeychain(true); | 510 OSCrypt::UseMockKeychain(true); |
511 #endif | 511 #endif |
512 | 512 |
513 // Create a main profile consumer. | 513 // Create a main profile consumer. |
514 consumer_.reset(new GCMProfileServiceTestConsumer(&waiter_)); | 514 consumer_.reset(new GCMProfileServiceTestConsumer(&waiter_)); |
515 } | 515 } |
516 | 516 |
517 virtual void TearDown() OVERRIDE { | 517 virtual void TearDown() OVERRIDE { |
518 #if defined(OS_CHROMEOS) | 518 #if defined(OS_CHROMEOS) |
519 test_user_manager_.reset(); | 519 test_user_manager_.reset(); |
520 #endif | 520 #endif |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 consumer()->gcm_event_router()->clear_results(); | 1364 consumer()->gcm_event_router()->clear_results(); |
1365 WaitUntilCompleted(); | 1365 WaitUntilCompleted(); |
1366 | 1366 |
1367 EXPECT_EQ(FakeGCMEventRouter::MESSAGE_EVENT, | 1367 EXPECT_EQ(FakeGCMEventRouter::MESSAGE_EVENT, |
1368 consumer()->gcm_event_router()->received_event()); | 1368 consumer()->gcm_event_router()->received_event()); |
1369 EXPECT_TRUE( | 1369 EXPECT_TRUE( |
1370 in_message5.data == consumer()->gcm_event_router()->message().data); | 1370 in_message5.data == consumer()->gcm_event_router()->message().data); |
1371 } | 1371 } |
1372 | 1372 |
1373 } // namespace gcm | 1373 } // namespace gcm |
OLD | NEW |