blob: d66fb2f6516b2aef2a6fd7b091a788d15306ef97 [file] [log] [blame]
Emmanuel Arias Soto9e159652025-05-16 07:53:551// Copyright 2025 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "content/browser/renderer_host/debug_urls.h"
6
7#include "testing/gtest/include/gtest/gtest.h"
8#include "third_party/blink/public/common/chrome_debug_urls.h"
9#include "url/gurl.h"
10
11namespace content {
12
13using DebugUrlsUnitTest = testing::Test;
14
15TEST_F(DebugUrlsUnitTest, IsDebugURL_NonDebugUrlsReturnFalse) {
16 EXPECT_FALSE(IsDebugURL(GURL("invalid")));
17 EXPECT_FALSE(IsDebugURL(GURL("https://example.com")));
18 EXPECT_FALSE(IsDebugURL(GURL("http://example.com")));
19 EXPECT_FALSE(IsDebugURL(GURL("chrome://version")));
20}
21
22TEST_F(DebugUrlsUnitTest, IsDebugURL_AsanUrlsReturnTrue) {
23 EXPECT_TRUE(IsDebugURL(GURL("chrome://crash/browser-heap-overflow")));
24 EXPECT_TRUE(IsDebugURL(GURL("chrome://crash/browser-heap-overflow")));
25 EXPECT_TRUE(IsDebugURL(GURL("chrome://crash/browser-use-after-free")));
26
27#if BUILDFLAG(IS_WIN)
28 EXPECT_TRUE(IsDebugURL(GURL("chrome://crash/browser-corrupt-heap-block")));
29 EXPECT_TRUE(IsDebugURL(GURL("chrome://crash/browser-corrupt-heap")));
30#endif
31}
32
33TEST_F(DebugUrlsUnitTest, IsDebugURL_DebugUrlsReturnTrue) {
34 EXPECT_TRUE(IsDebugURL(GURL(blink::kChromeUIBrowserCrashURL)));
35 EXPECT_TRUE(IsDebugURL(GURL(blink::kChromeUIBrowserDcheckURL)));
36#if BUILDFLAG(IS_WIN)
37 EXPECT_TRUE(IsDebugURL(GURL(blink::kChromeUIBrowserHeapCorruptionURL)));
38#endif
39 EXPECT_TRUE(IsDebugURL(GURL(blink::kChromeUIBrowserUIHang)));
40 EXPECT_TRUE(IsDebugURL(GURL(blink::kChromeUIDelayedBrowserUIHang)));
41 EXPECT_TRUE(IsDebugURL(GURL(blink::kChromeUIGpuCleanURL)));
42 EXPECT_TRUE(IsDebugURL(GURL(blink::kChromeUIGpuCrashURL)));
43#if BUILDFLAG(IS_ANDROID)
44 EXPECT_TRUE(IsDebugURL(GURL(blink::kChromeUIGpuJavaCrashURL)));
45#endif
46 EXPECT_TRUE(IsDebugURL(GURL(blink::kChromeUIGpuHangURL)));
47 EXPECT_TRUE(IsDebugURL(GURL(blink::kChromeUIMemoryPressureCriticalURL)));
48 EXPECT_TRUE(IsDebugURL(GURL(blink::kChromeUIMemoryPressureModerateURL)));
49}
50
51} // namespace content