| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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 CHROME_TEST_UI_PPAPI_UITEST_H_ | |
| 6 #define CHROME_TEST_UI_PPAPI_UITEST_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "chrome/test/base/in_process_browser_test.h" | |
| 12 | |
| 13 class PPAPITestBase : public InProcessBrowserTest { | |
| 14 public: | |
| 15 PPAPITestBase(); | |
| 16 | |
| 17 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | |
| 18 | |
| 19 virtual std::string BuildQuery(const std::string& base, | |
| 20 const std::string& test_case) = 0; | |
| 21 | |
| 22 // Returns the URL to load for file: tests. | |
| 23 GURL GetTestFileUrl(const std::string& test_case); | |
| 24 void RunTest(const std::string& test_case); | |
| 25 // Run the test and reload. This can test for clean shutdown, including leaked | |
| 26 // instance object vars. | |
| 27 void RunTestAndReload(const std::string& test_case); | |
| 28 void RunTestViaHTTP(const std::string& test_case); | |
| 29 void RunTestWithSSLServer(const std::string& test_case); | |
| 30 void RunTestWithWebSocketServer(const std::string& test_case); | |
| 31 void RunTestIfAudioOutputAvailable(const std::string& test_case); | |
| 32 void RunTestViaHTTPIfAudioOutputAvailable(const std::string& test_case); | |
| 33 std::string StripPrefixes(const std::string& test_name); | |
| 34 | |
| 35 protected: | |
| 36 // Runs the test for a tab given the tab that's already navigated to the | |
| 37 // given URL. | |
| 38 void RunTestURL(const GURL& test_url); | |
| 39 // Run the given |test_case| on a HTTP test server whose document root is | |
| 40 // specified by |document_root|. |extra_params| will be passed as URL | |
| 41 // parameters to the test. | |
| 42 void RunHTTPTestServer(const FilePath& document_root, | |
| 43 const std::string& test_case, | |
| 44 const std::string& extra_params); | |
| 45 // Return the document root for the HTTP server on which tests will be run. | |
| 46 // The result is placed in |document_root|. False is returned upon failure. | |
| 47 bool GetHTTPDocumentRoot(FilePath* document_root); | |
| 48 }; | |
| 49 | |
| 50 // In-process plugin test runner. See OutOfProcessPPAPITest below for the | |
| 51 // out-of-process version. | |
| 52 class PPAPITest : public PPAPITestBase { | |
| 53 public: | |
| 54 PPAPITest(); | |
| 55 | |
| 56 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | |
| 57 | |
| 58 virtual std::string BuildQuery(const std::string& base, | |
| 59 const std::string& test_case) OVERRIDE; | |
| 60 }; | |
| 61 | |
| 62 // Variant of PPAPITest that runs plugins out-of-process to test proxy | |
| 63 // codepaths. | |
| 64 class OutOfProcessPPAPITest : public PPAPITest { | |
| 65 public: | |
| 66 OutOfProcessPPAPITest(); | |
| 67 | |
| 68 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | |
| 69 }; | |
| 70 | |
| 71 // NaCl plugin test runner for Newlib runtime. | |
| 72 class PPAPINaClTest : public PPAPITestBase { | |
| 73 public: | |
| 74 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | |
| 75 }; | |
| 76 | |
| 77 // NaCl plugin test runner for Newlib runtime. | |
| 78 class PPAPINaClNewlibTest : public PPAPINaClTest { | |
| 79 public: | |
| 80 virtual std::string BuildQuery(const std::string& base, | |
| 81 const std::string& test_case) OVERRIDE; | |
| 82 }; | |
| 83 | |
| 84 // NaCl plugin test runner for GNU-libc runtime. | |
| 85 class PPAPINaClGLibcTest : public PPAPINaClTest { | |
| 86 public: | |
| 87 virtual std::string BuildQuery(const std::string& base, | |
| 88 const std::string& test_case) OVERRIDE; | |
| 89 }; | |
| 90 | |
| 91 class PPAPINaClTestDisallowedSockets : public PPAPITestBase { | |
| 92 public: | |
| 93 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | |
| 94 | |
| 95 virtual std::string BuildQuery(const std::string& base, | |
| 96 const std::string& test_case) OVERRIDE; | |
| 97 }; | |
| 98 | |
| 99 #endif // CHROME_TEST_UI_PPAPI_UITEST_H_ | |
| OLD | NEW |