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

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

Issue 1139123006: Fork the mojo shell interfaces used by Mandoline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 5 years, 7 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
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 "mojo/public/interfaces/application/application.mojom.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14
15 namespace mojo {
16
17 class ApplicationImpl;
18
19 namespace test {
20
21 // Access the command line arguments passed to the application test.
22 const Array<String>& Args();
23
24 // Run all application tests. This must be called after the environment is
25 // initialized, to support construction of a default run loop.
26 MojoResult RunAllTests(MojoHandle application_request_handle);
27
28 // A GTEST base class for application testing executed in mojo_shell.
29 class ApplicationTestBase : public testing::Test {
30 public:
31 ApplicationTestBase();
32 ~ApplicationTestBase() override;
33
34 protected:
35 ApplicationImpl* application_impl() { return application_impl_; }
36
37 // Get the ApplicationDelegate for the application to be tested.
38 virtual ApplicationDelegate* GetApplicationDelegate();
39
40 // testing::Test:
41 void SetUp() override;
42 void TearDown() override;
43
44 // True by default, which indicates a MessageLoop will automatically be
45 // created for the application. Tests may override this function to prevent
46 // a default loop from being created.
47 virtual bool ShouldCreateDefaultRunLoop();
48
49 private:
50 // The application implementation instance, reconstructed for each test.
51 ApplicationImpl* application_impl_;
52 // The application delegate used if GetApplicationDelegate is not overridden.
53 ApplicationDelegate default_application_delegate_;
54
55 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationTestBase);
56 };
57
58 } // namespace test
59
60 } // namespace mojo
61
62 #endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_TEST_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698