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

Side by Side Diff: content/browser/webui/web_ui_mojo_browsertest.cc

Issue 728553002: Update mojo sdk to rev afb4440fd5a10cba980878c326180b7ad7960480 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « build/all.gyp ('k') | device/battery/battery_monitor_impl.h » ('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 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 <limits> 5 #include <limits>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 DISALLOW_COPY_AND_ASSIGN(BrowserTargetImpl); 75 DISALLOW_COPY_AND_ASSIGN(BrowserTargetImpl);
76 }; 76 };
77 77
78 class PingBrowserTargetImpl : public BrowserTargetImpl { 78 class PingBrowserTargetImpl : public BrowserTargetImpl {
79 public: 79 public:
80 explicit PingBrowserTargetImpl(base::RunLoop* run_loop) 80 explicit PingBrowserTargetImpl(base::RunLoop* run_loop)
81 : BrowserTargetImpl(run_loop) {} 81 : BrowserTargetImpl(run_loop) {}
82 82
83 ~PingBrowserTargetImpl() override {} 83 ~PingBrowserTargetImpl() override {}
84 84
85 // mojo::InterfaceImpl<BrowserTarget> overrides:
86 void OnConnectionEstablished() override { client()->Ping(); }
87
88 // Quit the RunLoop when called. 85 // Quit the RunLoop when called.
89 void PingResponse() override { 86 void PingResponse() override {
90 got_message = true; 87 got_message = true;
91 run_loop_->Quit(); 88 run_loop_->Quit();
92 } 89 }
93 90
94 private: 91 private:
95 DISALLOW_COPY_AND_ASSIGN(PingBrowserTargetImpl); 92 DISALLOW_COPY_AND_ASSIGN(PingBrowserTargetImpl);
96 }; 93 };
97 94
(...skipping 29 matching lines...) Expand all
127 // WebUIController overrides: 124 // WebUIController overrides:
128 void RenderViewCreated(RenderViewHost* render_view_host) override { 125 void RenderViewCreated(RenderViewHost* render_view_host) override {
129 render_view_host->GetMainFrame()->GetServiceRegistry()-> 126 render_view_host->GetMainFrame()->GetServiceRegistry()->
130 AddService<BrowserTarget>(base::Bind( 127 AddService<BrowserTarget>(base::Bind(
131 &PingTestWebUIController::CreateHandler, base::Unretained(this))); 128 &PingTestWebUIController::CreateHandler, base::Unretained(this)));
132 } 129 }
133 130
134 void CreateHandler(mojo::InterfaceRequest<BrowserTarget> request) { 131 void CreateHandler(mojo::InterfaceRequest<BrowserTarget> request) {
135 browser_target_.reset(mojo::WeakBindToRequest( 132 browser_target_.reset(mojo::WeakBindToRequest(
136 new PingBrowserTargetImpl(run_loop_), &request)); 133 new PingBrowserTargetImpl(run_loop_), &request));
134 browser_target_->client()->Ping();
137 } 135 }
138 136
139 private: 137 private:
140 DISALLOW_COPY_AND_ASSIGN(PingTestWebUIController); 138 DISALLOW_COPY_AND_ASSIGN(PingTestWebUIController);
141 }; 139 };
142 140
143 // WebUIControllerFactory that creates TestWebUIController. 141 // WebUIControllerFactory that creates TestWebUIController.
144 class TestWebUIControllerFactory : public WebUIControllerFactory { 142 class TestWebUIControllerFactory : public WebUIControllerFactory {
145 public: 143 public:
146 TestWebUIControllerFactory() : run_loop_(NULL) {} 144 TestWebUIControllerFactory() : run_loop_(NULL) {}
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 NavigateToURL(other_shell, test_url); 222 NavigateToURL(other_shell, test_url);
225 // RunLoop is quit when message received from page. 223 // RunLoop is quit when message received from page.
226 other_run_loop.Run(); 224 other_run_loop.Run();
227 EXPECT_TRUE(got_message); 225 EXPECT_TRUE(got_message);
228 EXPECT_EQ(shell()->web_contents()->GetRenderProcessHost(), 226 EXPECT_EQ(shell()->web_contents()->GetRenderProcessHost(),
229 other_shell->web_contents()->GetRenderProcessHost()); 227 other_shell->web_contents()->GetRenderProcessHost());
230 } 228 }
231 229
232 } // namespace 230 } // namespace
233 } // namespace content 231 } // namespace content
OLDNEW
« no previous file with comments | « build/all.gyp ('k') | device/battery/battery_monitor_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698