Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove internal CE API usage from tests #32353

Merged
merged 4 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extensions/amp-3d-gltf/0.1/test/test-amp-3d-gltf.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describes.realWin(
doc.body.appendChild(amp3dGltfEl);
await amp3dGltfEl.build();

const amp3dGltf = amp3dGltfEl.implementation_;
const amp3dGltf = await amp3dGltfEl.getImpl();
env.sandbox
.stub(amp3dGltf, 'iframe_')
.get(() => iframe)
Expand Down
16 changes: 9 additions & 7 deletions extensions/amp-3q-player/0.1/test/test-amp-3q-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ describes.realWin(
await player.build();
player.layoutCallback();
const iframe = player.querySelector('iframe');
player.implementation_.sdnBridge_({
const impl = await player.getImpl();
impl.sdnBridge_({
source: iframe.contentWindow,
data: JSON.stringify({data: 'ready'}),
});
Expand All @@ -76,25 +77,26 @@ describes.realWin(

it('should forward events from amp-3q-player to the amp element', async () => {
const player = await get3QElement('c8dbe7f4-7f7f-11e6-a407-0cc47a188158');
const impl = await player.getImpl();
const iframe = player.querySelector('iframe');
await Promise.resolve();
const p1 = listenOncePromise(player, VideoEvents.MUTED);
sendFakeMessage(player, iframe, 'muted');
sendFakeMessage(impl, iframe, 'muted');
await p1;
const p2 = listenOncePromise(player, VideoEvents.PLAYING);
sendFakeMessage(player, iframe, 'playing');
sendFakeMessage(impl, iframe, 'playing');
await p2;
const p3 = listenOncePromise(player, VideoEvents.PAUSE);
sendFakeMessage(player, iframe, 'paused');
sendFakeMessage(impl, iframe, 'paused');
await p3;
const p4 = listenOncePromise(player, VideoEvents.UNMUTED);
sendFakeMessage(player, iframe, 'unmuted');
sendFakeMessage(impl, iframe, 'unmuted');
const successTimeout = timer.promise(10);
return Promise.race([p4, successTimeout]);
});

function sendFakeMessage(player, iframe, command) {
player.implementation_.sdnBridge_({
function sendFakeMessage(impl, iframe, command) {
impl.sdnBridge_({
source: iframe.contentWindow,
data: JSON.stringify({data: command}),
});
Expand Down
Loading