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/test/integration/sync_test.h" | 5 #include "chrome/browser/sync/test/integration/sync_test.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/process/launch.h" | 14 #include "base/process/launch.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
19 #include "base/test/test_timeouts.h" | 19 #include "base/test/test_timeouts.h" |
20 #include "base/threading/platform_thread.h" | 20 #include "base/threading/platform_thread.h" |
21 #include "base/values.h" | 21 #include "base/values.h" |
22 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 22 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
23 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" | 23 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" |
24 #include "chrome/browser/google/google_url_tracker.h" | 24 #include "chrome/browser/google/google_url_tracker.h" |
25 #include "chrome/browser/history/history_service_factory.h" | 25 #include "chrome/browser/history/history_service_factory.h" |
26 #include "chrome/browser/invalidation/invalidation_service_factory.h" | 26 #include "chrome/browser/invalidation/invalidation_service_factory.h" |
27 #include "chrome/browser/invalidation/p2p_invalidation_service.h" | 27 #include "chrome/browser/invalidation/p2p_invalidation_service.h" |
| 28 #include "chrome/browser/invalidation/profile_invalidation_auth_provider.h" |
28 #include "chrome/browser/lifetime/application_lifetime.h" | 29 #include "chrome/browser/lifetime/application_lifetime.h" |
29 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
30 #include "chrome/browser/profiles/profile_manager.h" | 31 #include "chrome/browser/profiles/profile_manager.h" |
31 #include "chrome/browser/search_engines/template_url_service.h" | 32 #include "chrome/browser/search_engines/template_url_service.h" |
32 #include "chrome/browser/search_engines/template_url_service_factory.h" | 33 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 34 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 35 #include "chrome/browser/signin/signin_manager.h" |
| 36 #include "chrome/browser/signin/signin_manager_factory.h" |
33 #include "chrome/browser/sync/profile_sync_service_factory.h" | 37 #include "chrome/browser/sync/profile_sync_service_factory.h" |
34 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 38 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
35 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 39 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
36 #include "chrome/browser/ui/browser.h" | 40 #include "chrome/browser/ui/browser.h" |
37 #include "chrome/browser/ui/browser_finder.h" | 41 #include "chrome/browser/ui/browser_finder.h" |
38 #include "chrome/browser/ui/host_desktop.h" | 42 #include "chrome/browser/ui/host_desktop.h" |
39 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 43 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 44 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
40 #include "chrome/common/chrome_paths.h" | 45 #include "chrome/common/chrome_paths.h" |
41 #include "chrome/common/chrome_switches.h" | 46 #include "chrome/common/chrome_switches.h" |
42 #include "chrome/test/base/testing_browser_process.h" | 47 #include "chrome/test/base/testing_browser_process.h" |
43 #include "chrome/test/base/ui_test_utils.h" | 48 #include "chrome/test/base/ui_test_utils.h" |
44 #include "components/os_crypt/os_crypt.h" | 49 #include "components/os_crypt/os_crypt.h" |
45 #include "content/public/browser/web_contents.h" | 50 #include "content/public/browser/web_contents.h" |
46 #include "content/public/test/test_browser_thread.h" | 51 #include "content/public/test/test_browser_thread.h" |
47 #include "google_apis/gaia/gaia_urls.h" | 52 #include "google_apis/gaia/gaia_urls.h" |
48 #include "net/base/escape.h" | 53 #include "net/base/escape.h" |
49 #include "net/base/load_flags.h" | 54 #include "net/base/load_flags.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const net::ProxyConfig& proxy_config) { | 105 const net::ProxyConfig& proxy_config) { |
101 net::ProxyService* proxy_service = | 106 net::ProxyService* proxy_service = |
102 url_request_context_getter->GetURLRequestContext()->proxy_service(); | 107 url_request_context_getter->GetURLRequestContext()->proxy_service(); |
103 proxy_service->ResetConfigService( | 108 proxy_service->ResetConfigService( |
104 new net::ProxyConfigServiceFixed(proxy_config)); | 109 new net::ProxyConfigServiceFixed(proxy_config)); |
105 done->Signal(); | 110 done->Signal(); |
106 } | 111 } |
107 | 112 |
108 KeyedService* BuildP2PInvalidationService(content::BrowserContext* context) { | 113 KeyedService* BuildP2PInvalidationService(content::BrowserContext* context) { |
109 Profile* profile = static_cast<Profile*>(context); | 114 Profile* profile = static_cast<Profile*>(context); |
110 return new invalidation::P2PInvalidationService(profile); | 115 return new invalidation::P2PInvalidationService( |
| 116 profile, |
| 117 scoped_ptr<invalidation::InvalidationAuthProvider>( |
| 118 new invalidation::ProfileInvalidationAuthProvider( |
| 119 SigninManagerFactory::GetForProfile(profile), |
| 120 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 121 LoginUIServiceFactory::GetForProfile(profile)))); |
111 } | 122 } |
112 | 123 |
113 SyncTest::SyncTest(TestType test_type) | 124 SyncTest::SyncTest(TestType test_type) |
114 : test_type_(test_type), | 125 : test_type_(test_type), |
115 server_type_(SERVER_TYPE_UNDECIDED), | 126 server_type_(SERVER_TYPE_UNDECIDED), |
116 num_clients_(-1), | 127 num_clients_(-1), |
117 use_verifier_(true), | 128 use_verifier_(true), |
118 notifications_enabled_(true), | 129 notifications_enabled_(true), |
119 test_server_handle_(base::kNullProcessHandle) { | 130 test_server_handle_(base::kNullProcessHandle) { |
120 sync_datatype_helper::AssociateWithTest(this); | 131 sync_datatype_helper::AssociateWithTest(this); |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 BrowserThread::IO, FROM_HERE, | 884 BrowserThread::IO, FROM_HERE, |
874 base::Bind(&SetProxyConfigCallback, &done, | 885 base::Bind(&SetProxyConfigCallback, &done, |
875 make_scoped_refptr(context_getter), proxy_config)); | 886 make_scoped_refptr(context_getter), proxy_config)); |
876 done.Wait(); | 887 done.Wait(); |
877 } | 888 } |
878 | 889 |
879 void SyncTest::UseFakeServer() { | 890 void SyncTest::UseFakeServer() { |
880 DCHECK_EQ(SERVER_TYPE_UNDECIDED, server_type_); | 891 DCHECK_EQ(SERVER_TYPE_UNDECIDED, server_type_); |
881 server_type_ = IN_PROCESS_FAKE_SERVER; | 892 server_type_ = IN_PROCESS_FAKE_SERVER; |
882 } | 893 } |
OLD | NEW |