| OLD | NEW |
| 1 // Use of this source code is governed by a BSD-style license that can be | 1 // Use of this source code is governed by a BSD-style license that can be |
| 2 // found in the LICENSE file. | 2 // found in the LICENSE file. |
| 3 | 3 |
| 4 #if defined(BROWSER_SYNC) | 4 #if defined(BROWSER_SYNC) |
| 5 | 5 |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 7 |
| 8 #include "base/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| 11 #include "chrome/browser/browser.h" | 11 #include "chrome/browser/browser.h" |
| 12 #include "chrome/browser/browser_list.h" | 12 #include "chrome/browser/browser_list.h" |
| 13 #include "chrome/browser/sync/profile_sync_service.h" | 13 #include "chrome/browser/sync/profile_sync_service.h" |
| 14 #include "chrome/browser/sync/sync_setup_flow.h" | 14 #include "chrome/browser/sync/sync_setup_flow.h" |
| 15 #include "chrome/browser/sync/sync_setup_wizard.h" | 15 #include "chrome/browser/sync/sync_setup_wizard.h" |
| 16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 17 #include "chrome/common/pref_service.h" | 17 #include "chrome/common/pref_service.h" |
| 18 #include "chrome/test/browser_with_test_window_test.h" | 18 #include "chrome/test/browser_with_test_window_test.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 168 |
| 169 TestBrowserWindowForWizardTest* test_window_; | 169 TestBrowserWindowForWizardTest* test_window_; |
| 170 scoped_ptr<SyncSetupWizard> wizard_; | 170 scoped_ptr<SyncSetupWizard> wizard_; |
| 171 ProfileSyncServiceForWizardTest* service_; | 171 ProfileSyncServiceForWizardTest* service_; |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 TEST_F(SyncSetupWizardTest, InitialStepLogin) { | 174 TEST_F(SyncSetupWizardTest, InitialStepLogin) { |
| 175 DictionaryValue dialog_args; | 175 DictionaryValue dialog_args; |
| 176 SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args); | 176 SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args); |
| 177 std::string json_start_args; | 177 std::string json_start_args; |
| 178 JSONWriter::Write(&dialog_args, false, &json_start_args); | 178 base::JSONWriter::Write(&dialog_args, false, &json_start_args); |
| 179 ListValue credentials; | 179 ListValue credentials; |
| 180 std::string auth = "{\"user\":\""; | 180 std::string auth = "{\"user\":\""; |
| 181 auth += std::string(kTestUser) + "\",\"pass\":\""; | 181 auth += std::string(kTestUser) + "\",\"pass\":\""; |
| 182 auth += std::string(kTestPassword) + "\"}"; | 182 auth += std::string(kTestPassword) + "\"}"; |
| 183 credentials.Append(new StringValue(auth)); | 183 credentials.Append(new StringValue(auth)); |
| 184 | 184 |
| 185 EXPECT_FALSE(wizard_->IsVisible()); | 185 EXPECT_FALSE(wizard_->IsVisible()); |
| 186 EXPECT_FALSE(test_window_->flow()); | 186 EXPECT_FALSE(test_window_->flow()); |
| 187 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); | 187 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); |
| 188 | 188 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 int error = -1; | 367 int error = -1; |
| 368 dialog_args.GetInteger(L"error", &error); | 368 dialog_args.GetInteger(L"error", &error); |
| 369 EXPECT_EQ(static_cast<int>(AUTH_ERROR_INVALID_GAIA_CREDENTIALS), error); | 369 EXPECT_EQ(static_cast<int>(AUTH_ERROR_INVALID_GAIA_CREDENTIALS), error); |
| 370 service_->set_auth_state(kTestUser, AUTH_ERROR_NONE); | 370 service_->set_auth_state(kTestUser, AUTH_ERROR_NONE); |
| 371 | 371 |
| 372 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); | 372 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); |
| 373 EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled()); | 373 EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled()); |
| 374 } | 374 } |
| 375 | 375 |
| 376 #endif // defined(BROWSER_SYNC) | 376 #endif // defined(BROWSER_SYNC) |
| OLD | NEW |