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

Side by Side Diff: third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/FrameView.h" 5 #include "core/frame/FrameView.h"
6 #include "core/layout/api/LayoutViewItem.h" 6 #include "core/layout/api/LayoutViewItem.h"
7 #include "core/layout/compositing/CompositedLayerMapping.h" 7 #include "core/layout/compositing/CompositedLayerMapping.h"
8 #include "core/layout/compositing/PaintLayerCompositor.h" 8 #include "core/layout/compositing/PaintLayerCompositor.h"
9 #include "core/page/Page.h" 9 #include "core/page/Page.h"
10 #include "platform/graphics/CompositorMutableProperties.h" 10 #include "platform/graphics/CompositorMutableProperties.h"
11 #include "platform/graphics/CompositorMutation.h" 11 #include "platform/graphics/CompositorMutation.h"
12 #include "platform/graphics/GraphicsLayer.h" 12 #include "platform/graphics/GraphicsLayer.h"
13 #include "platform/testing/URLTestHelpers.h" 13 #include "platform/testing/URLTestHelpers.h"
14 #include "public/platform/Platform.h" 14 #include "public/platform/Platform.h"
15 #include "public/platform/WebLayer.h" 15 #include "public/platform/WebLayer.h"
16 #include "public/platform/WebLayerTreeView.h" 16 #include "public/platform/WebLayerTreeView.h"
17 #include "public/platform/WebURLLoaderMockFactory.h" 17 #include "public/platform/WebURLLoaderMockFactory.h"
18 #include "public/web/WebCache.h" 18 #include "public/web/WebCache.h"
19 #include "public/web/WebSettings.h" 19 #include "public/web/WebSettings.h"
20 #include "public/web/WebViewClient.h" 20 #include "public/web/WebViewClient.h"
21 #include "web/WebLocalFrameImpl.h" 21 #include "web/WebLocalFrameImpl.h"
22 #include "web/WebViewImpl.h" 22 #include "web/WebViewImpl.h"
23 #include "web/tests/FrameTestHelpers.h" 23 #include "web/tests/FrameTestHelpers.h"
24 #include "wtf/PtrUtil.h"
25 #include <gtest/gtest.h> 24 #include <gtest/gtest.h>
26 #include <memory>
27 25
28 namespace blink { 26 namespace blink {
29 27
30 class CompositorWorkerTest : public testing::Test { 28 class CompositorWorkerTest : public testing::Test {
31 public: 29 public:
32 CompositorWorkerTest() 30 CompositorWorkerTest()
33 : m_baseURL("http://www.test.com/") 31 : m_baseURL("http://www.test.com/")
34 { 32 {
35 RuntimeEnabledFeatures::setCompositorWorkerEnabled(true); 33 RuntimeEnabledFeatures::setCompositorWorkerEnabled(true);
36 m_helper.initialize(true, nullptr, &m_mockWebViewClient, nullptr, &confi gureSettings); 34 m_helper.initialize(true, nullptr, &m_mockWebViewClient, nullptr, &confi gureSettings);
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 270
273 Element* proxiedElement = document->getElementById("proxied-transform-and-op acity"); 271 Element* proxiedElement = document->getElementById("proxied-transform-and-op acity");
274 WebLayer* proxiedLayer = webLayerFromElement(proxiedElement); 272 WebLayer* proxiedLayer = webLayerFromElement(proxiedElement);
275 EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMutableP roperty::kTransform); 273 EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMutableP roperty::kTransform);
276 EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMutableP roperty::kOpacity); 274 EXPECT_TRUE(proxiedLayer->compositorMutableProperties() & CompositorMutableP roperty::kOpacity);
277 EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMutabl eProperty::kScrollLeft | CompositorMutableProperty::kScrollTop)); 275 EXPECT_FALSE(proxiedLayer->compositorMutableProperties() & (CompositorMutabl eProperty::kScrollLeft | CompositorMutableProperty::kScrollTop));
278 uint64_t elementId = proxiedLayer->elementId(); 276 uint64_t elementId = proxiedLayer->elementId();
279 EXPECT_NE(0UL, elementId); 277 EXPECT_NE(0UL, elementId);
280 278
281 TransformationMatrix transformMatrix(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44); 279 TransformationMatrix transformMatrix(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44);
282 std::unique_ptr<CompositorMutation> mutation = wrapUnique(new CompositorMuta tion); 280 OwnPtr<CompositorMutation> mutation = adoptPtr(new CompositorMutation);
283 mutation->setTransform(TransformationMatrix::toSkMatrix44(transformMatrix)); 281 mutation->setTransform(TransformationMatrix::toSkMatrix44(transformMatrix));
284 mutation->setOpacity(0.5); 282 mutation->setOpacity(0.5);
285 283
286 proxiedElement->updateFromCompositorMutation(*mutation); 284 proxiedElement->updateFromCompositorMutation(*mutation);
287 { 285 {
288 const String& transformValue = document->domWindow()->getComputedStyle( proxiedElement, String())->getPropertyValueInternal(CSSPropertyTransform); 286 const String& transformValue = document->domWindow()->getComputedStyle( proxiedElement, String())->getPropertyValueInternal(CSSPropertyTransform);
289 EXPECT_EQ("matrix3d(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44)", transformValue); 287 EXPECT_EQ("matrix3d(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44)", transformValue);
290 288
291 const String& opacityValue = document->domWindow()->getComputedStyle(pro xiedElement, String())->getPropertyValueInternal(CSSPropertyOpacity); 289 const String& opacityValue = document->domWindow()->getComputedStyle(pro xiedElement, String())->getPropertyValueInternal(CSSPropertyOpacity);
292 EXPECT_EQ("0.5", opacityValue); 290 EXPECT_EQ("0.5", opacityValue);
293 } 291 }
294 292
295 // Verify that updating one property does not impact others 293 // Verify that updating one property does not impact others
296 mutation = wrapUnique(new CompositorMutation); 294 mutation = adoptPtr(new CompositorMutation);
297 mutation->setOpacity(0.8); 295 mutation->setOpacity(0.8);
298 296
299 proxiedElement->updateFromCompositorMutation(*mutation); 297 proxiedElement->updateFromCompositorMutation(*mutation);
300 { 298 {
301 const String& transformValue = document->domWindow()->getComputedStyle( proxiedElement, String())->getPropertyValueInternal(CSSPropertyTransform); 299 const String& transformValue = document->domWindow()->getComputedStyle( proxiedElement, String())->getPropertyValueInternal(CSSPropertyTransform);
302 EXPECT_EQ("matrix3d(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44)", transformValue); 300 EXPECT_EQ("matrix3d(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44)", transformValue);
303 301
304 const String& opacityValue = document->domWindow()->getComputedStyle(pro xiedElement, String())->getPropertyValueInternal(CSSPropertyOpacity); 302 const String& opacityValue = document->domWindow()->getComputedStyle(pro xiedElement, String())->getPropertyValueInternal(CSSPropertyOpacity);
305 EXPECT_EQ("0.8", opacityValue); 303 EXPECT_EQ("0.8", opacityValue);
306 } 304 }
307 } 305 }
308 306
309 } // namespace blink 307 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp ('k') | third_party/WebKit/Source/web/tests/FrameTestHelpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698