| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/environment.h" |
| 6 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 7 #include "base/process_util.h" | 8 #include "base/process_util.h" |
| 8 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 9 #include "chrome/browser/nacl_host/nacl_browser.h" | 10 #include "chrome/browser/nacl_host/nacl_browser.h" |
| 10 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 11 #include "chrome/test/ppapi/ppapi_test.h" | 12 #include "chrome/test/ppapi/ppapi_test.h" |
| 12 #include "content/public/test/test_utils.h" | 13 #include "content/public/test/test_utils.h" |
| 13 | 14 |
| 14 class NaClGdbDebugStubTest : public PPAPINaClNewlibTest { | 15 class NaClGdbDebugStubTest : public PPAPINaClNewlibTest { |
| 15 public: | 16 public: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 41 cmd.AppendArgPath(script); | 42 cmd.AppendArgPath(script); |
| 42 cmd.AppendArg(base::IntToString(debug_stub_port)); | 43 cmd.AppendArg(base::IntToString(debug_stub_port)); |
| 43 cmd.AppendArg(test_name); | 44 cmd.AppendArg(test_name); |
| 44 LOG(INFO) << cmd.GetCommandLineString(); | 45 LOG(INFO) << cmd.GetCommandLineString(); |
| 45 base::LaunchProcess(cmd, base::LaunchOptions(), test_process); | 46 base::LaunchProcess(cmd, base::LaunchOptions(), test_process); |
| 46 } | 47 } |
| 47 | 48 |
| 48 void NaClGdbDebugStubTest::RunDebugStubTest(const std::string& nacl_module, | 49 void NaClGdbDebugStubTest::RunDebugStubTest(const std::string& nacl_module, |
| 49 const std::string& test_name) { | 50 const std::string& test_name) { |
| 50 base::ProcessHandle test_script; | 51 base::ProcessHandle test_script; |
| 52 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 51 NaClBrowser::GetInstance()->SetGdbDebugStubPortListener( | 53 NaClBrowser::GetInstance()->SetGdbDebugStubPortListener( |
| 52 base::Bind(&NaClGdbDebugStubTest::StartTestScript, | 54 base::Bind(&NaClGdbDebugStubTest::StartTestScript, |
| 53 base::Unretained(this), &test_script, test_name)); | 55 base::Unretained(this), &test_script, test_name)); |
| 56 // Turn on debug stub logging. |
| 57 env->SetVar("NACLVERBOSITY", "1"); |
| 54 RunTestViaHTTP(nacl_module); | 58 RunTestViaHTTP(nacl_module); |
| 59 env->UnSetVar("NACLVERBOSITY"); |
| 55 NaClBrowser::GetInstance()->ClearGdbDebugStubPortListener(); | 60 NaClBrowser::GetInstance()->ClearGdbDebugStubPortListener(); |
| 56 int exit_code; | 61 int exit_code; |
| 57 base::WaitForExitCode(test_script, &exit_code); | 62 base::WaitForExitCode(test_script, &exit_code); |
| 58 EXPECT_EQ(0, exit_code); | 63 EXPECT_EQ(0, exit_code); |
| 59 } | 64 } |
| 60 | 65 |
| 61 // NaCl tests are disabled under ASAN because of qualification test. | 66 // NaCl tests are disabled under ASAN because of qualification test. |
| 62 #if defined(ADDRESS_SANITIZER) | 67 #if defined(ADDRESS_SANITIZER) |
| 63 # define MAYBE_Empty DISABLED_Empty | 68 # define MAYBE_Empty DISABLED_Empty |
| 64 # define MAYBE_Breakpoint DISABLED_Breakpoint | 69 # define MAYBE_Breakpoint DISABLED_Breakpoint |
| 65 #else | 70 #else |
| 66 # define MAYBE_Empty Empty | 71 # define MAYBE_Empty Empty |
| 67 # define MAYBE_Breakpoint Breakpoint | 72 # define MAYBE_Breakpoint Breakpoint |
| 68 #endif | 73 #endif |
| 69 | 74 |
| 70 IN_PROC_BROWSER_TEST_F(NaClGdbDebugStubTest, MAYBE_Empty) { | 75 IN_PROC_BROWSER_TEST_F(NaClGdbDebugStubTest, MAYBE_Empty) { |
| 71 RunDebugStubTest("Empty", "continue"); | 76 RunDebugStubTest("Empty", "continue"); |
| 72 } | 77 } |
| 73 | 78 |
| 74 IN_PROC_BROWSER_TEST_F(NaClGdbDebugStubTest, MAYBE_Breakpoint) { | 79 IN_PROC_BROWSER_TEST_F(NaClGdbDebugStubTest, MAYBE_Breakpoint) { |
| 75 RunDebugStubTest("Empty", "breakpoint"); | 80 RunDebugStubTest("Empty", "breakpoint"); |
| 76 } | 81 } |
| OLD | NEW |