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

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

Issue 617503003: Mojo: MOJO_OVERRIDE -> override in mojo/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years, 2 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 | « mojo/dbus/dbus_external_service.h ('k') | mojo/examples/apptest/example_client_application.h » ('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 "mojo/examples/apptest/example_client_application.h" 5 #include "mojo/examples/apptest/example_client_application.h"
6 #include "mojo/examples/apptest/example_client_impl.h" 6 #include "mojo/examples/apptest/example_client_impl.h"
7 #include "mojo/examples/apptest/example_service.mojom.h" 7 #include "mojo/examples/apptest/example_service.mojom.h"
8 #include "mojo/public/c/system/main.h" 8 #include "mojo/public/c/system/main.h"
9 #include "mojo/public/cpp/application/application_delegate.h" 9 #include "mojo/public/cpp/application/application_delegate.h"
10 #include "mojo/public/cpp/application/application_impl.h" 10 #include "mojo/public/cpp/application/application_impl.h"
(...skipping 15 matching lines...) Expand all
26 namespace { 26 namespace {
27 27
28 class ExampleServiceTest : public testing::Test { 28 class ExampleServiceTest : public testing::Test {
29 public: 29 public:
30 ExampleServiceTest() { 30 ExampleServiceTest() {
31 g_application_impl_hack->ConnectToService("mojo:mojo_example_service", 31 g_application_impl_hack->ConnectToService("mojo:mojo_example_service",
32 &example_service_); 32 &example_service_);
33 example_service_.set_client(&example_client_); 33 example_service_.set_client(&example_client_);
34 } 34 }
35 35
36 virtual ~ExampleServiceTest() MOJO_OVERRIDE {} 36 virtual ~ExampleServiceTest() override {}
37 37
38 protected: 38 protected:
39 ExampleServicePtr example_service_; 39 ExampleServicePtr example_service_;
40 ExampleClientImpl example_client_; 40 ExampleClientImpl example_client_;
41 41
42 private: 42 private:
43 MOJO_DISALLOW_COPY_AND_ASSIGN(ExampleServiceTest); 43 MOJO_DISALLOW_COPY_AND_ASSIGN(ExampleServiceTest);
44 }; 44 };
45 45
46 TEST_F(ExampleServiceTest, Ping) { 46 TEST_F(ExampleServiceTest, Ping) {
47 EXPECT_EQ(0, example_client_.last_pong_value()); 47 EXPECT_EQ(0, example_client_.last_pong_value());
48 example_service_->Ping(1); 48 example_service_->Ping(1);
49 RunLoop::current()->Run(); 49 RunLoop::current()->Run();
50 EXPECT_EQ(1, example_client_.last_pong_value()); 50 EXPECT_EQ(1, example_client_.last_pong_value());
51 } 51 }
52 52
53 template <typename T> 53 template <typename T>
54 struct SetAndQuit : public Callback<void()>::Runnable { 54 struct SetAndQuit : public Callback<void()>::Runnable {
55 SetAndQuit(T* val, T result) : val_(val), result_(result) {} 55 SetAndQuit(T* val, T result) : val_(val), result_(result) {}
56 virtual ~SetAndQuit() {} 56 virtual ~SetAndQuit() {}
57 virtual void Run() const MOJO_OVERRIDE{ 57 virtual void Run() const override {
58 *val_ = result_; 58 *val_ = result_;
59 RunLoop::current()->Quit(); 59 RunLoop::current()->Quit();
60 } 60 }
61 T* val_; 61 T* val_;
62 T result_; 62 T result_;
63 }; 63 };
64 64
65 TEST_F(ExampleServiceTest, RunCallback) { 65 TEST_F(ExampleServiceTest, RunCallback) {
66 bool was_run = false; 66 bool was_run = false;
67 example_service_->RunCallback(SetAndQuit<bool>(&was_run, true)); 67 example_service_->RunCallback(SetAndQuit<bool>(&was_run, true));
(...skipping 17 matching lines...) Expand all
85 85
86 // TODO(msw): Get actual commandline arguments. 86 // TODO(msw): Get actual commandline arguments.
87 int argc = 0; 87 int argc = 0;
88 char** argv = NULL; 88 char** argv = NULL;
89 testing::InitGoogleTest(&argc, argv); 89 testing::InitGoogleTest(&argc, argv);
90 mojo_ignore_result(RUN_ALL_TESTS()); 90 mojo_ignore_result(RUN_ALL_TESTS());
91 91
92 delete delegate; 92 delete delegate;
93 return MOJO_RESULT_OK; 93 return MOJO_RESULT_OK;
94 } 94 }
OLDNEW
« no previous file with comments | « mojo/dbus/dbus_external_service.h ('k') | mojo/examples/apptest/example_client_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698