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

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

Issue 2480003002: [RemotePlayback] Keep track of source compatibility and reject prompt() correspondingly (Closed)
Patch Set: Fixed failing tests Created 4 years, 1 month 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 31eeadba24631944984dc8d694db43e94a9f8d7c..bf8010aefc4beec050a96b585a3dfd2898b0c7b1 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
@@ -17,6 +17,7 @@
#include "platform/testing/UnitTestHelpers.h"
#include "public/platform/WebMediaPlayer.h"
#include "public/platform/WebSize.h"
+#include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h"
#include "testing/gtest/include/gtest/gtest.h"
#include <memory>
@@ -61,6 +62,20 @@ class MockVideoWebMediaPlayer : public WebMediaPlayer {
void paint(WebCanvas*, const WebRect&, SkPaint&) override{};
};
+class MockWebRemotePlaybackClient : public WebRemotePlaybackClient {
+ public:
+ void stateChanged(WebRemotePlaybackState) override {}
+ void availabilityChanged(bool isRouteAvailable,
+ bool isSourceCompatible) override {
+ m_availability = isRouteAvailable && isSourceCompatible;
+ }
+ void promptCancelled() override {}
+ bool remotePlaybackAvailable() const override { return m_availability; }
+
+ private:
+ bool m_availability = false;
+};
+
class StubFrameLoaderClient : public EmptyFrameLoaderClient {
public:
static StubFrameLoaderClient* create() { return new StubFrameLoaderClient; }
@@ -71,6 +86,12 @@ class StubFrameLoaderClient : public EmptyFrameLoaderClient {
WebMediaPlayerClient*) override {
return wrapUnique(new MockVideoWebMediaPlayer);
}
+
+ WebRemotePlaybackClient* createWebRemotePlaybackClient(
+ HTMLMediaElement&,
+ ScriptState*) override {
+ return new MockWebRemotePlaybackClient;
+ }
};
Element* getElementByShadowPseudoId(Node& rootNode,
@@ -124,7 +145,7 @@ class MediaControlsTest : public ::testing::Test {
}
void simulateRouteAvailabe() {
- m_mediaControls->mediaElement().remoteRouteAvailabilityChanged(true);
+ m_mediaControls->mediaElement().remoteRouteAvailabilityChanged(true, true);
}
void ensureLayout() {

Powered by Google App Engine
This is Rietveld 408576698