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

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

Issue 112053002: Allow the max url length to be overridden (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comment nit Created 7 years 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/interstitial_page_impl.h" 7 #include "content/browser/frame_host/interstitial_page_impl.h"
8 #include "content/browser/frame_host/navigation_entry_impl.h" 8 #include "content/browser/frame_host/navigation_entry_impl.h"
9 #include "content/browser/renderer_host/render_view_host_impl.h" 9 #include "content/browser/renderer_host/render_view_host_impl.h"
10 #include "content/browser/site_instance_impl.h" 10 #include "content/browser/site_instance_impl.h"
11 #include "content/browser/webui/web_ui_controller_factory_registry.h" 11 #include "content/browser/webui/web_ui_controller_factory_registry.h"
12 #include "content/common/view_messages.h" 12 #include "content/common/view_messages.h"
13 #include "content/public/browser/global_request_id.h" 13 #include "content/public/browser/global_request_id.h"
14 #include "content/public/browser/interstitial_page_delegate.h" 14 #include "content/public/browser/interstitial_page_delegate.h"
15 #include "content/public/browser/navigation_details.h" 15 #include "content/public/browser/navigation_details.h"
16 #include "content/public/browser/notification_details.h" 16 #include "content/public/browser/notification_details.h"
17 #include "content/public/browser/notification_source.h" 17 #include "content/public/browser/notification_source.h"
18 #include "content/public/browser/render_widget_host_view.h" 18 #include "content/public/browser/render_widget_host_view.h"
19 #include "content/public/browser/web_contents_observer.h" 19 #include "content/public/browser/web_contents_observer.h"
20 #include "content/public/browser/web_ui_controller.h" 20 #include "content/public/browser/web_ui_controller.h"
21 #include "content/public/common/bindings_policy.h" 21 #include "content/public/common/bindings_policy.h"
22 #include "content/public/common/content_constants.h" 22 #include "content/public/common/content_constants.h"
23 #include "content/public/common/url_constants.h" 23 #include "content/public/common/url_constants.h"
24 #include "content/public/common/url_utils.h"
24 #include "content/public/test/mock_render_process_host.h" 25 #include "content/public/test/mock_render_process_host.h"
25 #include "content/public/test/test_browser_thread.h" 26 #include "content/public/test/test_browser_thread.h"
26 #include "content/public/test/test_utils.h" 27 #include "content/public/test/test_utils.h"
27 #include "content/test/test_content_browser_client.h" 28 #include "content/test/test_content_browser_client.h"
28 #include "content/test/test_content_client.h" 29 #include "content/test/test_content_client.h"
29 #include "content/test/test_render_view_host.h" 30 #include "content/test/test_render_view_host.h"
30 #include "content/test/test_web_contents.h" 31 #include "content/test/test_web_contents.h"
31 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
32 33
33 namespace content { 34 namespace content {
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 EXPECT_EQ( 410 EXPECT_EQ(
410 instance1, 411 instance1,
411 NavigationEntryImpl::FromNavigationEntry(controller().GetVisibleEntry())-> 412 NavigationEntryImpl::FromNavigationEntry(controller().GetVisibleEntry())->
412 site_instance()); 413 site_instance());
413 } 414 }
414 415
415 // Test that we reject NavigateToEntry if the url is over kMaxURLChars. 416 // Test that we reject NavigateToEntry if the url is over kMaxURLChars.
416 TEST_F(WebContentsImplTest, NavigateToExcessivelyLongURL) { 417 TEST_F(WebContentsImplTest, NavigateToExcessivelyLongURL) {
417 // Construct a URL that's kMaxURLChars + 1 long of all 'a's. 418 // Construct a URL that's kMaxURLChars + 1 long of all 'a's.
418 const GURL url(std::string("http://example.org/").append( 419 const GURL url(std::string("http://example.org/").append(
419 kMaxURLChars + 1, 'a')); 420 GetMaxURLChars() + 1, 'a'));
420 421
421 controller().LoadURL( 422 controller().LoadURL(
422 url, Referrer(), PAGE_TRANSITION_GENERATED, std::string()); 423 url, Referrer(), PAGE_TRANSITION_GENERATED, std::string());
423 EXPECT_TRUE(controller().GetVisibleEntry() == NULL); 424 EXPECT_TRUE(controller().GetVisibleEntry() == NULL);
424 } 425 }
425 426
426 // Test that navigating across a site boundary creates a new RenderViewHost 427 // Test that navigating across a site boundary creates a new RenderViewHost
427 // with a new SiteInstance. Going back should do the same. 428 // with a new SiteInstance. Going back should do the same.
428 TEST_F(WebContentsImplTest, CrossSiteBoundaries) { 429 TEST_F(WebContentsImplTest, CrossSiteBoundaries) {
429 contents()->transition_cross_site = true; 430 contents()->transition_cross_site = true;
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 TEST_F(WebContentsImplTest, PendingContents) { 2162 TEST_F(WebContentsImplTest, PendingContents) {
2162 scoped_ptr<TestWebContents> other_contents( 2163 scoped_ptr<TestWebContents> other_contents(
2163 static_cast<TestWebContents*>(CreateTestWebContents())); 2164 static_cast<TestWebContents*>(CreateTestWebContents()));
2164 contents()->AddPendingContents(other_contents.get()); 2165 contents()->AddPendingContents(other_contents.get());
2165 int route_id = other_contents->GetRenderViewHost()->GetRoutingID(); 2166 int route_id = other_contents->GetRenderViewHost()->GetRoutingID();
2166 other_contents.reset(); 2167 other_contents.reset();
2167 EXPECT_EQ(NULL, contents()->GetCreatedWindow(route_id)); 2168 EXPECT_EQ(NULL, contents()->GetCreatedWindow(route_id));
2168 } 2169 }
2169 2170
2170 } // namespace content 2171 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/public/common/common_param_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698