| 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/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 std::string query = BuildQuery(std::string(), test_case); | 165 std::string query = BuildQuery(std::string(), test_case); |
| 166 replacements.SetQuery(query.c_str(), url::Component(0, query.size())); | 166 replacements.SetQuery(query.c_str(), url::Component(0, query.size())); |
| 167 return test_url.ReplaceComponents(replacements); | 167 return test_url.ReplaceComponents(replacements); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void PPAPITestBase::RunTest(const std::string& test_case) { | 170 void PPAPITestBase::RunTest(const std::string& test_case) { |
| 171 GURL url = GetTestFileUrl(test_case); | 171 GURL url = GetTestFileUrl(test_case); |
| 172 RunTestURL(url); | 172 RunTestURL(url); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void PPAPITestBase::RunTestAndReload(const std::string& test_case) { | |
| 176 GURL url = GetTestFileUrl(test_case); | |
| 177 RunTestURL(url); | |
| 178 // If that passed, we simply run the test again, which navigates again. | |
| 179 RunTestURL(url); | |
| 180 } | |
| 181 | |
| 182 void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) { | 175 void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) { |
| 183 base::FilePath document_root; | 176 base::FilePath document_root; |
| 184 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&document_root)); | 177 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&document_root)); |
| 185 base::FilePath http_document_root; | 178 base::FilePath http_document_root; |
| 186 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); | 179 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); |
| 187 net::SpawnedTestServer http_server(net::SpawnedTestServer::TYPE_HTTP, | 180 net::SpawnedTestServer http_server(net::SpawnedTestServer::TYPE_HTTP, |
| 188 net::SpawnedTestServer::kLocalhost, | 181 net::SpawnedTestServer::kLocalhost, |
| 189 document_root); | 182 document_root); |
| 190 ASSERT_TRUE(http_server.Start()); | 183 ASSERT_TRUE(http_server.Start()); |
| 191 RunTestURL(GetTestURL(http_server, test_case, std::string())); | 184 RunTestURL(GetTestURL(http_server, test_case, std::string())); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | 346 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); |
| 354 EXPECT_TRUE(base::PathExists(plugin_lib)); | 347 EXPECT_TRUE(base::PathExists(plugin_lib)); |
| 355 } | 348 } |
| 356 | 349 |
| 357 void PPAPINaClTest::RunTest(const std::string& test_case) { | 350 void PPAPINaClTest::RunTest(const std::string& test_case) { |
| 358 #if !defined(DISABLE_NACL) | 351 #if !defined(DISABLE_NACL) |
| 359 PPAPITestBase::RunTest(test_case); | 352 PPAPITestBase::RunTest(test_case); |
| 360 #endif | 353 #endif |
| 361 } | 354 } |
| 362 | 355 |
| 363 void PPAPINaClTest::RunTestAndReload(const std::string& test_case) { | |
| 364 #if !defined(DISABLE_NACL) | |
| 365 PPAPITestBase::RunTestAndReload(test_case); | |
| 366 #endif | |
| 367 } | |
| 368 | |
| 369 void PPAPINaClTest::RunTestViaHTTP(const std::string& test_case) { | 356 void PPAPINaClTest::RunTestViaHTTP(const std::string& test_case) { |
| 370 #if !defined(DISABLE_NACL) | 357 #if !defined(DISABLE_NACL) |
| 371 PPAPITestBase::RunTestViaHTTP(test_case); | 358 PPAPITestBase::RunTestViaHTTP(test_case); |
| 372 #endif | 359 #endif |
| 373 } | 360 } |
| 374 | 361 |
| 375 void PPAPINaClTest::RunTestWithSSLServer(const std::string& test_case) { | 362 void PPAPINaClTest::RunTestWithSSLServer(const std::string& test_case) { |
| 376 #if !defined(DISABLE_NACL) | 363 #if !defined(DISABLE_NACL) |
| 377 PPAPITestBase::RunTestWithSSLServer(test_case); | 364 PPAPITestBase::RunTestWithSSLServer(test_case); |
| 378 #endif | 365 #endif |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 } | 460 } |
| 474 | 461 |
| 475 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { | 462 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { |
| 476 // The default content setting for the PPAPI broker is ASK. We purposefully | 463 // The default content setting for the PPAPI broker is ASK. We purposefully |
| 477 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. | 464 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. |
| 478 | 465 |
| 479 base::FilePath plugin_lib; | 466 base::FilePath plugin_lib; |
| 480 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | 467 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); |
| 481 EXPECT_TRUE(base::PathExists(plugin_lib)); | 468 EXPECT_TRUE(base::PathExists(plugin_lib)); |
| 482 } | 469 } |
| OLD | NEW |