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

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

Issue 6627060: ImportantFileWriter: check return value of PostTask... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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
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/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 "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // In real life, this is owned by the view that is opened by the browser. We 171 // In real life, this is owned by the view that is opened by the browser. We
172 // mock all that out, so we need to take ownership so the flow doesn't leak. 172 // mock all that out, so we need to take ownership so the flow doesn't leak.
173 scoped_ptr<SyncSetupFlow> flow_; 173 scoped_ptr<SyncSetupFlow> flow_;
174 174
175 bool was_show_html_dialog_called_; 175 bool was_show_html_dialog_called_;
176 }; 176 };
177 177
178 class SyncSetupWizardTest : public BrowserWithTestWindowTest { 178 class SyncSetupWizardTest : public BrowserWithTestWindowTest {
179 public: 179 public:
180 SyncSetupWizardTest() 180 SyncSetupWizardTest()
181 : file_thread_(BrowserThread::FILE, MessageLoop::current()), 181 : test_window_(NULL),
182 test_window_(NULL),
183 wizard_(NULL) { } 182 wizard_(NULL) { }
184 virtual ~SyncSetupWizardTest() { } 183 virtual ~SyncSetupWizardTest() { }
185 virtual void SetUp() { 184 virtual void SetUp() {
186 set_profile(new TestingProfileWithSyncService()); 185 set_profile(new TestingProfileWithSyncService());
187 profile()->CreateBookmarkModel(false); 186 profile()->CreateBookmarkModel(false);
188 // Wait for the bookmarks model to load. 187 // Wait for the bookmarks model to load.
189 profile()->BlockUntilBookmarkModelLoaded(); 188 profile()->BlockUntilBookmarkModelLoaded();
190 set_browser(new Browser(Browser::TYPE_NORMAL, profile())); 189 set_browser(new Browser(Browser::TYPE_NORMAL, profile()));
191 test_window_ = new TestBrowserWindowForWizardTest(browser()); 190 test_window_ = new TestBrowserWindowForWizardTest(browser());
192 set_window(test_window_); 191 set_window(test_window_);
193 browser()->set_window(window()); 192 browser()->set_window(window());
194 BrowserList::SetLastActive(browser()); 193 BrowserList::SetLastActive(browser());
195 service_ = static_cast<ProfileSyncServiceForWizardTest*>( 194 service_ = static_cast<ProfileSyncServiceForWizardTest*>(
196 profile()->GetProfileSyncService()); 195 profile()->GetProfileSyncService());
197 wizard_.reset(new SyncSetupWizard(service_)); 196 wizard_.reset(new SyncSetupWizard(service_));
198 } 197 }
199 198
200 virtual void TearDown() { 199 virtual void TearDown() {
201 test_window_ = NULL; 200 test_window_ = NULL;
202 service_ = NULL; 201 service_ = NULL;
203 wizard_.reset(); 202 wizard_.reset();
204 } 203 }
205 204
206 BrowserThread file_thread_;
207 TestBrowserWindowForWizardTest* test_window_; 205 TestBrowserWindowForWizardTest* test_window_;
208 scoped_ptr<SyncSetupWizard> wizard_; 206 scoped_ptr<SyncSetupWizard> wizard_;
209 ProfileSyncServiceForWizardTest* service_; 207 ProfileSyncServiceForWizardTest* service_;
210 }; 208 };
211 209
212 // See http://code.google.com/p/chromium/issues/detail?id=40715 for 210 // See http://code.google.com/p/chromium/issues/detail?id=40715 for
213 // why we skip the below tests on OS X. We don't use DISABLED_ as we 211 // why we skip the below tests on OS X. We don't use DISABLED_ as we
214 // would have to change the corresponding FRIEND_TEST() declarations. 212 // would have to change the corresponding FRIEND_TEST() declarations.
215 213
216 #if defined(OS_MACOSX) 214 #if defined(OS_MACOSX)
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 int error = -1; 533 int error = -1;
536 dialog_args.GetInteger("error", &error); 534 dialog_args.GetInteger("error", &error);
537 EXPECT_EQ(static_cast<int>(AuthError::INVALID_GAIA_CREDENTIALS), error); 535 EXPECT_EQ(static_cast<int>(AuthError::INVALID_GAIA_CREDENTIALS), error);
538 service_->set_auth_state(kTestUser, AuthError::None()); 536 service_->set_auth_state(kTestUser, AuthError::None());
539 537
540 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); 538 wizard_->Step(SyncSetupWizard::GAIA_SUCCESS);
541 EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled()); 539 EXPECT_TRUE(test_window_->TestAndResetWasShowHTMLDialogCalled());
542 } 540 }
543 541
544 #undef SKIP_TEST_ON_MACOSX 542 #undef SKIP_TEST_ON_MACOSX
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager_unittest.cc ('k') | chrome/browser/ui/cocoa/browser_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698