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

Side by Side Diff: mojo/public/cpp/application/application_test_base.h

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 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
« no previous file with comments | « mojo/public/cpp/application/application_runner.h ('k') | mojo/public/cpp/application/connect.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/application/application_delegate.h"
9 #include "mojo/public/cpp/bindings/array.h"
10 #include "mojo/public/cpp/bindings/string.h"
11 #include "mojo/public/cpp/system/macros.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace mojo {
15
16 class ApplicationImpl;
17
18 namespace test {
19
20 // Access the command line arguments passed to the application test.
21 const Array<String>& Args();
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);
26
27 // A GTEST base class for application testing executed in mojo_shell.
28 class ApplicationTestBase : public testing::Test {
29 public:
30 ApplicationTestBase();
31 ~ApplicationTestBase() override;
32
33 protected:
34 ApplicationImpl* application_impl() { return application_impl_; }
35
36 // Get the ApplicationDelegate for the application to be tested.
37 virtual ApplicationDelegate* GetApplicationDelegate();
38
39 // A testing::Test::SetUp helper to override the application command
40 // line arguments.
41 void SetUpWithArgs(const Array<String>& args);
42
43 // testing::Test:
44 void SetUp() override;
45 void TearDown() override;
46
47 // True by default, which indicates a MessageLoop will automatically be
48 // created for the application. Tests may override this function to prevent
49 // a default loop from being created.
50 virtual bool ShouldCreateDefaultRunLoop();
51
52 private:
53 // The application implementation instance, reconstructed for each test.
54 ApplicationImpl* application_impl_;
55 // The application delegate used if GetApplicationDelegate is not overridden.
56 ApplicationDelegate default_application_delegate_;
57
58 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationTestBase);
59 };
60
61 } // namespace test
62
63 } // namespace mojo
64
65 #endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_TEST_BASE_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/application/application_runner.h ('k') | mojo/public/cpp/application/connect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698