Chromium Code Reviews| 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/memory/scoped_ptr.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 "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 15 |
| 15 class GURL; | 16 class GURL; |
| 16 | 17 |
| 17 namespace base { | |
| 18 class MessageLoop; | |
| 19 } | |
| 20 | |
| 21 namespace mojo { | 18 namespace mojo { |
| 22 namespace shell { | 19 namespace shell { |
| 23 | 20 |
|
viettrungluu
2014/06/18 23:57:13
nit: You can delete this blank line (and its mate
tim (not reviewing)
2014/06/19 00:04:06
Done.
| |
| 24 class Context; | |
| 25 | |
| 26 namespace test { | 21 namespace test { |
| 27 | 22 |
| 28 class ShellTestBase : public testing::Test { | 23 class ShellTestBase : public testing::Test { |
| 29 public: | 24 public: |
| 30 ShellTestBase(); | 25 ShellTestBase(); |
| 31 virtual ~ShellTestBase(); | 26 virtual ~ShellTestBase(); |
| 32 | 27 |
| 33 // Should be called before any of the methods below are called. | |
| 34 void InitMojo(); | |
| 35 | |
| 36 // Launches the given service in-process; |service_url| should typically be a | 28 // Launches the given service in-process; |service_url| should typically be a |
| 37 // mojo: URL (the origin will be set to an "appropriate" file: URL). | 29 // mojo: URL (the origin will be set to an "appropriate" file: URL). |
| 38 void LaunchServiceInProcess(const GURL& service_url, | 30 void LaunchServiceInProcess(const GURL& service_url, |
| 39 const std::string& service_name, | 31 const std::string& service_name, |
| 40 ScopedMessagePipeHandle client_handle); | 32 ScopedMessagePipeHandle client_handle); |
| 41 | 33 |
| 42 base::MessageLoop* message_loop() { return message_loop_.get(); } | 34 base::MessageLoop* message_loop() { return &message_loop_; } |
| 43 Context* shell_context() { return shell_context_.get(); } | 35 Context* shell_context() { return &shell_context_; } |
| 44 | 36 |
| 45 private: | 37 private: |
| 46 // Only set if/when |InitMojo()| is called. | 38 base::MessageLoop message_loop_; |
| 47 scoped_ptr<base::MessageLoop> message_loop_; | 39 Context shell_context_; |
| 48 scoped_ptr<Context> shell_context_; | |
| 49 | 40 |
| 50 DISALLOW_COPY_AND_ASSIGN(ShellTestBase); | 41 DISALLOW_COPY_AND_ASSIGN(ShellTestBase); |
| 51 }; | 42 }; |
| 52 | 43 |
| 53 } // namespace test | 44 } // namespace test |
| 54 | 45 |
| 55 } // namespace shell | 46 } // namespace shell |
| 56 } // namespace mojo | 47 } // namespace mojo |
| 57 | 48 |
| 58 #endif // MOJO_SHELL_SHELL_TEST_BASE_H_ | 49 #endif // MOJO_SHELL_SHELL_TEST_BASE_H_ |
| OLD | NEW |