| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/threading/thread_restrictions.h" |
| 11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 12 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 13 #include "chrome/test/ppapi/ppapi_test.h" | 14 #include "chrome/test/ppapi/ppapi_test.h" |
| 14 #include "components/nacl/common/nacl_switches.h" | 15 #include "components/nacl/common/nacl_switches.h" |
| 15 | 16 |
| 16 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 17 #include "base/win/windows_version.h" | 18 #include "base/win/windows_version.h" |
| 18 #endif | 19 #endif |
| 19 | 20 |
| 20 static const base::FilePath::CharType kMockNaClGdb[] = | 21 static const base::FilePath::CharType kMockNaClGdb[] = |
| (...skipping 28 matching lines...) Expand all Loading... |
| 49 // space is not reserved. We can't reserve 1Gb of space because | 50 // space is not reserved. We can't reserve 1Gb of space because |
| 50 // base::LaunchProcess doesn't support creating suspended processes. We need | 51 // base::LaunchProcess doesn't support creating suspended processes. We need |
| 51 // to either add suspended process support to base::LaunchProcess or use | 52 // to either add suspended process support to base::LaunchProcess or use |
| 52 // Win API. | 53 // Win API. |
| 53 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
| 54 if (base::win::OSInfo::GetInstance()->wow64_status() == | 55 if (base::win::OSInfo::GetInstance()->wow64_status() == |
| 55 base::win::OSInfo::WOW64_DISABLED) { | 56 base::win::OSInfo::WOW64_DISABLED) { |
| 56 return; | 57 return; |
| 57 } | 58 } |
| 58 #endif | 59 #endif |
| 60 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 59 EXPECT_TRUE(base::CreateTemporaryFile(&mock_nacl_gdb_file)); | 61 EXPECT_TRUE(base::CreateTemporaryFile(&mock_nacl_gdb_file)); |
| 60 env->SetVar("MOCK_NACL_GDB", mock_nacl_gdb_file.AsUTF8Unsafe()); | 62 env->SetVar("MOCK_NACL_GDB", mock_nacl_gdb_file.AsUTF8Unsafe()); |
| 61 RunTestViaHTTP(test_name); | 63 RunTestViaHTTP(test_name); |
| 62 env->UnSetVar("MOCK_NACL_GDB"); | 64 env->UnSetVar("MOCK_NACL_GDB"); |
| 63 | 65 |
| 64 EXPECT_TRUE(base::ReadFileToString(mock_nacl_gdb_file, &content)); | 66 EXPECT_TRUE(base::ReadFileToString(mock_nacl_gdb_file, &content)); |
| 65 EXPECT_STREQ("PASS", content.c_str()); | 67 EXPECT_STREQ("PASS", content.c_str()); |
| 66 EXPECT_TRUE(base::DeleteFile(mock_nacl_gdb_file, false)); | 68 EXPECT_TRUE(base::DeleteFile(mock_nacl_gdb_file, false)); |
| 67 | 69 |
| 68 content.clear(); | 70 content.clear(); |
| 69 EXPECT_TRUE(base::ReadFileToString(script_, &content)); | 71 EXPECT_TRUE(base::ReadFileToString(script_, &content)); |
| 70 EXPECT_STREQ("PASS", content.c_str()); | 72 EXPECT_STREQ("PASS", content.c_str()); |
| 71 EXPECT_TRUE(base::DeleteFile(script_, false)); | 73 EXPECT_TRUE(base::DeleteFile(script_, false)); |
| 72 } | 74 } |
| 73 | 75 |
| 74 private: | 76 private: |
| 75 base::FilePath script_; | 77 base::FilePath script_; |
| 76 }; | 78 }; |
| 77 | 79 |
| 78 // Fails on the ASAN test bot. See http://crbug.com/122219 | 80 // Fails on the ASAN test bot. See http://crbug.com/122219 |
| 79 #if defined(ADDRESS_SANITIZER) | 81 #if defined(ADDRESS_SANITIZER) |
| 80 #define MAYBE_Empty DISABLED_Empty | 82 #define MAYBE_Empty DISABLED_Empty |
| 81 #else | 83 #else |
| 82 #define MAYBE_Empty Empty | 84 #define MAYBE_Empty Empty |
| 83 #endif | 85 #endif |
| 84 IN_PROC_BROWSER_TEST_F(NaClGdbTest, MAYBE_Empty) { | 86 IN_PROC_BROWSER_TEST_F(NaClGdbTest, MAYBE_Empty) { |
| 85 RunWithNaClGdb("Empty"); | 87 RunWithNaClGdb("Empty"); |
| 86 } | 88 } |
| OLD | NEW |