Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: chrome/browser/sync/sync_setup_wizard_unittest.cc

Issue 7649006: more changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another typo Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/sync_js_controller_unittest.cc ('k') | chrome/browser/sync/sync_ui_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/browser/sync/sync_setup_wizard.h" 5 #include "chrome/browser/sync/sync_setup_wizard.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 DictionaryValue dialog_args; 239 DictionaryValue dialog_args;
240 SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args); 240 SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args);
241 std::string json_start_args; 241 std::string json_start_args;
242 base::JSONWriter::Write(&dialog_args, false, &json_start_args); 242 base::JSONWriter::Write(&dialog_args, false, &json_start_args);
243 ListValue credentials; 243 ListValue credentials;
244 std::string auth = "{\"user\":\""; 244 std::string auth = "{\"user\":\"";
245 auth += std::string(kTestUser) + "\",\"pass\":\""; 245 auth += std::string(kTestUser) + "\",\"pass\":\"";
246 auth += std::string(kTestPassword) + "\",\"captcha\":\""; 246 auth += std::string(kTestPassword) + "\",\"captcha\":\"";
247 auth += std::string(kTestCaptcha) + "\",\"access_code\":\""; 247 auth += std::string(kTestCaptcha) + "\",\"access_code\":\"";
248 auth += std::string() + "\"}"; 248 auth += std::string() + "\"}";
249 credentials.Append(new StringValue(auth)); 249 credentials.Append(base::StringValue::New(auth));
250 250
251 EXPECT_FALSE(wizard_->IsVisible()); 251 EXPECT_FALSE(wizard_->IsVisible());
252 EXPECT_EQ(static_cast<SyncSetupFlow*>(NULL), flow_); 252 EXPECT_EQ(static_cast<SyncSetupFlow*>(NULL), flow_);
253 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); 253 wizard_->Step(SyncSetupWizard::GAIA_LOGIN);
254 AttachSyncSetupHandler(); 254 AttachSyncSetupHandler();
255 255
256 EXPECT_TRUE(wizard_->IsVisible()); 256 EXPECT_TRUE(wizard_->IsVisible());
257 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_); 257 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_);
258 EXPECT_EQ(SyncSetupWizard::DONE, flow_->end_state_); 258 EXPECT_EQ(SyncSetupWizard::DONE, flow_->end_state_);
259 EXPECT_EQ(json_start_args, flow_->dialog_start_args_); 259 EXPECT_EQ(json_start_args, flow_->dialog_start_args_);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); 320 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS);
321 wizard_->Step(SyncSetupWizard::CONFIGURE); 321 wizard_->Step(SyncSetupWizard::CONFIGURE);
322 322
323 ListValue data_type_choices_value; 323 ListValue data_type_choices_value;
324 std::string data_type_choices = 324 std::string data_type_choices =
325 "{\"keepEverythingSynced\":false,\"syncBookmarks\":true," 325 "{\"keepEverythingSynced\":false,\"syncBookmarks\":true,"
326 "\"syncPreferences\":true,\"syncThemes\":false,\"syncPasswords\":false," 326 "\"syncPreferences\":true,\"syncThemes\":false,\"syncPasswords\":false,"
327 "\"syncAutofill\":false,\"syncExtensions\":false,\"syncTypedUrls\":true," 327 "\"syncAutofill\":false,\"syncExtensions\":false,\"syncTypedUrls\":true,"
328 "\"syncApps\":true,\"syncSessions\":false,\"usePassphrase\":false," 328 "\"syncApps\":true,\"syncSessions\":false,\"usePassphrase\":false,"
329 "\"encryptAllData\":false}"; 329 "\"encryptAllData\":false}";
330 data_type_choices_value.Append(new StringValue(data_type_choices)); 330 data_type_choices_value.Append(base::StringValue::New(data_type_choices));
331 331
332 // Simulate the user choosing data types; bookmarks, prefs, typed URLS, and 332 // Simulate the user choosing data types; bookmarks, prefs, typed URLS, and
333 // apps are on, the rest are off. 333 // apps are on, the rest are off.
334 handler_.HandleConfigure(&data_type_choices_value); 334 handler_.HandleConfigure(&data_type_choices_value);
335 EXPECT_TRUE(wizard_->IsVisible()); 335 EXPECT_TRUE(wizard_->IsVisible());
336 EXPECT_FALSE(service_->keep_everything_synced_); 336 EXPECT_FALSE(service_->keep_everything_synced_);
337 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::BOOKMARKS)); 337 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::BOOKMARKS));
338 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::PREFERENCES)); 338 EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::PREFERENCES));
339 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::THEMES)); 339 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::THEMES));
340 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::PASSWORDS)); 340 EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::PASSWORDS));
(...skipping 10 matching lines...) Expand all
351 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); 351 wizard_->Step(SyncSetupWizard::GAIA_LOGIN);
352 AttachSyncSetupHandler(); 352 AttachSyncSetupHandler();
353 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); 353 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS);
354 wizard_->Step(SyncSetupWizard::CONFIGURE); 354 wizard_->Step(SyncSetupWizard::CONFIGURE);
355 wizard_->Step(SyncSetupWizard::SETTING_UP); 355 wizard_->Step(SyncSetupWizard::SETTING_UP);
356 service_->set_passphrase_required_reason(sync_api::REASON_ENCRYPTION); 356 service_->set_passphrase_required_reason(sync_api::REASON_ENCRYPTION);
357 wizard_->Step(SyncSetupWizard::ENTER_PASSPHRASE); 357 wizard_->Step(SyncSetupWizard::ENTER_PASSPHRASE);
358 EXPECT_EQ(SyncSetupWizard::ENTER_PASSPHRASE, flow_->current_state_); 358 EXPECT_EQ(SyncSetupWizard::ENTER_PASSPHRASE, flow_->current_state_);
359 359
360 ListValue value; 360 ListValue value;
361 value.Append(new StringValue("{\"passphrase\":\"myPassphrase\"," 361 value.Append(base::StringValue::New("{\"passphrase\":\"myPassphrase\","
362 "\"mode\":\"gaia\"}")); 362 "\"mode\":\"gaia\"}"));
363 handler_.HandlePassphraseEntry(&value); 363 handler_.HandlePassphraseEntry(&value);
364 EXPECT_EQ("myPassphrase", service_->passphrase_); 364 EXPECT_EQ("myPassphrase", service_->passphrase_);
365 CloseSetupUI(); 365 CloseSetupUI();
366 } 366 }
367 367
368 TEST_F(SyncSetupWizardTest, DialogCancelled) { 368 TEST_F(SyncSetupWizardTest, DialogCancelled) {
369 SKIP_TEST_ON_MACOSX(); 369 SKIP_TEST_ON_MACOSX();
370 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); 370 wizard_->Step(SyncSetupWizard::GAIA_LOGIN);
371 AttachSyncSetupHandler(); 371 AttachSyncSetupHandler();
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 AuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE)); 581 AuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE));
582 wizard_->Step(SyncSetupWizard::NONFATAL_ERROR); 582 wizard_->Step(SyncSetupWizard::NONFATAL_ERROR);
583 AttachSyncSetupHandler(); 583 AttachSyncSetupHandler();
584 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_); 584 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_);
585 EXPECT_EQ(SyncSetupWizard::DONE, flow_->end_state_); 585 EXPECT_EQ(SyncSetupWizard::DONE, flow_->end_state_);
586 CloseSetupUI(); 586 CloseSetupUI();
587 EXPECT_FALSE(wizard_->IsVisible()); 587 EXPECT_FALSE(wizard_->IsVisible());
588 } 588 }
589 589
590 #undef SKIP_TEST_ON_MACOSX 590 #undef SKIP_TEST_ON_MACOSX
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_js_controller_unittest.cc ('k') | chrome/browser/sync/sync_ui_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698