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

Side by Side Diff: mojo/shell/application_manager_apptest_target.cc

Issue 1578473002: Pass application ids via AcceptConnection & ConnectToApplication callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "mojo/shell/application_manager_apptests.mojom.h" 8 #include "mojo/shell/application_manager_apptests.mojom.h"
9 #include "mojo/shell/public/cpp/application_connection.h" 9 #include "mojo/shell/public/cpp/application_connection.h"
10 #include "mojo/shell/public/cpp/application_delegate.h" 10 #include "mojo/shell/public/cpp/application_delegate.h"
11 #include "mojo/shell/public/cpp/application_impl.h" 11 #include "mojo/shell/public/cpp/application_impl.h"
12 #include "mojo/shell/runner/child/test_native_main.h" 12 #include "mojo/shell/runner/child/test_native_main.h"
13 #include "mojo/shell/runner/init.h" 13 #include "mojo/shell/runner/init.h"
14 14
15 using mojo::shell::test::mojom::CreateInstanceForHandleTestPtr; 15 using mojo::shell::test::mojom::CreateInstanceForHandleTestPtr;
16 16
17 namespace { 17 namespace {
18 18
19 class TargetApplicationDelegate : public mojo::ApplicationDelegate { 19 class TargetApplicationDelegate : public mojo::ApplicationDelegate {
20 public: 20 public:
21 TargetApplicationDelegate() {} 21 TargetApplicationDelegate() {}
22 ~TargetApplicationDelegate() override {} 22 ~TargetApplicationDelegate() override {}
23 23
24 private: 24 private:
25 // mojo::ApplicationDelegate: 25 // mojo::ApplicationDelegate:
26 void Initialize(mojo::ApplicationImpl* app) override { 26 void Initialize(mojo::ApplicationImpl* app) override {
27 CreateInstanceForHandleTestPtr service; 27 CreateInstanceForHandleTestPtr service;
28 app->ConnectToService("mojo:mojo_shell_apptests", &service); 28 app->ConnectToService("mojo:mojo_shell_apptests", &service);
29 service->Ping("From Target"); 29 service->SetTargetID(app->id());
30 } 30 }
31 bool ConfigureIncomingConnection( 31 bool ConfigureIncomingConnection(
32 mojo::ApplicationConnection* connection) override { 32 mojo::ApplicationConnection* connection) override {
33 return true; 33 return true;
34 } 34 }
35 35
36 DISALLOW_COPY_AND_ASSIGN(TargetApplicationDelegate); 36 DISALLOW_COPY_AND_ASSIGN(TargetApplicationDelegate);
37 }; 37 };
38 38
39 } // namespace 39 } // namespace
40 40
41 int main(int argc, char** argv) { 41 int main(int argc, char** argv) {
42 base::AtExitManager at_exit; 42 base::AtExitManager at_exit;
43 base::CommandLine::Init(argc, argv); 43 base::CommandLine::Init(argc, argv);
44 44
45 mojo::shell::InitializeLogging(); 45 mojo::shell::InitializeLogging();
46 46
47 TargetApplicationDelegate delegate; 47 TargetApplicationDelegate delegate;
48 return mojo::shell::TestNativeMain(&delegate); 48 return mojo::shell::TestNativeMain(&delegate);
49 } 49 }
OLDNEW
« no previous file with comments | « mojo/shell/application_manager_apptest_driver.cc ('k') | mojo/shell/application_manager_apptests.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698