Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/nacl_host/test/gdb_debug_stub_browsertest.cc

Issue 2630443003: Add thread checks to NaClBrowser, and make it leaky (Closed)
Patch Set: Move SetDelegate(nullptr) to ClearAndDeleteDelegateForTest() Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/environment.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/process/kill.h" 8 #include "base/process/kill.h"
9 #include "base/process/launch.h" 9 #include "base/process/launch.h"
10 #include "base/process/process.h" 10 #include "base/process/process.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 cmd.AppendArg(base::IntToString(debug_stub_port)); 47 cmd.AppendArg(base::IntToString(debug_stub_port));
48 cmd.AppendArg(test_name); 48 cmd.AppendArg(test_name);
49 LOG(INFO) << cmd.GetCommandLineString(); 49 LOG(INFO) << cmd.GetCommandLineString();
50 *test_process = base::LaunchProcess(cmd, base::LaunchOptions()); 50 *test_process = base::LaunchProcess(cmd, base::LaunchOptions());
51 } 51 }
52 52
53 void NaClGdbDebugStubTest::RunDebugStubTest(const std::string& nacl_module, 53 void NaClGdbDebugStubTest::RunDebugStubTest(const std::string& nacl_module,
54 const std::string& test_name) { 54 const std::string& test_name) {
55 base::Process test_script; 55 base::Process test_script;
56 std::unique_ptr<base::Environment> env(base::Environment::Create()); 56 std::unique_ptr<base::Environment> env(base::Environment::Create());
57 nacl::NaClBrowser::GetInstance()->SetGdbDebugStubPortListener( 57 nacl::NaClBrowser::GetInstance()->SetGdbDebugStubPortListenerForTest(
Wez 2017/01/14 01:53:11 bradnelson: These GetInstance() calls barf because
58 base::Bind(&NaClGdbDebugStubTest::StartTestScript, 58 base::Bind(&NaClGdbDebugStubTest::StartTestScript, base::Unretained(this),
59 base::Unretained(this), &test_script, test_name)); 59 &test_script, test_name));
60 // Turn on debug stub logging. 60 // Turn on debug stub logging.
61 env->SetVar("NACLVERBOSITY", "1"); 61 env->SetVar("NACLVERBOSITY", "1");
62 RunTestViaHTTP(nacl_module); 62 RunTestViaHTTP(nacl_module);
63 env->UnSetVar("NACLVERBOSITY"); 63 env->UnSetVar("NACLVERBOSITY");
64 nacl::NaClBrowser::GetInstance()->ClearGdbDebugStubPortListener(); 64 nacl::NaClBrowser::GetInstance()->ClearGdbDebugStubPortListenerForTest();
65 int exit_code; 65 int exit_code;
66 test_script.WaitForExit(&exit_code); 66 test_script.WaitForExit(&exit_code);
67 EXPECT_EQ(0, exit_code); 67 EXPECT_EQ(0, exit_code);
68 } 68 }
69 69
70 // NaCl tests are disabled under ASAN because of qualification test. 70 // NaCl tests are disabled under ASAN because of qualification test.
71 #if defined(ADDRESS_SANITIZER) 71 #if defined(ADDRESS_SANITIZER)
72 # define MAYBE_Empty DISABLED_Empty 72 # define MAYBE_Empty DISABLED_Empty
73 #else 73 #else
74 # define MAYBE_Empty Empty 74 # define MAYBE_Empty Empty
75 #endif 75 #endif
76 76
77 IN_PROC_BROWSER_TEST_F(NaClGdbDebugStubTest, MAYBE_Empty) { 77 IN_PROC_BROWSER_TEST_F(NaClGdbDebugStubTest, MAYBE_Empty) {
78 RunDebugStubTest("Empty", "continue"); 78 RunDebugStubTest("Empty", "continue");
79 } 79 }
80 80
81 #if defined(ADDRESS_SANITIZER) 81 #if defined(ADDRESS_SANITIZER)
82 # define MAYBE_Breakpoint DISABLED_Breakpoint 82 # define MAYBE_Breakpoint DISABLED_Breakpoint
83 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 83 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
84 // Timing out on ARM linux: http://crbug.com/238469 84 // Timing out on ARM linux: http://crbug.com/238469
85 # define MAYBE_Breakpoint DISABLED_Breakpoint 85 # define MAYBE_Breakpoint DISABLED_Breakpoint
86 #else 86 #else
87 # define MAYBE_Breakpoint Breakpoint 87 # define MAYBE_Breakpoint Breakpoint
88 #endif 88 #endif
89 89
90 IN_PROC_BROWSER_TEST_F(NaClGdbDebugStubTest, MAYBE_Breakpoint) { 90 IN_PROC_BROWSER_TEST_F(NaClGdbDebugStubTest, MAYBE_Breakpoint) {
91 RunDebugStubTest("Empty", "breakpoint"); 91 RunDebugStubTest("Empty", "breakpoint");
92 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698