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

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

Issue 7129009: Fix ProfileManagerTest.CreateProfileAsync failures on cros. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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) 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
11 #include "base/system_monitor/system_monitor.h" 11 #include "base/system_monitor/system_monitor.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/prefs/browser_prefs.h" 13 #include "chrome/browser/prefs/browser_prefs.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/common/chrome_constants.h" 16 #include "chrome/common/chrome_constants.h"
17 #include "chrome/common/chrome_paths.h" 17 #include "chrome/common/chrome_paths.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/test/testing_browser_process_test.h" 20 #include "chrome/test/testing_browser_process_test.h"
21 #include "chrome/test/testing_pref_service.h" 21 #include "chrome/test/testing_pref_service.h"
22 #include "content/browser/browser_thread.h" 22 #include "content/browser/browser_thread.h"
23 #include "content/common/notification_service.h" 23 #include "content/common/notification_service.h"
24 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
25 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
26 26
27 #if !defined(OS_CHROMEOS) // disable temporary while jam debugs debug failures
28
29 namespace { 27 namespace {
30 // This global variable is used to check that value returned to different 28 // This global variable is used to check that value returned to different
31 // observers is the same. 29 // observers is the same.
32 Profile* g_created_profile; 30 Profile* g_created_profile;
33 31
34 } // namespace 32 } // namespace
35 33
36 #endif
37
38 class ProfileManagerTest : public TestingBrowserProcessTest { 34 class ProfileManagerTest : public TestingBrowserProcessTest {
39 protected: 35 protected:
40 ProfileManagerTest() 36 ProfileManagerTest()
41 : ui_thread_(BrowserThread::UI, &message_loop_), 37 : ui_thread_(BrowserThread::UI, &message_loop_),
42 file_thread_(BrowserThread::FILE, &message_loop_), 38 file_thread_(BrowserThread::FILE, &message_loop_),
43 profile_manager_(new ProfileManagerWithoutInit), 39 profile_manager_(new ProfileManagerWithoutInit),
44 local_state_(testing_browser_process_.get()) { 40 local_state_(testing_browser_process_.get()) {
45 } 41 }
46 42
47 virtual void SetUp() { 43 virtual void SetUp() {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 169
174 // Make sure any pending tasks run before we destroy the profiles. 170 // Make sure any pending tasks run before we destroy the profiles.
175 message_loop_.RunAllPending(); 171 message_loop_.RunAllPending();
176 172
177 profile_manager_.reset(); 173 profile_manager_.reset();
178 174
179 // Make sure history cleans up correctly. 175 // Make sure history cleans up correctly.
180 message_loop_.RunAllPending(); 176 message_loop_.RunAllPending();
181 } 177 }
182 178
183 #if !defined(OS_CHROMEOS) // disable temporary while jam debugs debug failures
184
185 // Tests asynchronous profile creation mechanism. 179 // Tests asynchronous profile creation mechanism.
186 TEST_F(ProfileManagerTest, CreateProfileAsync) { 180 TEST_F(ProfileManagerTest, CreateProfileAsync) {
187 FilePath dest_path = 181 FilePath dest_path =
188 temp_dir_.path().Append(FILE_PATH_LITERAL("New Profile")); 182 temp_dir_.path().Append(FILE_PATH_LITERAL("New Profile"));
189 183
190 MockObserver mock_observer; 184 MockObserver mock_observer;
191 EXPECT_CALL(mock_observer, OnProfileCreated(testing::NotNull())).Times(1); 185 EXPECT_CALL(mock_observer, OnProfileCreated(testing::NotNull())).Times(1);
192 186
193 profile_manager_->CreateProfileAsync(dest_path, &mock_observer); 187 profile_manager_->CreateProfileAsync(dest_path, &mock_observer);
194 188
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 temp_dir_.path().Append(FILE_PATH_LITERAL("New Profile 2")); 222 temp_dir_.path().Append(FILE_PATH_LITERAL("New Profile 2"));
229 223
230 MockObserver mock_observer; 224 MockObserver mock_observer;
231 EXPECT_CALL(mock_observer, OnProfileCreated(testing::NotNull())).Times(2); 225 EXPECT_CALL(mock_observer, OnProfileCreated(testing::NotNull())).Times(2);
232 226
233 profile_manager_->CreateProfileAsync(dest_path1, &mock_observer); 227 profile_manager_->CreateProfileAsync(dest_path1, &mock_observer);
234 profile_manager_->CreateProfileAsync(dest_path2, &mock_observer); 228 profile_manager_->CreateProfileAsync(dest_path2, &mock_observer);
235 229
236 message_loop_.RunAllPending(); 230 message_loop_.RunAllPending();
237 } 231 }
238 #endif
239
OLDNEW
« no previous file with comments | « no previous file | chrome/test/testing_browser_process.cc » ('j') | chrome/test/testing_browser_process.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698