| 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(chrome::kChromeUIMemoryRedirectURL), |
| 94 false, | 94 false, |
| 95 true | 95 true |
| 96 }, | 96 }, |
| 97 { | 97 { |
| 98 GURL("about:mars"), | 98 GURL("about:mars"), |
| 99 GURL("chrome://about/mars"), | 99 GURL("chrome://mars"), |
| 100 false, | 100 false, |
| 101 true | 101 true |
| 102 }, | 102 }, |
| 103 { |
| 104 GURL("about://cars"), |
| 105 GURL("chrome://cars"), |
| 106 false, |
| 107 true |
| 108 }, |
| 109 { |
| 110 GURL("chrome:bars"), |
| 111 GURL("chrome://bars"), |
| 112 false, |
| 113 true |
| 114 }, |
| 115 { |
| 116 GURL("chrome://wars"), |
| 117 GURL("chrome://wars"), |
| 118 false, |
| 119 true |
| 120 }, |
| 103 }; | 121 }; |
| 104 MessageLoopForUI message_loop; | 122 MessageLoopForUI message_loop; |
| 105 BrowserThread ui_thread(BrowserThread::UI, &message_loop); | 123 BrowserThread ui_thread(BrowserThread::UI, &message_loop); |
| 106 TestingProfile profile; | 124 TestingProfile profile; |
| 107 | 125 |
| 108 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { | 126 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { |
| 109 GURL url(test_data[i].test_url); | 127 GURL url(test_data[i].test_url); |
| 110 EXPECT_EQ(test_data[i].about_handled, | 128 EXPECT_EQ(test_data[i].about_handled, |
| 111 chrome_about_handler::WillHandle(url)); | 129 chrome_about_handler::WillHandle(url)); |
| 112 EXPECT_EQ(test_data[i].browser_handled, | 130 EXPECT_EQ(test_data[i].browser_handled, |
| 113 WillHandleBrowserAboutURL(&url, &profile)); | 131 WillHandleBrowserAboutURL(&url, &profile)); |
| 114 EXPECT_EQ(test_data[i].result_url, url); | 132 EXPECT_EQ(test_data[i].result_url, url); |
| 115 } | 133 } |
| 116 | 134 |
| 117 // Crash the browser process for about:inducebrowsercrashforrealz. | 135 // Crash the browser process for about:inducebrowsercrashforrealz. |
| 118 GURL url(chrome::kAboutBrowserCrash); | 136 GURL url(chrome::kAboutBrowserCrash); |
| 119 EXPECT_DEATH(WillHandleBrowserAboutURL(&url, NULL), ""); | 137 EXPECT_DEATH(WillHandleBrowserAboutURL(&url, NULL), ""); |
| 120 } | 138 } |
| OLD | NEW |