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

Side by Side Diff: chrome/browser/browser_about_handler_unittest.cc

Issue 7064052: Revert 88142 to fix sync_integration_tests offline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 months 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 | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/test/testing_profile.h" 11 #include "chrome/test/testing_profile.h"
12 #include "content/browser/browser_thread.h" 12 #include "content/browser/browser_thread.h"
13 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 typedef TestingBrowserProcessTest BrowserAboutHandlerTest; 16 typedef TestingBrowserProcessTest BrowserAboutHandlerTest;
17 17
18 TEST_F(BrowserAboutHandlerTest, WillHandleBrowserAboutURL) { 18 TEST_F(BrowserAboutHandlerTest, WillHandleBrowserAboutURL) {
19 std::string chrome_prefix(chrome::kChromeUIScheme);
20 chrome_prefix.append(chrome::kStandardSchemeSeparator);
21 struct AboutURLTestData { 19 struct AboutURLTestData {
22 GURL test_url; 20 GURL test_url;
23 GURL result_url; 21 GURL result_url;
24 bool about_handled; 22 bool about_handled;
25 bool browser_handled; 23 bool browser_handled;
26 } test_data[] = { 24 } test_data[] = {
27 { 25 {
28 GURL("http://google.com"), 26 GURL("http://google.com"),
29 GURL("http://google.com"), 27 GURL("http://google.com"),
30 false, 28 false,
31 false 29 false
32 }, 30 },
33 { 31 {
34 GURL(chrome::kAboutBlankURL), 32 GURL(chrome::kAboutBlankURL),
35 GURL(chrome::kAboutBlankURL), 33 GURL(chrome::kAboutBlankURL),
36 false, 34 false,
37 false 35 false
38 }, 36 },
39 { 37 {
40 GURL(chrome_prefix + chrome::kChromeUICrashHost), 38 GURL(std::string(chrome::kAboutCacheURL) + "/mercury"),
41 GURL(chrome_prefix + chrome::kChromeUICrashHost), 39 GURL(std::string(chrome::kNetworkViewCacheURL) + "mercury"),
40 false,
41 true
42 },
43 {
44 GURL(std::string(chrome::kAboutNetInternalsURL) + "/venus"),
45 GURL(std::string(chrome::kNetworkViewInternalsURL) + "venus"),
46 false,
47 true
48 },
49 {
50 GURL(std::string(chrome::kAboutGpuURL) + "/jupiter"),
51 GURL(std::string(chrome::kGpuInternalsURL) + "jupiter"),
52 false,
53 true
54 },
55 {
56 GURL(std::string(chrome::kAboutAppCacheInternalsURL) + "/earth"),
57 GURL(std::string(chrome::kAppCacheViewInternalsURL) + "earth"),
58 false,
59 true
60 },
61 {
62 GURL(chrome::kAboutPluginsURL),
63 GURL(chrome::kChromeUIPluginsURL),
64 false,
65 true
66 },
67 {
68 GURL(chrome::kAboutCrashURL),
69 GURL(chrome::kAboutCrashURL),
42 true, 70 true,
43 false 71 false
44 }, 72 },
45 { 73 {
46 GURL(chrome_prefix + chrome::kChromeUIKillHost), 74 GURL(chrome::kAboutKillURL),
47 GURL(chrome_prefix + chrome::kChromeUIKillHost), 75 GURL(chrome::kAboutKillURL),
48 true, 76 true,
49 false 77 false
50 }, 78 },
51 { 79 {
52 GURL(chrome_prefix + chrome::kChromeUIHangHost), 80 GURL(chrome::kAboutHangURL),
53 GURL(chrome_prefix + chrome::kChromeUIHangHost), 81 GURL(chrome::kAboutHangURL),
54 true, 82 true,
55 false 83 false
56 }, 84 },
57 { 85 {
58 GURL(chrome_prefix + chrome::kChromeUIShorthangHost), 86 GURL(chrome::kAboutShorthangURL),
59 GURL(chrome_prefix + chrome::kChromeUIShorthangHost), 87 GURL(chrome::kAboutShorthangURL),
60 true, 88 true,
61 false 89 false
62 }, 90 },
63 { 91 {
64 GURL(chrome_prefix + chrome::kChromeUIMemoryHost), 92 GURL("about:memory"),
65 GURL(chrome_prefix + chrome::kChromeUIMemoryHost), 93 GURL("chrome://about/memory-redirect"),
66 false, 94 false,
67 true 95 true
68 }, 96 },
69 { 97 {
70 GURL(chrome_prefix + chrome::kChromeUIDefaultHost), 98 GURL("about:mars"),
71 GURL(chrome_prefix + chrome::kChromeUIVersionHost), 99 GURL("chrome://about/mars"),
72 false, 100 false,
73 true 101 true
74 }, 102 },
75 {
76 GURL(chrome_prefix + chrome::kChromeUIAboutHost),
77 GURL(chrome_prefix + chrome::kChromeUIChromeURLsHost),
78 false,
79 true
80 },
81 {
82 GURL(chrome_prefix + chrome::kChromeUICacheHost),
83 GURL(chrome_prefix + chrome::kChromeUINetworkViewCacheHost),
84 false,
85 true
86 },
87 {
88 GURL(chrome_prefix + chrome::kChromeUIGpuHost),
89 GURL(chrome_prefix + chrome::kChromeUIGpuInternalsHost),
90 false,
91 true
92 },
93 {
94 GURL(chrome_prefix + chrome::kChromeUISyncHost),
95 GURL(chrome_prefix + chrome::kChromeUISyncInternalsHost),
96 false,
97 true
98 },
99 {
100 GURL(chrome_prefix + "host/path?query#ref"),
101 GURL(chrome_prefix + "host/path?query#ref"),
102 false,
103 true
104 }
105 }; 103 };
106 MessageLoopForUI message_loop; 104 MessageLoopForUI message_loop;
107 BrowserThread ui_thread(BrowserThread::UI, &message_loop); 105 BrowserThread ui_thread(BrowserThread::UI, &message_loop);
108 TestingProfile profile; 106 TestingProfile profile;
109 107
110 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { 108 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) {
111 GURL url(test_data[i].test_url); 109 GURL url(test_data[i].test_url);
112 EXPECT_EQ(test_data[i].about_handled, 110 EXPECT_EQ(test_data[i].about_handled,
113 chrome_about_handler::WillHandle(url)); 111 chrome_about_handler::WillHandle(url));
114 EXPECT_EQ(test_data[i].browser_handled, 112 EXPECT_EQ(test_data[i].browser_handled,
115 WillHandleBrowserAboutURL(&url, &profile)); 113 WillHandleBrowserAboutURL(&url, &profile));
116 EXPECT_EQ(test_data[i].result_url, url); 114 EXPECT_EQ(test_data[i].result_url, url);
117 } 115 }
118 116
119 // Crash the browser process for about:inducebrowsercrashforrealz. 117 // Crash the browser process for about:inducebrowsercrashforrealz.
120 GURL url(chrome::kAboutBrowserCrash); 118 GURL url(chrome::kAboutBrowserCrash);
121 EXPECT_DEATH(WillHandleBrowserAboutURL(&url, NULL), ""); 119 EXPECT_DEATH(WillHandleBrowserAboutURL(&url, NULL), "");
122 } 120 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_about_handler.cc ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698