| 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 "chrome/browser/sync/glue/sync_backend_host.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "chrome/browser/sync/engine/model_safe_worker.h" | 11 #include "chrome/browser/sync/engine/model_safe_worker.h" |
| 12 #include "chrome/browser/sync/engine/syncapi.h" | 12 #include "chrome/browser/sync/engine/syncapi.h" |
| 13 #include "chrome/browser/sync/glue/data_type_controller.h" | 13 #include "chrome/browser/sync/glue/data_type_controller.h" |
| 14 #include "chrome/browser/sync/syncable/model_type.h" | 14 #include "chrome/browser/sync/syncable/model_type.h" |
| 15 #include "chrome/test/base/test_url_request_context_getter.h" | 15 #include "chrome/test/base/test_url_request_context_getter.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 17 #include "chrome/test/testing_browser_process_test.h" |
| 17 #include "content/browser/browser_thread.h" | 18 #include "content/browser/browser_thread.h" |
| 18 #include "content/common/url_fetcher.h" | 19 #include "content/common/url_fetcher.h" |
| 19 #include "content/test/test_url_fetcher_factory.h" | 20 #include "content/test/test_url_fetcher_factory.h" |
| 20 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 24 |
| 24 // TODO(akalin): Remove this once we fix the TODO below. | 25 // TODO(akalin): Remove this once we fix the TODO below. |
| 25 #include "chrome/browser/prefs/pref_service.h" | 26 #include "chrome/browser/prefs/pref_service.h" |
| 26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 40 MOCK_METHOD0(OnClearServerDataSucceeded, void()); | 41 MOCK_METHOD0(OnClearServerDataSucceeded, void()); |
| 41 MOCK_METHOD0(OnClearServerDataFailed, void()); | 42 MOCK_METHOD0(OnClearServerDataFailed, void()); |
| 42 MOCK_METHOD1(OnPassphraseRequired, void(sync_api::PassphraseRequiredReason)); | 43 MOCK_METHOD1(OnPassphraseRequired, void(sync_api::PassphraseRequiredReason)); |
| 43 MOCK_METHOD0(OnPassphraseAccepted, void()); | 44 MOCK_METHOD0(OnPassphraseAccepted, void()); |
| 44 MOCK_METHOD1(OnEncryptionComplete, void(const syncable::ModelTypeSet&)); | 45 MOCK_METHOD1(OnEncryptionComplete, void(const syncable::ModelTypeSet&)); |
| 45 MOCK_METHOD1(OnMigrationNeededForTypes, void(const syncable::ModelTypeSet&)); | 46 MOCK_METHOD1(OnMigrationNeededForTypes, void(const syncable::ModelTypeSet&)); |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 } // namespace | 49 } // namespace |
| 49 | 50 |
| 50 class SyncBackendHostTest : public testing::Test { | 51 class SyncBackendHostTest : public TestingBrowserProcessTest { |
| 51 protected: | 52 protected: |
| 52 SyncBackendHostTest() | 53 SyncBackendHostTest() |
| 53 : ui_thread_(BrowserThread::UI, &ui_loop_), | 54 : ui_thread_(BrowserThread::UI, &ui_loop_), |
| 54 io_thread_(BrowserThread::IO) {} | 55 io_thread_(BrowserThread::IO) {} |
| 55 | 56 |
| 56 virtual ~SyncBackendHostTest() {} | 57 virtual ~SyncBackendHostTest() {} |
| 57 | 58 |
| 58 virtual void SetUp() { | 59 virtual void SetUp() { |
| 59 base::Thread::Options options; | 60 base::Thread::Options options; |
| 60 options.message_loop_type = MessageLoop::TYPE_IO; | 61 options.message_loop_type = MessageLoop::TYPE_IO; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 EXPECT_EQ(types, state.initial_types); | 265 EXPECT_EQ(types, state.initial_types); |
| 265 EXPECT_TRUE(deleted_type); | 266 EXPECT_TRUE(deleted_type); |
| 266 | 267 |
| 267 EXPECT_TRUE(state.added_types.none()); | 268 EXPECT_TRUE(state.added_types.none()); |
| 268 } | 269 } |
| 269 } | 270 } |
| 270 | 271 |
| 271 // TODO(akalin): Write more SyncBackendHost unit tests. | 272 // TODO(akalin): Write more SyncBackendHost unit tests. |
| 272 | 273 |
| 273 } // namespace browser_sync | 274 } // namespace browser_sync |
| OLD | NEW |