OLD | NEW |
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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
12 #include "base/system_monitor/system_monitor.h" | 12 #include "base/system_monitor/system_monitor.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/extensions/extension_event_router_forwarder.h" | 17 #include "chrome/browser/extensions/event_router_forwarder.h" |
18 #include "chrome/browser/history/history.h" | 18 #include "chrome/browser/history/history.h" |
19 #include "chrome/browser/history/history_service_factory.h" | 19 #include "chrome/browser/history/history_service_factory.h" |
20 #include "chrome/browser/io_thread.h" | 20 #include "chrome/browser/io_thread.h" |
21 #include "chrome/browser/prefs/browser_prefs.h" | 21 #include "chrome/browser/prefs/browser_prefs.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/profile_info_cache.h" | 23 #include "chrome/browser/profiles/profile_info_cache.h" |
24 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
25 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
26 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
27 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 class ProfileManagerTest : public testing::Test { | 89 class ProfileManagerTest : public testing::Test { |
90 protected: | 90 protected: |
91 class MockObserver { | 91 class MockObserver { |
92 public: | 92 public: |
93 MOCK_METHOD2(OnProfileCreated, | 93 MOCK_METHOD2(OnProfileCreated, |
94 void(Profile* profile, Profile::CreateStatus status)); | 94 void(Profile* profile, Profile::CreateStatus status)); |
95 }; | 95 }; |
96 | 96 |
97 ProfileManagerTest() | 97 ProfileManagerTest() |
98 : local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)), | 98 : local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)), |
99 extension_event_router_forwarder_(new ExtensionEventRouterForwarder), | 99 extension_event_router_forwarder_(new extensions::EventRouterForwarder), |
100 ui_thread_(BrowserThread::UI, &message_loop_), | 100 ui_thread_(BrowserThread::UI, &message_loop_), |
101 db_thread_(BrowserThread::DB, &message_loop_), | 101 db_thread_(BrowserThread::DB, &message_loop_), |
102 file_thread_(BrowserThread::FILE, &message_loop_), | 102 file_thread_(BrowserThread::FILE, &message_loop_), |
103 io_thread_(local_state_.Get(), NULL, | 103 io_thread_(local_state_.Get(), NULL, |
104 extension_event_router_forwarder_) { | 104 extension_event_router_forwarder_) { |
105 #if defined(OS_MACOSX) | 105 #if defined(OS_MACOSX) |
106 base::SystemMonitor::AllocateSystemIOPorts(); | 106 base::SystemMonitor::AllocateSystemIOPorts(); |
107 #endif | 107 #endif |
108 system_monitor_dummy_.reset(new base::SystemMonitor); | 108 system_monitor_dummy_.reset(new base::SystemMonitor); |
109 static_cast<TestingBrowserProcess*>(g_browser_process)->SetIOThread( | 109 static_cast<TestingBrowserProcess*>(g_browser_process)->SetIOThread( |
(...skipping 20 matching lines...) Expand all Loading... |
130 #if defined(OS_CHROMEOS) | 130 #if defined(OS_CHROMEOS) |
131 // Do not change order of stub_cros_enabler_, which needs to be constructed | 131 // Do not change order of stub_cros_enabler_, which needs to be constructed |
132 // before io_thread_ which requires CrosLibrary to be initialized to construct | 132 // before io_thread_ which requires CrosLibrary to be initialized to construct |
133 // its data member pref_proxy_config_tracker_ on ChromeOS. | 133 // its data member pref_proxy_config_tracker_ on ChromeOS. |
134 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; | 134 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; |
135 #endif | 135 #endif |
136 | 136 |
137 // The path to temporary directory used to contain the test operations. | 137 // The path to temporary directory used to contain the test operations. |
138 ScopedTempDir temp_dir_; | 138 ScopedTempDir temp_dir_; |
139 ScopedTestingLocalState local_state_; | 139 ScopedTestingLocalState local_state_; |
140 scoped_refptr<ExtensionEventRouterForwarder> | 140 scoped_refptr<extensions::EventRouterForwarder> |
141 extension_event_router_forwarder_; | 141 extension_event_router_forwarder_; |
142 | 142 |
143 MessageLoopForUI message_loop_; | 143 MessageLoopForUI message_loop_; |
144 content::TestBrowserThread ui_thread_; | 144 content::TestBrowserThread ui_thread_; |
145 content::TestBrowserThread db_thread_; | 145 content::TestBrowserThread db_thread_; |
146 content::TestBrowserThread file_thread_; | 146 content::TestBrowserThread file_thread_; |
147 // IOThread is necessary for the creation of some services below. | 147 // IOThread is necessary for the creation of some services below. |
148 IOThread io_thread_; | 148 IOThread io_thread_; |
149 | 149 |
150 scoped_ptr<base::SystemMonitor> system_monitor_dummy_; | 150 scoped_ptr<base::SystemMonitor> system_monitor_dummy_; |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 browser2b.reset(); | 552 browser2b.reset(); |
553 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); | 553 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); |
554 ASSERT_EQ(1U, last_opened_profiles.size()); | 554 ASSERT_EQ(1U, last_opened_profiles.size()); |
555 EXPECT_EQ(profile1, last_opened_profiles[0]); | 555 EXPECT_EQ(profile1, last_opened_profiles[0]); |
556 | 556 |
557 browser1.reset(); | 557 browser1.reset(); |
558 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); | 558 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); |
559 ASSERT_EQ(0U, last_opened_profiles.size()); | 559 ASSERT_EQ(0U, last_opened_profiles.size()); |
560 } | 560 } |
561 #endif // !defined(OS_ANDROID) | 561 #endif // !defined(OS_ANDROID) |
OLD | NEW |