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/invalidations/invalidator_storage.h" | 11 #include "chrome/browser/sync/invalidations/invalidator_storage.h" |
12 #include "chrome/browser/sync/sync_prefs.h" | 12 #include "chrome/browser/sync/sync_prefs.h" |
13 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
14 #include "content/public/test/test_browser_thread.h" | 14 #include "content/public/test/test_browser_thread.h" |
15 #include "content/public/test/test_url_fetcher_factory.h" | |
16 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 16 #include "net/url_request/test_url_fetcher_factory.h" |
17 #include "sync/internal_api/public/engine/model_safe_worker.h" | 17 #include "sync/internal_api/public/engine/model_safe_worker.h" |
18 #include "sync/internal_api/public/syncable/model_type.h" | 18 #include "sync/internal_api/public/syncable/model_type.h" |
19 #include "sync/internal_api/public/util/experiments.h" | 19 #include "sync/internal_api/public/util/experiments.h" |
20 #include "sync/protocol/encryption.pb.h" | 20 #include "sync/protocol/encryption.pb.h" |
21 #include "sync/protocol/sync_protocol_error.h" | 21 #include "sync/protocol/sync_protocol_error.h" |
22 #include "sync/util/test_unrecoverable_error_handler.h" | 22 #include "sync/util/test_unrecoverable_error_handler.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 | 25 |
26 using content::BrowserThread; | 26 using content::BrowserThread; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 private: | 81 private: |
82 MessageLoop ui_loop_; | 82 MessageLoop ui_loop_; |
83 content::TestBrowserThread ui_thread_; | 83 content::TestBrowserThread ui_thread_; |
84 content::TestBrowserThread io_thread_; | 84 content::TestBrowserThread io_thread_; |
85 }; | 85 }; |
86 | 86 |
87 TEST_F(SyncBackendHostTest, InitShutdown) { | 87 TEST_F(SyncBackendHostTest, InitShutdown) { |
88 std::string k_mock_url = "http://www.example.com"; | 88 std::string k_mock_url = "http://www.example.com"; |
89 FakeURLFetcherFactory test_factory_; | 89 net::FakeURLFetcherFactory test_factory_; |
90 test_factory_.SetFakeResponse(k_mock_url + "/time?command=get_time", "", | 90 test_factory_.SetFakeResponse(k_mock_url + "/time?command=get_time", "", |
91 false); | 91 false); |
92 | 92 |
93 TestingProfile profile; | 93 TestingProfile profile; |
94 profile.CreateRequestContext(); | 94 profile.CreateRequestContext(); |
95 | 95 |
96 SyncPrefs sync_prefs(profile.GetPrefs()); | 96 SyncPrefs sync_prefs(profile.GetPrefs()); |
97 InvalidatorStorage invalidator_storage(profile.GetPrefs()); | 97 InvalidatorStorage invalidator_storage(profile.GetPrefs()); |
98 SyncBackendHost backend(profile.GetDebugName(), | 98 SyncBackendHost backend(profile.GetDebugName(), |
99 &profile, sync_prefs.AsWeakPtr(), | 99 &profile, sync_prefs.AsWeakPtr(), |
(...skipping 12 matching lines...) Expand all Loading... |
112 true, | 112 true, |
113 &handler, | 113 &handler, |
114 NULL); | 114 NULL); |
115 backend.StopSyncingForShutdown(); | 115 backend.StopSyncingForShutdown(); |
116 backend.Shutdown(false); | 116 backend.Shutdown(false); |
117 } | 117 } |
118 | 118 |
119 // TODO(akalin): Write more SyncBackendHost unit tests. | 119 // TODO(akalin): Write more SyncBackendHost unit tests. |
120 | 120 |
121 } // namespace browser_sync | 121 } // namespace browser_sync |
OLD | NEW |