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

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

Issue 441008: Many changes to DictionaryValues:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 // Simulate failed credentials. 222 // Simulate failed credentials.
223 AuthError invalid_gaia(AuthError::INVALID_GAIA_CREDENTIALS); 223 AuthError invalid_gaia(AuthError::INVALID_GAIA_CREDENTIALS);
224 service_->set_auth_state(kTestUser, invalid_gaia); 224 service_->set_auth_state(kTestUser, invalid_gaia);
225 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); 225 wizard_->Step(SyncSetupWizard::GAIA_LOGIN);
226 EXPECT_TRUE(wizard_->IsVisible()); 226 EXPECT_TRUE(wizard_->IsVisible());
227 EXPECT_FALSE(test_window_->TestAndResetWasShowHTMLDialogCalled()); 227 EXPECT_FALSE(test_window_->TestAndResetWasShowHTMLDialogCalled());
228 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, test_window_->flow()->current_state_); 228 EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, test_window_->flow()->current_state_);
229 dialog_args.Clear(); 229 dialog_args.Clear();
230 SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args); 230 SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args);
231 EXPECT_TRUE(3 == dialog_args.GetSize()); 231 EXPECT_EQ(3U, dialog_args.size());
232 std::string actual_user; 232 std::string actual_user;
233 dialog_args.GetString(L"user", &actual_user); 233 dialog_args.GetString(L"user", &actual_user);
234 EXPECT_EQ(kTestUser, actual_user); 234 EXPECT_EQ(kTestUser, actual_user);
235 int error = -1; 235 int error = -1;
236 dialog_args.GetInteger(L"error", &error); 236 dialog_args.GetInteger(L"error", &error);
237 EXPECT_EQ(static_cast<int>(AuthError::INVALID_GAIA_CREDENTIALS), error); 237 EXPECT_EQ(static_cast<int>(AuthError::INVALID_GAIA_CREDENTIALS), error);
238 service_->set_auth_state(kTestUser, AuthError::None()); 238 service_->set_auth_state(kTestUser, AuthError::None());
239 239
240 // Simulate captcha. 240 // Simulate captcha.
241 AuthError captcha_error(AuthError::FromCaptchaChallenge( 241 AuthError captcha_error(AuthError::FromCaptchaChallenge(
242 std::string(), GURL(kTestCaptchaUrl), GURL())); 242 std::string(), GURL(kTestCaptchaUrl), GURL()));
243 service_->set_auth_state(kTestUser, captcha_error); 243 service_->set_auth_state(kTestUser, captcha_error);
244 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); 244 wizard_->Step(SyncSetupWizard::GAIA_LOGIN);
245 SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args); 245 SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args);
246 EXPECT_TRUE(3 == dialog_args.GetSize()); 246 EXPECT_EQ(3U, dialog_args.size());
247 std::string captcha_url; 247 std::string captcha_url;
248 dialog_args.GetString(L"captchaUrl", &captcha_url); 248 dialog_args.GetString(L"captchaUrl", &captcha_url);
249 EXPECT_EQ(kTestCaptchaUrl, GURL(captcha_url).spec()); 249 EXPECT_EQ(kTestCaptchaUrl, GURL(captcha_url).spec());
250 error = -1; 250 error = -1;
251 dialog_args.GetInteger(L"error", &error); 251 dialog_args.GetInteger(L"error", &error);
252 EXPECT_EQ(static_cast<int>(AuthError::CAPTCHA_REQUIRED), error); 252 EXPECT_EQ(static_cast<int>(AuthError::CAPTCHA_REQUIRED), error);
253 service_->set_auth_state(kTestUser, AuthError::None()); 253 service_->set_auth_state(kTestUser, AuthError::None());
254 254
255 // Simulate success. 255 // Simulate success.
256 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); 256 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled()); 387 EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled());
388 388
389 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); 389 wizard_->Step(SyncSetupWizard::GAIA_LOGIN);
390 EXPECT_EQ(SyncSetupWizard::GAIA_SUCCESS, test_window_->flow()->end_state_); 390 EXPECT_EQ(SyncSetupWizard::GAIA_SUCCESS, test_window_->flow()->end_state_);
391 391
392 AuthError invalid_gaia(AuthError::INVALID_GAIA_CREDENTIALS); 392 AuthError invalid_gaia(AuthError::INVALID_GAIA_CREDENTIALS);
393 service_->set_auth_state(kTestUser, invalid_gaia); 393 service_->set_auth_state(kTestUser, invalid_gaia);
394 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); 394 wizard_->Step(SyncSetupWizard::GAIA_LOGIN);
395 EXPECT_TRUE(wizard_->IsVisible()); 395 EXPECT_TRUE(wizard_->IsVisible());
396 SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args); 396 SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args);
397 EXPECT_TRUE(3 == dialog_args.GetSize()); 397 EXPECT_EQ(3U, dialog_args.size());
398 std::string actual_user; 398 std::string actual_user;
399 dialog_args.GetString(L"user", &actual_user); 399 dialog_args.GetString(L"user", &actual_user);
400 EXPECT_EQ(kTestUser, actual_user); 400 EXPECT_EQ(kTestUser, actual_user);
401 int error = -1; 401 int error = -1;
402 dialog_args.GetInteger(L"error", &error); 402 dialog_args.GetInteger(L"error", &error);
403 EXPECT_EQ(static_cast<int>(AuthError::INVALID_GAIA_CREDENTIALS), error); 403 EXPECT_EQ(static_cast<int>(AuthError::INVALID_GAIA_CREDENTIALS), error);
404 service_->set_auth_state(kTestUser, AuthError::None()); 404 service_->set_auth_state(kTestUser, AuthError::None());
405 405
406 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); 406 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS);
407 EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled()); 407 EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled());
408 } 408 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698