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

Side by Side Diff: mojo/shell/shell_test_base.h

Issue 314293002: Mojo: Add a trivial end-to-end (in-process) test of Mojo shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « mojo/services/test_service/test_service_impl.cc ('k') | mojo/shell/shell_test_base.cc » ('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_SHELL_TEST_BASE_H_ 5 #ifndef MOJO_SHELL_SHELL_TEST_BASE_H_
6 #define MOJO_SHELL_SHELL_TEST_BASE_H_ 6 #define MOJO_SHELL_SHELL_TEST_BASE_H_
7 7
8 #include "base/at_exit.h" 8 #include <string>
9
9 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
10 #include "mojo/public/cpp/environment/environment.h" 12 #include "mojo/public/cpp/environment/environment.h"
13 #include "mojo/public/cpp/system/core.h"
11 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
12 15
16 class GURL;
17
18 namespace base {
19 class MessageLoop;
20 }
21
13 namespace mojo { 22 namespace mojo {
14 namespace shell { 23 namespace shell {
24
25 class Context;
26
15 namespace test { 27 namespace test {
16 28
17 class ShellTestBase : public testing::Test { 29 class ShellTestBase : public testing::Test {
18 public: 30 public:
19 ShellTestBase(); 31 ShellTestBase();
20 virtual ~ShellTestBase(); 32 virtual ~ShellTestBase();
21 33
34 // Should be called before any of the methods below are called.
35 void InitMojo();
36
37 // Launches the given service in-process; |service_url| should typically be a
38 // mojo: URL (the origin will be set to an "appropriate" file: URL).
39 void LaunchServiceInProcess(const GURL& service_url,
40 const std::string& service_name,
41 ScopedMessagePipeHandle client_handle);
42
43 base::MessageLoop* message_loop() { return message_loop_.get(); }
44 Context* shell_context() { return shell_context_.get(); }
45
22 private: 46 private:
23 base::ShadowingAtExitManager at_exit_manager_;
24 Environment environment_; 47 Environment environment_;
25 48
49 // Only set if/when |InitMojo()| is called.
50 scoped_ptr<base::MessageLoop> message_loop_;
51 scoped_ptr<Context> shell_context_;
52
26 DISALLOW_COPY_AND_ASSIGN(ShellTestBase); 53 DISALLOW_COPY_AND_ASSIGN(ShellTestBase);
27 }; 54 };
28 55
29 } // namespace test 56 } // namespace test
57
30 } // namespace shell 58 } // namespace shell
31 } // namespace mojo 59 } // namespace mojo
32 60
33 #endif // MOJO_SYSTEM_SHELL_SHELLASE_H_ 61 #endif // MOJO_SHELL_SHELL_TEST_BASE_H_
OLDNEW
« no previous file with comments | « mojo/services/test_service/test_service_impl.cc ('k') | mojo/shell/shell_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698