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

Side by Side Diff: content/browser/frame_host/navigation_controller_impl_unittest.cc

Issue 1497743005: Allow huge data: URIs only via WebView.loadDataWithBaseUrl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test for serializing a huge data url Created 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 EXPECT_EQ(load_params.referrer.url, entry->GetReferrer().url); 533 EXPECT_EQ(load_params.referrer.url, entry->GetReferrer().url);
534 EXPECT_EQ(load_params.referrer.policy, entry->GetReferrer().policy); 534 EXPECT_EQ(load_params.referrer.policy, entry->GetReferrer().policy);
535 EXPECT_EQ(load_params.transition_type, entry->GetTransitionType()); 535 EXPECT_EQ(load_params.transition_type, entry->GetTransitionType());
536 EXPECT_EQ(load_params.extra_headers, entry->extra_headers()); 536 EXPECT_EQ(load_params.extra_headers, entry->extra_headers());
537 537
538 EXPECT_EQ(load_params.is_renderer_initiated, entry->is_renderer_initiated()); 538 EXPECT_EQ(load_params.is_renderer_initiated, entry->is_renderer_initiated());
539 EXPECT_EQ(load_params.base_url_for_data_url, entry->GetBaseURLForDataURL()); 539 EXPECT_EQ(load_params.base_url_for_data_url, entry->GetBaseURLForDataURL());
540 if (!load_params.virtual_url_for_data_url.is_empty()) { 540 if (!load_params.virtual_url_for_data_url.is_empty()) {
541 EXPECT_EQ(load_params.virtual_url_for_data_url, entry->GetVirtualURL()); 541 EXPECT_EQ(load_params.virtual_url_for_data_url, entry->GetVirtualURL());
542 } 542 }
543 EXPECT_EQ(load_params.data_url_as_string, entry->GetDataURLAsString());
Charlie Reis 2015/12/10 20:43:46 Can we also check that if data_url_as_string is sp
mnaganov (inactive) 2015/12/11 23:14:23 I added checks into navigation_controller_android
543 if (NavigationController::UA_OVERRIDE_INHERIT != 544 if (NavigationController::UA_OVERRIDE_INHERIT !=
544 load_params.override_user_agent) { 545 load_params.override_user_agent) {
545 bool should_override = (NavigationController::UA_OVERRIDE_TRUE == 546 bool should_override = (NavigationController::UA_OVERRIDE_TRUE ==
546 load_params.override_user_agent); 547 load_params.override_user_agent);
547 EXPECT_EQ(should_override, entry->GetIsOverridingUserAgent()); 548 EXPECT_EQ(should_override, entry->GetIsOverridingUserAgent());
548 } 549 }
549 EXPECT_EQ(load_params.browser_initiated_post_data.get(), 550 EXPECT_EQ(load_params.browser_initiated_post_data.get(),
550 entry->GetBrowserInitiatedPostData()); 551 entry->GetBrowserInitiatedPostData());
551 EXPECT_EQ(load_params.transferred_global_request_id, 552 EXPECT_EQ(load_params.transferred_global_request_id,
552 entry->transferred_global_request_id()); 553 entry->transferred_global_request_id());
(...skipping 27 matching lines...) Expand all
580 } 581 }
581 582
582 TEST_F(NavigationControllerTest, LoadURLWithExtraParams_Data) { 583 TEST_F(NavigationControllerTest, LoadURLWithExtraParams_Data) {
583 NavigationControllerImpl& controller = controller_impl(); 584 NavigationControllerImpl& controller = controller_impl();
584 585
585 NavigationController::LoadURLParams load_params( 586 NavigationController::LoadURLParams load_params(
586 GURL("data:text/html,dataurl")); 587 GURL("data:text/html,dataurl"));
587 load_params.load_type = NavigationController::LOAD_TYPE_DATA; 588 load_params.load_type = NavigationController::LOAD_TYPE_DATA;
588 load_params.base_url_for_data_url = GURL("http://foo"); 589 load_params.base_url_for_data_url = GURL("http://foo");
589 load_params.virtual_url_for_data_url = GURL(url::kAboutBlankURL); 590 load_params.virtual_url_for_data_url = GURL(url::kAboutBlankURL);
591 load_params.data_url_as_string = "data:text/html;charset=utf-8;base64,";
Charlie Reis 2015/12/10 20:43:46 Why doesn't this match the specified URL (data:tex
mnaganov (inactive) 2015/12/11 23:14:23 Done.
590 load_params.override_user_agent = NavigationController::UA_OVERRIDE_FALSE; 592 load_params.override_user_agent = NavigationController::UA_OVERRIDE_FALSE;
591 593
592 controller.LoadURLWithParams(load_params); 594 controller.LoadURLWithParams(load_params);
593 NavigationEntryImpl* entry = controller.GetPendingEntry(); 595 NavigationEntryImpl* entry = controller.GetPendingEntry();
594 596
595 CheckNavigationEntryMatchLoadParams(load_params, entry); 597 CheckNavigationEntryMatchLoadParams(load_params, entry);
596 } 598 }
597 599
598 TEST_F(NavigationControllerTest, LoadURLWithExtraParams_HttpPost) { 600 TEST_F(NavigationControllerTest, LoadURLWithExtraParams_HttpPost) {
599 NavigationControllerImpl& controller = controller_impl(); 601 NavigationControllerImpl& controller = controller_impl();
(...skipping 4493 matching lines...) Expand 10 before | Expand all | Expand 10 after
5093 EXPECT_EQ(default_ssl_status.connection_status, 5095 EXPECT_EQ(default_ssl_status.connection_status,
5094 details.ssl_status.connection_status); 5096 details.ssl_status.connection_status);
5095 EXPECT_EQ(default_ssl_status.content_status, 5097 EXPECT_EQ(default_ssl_status.content_status,
5096 details.ssl_status.content_status); 5098 details.ssl_status.content_status);
5097 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size()); 5099 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size());
5098 5100
5099 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); 5101 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count());
5100 } 5102 }
5101 5103
5102 } // namespace content 5104 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698