Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(835)

Side by Side Diff: third_party/WebKit/Source/web/tests/MediaElementFillingViewportTest.cpp

Issue 2885313003: [scheduler] Fix --disable-background-timer-throttling flag. (Closed)
Patch Set: fix test crash Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "web/tests/sim/SimRequest.h" 11 #include "web/tests/sim/SimRequest.h"
12 #include "web/tests/sim/SimTest.h" 12 #include "web/tests/sim/SimTest.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class MediaElementFillingViewportTest : public SimTest { 16 class MediaElementFillingViewportTest : public SimTest {
17 protected: 17 protected:
18 MediaElementFillingViewportTest() { WebView().Resize(WebSize(640, 480)); } 18 MediaElementFillingViewportTest() {}
19
20 void SetUp() override {
21 SimTest::SetUp();
22 WebView().Resize(WebSize(640, 480));
23 }
19 24
20 bool IsMostlyFillingViewport(HTMLMediaElement* element) { 25 bool IsMostlyFillingViewport(HTMLMediaElement* element) {
21 return element->mostly_filling_viewport_; 26 return element->mostly_filling_viewport_;
22 } 27 }
23 28
24 bool ViewportFillDebouncerTimerActive(HTMLMediaElement* element) { 29 bool ViewportFillDebouncerTimerActive(HTMLMediaElement* element) {
25 return element->viewport_fill_debouncer_timer_.IsActive(); 30 return element->viewport_fill_debouncer_timer_.IsActive();
26 } 31 }
27 32
28 void CheckViewportIntersectionChanged(HTMLMediaElement* element) { 33 void CheckViewportIntersectionChanged(HTMLMediaElement* element) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 element->setAttribute( 152 element->setAttribute(
148 "style", "position:fixed; left:0; top:240px; width:100%; height:100%;", 153 "style", "position:fixed; left:0; top:240px; width:100%; height:100%;",
149 ASSERT_NO_EXCEPTION); 154 ASSERT_NO_EXCEPTION);
150 Compositor().BeginFrame(); 155 Compositor().BeginFrame();
151 CheckViewportIntersectionChanged(element); 156 CheckViewportIntersectionChanged(element);
152 EXPECT_FALSE(IsMostlyFillingViewport(element)); 157 EXPECT_FALSE(IsMostlyFillingViewport(element));
153 EXPECT_FALSE(ViewportFillDebouncerTimerActive(element)); 158 EXPECT_FALSE(ViewportFillDebouncerTimerActive(element));
154 } 159 }
155 160
156 } // namespace blink 161 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698