OLD | NEW |
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 "web/WebViewImpl.h" | 5 #include "web/WebViewImpl.h" |
6 | 6 |
7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
8 #include "platform/graphics/compositing/PaintArtifactCompositor.h" | 8 #include "platform/graphics/compositing/PaintArtifactCompositor.h" |
9 #include "public/platform/WebLayerTreeView.h" | 9 #include "public/platform/WebLayerTreeView.h" |
10 #include "public/web/WebViewClient.h" | 10 #include "public/web/WebViewClient.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 m_helper.initialize(false, nullptr, &m_webViewClient); | 50 m_helper.initialize(false, nullptr, &m_webViewClient); |
51 } | 51 } |
52 | 52 |
53 void TearDown() override | 53 void TearDown() override |
54 { | 54 { |
55 m_featuresBackup.restore(); | 55 m_featuresBackup.restore(); |
56 } | 56 } |
57 | 57 |
58 MockWebLayerTreeView& webLayerTreeView() { return m_webLayerTreeView; } | 58 MockWebLayerTreeView& webLayerTreeView() { return m_webLayerTreeView; } |
59 WebViewImpl& webViewImpl() { return *m_helper.webViewImpl(); } | 59 WebViewImpl& webViewImpl() { return *m_helper.webViewImpl(); } |
60 PaintArtifactCompositor& paintArtifactCompositor() { return webViewImpl().pa
intArtifactCompositor(); } | 60 PaintArtifactCompositor& getPaintArtifactCompositor() { return webViewImpl()
.getPaintArtifactCompositor(); } |
61 | 61 |
62 private: | 62 private: |
63 RuntimeEnabledFeatures::Backup m_featuresBackup; | 63 RuntimeEnabledFeatures::Backup m_featuresBackup; |
64 MockWebLayerTreeView m_webLayerTreeView; | 64 MockWebLayerTreeView m_webLayerTreeView; |
65 TestWebViewClientWithLayerTreeView m_webViewClient; | 65 TestWebViewClientWithLayerTreeView m_webViewClient; |
66 FrameTestHelpers::WebViewHelper m_helper; | 66 FrameTestHelpers::WebViewHelper m_helper; |
67 }; | 67 }; |
68 | 68 |
69 TEST_F(WebViewImplPaintArtifactCompositorTest, AttachAndDetach) | 69 TEST_F(WebViewImplPaintArtifactCompositorTest, AttachAndDetach) |
70 { | 70 { |
71 cc::Layer* rootLayer = paintArtifactCompositor().rootLayer(); | 71 cc::Layer* rootLayer = getPaintArtifactCompositor().rootLayer(); |
72 ASSERT_TRUE(rootLayer); | 72 ASSERT_TRUE(rootLayer); |
73 | 73 |
74 EXPECT_CALL(webLayerTreeView(), setRootLayer(Property(&WebLayer::ccLayer, ro
otLayer))); | 74 EXPECT_CALL(webLayerTreeView(), setRootLayer(Property(&WebLayer::ccLayer, ro
otLayer))); |
75 webViewImpl().attachPaintArtifactCompositor(); | 75 webViewImpl().attachPaintArtifactCompositor(); |
76 testing::Mock::VerifyAndClearExpectations(&webLayerTreeView()); | 76 testing::Mock::VerifyAndClearExpectations(&webLayerTreeView()); |
77 | 77 |
78 EXPECT_CALL(webLayerTreeView(), clearRootLayer()); | 78 EXPECT_CALL(webLayerTreeView(), clearRootLayer()); |
79 webViewImpl().detachPaintArtifactCompositor(); | 79 webViewImpl().detachPaintArtifactCompositor(); |
80 testing::Mock::VerifyAndClearExpectations(&webLayerTreeView()); | 80 testing::Mock::VerifyAndClearExpectations(&webLayerTreeView()); |
81 } | 81 } |
82 | 82 |
83 } // namespace | 83 } // namespace |
84 } // namespace blink | 84 } // namespace blink |
OLD | NEW |