| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 | 146 |
| 147 GURL PPAPITestBase::GetTestFileUrl(const std::string& test_case) { | 147 GURL PPAPITestBase::GetTestFileUrl(const std::string& test_case) { |
| 148 base::FilePath test_path; | 148 base::FilePath test_path; |
| 149 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_path)); | 149 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_path)); |
| 150 test_path = test_path.Append(FILE_PATH_LITERAL("ppapi")); | 150 test_path = test_path.Append(FILE_PATH_LITERAL("ppapi")); |
| 151 test_path = test_path.Append(FILE_PATH_LITERAL("tests")); | 151 test_path = test_path.Append(FILE_PATH_LITERAL("tests")); |
| 152 test_path = test_path.Append(FILE_PATH_LITERAL("test_case.html")); | 152 test_path = test_path.Append(FILE_PATH_LITERAL("test_case.html")); |
| 153 | 153 |
| 154 // Sanity check the file name. | 154 // Sanity check the file name. |
| 155 EXPECT_TRUE(file_util::PathExists(test_path)); | 155 EXPECT_TRUE(base::PathExists(test_path)); |
| 156 | 156 |
| 157 GURL test_url = net::FilePathToFileURL(test_path); | 157 GURL test_url = net::FilePathToFileURL(test_path); |
| 158 | 158 |
| 159 GURL::Replacements replacements; | 159 GURL::Replacements replacements; |
| 160 std::string query = BuildQuery(std::string(), test_case); | 160 std::string query = BuildQuery(std::string(), test_case); |
| 161 replacements.SetQuery(query.c_str(), url_parse::Component(0, query.size())); | 161 replacements.SetQuery(query.c_str(), url_parse::Component(0, query.size())); |
| 162 return test_url.ReplaceComponents(replacements); | 162 return test_url.ReplaceComponents(replacements); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void PPAPITestBase::RunTest(const std::string& test_case) { | 165 void PPAPITestBase::RunTest(const std::string& test_case) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 void PPAPITest::SetUpCommandLine(CommandLine* command_line) { | 287 void PPAPITest::SetUpCommandLine(CommandLine* command_line) { |
| 288 PPAPITestBase::SetUpCommandLine(command_line); | 288 PPAPITestBase::SetUpCommandLine(command_line); |
| 289 | 289 |
| 290 // Append the switch to register the pepper plugin. | 290 // Append the switch to register the pepper plugin. |
| 291 // library name = <out dir>/<test_name>.<library_extension> | 291 // library name = <out dir>/<test_name>.<library_extension> |
| 292 // MIME type = application/x-ppapi-<test_name> | 292 // MIME type = application/x-ppapi-<test_name> |
| 293 base::FilePath plugin_dir; | 293 base::FilePath plugin_dir; |
| 294 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); | 294 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); |
| 295 | 295 |
| 296 base::FilePath plugin_lib = plugin_dir.Append(library_name); | 296 base::FilePath plugin_lib = plugin_dir.Append(library_name); |
| 297 EXPECT_TRUE(file_util::PathExists(plugin_lib)); | 297 EXPECT_TRUE(base::PathExists(plugin_lib)); |
| 298 base::FilePath::StringType pepper_plugin = plugin_lib.value(); | 298 base::FilePath::StringType pepper_plugin = plugin_lib.value(); |
| 299 pepper_plugin.append(FILE_PATH_LITERAL(";application/x-ppapi-tests")); | 299 pepper_plugin.append(FILE_PATH_LITERAL(";application/x-ppapi-tests")); |
| 300 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, | 300 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, |
| 301 pepper_plugin); | 301 pepper_plugin); |
| 302 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); | 302 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); |
| 303 | 303 |
| 304 if (in_process_) | 304 if (in_process_) |
| 305 command_line->AppendSwitch(switches::kPpapiInProcess); | 305 command_line->AppendSwitch(switches::kPpapiInProcess); |
| 306 } | 306 } |
| 307 | 307 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 318 PPAPITest::SetUpCommandLine(command_line); | 318 PPAPITest::SetUpCommandLine(command_line); |
| 319 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 319 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
| 320 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); | 320 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); |
| 321 } | 321 } |
| 322 | 322 |
| 323 void PPAPINaClTest::SetUpCommandLine(CommandLine* command_line) { | 323 void PPAPINaClTest::SetUpCommandLine(CommandLine* command_line) { |
| 324 PPAPITestBase::SetUpCommandLine(command_line); | 324 PPAPITestBase::SetUpCommandLine(command_line); |
| 325 | 325 |
| 326 base::FilePath plugin_lib; | 326 base::FilePath plugin_lib; |
| 327 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | 327 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); |
| 328 EXPECT_TRUE(file_util::PathExists(plugin_lib)); | 328 EXPECT_TRUE(base::PathExists(plugin_lib)); |
| 329 | 329 |
| 330 // Enable running NaCl outside of the store. | 330 // Enable running NaCl outside of the store. |
| 331 command_line->AppendSwitch(switches::kEnableNaCl); | 331 command_line->AppendSwitch(switches::kEnableNaCl); |
| 332 command_line->AppendSwitch(switches::kEnablePnacl); | 332 command_line->AppendSwitch(switches::kEnablePnacl); |
| 333 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); | 333 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); |
| 334 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 334 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
| 335 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); | 335 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); |
| 336 } | 336 } |
| 337 | 337 |
| 338 // Append the correct mode and testcase string | 338 // Append the correct mode and testcase string |
| (...skipping 16 matching lines...) Expand all Loading... |
| 355 return base::StringPrintf("%smode=nacl_pnacl&testcase=%s", base.c_str(), | 355 return base::StringPrintf("%smode=nacl_pnacl&testcase=%s", base.c_str(), |
| 356 test_case.c_str()); | 356 test_case.c_str()); |
| 357 } | 357 } |
| 358 | 358 |
| 359 void PPAPINaClTestDisallowedSockets::SetUpCommandLine( | 359 void PPAPINaClTestDisallowedSockets::SetUpCommandLine( |
| 360 CommandLine* command_line) { | 360 CommandLine* command_line) { |
| 361 PPAPITestBase::SetUpCommandLine(command_line); | 361 PPAPITestBase::SetUpCommandLine(command_line); |
| 362 | 362 |
| 363 base::FilePath plugin_lib; | 363 base::FilePath plugin_lib; |
| 364 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | 364 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); |
| 365 EXPECT_TRUE(file_util::PathExists(plugin_lib)); | 365 EXPECT_TRUE(base::PathExists(plugin_lib)); |
| 366 | 366 |
| 367 // Enable running NaCl outside of the store. | 367 // Enable running NaCl outside of the store. |
| 368 command_line->AppendSwitch(switches::kEnableNaCl); | 368 command_line->AppendSwitch(switches::kEnableNaCl); |
| 369 command_line->AppendSwitch(switches::kEnablePnacl); | 369 command_line->AppendSwitch(switches::kEnablePnacl); |
| 370 } | 370 } |
| 371 | 371 |
| 372 // Append the correct mode and testcase string | 372 // Append the correct mode and testcase string |
| 373 std::string PPAPINaClTestDisallowedSockets::BuildQuery( | 373 std::string PPAPINaClTestDisallowedSockets::BuildQuery( |
| 374 const std::string& base, | 374 const std::string& base, |
| 375 const std::string& test_case) { | 375 const std::string& test_case) { |
| 376 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), | 376 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
| 377 test_case.c_str()); | 377 test_case.c_str()); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { | 380 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { |
| 381 // The default content setting for the PPAPI broker is ASK. We purposefully | 381 // The default content setting for the PPAPI broker is ASK. We purposefully |
| 382 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. | 382 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. |
| 383 } | 383 } |
| OLD | NEW |