 Chromium Code Reviews
 Chromium Code Reviews Issue 11236025:
  Test that debug stub works with browser.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/
    
  
    Issue 11236025:
  Test that debug stub works with browser.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/| 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 | |
| 
Mark Seaborn
2012/12/04 21:46:42
Maybe change the filename to "gdb_debug_stub_brows
 
halyavin
2012/12/05 10:05:57
Done.
 | |
| 5 #include "base/command_line.h" | |
| 6 #include "base/path_service.h" | |
| 7 #include "base/process_util.h" | |
| 8 #include "base/string_number_conversions.h" | |
| 9 #include "chrome/browser/nacl_host/nacl_browser.h" | |
| 10 #include "chrome/common/chrome_switches.h" | |
| 11 #include "chrome/test/ppapi/ppapi_test.h" | |
| 12 #include "content/public/test/test_browser_thread.h" | |
| 13 #include "content/public/test/test_utils.h" | |
| 14 | |
| 15 class NaClDebugStubRspTest : public PPAPINaClNewlibTest { | |
| 
Mark Seaborn
2012/12/04 21:46:42
Maybe "NaClGdbDebugStubTest" (along the lines of o
 
halyavin
2012/12/05 10:05:57
Done.
 | |
| 16 public: | |
| 17 NaClDebugStubRspTest() { | |
| 18 } | |
| 19 | |
| 20 void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | |
| 21 | |
| 22 void StartTestScript(base::ProcessHandle* test_process, | |
| 23 std::string test_name, int debug_stub_port); | |
| 24 | |
| 25 }; | |
| 26 | |
| 27 void NaClDebugStubRspTest::SetUpCommandLine(CommandLine* command_line) { | |
| 28 PPAPINaClNewlibTest::SetUpCommandLine(command_line); | |
| 29 command_line->AppendSwitch(switches::kEnableNaClDebug); | |
| 30 } | |
| 31 | |
| 32 void NaClDebugStubRspTest::StartTestScript(base::ProcessHandle* test_process, | |
| 33 std::string test_name, | |
| 34 int debug_stub_port) { | |
| 35 CommandLine cmd(FilePath(FILE_PATH_LITERAL("python"))); | |
| 
Mark Seaborn
2012/12/04 21:46:42
Maybe comment: We launch a Python script in order
 
halyavin
2012/12/05 10:05:57
Done.
 | |
| 36 FilePath script; | |
| 37 PathService::Get(base::DIR_SOURCE_ROOT, &script); | |
| 38 script = script.AppendASCII( | |
| 39 "chrome/browser/nacl_host/test/debug_stub_browser_tests.py"); | |
| 40 cmd.AppendArgPath(script); | |
| 41 cmd.AppendArg(base::IntToString(debug_stub_port)); | |
| 42 cmd.AppendArg(test_name); | |
| 43 LOG(INFO) << cmd.GetCommandLineString(); | |
| 44 base::LaunchProcess(cmd, base::LaunchOptions(), test_process); | |
| 45 } | |
| 46 | |
| 47 #if defined(ADDRESS_SANITIZER) | |
| 
Mark Seaborn
2012/12/04 21:46:42
Please comment this, if only to say that this is b
 
halyavin
2012/12/05 10:05:57
Done.
 | |
| 48 #define MAYBE_Empty DISABLED_Empty | |
| 49 #else | |
| 50 #define MAYBE_Empty Empty | |
| 51 #endif | |
| 52 | |
| 53 IN_PROC_BROWSER_TEST_F(NaClDebugStubRspTest, MAYBE_Empty) { | |
| 54 base::ProcessHandle test_script; | |
| 55 NaClBrowser::GetInstance()->SetDebugStubPortListener( | |
| 56 base::Bind(&NaClDebugStubRspTest::StartTestScript, | |
| 57 base::Unretained(this), &test_script, "continue")); | |
| 58 RunTestViaHTTP("Empty"); | |
| 59 NaClBrowser::GetInstance()->ClearDebugStubPortListener(); | |
| 60 int exit_code; | |
| 61 base::WaitForExitCode(test_script, &exit_code); | |
| 62 EXPECT_EQ(0, exit_code); | |
| 63 } | |
| OLD | NEW |