| OLD | NEW |
| 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/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 CheckNavigationEntryMatchLoadParams(load_params, entry); | 534 CheckNavigationEntryMatchLoadParams(load_params, entry); |
| 535 } | 535 } |
| 536 | 536 |
| 537 TEST_F(NavigationControllerTest, LoadURLWithExtraParams_Data) { | 537 TEST_F(NavigationControllerTest, LoadURLWithExtraParams_Data) { |
| 538 NavigationControllerImpl& controller = controller_impl(); | 538 NavigationControllerImpl& controller = controller_impl(); |
| 539 | 539 |
| 540 NavigationController::LoadURLParams load_params( | 540 NavigationController::LoadURLParams load_params( |
| 541 GURL("data:text/html,dataurl")); | 541 GURL("data:text/html,dataurl")); |
| 542 load_params.load_type = NavigationController::LOAD_TYPE_DATA; | 542 load_params.load_type = NavigationController::LOAD_TYPE_DATA; |
| 543 load_params.base_url_for_data_url = GURL("http://foo"); | 543 load_params.base_url_for_data_url = GURL("http://foo"); |
| 544 load_params.virtual_url_for_data_url = GURL(kAboutBlankURL); | 544 load_params.virtual_url_for_data_url = GURL(url::kAboutBlankURL); |
| 545 load_params.override_user_agent = NavigationController::UA_OVERRIDE_FALSE; | 545 load_params.override_user_agent = NavigationController::UA_OVERRIDE_FALSE; |
| 546 | 546 |
| 547 controller.LoadURLWithParams(load_params); | 547 controller.LoadURLWithParams(load_params); |
| 548 NavigationEntryImpl* entry = | 548 NavigationEntryImpl* entry = |
| 549 NavigationEntryImpl::FromNavigationEntry( | 549 NavigationEntryImpl::FromNavigationEntry( |
| 550 controller.GetPendingEntry()); | 550 controller.GetPendingEntry()); |
| 551 | 551 |
| 552 CheckNavigationEntryMatchLoadParams(load_params, entry); | 552 CheckNavigationEntryMatchLoadParams(load_params, entry); |
| 553 } | 553 } |
| 554 | 554 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 NavigationControllerImpl& controller = controller_impl(); | 910 NavigationControllerImpl& controller = controller_impl(); |
| 911 TestNotificationTracker notifications; | 911 TestNotificationTracker notifications; |
| 912 RegisterForAllNavNotifications(¬ifications, &controller); | 912 RegisterForAllNavNotifications(¬ifications, &controller); |
| 913 | 913 |
| 914 // Set a WebContentsDelegate to listen for state changes. | 914 // Set a WebContentsDelegate to listen for state changes. |
| 915 scoped_ptr<TestWebContentsDelegate> delegate(new TestWebContentsDelegate()); | 915 scoped_ptr<TestWebContentsDelegate> delegate(new TestWebContentsDelegate()); |
| 916 EXPECT_FALSE(contents()->GetDelegate()); | 916 EXPECT_FALSE(contents()->GetDelegate()); |
| 917 contents()->SetDelegate(delegate.get()); | 917 contents()->SetDelegate(delegate.get()); |
| 918 | 918 |
| 919 // Without any navigations, the renderer starts at about:blank. | 919 // Without any navigations, the renderer starts at about:blank. |
| 920 const GURL kExistingURL(kAboutBlankURL); | 920 const GURL kExistingURL(url::kAboutBlankURL); |
| 921 | 921 |
| 922 // Now make a pending new navigation. | 922 // Now make a pending new navigation. |
| 923 const GURL kNewURL("http://eh"); | 923 const GURL kNewURL("http://eh"); |
| 924 controller.LoadURL( | 924 controller.LoadURL( |
| 925 kNewURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); | 925 kNewURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); |
| 926 EXPECT_EQ(0U, notifications.size()); | 926 EXPECT_EQ(0U, notifications.size()); |
| 927 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 927 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
| 928 EXPECT_TRUE(controller.GetPendingEntry()); | 928 EXPECT_TRUE(controller.GetPendingEntry()); |
| 929 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); | 929 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); |
| 930 EXPECT_EQ(1, delegate->navigation_state_change_count()); | 930 EXPECT_EQ(1, delegate->navigation_state_change_count()); |
| (...skipping 3359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4290 params.post_id = -1; | 4290 params.post_id = -1; |
| 4291 test_rvh()->SendNavigateWithParams(¶ms); | 4291 test_rvh()->SendNavigateWithParams(¶ms); |
| 4292 | 4292 |
| 4293 // Now reload. replaceState overrides the POST, so we should not show a | 4293 // Now reload. replaceState overrides the POST, so we should not show a |
| 4294 // repost warning dialog. | 4294 // repost warning dialog. |
| 4295 controller_impl().Reload(true); | 4295 controller_impl().Reload(true); |
| 4296 EXPECT_EQ(0, delegate->repost_form_warning_count()); | 4296 EXPECT_EQ(0, delegate->repost_form_warning_count()); |
| 4297 } | 4297 } |
| 4298 | 4298 |
| 4299 } // namespace content | 4299 } // namespace content |
| OLD | NEW |