Infobar material design refresh: bg color
[chromium-blink-merge.git] / content / test / ppapi / ppapi_test.h
blob92d5f8b288f7d697ed3dfea20a4fc65647f46f79
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 CONTENT_TEST_PPAPI_PPAPI_TEST_H_
6 #define CONTENT_TEST_PPAPI_PPAPI_TEST_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "content/public/test/content_browser_test.h"
13 #include "content/public/test/javascript_test_observer.h"
14 #include "net/test/spawned_test_server/spawned_test_server.h"
15 #include "url/gurl.h"
17 // This file provides test classes for writing Pepper tests for
18 // content_browsertests. The interfaces provided here should look similar to
19 // what's available in chrome/test/ppapi.
21 namespace base {
22 class CommandLine;
25 namespace content {
27 class PPAPITestMessageHandler : public content::TestMessageHandler {
28 public:
29 PPAPITestMessageHandler();
31 MessageResponse HandleMessage(const std::string& json) override;
32 void Reset() override;
34 const std::string& message() const {
35 return message_;
38 private:
39 std::string message_;
41 DISALLOW_COPY_AND_ASSIGN(PPAPITestMessageHandler);
44 class PPAPITestBase : public ContentBrowserTest {
45 public:
46 PPAPITestBase();
48 // ContentBrowserTest overrides.
49 void SetUpCommandLine(base::CommandLine* command_line) override;
51 virtual std::string BuildQuery(const std::string& base,
52 const std::string& test_case) = 0;
54 // Returns the URL to load for file: tests.
55 GURL GetTestFileUrl(const std::string& test_case);
56 virtual void RunTest(const std::string& test_case);
58 // Run the test and reload. This can test for clean shutdown, including
59 // leaked instance object vars.
60 virtual void RunTestAndReload(const std::string& test_case);
62 protected:
63 // Runs the test for a tab given the tab that's already navigated to the
64 // given URL.
65 void RunTestURL(const GURL& test_url);
68 // In-process plugin test runner. See OutOfProcessPPAPITest below for the
69 // out-of-process version.
70 class PPAPITest : public PPAPITestBase {
71 public:
72 PPAPITest();
74 void SetUpCommandLine(base::CommandLine* command_line) override;
76 std::string BuildQuery(const std::string& base,
77 const std::string& test_case) override;
79 protected:
80 bool in_process_; // Controls the --ppapi-in-process switch.
83 // Variant of PPAPITest that runs plugins out-of-process to test proxy
84 // codepaths.
85 class OutOfProcessPPAPITest : public PPAPITest {
86 public:
87 OutOfProcessPPAPITest();
89 void SetUp() override;
90 void TearDown() override;
93 } // namespace
95 #endif // CONTENT_TEST_PPAPI_PPAPI_TEST_H_