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

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

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 years, 8 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
« no previous file with comments | « mojo/shell/shell_apptest.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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SHELL_SHELL_TEST_BASE_H_
6 #define SHELL_SHELL_TEST_BASE_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h"
12 #include "mojo/public/cpp/system/core.h"
13 #include "mojo/shell/context.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15
16 class GURL;
17
18 namespace mojo {
19 namespace shell {
20 namespace test {
21
22 class ShellTestBase : public testing::Test {
23 public:
24 ShellTestBase();
25 ~ShellTestBase() override;
26
27 void SetUp() override;
28 void TearDown() override;
29
30 // |application_url| should typically be a mojo: URL (the origin will be set
31 // to an "appropriate" file: URL).
32 // TODO(tim): Should the test base be a ServiceProvider?
33 ScopedMessagePipeHandle ConnectToService(const GURL& application_url,
34 const std::string& service_name);
35
36 template <typename Interface>
37 void ConnectToService(const GURL& application_url,
38 InterfacePtr<Interface>* ptr) {
39 ptr->Bind(ConnectToService(application_url, Interface::Name_).Pass());
40 }
41
42 base::MessageLoop* message_loop() { return &message_loop_; }
43 Context* shell_context() { return &shell_context_; }
44
45 private:
46 // Set up the test applications so that mojo: URL resolves to those.
47 void SetUpTestApplications();
48
49 Context shell_context_;
50 base::MessageLoop message_loop_;
51
52 DISALLOW_COPY_AND_ASSIGN(ShellTestBase);
53 };
54
55 } // namespace test
56 } // namespace shell
57 } // namespace mojo
58
59 #endif // SHELL_SHELL_TEST_BASE_H_
OLDNEW
« no previous file with comments | « mojo/shell/shell_apptest.cc ('k') | mojo/shell/shell_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698