| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 2701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2712 "<div style='width=20px; height=20px'></div>"; | 2712 "<div style='width=20px; height=20px'></div>"; |
| 2713 | 2713 |
| 2714 } // namespace | 2714 } // namespace |
| 2715 | 2715 |
| 2716 TEST_F(RenderViewImplScaleFactorTest, AutoResizeWithZoomForDSF) { | 2716 TEST_F(RenderViewImplScaleFactorTest, AutoResizeWithZoomForDSF) { |
| 2717 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 2717 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 2718 switches::kEnableUseZoomForDSF); | 2718 switches::kEnableUseZoomForDSF); |
| 2719 DoSetUp(); | 2719 DoSetUp(); |
| 2720 view()->EnableAutoResizeForTesting(gfx::Size(5, 5), gfx::Size(1000, 1000)); | 2720 view()->EnableAutoResizeForTesting(gfx::Size(5, 5), gfx::Size(1000, 1000)); |
| 2721 LoadHTML(kAutoResizeTestPage); | 2721 LoadHTML(kAutoResizeTestPage); |
| 2722 gfx::Size size_at_1x = view()->GetWidget()->size(); | 2722 gfx::Size size_at_1x = view()->size(); |
| 2723 ASSERT_FALSE(size_at_1x.IsEmpty()); | 2723 ASSERT_FALSE(size_at_1x.IsEmpty()); |
| 2724 | 2724 |
| 2725 SetDeviceScaleFactor(2.f); | 2725 SetDeviceScaleFactor(2.f); |
| 2726 LoadHTML(kAutoResizeTestPage); | 2726 LoadHTML(kAutoResizeTestPage); |
| 2727 gfx::Size size_at_2x = view()->GetWidget()->size(); | 2727 gfx::Size size_at_2x = view()->size(); |
| 2728 EXPECT_EQ(size_at_1x, size_at_2x); | 2728 EXPECT_EQ(size_at_1x, size_at_2x); |
| 2729 } | 2729 } |
| 2730 | 2730 |
| 2731 TEST_F(RenderViewImplScaleFactorTest, AutoResizeWithoutZoomForDSF) { | 2731 TEST_F(RenderViewImplScaleFactorTest, AutoResizeWithoutZoomForDSF) { |
| 2732 DoSetUp(); | 2732 DoSetUp(); |
| 2733 view()->EnableAutoResizeForTesting(gfx::Size(5, 5), gfx::Size(1000, 1000)); | 2733 view()->EnableAutoResizeForTesting(gfx::Size(5, 5), gfx::Size(1000, 1000)); |
| 2734 LoadHTML(kAutoResizeTestPage); | 2734 LoadHTML(kAutoResizeTestPage); |
| 2735 gfx::Size size_at_1x = view()->GetWidget()->size(); | 2735 gfx::Size size_at_1x = view()->size(); |
| 2736 ASSERT_FALSE(size_at_1x.IsEmpty()); | 2736 ASSERT_FALSE(size_at_1x.IsEmpty()); |
| 2737 | 2737 |
| 2738 SetDeviceScaleFactor(2.f); | 2738 SetDeviceScaleFactor(2.f); |
| 2739 LoadHTML(kAutoResizeTestPage); | 2739 LoadHTML(kAutoResizeTestPage); |
| 2740 gfx::Size size_at_2x = view()->GetWidget()->size(); | 2740 gfx::Size size_at_2x = view()->size(); |
| 2741 EXPECT_EQ(size_at_1x, size_at_2x); | 2741 EXPECT_EQ(size_at_1x, size_at_2x); |
| 2742 } | 2742 } |
| 2743 | 2743 |
| 2744 #endif | 2744 #endif |
| 2745 | 2745 |
| 2746 TEST_F(DevToolsAgentTest, DevToolsResumeOnClose) { | 2746 TEST_F(DevToolsAgentTest, DevToolsResumeOnClose) { |
| 2747 Attach(); | 2747 Attach(); |
| 2748 EXPECT_FALSE(IsPaused()); | 2748 EXPECT_FALSE(IsPaused()); |
| 2749 DispatchDevToolsMessage("{\"id\":1,\"method\":\"Debugger.enable\"}"); | 2749 DispatchDevToolsMessage("{\"id\":1,\"method\":\"Debugger.enable\"}"); |
| 2750 | 2750 |
| 2751 // Executing javascript will pause the thread and create nested message loop. | 2751 // Executing javascript will pause the thread and create nested message loop. |
| 2752 // Posting task simulates message coming from browser. | 2752 // Posting task simulates message coming from browser. |
| 2753 base::ThreadTaskRunnerHandle::Get()->PostTask( | 2753 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 2754 FROM_HERE, | 2754 FROM_HERE, |
| 2755 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); | 2755 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); |
| 2756 ExecuteJavaScriptForTests("debugger;"); | 2756 ExecuteJavaScriptForTests("debugger;"); |
| 2757 | 2757 |
| 2758 // CloseWhilePaused should resume execution and continue here. | 2758 // CloseWhilePaused should resume execution and continue here. |
| 2759 EXPECT_FALSE(IsPaused()); | 2759 EXPECT_FALSE(IsPaused()); |
| 2760 Detach(); | 2760 Detach(); |
| 2761 } | 2761 } |
| 2762 | 2762 |
| 2763 } // namespace content | 2763 } // namespace content |
| OLD | NEW |