| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/signin/signin_manager.h" | 11 #include "chrome/browser/signin/signin_manager.h" |
| 12 #include "chrome/browser/signin/signin_manager_factory.h" | 12 #include "chrome/browser/signin/signin_manager_factory.h" |
| 13 #include "chrome/browser/signin/token_service.h" | 13 #include "chrome/browser/signin/token_service.h" |
| 14 #include "chrome/browser/signin/token_service_factory.h" | 14 #include "chrome/browser/signin/token_service_factory.h" |
| 15 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" | 15 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
| 16 #include "chrome/browser/sync/glue/data_type_controller.h" | 16 #include "chrome/browser/sync/glue/data_type_controller.h" |
| 17 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 17 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
| 18 #include "chrome/browser/sync/test_profile_sync_service.h" | 18 #include "chrome/browser/sync/test_profile_sync_service.h" |
| 19 #include "chrome/common/chrome_version_info.h" | 19 #include "chrome/common/chrome_version_info.h" |
| 20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 21 #include "chrome/test/base/testing_pref_service_syncable.h" | 21 #include "chrome/test/base/testing_pref_service_syncable.h" |
| 22 #include "chrome/test/base/testing_profile.h" | 22 #include "chrome/test/base/testing_profile.h" |
| 23 #include "content/public/common/content_client.h" | |
| 24 #include "content/public/test/test_browser_thread.h" | 23 #include "content/public/test/test_browser_thread.h" |
| 25 #include "google/cacheinvalidation/include/types.h" | 24 #include "google/cacheinvalidation/include/types.h" |
| 26 #include "google_apis/gaia/gaia_constants.h" | 25 #include "google_apis/gaia/gaia_constants.h" |
| 27 #include "sync/js/js_arg_list.h" | 26 #include "sync/js/js_arg_list.h" |
| 28 #include "sync/js/js_event_details.h" | 27 #include "sync/js/js_event_details.h" |
| 29 #include "sync/js/js_test_util.h" | 28 #include "sync/js/js_test_util.h" |
| 30 #include "sync/notifier/fake_invalidation_handler.h" | 29 #include "sync/notifier/fake_invalidation_handler.h" |
| 31 #include "sync/notifier/invalidator.h" | 30 #include "sync/notifier/invalidator.h" |
| 32 #include "sync/notifier/invalidator_test_template.h" | 31 #include "sync/notifier/invalidator_test_template.h" |
| 33 #include "sync/notifier/object_id_invalidation_map_test_util.h" | 32 #include "sync/notifier/object_id_invalidation_map_test_util.h" |
| 34 #include "testing/gmock/include/gmock/gmock.h" | 33 #include "testing/gmock/include/gmock/gmock.h" |
| 35 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
| 36 #include "webkit/user_agent/user_agent.h" | |
| 37 | 35 |
| 38 // TODO(akalin): Add tests here that exercise the whole | 36 // TODO(akalin): Add tests here that exercise the whole |
| 39 // ProfileSyncService/SyncBackendHost stack while mocking out as | 37 // ProfileSyncService/SyncBackendHost stack while mocking out as |
| 40 // little as possible. | 38 // little as possible. |
| 41 | 39 |
| 42 namespace browser_sync { | 40 namespace browser_sync { |
| 43 | 41 |
| 44 namespace { | 42 namespace { |
| 45 | 43 |
| 46 using content::BrowserThread; | 44 using content::BrowserThread; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 59 file_thread_(BrowserThread::FILE), | 57 file_thread_(BrowserThread::FILE), |
| 60 io_thread_(BrowserThread::IO) {} | 58 io_thread_(BrowserThread::IO) {} |
| 61 | 59 |
| 62 ~ProfileSyncServiceTestHarness() {} | 60 ~ProfileSyncServiceTestHarness() {} |
| 63 | 61 |
| 64 void SetUp() { | 62 void SetUp() { |
| 65 file_thread_.Start(); | 63 file_thread_.Start(); |
| 66 io_thread_.StartIOThread(); | 64 io_thread_.StartIOThread(); |
| 67 profile.reset(new TestingProfile()); | 65 profile.reset(new TestingProfile()); |
| 68 profile->CreateRequestContext(); | 66 profile->CreateRequestContext(); |
| 69 | |
| 70 // We need to set the user agent before the backend host can call | |
| 71 // webkit_glue::GetUserAgent(). | |
| 72 webkit_glue::SetUserAgent(content::GetContentClient()->GetUserAgent(), | |
| 73 false); | |
| 74 } | 67 } |
| 75 | 68 |
| 76 void TearDown() { | 69 void TearDown() { |
| 77 // Kill the service before the profile. | 70 // Kill the service before the profile. |
| 78 if (service.get()) { | 71 if (service.get()) { |
| 79 service->Shutdown(); | 72 service->Shutdown(); |
| 80 } | 73 } |
| 81 service.reset(); | 74 service.reset(); |
| 82 profile.reset(); | 75 profile.reset(); |
| 83 // Pump messages posted by the sync thread (which may end up | 76 // Pump messages posted by the sync thread (which may end up |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 namespace syncer { | 623 namespace syncer { |
| 631 namespace { | 624 namespace { |
| 632 | 625 |
| 633 // ProfileSyncService should behave just like an invalidator. | 626 // ProfileSyncService should behave just like an invalidator. |
| 634 INSTANTIATE_TYPED_TEST_CASE_P( | 627 INSTANTIATE_TYPED_TEST_CASE_P( |
| 635 ProfileSyncServiceInvalidatorTest, InvalidatorTest, | 628 ProfileSyncServiceInvalidatorTest, InvalidatorTest, |
| 636 ::browser_sync::ProfileSyncServiceInvalidatorTestDelegate); | 629 ::browser_sync::ProfileSyncServiceInvalidatorTestDelegate); |
| 637 | 630 |
| 638 } // namespace | 631 } // namespace |
| 639 } // namespace syncer | 632 } // namespace syncer |
| OLD | NEW |