shell_test_base.h revision 116680a4aac90f2aa7413d9095a592090648e557
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 MOJO_SHELL_SHELL_TEST_BASE_H_ 6#define MOJO_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 16class GURL; 17 18namespace mojo { 19namespace shell { 20namespace test { 21 22class ShellTestBase : public testing::Test { 23 public: 24 ShellTestBase(); 25 virtual ~ShellTestBase(); 26 27 // |application_url| should typically be a mojo: URL (the origin will be set 28 // to an "appropriate" file: URL). 29 // TODO(tim): Should the test base be a ServiceProvider? 30 ScopedMessagePipeHandle ConnectToService( 31 const GURL& application_url, 32 const std::string& service_name); 33 34 base::MessageLoop* message_loop() { return &message_loop_; } 35 Context* shell_context() { return &shell_context_; } 36 37 private: 38 base::MessageLoop message_loop_; 39 Context shell_context_; 40 41 DISALLOW_COPY_AND_ASSIGN(ShellTestBase); 42}; 43 44} // namespace test 45} // namespace shell 46} // namespace mojo 47 48#endif // MOJO_SHELL_SHELL_TEST_BASE_H_ 49