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

Side by Side Diff: services/shell/tests/shutdown/shutdown_client_app.cc

Issue 2135223002: Use spin runloop instead of WaitForIncomingMethodCall() for test codes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase only Created 4 years, 5 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 | « components/arc/test/fake_arc_bridge_instance.cc ('k') | no next file » | 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 "base/macros.h" 5 #include "base/macros.h"
6 #include "base/run_loop.h"
6 #include "mojo/public/c/system/main.h" 7 #include "mojo/public/c/system/main.h"
7 #include "mojo/public/cpp/bindings/binding_set.h" 8 #include "mojo/public/cpp/bindings/binding_set.h"
8 #include "services/shell/public/cpp/application_runner.h" 9 #include "services/shell/public/cpp/application_runner.h"
9 #include "services/shell/public/cpp/connector.h" 10 #include "services/shell/public/cpp/connector.h"
10 #include "services/shell/public/cpp/interface_factory.h" 11 #include "services/shell/public/cpp/interface_factory.h"
11 #include "services/shell/public/cpp/service.h" 12 #include "services/shell/public/cpp/service.h"
12 #include "services/shell/tests/shutdown/shutdown_unittest.mojom.h" 13 #include "services/shell/tests/shutdown/shutdown_unittest.mojom.h"
13 14
14 namespace shell { 15 namespace shell {
15 16
(...skipping 29 matching lines...) Expand all
45 mojom::ShutdownTestServicePtr service; 46 mojom::ShutdownTestServicePtr service;
46 connector_->ConnectToInterface("mojo:shutdown_service", &service); 47 connector_->ConnectToInterface("mojo:shutdown_service", &service);
47 48
48 mojo::Binding<mojom::ShutdownTestClient> client_binding(this); 49 mojo::Binding<mojom::ShutdownTestClient> client_binding(this);
49 50
50 mojom::ShutdownTestClientPtr client_ptr = 51 mojom::ShutdownTestClientPtr client_ptr =
51 client_binding.CreateInterfacePtrAndBind(); 52 client_binding.CreateInterfacePtrAndBind();
52 53
53 service->SetClient(std::move(client_ptr)); 54 service->SetClient(std::move(client_ptr));
54 55
55 client_binding.WaitForIncomingMethodCall(); 56 base::MessageLoop::ScopedNestableTaskAllower nestable_allower(
57 base::MessageLoop::current());
58 base::RunLoop run_loop;
59 client_binding.set_connection_error_handler(run_loop.QuitClosure());
60 run_loop.Run();
61
56 callback.Run(); 62 callback.Run();
57 } 63 }
58 64
59 Connector* connector_ = nullptr; 65 Connector* connector_ = nullptr;
60 mojo::BindingSet<mojom::ShutdownTestClientController> bindings_; 66 mojo::BindingSet<mojom::ShutdownTestClientController> bindings_;
61 67
62 DISALLOW_COPY_AND_ASSIGN(ShutdownClientApp); 68 DISALLOW_COPY_AND_ASSIGN(ShutdownClientApp);
63 }; 69 };
64 70
65 } // namespace shell 71 } // namespace shell
66 72
67 73
68 MojoResult MojoMain(MojoHandle shell_handle) { 74 MojoResult MojoMain(MojoHandle shell_handle) {
69 return shell::ApplicationRunner(new shell::ShutdownClientApp) 75 return shell::ApplicationRunner(new shell::ShutdownClientApp)
70 .Run(shell_handle); 76 .Run(shell_handle);
71 } 77 }
OLDNEW
« no previous file with comments | « components/arc/test/fake_arc_bridge_instance.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698