| 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/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 3290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3301 EXPECT_TRUE(controller.IsURLInPageNavigation(url, true, | 3301 EXPECT_TRUE(controller.IsURLInPageNavigation(url, true, |
| 3302 main_test_rfh())); | 3302 main_test_rfh())); |
| 3303 | 3303 |
| 3304 // If the renderer says this is a same-origin in-page navigation, believe it. | 3304 // If the renderer says this is a same-origin in-page navigation, believe it. |
| 3305 // This is the pushState/replaceState case. | 3305 // This is the pushState/replaceState case. |
| 3306 EXPECT_TRUE(controller.IsURLInPageNavigation(other_url, true, | 3306 EXPECT_TRUE(controller.IsURLInPageNavigation(other_url, true, |
| 3307 main_test_rfh())); | 3307 main_test_rfh())); |
| 3308 | 3308 |
| 3309 // Test allow_universal_access_from_file_urls flag. | 3309 // Test allow_universal_access_from_file_urls flag. |
| 3310 const GURL different_origin_url("http://www.example.com"); | 3310 const GURL different_origin_url("http://www.example.com"); |
| 3311 MockRenderProcessHost* rph = | 3311 MockRenderProcessHost* rph = main_test_rfh()->GetProcess(); |
| 3312 static_cast<MockRenderProcessHost*>(main_test_rfh()->GetProcess()); | |
| 3313 WebPreferences prefs = test_rvh()->GetWebkitPreferences(); | 3312 WebPreferences prefs = test_rvh()->GetWebkitPreferences(); |
| 3314 prefs.allow_universal_access_from_file_urls = true; | 3313 prefs.allow_universal_access_from_file_urls = true; |
| 3315 test_rvh()->UpdateWebkitPreferences(prefs); | 3314 test_rvh()->UpdateWebkitPreferences(prefs); |
| 3316 prefs = test_rvh()->GetWebkitPreferences(); | 3315 prefs = test_rvh()->GetWebkitPreferences(); |
| 3317 EXPECT_TRUE(prefs.allow_universal_access_from_file_urls); | 3316 EXPECT_TRUE(prefs.allow_universal_access_from_file_urls); |
| 3318 // Allow in page navigation if existing URL is file scheme. | 3317 // Allow in page navigation if existing URL is file scheme. |
| 3319 const GURL file_url("file:///foo/index.html"); | 3318 const GURL file_url("file:///foo/index.html"); |
| 3320 main_test_rfh()->SendNavigate(0, file_url); | 3319 main_test_rfh()->SendNavigate(0, file_url); |
| 3321 EXPECT_EQ(0, rph->bad_msg_count()); | 3320 EXPECT_EQ(0, rph->bad_msg_count()); |
| 3322 EXPECT_TRUE(controller.IsURLInPageNavigation(different_origin_url, true, | 3321 EXPECT_TRUE(controller.IsURLInPageNavigation(different_origin_url, true, |
| (...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4593 { | 4592 { |
| 4594 LoadCommittedDetails details; | 4593 LoadCommittedDetails details; |
| 4595 controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); | 4594 controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); |
| 4596 EXPECT_EQ(PAGE_TYPE_ERROR, | 4595 EXPECT_EQ(PAGE_TYPE_ERROR, |
| 4597 controller_impl().GetLastCommittedEntry()->GetPageType()); | 4596 controller_impl().GetLastCommittedEntry()->GetPageType()); |
| 4598 EXPECT_EQ(NAVIGATION_TYPE_IN_PAGE, details.type); | 4597 EXPECT_EQ(NAVIGATION_TYPE_IN_PAGE, details.type); |
| 4599 } | 4598 } |
| 4600 } | 4599 } |
| 4601 | 4600 |
| 4602 } // namespace content | 4601 } // namespace content |
| OLD | NEW |