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

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 the code modifications 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..63767a15d484b8198e61b937c50f4f9993310761 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
@@ -11,9 +11,12 @@
#include "core/dom/Document.h"
#include "core/dom/ElementTraversal.h"
#include "core/dom/StyleEngine.h"
+#include "core/events/Event.h"
#include "core/frame/Settings.h"
+#include "core/html/HTMLElement.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 +58,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 +526,33 @@ 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);
+
+ HTMLElement* element = volumeSlider;
+
+ MockLayoutObject layoutObject;
+ LayoutObject* prevLayoutObject = volumeSlider->layoutObject();
+ volumeSlider->setLayoutObject(&layoutObject);
+
+ Event* event = Event::create(EventTypeNames::input);
+ element->defaultEventHandler(event);
+ EXPECT_EQ(1, layoutObject.fullPaintInvalidationCallCount());
+
+ event = Event::create(EventTypeNames::input);
+ element->defaultEventHandler(event);
+ EXPECT_EQ(2, layoutObject.fullPaintInvalidationCallCount());
+
+ event = Event::create(EventTypeNames::input);
+ element->defaultEventHandler(event);
+ EXPECT_EQ(3, layoutObject.fullPaintInvalidationCallCount());
+
+ volumeSlider->setLayoutObject(prevLayoutObject);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698