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

Side by Side Diff: content/browser/browser_associated_interface_unittest.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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_version_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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 #include <utility>
7 8
8 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
9 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
10 #include "base/pickle.h" 11 #include "base/pickle.h"
11 #include "base/run_loop.h" 12 #include "base/run_loop.h"
12 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
13 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
14 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
15 #include "content/public/browser/browser_associated_interface.h" 16 #include "content/public/browser/browser_associated_interface.h"
16 #include "content/public/browser/browser_message_filter.h" 17 #include "content/public/browser/browser_message_filter.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 EXPECT_EQ(next_expected_string_, actual_string); 90 EXPECT_EQ(next_expected_string_, actual_string);
90 message_count_++; 91 message_count_++;
91 return true; 92 return true;
92 } 93 }
93 94
94 // mojom::BrowserAssociatedInterfaceTestDriver: 95 // mojom::BrowserAssociatedInterfaceTestDriver:
95 void ExpectString(const std::string& expected) override { 96 void ExpectString(const std::string& expected) override {
96 next_expected_string_ = expected; 97 next_expected_string_ = expected;
97 } 98 }
98 99
99 void RequestQuit(const RequestQuitCallback& callback) override { 100 void RequestQuit(RequestQuitCallback callback) override {
100 EXPECT_EQ(kNumTestMessages, message_count_); 101 EXPECT_EQ(kNumTestMessages, message_count_);
101 callback.Run(); 102 std::move(callback).Run();
102 base::MessageLoop::current()->QuitWhenIdle(); 103 base::MessageLoop::current()->QuitWhenIdle();
103 } 104 }
104 105
105 std::string next_expected_string_; 106 std::string next_expected_string_;
106 int message_count_ = 0; 107 int message_count_ = 0;
107 }; 108 };
108 109
109 class TestClientRunner { 110 class TestClientRunner {
110 public: 111 public:
111 explicit TestClientRunner(mojo::ScopedMessagePipeHandle pipe) 112 explicit TestClientRunner(mojo::ScopedMessagePipeHandle pipe)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 AddFilterToChannel(new TestDriverMessageFilter, proxy.channel()); 162 AddFilterToChannel(new TestDriverMessageFilter, proxy.channel());
162 163
163 TestClientRunner client(std::move(pipe.handle1)); 164 TestClientRunner client(std::move(pipe.handle1));
164 base::RunLoop().Run(); 165 base::RunLoop().Run();
165 166
166 proxy.ShutDown(); 167 proxy.ShutDown();
167 base::RunLoop().RunUntilIdle(); 168 base::RunLoop().RunUntilIdle();
168 } 169 }
169 170
170 } // namespace content 171 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_version_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698