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 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2250 EXPECT_EQ(params.viewSize.width, width); | 2250 EXPECT_EQ(params.viewSize.width, width); |
2251 EXPECT_TRUE(ExecuteJavaScriptAndReturnIntValue(get_height, &height)); | 2251 EXPECT_TRUE(ExecuteJavaScriptAndReturnIntValue(get_height, &height)); |
2252 EXPECT_EQ(params.viewSize.height, height); | 2252 EXPECT_EQ(params.viewSize.height, height); |
2253 | 2253 |
2254 view()->OnDisableDeviceEmulation(); | 2254 view()->OnDisableDeviceEmulation(); |
2255 | 2255 |
2256 view()->OnEnableDeviceEmulation(params); | 2256 view()->OnEnableDeviceEmulation(params); |
2257 // Don't disable here to test that emulation is being shutdown properly. | 2257 // Don't disable here to test that emulation is being shutdown properly. |
2258 } | 2258 } |
2259 | 2259 |
2260 // Sanity checks for the Navigation Timing API |navigationStart| override. We | 2260 // Sanity check for the Navigation Timing API |navigationStart| override. We |
2261 // are asserting only most basic constraints, as TimeTicks (passed as the | 2261 // are asserting only most basic constraints, as TimeTicks (passed as the |
2262 // override) are not comparable with the wall time (returned by the Blink API). | 2262 // override) are not comparable with the wall time (returned by the Blink API). |
2263 TEST_F(RenderViewImplTest, NavigationStartOverride) { | 2263 TEST_F(RenderViewImplTest, NavigationStartOverride) { |
2264 // Verify that a navigation that claims to have started at the earliest | |
2265 // possible TimeTicks is indeed reported as one that started before | |
2266 // OnNavigate() is called. | |
2267 base::Time before_navigation = base::Time::Now(); | |
2268 CommonNavigationParams early_common_params; | |
2269 StartNavigationParams early_start_params; | |
2270 early_common_params.url = GURL("data:text/html,<div>Page</div>"); | |
2271 early_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | |
2272 early_common_params.transition = ui::PAGE_TRANSITION_TYPED; | |
2273 early_common_params.navigation_start = base::TimeTicks::FromInternalValue(1); | |
2274 early_start_params.is_post = true; | |
2275 | |
2276 frame()->Navigate(early_common_params, early_start_params, | |
2277 RequestNavigationParams()); | |
2278 ProcessPendingMessages(); | |
2279 | |
2280 base::Time early_nav_reported_start = | |
2281 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); | |
2282 EXPECT_LT(early_nav_reported_start, before_navigation); | |
2283 | |
2284 // Verify that a navigation that claims to have started in the future - 42 | 2264 // Verify that a navigation that claims to have started in the future - 42 |
2285 // days from now is *not* reported as one that starts in the future; as we | 2265 // days from now is *not* reported as one that starts in the future; as we |
2286 // sanitize the override allowing a maximum of ::Now(). | 2266 // sanitize the override allowing a maximum of ::Now(). |
2287 CommonNavigationParams late_common_params; | 2267 CommonNavigationParams late_common_params; |
2288 StartNavigationParams late_start_params; | 2268 StartNavigationParams late_start_params; |
2289 late_common_params.url = GURL("data:text/html,<div>Another page</div>"); | 2269 late_common_params.url = GURL("data:text/html,<div>Another page</div>"); |
2290 late_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 2270 late_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
2291 late_common_params.transition = ui::PAGE_TRANSITION_TYPED; | 2271 late_common_params.transition = ui::PAGE_TRANSITION_TYPED; |
2292 late_common_params.navigation_start = | 2272 late_common_params.navigation_start = |
2293 base::TimeTicks::Now() + base::TimeDelta::FromDays(42); | 2273 base::TimeTicks::Now() + base::TimeDelta::FromDays(42); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 FROM_HERE, | 2354 FROM_HERE, |
2375 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); | 2355 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); |
2376 ExecuteJavaScriptForTests("debugger;"); | 2356 ExecuteJavaScriptForTests("debugger;"); |
2377 | 2357 |
2378 // CloseWhilePaused should resume execution and continue here. | 2358 // CloseWhilePaused should resume execution and continue here. |
2379 EXPECT_FALSE(IsPaused()); | 2359 EXPECT_FALSE(IsPaused()); |
2380 Detach(); | 2360 Detach(); |
2381 } | 2361 } |
2382 | 2362 |
2383 } // namespace content | 2363 } // namespace content |
OLD | NEW |