}
}
-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() {
}
}
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.";
}
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"));
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.";
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),
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");
}
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));
+}