Skip to content

Commit

Permalink
Revert "[ppapi] Move some plugin tests into ppapi subdirectory"
Browse files Browse the repository at this point in the history
This reverts commit 497d48d.

Reason for revert: Causes leak-detection failures.

Original change's description:
> [ppapi] Move some plugin tests into ppapi subdirectory
>
> In preparation for disabling ppapi on every platform but ChromeOS
> move the tests into a ppapi subdirectory so we can easily skip it.
>
> Rewrite some tests to use the WebTest plugin.
>
> Teach WebTest plugin about a scriptable object that "loaded" is defined
> as a true boolean.
>
> Bug: b:303417958
> Change-Id: Icd7680e89897f01e99e6cd53f380f8f795cda0e8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5041191
> Reviewed-by: danakj <danakj@chromium.org>
> Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
> Reviewed-by: Stefan Zager <szager@chromium.org>
> Reviewed-by: Dirk Pranke <dpranke@google.com>
> Cr-Commit-Position: refs/heads/main@{#1226582}

Bug: b:303417958, 1503546
Change-Id: I3b0930f16ad4bf90a6a86155d6e9fa0f37e4706e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5043562
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Fergal Daly <fergal@chromium.org>
Owners-Override: Fergal Daly <fergal@google.com>
Cr-Commit-Position: refs/heads/main@{#1226653}
  • Loading branch information
fergald authored and Chromium LUCI CQ committed Nov 20, 2023
1 parent 89eb49a commit 9a1d37e
Show file tree
Hide file tree
Showing 143 changed files with 350 additions and 239 deletions.
1 change: 0 additions & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,6 @@ if (use_blink && !is_cronet_build) {
"//third_party/blink/web_tests/permissionclient/",
"//third_party/blink/web_tests/plugins/",
"//third_party/blink/web_tests/pointer-lock/",
"//third_party/blink/web_tests/ppapi/",
"//third_party/blink/web_tests/print_testharness/",
"//third_party/blink/web_tests/printing/",
"//third_party/blink/web_tests/register-protocol-handler/",
Expand Down
59 changes: 11 additions & 48 deletions content/web_test/renderer/test_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
#include "components/viz/common/resources/bitmap_allocation.h"
#include "components/viz/common/resources/shared_image_format.h"
#include "content/web_test/renderer/test_runner.h"
#include "gin/handle.h"
#include "gin/interceptor.h"
#include "gin/object_template_builder.h"
#include "gin/wrappable.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/gles2_interface.h"
Expand Down Expand Up @@ -120,50 +116,24 @@ blink::WebPluginContainer::TouchEventRequestType ParseTouchEventRequestType(
return blink::WebPluginContainer::kTouchEventRequestTypeNone;
}

class ScriptableObject : public gin::Wrappable<ScriptableObject>,
public gin::NamedPropertyInterceptor {
public:
static gin::WrapperInfo kWrapperInfo;

static v8::Local<v8::Object> Create(v8::Isolate* isolate) {
ScriptableObject* scriptable_object = new ScriptableObject(isolate);
return gin::CreateHandle(isolate, scriptable_object)
.ToV8()
.As<v8::Object>();
}

// gin::NamedPropertyInterceptor
v8::Local<v8::Value> GetNamedProperty(
v8::Isolate* isolate,
const std::string& identifier) override {
if (identifier == "loaded") {
return v8::True(isolate);
}
return v8::Local<v8::Value>();
}

private:
explicit ScriptableObject(v8::Isolate* isolate)
: gin::NamedPropertyInterceptor(isolate, this) {}

// gin::Wrappable
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override {
return gin::Wrappable<ScriptableObject>::GetObjectTemplateBuilder(isolate)
.AddNamedPropertyInterceptor();
}
};

// static
gin::WrapperInfo ScriptableObject::kWrapperInfo = {gin::kEmbedderNativeGin};

} // namespace

TestPlugin::TestPlugin(const blink::WebPluginParams& params,
TestRunner* test_runner,
blink::WebLocalFrame* frame)
: test_runner_(test_runner),
container_(nullptr),
web_local_frame_(frame),
gl_(nullptr),
content_changed_(false),
framebuffer_(0),
touch_event_request_(
blink::WebPluginContainer::kTouchEventRequestTypeNone),
re_request_touch_events_(false),
print_event_details_(false),
print_user_gesture_status_(false),
can_process_drag_(false),
supports_keyboard_focus_(false),
is_persistent_(params.mime_type == PluginPersistsMimeType()) {
DCHECK_EQ(params.attribute_names.size(), params.attribute_values.size());
size_t size = params.attribute_names.size();
Expand Down Expand Up @@ -331,13 +301,6 @@ bool TestPlugin::IsPlaceholder() {
return false;
}

v8::Local<v8::Object> TestPlugin::V8ScriptableObject(v8::Isolate* isolate) {
if (scriptable_object_.IsEmpty()) {
scriptable_object_.Reset(isolate, ScriptableObject::Create(isolate));
}
return scriptable_object_.Get(isolate);
}

// static
void TestPlugin::ReleaseSharedMemory(
scoped_refptr<cc::CrossThreadSharedBitmap> shared_bitmap,
Expand Down
21 changes: 9 additions & 12 deletions content/web_test/renderer/test_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class TestPlugin : public blink::WebPlugin, public cc::TextureLayerClient {
void DidFinishLoading() override {}
void DidFailLoading(const blink::WebURLError& error) override {}
bool IsPlaceholder() override;
v8::Local<v8::Object> V8ScriptableObject(v8::Isolate*) override;

// cc::TextureLayerClient methods:
bool PrepareTransferableResource(
Expand Down Expand Up @@ -182,24 +181,22 @@ class TestPlugin : public blink::WebPlugin, public cc::TextureLayerClient {
gpu::Mailbox mailbox_;
gpu::SyncToken sync_token_;
scoped_refptr<cc::CrossThreadSharedBitmap> shared_bitmap_;
bool content_changed_ = false;
GLuint framebuffer_ = 0;
bool content_changed_;
GLuint framebuffer_;
Scene scene_;
scoped_refptr<cc::TextureLayer> layer_;

v8::Persistent<v8::Object> scriptable_object_;

blink::WebPluginContainer::TouchEventRequestType touch_event_request_ =
blink::WebPluginContainer::kTouchEventRequestTypeNone;
blink::WebPluginContainer::TouchEventRequestType touch_event_request_;
// Requests touch events from the WebPluginContainerImpl multiple times to
// tickle webkit.org/b/108381
bool re_request_touch_events_ = false;
bool print_event_details_ = false;
bool print_user_gesture_status_ = false;
bool can_process_drag_ = false;
bool supports_keyboard_focus_ = false;
bool re_request_touch_events_;
bool print_event_details_;
bool print_user_gesture_status_;
bool can_process_drag_;
bool supports_keyboard_focus_;

bool is_persistent_;
bool can_create_without_renderer_;
};

} // namespace content
Expand Down
2 changes: 1 addition & 1 deletion third_party/blink/web_tests/ASANExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ crbug.com/145940 [ Linux ] plugins/iframe-shims.html [ Skip ]
# ==17332== ERROR: AddressSanitizer: heap-use-after-free on address 0x7f48e8a05a58
# WRITE of size 1 at 0x7f48e8a05a58 thread T0
# #0 0x7f48eb06f7c5 in DocumentOpenInDestroyStream::NPP_DestroyStream
crbug.com/166932 [ Linux ] ppapi/plugins/embed-attributes-setting.html [ Skip ]
crbug.com/166932 [ Linux ] plugins/embed-attributes-setting.html [ Skip ]
crbug.com/166932 [ Linux ] plugins/embed-attributes-style.html [ Skip ]

# Stack use-after-return detection
Expand Down
4 changes: 0 additions & 4 deletions third_party/blink/web_tests/FlagSpecificConfig
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@
"args": ["--force-device-scale-factor=1.5"],
"smoke_file": "TestLists/highdpi"
},
{
"name": "ppapi",
"args": ["--enable-features=PPAPI"]
},
{
"name": "skia-vulkan-swiftshader",
"args": [
Expand Down
2 changes: 1 addition & 1 deletion third_party/blink/web_tests/SlowTests
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ crbug.com/874695 [ Release ] media/video-played-collapse.html [ Slow ]
crbug.com/874695 paint/invalidation/filters/filter-repaint-accelerated-child-with-filter-child.html [ Slow ]
crbug.com/874695 paint/invalidation/filters/filter-repaint-accelerated-on-accelerated-filter.html [ Slow ]
crbug.com/874695 paint/invalidation/filters/filter-repaint-on-accelerated-layer.html [ Slow ]
crbug.com/874695 ppapi/plugins/plugin-document-back-forward.html [ Slow ]
crbug.com/874695 plugins/plugin-document-back-forward.html [ Slow ]
crbug.com/874695 pointer-lock/locked-element-iframe-removed-from-dom.html [ Slow ]
crbug.com/874695 [ Debug Linux ] printing/webgl-oversized-printing.html [ Slow ]
crbug.com/874695 [ Linux Release ] printing/webgl-oversized-printing.html [ Slow ]
Expand Down
17 changes: 8 additions & 9 deletions third_party/blink/web_tests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -3747,9 +3747,9 @@ crbug.com/930297 external/wpt/html/infrastructure/urls/resolving-urls/query-enco
crbug.com/930297 external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/utf-16le.html?include=workers [ Skip Timeout ]

crbug.com/676229 plugins/mouse-click-plugin-clears-selection.html [ Failure Pass ]
crbug.com/742670 ppapi/plugins/iframe-plugin-bgcolor.html [ Failure Pass ]
crbug.com/742670 plugins/iframe-plugin-bgcolor.html [ Failure Pass ]
crbug.com/780398 [ Mac ] plugins/mouse-capture-inside-shadow.html [ Failure Pass ]
crbug.com/1331239 [ Mac ] ppapi/plugins/plugin-remove-subframe.html [ Crash Pass ]
crbug.com/1331239 [ Mac ] plugins/plugin-remove-subframe.html [ Crash Pass ]

crbug.com/678493 http/tests/permissions/chromium/test-request-window.html [ Pass Timeout ]

Expand Down Expand Up @@ -5079,7 +5079,7 @@ crbug.com/1223601 [ Linux ] fast/scrolling/autoscroll-latch-clicked-node-if-pare
crbug.com/1223601 [ Linux ] fast/scrolling/reset-scroll-in-onscroll.html [ Failure Pass ]

# Sheriff 2021-06-29
crbug.com/1197464 [ Mac ] ppapi/plugins/refcount-leaks.html [ Failure Pass ]
crbug.com/1197464 [ Mac ] plugins/refcount-leaks.html [ Failure Pass ]

# Sheriff 2021-07-12
crbug.com/1228432 [ Linux ] external/wpt/video-rvfc/request-video-frame-callback-before-xr-session.https.html [ Pass Timeout ]
Expand Down Expand Up @@ -5344,8 +5344,7 @@ crbug.com/1271485 http/tests/inspector-protocol/network/load-network-resource-di

# Sheriff 2021-11-29
crbug.com/1274458 external/wpt/audio-output/selectAudioOutput-permissions-policy.https.sub.html [ Failure Pass ]
crbug.com/1239485 [ Mac Release ] ppapi/fast/frames/iframe-plugin-load-remove-document-crash.html [ Failure Pass ]
crbug.com/1239485 [ Mac Release ] ppapi/plugins/plugin-scroll.html [ Failure Pass ]
crbug.com/1239485 [ Mac Release ] fast/frames/iframe-plugin-load-remove-document-crash.html [ Failure Pass ]

# Sheriff 2021-12-01
crbug.com/1275658 http/tests/misc/script-after-slow-stylesheet-removed.html [ Failure Pass ]
Expand All @@ -5363,7 +5362,7 @@ crbug.com/1159463 crbug.com/1278570 [ Mac12 Release ] virtual/gpu-rasterization/
# Sheriff 2021-12-21
crbug.com/1281792 external/wpt/event-timing/min-duration-threshold.html [ Failure Pass ]

crbug.com/1285857 ppapi/plugins/plugin-destroyed-enumerate.html [ Failure Pass ]
crbug.com/1285857 plugins/plugin-destroyed-enumerate.html [ Failure Pass ]

# Sheriff 2021-12-22
crbug.com/1283295 [ Mac ] fast/text-autosizing/hackernews-comments.html [ Failure Pass ]
Expand Down Expand Up @@ -5479,7 +5478,7 @@ crbug.com/1312164 webaudio/internals/mediaelementaudiosourcenode-gc.html [ Failu
crbug.com/1312164 webaudio/internals/audiocontext-gc.html [ Failure Skip ]

# Sheriff 2022-03-21: More flaky tests.
crbug.com/1450306 [ Mac ] ppapi/plugins/plugin-document-back-forward.html [ Failure Pass ]
crbug.com/1450306 [ Mac ] plugins/plugin-document-back-forward.html [ Failure Pass ]

# Tests that need updates due to rounding math in layout
crbug.com/1309975 http/tests/devtools/console/console-viewport-indices.js [ Failure ]
Expand Down Expand Up @@ -5723,7 +5722,7 @@ crbug.com/1351571 [ Mac ] http/tests/devtools/persistence/automapping-bind-commi
crbug.com/1358333 [ Mac ] external/wpt/webmessaging/event.origin.sub.htm [ Failure Pass ]

# Sheriff 2022-08-31
crbug.com/1306304 [ Mac ] ppapi/plugins/multiple-plugins.html [ Failure Pass ]
crbug.com/1306304 [ Mac ] plugins/multiple-plugins.html [ Failure Pass ]

# Sheriff 2022-09-06
crbug.com/1358298 external/wpt/html/cross-origin-embedder-policy/require-corp.https.html [ Failure Pass ]
Expand Down Expand Up @@ -6471,7 +6470,7 @@ crbug.com/822696 virtual/webrtc-legacy-stats-trial-disabled/http/tests/inspector
crbug.com/webrtc/14889 external/wpt/webrtc/simulcast/vp9.https.html [ Skip Timeout ]

#Sheriff 2023-02-21
crbug.com/1308826 ppapi/fast/loader/reload-zero-byte-plugin.html [ Failure Pass Timeout ]
crbug.com/1308826 fast/loader/reload-zero-byte-plugin.html [ Failure Pass Timeout ]

# Sheriff 2023-03-23
crbug.com/952717 [ Win10.20h2 ] http/tests/xmlhttprequest/redirect-cross-origin-post.html [ Failure Pass ]
Expand Down
1 change: 1 addition & 0 deletions third_party/blink/web_tests/TestLists/Default.txt
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,7 @@ paint/roundedrects/degenerate-radius-assert.html
paint/selection/selection-drag-image-in-iframe.html
payments/payment-request-in-iframe-allowed.html
permissionclient/storage-permission.html
plugins/instance-available-before-stylesheets-loaded.html
pointer-lock/lock-already-locked.html
pointer-lock/mouse-event-api.html
pointer-lock/pointerlockelement-null-when-pending.html
Expand Down
1 change: 1 addition & 0 deletions third_party/blink/web_tests/TestLists/MacOld.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ http/tests/inspector-protocol/network/disabled-cache-navigation.js
http/tests/navigation/location-change-repeated-from-blank.html
inspector-protocol/layout-fonts/lang-fallback.js
media/controls/doubletap-to-toggle-fullscreen.html
plugins/refcount-leaks.html
scrollbars/custom-scrollbar-thumb-width-changed-on-inactive-pseudo.html
scrollbars/hidden-scrollbars-invisible.html
tables/mozilla_expected_failures/bugs/bug89315.html
Expand Down
2 changes: 0 additions & 2 deletions third_party/blink/web_tests/TestLists/ppapi

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<table
CELLSPACING=8888888888>
<EMBED UNITS="4" type="application/x-webkit-test-webplugin">
<EMBED UNITS="4" type="application/x-blink-test-plugin">
<script>
if (window.testRunner)
testRunner.dumpAsText();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</select>
<div id="contenteditable-div" contenteditable>I'm editable</div>
<span id="tabindex-span" tabindex="0">I'm tabindexed.</div>
<embed id="embed" type="application/x-webkit-test-webplugin" width=100 height=100></embed>
<embed id="embed" type="application/x-blink-test-plugin" width=100 height=100></embed>
<a id="anchor" href="">Link</a>
</div>
<script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<body>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<applet code=""><input><embed type="application/x-webkit-test-webplugin" width="200"></embed></applet>
<applet code=""><input><embed type="application/x-blink-test-plugin" width="200"></embed></applet>
<script>
var t = async_test('There was a bug that TextControlElement::setSelectionRange crashed. This test requires ASAN or something.');
document.body.onload = function() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!DOCTYPE html>
<html>
<body>
<script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<body>
<embed id="plugin"
type="application/x-webkit-test-webplugin"
type="application/x-blink-test-plugin"
src="data:text/plain,"
style="width:0; height:0">
</embed>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<body>
<object id="plugin"
type="application/x-webkit-test-webplugin"
type="application/x-blink-test-plugin"
style="width:0; height:0">
</object>
</body>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CONSOLE WARNING: An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
CONSOLE MESSAGE: Blink Test Plugin: initializing
CONSOLE ERROR: Failed to load '' as a plugin, because the frame into which the plugin is loading is sandboxed.
This test verifies that a sandboxed iframe CAN navigate both itself and a child in the frame tree. It also verifies that the sandbox attribute remains intact after a frame has been navigated, and that sandbox attributes are propagated through the frame hierarchy.

Expand All @@ -8,8 +9,8 @@ PASS successfullyParsed is true

TEST COMPLETE

PASS (self.sandboxedFrame.frameWithPlugin.document.getElementById('plugin').loaded) == undefined is true
PASS (self.frameWithPlugin.document.getElementById('plugin').loaded) != undefined is true
PASS (self.sandboxedFrame.frameWithPlugin.document.getElementById('plugin').postMessage) == undefined is true
PASS (self.frameWithPlugin.document.getElementById('plugin').postMessage) != undefined is true
PASS document.getElementById('sandboxedFrameId').sandbox is ['allow-scripts', 'allow-same-origin']
PASS document.getElementById('sandboxedFrameId').getAttribute('sandbox') is 'allow-scripts'
PASS successfullyParsed is true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
function childFrameWasNavigated()
{
// Check that the child frame was unable to load a plugin, since its parent is sandboxed.
shouldBeTrue("(self.sandboxedFrame.frameWithPlugin.document.getElementById('plugin').loaded) == undefined");
shouldBeTrue("(self.sandboxedFrame.frameWithPlugin.document.getElementById('plugin').postMessage) == undefined");

// Check a non-sandboxed frame as well, to ensure that the plugin is disabled by sandboxing
// and not some other failure
shouldBeTrue("(self.frameWithPlugin.document.getElementById('plugin').loaded) != undefined");
shouldBeTrue("(self.frameWithPlugin.document.getElementById('plugin').postMessage) != undefined");

// When the child frame (grandchild of the main window) has been navigated,
// make the sandboxed frame navigate itself
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ PASS successfullyParsed is true

TEST COMPLETE

PASS (self.embedFrame1.document.getElementById('plugin').loaded) != undefined is true
PASS (self.embedFrame2.document.getElementById('plugin').loaded) == undefined is true
PASS (self.objectFrame1.document.getElementById('plugin').loaded) != undefined is true
PASS (self.objectFrame2.document.getElementById('plugin').loaded) == undefined is true
PASS (self.embedFrame1.document.getElementById('plugin').postMessage) != undefined is true
PASS (self.embedFrame2.document.getElementById('plugin').postMessage) == undefined is true
PASS (self.objectFrame1.document.getElementById('plugin').postMessage) != undefined is true
PASS (self.objectFrame2.document.getElementById('plugin').postMessage) == undefined is true
PASS successfullyParsed is true

TEST COMPLETE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
}

window.onload = function() {
shouldBeTrue("(self.embedFrame1.document.getElementById('plugin').loaded) != undefined");
shouldBeTrue("(self.embedFrame2.document.getElementById('plugin').loaded) == undefined");
shouldBeTrue("(self.embedFrame1.document.getElementById('plugin').postMessage) != undefined");
shouldBeTrue("(self.embedFrame2.document.getElementById('plugin').postMessage) == undefined");

shouldBeTrue("(self.objectFrame1.document.getElementById('plugin').loaded) != undefined");
shouldBeTrue("(self.objectFrame2.document.getElementById('plugin').loaded) == undefined");
shouldBeTrue("(self.objectFrame1.document.getElementById('plugin').postMessage) != undefined");
shouldBeTrue("(self.objectFrame2.document.getElementById('plugin').postMessage) == undefined");

isSuccessfullyParsed();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div style="transform: translateZ(0); position: absolute;"></div>
<div style="opacity: 0.9">
<div style="position: absolute;">
<embed type="application/x-webkit-test-webplugin">
<embed type="application/x-blink-test-plugin">
</div>
</div>
<script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</p>
<div style="transform: translateX(100px);">
<div style="position: absolute; overflow: hidden;">
<embed type="application/x-webkit-test-webplugin">
<embed type="application/x-blink-test-plugin">
</div>
</div>
<script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!DOCTYPE html>
<iframe src="data:application/x-blink-test-plugin," id="f" onload="reload_iframe()"></iframe>
<script>
if (window.testRunner) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE MESSAGE: Blink Test Plugin: initializing
This test verifies that an <embed> tag is rendered along with other fallback content when an <object> fails to load. On success, you should see this text, followed by 'PASS'.

PASS
Expand Down
Loading

0 comments on commit 9a1d37e

Please sign in to comment.