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

Side by Side Diff: examples/apptest/example_apptest.cc

Issue 1916233002: Mark ApplicationImpl::ConnectTo{Application,Service}() as deprecated. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 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 | « apps/benchmark/benchmark_app.cc ('k') | examples/audio_play_test/play_tone.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 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 "examples/apptest/example_service.mojom.h" 5 #include "examples/apptest/example_service.mojom.h"
6 #include "mojo/public/cpp/application/application_impl.h" 6 #include "mojo/public/cpp/application/application_impl.h"
7 #include "mojo/public/cpp/application/application_test_base.h" 7 #include "mojo/public/cpp/application/application_test_base.h"
8 #include "mojo/public/cpp/bindings/callback.h" 8 #include "mojo/public/cpp/bindings/callback.h"
9 #include "mojo/public/cpp/environment/logging.h" 9 #include "mojo/public/cpp/environment/logging.h"
10 #include "mojo/public/cpp/system/macros.h" 10 #include "mojo/public/cpp/system/macros.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 namespace { 13 namespace {
14 14
15 // Exemplifies ApplicationTestBase's application testing pattern. 15 // Exemplifies ApplicationTestBase's application testing pattern.
16 class ExampleApplicationTest : public test::ApplicationTestBase { 16 class ExampleApplicationTest : public test::ApplicationTestBase {
17 public: 17 public:
18 ExampleApplicationTest() : ApplicationTestBase() {} 18 ExampleApplicationTest() : ApplicationTestBase() {}
19 ~ExampleApplicationTest() override {} 19 ~ExampleApplicationTest() override {}
20 20
21 protected: 21 protected:
22 // ApplicationTestBase: 22 // ApplicationTestBase:
23 void SetUp() override { 23 void SetUp() override {
24 ApplicationTestBase::SetUp(); 24 ApplicationTestBase::SetUp();
25 25
26 application_impl()->ConnectToService("mojo:example_service", 26 application_impl()->ConnectToServiceDeprecated("mojo:example_service",
27 &example_service_); 27 &example_service_);
28 } 28 }
29 29
30 ExampleServicePtr example_service_; 30 ExampleServicePtr example_service_;
31 31
32 private: 32 private:
33 MOJO_DISALLOW_COPY_AND_ASSIGN(ExampleApplicationTest); 33 MOJO_DISALLOW_COPY_AND_ASSIGN(ExampleApplicationTest);
34 }; 34 };
35 35
36 TEST_F(ExampleApplicationTest, PingServiceToPong) { 36 TEST_F(ExampleApplicationTest, PingServiceToPong) {
37 uint16_t pong_value = 0u; 37 uint16_t pong_value = 0u;
38 example_service_->Ping(1u, 38 example_service_->Ping(1u,
39 [&pong_value](uint16_t value) { pong_value = value; }); 39 [&pong_value](uint16_t value) { pong_value = value; });
40 EXPECT_TRUE(example_service_.WaitForIncomingResponse()); 40 EXPECT_TRUE(example_service_.WaitForIncomingResponse());
41 // Test making a call and receiving the reply. 41 // Test making a call and receiving the reply.
42 EXPECT_EQ(1u, pong_value); 42 EXPECT_EQ(1u, pong_value);
43 } 43 }
44 44
45 TEST_F(ExampleApplicationTest, CheckCommandLineArg) { 45 TEST_F(ExampleApplicationTest, CheckCommandLineArg) {
46 // Ensure the test runner passes along this example command line argument. 46 // Ensure the test runner passes along this example command line argument.
47 ASSERT_TRUE(application_impl()->HasArg("--example_apptest_arg")); 47 ASSERT_TRUE(application_impl()->HasArg("--example_apptest_arg"));
48 } 48 }
49 49
50 } // namespace 50 } // namespace
51 } // namespace mojo 51 } // namespace mojo
OLDNEW
« no previous file with comments | « apps/benchmark/benchmark_app.cc ('k') | examples/audio_play_test/play_tone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698