| 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 SHELL_SHELL_TEST_BASE_H_ | 5 #ifndef SHELL_SHELL_TEST_BASE_H_ |
| 6 #define SHELL_SHELL_TEST_BASE_H_ | 6 #define 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 "shell/context.h" | 13 #include "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 mojo { | 18 namespace mojo { |
| 19 namespace shell { | 19 namespace shell { |
| 20 namespace test { | 20 namespace test { |
| 21 | 21 |
| 22 class ShellTestBase : public testing::Test { | 22 class ShellTestBase : public testing::Test { |
| 23 public: | 23 public: |
| 24 ShellTestBase(); | 24 ShellTestBase(); |
| 25 ~ShellTestBase() override; | 25 ~ShellTestBase() override; |
| 26 | 26 |
| 27 void SetUp() override; | 27 void SetUp() override; |
| 28 void TearDown() override; |
| 28 | 29 |
| 29 // |application_url| should typically be a mojo: URL (the origin will be set | 30 // |application_url| should typically be a mojo: URL (the origin will be set |
| 30 // to an "appropriate" file: URL). | 31 // to an "appropriate" file: URL). |
| 31 // TODO(tim): Should the test base be a ServiceProvider? | 32 // TODO(tim): Should the test base be a ServiceProvider? |
| 32 ScopedMessagePipeHandle ConnectToService(const GURL& application_url, | 33 ScopedMessagePipeHandle ConnectToService(const GURL& application_url, |
| 33 const std::string& service_name); | 34 const std::string& service_name); |
| 34 | 35 |
| 35 template <typename Interface> | 36 template <typename Interface> |
| 36 void ConnectToService(const GURL& application_url, | 37 void ConnectToService(const GURL& application_url, |
| 37 InterfacePtr<Interface>* ptr) { | 38 InterfacePtr<Interface>* ptr) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 49 base::MessageLoop message_loop_; | 50 base::MessageLoop message_loop_; |
| 50 | 51 |
| 51 DISALLOW_COPY_AND_ASSIGN(ShellTestBase); | 52 DISALLOW_COPY_AND_ASSIGN(ShellTestBase); |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 } // namespace test | 55 } // namespace test |
| 55 } // namespace shell | 56 } // namespace shell |
| 56 } // namespace mojo | 57 } // namespace mojo |
| 57 | 58 |
| 58 #endif // SHELL_SHELL_TEST_BASE_H_ | 59 #endif // SHELL_SHELL_TEST_BASE_H_ |
| OLD | NEW |