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_
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"
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.
27 class PPAPITestMessageHandler
: public content::TestMessageHandler
{
29 PPAPITestMessageHandler();
31 virtual MessageResponse
HandleMessage(const std::string
& json
) OVERRIDE
;
32 virtual void Reset() OVERRIDE
;
34 const std::string
& message() const {
41 DISALLOW_COPY_AND_ASSIGN(PPAPITestMessageHandler
);
44 class PPAPITestBase
: public ContentBrowserTest
{
48 // ContentBrowserTest overrides.
49 virtual 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
);
63 // Runs the test for a tab given the tab that's already navigated to the
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
{
74 virtual void SetUpCommandLine(base::CommandLine
* command_line
) OVERRIDE
;
76 virtual std::string
BuildQuery(const std::string
& base
,
77 const std::string
& test_case
) OVERRIDE
;
79 bool in_process_
; // Controls the --ppapi-in-process switch.
82 // Variant of PPAPITest that runs plugins out-of-process to test proxy
84 class OutOfProcessPPAPITest
: public PPAPITest
{
86 OutOfProcessPPAPITest();
91 #endif // CONTENT_TEST_PPAPI_PPAPI_TEST_H_