| 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 #include "content/test/ppapi/ppapi_test.h" | 5 #include "content/test/ppapi/ppapi_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 std::string query = BuildQuery(std::string(), test_case); | 66 std::string query = BuildQuery(std::string(), test_case); |
| 67 replacements.SetQuery(query.c_str(), url::Component(0, query.size())); | 67 replacements.SetQuery(query.c_str(), url::Component(0, query.size())); |
| 68 return test_url.ReplaceComponents(replacements); | 68 return test_url.ReplaceComponents(replacements); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void PPAPITestBase::RunTest(const std::string& test_case) { | 71 void PPAPITestBase::RunTest(const std::string& test_case) { |
| 72 GURL url = GetTestFileUrl(test_case); | 72 GURL url = GetTestFileUrl(test_case); |
| 73 RunTestURL(url); | 73 RunTestURL(url); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void PPAPITestBase::RunTestAndReload(const std::string& test_case) { |
| 77 GURL url = GetTestFileUrl(test_case); |
| 78 RunTestURL(url); |
| 79 // If that passed, we simply run the test again, which navigates again. |
| 80 RunTestURL(url); |
| 81 } |
| 82 |
| 76 void PPAPITestBase::RunTestURL(const GURL& test_url) { | 83 void PPAPITestBase::RunTestURL(const GURL& test_url) { |
| 77 // See comment above TestingInstance in ppapi/test/testing_instance.h. | 84 // See comment above TestingInstance in ppapi/test/testing_instance.h. |
| 78 // Basically it sends messages using the DOM automation controller. The | 85 // Basically it sends messages using the DOM automation controller. The |
| 79 // value of "..." means it's still working and we should continue to wait, | 86 // value of "..." means it's still working and we should continue to wait, |
| 80 // any other value indicates completion (in this case it will start with | 87 // any other value indicates completion (in this case it will start with |
| 81 // "PASS" or "FAIL"). This keeps us from timing out on waits for long tests. | 88 // "PASS" or "FAIL"). This keeps us from timing out on waits for long tests. |
| 82 PPAPITestMessageHandler handler; | 89 PPAPITestMessageHandler handler; |
| 83 JavascriptTestObserver observer(shell()->web_contents(), &handler); | 90 JavascriptTestObserver observer(shell()->web_contents(), &handler); |
| 84 shell()->LoadURL(test_url); | 91 shell()->LoadURL(test_url); |
| 85 | 92 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 113 std::string PPAPITest::BuildQuery(const std::string& base, | 120 std::string PPAPITest::BuildQuery(const std::string& base, |
| 114 const std::string& test_case){ | 121 const std::string& test_case){ |
| 115 return base::StringPrintf("%stestcase=%s", base.c_str(), test_case.c_str()); | 122 return base::StringPrintf("%stestcase=%s", base.c_str(), test_case.c_str()); |
| 116 } | 123 } |
| 117 | 124 |
| 118 OutOfProcessPPAPITest::OutOfProcessPPAPITest() { | 125 OutOfProcessPPAPITest::OutOfProcessPPAPITest() { |
| 119 in_process_ = false; | 126 in_process_ = false; |
| 120 } | 127 } |
| 121 | 128 |
| 122 } // namespace content | 129 } // namespace content |
| OLD | NEW |