| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/test/test_timeouts.h" | 7 #include "base/test/test_timeouts.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/test/automation/tab_proxy.h" | 10 #include "chrome/test/automation/tab_proxy.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 FilePath test_path; | 59 FilePath test_path; |
| 60 PathService::Get(base::DIR_SOURCE_ROOT, &test_path); | 60 PathService::Get(base::DIR_SOURCE_ROOT, &test_path); |
| 61 test_path = test_path.Append(FILE_PATH_LITERAL("ppapi")); | 61 test_path = test_path.Append(FILE_PATH_LITERAL("ppapi")); |
| 62 test_path = test_path.Append(FILE_PATH_LITERAL("tests")); | 62 test_path = test_path.Append(FILE_PATH_LITERAL("tests")); |
| 63 test_path = test_path.Append(FILE_PATH_LITERAL("test_case.html")); | 63 test_path = test_path.Append(FILE_PATH_LITERAL("test_case.html")); |
| 64 | 64 |
| 65 // Sanity check the file name. | 65 // Sanity check the file name. |
| 66 EXPECT_TRUE(file_util::PathExists(test_path)); | 66 EXPECT_TRUE(file_util::PathExists(test_path)); |
| 67 | 67 |
| 68 GURL::Replacements replacements; | 68 GURL::Replacements replacements; |
| 69 replacements.SetQuery(test_case.c_str(), | 69 std::string query("testcase="); |
| 70 url_parse::Component(0, test_case.size())); | 70 query += test_case; |
| 71 replacements.SetQuery(query.c_str(), url_parse::Component(0, query.size())); |
| 71 GURL test_url = net::FilePathToFileURL(test_path); | 72 GURL test_url = net::FilePathToFileURL(test_path); |
| 72 RunTestURL(test_url.ReplaceComponents(replacements)); | 73 RunTestURL(test_url.ReplaceComponents(replacements)); |
| 73 } | 74 } |
| 74 | 75 |
| 75 void RunTestViaHTTP(const std::string& test_case) { | 76 void RunTestViaHTTP(const std::string& test_case) { |
| 76 net::TestServer test_server( | 77 net::TestServer test_server( |
| 77 net::TestServer::TYPE_HTTP, | 78 net::TestServer::TYPE_HTTP, |
| 78 FilePath(FILE_PATH_LITERAL("ppapi/tests"))); | 79 FilePath(FILE_PATH_LITERAL("ppapi/tests"))); |
| 79 ASSERT_TRUE(test_server.Start()); | 80 ASSERT_TRUE(test_server.Start()); |
| 80 RunTestURL(test_server.GetURL("files/test_case.html?" + test_case)); | 81 RunTestURL( |
| 82 test_server.GetURL("files/test_case.html?testcase=" + test_case)); |
| 81 } | 83 } |
| 82 | 84 |
| 83 private: | 85 private: |
| 84 void RunTestURL(const GURL& test_url) { | 86 void RunTestURL(const GURL& test_url) { |
| 85 scoped_refptr<TabProxy> tab(GetActiveTab()); | 87 scoped_refptr<TabProxy> tab(GetActiveTab()); |
| 86 ASSERT_TRUE(tab.get()); | 88 ASSERT_TRUE(tab.get()); |
| 87 ASSERT_TRUE(tab->NavigateToURL(test_url)); | 89 ASSERT_TRUE(tab->NavigateToURL(test_url)); |
| 88 | 90 |
| 89 // First wait for the "starting" signal. This cookie is set at the start | 91 // First wait for the "starting" signal. This cookie is set at the start |
| 90 // of every test. Waiting for this separately allows us to avoid a single | 92 // of every test. Waiting for this separately allows us to avoid a single |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } | 140 } |
| 139 | 141 |
| 140 TEST_F(PPAPITest, URLUtil) { | 142 TEST_F(PPAPITest, URLUtil) { |
| 141 RunTest("URLUtil"); | 143 RunTest("URLUtil"); |
| 142 } | 144 } |
| 143 | 145 |
| 144 TEST_F(PPAPITest, CharSet) { | 146 TEST_F(PPAPITest, CharSet) { |
| 145 RunTest("CharSet"); | 147 RunTest("CharSet"); |
| 146 } | 148 } |
| 147 | 149 |
| 148 TEST_F(PPAPITest, Var) { | 150 TEST_F(PPAPITest, VarDeprecated) { |
| 149 RunTest("Var"); | 151 RunTest("VarDeprecated"); |
| 150 } | 152 } |
| 151 | 153 |
| 152 TEST_F(PPAPITest, PostMessage) { | 154 TEST_F(PPAPITest, PostMessage) { |
| 153 RunTest("PostMessage"); | 155 RunTest("PostMessage"); |
| 154 } | 156 } |
| 155 | 157 |
| 156 TEST_F(PPAPITest, FileIO) { | 158 TEST_F(PPAPITest, FileIO) { |
| 157 RunTestViaHTTP("FileIO"); | 159 RunTestViaHTTP("FileIO"); |
| 158 } | 160 } |
| 159 | 161 |
| 160 TEST_F(PPAPITest, FileRef) { | 162 TEST_F(PPAPITest, FileRef) { |
| 161 RunTestViaHTTP("FileRef"); | 163 RunTestViaHTTP("FileRef"); |
| 162 } | 164 } |
| 163 | 165 |
| 164 // http://crbug.com/63239 | 166 // http://crbug.com/63239 |
| 165 TEST_F(PPAPITest, DISABLED_DirectoryReader) { | 167 TEST_F(PPAPITest, DISABLED_DirectoryReader) { |
| 166 RunTestViaHTTP("DirectoryReader"); | 168 RunTestViaHTTP("DirectoryReader"); |
| 167 } | 169 } |
| 168 | 170 |
| 169 TEST_F(PPAPITest, Transport) { | 171 // http://crbug.com/83395 |
| 172 TEST_F(PPAPITest, DISABLED_Transport) { |
| 170 RunTest("Transport"); | 173 RunTest("Transport"); |
| 171 } | 174 } |
| OLD | NEW |