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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp

Issue 1309393007: [poc] redecode Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: resetColorProfileForTesting rename Created 5 years 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 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 28 matching lines...) Expand all
39 #include "testing/gtest/include/gtest/gtest.h" 39 #include "testing/gtest/include/gtest/gtest.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 class BitmapImageTest : public ::testing::Test { 43 class BitmapImageTest : public ::testing::Test {
44 public: 44 public:
45 class FakeImageObserver : public ImageObserver { 45 class FakeImageObserver : public ImageObserver {
46 public: 46 public:
47 FakeImageObserver() : m_lastDecodedSizeChangedDelta(0) { } 47 FakeImageObserver() : m_lastDecodedSizeChangedDelta(0) { }
48 48
49 virtual void decodedSizeChanged(const Image*, int delta) 49 virtual void decodedSizeChanged(const Image*, int delta) { m_lastDecoded SizeChangedDelta = delta; }
50 { 50 void deviceProfileChanged(const Image*, ColorSpaceProfile*) override { }
51 m_lastDecodedSizeChangedDelta = delta;
52 }
53 void didDraw(const Image*) override { } 51 void didDraw(const Image*) override { }
54 bool shouldPauseAnimation(const Image*) override { return false; } 52 bool shouldPauseAnimation(const Image*) override { return false; }
55 void animationAdvanced(const Image*) override { } 53 void animationAdvanced(const Image*) override { }
56
57 virtual void changedInRect(const Image*, const IntRect&) { } 54 virtual void changedInRect(const Image*, const IntRect&) { }
58 55
59 int m_lastDecodedSizeChangedDelta; 56 int m_lastDecodedSizeChangedDelta;
60 }; 57 };
61 58
62 BitmapImageTest() : BitmapImageTest(false) { } 59 BitmapImageTest() : BitmapImageTest(false) { }
63 BitmapImageTest(bool enableDeferredDecoding) : m_enableDeferredDecoding(enab leDeferredDecoding) { } 60 BitmapImageTest(bool enableDeferredDecoding) : m_enableDeferredDecoding(enab leDeferredDecoding) { }
64 61
65 static PassRefPtr<SharedBuffer> readFile(const char* fileName) 62 static PassRefPtr<SharedBuffer> readFile(const char* fileName)
66 { 63 {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 frameAtIndex(0); 260 frameAtIndex(0);
264 261
265 // Trying to destroy all data except an undecoded frame should go ahead and 262 // Trying to destroy all data except an undecoded frame should go ahead and
266 // destroy all other frames. 263 // destroy all other frames.
267 setCurrentFrame(2); 264 setCurrentFrame(2);
268 destroyDecodedData(false); 265 destroyDecodedData(false);
269 EXPECT_EQ(-frameSize * 2, m_imageObserver.m_lastDecodedSizeChangedDelta); 266 EXPECT_EQ(-frameSize * 2, m_imageObserver.m_lastDecodedSizeChangedDelta);
270 } 267 }
271 268
272 } // namespace blink 269 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698