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/test/live_sync/live_sync_test.h" | 5 #include "chrome/test/live_sync/live_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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 base::WaitableEvent* done_; | 102 base::WaitableEvent* done_; |
103 net::URLRequestContextGetter* url_request_context_getter_; | 103 net::URLRequestContextGetter* url_request_context_getter_; |
104 net::ProxyConfig proxy_config_; | 104 net::ProxyConfig proxy_config_; |
105 }; | 105 }; |
106 | 106 |
107 LiveSyncTest::LiveSyncTest(TestType test_type) | 107 LiveSyncTest::LiveSyncTest(TestType test_type) |
108 : sync_server_(net::TestServer::TYPE_SYNC, FilePath()), | 108 : sync_server_(net::TestServer::TYPE_SYNC, FilePath()), |
109 test_type_(test_type), | 109 test_type_(test_type), |
110 server_type_(SERVER_TYPE_UNDECIDED), | 110 server_type_(SERVER_TYPE_UNDECIDED), |
111 num_clients_(-1), | 111 num_clients_(-1), |
112 test_server_handle_(base::kNullProcessHandle) { | 112 test_server_handle_(base::kNullProcessHandle), |
| 113 use_verifier_prefs_(true) { |
113 InProcessBrowserTest::set_show_window(true); | 114 InProcessBrowserTest::set_show_window(true); |
114 switch (test_type_) { | 115 switch (test_type_) { |
115 case SINGLE_CLIENT: { | 116 case SINGLE_CLIENT: { |
116 num_clients_ = 1; | 117 num_clients_ = 1; |
117 break; | 118 break; |
118 } | 119 } |
119 case TWO_CLIENT: { | 120 case TWO_CLIENT: { |
120 num_clients_ = 2; | 121 num_clients_ = 2; |
121 break; | 122 break; |
122 } | 123 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 LOG(FATAL) << "GetClient(): Index is out of bounds."; | 241 LOG(FATAL) << "GetClient(): Index is out of bounds."; |
241 return clients_[index]; | 242 return clients_[index]; |
242 } | 243 } |
243 | 244 |
244 Profile* LiveSyncTest::verifier() { | 245 Profile* LiveSyncTest::verifier() { |
245 if (verifier_.get() == NULL) | 246 if (verifier_.get() == NULL) |
246 LOG(FATAL) << "SetupClients() has not yet been called."; | 247 LOG(FATAL) << "SetupClients() has not yet been called."; |
247 return verifier_.get(); | 248 return verifier_.get(); |
248 } | 249 } |
249 | 250 |
| 251 void LiveSyncTest::DisableVerifier() { |
| 252 use_verifier_prefs_ = false; |
| 253 } |
| 254 |
250 bool LiveSyncTest::SetupClients() { | 255 bool LiveSyncTest::SetupClients() { |
251 if (num_clients_ <= 0) | 256 if (num_clients_ <= 0) |
252 LOG(FATAL) << "num_clients_ incorrectly initialized."; | 257 LOG(FATAL) << "num_clients_ incorrectly initialized."; |
253 if (!profiles_.empty() || !clients_.empty()) | 258 if (!profiles_.empty() || !clients_.empty()) |
254 LOG(FATAL) << "SetupClients() has already been called."; | 259 LOG(FATAL) << "SetupClients() has already been called."; |
255 | 260 |
256 // Start up a sync test server if one is needed. | 261 // Start up a sync test server if one is needed. |
257 SetUpTestServerIfRequired(); | 262 SetUpTestServerIfRequired(); |
258 | 263 |
259 // Create the required number of sync profiles and clients. | 264 // Create the required number of sync profiles and clients. |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 const net::ProxyConfig& proxy_config) { | 515 const net::ProxyConfig& proxy_config) { |
511 base::WaitableEvent done(false, false); | 516 base::WaitableEvent done(false, false); |
512 BrowserThread::PostTask( | 517 BrowserThread::PostTask( |
513 BrowserThread::IO, | 518 BrowserThread::IO, |
514 FROM_HERE, | 519 FROM_HERE, |
515 new SetProxyConfigTask(&done, | 520 new SetProxyConfigTask(&done, |
516 context_getter, | 521 context_getter, |
517 proxy_config)); | 522 proxy_config)); |
518 done.Wait(); | 523 done.Wait(); |
519 } | 524 } |
OLD | NEW |