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

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

Issue 8840003: Replace ProfileManagerObserver with callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo 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
« no previous file with comments | « chrome/browser/profiles/profile_manager_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_manager_unittest.cc
diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc
index 0edf118e0ba51b62d1eed76464d51b4c3c55d4ce..0182d90e70fa6cfbd944429155f4f3cd50e8a697 100644
--- a/chrome/browser/profiles/profile_manager_unittest.cc
+++ b/chrome/browser/profiles/profile_manager_unittest.cc
@@ -115,9 +115,10 @@ class ProfileManagerTest : public testing::Test {
message_loop_.RunAllPending();
}
- class MockObserver : public ProfileManagerObserver {
+ class MockObserver {
public:
- MOCK_METHOD2(OnProfileCreated, void(Profile* profile, Status status));
+ MOCK_METHOD2(OnProfileCreated,
+ void(Profile* profile, Profile::CreateStatus status));
};
#if defined(OS_CHROMEOS)
@@ -228,8 +229,8 @@ TEST_F(ProfileManagerTest, CreateAndUseTwoProfiles) {
}
MATCHER(NotFail, "Profile creation failure status is not reported.") {
- return arg == ProfileManagerObserver::STATUS_CREATED ||
- arg == ProfileManagerObserver::STATUS_INITIALIZED;
+ return arg == Profile::CREATE_STATUS_CREATED ||
+ arg == Profile::CREATE_STATUS_INITIALIZED;
}
// Tests asynchronous profile creation mechanism.
@@ -241,7 +242,9 @@ TEST_F(ProfileManagerTest, DISABLED_CreateProfileAsync) {
EXPECT_CALL(mock_observer, OnProfileCreated(
testing::NotNull(), NotFail())).Times(testing::AtLeast(1));
- profile_manager_->CreateProfileAsync(dest_path, &mock_observer);
+ profile_manager_->CreateProfileAsync(dest_path,
+ base::Bind(&MockObserver::OnProfileCreated,
+ base::Unretained(&mock_observer)));
message_loop_.RunAllPending();
}
@@ -268,9 +271,15 @@ TEST_F(ProfileManagerTest, CreateProfileAsyncMultipleRequests) {
EXPECT_CALL(mock_observer3, OnProfileCreated(
SameNotNull(), NotFail())).Times(testing::AtLeast(1));
- profile_manager_->CreateProfileAsync(dest_path, &mock_observer1);
- profile_manager_->CreateProfileAsync(dest_path, &mock_observer2);
- profile_manager_->CreateProfileAsync(dest_path, &mock_observer3);
+ profile_manager_->CreateProfileAsync(dest_path,
+ base::Bind(&MockObserver::OnProfileCreated,
+ base::Unretained(&mock_observer1)));
+ profile_manager_->CreateProfileAsync(dest_path,
+ base::Bind(&MockObserver::OnProfileCreated,
+ base::Unretained(&mock_observer2)));
+ profile_manager_->CreateProfileAsync(dest_path,
+ base::Bind(&MockObserver::OnProfileCreated,
+ base::Unretained(&mock_observer3)));
message_loop_.RunAllPending();
}
@@ -285,8 +294,12 @@ TEST_F(ProfileManagerTest, CreateProfilesAsync) {
EXPECT_CALL(mock_observer, OnProfileCreated(
testing::NotNull(), NotFail())).Times(testing::AtLeast(3));
- profile_manager_->CreateProfileAsync(dest_path1, &mock_observer);
- profile_manager_->CreateProfileAsync(dest_path2, &mock_observer);
+ profile_manager_->CreateProfileAsync(dest_path1,
+ base::Bind(&MockObserver::OnProfileCreated,
+ base::Unretained(&mock_observer)));
+ profile_manager_->CreateProfileAsync(dest_path2,
+ base::Bind(&MockObserver::OnProfileCreated,
+ base::Unretained(&mock_observer)));
message_loop_.RunAllPending();
}
« no previous file with comments | « chrome/browser/profiles/profile_manager_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698