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

Side by Side Diff: chrome/browser/profiles/profile_manager_browsertest.cc

Issue 15774008: Pass errors generated during limited-user registration up to the UI for display. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: One more switch statement Created 7 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/profiles/profile_info_cache.h" 8 #include "chrome/browser/profiles/profile_info_cache.h"
9 #include "chrome/browser/profiles/profile_info_cache_observer.h" 9 #include "chrome/browser/profiles/profile_info_cache_observer.h"
10 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
11 #include "chrome/browser/ui/browser_finder.h" 11 #include "chrome/browser/ui/browser_finder.h"
12 #include "chrome/browser/ui/browser_list.h" 12 #include "chrome/browser/ui/browser_list.h"
13 #include "chrome/browser/ui/host_desktop.h" 13 #include "chrome/browser/ui/host_desktop.h"
14 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
16 #include "chrome/test/base/testing_browser_process.h" 16 #include "chrome/test/base/testing_browser_process.h"
17 #include "chrome/test/base/ui_test_utils.h" 17 #include "chrome/test/base/ui_test_utils.h"
18 18
19 namespace { 19 namespace {
20 20
21 // An observer that returns back to test code after a new profile is 21 // An observer that returns back to test code after a new profile is
22 // initialized. 22 // initialized.
23 void OnUnblockOnProfileCreation(Profile* profile, 23 void OnUnblockOnProfileCreation(Profile* profile,
24 Profile::CreateStatus status) { 24 Profile::CreateStatus status) {
25 if (status == Profile::CREATE_STATUS_INITIALIZED) 25 if (status == Profile::CREATE_STATUS_INITIALIZED)
26 base::MessageLoop::current()->Quit(); 26 base::MessageLoop::current()->Quit();
27 } 27 }
28 28
29 void ProfileCreationComplete(Profile* profile, Profile::CreateStatus status) { 29 void ProfileCreationComplete(Profile* profile, Profile::CreateStatus status) {
30 ASSERT_NE(status, Profile::CREATE_STATUS_FAIL); 30 ASSERT_NE(status, Profile::CREATE_STATUS_LOCAL_FAIL);
31 ASSERT_NE(status, Profile::CREATE_STATUS_REMOTE_FAIL);
31 // No browser should have been created for this profile yet. 32 // No browser should have been created for this profile yet.
32 EXPECT_EQ(chrome::GetTotalBrowserCountForProfile(profile), 0U); 33 EXPECT_EQ(chrome::GetTotalBrowserCountForProfile(profile), 0U);
33 EXPECT_EQ(chrome::GetTotalBrowserCount(), 1U); 34 EXPECT_EQ(chrome::GetTotalBrowserCount(), 1U);
34 if (status == Profile::CREATE_STATUS_INITIALIZED) 35 if (status == Profile::CREATE_STATUS_INITIALIZED)
35 base::MessageLoop::current()->Quit(); 36 base::MessageLoop::current()->Quit();
36 } 37 }
37 38
38 class ProfileRemovalObserver : public ProfileInfoCacheObserver { 39 class ProfileRemovalObserver : public ProfileInfoCacheObserver {
39 public: 40 public:
40 ProfileRemovalObserver() { 41 ProfileRemovalObserver() {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 EXPECT_EQ(profile_manager->GetNumberOfProfiles(), 2U); 182 EXPECT_EQ(profile_manager->GetNumberOfProfiles(), 2U);
182 EXPECT_EQ(chrome::GetTotalBrowserCount(), 2U); 183 EXPECT_EQ(chrome::GetTotalBrowserCount(), 2U);
183 184
184 // Now close all browser windows. 185 // Now close all browser windows.
185 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); 186 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles();
186 for (std::vector<Profile*>::const_iterator it = profiles.begin(); 187 for (std::vector<Profile*>::const_iterator it = profiles.begin();
187 it != profiles.end(); ++it) { 188 it != profiles.end(); ++it) {
188 BrowserList::CloseAllBrowsersWithProfile(*it); 189 BrowserList::CloseAllBrowsersWithProfile(*it);
189 } 190 }
190 } 191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698