| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/dom/Document.h" | 5 #include "core/dom/Document.h" |
| 6 #include "core/html/HTMLMediaElement.h" | 6 #include "core/html/HTMLMediaElement.h" |
| 7 #include "platform/testing/UnitTestHelpers.h" | 7 #include "platform/testing/UnitTestHelpers.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "web/tests/sim/SimCompositor.h" | 9 #include "web/tests/sim/SimCompositor.h" |
| 10 #include "web/tests/sim/SimDisplayItemList.h" | 10 #include "web/tests/sim/SimDisplayItemList.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 bool viewportFillDebouncerTimerActive(HTMLMediaElement* element) { | 24 bool viewportFillDebouncerTimerActive(HTMLMediaElement* element) { |
| 25 return element->m_viewportFillDebouncerTimer.isActive(); | 25 return element->m_viewportFillDebouncerTimer.isActive(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void checkViewportIntersectionChanged(HTMLMediaElement* element) { | 28 void checkViewportIntersectionChanged(HTMLMediaElement* element) { |
| 29 element->checkViewportIntersectionChanged(); | 29 element->checkViewportIntersectionChanged(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 std::unique_ptr<SimRequest> createMainResource() { | 32 std::unique_ptr<SimRequest> createMainResource() { |
| 33 std::unique_ptr<SimRequest> mainResource = | 33 std::unique_ptr<SimRequest> mainResource = |
| 34 wrapUnique(new SimRequest("https://example.com/", "text/html")); | 34 WTF::wrapUnique(new SimRequest("https://example.com/", "text/html")); |
| 35 loadURL("https://example.com"); | 35 loadURL("https://example.com"); |
| 36 return mainResource; | 36 return mainResource; |
| 37 } | 37 } |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 TEST_F(MediaElementFillingViewportTest, MostlyFillingViewport) { | 40 TEST_F(MediaElementFillingViewportTest, MostlyFillingViewport) { |
| 41 std::unique_ptr<SimRequest> mainResource = createMainResource(); | 41 std::unique_ptr<SimRequest> mainResource = createMainResource(); |
| 42 mainResource->complete( | 42 mainResource->complete( |
| 43 "<!DOCTYPE html>" | 43 "<!DOCTYPE html>" |
| 44 "<html>" | 44 "<html>" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 element->setAttribute( | 144 element->setAttribute( |
| 145 "style", "position:fixed; left:0; top:240px; width:100%; height:100%;", | 145 "style", "position:fixed; left:0; top:240px; width:100%; height:100%;", |
| 146 ASSERT_NO_EXCEPTION); | 146 ASSERT_NO_EXCEPTION); |
| 147 compositor().beginFrame(); | 147 compositor().beginFrame(); |
| 148 checkViewportIntersectionChanged(element); | 148 checkViewportIntersectionChanged(element); |
| 149 EXPECT_FALSE(isMostlyFillingViewport(element)); | 149 EXPECT_FALSE(isMostlyFillingViewport(element)); |
| 150 EXPECT_FALSE(viewportFillDebouncerTimerActive(element)); | 150 EXPECT_FALSE(viewportFillDebouncerTimerActive(element)); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace blink | 153 } // namespace blink |
| OLD | NEW |