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

Side by Side Diff: shell/android/nfc_apptest.cc

Issue 1990603002: Make ApplicationTestBase not use ApplicationImpl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: delete ApplicationImpl::WaitForInitialize() 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
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/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "mojo/public/cpp/application/application_impl.h"
8 #include "mojo/public/cpp/application/application_test_base.h" 7 #include "mojo/public/cpp/application/application_test_base.h"
9 #include "mojo/public/cpp/application/connect.h" 8 #include "mojo/public/cpp/application/connect.h"
10 #include "mojo/public/cpp/bindings/callback.h" 9 #include "mojo/public/cpp/bindings/callback.h"
11 #include "mojo/public/cpp/environment/logging.h" 10 #include "mojo/public/cpp/environment/logging.h"
12 #include "mojo/public/cpp/system/macros.h" 11 #include "mojo/public/cpp/system/macros.h"
13 #include "mojo/services/nfc/interfaces/nfc.mojom.h" 12 #include "mojo/services/nfc/interfaces/nfc.mojom.h"
14 13
15 namespace mojo { 14 namespace mojo {
16 namespace { 15 namespace {
17 16
18 // Tests the NFC mojo service on android. 17 // Tests the NFC mojo service on android.
19 class NfcApplicationTest : public test::ApplicationTestBase { 18 class NfcApplicationTest : public test::ApplicationTestBase {
20 public: 19 public:
21 NfcApplicationTest() : ApplicationTestBase() {} 20 NfcApplicationTest() : ApplicationTestBase() {}
22 ~NfcApplicationTest() override {} 21 ~NfcApplicationTest() override {}
23 22
24 void TransmitOnNextConnectionResult(bool success) {} 23 void TransmitOnNextConnectionResult(bool success) {}
25 24
26 protected: 25 protected:
27 // ApplicationTestBase: 26 // ApplicationTestBase:
28 void SetUp() override { 27 void SetUp() override {
29 ApplicationTestBase::SetUp(); 28 ApplicationTestBase::SetUp();
30 ConnectToService(application_impl()->shell(), "mojo:nfc", GetProxy(&nfc_)); 29 ConnectToService(shell(), "mojo:nfc", GetProxy(&nfc_));
31 } 30 }
32 31
33 nfc::NfcPtr nfc_; 32 nfc::NfcPtr nfc_;
34 nfc::NfcTransmissionPtr nfc_transmission_; 33 nfc::NfcTransmissionPtr nfc_transmission_;
35 34
36 private: 35 private:
37 MOJO_DISALLOW_COPY_AND_ASSIGN(NfcApplicationTest); 36 MOJO_DISALLOW_COPY_AND_ASSIGN(NfcApplicationTest);
38 }; 37 };
39 38
40 TEST_F(NfcApplicationTest, TransmitAndCancelNfc) { 39 TEST_F(NfcApplicationTest, TransmitAndCancelNfc) {
41 nfc::NfcDataPtr nfc_data = nfc::NfcData::New(); 40 nfc::NfcDataPtr nfc_data = nfc::NfcData::New();
42 nfc_->TransmitOnNextConnection( 41 nfc_->TransmitOnNextConnection(
43 nfc_data.Pass(), GetProxy(&nfc_transmission_), 42 nfc_data.Pass(), GetProxy(&nfc_transmission_),
44 base::Bind(&NfcApplicationTest::TransmitOnNextConnectionResult, 43 base::Bind(&NfcApplicationTest::TransmitOnNextConnectionResult,
45 base::Unretained(this))); 44 base::Unretained(this)));
46 nfc_transmission_->Cancel(); 45 nfc_transmission_->Cancel();
47 } 46 }
48 47
49 TEST_F(NfcApplicationTest, Register) { 48 TEST_F(NfcApplicationTest, Register) {
50 nfc_->Register(); 49 nfc_->Register();
51 } 50 }
52 51
53 } // namespace 52 } // namespace
54 } // namespace mojo 53 } // namespace mojo
OLDNEW
« no previous file with comments | « services/url_response_disk_cache/url_response_disk_cache_apptest.cc ('k') | shell/shell_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698