| 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 "chrome/browser/extensions/event_router_forwarder.h" | 5 #include "chrome/browser/extensions/event_router_forwarder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/power_monitor/power_monitor.h" | 9 #include "base/power_monitor/power_monitor.h" |
| 10 #include "base/power_monitor/power_monitor_device_source.h" | 10 #include "base/power_monitor/power_monitor_device_source.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 ASSERT_TRUE(profile_manager_.SetUp()); | 104 ASSERT_TRUE(profile_manager_.SetUp()); |
| 105 | 105 |
| 106 // Inject a BrowserProcess with a ProfileManager. | 106 // Inject a BrowserProcess with a ProfileManager. |
| 107 ASSERT_TRUE(io_thread_.Start()); | 107 ASSERT_TRUE(io_thread_.Start()); |
| 108 | 108 |
| 109 profile1_ = profile_manager_.CreateTestingProfile("one"); | 109 profile1_ = profile_manager_.CreateTestingProfile("one"); |
| 110 profile2_ = profile_manager_.CreateTestingProfile("two"); | 110 profile2_ = profile_manager_.CreateTestingProfile("two"); |
| 111 } | 111 } |
| 112 | 112 |
| 113 TestingProfile* CreateIncognitoProfile(TestingProfile* base) { | 113 TestingProfile* CreateIncognitoProfile(TestingProfile* base) { |
| 114 TestingProfile* incognito = new TestingProfile; // Owned by |base|. | 114 TestingProfile::Builder builder; |
| 115 incognito->set_incognito(true); | 115 builder.SetIncognito(); |
| 116 base->SetOffTheRecordProfile(incognito); | 116 scoped_ptr<TestingProfile> incognito = builder.Build(); |
| 117 return incognito; | 117 TestingProfile* incognito_ptr = incognito.get(); |
| 118 // Incognito profile now owned by |base| |
| 119 base->SetOffTheRecordProfile(incognito.PassAs<Profile>()); |
| 120 return incognito_ptr; |
| 118 } | 121 } |
| 119 | 122 |
| 120 base::MessageLoopForUI message_loop_; | 123 base::MessageLoopForUI message_loop_; |
| 121 content::TestBrowserThread ui_thread_; | 124 content::TestBrowserThread ui_thread_; |
| 122 content::TestBrowserThread io_thread_; | 125 content::TestBrowserThread io_thread_; |
| 123 TestingProfileManager profile_manager_; | 126 TestingProfileManager profile_manager_; |
| 124 scoped_ptr<base::PowerMonitor> dummy; | 127 scoped_ptr<base::PowerMonitor> dummy; |
| 125 // Profiles are weak pointers, owned by ProfileManager in |browser_process_|. | 128 // Profiles are weak pointers, owned by ProfileManager in |browser_process_|. |
| 126 TestingProfile* profile1_; | 129 TestingProfile* profile1_; |
| 127 TestingProfile* profile2_; | 130 TestingProfile* profile2_; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 GURL url; | 285 GURL url; |
| 283 EXPECT_CALL(*event_router.get(), | 286 EXPECT_CALL(*event_router.get(), |
| 284 CallEventRouter(profile1_, kExt, kEventName, NULL, url)); | 287 CallEventRouter(profile1_, kExt, kEventName, NULL, url)); |
| 285 EXPECT_CALL(*event_router.get(), CallEventRouter(profile2_, _, _, _, _)) | 288 EXPECT_CALL(*event_router.get(), CallEventRouter(profile2_, _, _, _, _)) |
| 286 .Times(0); | 289 .Times(0); |
| 287 DispatchEventToExtension(event_router.get(), kExt, kEventName, profile1_, | 290 DispatchEventToExtension(event_router.get(), kExt, kEventName, profile1_, |
| 288 false, url); | 291 false, url); |
| 289 } | 292 } |
| 290 | 293 |
| 291 } // namespace extensions | 294 } // namespace extensions |
| OLD | NEW |