OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/test/ppapi/ppapi_test.h" | 5 #include "chrome/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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 test_path = test_path.Append(FILE_PATH_LITERAL("ppapi")); | 149 test_path = test_path.Append(FILE_PATH_LITERAL("ppapi")); |
150 test_path = test_path.Append(FILE_PATH_LITERAL("tests")); | 150 test_path = test_path.Append(FILE_PATH_LITERAL("tests")); |
151 test_path = test_path.Append(FILE_PATH_LITERAL("test_case.html")); | 151 test_path = test_path.Append(FILE_PATH_LITERAL("test_case.html")); |
152 | 152 |
153 // Sanity check the file name. | 153 // Sanity check the file name. |
154 EXPECT_TRUE(file_util::PathExists(test_path)); | 154 EXPECT_TRUE(file_util::PathExists(test_path)); |
155 | 155 |
156 GURL test_url = net::FilePathToFileURL(test_path); | 156 GURL test_url = net::FilePathToFileURL(test_path); |
157 | 157 |
158 GURL::Replacements replacements; | 158 GURL::Replacements replacements; |
159 std::string query = BuildQuery("", test_case); | 159 std::string query = BuildQuery(std::string(), test_case); |
160 replacements.SetQuery(query.c_str(), url_parse::Component(0, query.size())); | 160 replacements.SetQuery(query.c_str(), url_parse::Component(0, query.size())); |
161 return test_url.ReplaceComponents(replacements); | 161 return test_url.ReplaceComponents(replacements); |
162 } | 162 } |
163 | 163 |
164 void PPAPITestBase::RunTest(const std::string& test_case) { | 164 void PPAPITestBase::RunTest(const std::string& test_case) { |
165 GURL url = GetTestFileUrl(test_case); | 165 GURL url = GetTestFileUrl(test_case); |
166 RunTestURL(url); | 166 RunTestURL(url); |
167 } | 167 } |
168 | 168 |
169 void PPAPITestBase::RunTestAndReload(const std::string& test_case) { | 169 void PPAPITestBase::RunTestAndReload(const std::string& test_case) { |
170 GURL url = GetTestFileUrl(test_case); | 170 GURL url = GetTestFileUrl(test_case); |
171 RunTestURL(url); | 171 RunTestURL(url); |
172 // If that passed, we simply run the test again, which navigates again. | 172 // If that passed, we simply run the test again, which navigates again. |
173 RunTestURL(url); | 173 RunTestURL(url); |
174 } | 174 } |
175 | 175 |
176 void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) { | 176 void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) { |
177 base::FilePath document_root; | 177 base::FilePath document_root; |
178 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&document_root)); | 178 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&document_root)); |
179 base::FilePath http_document_root; | 179 base::FilePath http_document_root; |
180 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); | 180 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); |
181 net::TestServer http_server(net::TestServer::TYPE_HTTP, | 181 net::TestServer http_server(net::TestServer::TYPE_HTTP, |
182 net::TestServer::kLocalhost, | 182 net::TestServer::kLocalhost, |
183 document_root); | 183 document_root); |
184 ASSERT_TRUE(http_server.Start()); | 184 ASSERT_TRUE(http_server.Start()); |
185 RunTestURL(GetTestURL(http_server, test_case, "")); | 185 RunTestURL(GetTestURL(http_server, test_case, std::string())); |
186 } | 186 } |
187 | 187 |
188 void PPAPITestBase::RunTestWithSSLServer(const std::string& test_case) { | 188 void PPAPITestBase::RunTestWithSSLServer(const std::string& test_case) { |
189 base::FilePath http_document_root; | 189 base::FilePath http_document_root; |
190 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); | 190 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); |
191 net::TestServer http_server(net::TestServer::TYPE_HTTP, | 191 net::TestServer http_server(net::TestServer::TYPE_HTTP, |
192 net::TestServer::kLocalhost, | 192 net::TestServer::kLocalhost, |
193 http_document_root); | 193 http_document_root); |
194 net::TestServer ssl_server(net::TestServer::TYPE_HTTPS, | 194 net::TestServer ssl_server(net::TestServer::TYPE_HTTPS, |
195 net::BaseTestServer::SSLOptions(), | 195 net::BaseTestServer::SSLOptions(), |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 const std::string& base, | 369 const std::string& base, |
370 const std::string& test_case) { | 370 const std::string& test_case) { |
371 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), | 371 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
372 test_case.c_str()); | 372 test_case.c_str()); |
373 } | 373 } |
374 | 374 |
375 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { | 375 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { |
376 // The default content setting for the PPAPI broker is ASK. We purposefully | 376 // The default content setting for the PPAPI broker is ASK. We purposefully |
377 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. | 377 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. |
378 } | 378 } |
OLD | NEW |