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

Side by Side Diff: extensions/browser/mojo/keep_alive_impl_unittest.cc

Issue 2851173004: Eliminate bind callback that doesn't take a BindSourceInfo parameter. (Closed)
Patch Set: . Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/mojo/keep_alive_impl.h" 5 #include "extensions/browser/mojo/keep_alive_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "extensions/browser/extension_registry.h" 12 #include "extensions/browser/extension_registry.h"
13 #include "extensions/browser/extensions_test.h" 13 #include "extensions/browser/extensions_test.h"
14 #include "extensions/browser/process_manager.h" 14 #include "extensions/browser/process_manager.h"
15 #include "extensions/common/extension_builder.h" 15 #include "extensions/common/extension_builder.h"
16 #include "services/service_manager/public/cpp/bind_source_info.h"
16 17
17 namespace extensions { 18 namespace extensions {
18 19
19 class KeepAliveTest : public ExtensionsTest { 20 class KeepAliveTest : public ExtensionsTest {
20 public: 21 public:
21 KeepAliveTest() {} 22 KeepAliveTest() {}
22 ~KeepAliveTest() override {} 23 ~KeepAliveTest() override {}
23 24
24 void SetUp() override { 25 void SetUp() override {
25 ExtensionsTest::SetUp(); 26 ExtensionsTest::SetUp();
(...skipping 26 matching lines...) Expand all
52 53
53 void WaitUntilLazyKeepAliveChanges() { 54 void WaitUntilLazyKeepAliveChanges() {
54 int initial_keep_alive_count = GetKeepAliveCount(); 55 int initial_keep_alive_count = GetKeepAliveCount();
55 while (GetKeepAliveCount() == initial_keep_alive_count) { 56 while (GetKeepAliveCount() == initial_keep_alive_count) {
56 base::RunLoop().RunUntilIdle(); 57 base::RunLoop().RunUntilIdle();
57 } 58 }
58 } 59 }
59 60
60 void CreateKeepAlive(mojo::InterfaceRequest<KeepAlive> request) { 61 void CreateKeepAlive(mojo::InterfaceRequest<KeepAlive> request) {
61 KeepAliveImpl::Create(browser_context(), extension_.get(), 62 KeepAliveImpl::Create(browser_context(), extension_.get(),
63 service_manager::BindSourceInfo(),
62 std::move(request)); 64 std::move(request));
63 } 65 }
64 66
65 const Extension* extension() { return extension_.get(); } 67 const Extension* extension() { return extension_.get(); }
66 68
67 int GetKeepAliveCount() { 69 int GetKeepAliveCount() {
68 return ProcessManager::Get(browser_context()) 70 return ProcessManager::Get(browser_context())
69 ->GetLazyKeepaliveCount(extension()); 71 ->GetLazyKeepaliveCount(extension());
70 } 72 }
71 73
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // ProcessManager and so the keep-alive count should remain unchanged. 159 // ProcessManager and so the keep-alive count should remain unchanged.
158 EXPECT_EQ(1, GetKeepAliveCount()); 160 EXPECT_EQ(1, GetKeepAliveCount());
159 161
160 // Wait for |keep_alive| to disconnect. 162 // Wait for |keep_alive| to disconnect.
161 base::RunLoop run_loop; 163 base::RunLoop run_loop;
162 keep_alive.set_connection_error_handler(run_loop.QuitClosure()); 164 keep_alive.set_connection_error_handler(run_loop.QuitClosure());
163 run_loop.Run(); 165 run_loop.Run();
164 } 166 }
165 167
166 } // namespace extensions 168 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/mojo/keep_alive_impl.cc ('k') | extensions/renderer/extensions_render_frame_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698