ToolbarOriginChipView is dead; remove the suppression for it.
[chromium-blink-merge.git] / mojo / shell / shell_test_helper.h
blob5d0df6ea5b86d77ae576a236988995796aab498b
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.
5 #ifndef MOJO_SHELL_SHELL_TEST_HELPER_
6 #define MOJO_SHELL_SHELL_TEST_HELPER_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/run_loop.h"
11 #include "base/threading/thread.h"
12 #include "mojo/public/cpp/environment/environment.h"
13 #include "mojo/public/interfaces/shell/shell.mojom.h"
15 namespace base {
16 class MessageLoopProxy;
17 class RunLoop;
20 namespace mojo {
21 namespace shell {
23 // ShellTestHelper is useful for tests to establish a connection to the Shell.
24 // ShellTestHelper does this by spawning a thread and connecting. Invoke Init()
25 // to do this. Once done, shell() returns the handle to the Shell.
26 class ShellTestHelper {
27 public:
28 struct State;
30 ShellTestHelper();
31 ~ShellTestHelper();
33 void Init();
35 // Returns a handle to the Shell. ShellTestHelper owns the shell.
36 Shell* shell() { return shell_.get(); }
38 private:
39 class TestShellClient;
41 // Invoked once connection has been established.
42 void OnShellStarted();
44 Environment environment_;
46 base::Thread shell_thread_;
48 // If non-null we're in Init() and waiting for connection.
49 scoped_ptr<base::RunLoop> run_loop_;
51 // See comment in declaration for details.
52 State* state_;
54 // Client interface for the shell.
55 scoped_ptr<TestShellClient> shell_client_;
57 ShellPtr shell_;
59 DISALLOW_COPY_AND_ASSIGN(ShellTestHelper);
62 } // namespace shell
63 } // namespace mojo
65 #endif // MOJO_SHELL_SHELL_TEST_HELPER_