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 #include "mojo/public/cpp/application/application_test_base.h" | 5 #include "mojo/public/cpp/application/application_test_base.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "mojo/public/cpp/application/application_impl.h" | 9 #include "mojo/public/cpp/application/application_impl.h" |
10 #include "mojo/public/cpp/bindings/binding.h" | 10 #include "mojo/public/cpp/bindings/binding.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 { | 84 { |
85 // This loop is used for init, and then destroyed before running tests. | 85 // This loop is used for init, and then destroyed before running tests. |
86 Environment::InstantiateDefaultRunLoop(); | 86 Environment::InstantiateDefaultRunLoop(); |
87 | 87 |
88 // Grab the shell handle and GTEST commandline arguments. | 88 // Grab the shell handle and GTEST commandline arguments. |
89 // GTEST command line arguments are supported amid application arguments: | 89 // GTEST command line arguments are supported amid application arguments: |
90 // $ mojo_shell mojo:example_apptests | 90 // $ mojo_shell mojo:example_apptests |
91 // --args-for='mojo:example_apptests arg1 --gtest_filter=foo arg2' | 91 // --args-for='mojo:example_apptests arg1 --gtest_filter=foo arg2' |
92 Array<String> args; | 92 Array<String> args; |
93 ShellAndArgumentGrabber grabber( | 93 ShellAndArgumentGrabber grabber( |
94 &args, MakeRequest<Application>(MakeScopedHandle( | 94 &args, InterfaceRequest<Application>(MakeScopedHandle( |
95 MessagePipeHandle(application_request_handle)))); | 95 MessagePipeHandle(application_request_handle)))); |
96 grabber.WaitForInitialize(); | 96 grabber.WaitForInitialize(); |
97 MOJO_CHECK(g_shell); | 97 MOJO_CHECK(g_shell); |
98 MOJO_CHECK(g_application_request.is_pending()); | 98 MOJO_CHECK(g_application_request.is_pending()); |
99 | 99 |
100 // InitGoogleTest expects (argc + 1) elements, including a terminating null. | 100 // InitGoogleTest expects (argc + 1) elements, including a terminating null. |
101 // It also removes GTEST arguments from |argv| and updates the |argc| count. | 101 // It also removes GTEST arguments from |argv| and updates the |argc| count. |
102 MOJO_CHECK(args.size() < | 102 MOJO_CHECK(args.size() < |
103 static_cast<size_t>(std::numeric_limits<int>::max())); | 103 static_cast<size_t>(std::numeric_limits<int>::max())); |
104 int argc = static_cast<int>(args.size()); | 104 int argc = static_cast<int>(args.size()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 if (ShouldCreateDefaultRunLoop()) | 158 if (ShouldCreateDefaultRunLoop()) |
159 Environment::DestroyDefaultRunLoop(); | 159 Environment::DestroyDefaultRunLoop(); |
160 } | 160 } |
161 | 161 |
162 bool ApplicationTestBase::ShouldCreateDefaultRunLoop() { | 162 bool ApplicationTestBase::ShouldCreateDefaultRunLoop() { |
163 return true; | 163 return true; |
164 } | 164 } |
165 | 165 |
166 } // namespace test | 166 } // namespace test |
167 } // namespace mojo | 167 } // namespace mojo |
OLD | NEW |