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

Side by Side Diff: Source/core/page/PrintContextTest.cpp

Issue 1175563004: [SP] Save and restore slimming paint enabled state in SP-specific unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | Source/core/paint/DisplayItemListPaintTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "core/page/PrintContext.h" 6 #include "core/page/PrintContext.h"
7 7
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/frame/FrameHost.h" 9 #include "core/frame/FrameHost.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 ASSERT_EQ(2u, operations.size()); 183 ASSERT_EQ(2u, operations.size());
184 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); 184 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type);
185 EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect); 185 EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect);
186 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); 186 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type);
187 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); 187 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect);
188 // We should also check if the annotation is correct but Skia doesn't export 188 // We should also check if the annotation is correct but Skia doesn't export
189 // SkAnnotation API. 189 // SkAnnotation API.
190 } 190 }
191 191
192 class PrintContextTestWithSlimmingPaint : public PrintContextTest { 192 class PrintContextTestWithSlimmingPaint : public PrintContextTest {
193 public:
194 PrintContextTestWithSlimmingPaint()
195 : m_originalSlimmingPaintEnabled(RuntimeEnabledFeatures::slimmingPaintEn abled()) { }
196
193 protected: 197 protected:
194 virtual void SetUp() override 198 virtual void SetUp() override
195 { 199 {
196 PrintContextTest::SetUp(); 200 PrintContextTest::SetUp();
197 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true); 201 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true);
198 } 202 }
199 virtual void TearDown() override 203 virtual void TearDown() override
200 { 204 {
201 RuntimeEnabledFeatures::setSlimmingPaintEnabled(false); 205 RuntimeEnabledFeatures::setSlimmingPaintEnabled(m_originalSlimmingPaintE nabled);
202 PrintContextTest::TearDown(); 206 PrintContextTest::TearDown();
203 } 207 }
208
209 private:
210 bool m_originalSlimmingPaintEnabled;
204 }; 211 };
205 212
206 TEST_F(PrintContextTest, LinkTarget) 213 TEST_F(PrintContextTest, LinkTarget)
207 { 214 {
208 testBasicLinkTarget(); 215 testBasicLinkTarget();
209 } 216 }
210 217
211 TEST_F(PrintContextTestWithSlimmingPaint, LinkTargetBasic) 218 TEST_F(PrintContextTestWithSlimmingPaint, LinkTargetBasic)
212 { 219 {
213 testBasicLinkTarget(); 220 testBasicLinkTarget();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); 376 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect);
370 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); 377 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type);
371 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); 378 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect);
372 379
373 subframe->detach(); 380 subframe->detach();
374 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(nullptr); 381 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(nullptr);
375 document().frame()->host()->decrementSubframeCount(); 382 document().frame()->host()->decrementSubframeCount();
376 } 383 }
377 384
378 } // namespace blink 385 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/paint/DisplayItemListPaintTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698