diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-13 02:01:03 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-13 02:01:03 +0000 |
commit | 0b9c840bb55c2c9914ccb44b66274b38c74872a1 (patch) | |
tree | f464f1283529b4644df4a22e22c14c1032979fc6 /content/renderer | |
parent | 0a29063eef78157e35da84f60c7c12043f40f29d (diff) | |
download | chromium_src-0b9c840bb55c2c9914ccb44b66274b38c74872a1.zip chromium_src-0b9c840bb55c2c9914ccb44b66274b38c74872a1.tar.gz chromium_src-0b9c840bb55c2c9914ccb44b66274b38c74872a1.tar.bz2 |
Move image decoder unit tests to content_unittests
We're deleting the concept of a webcore_unit_test from Chromium. I would prefer
to move these tests into the WebKit repository, but they depend on test data in
src-internal. Instead, this CL moves them into content_unittests.
BUG=184276
Review URL: https://chromiumcodereview.appspot.com/12725006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187745 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r-- | content/renderer/bmp_image_decoder_unittest.cc | 30 | ||||
-rw-r--r-- | content/renderer/ico_image_decoder_unittest.cc | 36 |
2 files changed, 66 insertions, 0 deletions
diff --git a/content/renderer/bmp_image_decoder_unittest.cc b/content/renderer/bmp_image_decoder_unittest.cc new file mode 100644 index 0000000..7171e7f --- /dev/null +++ b/content/renderer/bmp_image_decoder_unittest.cc @@ -0,0 +1,30 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/test/image_decoder_test.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebImageDecoder.h" + +class BMPImageDecoderTest : public ImageDecoderTest { + public: + BMPImageDecoderTest() : ImageDecoderTest("bmp") { } + + protected: + virtual WebKit::WebImageDecoder* CreateWebKitImageDecoder() const OVERRIDE { + return new WebKit::WebImageDecoder(WebKit::WebImageDecoder::TypeBMP); + } + + // The BMPImageDecoderTest tests are really slow under Valgrind. + // Thus it is split into fast and slow versions. The threshold is + // set to 10KB because the fast test can finish under Valgrind in + // less than 30 seconds. + static const int64 kThresholdSize = 10240; +}; + +TEST_F(BMPImageDecoderTest, DecodingFast) { + TestDecoding(TEST_SMALLER, kThresholdSize); +} + +TEST_F(BMPImageDecoderTest, DecodingSlow) { + TestDecoding(TEST_BIGGER, kThresholdSize); +} diff --git a/content/renderer/ico_image_decoder_unittest.cc b/content/renderer/ico_image_decoder_unittest.cc new file mode 100644 index 0000000..3b02874 --- /dev/null +++ b/content/renderer/ico_image_decoder_unittest.cc @@ -0,0 +1,36 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/file_util.h" +#include "base/files/file_path.h" +#include "content/test/image_decoder_test.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebImageDecoder.h" + +using WebKit::WebImageDecoder; + +class ICOImageDecoderTest : public ImageDecoderTest { + public: + ICOImageDecoderTest() : ImageDecoderTest("ico") { } + + protected: + virtual WebKit::WebImageDecoder* CreateWebKitImageDecoder() const OVERRIDE { + return new WebKit::WebImageDecoder(WebKit::WebImageDecoder::TypeICO); + } +}; + +TEST_F(ICOImageDecoderTest, Decoding) { + TestDecoding(); +} + +TEST_F(ICOImageDecoderTest, ImageNonZeroFrameIndex) { + if (data_dir_.empty()) + return; + // Test that the decoder decodes multiple sizes of icons which have them. + // Load an icon that has both favicon-size and larger entries. + base::FilePath multisize_icon_path(data_dir_.AppendASCII("yahoo.ico")); + const base::FilePath md5_sum_path( + GetMD5SumPath(multisize_icon_path).value() + FILE_PATH_LITERAL("2")); + static const int kDesiredFrameIndex = 3; + TestWebKitImageDecoder(multisize_icon_path, md5_sum_path, kDesiredFrameIndex); +} |