OLD | NEW |
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 #ifndef MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_TEST_BASE_H_ | 5 #ifndef MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_TEST_BASE_H_ |
6 #define MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_TEST_BASE_H_ | 6 #define MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_TEST_BASE_H_ |
7 | 7 |
8 #include "mojo/public/cpp/application/application_delegate.h" | 8 #include "mojo/public/cpp/application/application_delegate.h" |
9 #include "mojo/public/cpp/bindings/array.h" | 9 #include "mojo/public/cpp/bindings/array.h" |
10 #include "mojo/public/cpp/bindings/string.h" | 10 #include "mojo/public/cpp/bindings/string.h" |
11 #include "mojo/public/cpp/system/macros.h" | 11 #include "mojo/public/cpp/system/macros.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 | 15 |
16 class ApplicationImpl; | 16 class ApplicationImpl; |
17 | 17 |
18 namespace test { | 18 namespace test { |
19 | 19 |
20 // Access the shell handle shared by multiple test application instances. | |
21 ScopedMessagePipeHandle PassShellHandle(); | |
22 void SetShellHandle(ScopedMessagePipeHandle handle); | |
23 | |
24 // Access the command line arguments passed to the application test. | 20 // Access the command line arguments passed to the application test. |
25 const Array<String>& Args(); | 21 const Array<String>& Args(); |
26 void InitializeArgs(int argc, std::vector<const char*> argv); | 22 |
| 23 // Run all application tests. This must be called after the environment is |
| 24 // initialized, to support construction of a default run loop. |
| 25 MojoResult RunAllTests(MojoHandle shell_handle); |
27 | 26 |
28 // A GTEST base class for application testing executed in mojo_shell. | 27 // A GTEST base class for application testing executed in mojo_shell. |
29 class ApplicationTestBase : public testing::Test { | 28 class ApplicationTestBase : public testing::Test { |
30 public: | 29 public: |
31 ApplicationTestBase(); | 30 ApplicationTestBase(); |
32 ~ApplicationTestBase() override; | 31 ~ApplicationTestBase() override; |
33 | 32 |
34 protected: | 33 protected: |
35 ApplicationImpl* application_impl() { return application_impl_; } | 34 ApplicationImpl* application_impl() { return application_impl_; } |
36 | 35 |
(...skipping 20 matching lines...) Expand all Loading... |
57 ApplicationDelegate default_application_delegate_; | 56 ApplicationDelegate default_application_delegate_; |
58 | 57 |
59 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationTestBase); | 58 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationTestBase); |
60 }; | 59 }; |
61 | 60 |
62 } // namespace test | 61 } // namespace test |
63 | 62 |
64 } // namespace mojo | 63 } // namespace mojo |
65 | 64 |
66 #endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_TEST_BASE_H_ | 65 #endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_TEST_BASE_H_ |
OLD | NEW |