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

Side by Side Diff: content/browser/frame_host/debug_urls.cc

Issue 1543803005: Added an integration test for kasko hang reports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 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/browser/frame_host/debug_urls.h" 5 #include "content/browser/frame_host/debug_urls.h"
6 6
7 #if defined(SYZYASAN) 7 #if defined(SYZYASAN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
(...skipping 12 matching lines...) Expand all
23 #include "content/public/common/url_constants.h" 23 #include "content/public/common/url_constants.h"
24 #include "ppapi/proxy/ppapi_messages.h" 24 #include "ppapi/proxy/ppapi_messages.h"
25 #include "url/gurl.h" 25 #include "url/gurl.h"
26 26
27 #if defined(ENABLE_PLUGINS) 27 #if defined(ENABLE_PLUGINS)
28 #include "content/browser/ppapi_plugin_process_host.h" 28 #include "content/browser/ppapi_plugin_process_host.h"
29 #endif 29 #endif
30 30
31 namespace content { 31 namespace content {
32 32
33 class ScopedAllowWaitForDebugURL {
34 private:
35 base::ThreadRestrictions::ScopedAllowWait wait;
36 };
37
33 namespace { 38 namespace {
34 39
35 // Define the Asan debug URLs. 40 // Define the Asan debug URLs.
36 const char kAsanCrashDomain[] = "crash"; 41 const char kAsanCrashDomain[] = "crash";
37 const char kAsanHeapOverflow[] = "/browser-heap-overflow"; 42 const char kAsanHeapOverflow[] = "/browser-heap-overflow";
38 const char kAsanHeapUnderflow[] = "/browser-heap-underflow"; 43 const char kAsanHeapUnderflow[] = "/browser-heap-underflow";
39 const char kAsanUseAfterFree[] = "/browser-use-after-free"; 44 const char kAsanUseAfterFree[] = "/browser-use-after-free";
40 #if defined(SYZYASAN) 45 #if defined(SYZYASAN)
41 const char kAsanCorruptHeapBlock[] = "/browser-corrupt-heap-block"; 46 const char kAsanCorruptHeapBlock[] = "/browser-corrupt-heap-block";
42 const char kAsanCorruptHeap[] = "/browser-corrupt-heap"; 47 const char kAsanCorruptHeap[] = "/browser-corrupt-heap";
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } else if (url.path() == kAsanUseAfterFree) { 161 } else if (url.path() == kAsanUseAfterFree) {
157 base::debug::AsanHeapUseAfterFree(); 162 base::debug::AsanHeapUseAfterFree();
158 } else { 163 } else {
159 return false; 164 return false;
160 } 165 }
161 #endif 166 #endif
162 167
163 return true; 168 return true;
164 } 169 }
165 170
171 void HangCurrentThread() {
172 ScopedAllowWaitForDebugURL allow_wait;
173 base::WaitableEvent(false, false).Wait();
174 }
166 175
167 } // namespace 176 } // namespace
168 177
169 class ScopedAllowWaitForDebugURL {
170 private:
171 base::ThreadRestrictions::ScopedAllowWait wait;
172 };
173
174 bool HandleDebugURL(const GURL& url, ui::PageTransition transition) { 178 bool HandleDebugURL(const GURL& url, ui::PageTransition transition) {
175 // Ensure that the user explicitly navigated to this URL, unless 179 // Ensure that the user explicitly navigated to this URL, unless
176 // kEnableGpuBenchmarking is enabled by Telemetry. 180 // kEnableGpuBenchmarking is enabled by Telemetry.
177 bool is_telemetry_navigation = 181 bool is_telemetry_navigation =
178 base::CommandLine::ForCurrentProcess()->HasSwitch( 182 base::CommandLine::ForCurrentProcess()->HasSwitch(
179 cc::switches::kEnableGpuBenchmarking) && 183 cc::switches::kEnableGpuBenchmarking) &&
180 (PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_TYPED)); 184 (PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_TYPED));
181 185
182 if (!(transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) && 186 if (!(transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) &&
183 !is_telemetry_navigation) 187 !is_telemetry_navigation)
184 return false; 188 return false;
185 189
186 if (IsAsanDebugURL(url)) 190 if (IsAsanDebugURL(url))
187 return HandleAsanDebugURL(url); 191 return HandleAsanDebugURL(url);
188 192
189 if (IsKaskoDebugURL(url)) { 193 if (IsKaskoDebugURL(url)) {
190 HandleKaskoDebugURL(); 194 HandleKaskoDebugURL();
191 return true; 195 return true;
192 } 196 }
193 197
194 if (url == GURL(kChromeUIBrowserCrashURL)) { 198 if (url == GURL(kChromeUIBrowserCrashURL)) {
195 // Induce an intentional crash in the browser process. 199 // Induce an intentional crash in the browser process.
196 CHECK(false); 200 CHECK(false);
197 return true; 201 return true;
198 } 202 }
199 203
200 if (url == GURL(kChromeUIBrowserUIHang)) { 204 if (url == GURL(kChromeUIBrowserUIHang)) {
201 ScopedAllowWaitForDebugURL allow_wait; 205 // Webdriver waits for the onload event in javascript which needs a little
202 base::WaitableEvent(false, false).Wait(); 206 // more time to fire.
207 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE,
208 base::Bind(&HangCurrentThread),
209 base::TimeDelta::FromSeconds(1));
203 return true; 210 return true;
204 } 211 }
205 212
206 if (url == GURL(kChromeUIGpuCleanURL)) { 213 if (url == GURL(kChromeUIGpuCleanURL)) {
207 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); 214 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance();
208 if (shim) 215 if (shim)
209 shim->SimulateRemoveAllContext(); 216 shim->SimulateRemoveAllContext();
210 return true; 217 return true;
211 } 218 }
212 219
(...skipping 30 matching lines...) Expand all
243 250
244 return url == GURL(kChromeUIBadCastCrashURL) || 251 return url == GURL(kChromeUIBadCastCrashURL) ||
245 url == GURL(kChromeUICrashURL) || 252 url == GURL(kChromeUICrashURL) ||
246 url == GURL(kChromeUIDumpURL) || 253 url == GURL(kChromeUIDumpURL) ||
247 url == GURL(kChromeUIKillURL) || 254 url == GURL(kChromeUIKillURL) ||
248 url == GURL(kChromeUIHangURL) || 255 url == GURL(kChromeUIHangURL) ||
249 url == GURL(kChromeUIShorthangURL); 256 url == GURL(kChromeUIShorthangURL);
250 } 257 }
251 258
252 } // namespace content 259 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698