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

Side by Side Diff: shell/shell_test_base.h

Issue 775343004: Move //mojo/shell to //shell (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « shell/out_of_process_dynamic_service_runner.cc ('k') | 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 SHELL_SHELL_TEST_BASE_H_
6 #define MOJO_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 "mojo/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 28
29 // |application_url| should typically be a mojo: URL (the origin will be set 29 // |application_url| should typically be a mojo: URL (the origin will be set
30 // to an "appropriate" file: URL). 30 // to an "appropriate" file: URL).
31 // TODO(tim): Should the test base be a ServiceProvider? 31 // TODO(tim): Should the test base be a ServiceProvider?
32 ScopedMessagePipeHandle ConnectToService( 32 ScopedMessagePipeHandle ConnectToService(const GURL& application_url,
33 const GURL& application_url, 33 const std::string& service_name);
34 const std::string& service_name);
35 34
36 ScopedMessagePipeHandle ConnectToServiceViaNetwork( 35 ScopedMessagePipeHandle ConnectToServiceViaNetwork(
37 const GURL& application_url, 36 const GURL& application_url,
38 const std::string& service_name); 37 const std::string& service_name);
39 38
40 template <typename Interface> 39 template <typename Interface>
41 void ConnectToService(const GURL& application_url, 40 void ConnectToService(const GURL& application_url,
42 InterfacePtr<Interface>* ptr) { 41 InterfacePtr<Interface>* ptr) {
43 ptr->Bind(ConnectToService(application_url, Interface::Name_).Pass()); 42 ptr->Bind(ConnectToService(application_url, Interface::Name_).Pass());
44 } 43 }
45 44
46 template <typename Interface> 45 template <typename Interface>
47 void ConnectToServiceViaNetwork(const GURL& application_url, 46 void ConnectToServiceViaNetwork(const GURL& application_url,
48 InterfacePtr<Interface>* ptr) { 47 InterfacePtr<Interface>* ptr) {
49 ptr->Bind( 48 ptr->Bind(
50 ConnectToServiceViaNetwork(application_url, Interface::Name_).Pass()); 49 ConnectToServiceViaNetwork(application_url, Interface::Name_).Pass());
51 } 50 }
52 51
53 base::MessageLoop* message_loop() { return &message_loop_; } 52 base::MessageLoop* message_loop() { return &message_loop_; }
54 Context* shell_context() { return &shell_context_; } 53 Context* shell_context() { return &shell_context_; }
55 54
56 private: 55 private:
57 Context shell_context_; 56 Context shell_context_;
58 base::MessageLoop message_loop_; 57 base::MessageLoop message_loop_;
59 58
60 DISALLOW_COPY_AND_ASSIGN(ShellTestBase); 59 DISALLOW_COPY_AND_ASSIGN(ShellTestBase);
61 }; 60 };
62 61
63 } // namespace test 62 } // namespace test
64 } // namespace shell 63 } // namespace shell
65 } // namespace mojo 64 } // namespace mojo
66 65
67 #endif // MOJO_SHELL_SHELL_TEST_BASE_H_ 66 #endif // SHELL_SHELL_TEST_BASE_H_
OLDNEW
« no previous file with comments | « shell/out_of_process_dynamic_service_runner.cc ('k') | shell/shell_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698