OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "chrome/browser/browser_about_handler.h" | 7 #include "chrome/browser/browser_about_handler.h" |
8 #include "chrome/common/about_handler.h" | 8 #include "chrome/common/about_handler.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "chrome/test/testing_browser_process_test.h" | 10 #include "chrome/test/testing_browser_process_test.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 true, | 82 true, |
83 false | 83 false |
84 }, | 84 }, |
85 { | 85 { |
86 GURL(chrome::kAboutShorthangURL), | 86 GURL(chrome::kAboutShorthangURL), |
87 GURL(chrome::kAboutShorthangURL), | 87 GURL(chrome::kAboutShorthangURL), |
88 true, | 88 true, |
89 false | 89 false |
90 }, | 90 }, |
91 { | 91 { |
92 GURL("about:memory"), | 92 GURL(chrome::kAboutMemoryURL), |
93 GURL("chrome://about/memory-redirect"), | 93 GURL(std::string("chrome://") + chrome::kChromeUIMemoryHost), |
94 false, | 94 false, |
95 true | 95 true |
96 }, | 96 }, |
97 { | 97 { |
98 GURL("about:mars"), | 98 GURL(std::string("about:")), |
99 GURL("chrome://about/mars"), | 99 GURL(std::string("chrome://") + chrome::kChromeUIVersionHost), |
100 false, | 100 false, |
101 true | 101 true |
102 }, | 102 }, |
| 103 { |
| 104 GURL(std::string("chrome://") + chrome::kChromeUICacheHost), |
| 105 GURL(std::string("chrome://") + chrome::kChromeUINetworkViewCacheHost), |
| 106 false, |
| 107 true |
| 108 }, |
| 109 { |
| 110 GURL(std::string("chrome://") + chrome::kChromeUIGpuHost), |
| 111 GURL(std::string("chrome://") + chrome::kChromeUIGpuInternalsHost), |
| 112 false, |
| 113 true |
| 114 }, |
| 115 { |
| 116 GURL(std::string("chrome://") + chrome::kChromeUISyncHost), |
| 117 GURL(std::string("chrome://") + chrome::kChromeUISyncInternalsHost), |
| 118 false, |
| 119 true |
| 120 }, |
| 121 { |
| 122 GURL("about:host/path?query#ref"), |
| 123 GURL("chrome://host/path?query#ref"), |
| 124 false, |
| 125 true |
| 126 }, |
| 127 { |
| 128 GURL("about://host/path?query#ref"), |
| 129 GURL("chrome://host/path?query#ref"), |
| 130 false, |
| 131 true |
| 132 }, |
| 133 { |
| 134 GURL("chrome:host/path?query#ref"), |
| 135 GURL("chrome://host/path?query#ref"), |
| 136 false, |
| 137 true |
| 138 }, |
| 139 { |
| 140 GURL("chrome://host/path?query#ref"), |
| 141 GURL("chrome://host/path?query#ref"), |
| 142 false, |
| 143 true |
| 144 } |
103 }; | 145 }; |
104 MessageLoopForUI message_loop; | 146 MessageLoopForUI message_loop; |
105 BrowserThread ui_thread(BrowserThread::UI, &message_loop); | 147 BrowserThread ui_thread(BrowserThread::UI, &message_loop); |
106 TestingProfile profile; | 148 TestingProfile profile; |
107 | 149 |
108 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { | 150 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { |
109 GURL url(test_data[i].test_url); | 151 GURL url(test_data[i].test_url); |
110 EXPECT_EQ(test_data[i].about_handled, | 152 EXPECT_EQ(test_data[i].about_handled, |
111 chrome_about_handler::WillHandle(url)); | 153 chrome_about_handler::WillHandle(url)); |
112 EXPECT_EQ(test_data[i].browser_handled, | 154 EXPECT_EQ(test_data[i].browser_handled, |
113 WillHandleBrowserAboutURL(&url, &profile)); | 155 WillHandleBrowserAboutURL(&url, &profile)); |
114 EXPECT_EQ(test_data[i].result_url, url); | 156 EXPECT_EQ(test_data[i].result_url, url); |
115 } | 157 } |
116 | 158 |
117 // Crash the browser process for about:inducebrowsercrashforrealz. | 159 // Crash the browser process for about:inducebrowsercrashforrealz. |
118 GURL url(chrome::kAboutBrowserCrash); | 160 GURL url(chrome::kAboutBrowserCrash); |
119 EXPECT_DEATH(WillHandleBrowserAboutURL(&url, NULL), ""); | 161 EXPECT_DEATH(WillHandleBrowserAboutURL(&url, NULL), ""); |
120 } | 162 } |
OLD | NEW |