| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_TEST_PPAPI_PPAPI_TEST_H_ | 5 #ifndef CONTENT_TEST_PPAPI_PPAPI_TEST_H_ |
| 6 #define CONTENT_TEST_PPAPI_PPAPI_TEST_H_ | 6 #define CONTENT_TEST_PPAPI_PPAPI_TEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace base { | 21 namespace base { |
| 22 class CommandLine; | 22 class CommandLine; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 | 26 |
| 27 class PPAPITestMessageHandler : public content::TestMessageHandler { | 27 class PPAPITestMessageHandler : public content::TestMessageHandler { |
| 28 public: | 28 public: |
| 29 PPAPITestMessageHandler(); | 29 PPAPITestMessageHandler(); |
| 30 | 30 |
| 31 virtual MessageResponse HandleMessage(const std::string& json) override; | 31 MessageResponse HandleMessage(const std::string& json) override; |
| 32 virtual void Reset() override; | 32 void Reset() override; |
| 33 | 33 |
| 34 const std::string& message() const { | 34 const std::string& message() const { |
| 35 return message_; | 35 return message_; |
| 36 } | 36 } |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 std::string message_; | 39 std::string message_; |
| 40 | 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(PPAPITestMessageHandler); | 41 DISALLOW_COPY_AND_ASSIGN(PPAPITestMessageHandler); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 class PPAPITestBase : public ContentBrowserTest { | 44 class PPAPITestBase : public ContentBrowserTest { |
| 45 public: | 45 public: |
| 46 PPAPITestBase(); | 46 PPAPITestBase(); |
| 47 | 47 |
| 48 // ContentBrowserTest overrides. | 48 // ContentBrowserTest overrides. |
| 49 virtual void SetUpCommandLine(base::CommandLine* command_line) override; | 49 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 50 | 50 |
| 51 virtual std::string BuildQuery(const std::string& base, | 51 virtual std::string BuildQuery(const std::string& base, |
| 52 const std::string& test_case) = 0; | 52 const std::string& test_case) = 0; |
| 53 | 53 |
| 54 // Returns the URL to load for file: tests. | 54 // Returns the URL to load for file: tests. |
| 55 GURL GetTestFileUrl(const std::string& test_case); | 55 GURL GetTestFileUrl(const std::string& test_case); |
| 56 virtual void RunTest(const std::string& test_case); | 56 virtual void RunTest(const std::string& test_case); |
| 57 | 57 |
| 58 // Run the test and reload. This can test for clean shutdown, including | 58 // Run the test and reload. This can test for clean shutdown, including |
| 59 // leaked instance object vars. | 59 // leaked instance object vars. |
| 60 virtual void RunTestAndReload(const std::string& test_case); | 60 virtual void RunTestAndReload(const std::string& test_case); |
| 61 | 61 |
| 62 protected: | 62 protected: |
| 63 // Runs the test for a tab given the tab that's already navigated to the | 63 // Runs the test for a tab given the tab that's already navigated to the |
| 64 // given URL. | 64 // given URL. |
| 65 void RunTestURL(const GURL& test_url); | 65 void RunTestURL(const GURL& test_url); |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 // In-process plugin test runner. See OutOfProcessPPAPITest below for the | 68 // In-process plugin test runner. See OutOfProcessPPAPITest below for the |
| 69 // out-of-process version. | 69 // out-of-process version. |
| 70 class PPAPITest : public PPAPITestBase { | 70 class PPAPITest : public PPAPITestBase { |
| 71 public: | 71 public: |
| 72 PPAPITest(); | 72 PPAPITest(); |
| 73 | 73 |
| 74 virtual void SetUpCommandLine(base::CommandLine* command_line) override; | 74 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 75 | 75 |
| 76 virtual std::string BuildQuery(const std::string& base, | 76 std::string BuildQuery(const std::string& base, |
| 77 const std::string& test_case) override; | 77 const std::string& test_case) override; |
| 78 |
| 78 protected: | 79 protected: |
| 79 bool in_process_; // Controls the --ppapi-in-process switch. | 80 bool in_process_; // Controls the --ppapi-in-process switch. |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 // Variant of PPAPITest that runs plugins out-of-process to test proxy | 83 // Variant of PPAPITest that runs plugins out-of-process to test proxy |
| 83 // codepaths. | 84 // codepaths. |
| 84 class OutOfProcessPPAPITest : public PPAPITest { | 85 class OutOfProcessPPAPITest : public PPAPITest { |
| 85 public: | 86 public: |
| 86 OutOfProcessPPAPITest(); | 87 OutOfProcessPPAPITest(); |
| 87 | 88 |
| 88 virtual void SetUp() override; | 89 void SetUp() override; |
| 89 virtual void TearDown() override; | 90 void TearDown() override; |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 } // namespace | 93 } // namespace |
| 93 | 94 |
| 94 #endif // CONTENT_TEST_PPAPI_PPAPI_TEST_H_ | 95 #endif // CONTENT_TEST_PPAPI_PPAPI_TEST_H_ |
| OLD | NEW |