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

Side by Side Diff: chrome/browser/tabs/tab_strip_model_unittest.cc

Issue 7235023: Mac: Split SystemMonitor initialization so it's not blocked by the Sandbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced to trunk Created 9 years, 5 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // Whether to report that we need to run an unload listener before closing. 146 // Whether to report that we need to run an unload listener before closing.
147 bool run_unload_; 147 bool run_unload_;
148 148
149 DISALLOW_COPY_AND_ASSIGN(TabStripDummyDelegate); 149 DISALLOW_COPY_AND_ASSIGN(TabStripDummyDelegate);
150 }; 150 };
151 151
152 class TabStripModelTest : public RenderViewHostTestHarness { 152 class TabStripModelTest : public RenderViewHostTestHarness {
153 public: 153 public:
154 TabStripModelTest() 154 TabStripModelTest()
155 : RenderViewHostTestHarness(), 155 : RenderViewHostTestHarness(),
156 browser_thread_(BrowserThread::UI, &message_loop_) {} 156 browser_thread_(BrowserThread::UI, &message_loop_) {
157 #if defined(OS_MACOSX)
158 base::SystemMonitor::AllocateSystemIOPorts();
159 #endif
160 system_monitor.reset(new base::SystemMonitor);
161 }
157 162
158 TabContentsWrapper* CreateTabContents() { 163 TabContentsWrapper* CreateTabContents() {
159 return Browser::TabContentsFactory(profile(), NULL, 0, NULL, NULL); 164 return Browser::TabContentsFactory(profile(), NULL, 0, NULL, NULL);
160 } 165 }
161 166
162 TabContentsWrapper* CreateTabContentsWithSharedRPH( 167 TabContentsWrapper* CreateTabContentsWithSharedRPH(
163 TabContents* tab_contents) { 168 TabContents* tab_contents) {
164 TabContentsWrapper* retval = Browser::TabContentsFactory(profile(), 169 TabContentsWrapper* retval = Browser::TabContentsFactory(profile(),
165 tab_contents->render_view_host()->site_instance(), MSG_ROUTING_NONE, 170 tab_contents->render_view_host()->site_instance(), MSG_ROUTING_NONE,
166 NULL, NULL); 171 NULL, NULL);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 return &accessor; 268 return &accessor;
264 } 269 }
265 270
266 BrowserThread browser_thread_; 271 BrowserThread browser_thread_;
267 272
268 std::wstring test_dir_; 273 std::wstring test_dir_;
269 std::wstring profile_path_; 274 std::wstring profile_path_;
270 std::map<TabContents*, int> foo_; 275 std::map<TabContents*, int> foo_;
271 276
272 // ProfileManager requires a base::SystemMonitor. 277 // ProfileManager requires a base::SystemMonitor.
273 base::SystemMonitor system_monitor; 278 scoped_ptr<base::SystemMonitor> system_monitor;
274 279
275 ProfileManager pm_; 280 ProfileManager pm_;
276 }; 281 };
277 282
278 class MockTabStripModelObserver : public TabStripModelObserver { 283 class MockTabStripModelObserver : public TabStripModelObserver {
279 public: 284 public:
280 MockTabStripModelObserver() : empty_(true), 285 MockTabStripModelObserver() : empty_(true),
281 log_tab_selection_changed_(false), 286 log_tab_selection_changed_(false),
282 model_(NULL) {} 287 model_(NULL) {}
283 explicit MockTabStripModelObserver(TabStripModel* model) 288 explicit MockTabStripModelObserver(TabStripModel* model)
(...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after
2318 ASSERT_EQ(1, observer.GetStateCount()); 2323 ASSERT_EQ(1, observer.GetStateCount());
2319 MockTabStripModelObserver::State s( 2324 MockTabStripModelObserver::State s(
2320 contents2, 1, MockTabStripModelObserver::SELECT); 2325 contents2, 1, MockTabStripModelObserver::SELECT);
2321 s.src_contents = contents2; 2326 s.src_contents = contents2;
2322 s.src_index = 1; 2327 s.src_index = 1;
2323 s.user_gesture = false; 2328 s.user_gesture = false;
2324 EXPECT_TRUE(observer.StateEquals(0, s)); 2329 EXPECT_TRUE(observer.StateEquals(0, s));
2325 strip.RemoveObserver(&observer); 2330 strip.RemoveObserver(&observer);
2326 strip.CloseAllTabs(); 2331 strip.CloseAllTabs();
2327 } 2332 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager_unittest.cc ('k') | chrome/test/in_process_browser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698