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

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

Issue 3127017: Revert 56423 - Added classes to enable session sync functionality.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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_setup_flow.cc ('k') | chrome/browser/sync/syncable/model_type.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // In real life, this is owned by the view that is opened by the browser. We 157 // In real life, this is owned by the view that is opened by the browser. We
158 // mock all that out, so we need to take ownership so the flow doesn't leak. 158 // mock all that out, so we need to take ownership so the flow doesn't leak.
159 scoped_ptr<SyncSetupFlow> flow_; 159 scoped_ptr<SyncSetupFlow> flow_;
160 160
161 bool was_show_html_dialog_called_; 161 bool was_show_html_dialog_called_;
162 }; 162 };
163 163
164 class SyncSetupWizardTest : public BrowserWithTestWindowTest { 164 class SyncSetupWizardTest : public BrowserWithTestWindowTest {
165 public: 165 public:
166 SyncSetupWizardTest() 166 SyncSetupWizardTest()
167 : file_thread_(ChromeThread::FILE, MessageLoop::current()), 167 : ui_thread_(ChromeThread::UI, MessageLoop::current()),
168 file_thread_(ChromeThread::FILE, MessageLoop::current()),
168 test_window_(NULL), 169 test_window_(NULL),
169 wizard_(NULL) { } 170 wizard_(NULL) { }
170 virtual ~SyncSetupWizardTest() { } 171 virtual ~SyncSetupWizardTest() { }
171 virtual void SetUp() { 172 virtual void SetUp() {
172 set_profile(new TestingProfileWithSyncService()); 173 set_profile(new TestingProfileWithSyncService());
173 profile()->CreateBookmarkModel(false); 174 profile()->CreateBookmarkModel(false);
174 // Wait for the bookmarks model to load. 175 // Wait for the bookmarks model to load.
175 profile()->BlockUntilBookmarkModelLoaded(); 176 profile()->BlockUntilBookmarkModelLoaded();
176 set_browser(new Browser(Browser::TYPE_NORMAL, profile())); 177 set_browser(new Browser(Browser::TYPE_NORMAL, profile()));
177 test_window_ = new TestBrowserWindowForWizardTest(browser()); 178 test_window_ = new TestBrowserWindowForWizardTest(browser());
178 set_window(test_window_); 179 set_window(test_window_);
179 browser()->set_window(window()); 180 browser()->set_window(window());
180 BrowserList::SetLastActive(browser()); 181 BrowserList::SetLastActive(browser());
181 service_ = static_cast<ProfileSyncServiceForWizardTest*>( 182 service_ = static_cast<ProfileSyncServiceForWizardTest*>(
182 profile()->GetProfileSyncService()); 183 profile()->GetProfileSyncService());
183 wizard_.reset(new SyncSetupWizard(service_)); 184 wizard_.reset(new SyncSetupWizard(service_));
184 } 185 }
185 186
186 virtual void TearDown() { 187 virtual void TearDown() {
187 test_window_ = NULL; 188 test_window_ = NULL;
188 service_ = NULL; 189 service_ = NULL;
189 wizard_.reset(); 190 wizard_.reset();
190 } 191 }
191 192
193 ChromeThread ui_thread_;
192 ChromeThread file_thread_; 194 ChromeThread file_thread_;
193 TestBrowserWindowForWizardTest* test_window_; 195 TestBrowserWindowForWizardTest* test_window_;
194 scoped_ptr<SyncSetupWizard> wizard_; 196 scoped_ptr<SyncSetupWizard> wizard_;
195 ProfileSyncServiceForWizardTest* service_; 197 ProfileSyncServiceForWizardTest* service_;
196 }; 198 };
197 199
198 // See http://code.google.com/p/chromium/issues/detail?id=40715 for 200 // See http://code.google.com/p/chromium/issues/detail?id=40715 for
199 // why we skip the below tests on OS X. We don't use DISABLED_ as we 201 // why we skip the below tests on OS X. We don't use DISABLED_ as we
200 // would have to change the corresponding FRIEND_TEST() declarations. 202 // would have to change the corresponding FRIEND_TEST() declarations.
201 203
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 TEST_F(SyncSetupWizardTest, ChooseDataTypesSetsPrefs) { 299 TEST_F(SyncSetupWizardTest, ChooseDataTypesSetsPrefs) {
298 SKIP_TEST_ON_MACOSX(); 300 SKIP_TEST_ON_MACOSX();
299 wizard_->Step(SyncSetupWizard::GAIA_LOGIN); 301 wizard_->Step(SyncSetupWizard::GAIA_LOGIN);
300 wizard_->Step(SyncSetupWizard::CHOOSE_DATA_TYPES); 302 wizard_->Step(SyncSetupWizard::CHOOSE_DATA_TYPES);
301 303
302 ListValue data_type_choices_value; 304 ListValue data_type_choices_value;
303 std::string data_type_choices = "{\"keepEverythingSynced\":false,"; 305 std::string data_type_choices = "{\"keepEverythingSynced\":false,";
304 data_type_choices += "\"syncBookmarks\":true,\"syncPreferences\":true,"; 306 data_type_choices += "\"syncBookmarks\":true,\"syncPreferences\":true,";
305 data_type_choices += "\"syncThemes\":false,\"syncPasswords\":false,"; 307 data_type_choices += "\"syncThemes\":false,\"syncPasswords\":false,";
306 data_type_choices += "\"syncAutofill\":false,\"syncExtensions\":false,"; 308 data_type_choices += "\"syncAutofill\":false,\"syncExtensions\":false,";
307 data_type_choices += "\"syncTypedUrls\":true,\"syncApps\":true,"; 309 data_type_choices += "\"syncTypedUrls\":true,\"syncApps\":true}";
308 data_type_choices += "\"syncSessions\":false}";
309 data_type_choices_value.Append(new StringValue(data_type_choices)); 310 data_type_choices_value.Append(new StringValue(data_type_choices));
310 311
311 // Simulate the user choosing data types; bookmarks, prefs, typed 312 // Simulate the user choosing data types; bookmarks, prefs, typed
312 // URLS, and apps are on, the rest are off. 313 // URLS, and apps are on, the rest are off.
313 test_window_->flow()->flow_handler_->HandleChooseDataTypes( 314 test_window_->flow()->flow_handler_->HandleChooseDataTypes(
314 &data_type_choices_value); 315 &data_type_choices_value);
315 EXPECT_TRUE(wizard_->IsVisible()); 316 EXPECT_TRUE(wizard_->IsVisible());
316 EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled()); 317 EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled());
317 EXPECT_FALSE(service_->keep_everything_synced_); 318 EXPECT_FALSE(service_->keep_everything_synced_);
318 EXPECT_EQ(service_->chosen_data_types_.count(syncable::BOOKMARKS), 1U); 319 EXPECT_EQ(service_->chosen_data_types_.count(syncable::BOOKMARKS), 1U);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 int error = -1; 483 int error = -1;
483 dialog_args.GetInteger("error", &error); 484 dialog_args.GetInteger("error", &error);
484 EXPECT_EQ(static_cast<int>(AuthError::INVALID_GAIA_CREDENTIALS), error); 485 EXPECT_EQ(static_cast<int>(AuthError::INVALID_GAIA_CREDENTIALS), error);
485 service_->set_auth_state(kTestUser, AuthError::None()); 486 service_->set_auth_state(kTestUser, AuthError::None());
486 487
487 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); 488 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS);
488 EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled()); 489 EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled());
489 } 490 }
490 491
491 #undef SKIP_TEST_ON_MACOSX 492 #undef SKIP_TEST_ON_MACOSX
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_setup_flow.cc ('k') | chrome/browser/sync/syncable/model_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698