| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/command_line.h" |
| 6 #include "base/environment.h" |
| 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" |
| 9 #include "base/win/windows_version.h" |
| 10 #include "chrome/common/chrome_switches.h" |
| 11 #include "chrome/test/ui/ppapi_uitest.h" |
| 12 |
| 13 static const FilePath::CharType kMockNaClGdb[] = |
| 14 #if defined(OS_WIN) |
| 15 FILE_PATH_LITERAL("mock_nacl_gdb.exe"); |
| 16 #else |
| 17 FILE_PATH_LITERAL("mock_nacl_gdb"); |
| 18 #endif |
| 19 |
| 20 class NaClGdbTest : public PPAPINaClTest { |
| 21 public: |
| 22 NaClGdbTest() { |
| 23 } |
| 24 |
| 25 void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 26 PPAPINaClTest::SetUpCommandLine(command_line); |
| 27 |
| 28 FilePath mock_nacl_gdb; |
| 29 EXPECT_TRUE(PathService::Get(base::DIR_EXE, &mock_nacl_gdb)); |
| 30 mock_nacl_gdb = mock_nacl_gdb.Append(kMockNaClGdb); |
| 31 command_line->AppendSwitchPath(switches::kNaClGdb, mock_nacl_gdb); |
| 32 } |
| 33 }; |
| 34 |
| 35 IN_PROC_BROWSER_TEST_F(NaClGdbTest, Empty) { |
| 36 FilePath mock_nacl_gdb_file; |
| 37 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 38 std::string content; |
| 39 // TODO(halyavin): Make this test to work on Windows 32-bit. Currently this |
| 40 // is not possible because NaCl doesn't work without sandbox since 1Gb of |
| 41 // space is not reserved. We can't reserve 1Gb of space because |
| 42 // base::LaunchProcess doesn't support creating suspended processes. We need |
| 43 // to either add suspended process support to base::LaunchProcess or use |
| 44 // Win API. |
| 45 if (base::win::OSInfo::GetInstance()->wow64_status() == |
| 46 base::win::OSInfo::WOW64_DISABLED) { |
| 47 return; |
| 48 } |
| 49 EXPECT_TRUE(file_util::CreateTemporaryFile(&mock_nacl_gdb_file)); |
| 50 env->SetVar("MOCK_NACL_GDB", mock_nacl_gdb_file.AsUTF8Unsafe()); |
| 51 RunTestViaHTTP("Empty"); |
| 52 env->UnSetVar("MOCK_NACL_GDB"); |
| 53 EXPECT_TRUE(file_util::ReadFileToString(mock_nacl_gdb_file, &content)); |
| 54 EXPECT_STREQ("PASS", content.c_str()); |
| 55 EXPECT_TRUE(file_util::Delete(mock_nacl_gdb_file, false)); |
| 56 } |
| OLD | NEW |