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 "content/browser/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 5306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5317 // pruned it will end up as a *new* entry at the end of the entry list. This | 5317 // pruned it will end up as a *new* entry at the end of the entry list. This |
5318 // means that occasionally a navigation conflict will end up with one entry | 5318 // means that occasionally a navigation conflict will end up with one entry |
5319 // bubbling to the end of the entry list, but that's the least-bad option. | 5319 // bubbling to the end of the entry list, but that's the least-bad option. |
5320 EXPECT_EQ(3, controller.GetEntryCount()); | 5320 EXPECT_EQ(3, controller.GetEntryCount()); |
5321 EXPECT_EQ(2, controller.GetCurrentEntryIndex()); | 5321 EXPECT_EQ(2, controller.GetCurrentEntryIndex()); |
5322 EXPECT_EQ(url_a, controller.GetEntryAtIndex(0)->GetURL()); | 5322 EXPECT_EQ(url_a, controller.GetEntryAtIndex(0)->GetURL()); |
5323 EXPECT_EQ(url_c, controller.GetEntryAtIndex(1)->GetURL()); | 5323 EXPECT_EQ(url_c, controller.GetEntryAtIndex(1)->GetURL()); |
5324 EXPECT_EQ(url_b, controller.GetEntryAtIndex(2)->GetURL()); | 5324 EXPECT_EQ(url_b, controller.GetEntryAtIndex(2)->GetURL()); |
5325 } | 5325 } |
5326 | 5326 |
5327 // Test that if a renderer provides bogus security info (that fails to | |
5328 // deserialize properly) when reporting a navigation, the renderer gets | |
5329 // killed. | |
5330 TEST_F(NavigationControllerTest, RendererNavigateBogusSecurityInfo) { | |
5331 GURL url("http://foo.test"); | |
5332 controller().LoadURL(url, Referrer(), ui::PAGE_TRANSITION_TYPED, | |
5333 std::string()); | |
5334 FrameHostMsg_DidCommitProvisionalLoad_Params params; | |
5335 params.page_id = 0; | |
5336 params.nav_entry_id = 0; | |
5337 params.did_create_new_entry = true; | |
5338 params.url = url; | |
5339 params.transition = ui::PAGE_TRANSITION_LINK; | |
5340 params.should_update_history = true; | |
5341 params.gesture = NavigationGestureUser; | |
5342 params.method = "GET"; | |
5343 params.page_state = PageState::CreateFromURL(url); | |
5344 params.was_within_same_page = false; | |
5345 params.security_info = "bogus security info!"; | |
5346 | |
5347 LoadCommittedDetailsObserver observer(contents()); | |
5348 EXPECT_EQ(0, main_test_rfh()->GetProcess()->bad_msg_count()); | |
5349 main_test_rfh()->PrepareForCommit(); | |
5350 main_test_rfh()->SendNavigateWithParams(¶ms); | |
5351 | |
5352 SSLStatus default_ssl_status; | |
5353 EXPECT_EQ(default_ssl_status.security_style, | |
5354 observer.details().ssl_status.security_style); | |
5355 EXPECT_EQ(default_ssl_status.cert_id, observer.details().ssl_status.cert_id); | |
5356 EXPECT_EQ(default_ssl_status.cert_status, | |
5357 observer.details().ssl_status.cert_status); | |
5358 EXPECT_EQ(default_ssl_status.security_bits, | |
5359 observer.details().ssl_status.security_bits); | |
5360 EXPECT_EQ(default_ssl_status.connection_status, | |
5361 observer.details().ssl_status.connection_status); | |
5362 EXPECT_EQ(default_ssl_status.content_status, | |
5363 observer.details().ssl_status.content_status); | |
5364 EXPECT_EQ(default_ssl_status.sct_statuses, | |
5365 observer.details().ssl_status.sct_statuses); | |
5366 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); | |
5367 } | |
5368 | |
5369 } // namespace content | 5327 } // namespace content |
OLD | NEW |