Index: chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc |
=================================================================== |
--- chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc (revision 138748) |
+++ chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc (working copy) |
@@ -30,6 +30,31 @@ |
mock_nacl_gdb = mock_nacl_gdb.Append(kMockNaClGdb); |
command_line->AppendSwitchPath(switches::kNaClGdb, mock_nacl_gdb); |
} |
+ |
+ void RunWithNaClGdb(std::string test_name) { |
+ FilePath mock_nacl_gdb_file; |
+ scoped_ptr<base::Environment> env(base::Environment::Create()); |
+ std::string content; |
+ // TODO(halyavin): Make this test to work on Windows 32-bit. Currently this |
Mark Seaborn
2012/05/24 17:25:58
"Make this test work"
halyavin
2012/05/25 09:37:45
Done.
|
+ // is not possible because NaCl doesn't work without sandbox since 1Gb of |
+ // space is not reserved. We can't reserve 1Gb of space because |
+ // base::LaunchProcess doesn't support creating suspended processes. We need |
+ // to either add suspended process support to base::LaunchProcess or use |
+ // Win API. |
+#if defined(OS_WIN) |
+ if (base::win::OSInfo::GetInstance()->wow64_status() == |
+ base::win::OSInfo::WOW64_DISABLED) { |
+ return; |
+ } |
+#endif |
+ EXPECT_TRUE(file_util::CreateTemporaryFile(&mock_nacl_gdb_file)); |
+ env->SetVar("MOCK_NACL_GDB", mock_nacl_gdb_file.AsUTF8Unsafe()); |
+ RunTestViaHTTP(test_name); |
+ env->UnSetVar("MOCK_NACL_GDB"); |
+ EXPECT_TRUE(file_util::ReadFileToString(mock_nacl_gdb_file, &content)); |
+ EXPECT_STREQ("PASS", content.c_str()); |
+ EXPECT_TRUE(file_util::Delete(mock_nacl_gdb_file, false)); |
+ } |
}; |
// Fails on the ASAN test bot. See http://crbug.com/122219 |
@@ -39,26 +64,31 @@ |
#define MAYBE_Empty Empty |
#endif |
IN_PROC_BROWSER_TEST_F(NaClGdbTest, MAYBE_Empty) { |
- FilePath mock_nacl_gdb_file; |
- scoped_ptr<base::Environment> env(base::Environment::Create()); |
- std::string content; |
- // TODO(halyavin): Make this test to work on Windows 32-bit. Currently this |
- // is not possible because NaCl doesn't work without sandbox since 1Gb of |
- // space is not reserved. We can't reserve 1Gb of space because |
- // base::LaunchProcess doesn't support creating suspended processes. We need |
- // to either add suspended process support to base::LaunchProcess or use |
- // Win API. |
-#if defined(OS_WIN) |
- if (base::win::OSInfo::GetInstance()->wow64_status() == |
- base::win::OSInfo::WOW64_DISABLED) { |
- return; |
+ RunWithNaClGdb("Empty"); |
+} |
+ |
+class NaClGdbScriptTest : public NaClGdbTest { |
+ public: |
+ NaClGdbScriptTest() { |
} |
-#endif |
- EXPECT_TRUE(file_util::CreateTemporaryFile(&mock_nacl_gdb_file)); |
- env->SetVar("MOCK_NACL_GDB", mock_nacl_gdb_file.AsUTF8Unsafe()); |
- RunTestViaHTTP("Empty"); |
- env->UnSetVar("MOCK_NACL_GDB"); |
- EXPECT_TRUE(file_util::ReadFileToString(mock_nacl_gdb_file, &content)); |
- EXPECT_STREQ("PASS", content.c_str()); |
- EXPECT_TRUE(file_util::Delete(mock_nacl_gdb_file, false)); |
+ |
+ void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
+ NaClGdbTest::SetUpCommandLine(command_line); |
+ EXPECT_TRUE(file_util::CreateTemporaryFile(&script_)); |
+ command_line->AppendSwitchPath("nacl-gdb-script", script_); |
+ } |
+ |
+ void RunWithNaClGdb(std::string test_name) { |
+ scoped_ptr<base::Environment> env(base::Environment::Create()); |
+ env->SetVar("NACL_GDB_SCRIPT", script_.AsUTF8Unsafe()); |
+ NaClGdbTest::RunWithNaClGdb("Empty"); |
Mark Seaborn
2012/05/24 17:25:58
I don't like this use of inheritance. It's kind o
halyavin
2012/05/25 09:37:45
It will make extending it easier. All tests could
|
+ env->UnSetVar("NACL_GDB_SCRIPT"); |
+ EXPECT_TRUE(file_util::Delete(script_, false)); |
+ } |
+ private: |
+ FilePath script_; |
+}; |
+ |
+IN_PROC_BROWSER_TEST_F(NaClGdbScriptTest, MAYBE_Empty) { |
+ RunWithNaClGdb("Empty"); |
} |