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

Side by Side Diff: content/browser/renderer_host/render_view_host_unittest.cc

Issue 21955003: Cleanup: Use content::kAboutBlankURL instead of the raw string in contents/. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix build Created 7 years, 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/path_service.h" 5 #include "base/path_service.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "content/browser/child_process_security_policy_impl.h" 7 #include "content/browser/child_process_security_policy_impl.h"
8 #include "content/browser/renderer_host/test_render_view_host.h" 8 #include "content/browser/renderer_host/test_render_view_host.h"
9 #include "content/browser/web_contents/navigation_controller_impl.h" 9 #include "content/browser/web_contents/navigation_controller_impl.h"
10 #include "content/common/input_messages.h" 10 #include "content/common/input_messages.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 ContentBrowserClient* old_browser_client_; 56 ContentBrowserClient* old_browser_client_;
57 57
58 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTest); 58 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTest);
59 }; 59 };
60 60
61 // All about URLs reported by the renderer should get rewritten to about:blank. 61 // All about URLs reported by the renderer should get rewritten to about:blank.
62 // See RenderViewHost::OnNavigate for a discussion. 62 // See RenderViewHost::OnNavigate for a discussion.
63 TEST_F(RenderViewHostTest, FilterAbout) { 63 TEST_F(RenderViewHostTest, FilterAbout) {
64 test_rvh()->SendNavigate(1, GURL("about:cache")); 64 test_rvh()->SendNavigate(1, GURL("about:cache"));
65 ASSERT_TRUE(controller().GetActiveEntry()); 65 ASSERT_TRUE(controller().GetActiveEntry());
66 EXPECT_EQ(GURL("about:blank"), controller().GetActiveEntry()->GetURL()); 66 EXPECT_EQ(GURL(kAboutBlankURL), controller().GetActiveEntry()->GetURL());
67 } 67 }
68 68
69 // Create a full screen popup RenderWidgetHost and View. 69 // Create a full screen popup RenderWidgetHost and View.
70 TEST_F(RenderViewHostTest, CreateFullscreenWidget) { 70 TEST_F(RenderViewHostTest, CreateFullscreenWidget) {
71 int routing_id = process()->GetNextRoutingID(); 71 int routing_id = process()->GetNextRoutingID();
72 test_rvh()->CreateNewFullscreenWidget(routing_id); 72 test_rvh()->CreateNewFullscreenWidget(routing_id);
73 } 73 }
74 74
75 // Makes sure that RenderViewHost::is_waiting_for_unload_ack_ is false when 75 // Makes sure that RenderViewHost::is_waiting_for_unload_ack_ is false when
76 // reloading a page. If is_waiting_for_unload_ack_ is not false when reloading 76 // reloading a page. If is_waiting_for_unload_ack_ is not false when reloading
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 TEST_F(RenderViewHostTest, StartDragging) { 154 TEST_F(RenderViewHostTest, StartDragging) {
155 TestWebContents* web_contents = contents(); 155 TestWebContents* web_contents = contents();
156 MockDraggingRenderViewHostDelegateView delegate_view; 156 MockDraggingRenderViewHostDelegateView delegate_view;
157 web_contents->set_delegate_view(&delegate_view); 157 web_contents->set_delegate_view(&delegate_view);
158 158
159 DropData drop_data; 159 DropData drop_data;
160 GURL file_url = GURL("file:///home/user/secrets.txt"); 160 GURL file_url = GURL("file:///home/user/secrets.txt");
161 drop_data.url = file_url; 161 drop_data.url = file_url;
162 drop_data.html_base_url = file_url; 162 drop_data.html_base_url = file_url;
163 test_rvh()->TestOnStartDragging(drop_data); 163 test_rvh()->TestOnStartDragging(drop_data);
164 EXPECT_EQ(GURL("about:blank"), delegate_view.drag_url()); 164 EXPECT_EQ(GURL(kAboutBlankURL), delegate_view.drag_url());
165 EXPECT_EQ(GURL("about:blank"), delegate_view.html_base_url()); 165 EXPECT_EQ(GURL(kAboutBlankURL), delegate_view.html_base_url());
166 166
167 GURL http_url = GURL("http://www.domain.com/index.html"); 167 GURL http_url = GURL("http://www.domain.com/index.html");
168 drop_data.url = http_url; 168 drop_data.url = http_url;
169 drop_data.html_base_url = http_url; 169 drop_data.html_base_url = http_url;
170 test_rvh()->TestOnStartDragging(drop_data); 170 test_rvh()->TestOnStartDragging(drop_data);
171 EXPECT_EQ(http_url, delegate_view.drag_url()); 171 EXPECT_EQ(http_url, delegate_view.drag_url());
172 EXPECT_EQ(http_url, delegate_view.html_base_url()); 172 EXPECT_EQ(http_url, delegate_view.html_base_url());
173 173
174 GURL https_url = GURL("https://www.domain.com/index.html"); 174 GURL https_url = GURL("https://www.domain.com/index.html");
175 drop_data.url = https_url; 175 drop_data.url = https_url;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 test_rvh()->SendNavigateWithFile(1, url, file_path); 282 test_rvh()->SendNavigateWithFile(1, url, file_path);
283 EXPECT_EQ(1, process()->bad_msg_count()); 283 EXPECT_EQ(1, process()->bad_msg_count());
284 284
285 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( 285 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
286 process()->GetID(), file_path); 286 process()->GetID(), file_path);
287 test_rvh()->SendNavigateWithFile(process()->GetID(), url, file_path); 287 test_rvh()->SendNavigateWithFile(process()->GetID(), url, file_path);
288 EXPECT_EQ(1, process()->bad_msg_count()); 288 EXPECT_EQ(1, process()->bad_msg_count());
289 } 289 }
290 290
291 } // namespace content 291 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/media_browsertest.cc ('k') | content/browser/renderer_host/render_widget_host_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698