OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_TEST_BASE_H_ | |
6 #define MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_TEST_BASE_H_ | |
7 | |
8 #include "mojo/public/cpp/bindings/array.h" | |
9 #include "mojo/public/cpp/bindings/string.h" | |
10 #include "mojo/public/cpp/system/macros.h" | |
11 #include "testing/gtest/include/gtest/gtest.h" | |
12 | |
13 namespace mojo { | |
14 | |
15 class ApplicationDelegate; | |
16 class ApplicationImpl; | |
17 | |
18 namespace test { | |
19 | |
20 // A GTEST base class for application testing executed in mojo_shell. | |
21 class ApplicationTestBase : public testing::Test { | |
22 public: | |
23 explicit ApplicationTestBase(Array<String> args); | |
24 ~ApplicationTestBase() override; | |
25 | |
26 protected: | |
27 ApplicationImpl* application_impl() { return application_impl_; } | |
28 | |
29 // Get the ApplicationDelegate for the application to be tested. | |
30 virtual ApplicationDelegate* GetApplicationDelegate() = 0; | |
31 | |
32 // testing::Test: | |
33 void SetUp() override; | |
34 void TearDown() override; | |
35 | |
36 private: | |
37 // The command line arguments supplied to each test application instance. | |
38 Array<String> args_; | |
39 | |
40 // The application implementation instance, reconstructed for each test. | |
41 ApplicationImpl* application_impl_; | |
42 | |
43 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationTestBase); | |
44 }; | |
45 | |
46 } // namespace test | |
47 | |
48 } // namespace mojo | |
49 | |
50 #endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_TEST_BASE_H_ | |
OLD | NEW |