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

Side by Side Diff: content/shell/browser/webkit_test_controller.cc

Issue 405433011: LeakDetector: Add commandline option to force crash when leak is found. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « content/shell/browser/webkit_test_controller.h ('k') | content/shell/common/shell_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/shell/browser/webkit_test_controller.h" 5 #include "content/shell/browser/webkit_test_controller.h"
6 6
7 #include <iostream> 7 #include <iostream>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // static 195 // static
196 WebKitTestController* WebKitTestController::Get() { 196 WebKitTestController* WebKitTestController::Get() {
197 DCHECK(instance_); 197 DCHECK(instance_);
198 return instance_; 198 return instance_;
199 } 199 }
200 200
201 WebKitTestController::WebKitTestController() 201 WebKitTestController::WebKitTestController()
202 : main_window_(NULL), 202 : main_window_(NULL),
203 test_phase_(BETWEEN_TESTS), 203 test_phase_(BETWEEN_TESTS),
204 is_leak_detection_enabled_(CommandLine::ForCurrentProcess()->HasSwitch( 204 is_leak_detection_enabled_(CommandLine::ForCurrentProcess()->HasSwitch(
205 switches::kEnableLeakDetection)) { 205 switches::kEnableLeakDetection)),
206 crash_when_leak_found_(false) {
206 CHECK(!instance_); 207 CHECK(!instance_);
207 instance_ = this; 208 instance_ = this;
209
210 if (is_leak_detection_enabled_) {
211 std::string switchValue =
212 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
213 switches::kEnableLeakDetection);
214 crash_when_leak_found_ = switchValue == switches::kCrashOnFailure;
215 }
216
208 printer_.reset(new WebKitTestResultPrinter(&std::cout, &std::cerr)); 217 printer_.reset(new WebKitTestResultPrinter(&std::cout, &std::cerr));
209 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEncodeBinary)) 218 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEncodeBinary))
210 printer_->set_encode_binary_data(true); 219 printer_->set_encode_binary_data(true);
211 registrar_.Add(this, 220 registrar_.Add(this,
212 NOTIFICATION_RENDERER_PROCESS_CREATED, 221 NOTIFICATION_RENDERER_PROCESS_CREATED,
213 NotificationService::AllSources()); 222 NotificationService::AllSources());
214 GpuDataManager::GetInstance()->AddObserver(this); 223 GpuDataManager::GetInstance()->AddObserver(this);
215 ResetAfterLayoutTest(); 224 ResetAfterLayoutTest();
216 } 225 }
217 226
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 const LeakDetectionResult& result) { 682 const LeakDetectionResult& result) {
674 if (!result.leaked) { 683 if (!result.leaked) {
675 base::MessageLoop::current()->PostTask(FROM_HERE, 684 base::MessageLoop::current()->PostTask(FROM_HERE,
676 base::MessageLoop::QuitClosure()); 685 base::MessageLoop::QuitClosure());
677 return; 686 return;
678 } 687 }
679 688
680 printer_->AddErrorMessage( 689 printer_->AddErrorMessage(
681 base::StringPrintf("#LEAK - renderer pid %d (%s)", current_pid_, 690 base::StringPrintf("#LEAK - renderer pid %d (%s)", current_pid_,
682 result.detail.c_str())); 691 result.detail.c_str()));
692 CHECK(!crash_when_leak_found_);
693
683 DiscardMainWindow(); 694 DiscardMainWindow();
684 } 695 }
685 696
686 } // namespace content 697 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/webkit_test_controller.h ('k') | content/shell/common/shell_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698