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

Unified Diff: third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp

Issue 2783593002: Redraw media volume slider when it is moving (Closed)
Patch Set: Test for volume slider invalidation on input while dragging Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
index 9a3f79b4c5b05b14017007db2bdc66c110579636..8320d97b95c66f673d284a9ca17cbaab2c455b46 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
@@ -14,6 +14,7 @@
#include "core/frame/Settings.h"
#include "core/html/HTMLVideoElement.h"
#include "core/html/shadow/MediaControlElementTypes.h"
+#include "core/layout/LayoutObject.h"
#include "core/loader/EmptyClients.h"
#include "core/testing/DummyPageHolder.h"
#include "platform/heap/Handle.h"
@@ -55,6 +56,28 @@ class MockWebRemotePlaybackClient : public WebRemotePlaybackClient {
WebRemotePlaybackAvailability::Unknown;
};
+class MockLayoutObject : public LayoutObject {
+ public:
+ MockLayoutObject() : LayoutObject(nullptr) {}
+
+ const char* name() const override { return "MockLayoutObject"; }
+ void layout() override {}
+ FloatRect localBoundingBoxRectForAccessibility() const override {
+ return FloatRect();
+ }
+
+ void setShouldDoFullPaintInvalidation(PaintInvalidationReason) {
+ m_fullPaintInvalidationCallCount++;
+ }
+
+ int fullPaintInvalidationCallCount() const {
+ return m_fullPaintInvalidationCallCount;
+ }
+
+ private:
+ int m_fullPaintInvalidationCallCount = 0;
+};
+
class StubLocalFrameClient : public EmptyLocalFrameClient {
public:
static StubLocalFrameClient* create() { return new StubLocalFrameClient; }
@@ -501,4 +524,28 @@ TEST_F(MediaControlsTest, TimelineImmediatelyUpdatesCurrentTime) {
EXPECT_EQ(duration / 2, currentTimeDisplay->currentValue());
}
+TEST_F(MediaControlsTest, VolumeSliderPaintInvalidationOnInput) {
+ ensureSizing();
+
+ MediaControlVolumeSliderElement* volumeSlider =
+ static_cast<MediaControlVolumeSliderElement*>(getElementByShadowPseudoId(
+ mediaControls(), "-webkit-media-controls-volume-slider"));
+ ASSERT_NE(nullptr, volumeSlider);
+
+ MockLayoutObject layoutObject;
+ LayoutObject* prevLayoutObject = volumeSlider->layoutObject();
+ volumeSlider->setLayoutObject(&layoutObject);
+
+ volumeSlider->setVolume(0.5);
mlamouri (slow - plz ping) 2017/03/31 11:20:16 I'm a bit confused: setVolume() doesn't call the c
sabbakumov 2017/04/03 04:12:45 Done.
+ EXPECT_EQ(1, layoutObject.fullPaintInvalidationCallCount());
+
+ volumeSlider->setVolume(0.3);
+ EXPECT_EQ(2, layoutObject.fullPaintInvalidationCallCount());
+
+ volumeSlider->setVolume(0.1);
+ EXPECT_EQ(3, layoutObject.fullPaintInvalidationCallCount());
+
+ volumeSlider->setLayoutObject(prevLayoutObject);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698