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 #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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "mojo/public/cpp/system/core.h" | 12 #include "mojo/public/cpp/system/core.h" |
13 #include "mojo/shell/context.h" | 13 #include "mojo/shell/context.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 class GURL; | 16 class GURL; |
17 | 17 |
| 18 namespace net { |
| 19 namespace test_server { |
| 20 class EmbeddedTestServer; |
| 21 } |
| 22 } // namespace net |
| 23 |
18 namespace mojo { | 24 namespace mojo { |
19 namespace shell { | 25 namespace shell { |
20 namespace test { | 26 namespace test { |
21 | 27 |
22 class ShellTestBase : public testing::Test { | 28 class ShellTestBase : public testing::Test { |
23 public: | 29 public: |
24 ShellTestBase(); | 30 ShellTestBase(); |
25 virtual ~ShellTestBase(); | 31 virtual ~ShellTestBase(); |
26 | 32 |
| 33 virtual void SetUp() OVERRIDE; |
| 34 |
27 // |application_url| should typically be a mojo: URL (the origin will be set | 35 // |application_url| should typically be a mojo: URL (the origin will be set |
28 // to an "appropriate" file: URL). | 36 // to an "appropriate" file: URL). |
29 // TODO(tim): Should the test base be a ServiceProvider? | 37 // TODO(tim): Should the test base be a ServiceProvider? |
30 ScopedMessagePipeHandle ConnectToService( | 38 ScopedMessagePipeHandle ConnectToService( |
31 const GURL& application_url, | 39 const GURL& application_url, |
32 const std::string& service_name); | 40 const std::string& service_name); |
33 | 41 |
| 42 ScopedMessagePipeHandle ConnectToServiceViaNetwork( |
| 43 const GURL& application_url, |
| 44 const std::string& service_name); |
| 45 |
34 base::MessageLoop* message_loop() { return &message_loop_; } | 46 base::MessageLoop* message_loop() { return &message_loop_; } |
35 Context* shell_context() { return &shell_context_; } | 47 Context* shell_context() { return &shell_context_; } |
36 | 48 |
37 private: | 49 private: |
| 50 scoped_ptr<net::test_server::EmbeddedTestServer> test_server_; |
38 base::MessageLoop message_loop_; | 51 base::MessageLoop message_loop_; |
39 Context shell_context_; | 52 Context shell_context_; |
40 | 53 |
41 DISALLOW_COPY_AND_ASSIGN(ShellTestBase); | 54 DISALLOW_COPY_AND_ASSIGN(ShellTestBase); |
42 }; | 55 }; |
43 | 56 |
44 } // namespace test | 57 } // namespace test |
45 } // namespace shell | 58 } // namespace shell |
46 } // namespace mojo | 59 } // namespace mojo |
47 | 60 |
48 #endif // MOJO_SHELL_SHELL_TEST_BASE_H_ | 61 #endif // MOJO_SHELL_SHELL_TEST_BASE_H_ |
OLD | NEW |