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

Side by Side Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 325443002: Move about://-related constants from //content to //url (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Android ifx Created 6 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) 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/logging.h" 5 #include "base/logging.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "content/browser/frame_host/cross_site_transferring_request.h" 7 #include "content/browser/frame_host/cross_site_transferring_request.h"
8 #include "content/browser/frame_host/interstitial_page_impl.h" 8 #include "content/browser/frame_host/interstitial_page_impl.h"
9 #include "content/browser/frame_host/navigation_entry_impl.h" 9 #include "content/browser/frame_host/navigation_entry_impl.h"
10 #include "content/browser/renderer_host/render_view_host_impl.h" 10 #include "content/browser/renderer_host/render_view_host_impl.h"
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 DISALLOW_COPY_AND_ASSIGN(FakeFullscreenDelegate); 318 DISALLOW_COPY_AND_ASSIGN(FakeFullscreenDelegate);
319 }; 319 };
320 320
321 } // namespace 321 } // namespace
322 322
323 // Test to make sure that title updates get stripped of whitespace. 323 // Test to make sure that title updates get stripped of whitespace.
324 TEST_F(WebContentsImplTest, UpdateTitle) { 324 TEST_F(WebContentsImplTest, UpdateTitle) {
325 NavigationControllerImpl& cont = 325 NavigationControllerImpl& cont =
326 static_cast<NavigationControllerImpl&>(controller()); 326 static_cast<NavigationControllerImpl&>(controller());
327 FrameHostMsg_DidCommitProvisionalLoad_Params params; 327 FrameHostMsg_DidCommitProvisionalLoad_Params params;
328 InitNavigateParams(&params, 0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); 328 InitNavigateParams(
329 &params, 0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED);
329 330
330 LoadCommittedDetails details; 331 LoadCommittedDetails details;
331 cont.RendererDidNavigate(main_test_rfh(), params, &details); 332 cont.RendererDidNavigate(main_test_rfh(), params, &details);
332 333
333 contents()->UpdateTitle(main_test_rfh(), 0, 334 contents()->UpdateTitle(main_test_rfh(), 0,
334 base::ASCIIToUTF16(" Lots O' Whitespace\n"), 335 base::ASCIIToUTF16(" Lots O' Whitespace\n"),
335 base::i18n::LEFT_TO_RIGHT); 336 base::i18n::LEFT_TO_RIGHT);
336 EXPECT_EQ(base::ASCIIToUTF16("Lots O' Whitespace"), contents()->GetTitle()); 337 EXPECT_EQ(base::ASCIIToUTF16("Lots O' Whitespace"), contents()->GetTitle());
337 } 338 }
338 339
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 } 1226 }
1226 1227
1227 // Test that NavigationEntries have the correct page state and SiteInstance 1228 // Test that NavigationEntries have the correct page state and SiteInstance
1228 // state after opening a new window to about:blank. Prevents regression for 1229 // state after opening a new window to about:blank. Prevents regression for
1229 // bugs b/1116137 and http://crbug.com/111975. 1230 // bugs b/1116137 and http://crbug.com/111975.
1230 TEST_F(WebContentsImplTest, NavigationEntryContentStateNewWindow) { 1231 TEST_F(WebContentsImplTest, NavigationEntryContentStateNewWindow) {
1231 TestRenderViewHost* orig_rvh = test_rvh(); 1232 TestRenderViewHost* orig_rvh = test_rvh();
1232 1233
1233 // When opening a new window, it is navigated to about:blank internally. 1234 // When opening a new window, it is navigated to about:blank internally.
1234 // Currently, this results in two DidNavigate events. 1235 // Currently, this results in two DidNavigate events.
1235 const GURL url(kAboutBlankURL); 1236 const GURL url(url::kAboutBlankURL);
1236 contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); 1237 contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED);
1237 contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); 1238 contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED);
1238 1239
1239 // Should have a page state here. 1240 // Should have a page state here.
1240 NavigationEntry* entry = controller().GetLastCommittedEntry(); 1241 NavigationEntry* entry = controller().GetLastCommittedEntry();
1241 EXPECT_TRUE(entry->GetPageState().IsValid()); 1242 EXPECT_TRUE(entry->GetPageState().IsValid());
1242 1243
1243 // The SiteInstance should be available for other navigations to use. 1244 // The SiteInstance should be available for other navigations to use.
1244 NavigationEntryImpl* entry_impl = 1245 NavigationEntryImpl* entry_impl =
1245 NavigationEntryImpl::FromNavigationEntry(entry); 1246 NavigationEntryImpl::FromNavigationEntry(entry);
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after
2290 EXPECT_FALSE(other_controller.CanPruneAllButLastCommitted()); 2291 EXPECT_FALSE(other_controller.CanPruneAllButLastCommitted());
2291 } 2292 }
2292 2293
2293 // Regression test for http://crbug.com/168611 - the URLs passed by the 2294 // Regression test for http://crbug.com/168611 - the URLs passed by the
2294 // DidFinishLoad and DidFailLoadWithError IPCs should get filtered. 2295 // DidFinishLoad and DidFailLoadWithError IPCs should get filtered.
2295 TEST_F(WebContentsImplTest, FilterURLs) { 2296 TEST_F(WebContentsImplTest, FilterURLs) {
2296 TestWebContentsObserver observer(contents()); 2297 TestWebContentsObserver observer(contents());
2297 2298
2298 // A navigation to about:whatever should always look like a navigation to 2299 // A navigation to about:whatever should always look like a navigation to
2299 // about:blank 2300 // about:blank
2300 GURL url_normalized(kAboutBlankURL); 2301 GURL url_normalized(url::kAboutBlankURL);
2301 GURL url_from_ipc("about:whatever"); 2302 GURL url_from_ipc("about:whatever");
2302 2303
2303 // We navigate the test WebContents to about:blank, since NavigateAndCommit 2304 // We navigate the test WebContents to about:blank, since NavigateAndCommit
2304 // will use the given URL to create the NavigationEntry as well, and that 2305 // will use the given URL to create the NavigationEntry as well, and that
2305 // entry should contain the filtered URL. 2306 // entry should contain the filtered URL.
2306 contents()->NavigateAndCommit(url_normalized); 2307 contents()->NavigateAndCommit(url_normalized);
2307 2308
2308 // Check that an IPC with about:whatever is correctly normalized. 2309 // Check that an IPC with about:whatever is correctly normalized.
2309 contents()->TestDidFinishLoad(url_from_ipc); 2310 contents()->TestDidFinishLoad(url_from_ipc);
2310 2311
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
2635 contents->CommitPendingNavigation(); 2636 contents->CommitPendingNavigation();
2636 EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount()); 2637 EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount());
2637 EXPECT_EQ(1u, instance_webui->GetRelatedActiveContentsCount()); 2638 EXPECT_EQ(1u, instance_webui->GetRelatedActiveContentsCount());
2638 2639
2639 contents.reset(); 2640 contents.reset();
2640 EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount()); 2641 EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount());
2641 EXPECT_EQ(0u, instance_webui->GetRelatedActiveContentsCount()); 2642 EXPECT_EQ(0u, instance_webui->GetRelatedActiveContentsCount());
2642 } 2643 }
2643 2644
2644 } // namespace content 2645 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/browser/webui/web_ui_controller_factory_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698