| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 std::string relative_url = base::StringPrintf("/CreateUsers?%s=%s", | 319 std::string relative_url = base::StringPrintf("/CreateUsers?%s=%s", |
| 320 username.c_str(), | 320 username.c_str(), |
| 321 password.c_str()); | 321 password.c_str()); |
| 322 GURL create_user_url = | 322 GURL create_user_url = |
| 323 GaiaUrls::GetInstance()->gaia_url().Resolve(relative_url); | 323 GaiaUrls::GetInstance()->gaia_url().Resolve(relative_url); |
| 324 // NavigateToURL blocks until the navigation finishes. | 324 // NavigateToURL blocks until the navigation finishes. |
| 325 ui_test_utils::NavigateToURL(browser(), create_user_url); | 325 ui_test_utils::NavigateToURL(browser(), create_user_url); |
| 326 content::WebContents* contents = | 326 content::WebContents* contents = |
| 327 browser()->tab_strip_model()->GetActiveWebContents(); | 327 browser()->tab_strip_model()->GetActiveWebContents(); |
| 328 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); | 328 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); |
| 329 CHECK(entry) << "Could not get a hold on NavigationEntry post URL navigate."; | 329 // Could not get a hold on NavigationEntry post URL navigate. |
| 330 CHECK(entry); |
| 330 DVLOG(1) << "Create Gaia account request return code = " | 331 DVLOG(1) << "Create Gaia account request return code = " |
| 331 << entry->GetHttpStatusCode(); | 332 << entry->GetHttpStatusCode(); |
| 332 return entry->GetHttpStatusCode() == 200; | 333 return entry->GetHttpStatusCode() == 200; |
| 333 } | 334 } |
| 334 | 335 |
| 335 void SyncTest::CreateProfile(int index) { | 336 void SyncTest::CreateProfile(int index) { |
| 336 tmp_profile_paths_[index] = new base::ScopedTempDir(); | 337 tmp_profile_paths_[index] = new base::ScopedTempDir(); |
| 337 if (UsingExternalServers() && num_clients_ > 1) { | 338 if (UsingExternalServers() && num_clients_ > 1) { |
| 338 // For multi profile UI signin, profile paths should be outside user data | 339 // For multi profile UI signin, profile paths should be outside user data |
| 339 // dir to allow signing-in multiple profiles to same account. Otherwise, we | 340 // dir to allow signing-in multiple profiles to same account. Otherwise, we |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 profiles_.resize(num_clients_); | 487 profiles_.resize(num_clients_); |
| 487 profile_delegates_.resize(num_clients_ + 1); // + 1 for the verifier. | 488 profile_delegates_.resize(num_clients_ + 1); // + 1 for the verifier. |
| 488 tmp_profile_paths_.resize(num_clients_); | 489 tmp_profile_paths_.resize(num_clients_); |
| 489 browsers_.resize(num_clients_); | 490 browsers_.resize(num_clients_); |
| 490 clients_.resize(num_clients_); | 491 clients_.resize(num_clients_); |
| 491 invalidation_forwarders_.resize(num_clients_); | 492 invalidation_forwarders_.resize(num_clients_); |
| 492 sync_refreshers_.resize(num_clients_); | 493 sync_refreshers_.resize(num_clients_); |
| 493 fake_server_invalidation_services_.resize(num_clients_); | 494 fake_server_invalidation_services_.resize(num_clients_); |
| 494 | 495 |
| 495 if (create_gaia_account_at_runtime_) { | 496 if (create_gaia_account_at_runtime_) { |
| 496 CHECK(UsingExternalServers()) << | 497 // Cannot create Gaia accounts without external authentication servers |
| 497 "Cannot create Gaia accounts without external authentication servers"; | 498 CHECK(UsingExternalServers()); |
| 498 if (!CreateGaiaAccount(username_, password_)) | 499 if (!CreateGaiaAccount(username_, password_)) |
| 499 LOG(FATAL) << "Could not create Gaia account."; | 500 LOG(FATAL) << "Could not create Gaia account."; |
| 500 } | 501 } |
| 501 | 502 |
| 502 for (int i = 0; i < num_clients_; ++i) { | 503 for (int i = 0; i < num_clients_; ++i) { |
| 503 CreateProfile(i); | 504 CreateProfile(i); |
| 504 } | 505 } |
| 505 | 506 |
| 506 // Verifier account is not useful when running against external servers. | 507 // Verifier account is not useful when running against external servers. |
| 507 if (UsingExternalServers()) | 508 if (UsingExternalServers()) |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 | 1130 |
| 1130 void SyncTest::TriggerSyncForModelTypes(int index, | 1131 void SyncTest::TriggerSyncForModelTypes(int index, |
| 1131 syncer::ModelTypeSet model_types) { | 1132 syncer::ModelTypeSet model_types) { |
| 1132 GetSyncService(index)->TriggerRefresh(model_types); | 1133 GetSyncService(index)->TriggerRefresh(model_types); |
| 1133 } | 1134 } |
| 1134 | 1135 |
| 1135 void SyncTest::SetPreexistingPreferencesFileContents( | 1136 void SyncTest::SetPreexistingPreferencesFileContents( |
| 1136 const std::string& contents) { | 1137 const std::string& contents) { |
| 1137 preexisting_preferences_file_contents_ = contents; | 1138 preexisting_preferences_file_contents_ = contents; |
| 1138 } | 1139 } |
| OLD | NEW |