OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "sky/engine/platform/SharedBuffer.h" | 31 #include "sky/engine/platform/SharedBuffer.h" |
32 #include "sky/engine/platform/graphics/ImageFrameGenerator.h" | 32 #include "sky/engine/platform/graphics/ImageFrameGenerator.h" |
33 #include "sky/engine/platform/graphics/test/MockImageDecoder.h" | 33 #include "sky/engine/platform/graphics/test/MockImageDecoder.h" |
34 | 34 |
35 using namespace blink; | 35 using namespace blink; |
36 | 36 |
37 namespace { | 37 namespace { |
38 | 38 |
39 class ImageDecodingStoreTest : public ::testing::Test, public MockImageDecoderCl
ient { | 39 class ImageDecodingStoreTest : public ::testing::Test, public MockImageDecoderCl
ient { |
40 public: | 40 public: |
41 virtual void SetUp() | 41 void SetUp() override |
42 { | 42 { |
43 ImageDecodingStore::instance()->setCacheLimitInBytes(1024 * 1024); | 43 ImageDecodingStore::instance()->setCacheLimitInBytes(1024 * 1024); |
44 m_data = SharedBuffer::create(); | 44 m_data = SharedBuffer::create(); |
45 m_generator = ImageFrameGenerator::create(SkISize::Make(100, 100), m_dat
a, true); | 45 m_generator = ImageFrameGenerator::create(SkISize::Make(100, 100), m_dat
a, true); |
46 m_decodersDestroyed = 0; | 46 m_decodersDestroyed = 0; |
47 } | 47 } |
48 | 48 |
49 virtual void TearDown() | 49 void TearDown() override |
50 { | 50 { |
51 ImageDecodingStore::instance()->clear(); | 51 ImageDecodingStore::instance()->clear(); |
52 } | 52 } |
53 | 53 |
54 virtual void decoderBeingDestroyed() | 54 void decoderBeingDestroyed() override |
55 { | 55 { |
56 ++m_decodersDestroyed; | 56 ++m_decodersDestroyed; |
57 } | 57 } |
58 | 58 |
59 virtual void frameBufferRequested() | 59 void frameBufferRequested() override |
60 { | 60 { |
61 // Decoder is never used by ImageDecodingStore. | 61 // Decoder is never used by ImageDecodingStore. |
62 ASSERT_TRUE(false); | 62 ASSERT_TRUE(false); |
63 } | 63 } |
64 | 64 |
65 virtual ImageFrame::Status status() | 65 virtual ImageFrame::Status status() |
66 { | 66 { |
67 return ImageFrame::FramePartial; | 67 return ImageFrame::FramePartial; |
68 } | 68 } |
69 | 69 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 EXPECT_TRUE(ImageDecodingStore::instance()->lockDecoder(m_generator.get(), s
ize, &testDecoder)); | 173 EXPECT_TRUE(ImageDecodingStore::instance()->lockDecoder(m_generator.get(), s
ize, &testDecoder)); |
174 EXPECT_TRUE(testDecoder); | 174 EXPECT_TRUE(testDecoder); |
175 EXPECT_EQ(refDecoder, testDecoder); | 175 EXPECT_EQ(refDecoder, testDecoder); |
176 ImageDecodingStore::instance()->removeDecoder(m_generator.get(), testDecoder
); | 176 ImageDecodingStore::instance()->removeDecoder(m_generator.get(), testDecoder
); |
177 EXPECT_FALSE(ImageDecodingStore::instance()->cacheEntries()); | 177 EXPECT_FALSE(ImageDecodingStore::instance()->cacheEntries()); |
178 | 178 |
179 EXPECT_FALSE(ImageDecodingStore::instance()->lockDecoder(m_generator.get(),
size, &testDecoder)); | 179 EXPECT_FALSE(ImageDecodingStore::instance()->lockDecoder(m_generator.get(),
size, &testDecoder)); |
180 } | 180 } |
181 | 181 |
182 } // namespace | 182 } // namespace |
OLD | NEW |