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

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

Issue 1675153002: ApplicationImpl->ShellConnection, mojom::Application->mojom::ShellClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ci2
Patch Set: . Created 4 years, 10 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/shell/public/cpp/application_runner.h ('k') | mojo/shell/public/cpp/connection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SHELL_PUBLIC_CPP_APPLICATION_TEST_BASE_H_ 5 #ifndef MOJO_SHELL_PUBLIC_CPP_APPLICATION_TEST_BASE_H_
6 #define MOJO_SHELL_PUBLIC_CPP_APPLICATION_TEST_BASE_H_ 6 #define MOJO_SHELL_PUBLIC_CPP_APPLICATION_TEST_BASE_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.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 "mojo/shell/public/cpp/application_impl.h"
13 #include "mojo/shell/public/cpp/shell_client.h" 12 #include "mojo/shell/public/cpp/shell_client.h"
14 #include "mojo/shell/public/interfaces/application.mojom.h" 13 #include "mojo/shell/public/cpp/shell_connection.h"
14 #include "mojo/shell/public/interfaces/shell_client.mojom.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace mojo { 17 namespace mojo {
18 18
19 class ApplicationImpl; 19 class ShellConnection;
20 20
21 namespace test { 21 namespace test {
22 22
23 // Run all application tests. This must be called after the environment is 23 // Run all application tests. This must be called after the environment is
24 // initialized, to support construction of a default run loop. 24 // initialized, to support construction of a default run loop.
25 MojoResult RunAllTests(MojoHandle application_request_handle); 25 MojoResult RunAllTests(MojoHandle shell_client_request_handle);
26 26
27 // Used to configure the ApplicationImpl. This is used internally by 27 // Used to configure the ShellConnection. This is used internally by
28 // ApplicationTestBase, but useful if you do not want to subclass 28 // ApplicationTestBase, but useful if you do not want to subclass
29 // ApplicationTestBase. 29 // ApplicationTestBase.
30 class TestHelper { 30 class TestHelper {
31 public: 31 public:
32 explicit TestHelper(ShellClient* client); 32 explicit TestHelper(ShellClient* client);
33 ~TestHelper(); 33 ~TestHelper();
34 34
35 Shell* shell() { return application_impl_.get(); } 35 Shell* shell() { return shell_connection_.get(); }
36 std::string shell_url() { return url_; } 36 std::string shell_url() { return url_; }
37 37
38 private: 38 private:
39 // The application delegate used if GetShellClient is not overridden. 39 // The application delegate used if GetShellClient is not overridden.
40 ShellClient default_shell_client_; 40 ShellClient default_shell_client_;
41 41
42 // The application implementation instance, reconstructed for each test. 42 // The application implementation instance, reconstructed for each test.
43 scoped_ptr<ApplicationImpl> application_impl_; 43 scoped_ptr<ShellConnection> shell_connection_;
44 44
45 std::string url_; 45 std::string url_;
46 46
47 MOJO_DISALLOW_COPY_AND_ASSIGN(TestHelper); 47 MOJO_DISALLOW_COPY_AND_ASSIGN(TestHelper);
48 }; 48 };
49 49
50 // A GTEST base class for application testing executed in mojo_shell. 50 // A GTEST base class for application testing executed in mojo_shell.
51 class ApplicationTestBase : public testing::Test { 51 class ApplicationTestBase : public testing::Test {
52 public: 52 public:
53 ApplicationTestBase(); 53 ApplicationTestBase();
(...skipping 23 matching lines...) Expand all
77 scoped_ptr<TestHelper> test_helper_; 77 scoped_ptr<TestHelper> test_helper_;
78 78
79 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationTestBase); 79 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationTestBase);
80 }; 80 };
81 81
82 } // namespace test 82 } // namespace test
83 83
84 } // namespace mojo 84 } // namespace mojo
85 85
86 #endif // MOJO_SHELL_PUBLIC_CPP_APPLICATION_TEST_BASE_H_ 86 #endif // MOJO_SHELL_PUBLIC_CPP_APPLICATION_TEST_BASE_H_
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/application_runner.h ('k') | mojo/shell/public/cpp/connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698