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

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

Issue 2871523002: Use OnceCallback on Mojo interfaces in //content (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 <limits> 5 #include <limits>
6 #include <utility> 6 #include <utility>
7 7
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/macros.h" 10 #include "base/macros.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 class BrowserTargetImpl : public mojom::BrowserTarget { 79 class BrowserTargetImpl : public mojom::BrowserTarget {
80 public: 80 public:
81 BrowserTargetImpl(base::RunLoop* run_loop, 81 BrowserTargetImpl(base::RunLoop* run_loop,
82 mojo::InterfaceRequest<mojom::BrowserTarget> request) 82 mojo::InterfaceRequest<mojom::BrowserTarget> request)
83 : run_loop_(run_loop), binding_(this, std::move(request)) {} 83 : run_loop_(run_loop), binding_(this, std::move(request)) {}
84 84
85 ~BrowserTargetImpl() override {} 85 ~BrowserTargetImpl() override {}
86 86
87 // mojom::BrowserTarget overrides: 87 // mojom::BrowserTarget overrides:
88 void Start(const StartCallback& closure) override { 88 void Start(StartCallback closure) override { std::move(closure).Run(); }
89 closure.Run();
90 }
91 void Stop() override { 89 void Stop() override {
92 g_got_message = true; 90 g_got_message = true;
93 run_loop_->Quit(); 91 run_loop_->Quit();
94 } 92 }
95 93
96 protected: 94 protected:
97 base::RunLoop* const run_loop_; 95 base::RunLoop* const run_loop_;
98 96
99 private: 97 private:
100 mojo::Binding<mojom::BrowserTarget> binding_; 98 mojo::Binding<mojom::BrowserTarget> binding_;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 NavigateToURL(other_shell, test_url); 232 NavigateToURL(other_shell, test_url);
235 // RunLoop is quit when message received from page. 233 // RunLoop is quit when message received from page.
236 other_run_loop.Run(); 234 other_run_loop.Run();
237 EXPECT_TRUE(g_got_message); 235 EXPECT_TRUE(g_got_message);
238 EXPECT_EQ(shell()->web_contents()->GetRenderProcessHost(), 236 EXPECT_EQ(shell()->web_contents()->GetRenderProcessHost(),
239 other_shell->web_contents()->GetRenderProcessHost()); 237 other_shell->web_contents()->GetRenderProcessHost());
240 } 238 }
241 239
242 } // namespace 240 } // namespace
243 } // namespace content 241 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_version_unittest.cc ('k') | content/public/test/test_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698