| OLD | NEW |
| 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1904 TEST_F(RenderViewImplTest, NavigateSubframe) { | 1904 TEST_F(RenderViewImplTest, NavigateSubframe) { |
| 1905 // Load page A. | 1905 // Load page A. |
| 1906 LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>"); | 1906 LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>"); |
| 1907 | 1907 |
| 1908 // Navigate the frame only. | 1908 // Navigate the frame only. |
| 1909 CommonNavigationParams common_params; | 1909 CommonNavigationParams common_params; |
| 1910 RequestNavigationParams request_params; | 1910 RequestNavigationParams request_params; |
| 1911 common_params.url = GURL("data:text/html,world"); | 1911 common_params.url = GURL("data:text/html,world"); |
| 1912 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 1912 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 1913 common_params.transition = ui::PAGE_TRANSITION_TYPED; | 1913 common_params.transition = ui::PAGE_TRANSITION_TYPED; |
| 1914 common_params.navigation_start = base::TimeTicks::FromInternalValue(1); |
| 1914 request_params.current_history_list_length = 1; | 1915 request_params.current_history_list_length = 1; |
| 1915 request_params.current_history_list_offset = 0; | 1916 request_params.current_history_list_offset = 0; |
| 1916 request_params.pending_history_list_offset = 1; | 1917 request_params.pending_history_list_offset = 1; |
| 1917 request_params.page_id = -1; | 1918 request_params.page_id = -1; |
| 1918 request_params.browser_navigation_start = | |
| 1919 base::TimeTicks::FromInternalValue(1); | |
| 1920 | 1919 |
| 1921 TestRenderFrame* subframe = | 1920 TestRenderFrame* subframe = |
| 1922 static_cast<TestRenderFrame*>(RenderFrameImpl::FromWebFrame( | 1921 static_cast<TestRenderFrame*>(RenderFrameImpl::FromWebFrame( |
| 1923 view()->webview()->findFrameByName("frame"))); | 1922 view()->webview()->findFrameByName("frame"))); |
| 1924 subframe->Navigate(common_params, StartNavigationParams(), request_params); | 1923 subframe->Navigate(common_params, StartNavigationParams(), request_params); |
| 1925 FrameLoadWaiter(subframe).Wait(); | 1924 FrameLoadWaiter(subframe).Wait(); |
| 1926 | 1925 |
| 1927 // Copy the document content to std::wstring and compare with the | 1926 // Copy the document content to std::wstring and compare with the |
| 1928 // expected result. | 1927 // expected result. |
| 1929 const int kMaxOutputCharacters = 256; | 1928 const int kMaxOutputCharacters = 256; |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2266 // Sanity checks for the Navigation Timing API |navigationStart| override. We | 2265 // Sanity checks for the Navigation Timing API |navigationStart| override. We |
| 2267 // are asserting only most basic constraints, as TimeTicks (passed as the | 2266 // are asserting only most basic constraints, as TimeTicks (passed as the |
| 2268 // override) are not comparable with the wall time (returned by the Blink API). | 2267 // override) are not comparable with the wall time (returned by the Blink API). |
| 2269 TEST_F(RenderViewImplTest, NavigationStartOverride) { | 2268 TEST_F(RenderViewImplTest, NavigationStartOverride) { |
| 2270 // Verify that a navigation that claims to have started at the earliest | 2269 // Verify that a navigation that claims to have started at the earliest |
| 2271 // possible TimeTicks is indeed reported as one that started before | 2270 // possible TimeTicks is indeed reported as one that started before |
| 2272 // OnNavigate() is called. | 2271 // OnNavigate() is called. |
| 2273 base::Time before_navigation = base::Time::Now(); | 2272 base::Time before_navigation = base::Time::Now(); |
| 2274 CommonNavigationParams early_common_params; | 2273 CommonNavigationParams early_common_params; |
| 2275 StartNavigationParams early_start_params; | 2274 StartNavigationParams early_start_params; |
| 2276 RequestNavigationParams early_request_params; | |
| 2277 early_common_params.url = GURL("data:text/html,<div>Page</div>"); | 2275 early_common_params.url = GURL("data:text/html,<div>Page</div>"); |
| 2278 early_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 2276 early_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 2279 early_common_params.transition = ui::PAGE_TRANSITION_TYPED; | 2277 early_common_params.transition = ui::PAGE_TRANSITION_TYPED; |
| 2278 early_common_params.navigation_start = base::TimeTicks::FromInternalValue(1); |
| 2280 early_start_params.is_post = true; | 2279 early_start_params.is_post = true; |
| 2281 early_request_params.browser_navigation_start = | |
| 2282 base::TimeTicks::FromInternalValue(1); | |
| 2283 | 2280 |
| 2284 frame()->Navigate(early_common_params, early_start_params, | 2281 frame()->Navigate(early_common_params, early_start_params, |
| 2285 early_request_params); | 2282 RequestNavigationParams()); |
| 2286 ProcessPendingMessages(); | 2283 ProcessPendingMessages(); |
| 2287 | 2284 |
| 2288 base::Time early_nav_reported_start = | 2285 base::Time early_nav_reported_start = |
| 2289 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); | 2286 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); |
| 2290 EXPECT_LT(early_nav_reported_start, before_navigation); | 2287 EXPECT_LT(early_nav_reported_start, before_navigation); |
| 2291 | 2288 |
| 2292 // Verify that a navigation that claims to have started in the future - 42 | 2289 // Verify that a navigation that claims to have started in the future - 42 |
| 2293 // days from now is *not* reported as one that starts in the future; as we | 2290 // days from now is *not* reported as one that starts in the future; as we |
| 2294 // sanitize the override allowing a maximum of ::Now(). | 2291 // sanitize the override allowing a maximum of ::Now(). |
| 2295 CommonNavigationParams late_common_params; | 2292 CommonNavigationParams late_common_params; |
| 2296 RequestNavigationParams late_request_params; | |
| 2297 StartNavigationParams late_start_params; | 2293 StartNavigationParams late_start_params; |
| 2298 late_common_params.url = GURL("data:text/html,<div>Another page</div>"); | 2294 late_common_params.url = GURL("data:text/html,<div>Another page</div>"); |
| 2299 late_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 2295 late_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 2300 late_common_params.transition = ui::PAGE_TRANSITION_TYPED; | 2296 late_common_params.transition = ui::PAGE_TRANSITION_TYPED; |
| 2297 late_common_params.navigation_start = |
| 2298 base::TimeTicks::Now() + base::TimeDelta::FromDays(42); |
| 2301 late_start_params.is_post = true; | 2299 late_start_params.is_post = true; |
| 2302 late_request_params.browser_navigation_start = | |
| 2303 base::TimeTicks::Now() + base::TimeDelta::FromDays(42); | |
| 2304 | 2300 |
| 2305 frame()->Navigate(late_common_params, late_start_params, late_request_params); | 2301 frame()->Navigate(late_common_params, late_start_params, |
| 2302 RequestNavigationParams()); |
| 2306 ProcessPendingMessages(); | 2303 ProcessPendingMessages(); |
| 2307 base::Time after_navigation = | 2304 base::Time after_navigation = |
| 2308 base::Time::Now() + base::TimeDelta::FromDays(1); | 2305 base::Time::Now() + base::TimeDelta::FromDays(1); |
| 2309 | 2306 |
| 2310 base::Time late_nav_reported_start = | 2307 base::Time late_nav_reported_start = |
| 2311 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); | 2308 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); |
| 2312 EXPECT_LE(late_nav_reported_start, after_navigation); | 2309 EXPECT_LE(late_nav_reported_start, after_navigation); |
| 2313 } | 2310 } |
| 2314 | 2311 |
| 2315 TEST_F(RenderViewImplTest, PreferredSizeZoomed) { | 2312 TEST_F(RenderViewImplTest, PreferredSizeZoomed) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2382 FROM_HERE, | 2379 FROM_HERE, |
| 2383 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); | 2380 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); |
| 2384 ExecuteJavaScriptForTests("debugger;"); | 2381 ExecuteJavaScriptForTests("debugger;"); |
| 2385 | 2382 |
| 2386 // CloseWhilePaused should resume execution and continue here. | 2383 // CloseWhilePaused should resume execution and continue here. |
| 2387 EXPECT_FALSE(IsPaused()); | 2384 EXPECT_FALSE(IsPaused()); |
| 2388 Detach(); | 2385 Detach(); |
| 2389 } | 2386 } |
| 2390 | 2387 |
| 2391 } // namespace content | 2388 } // namespace content |
| OLD | NEW |