| 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 new_main_frame->SwapOut(kProxyRoutingId, true, | 950 new_main_frame->SwapOut(kProxyRoutingId, true, |
| 951 content::FrameReplicationState()); | 951 content::FrameReplicationState()); |
| 952 | 952 |
| 953 // Simulate getting painted after swapping out. | 953 // Simulate getting painted after swapping out. |
| 954 new_view->DidFlushPaint(); | 954 new_view->DidFlushPaint(); |
| 955 | 955 |
| 956 new_view->Close(); | 956 new_view->Close(); |
| 957 new_view->Release(); | 957 new_view->Release(); |
| 958 } | 958 } |
| 959 | 959 |
| 960 // Verify that the renderer process doesn't crash when device scale factor |
| 961 // changes after a cross-process navigation has commited. |
| 962 // See https://crbug.com/571603. |
| 963 TEST_F(RenderViewImplTest, SetZoomLevelAfterCrossProcessNavigation) { |
| 964 // This test should only run with out-of-process iframes enabled. |
| 965 if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) |
| 966 return; |
| 967 |
| 968 // The bug reproduces if zoom is used for devices scale factor. |
| 969 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 970 switches::kEnableUseZoomForDSF); |
| 971 |
| 972 LoadHTML("Hello world!"); |
| 973 |
| 974 // Swap the main frame out after which it should become a WebRemoteFrame. |
| 975 TestRenderFrame* main_frame = |
| 976 static_cast<TestRenderFrame*>(view()->GetMainRenderFrame()); |
| 977 main_frame->SwapOut(kProxyRoutingId, true, content::FrameReplicationState()); |
| 978 EXPECT_TRUE(view()->webview()->mainFrame()->isWebRemoteFrame()); |
| 979 |
| 980 // This should not cause a crash. |
| 981 view()->OnDeviceScaleFactorChanged(); |
| 982 } |
| 983 |
| 960 // Test that we get the correct UpdateState message when we go back twice | 984 // Test that we get the correct UpdateState message when we go back twice |
| 961 // quickly without committing. Regression test for http://crbug.com/58082. | 985 // quickly without committing. Regression test for http://crbug.com/58082. |
| 962 // Disabled: http://crbug.com/157357 . | 986 // Disabled: http://crbug.com/157357 . |
| 963 TEST_F(RenderViewImplTest, DISABLED_LastCommittedUpdateState) { | 987 TEST_F(RenderViewImplTest, DISABLED_LastCommittedUpdateState) { |
| 964 // Load page A. | 988 // Load page A. |
| 965 LoadHTML("<div>Page A</div>"); | 989 LoadHTML("<div>Page A</div>"); |
| 966 | 990 |
| 967 // Load page B, which will trigger an UpdateState message for page A. | 991 // Load page B, which will trigger an UpdateState message for page A. |
| 968 LoadHTML("<div>Page B</div>"); | 992 LoadHTML("<div>Page B</div>"); |
| 969 | 993 |
| (...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2706 FROM_HERE, | 2730 FROM_HERE, |
| 2707 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); | 2731 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); |
| 2708 ExecuteJavaScriptForTests("debugger;"); | 2732 ExecuteJavaScriptForTests("debugger;"); |
| 2709 | 2733 |
| 2710 // CloseWhilePaused should resume execution and continue here. | 2734 // CloseWhilePaused should resume execution and continue here. |
| 2711 EXPECT_FALSE(IsPaused()); | 2735 EXPECT_FALSE(IsPaused()); |
| 2712 Detach(); | 2736 Detach(); |
| 2713 } | 2737 } |
| 2714 | 2738 |
| 2715 } // namespace content | 2739 } // namespace content |
| OLD | NEW |