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

Side by Side Diff: chrome/browser/extensions/extension_event_router_forwarder_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
« no previous file with comments | « chrome/app/chrome_main.cc ('k') | chrome/browser/profiles/profile_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/extensions/extension_event_router_forwarder.h" 5 #include "chrome/browser/extensions/extension_event_router_forwarder.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/system_monitor/system_monitor.h" 8 #include "base/system_monitor/system_monitor.h"
9 #include "base/test/thread_test_helper.h" 9 #include "base/test/thread_test_helper.h"
10 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
(...skipping 19 matching lines...) Expand all
30 Profile*, const GURL&)); 30 Profile*, const GURL&));
31 }; 31 };
32 32
33 } // namespace 33 } // namespace
34 34
35 class ExtensionEventRouterForwarderTest : public TestingBrowserProcessTest { 35 class ExtensionEventRouterForwarderTest : public TestingBrowserProcessTest {
36 protected: 36 protected:
37 ExtensionEventRouterForwarderTest() 37 ExtensionEventRouterForwarderTest()
38 : ui_thread_(BrowserThread::UI, &message_loop_), 38 : ui_thread_(BrowserThread::UI, &message_loop_),
39 io_thread_(BrowserThread::IO) { 39 io_thread_(BrowserThread::IO) {
40 #if defined(OS_MACOSX)
41 base::SystemMonitor::AllocateSystemIOPorts();
42 #endif
43 dummy.reset(new base::SystemMonitor);
40 } 44 }
41 45
42 ~ExtensionEventRouterForwarderTest() { 46 ~ExtensionEventRouterForwarderTest() {
43 } 47 }
44 48
45 virtual void SetUp() { 49 virtual void SetUp() {
46 // Inject a BrowserProcess with a ProfileManager. 50 // Inject a BrowserProcess with a ProfileManager.
47 ASSERT_TRUE(io_thread_.Start()); 51 ASSERT_TRUE(io_thread_.Start());
48 52
49 TestingBrowserProcess* browser_process = testing_browser_process_.get(); 53 TestingBrowserProcess* browser_process = testing_browser_process_.get();
50 browser_process->SetProfileManager(new ProfileManager); 54 browser_process->SetProfileManager(new ProfileManager);
51 55
52 profile1_ = new TestingProfile(); 56 profile1_ = new TestingProfile();
53 profile2_ = new TestingProfile(); 57 profile2_ = new TestingProfile();
54 58
55 browser_process->profile_manager()->RegisterProfile(profile1_, true); 59 browser_process->profile_manager()->RegisterProfile(profile1_, true);
56 browser_process->profile_manager()->RegisterProfile(profile2_, true); 60 browser_process->profile_manager()->RegisterProfile(profile2_, true);
57 } 61 }
58 62
59 TestingProfile* CreateIncognitoProfile(TestingProfile* base) { 63 TestingProfile* CreateIncognitoProfile(TestingProfile* base) {
60 TestingProfile* incognito = new TestingProfile(); 64 TestingProfile* incognito = new TestingProfile();
61 incognito->set_incognito(true); 65 incognito->set_incognito(true);
62 base->SetOffTheRecordProfile(incognito); 66 base->SetOffTheRecordProfile(incognito);
63 return incognito; 67 return incognito;
64 } 68 }
65 69
66 MessageLoopForUI message_loop_; 70 MessageLoopForUI message_loop_;
67 BrowserThread ui_thread_; 71 BrowserThread ui_thread_;
68 BrowserThread io_thread_; 72 BrowserThread io_thread_;
69 base::SystemMonitor dummy; 73 scoped_ptr<base::SystemMonitor> dummy;
70 // Profiles are weak pointers, owned by ProfileManager in |browser_process_|. 74 // Profiles are weak pointers, owned by ProfileManager in |browser_process_|.
71 TestingProfile* profile1_; 75 TestingProfile* profile1_;
72 TestingProfile* profile2_; 76 TestingProfile* profile2_;
73 }; 77 };
74 78
75 TEST_F(ExtensionEventRouterForwarderTest, BroadcastRendererUI) { 79 TEST_F(ExtensionEventRouterForwarderTest, BroadcastRendererUI) {
76 scoped_refptr<MockExtensionEventRouterForwarder> event_router( 80 scoped_refptr<MockExtensionEventRouterForwarder> event_router(
77 new MockExtensionEventRouterForwarder); 81 new MockExtensionEventRouterForwarder);
78 GURL url; 82 GURL url;
79 EXPECT_CALL(*event_router, 83 EXPECT_CALL(*event_router,
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 GURL url; 256 GURL url;
253 EXPECT_CALL(*event_router, 257 EXPECT_CALL(*event_router,
254 CallExtensionEventRouter( 258 CallExtensionEventRouter(
255 profile1_, kExt, kEventName, kEventArgs, NULL, url)); 259 profile1_, kExt, kEventName, kEventArgs, NULL, url));
256 EXPECT_CALL(*event_router, 260 EXPECT_CALL(*event_router,
257 CallExtensionEventRouter(profile2_, _, _, _, _, _)).Times(0); 261 CallExtensionEventRouter(profile2_, _, _, _, _, _)).Times(0);
258 event_router->DispatchEventToExtension(kExt, kEventName, kEventArgs, 262 event_router->DispatchEventToExtension(kExt, kEventName, kEventArgs,
259 profile1_->GetRuntimeId(), 263 profile1_->GetRuntimeId(),
260 false, url); 264 false, url);
261 } 265 }
OLDNEW
« no previous file with comments | « chrome/app/chrome_main.cc ('k') | chrome/browser/profiles/profile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698