| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/scoped_ptr.h" | 6 #include "base/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/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 9 #include "chrome/renderer/about_handler.h" | |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 TEST(BrowserAboutHandlerTest, WillHandleBrowserAboutURL) { | 13 TEST(BrowserAboutHandlerTest, WillHandleBrowserAboutURL) { |
| 14 struct AboutURLTestData { | 14 struct AboutURLTestData { |
| 15 GURL test_url; | 15 GURL test_url; |
| 16 GURL result_url; | 16 GURL result_url; |
| 17 bool about_handled; | 17 bool about_handled; |
| 18 bool browser_handled; | 18 bool browser_handled; |
| 19 } test_data[] = { | 19 } test_data[] = { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 { | 80 { |
| 81 GURL("about:mars"), | 81 GURL("about:mars"), |
| 82 GURL("chrome://about/mars"), | 82 GURL("chrome://about/mars"), |
| 83 false, | 83 false, |
| 84 true | 84 true |
| 85 }, | 85 }, |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { | 88 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { |
| 89 GURL url(test_data[i].test_url); | 89 GURL url(test_data[i].test_url); |
| 90 EXPECT_EQ(test_data[i].about_handled, AboutHandler::WillHandle(url)); | 90 EXPECT_EQ(test_data[i].about_handled, |
| 91 chrome_about_handler::WillHandle(url)); |
| 91 EXPECT_EQ(test_data[i].browser_handled, | 92 EXPECT_EQ(test_data[i].browser_handled, |
| 92 WillHandleBrowserAboutURL(&url, NULL)); | 93 WillHandleBrowserAboutURL(&url, NULL)); |
| 93 EXPECT_EQ(test_data[i].result_url, url); | 94 EXPECT_EQ(test_data[i].result_url, url); |
| 94 } | 95 } |
| 95 | 96 |
| 96 // Crash the browser process for about:inducebrowsercrashforrealz. | 97 // Crash the browser process for about:inducebrowsercrashforrealz. |
| 97 GURL url(chrome::kAboutBrowserCrash); | 98 GURL url(chrome::kAboutBrowserCrash); |
| 98 EXPECT_DEATH(WillHandleBrowserAboutURL(&url, NULL), ""); | 99 EXPECT_DEATH(WillHandleBrowserAboutURL(&url, NULL), ""); |
| 99 } | 100 } |
| OLD | NEW |