Chromium Code Reviews| Index: chrome/test/nacl/nacl_browsertest_util.cc |
| diff --git a/chrome/test/nacl/nacl_browsertest_util.cc b/chrome/test/nacl/nacl_browsertest_util.cc |
| index 48cde92d724d60d86a7866f68b313b1d9ca45e89..fbc307425de85ab88202fb341fe139bdf80f5677 100644 |
| --- a/chrome/test/nacl/nacl_browsertest_util.cc |
| +++ b/chrome/test/nacl/nacl_browsertest_util.cc |
| @@ -187,6 +187,15 @@ static void AddPnaclParm(const base::FilePath::StringType& url, |
| } |
| } |
| +static void AddPnaclDisabledParm(const base::FilePath::StringType& url, |
| + base::FilePath::StringType* url_with_parm) { |
| + if (url.find(FILE_PATH_LITERAL("?")) == base::FilePath::StringType::npos) { |
| + *url_with_parm = url + FILE_PATH_LITERAL("?pnacl_disabled=1"); |
| + } else { |
| + *url_with_parm = url + FILE_PATH_LITERAL("&pnacl_disabled=1"); |
| + } |
| +} |
| + |
| NaClBrowserTestBase::NaClBrowserTestBase() { |
| } |
| @@ -211,7 +220,11 @@ bool NaClBrowserTestBase::GetDocumentRoot(base::FilePath* document_root) { |
| return GetNaClVariantRoot(Variant(), document_root); |
| } |
| -bool NaClBrowserTestBase::IsPnacl() { |
| +bool NaClBrowserTestBase::IsAPnaclTest() { |
| + return false; |
| +} |
| + |
| +bool NaClBrowserTestBase::IsPnaclDisabled() { |
| return false; |
| } |
| @@ -234,11 +247,15 @@ bool NaClBrowserTestBase::RunJavascriptTest(const GURL& url, |
| void NaClBrowserTestBase::RunLoadTest( |
| const base::FilePath::StringType& test_file) { |
| LoadTestMessageHandler handler; |
| - base::FilePath::StringType test_file_with_parm = test_file; |
| - if (IsPnacl()) { |
| - AddPnaclParm(test_file, &test_file_with_parm); |
| + base::FilePath::StringType test_file_with_pnacl = test_file; |
| + if (IsAPnaclTest()) { |
| + AddPnaclParm(test_file, &test_file_with_pnacl); |
| + } |
| + base::FilePath::StringType test_file_with_both = test_file_with_pnacl; |
| + if (IsPnaclDisabled()) { |
| + AddPnaclDisabledParm(test_file_with_pnacl, &test_file_with_both); |
| } |
| - bool ok = RunJavascriptTest(TestURL(test_file_with_parm), &handler); |
| + bool ok = RunJavascriptTest(TestURL(test_file_with_both), &handler); |
| ASSERT_TRUE(ok) << handler.error_message(); |
| ASSERT_TRUE(handler.test_passed()) << "Test failed."; |
| } |
| @@ -246,11 +263,15 @@ void NaClBrowserTestBase::RunLoadTest( |
| void NaClBrowserTestBase::RunNaClIntegrationTest( |
| const base::FilePath::StringType& url_fragment) { |
| NaClIntegrationMessageHandler handler; |
| - base::FilePath::StringType url_fragment_with_parm = url_fragment; |
| - if (IsPnacl()) { |
| - AddPnaclParm(url_fragment, &url_fragment_with_parm); |
| + base::FilePath::StringType url_fragment_with_pnacl = url_fragment; |
| + if (IsAPnaclTest()) { |
| + AddPnaclParm(url_fragment, &url_fragment_with_pnacl); |
| } |
| - bool ok = RunJavascriptTest(TestURL(url_fragment_with_parm), &handler); |
| + base::FilePath::StringType url_fragment_with_both = url_fragment_with_pnacl; |
| + if (IsPnaclDisabled()) { |
| + AddPnaclDisabledParm(url_fragment_with_pnacl, &url_fragment_with_both); |
| + } |
| + bool ok = RunJavascriptTest(TestURL(url_fragment_with_both), &handler); |
| ASSERT_TRUE(ok) << handler.error_message(); |
| ASSERT_TRUE(handler.test_passed()) << "Test failed."; |
| } |
| @@ -279,13 +300,29 @@ base::FilePath::StringType NaClBrowserTestPnacl::Variant() { |
| return FILE_PATH_LITERAL("pnacl"); |
| } |
| -bool NaClBrowserTestPnacl::IsPnacl() { |
| +bool NaClBrowserTestPnacl::IsAPnaclTest() { |
| return true; |
| } |
| void NaClBrowserTestPnacl::SetUpCommandLine(CommandLine* command_line) { |
|
jvoung (off chromium)
2013/07/23 23:16:00
no need to override anymore
sehr
2013/07/24 00:39:14
Done.
|
| NaClBrowserTestBase::SetUpCommandLine(command_line); |
| - command_line->AppendSwitch(switches::kEnablePnacl); |
| +} |
| + |
| +base::FilePath::StringType NaClBrowserTestPnaclDisabled::Variant() { |
| + return FILE_PATH_LITERAL("pnacl"); |
| +} |
| + |
| +bool NaClBrowserTestPnaclDisabled::IsAPnaclTest() { |
| + return true; |
| +} |
| + |
| +bool NaClBrowserTestPnaclDisabled::IsPnaclDisabled() { |
| + return true; |
| +} |
| + |
| +void NaClBrowserTestPnaclDisabled::SetUpCommandLine(CommandLine* command_line) { |
| + NaClBrowserTestBase::SetUpCommandLine(command_line); |
| + command_line->AppendSwitch(switches::kDisablePnacl); |
| } |
| NaClBrowserTestPnaclWithNewCache::NaClBrowserTestPnaclWithNewCache() { |