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 env->SetVar("NACLVERBOSITY", "1"); | |
Mark Seaborn
2013/01/15 17:47:55
Please add a comment to say that this turns on deb
halyavin
2013/01/16 08:34:19
Done
| |
54 RunTestViaHTTP(nacl_module); | 57 RunTestViaHTTP(nacl_module); |
58 env->UnSetVar("NACLVERBOSITY"); | |
55 NaClBrowser::GetInstance()->ClearGdbDebugStubPortListener(); | 59 NaClBrowser::GetInstance()->ClearGdbDebugStubPortListener(); |
56 int exit_code; | 60 int exit_code; |
57 base::WaitForExitCode(test_script, &exit_code); | 61 base::WaitForExitCode(test_script, &exit_code); |
58 EXPECT_EQ(0, exit_code); | 62 EXPECT_EQ(0, exit_code); |
59 } | 63 } |
60 | 64 |
61 // NaCl tests are disabled under ASAN because of qualification test. | 65 // NaCl tests are disabled under ASAN because of qualification test. |
62 #if defined(ADDRESS_SANITIZER) | 66 #if defined(ADDRESS_SANITIZER) |
63 # define MAYBE_Empty DISABLED_Empty | 67 # define MAYBE_Empty DISABLED_Empty |
64 # define MAYBE_Breakpoint DISABLED_Breakpoint | 68 # define MAYBE_Breakpoint DISABLED_Breakpoint |
65 #else | 69 #else |
66 # define MAYBE_Empty Empty | 70 # define MAYBE_Empty Empty |
67 # define MAYBE_Breakpoint Breakpoint | 71 # define MAYBE_Breakpoint Breakpoint |
68 #endif | 72 #endif |
69 | 73 |
70 IN_PROC_BROWSER_TEST_F(NaClGdbDebugStubTest, MAYBE_Empty) { | 74 IN_PROC_BROWSER_TEST_F(NaClGdbDebugStubTest, MAYBE_Empty) { |
71 RunDebugStubTest("Empty", "continue"); | 75 RunDebugStubTest("Empty", "continue"); |
72 } | 76 } |
73 | 77 |
74 IN_PROC_BROWSER_TEST_F(NaClGdbDebugStubTest, MAYBE_Breakpoint) { | 78 IN_PROC_BROWSER_TEST_F(NaClGdbDebugStubTest, MAYBE_Breakpoint) { |
75 RunDebugStubTest("Empty", "breakpoint"); | 79 RunDebugStubTest("Empty", "breakpoint"); |
76 } | 80 } |
OLD | NEW |