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

Unified Diff: chrome/browser/profiles/profile_manager_browsertest.cc

Issue 8840003: Replace ProfileManagerObserver with callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: weakptr Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_manager_browsertest.cc
diff --git a/chrome/browser/profiles/profile_manager_browsertest.cc b/chrome/browser/profiles/profile_manager_browsertest.cc
index 3953fa215aae9614fae37f8ceb7925d4bf16af0b..50bff3202fe4dffff4f0d02a793b74c9b0e6faff 100644
--- a/chrome/browser/profiles/profile_manager_browsertest.cc
+++ b/chrome/browser/profiles/profile_manager_browsertest.cc
@@ -8,6 +8,18 @@
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/ui_test_utils.h"
+namespace {
+
+// An observer that returns back to test code after a new profile is
+// initialized.
+void OnUnblockOnProfileCreation(Profile* profile,
+ Profile::CreateStatus status) {
+ if (status == Profile::CREATE_STATUS_INITIALIZED)
+ MessageLoop::current()->Quit();
+}
+
+} // namespace
+
// This file contains tests for the ProfileManager that require a heavyweight
// InProcessBrowserTest. These include tests involving profile deletion.
@@ -15,17 +27,6 @@
// platforms.
#if defined(OS_MACOSX)
class ProfileManagerBrowserTest : public InProcessBrowserTest {
- protected:
- // An observer that returns back to test code after a new profile
- // is initialized.
- class BlockOnProfileInitObserver : public ProfileManagerObserver {
- public:
- void OnProfileCreated(Profile* profile, Status status) {
- if (status == ProfileManagerObserver::STATUS_INITIALIZED) {
- MessageLoop::current()->Quit();
- }
- }
- };
};
// Delete single profile and make sure a new one is created.
@@ -69,12 +70,12 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, MAYBE_DeleteAllProfiles) {
ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
// Create an additional profile.
- BlockOnProfileInitObserver observer;
FilePath new_path = profile_manager->GenerateNextProfileDirectoryPath();
- profile_manager->CreateProfileAsync(new_path, &observer);
+ profile_manager->CreateProfileAsync(new_path,
+ base::Bind(&OnUnblockOnProfileCreation));
// Spin to allow profile creation to take place, loop is terminated
- // by BlockOnProfileInitObserver when the profile is created.
+ // by OnUnblockOnProfileCreation when the profile is created.
ui_test_utils::RunMessageLoop();
ASSERT_EQ(cache.GetNumberOfProfiles(), 2U);

Powered by Google App Engine
This is Rietveld 408576698