OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chrome/browser/net/gaia/token_service.h" | 9 #include "chrome/browser/net/gaia/token_service.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
11 #include "chrome/browser/sync/glue/data_type_manager.h" | 11 #include "chrome/browser/sync/glue/data_type_manager.h" |
12 #include "chrome/browser/sync/glue/data_type_manager_mock.h" | 12 #include "chrome/browser/sync/glue/data_type_manager_mock.h" |
13 #include "chrome/browser/sync/profile_sync_factory_mock.h" | 13 #include "chrome/browser/sync/profile_sync_factory_mock.h" |
14 #include "chrome/browser/sync/profile_sync_test_util.h" | 14 #include "chrome/browser/sync/profile_sync_test_util.h" |
15 #include "chrome/browser/sync/signin_manager.h" | 15 #include "chrome/browser/sync/signin_manager.h" |
16 #include "chrome/browser/sync/test_profile_sync_service.h" | 16 #include "chrome/browser/sync/test_profile_sync_service.h" |
17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
18 #include "chrome/common/net/gaia/gaia_auth_consumer.h" | 18 #include "chrome/common/net/gaia/gaia_auth_consumer.h" |
19 #include "chrome/common/net/gaia/gaia_constants.h" | 19 #include "chrome/common/net/gaia/gaia_constants.h" |
20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 21 #include "chrome/test/testing_browser_process_test.h" |
21 #include "chrome/test/testing_profile.h" | 22 #include "chrome/test/testing_profile.h" |
22 #include "content/browser/browser_thread.h" | 23 #include "content/browser/browser_thread.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
24 | 25 |
25 using browser_sync::DataTypeManager; | 26 using browser_sync::DataTypeManager; |
26 using browser_sync::DataTypeManagerMock; | 27 using browser_sync::DataTypeManagerMock; |
27 using testing::_; | 28 using testing::_; |
28 using testing::AnyNumber; | 29 using testing::AnyNumber; |
29 using testing::DoAll; | 30 using testing::DoAll; |
30 using testing::InvokeArgument; | 31 using testing::InvokeArgument; |
31 using testing::Mock; | 32 using testing::Mock; |
32 using testing::Return; | 33 using testing::Return; |
33 | 34 |
34 ACTION_P(InvokeCallback, callback_result) { | 35 ACTION_P(InvokeCallback, callback_result) { |
35 arg0->Run(callback_result); | 36 arg0->Run(callback_result); |
36 delete arg0; | 37 delete arg0; |
37 } | 38 } |
38 | 39 |
39 // TODO(chron): Test not using cros_user flag and use signin_ | 40 // TODO(chron): Test not using cros_user flag and use signin_ |
40 class ProfileSyncServiceStartupTest : public testing::Test { | 41 class ProfileSyncServiceStartupTest : public TestingBrowserProcessTest { |
41 public: | 42 public: |
42 ProfileSyncServiceStartupTest() | 43 ProfileSyncServiceStartupTest() |
43 : ui_thread_(BrowserThread::UI, &ui_loop_), | 44 : ui_thread_(BrowserThread::UI, &ui_loop_), |
44 io_thread_(BrowserThread::IO) {} | 45 io_thread_(BrowserThread::IO) {} |
45 | 46 |
46 virtual ~ProfileSyncServiceStartupTest() { | 47 virtual ~ProfileSyncServiceStartupTest() { |
47 } | 48 } |
48 | 49 |
49 virtual void SetUp() { | 50 virtual void SetUp() { |
50 base::Thread::Options options; | 51 base::Thread::Options options; |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 310 |
310 // Preload the tokens. | 311 // Preload the tokens. |
311 profile_.GetTokenService()->IssueAuthTokenForTest( | 312 profile_.GetTokenService()->IssueAuthTokenForTest( |
312 GaiaConstants::kSyncService, "sync_token"); | 313 GaiaConstants::kSyncService, "sync_token"); |
313 service_->fail_initial_download(); | 314 service_->fail_initial_download(); |
314 | 315 |
315 service_->Initialize(); | 316 service_->Initialize(); |
316 EXPECT_FALSE(service_->sync_initialized()); | 317 EXPECT_FALSE(service_->sync_initialized()); |
317 EXPECT_FALSE(service_->GetBackendForTest()); | 318 EXPECT_FALSE(service_->GetBackendForTest()); |
318 } | 319 } |
OLD | NEW |