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 "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/sync_prefs.h" | 11 #include "chrome/browser/sync/sync_prefs.h" |
12 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
13 #include "content/test/test_browser_thread.h" | 13 #include "content/test/test_browser_thread.h" |
14 #include "content/test/test_url_fetcher_factory.h" | 14 #include "content/test/test_url_fetcher_factory.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 #include "sync/engine/model_safe_worker.h" | 16 #include "sync/engine/model_safe_worker.h" |
17 #include "sync/protocol/encryption.pb.h" | 17 #include "sync/protocol/encryption.pb.h" |
18 #include "sync/protocol/sync_protocol_error.h" | 18 #include "sync/protocol/sync_protocol_error.h" |
19 #include "sync/syncable/model_type.h" | 19 #include "sync/syncable/model_type.h" |
| 20 #include "sync/util/experiments.h" |
20 #include "sync/util/test_unrecoverable_error_handler.h" | 21 #include "sync/util/test_unrecoverable_error_handler.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 using content::BrowserThread; | 25 using content::BrowserThread; |
25 | 26 |
26 namespace browser_sync { | 27 namespace browser_sync { |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 class MockSyncFrontend : public SyncFrontend { | 31 class MockSyncFrontend : public SyncFrontend { |
31 public: | 32 public: |
32 virtual ~MockSyncFrontend() {} | 33 virtual ~MockSyncFrontend() {} |
33 | 34 |
34 MOCK_METHOD2(OnBackendInitialized, void(const WeakHandle<JsBackend>&, bool)); | 35 MOCK_METHOD2(OnBackendInitialized, void(const WeakHandle<JsBackend>&, bool)); |
35 MOCK_METHOD0(OnSyncCycleCompleted, void()); | 36 MOCK_METHOD0(OnSyncCycleCompleted, void()); |
36 MOCK_METHOD1(OnConnectionStatusChange, | 37 MOCK_METHOD1(OnConnectionStatusChange, |
37 void(sync_api::ConnectionStatus status)); | 38 void(sync_api::ConnectionStatus status)); |
38 MOCK_METHOD0(OnStopSyncingPermanently, void()); | 39 MOCK_METHOD0(OnStopSyncingPermanently, void()); |
39 MOCK_METHOD0(OnClearServerDataSucceeded, void()); | 40 MOCK_METHOD0(OnClearServerDataSucceeded, void()); |
40 MOCK_METHOD0(OnClearServerDataFailed, void()); | 41 MOCK_METHOD0(OnClearServerDataFailed, void()); |
41 MOCK_METHOD2(OnPassphraseRequired, | 42 MOCK_METHOD2(OnPassphraseRequired, |
42 void(sync_api::PassphraseRequiredReason, | 43 void(sync_api::PassphraseRequiredReason, |
43 const sync_pb::EncryptedData&)); | 44 const sync_pb::EncryptedData&)); |
44 MOCK_METHOD0(OnPassphraseAccepted, void()); | 45 MOCK_METHOD0(OnPassphraseAccepted, void()); |
45 MOCK_METHOD2(OnEncryptedTypesChanged, | 46 MOCK_METHOD2(OnEncryptedTypesChanged, |
46 void(syncable::ModelTypeSet, bool)); | 47 void(syncable::ModelTypeSet, bool)); |
47 MOCK_METHOD0(OnEncryptionComplete, void()); | 48 MOCK_METHOD0(OnEncryptionComplete, void()); |
48 MOCK_METHOD1(OnMigrationNeededForTypes, void(syncable::ModelTypeSet)); | 49 MOCK_METHOD1(OnMigrationNeededForTypes, void(syncable::ModelTypeSet)); |
49 MOCK_METHOD1(OnDataTypesChanged, void(syncable::ModelTypeSet)); | 50 MOCK_METHOD1(OnExperimentsChanged, |
| 51 void(const browser_sync::Experiments&)); |
50 MOCK_METHOD1(OnActionableError, | 52 MOCK_METHOD1(OnActionableError, |
51 void(const browser_sync::SyncProtocolError& sync_error)); | 53 void(const browser_sync::SyncProtocolError& sync_error)); |
52 MOCK_METHOD0(OnSyncConfigureRetry, void()); | 54 MOCK_METHOD0(OnSyncConfigureRetry, void()); |
53 }; | 55 }; |
54 | 56 |
55 } // namespace | 57 } // namespace |
56 | 58 |
57 class SyncBackendHostTest : public testing::Test { | 59 class SyncBackendHostTest : public testing::Test { |
58 protected: | 60 protected: |
59 SyncBackendHostTest() | 61 SyncBackendHostTest() |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 true, | 109 true, |
108 &handler, | 110 &handler, |
109 NULL); | 111 NULL); |
110 backend.StopSyncingForShutdown(); | 112 backend.StopSyncingForShutdown(); |
111 backend.Shutdown(false); | 113 backend.Shutdown(false); |
112 } | 114 } |
113 | 115 |
114 // TODO(akalin): Write more SyncBackendHost unit tests. | 116 // TODO(akalin): Write more SyncBackendHost unit tests. |
115 | 117 |
116 } // namespace browser_sync | 118 } // namespace browser_sync |
OLD | NEW |