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

Unified Diff: third_party/WebKit/LayoutTests/virtual/threaded/fast/compositorworker/basic-plumbing-main-to-worker.html

Issue 2041193005: [compositorworker] compositor proxy mutation updates underlying layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compositor-worker-upstream-registration
Patch Set: Use RAII pattern Created 4 years, 6 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/LayoutTests/virtual/threaded/fast/compositorworker/basic-plumbing-main-to-worker.html
diff --git a/third_party/WebKit/LayoutTests/virtual/threaded/fast/compositorworker/basic-plumbing-main-to-worker.html b/third_party/WebKit/LayoutTests/virtual/threaded/fast/compositorworker/basic-plumbing-main-to-worker.html
new file mode 100644
index 0000000000000000000000000000000000000000..adf005ae59ee43e350317be0c4c87d4b97ce77c3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/threaded/fast/compositorworker/basic-plumbing-main-to-worker.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+
+<style>
+#box {
+ width: 100px;
+ height: 100px;
+ overflow: scroll;
+}
+
+#scrolled {
+ background: white;
+ width: 300px;
+ height: 300px;
+}
+</style>
+
+<div id="box">
+ <div id="scrolled"></div>
+</div>
+
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script>
+if (window.internals)
+ internals.settings.setCompositorWorkerEnabled(true);
+
+var test = async_test('Tests that a change from the main thread is received on the compositor thread');
+var worker;
+
+test.step(function(){
+ worker = new CompositorWorker('resources/basic-plumbing-main-to-worker.js');
+ worker.onmessage = test.step_func(function(e){
+ assert_equals(e.data.opacity, 1);
+ assert_equals(e.data.scrollLeft, 0);
+ assert_equals(e.data.scrollTop, 0);
+ assert_equals(JSON.stringify(e.data.transform), '{"0":1,"1":0,"2":0,"3":0,"4":0,"5":1,"6":0,"7":0,"8":0,"9":0,"10":1,"11":0,"12":0,"13":0,"14":0,"15":1}');
+
+ updateElementAndVerify();
+ });
+
+ var keys = ['opacity', 'transform', 'scrollTop', 'scrollLeft'];
+ worker.postMessage({'proxy': new CompositorProxy(document.getElementById('box'), keys)});
+});
+
+function updateElementAndVerify(e) {
+ var element = document.getElementById('box');
+ element.scrollLeft = 10;
+ element.scrollTop = 20;
+ element.style.transform = 'translate3d(30px, 0, 0)';
+ element.style.opacity = 0.5;
+
+ worker.onmessage = test.step_func(function(e){
+ assert_equals(e.data.opacity, 0.5);
+ assert_equals(e.data.scrollLeft, 10);
+ assert_equals(e.data.scrollTop, 20);
+ assert_equals(JSON.stringify(e.data.transform), '{"0":1,"1":0,"2":0,"3":0,"4":0,"5":1,"6":0,"7":0,"8":0,"9":0,"10":1,"11":0,"12":30,"13":0,"14":0,"15":1}');
+
+ test.done();
+ });
+
+ // Delay posting to the compositor until we have had another frame (i.e. commit).
+ requestAnimationFrame(function() {
+ worker.postMessage({});
+ });
+}
+</script>

Powered by Google App Engine
This is Rietveld 408576698