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

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

Issue 7744039: Switch ChromeTestSuite to the same convention as ContentTestSuite: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixing Created 9 years, 4 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/browser_process.h"
13 #include "chrome/browser/extensions/extension_event_router_forwarder.h" 14 #include "chrome/browser/extensions/extension_event_router_forwarder.h"
14 #include "chrome/browser/io_thread.h" 15 #include "chrome/browser/io_thread.h"
15 #include "chrome/browser/prefs/browser_prefs.h" 16 #include "chrome/browser/prefs/browser_prefs.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/common/chrome_constants.h" 19 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/chrome_notification_types.h" 20 #include "chrome/common/chrome_notification_types.h"
20 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
21 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
23 #include "chrome/test/base/testing_browser_process_test.h" 24 #include "chrome/test/base/testing_browser_process.h"
24 #include "chrome/test/base/testing_pref_service.h" 25 #include "chrome/test/base/testing_pref_service.h"
25 #include "content/browser/browser_thread.h" 26 #include "content/browser/browser_thread.h"
26 #include "content/common/notification_service.h" 27 #include "content/common/notification_service.h"
27 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
28 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
29 30
30 namespace { 31 namespace {
31 // This global variable is used to check that value returned to different 32 // This global variable is used to check that value returned to different
32 // observers is the same. 33 // observers is the same.
33 Profile* g_created_profile; 34 Profile* g_created_profile;
34 35
35 } // namespace 36 } // namespace
36 37
37 class ProfileManagerTest : public TestingBrowserProcessTest { 38 class ProfileManagerTest : public testing::Test {
38 protected: 39 protected:
39 ProfileManagerTest() 40 ProfileManagerTest()
40 : local_state_(testing_browser_process_.get()), 41 : local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)),
41 extension_event_router_forwarder_(new ExtensionEventRouterForwarder), 42 extension_event_router_forwarder_(new ExtensionEventRouterForwarder),
42 ui_thread_(BrowserThread::UI, &message_loop_), 43 ui_thread_(BrowserThread::UI, &message_loop_),
43 db_thread_(BrowserThread::DB, &message_loop_), 44 db_thread_(BrowserThread::DB, &message_loop_),
44 file_thread_(BrowserThread::FILE, &message_loop_), 45 file_thread_(BrowserThread::FILE, &message_loop_),
45 io_thread_(local_state_.Get(), NULL, extension_event_router_forwarder_), 46 io_thread_(local_state_.Get(), NULL, extension_event_router_forwarder_),
46 profile_manager_(new ProfileManagerWithoutInit) { 47 profile_manager_(new ProfileManagerWithoutInit) {
47 #if defined(OS_MACOSX) 48 #if defined(OS_MACOSX)
48 base::SystemMonitor::AllocateSystemIOPorts(); 49 base::SystemMonitor::AllocateSystemIOPorts();
49 #endif 50 #endif
50 system_monitor_dummy_.reset(new base::SystemMonitor); 51 system_monitor_dummy_.reset(new base::SystemMonitor);
51 testing_browser_process_.get()->SetIOThread(&io_thread_); 52 static_cast<TestingBrowserProcess*>(g_browser_process)->SetIOThread(
53 &io_thread_);
52 } 54 }
53 55
54 virtual void SetUp() { 56 virtual void SetUp() {
55 // Create a new temporary directory, and store the path 57 // Create a new temporary directory, and store the path
56 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 58 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
57 } 59 }
58 60
59 virtual void TearDown() { 61 virtual void TearDown() {
60 profile_manager_.reset(); 62 profile_manager_.reset();
61 message_loop_.RunAllPending(); 63 message_loop_.RunAllPending();
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 249
248 MockObserver mock_observer; 250 MockObserver mock_observer;
249 EXPECT_CALL(mock_observer, OnProfileCreated( 251 EXPECT_CALL(mock_observer, OnProfileCreated(
250 testing::NotNull(), NotFail())).Times(testing::AtLeast(3)); 252 testing::NotNull(), NotFail())).Times(testing::AtLeast(3));
251 253
252 profile_manager_->CreateProfileAsync(dest_path1, &mock_observer); 254 profile_manager_->CreateProfileAsync(dest_path1, &mock_observer);
253 profile_manager_->CreateProfileAsync(dest_path2, &mock_observer); 255 profile_manager_->CreateProfileAsync(dest_path2, &mock_observer);
254 256
255 message_loop_.RunAllPending(); 257 message_loop_.RunAllPending();
256 } 258 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698