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 <string> | |
9 #include <vector> | |
10 | |
11 #include "gtest/gtest.h" | |
12 #include "mojo/public/cpp/bindings/array.h" | |
13 #include "mojo/public/cpp/bindings/string.h" | |
14 #include "mojo/public/cpp/system/macros.h" | |
15 #include "mojo/public/interfaces/application/application.mojom.h" | |
16 #include "mojo/public/interfaces/application/shell.mojom.h" | |
17 | |
18 namespace mojo { | |
19 namespace test { | |
20 | |
21 // Run all application tests. This must be called after the environment is | |
22 // initialized, to support construction of a default run loop. | |
23 MojoResult RunAllTests(MojoHandle application_request_handle); | |
24 | |
25 // A GTEST base class for application testing executed in mojo_shell. | |
26 class ApplicationTestBase : public testing::Test { | |
27 public: | |
28 ApplicationTestBase(); | |
29 ~ApplicationTestBase() override; | |
30 | |
31 protected: | |
32 Shell* shell() const { return shell_.get(); } | |
33 const std::vector<std::string>& args() const { return args_; } | |
34 | |
35 // testing::Test: | |
36 void SetUp() override; | |
37 void TearDown() override; | |
38 | |
39 // True by default, which indicates a MessageLoop will automatically be | |
40 // created for the application. Tests may override this function to prevent | |
41 // a default loop from being created. | |
42 virtual bool ShouldCreateDefaultRunLoop(); | |
43 | |
44 private: | |
45 ShellPtr shell_; | |
46 std::vector<std::string> args_; | |
47 | |
48 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationTestBase); | |
49 }; | |
50 | |
51 } // namespace test | |
52 } // namespace mojo | |
53 | |
54 #endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_TEST_BASE_H_ | |
OLD | NEW |