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

Side by Side Diff: webkit/support/webkit_support.cc

Issue 9863056: Properly crash when triggering an ASSERT() in debug DRT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/support/webkit_support.h" 5 #include "webkit/support/webkit_support.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 using webkit::gpu::WebGraphicsContext3DInProcessImpl; 82 using webkit::gpu::WebGraphicsContext3DInProcessImpl;
83 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; 83 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
84 84
85 namespace { 85 namespace {
86 86
87 // All fatal log messages (e.g. DCHECK failures) imply unit test failures 87 // All fatal log messages (e.g. DCHECK failures) imply unit test failures
88 void UnitTestAssertHandler(const std::string& str) { 88 void UnitTestAssertHandler(const std::string& str) {
89 FAIL() << str; 89 FAIL() << str;
90 } 90 }
91 91
92 void InitLogging(bool enable_gp_fault_error_box) { 92 void InitLogging() {
93 logging::SetLogAssertHandler(UnitTestAssertHandler);
94
95 #if defined(OS_WIN) 93 #if defined(OS_WIN)
96 if (!::IsDebuggerPresent()) { 94 if (!::IsDebuggerPresent()) {
97 UINT new_flags = SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX; 95 UINT new_flags = SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX
98 if (!enable_gp_fault_error_box) 96 | SEM_NOGPFAULTERRORBOX;
99 new_flags |= SEM_NOGPFAULTERRORBOX;
100 97
101 // Preserve existing error mode, as discussed at 98 // Preserve existing error mode, as discussed at
102 // http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx 99 // http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx
103 UINT existing_flags = SetErrorMode(new_flags); 100 UINT existing_flags = SetErrorMode(new_flags);
104 SetErrorMode(existing_flags | new_flags); 101 SetErrorMode(existing_flags | new_flags);
105 } 102 }
106 #endif 103 #endif
107 104
108 FilePath log_filename; 105 FilePath log_filename;
109 PathService::Get(base::DIR_EXE, &log_filename); 106 PathService::Get(base::DIR_EXE, &log_filename);
(...skipping 20 matching lines...) Expand all
130 public: 127 public:
131 #if defined(OS_ANDROID) 128 #if defined(OS_ANDROID)
132 // Android UI message loop goes through Java, so don't use it in tests. 129 // Android UI message loop goes through Java, so don't use it in tests.
133 typedef MessageLoop MessageLoopType; 130 typedef MessageLoop MessageLoopType;
134 #else 131 #else
135 typedef MessageLoopForUI MessageLoopType; 132 typedef MessageLoopForUI MessageLoopType;
136 #endif 133 #endif
137 134
138 TestEnvironment(bool unit_test_mode, 135 TestEnvironment(bool unit_test_mode,
139 base::AtExitManager* existing_at_exit_manager) { 136 base::AtExitManager* existing_at_exit_manager) {
140 if (!unit_test_mode) { 137 if (unit_test_mode) {
138 logging::SetLogAssertHandler(UnitTestAssertHandler);
139 } else {
141 // The existing_at_exit_manager must be not NULL. 140 // The existing_at_exit_manager must be not NULL.
142 at_exit_manager_.reset(existing_at_exit_manager); 141 at_exit_manager_.reset(existing_at_exit_manager);
143 InitLogging(false); 142 InitLogging();
144 } 143 }
145 main_message_loop_.reset(new MessageLoopType); 144 main_message_loop_.reset(new MessageLoopType);
146 // TestWebKitPlatformSupport must be instantiated after MessageLoopType. 145 // TestWebKitPlatformSupport must be instantiated after MessageLoopType.
147 webkit_platform_support_.reset( 146 webkit_platform_support_.reset(
148 new TestWebKitPlatformSupport(unit_test_mode)); 147 new TestWebKitPlatformSupport(unit_test_mode));
149 } 148 }
150 149
151 ~TestEnvironment() { 150 ~TestEnvironment() {
152 SimpleResourceLoaderBridge::Shutdown(); 151 SimpleResourceLoaderBridge::Shutdown();
153 } 152 }
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 // Logging 696 // Logging
698 void EnableWebCoreLogChannels(const std::string& channels) { 697 void EnableWebCoreLogChannels(const std::string& channels) {
699 webkit_glue::EnableWebCoreLogChannels(channels); 698 webkit_glue::EnableWebCoreLogChannels(channels);
700 } 699 }
701 700
702 void SetGamepadData(const WebKit::WebGamepads& pads) { 701 void SetGamepadData(const WebKit::WebGamepads& pads) {
703 test_environment->webkit_platform_support()->setGamepadData(pads); 702 test_environment->webkit_platform_support()->setGamepadData(pads);
704 } 703 }
705 704
706 } // namespace webkit_support 705 } // namespace webkit_support
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698