[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / content / test / ppapi / ppapi_test.h
blobd02ca3e2720fa44400b585951f088679ef508c2a
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 virtual MessageResponse HandleMessage(const std::string& json) OVERRIDE;
32 virtual 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 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);
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 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE;
76 virtual std::string BuildQuery(const std::string& base,
77 const std::string& test_case) OVERRIDE;
78 protected:
79 bool in_process_; // Controls the --ppapi-in-process switch.
82 // Variant of PPAPITest that runs plugins out-of-process to test proxy
83 // codepaths.
84 class OutOfProcessPPAPITest : public PPAPITest {
85 public:
86 OutOfProcessPPAPITest();
89 } // namespace
91 #endif // CONTENT_TEST_PPAPI_PPAPI_TEST_H_