Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / test / nacl / nacl_browsertest_util.cc
index 9c1d57d..461d9f0 100644 (file)
@@ -188,15 +188,6 @@ 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() {
 }
 
@@ -208,11 +199,6 @@ void NaClBrowserTestBase::SetUpCommandLine(base::CommandLine* command_line) {
 }
 
 void NaClBrowserTestBase::SetUpOnMainThread() {
-  // Sanity check.
-  base::FilePath plugin_lib;
-  ASSERT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib));
-  ASSERT_TRUE(base::PathExists(plugin_lib)) << plugin_lib.value();
-
   ASSERT_TRUE(StartTestServer()) << "Cannot start test server.";
 }
 
@@ -224,10 +210,6 @@ bool NaClBrowserTestBase::IsAPnaclTest() {
   return false;
 }
 
-bool NaClBrowserTestBase::IsPnaclDisabled() {
-  return false;
-}
-
 GURL NaClBrowserTestBase::TestURL(
     const base::FilePath::StringType& url_fragment) {
   base::FilePath expanded_url = base::FilePath(FILE_PATH_LITERAL("files"));
@@ -253,9 +235,6 @@ void NaClBrowserTestBase::RunLoadTest(
     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_both), &handler);
   ASSERT_TRUE(ok) << handler.error_message();
   ASSERT_TRUE(handler.test_passed()) << "Test failed.";
@@ -269,9 +248,6 @@ void NaClBrowserTestBase::RunNaClIntegrationTest(
     AddPnaclParm(url_fragment, &url_fragment_with_pnacl);
   }
   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(full_url
                               ? GURL(url_fragment_with_both)
                               : TestURL(url_fragment_with_both),
@@ -308,23 +284,6 @@ bool NaClBrowserTestPnacl::IsAPnaclTest() {
   return true;
 }
 
-base::FilePath::StringType NaClBrowserTestPnaclDisabled::Variant() {
-  return FILE_PATH_LITERAL("pnacl");
-}
-
-bool NaClBrowserTestPnaclDisabled::IsAPnaclTest() {
-  return true;
-}
-
-bool NaClBrowserTestPnaclDisabled::IsPnaclDisabled() {
-  return true;
-}
-void NaClBrowserTestPnaclDisabled::SetUpCommandLine(
-    base::CommandLine* command_line) {
-  NaClBrowserTestBase::SetUpCommandLine(command_line);
-  command_line->AppendSwitch(switches::kDisablePnacl);
-}
-
 base::FilePath::StringType NaClBrowserTestNonSfiMode::Variant() {
   return FILE_PATH_LITERAL("libc-free");
 }
@@ -371,3 +330,21 @@ void NaClBrowserTestNewlibExtension::SetUpCommandLine(
   command_line->AppendSwitchPath(switches::kLoadExtension,
                                  src_root.Append(document_root));
 }
+
+void NaClBrowserTestGLibcExtension::SetUpCommandLine(
+    CommandLine* command_line) {
+  NaClBrowserTestBase::SetUpCommandLine(command_line);
+  base::FilePath src_root;
+  ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &src_root));
+
+  // Extension-based tests should specialize the GetDocumentRoot() / Variant()
+  // to point at the isolated the test extension directory.
+  // Otherwise, multiple NaCl extensions tests will end up sharing the
+  // same directory when loading the extension files.
+  base::FilePath document_root;
+  ASSERT_TRUE(GetDocumentRoot(&document_root));
+
+  // Document root is relative to source root, and source root may not be CWD.
+  command_line->AppendSwitchPath(switches::kLoadExtension,
+                                 src_root.Append(document_root));
+}