diff options
author | benwells <benwells@chromium.org> | 2014-12-11 04:38:27 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-11 12:38:52 +0000 |
commit | d4b64a7bf6f7d450e41f5133890cdaebb30623da (patch) | |
tree | 6e63062001ca6d7a39182ca0633bac82f517f7b9 /extensions/common/image_util_unittest.cc | |
parent | 206d4d3e569857c3e8f11e4f8364225688ea8507 (diff) | |
download | chromium_src-d4b64a7bf6f7d450e41f5133890cdaebb30623da.zip chromium_src-d4b64a7bf6f7d450e41f5133890cdaebb30623da.tar.gz chromium_src-d4b64a7bf6f7d450e41f5133890cdaebb30623da.tar.bz2 |
Ensure there are always nice icons for bookmark apps.
This change does a few things. Firstly, it stops bookmark apps from
using downloaded favicons / manifest icons. Secondly, it syncs the
color it uses to generate icons. Thirdly, machines that bookmark apps
are synced onto will now generate icons using the synced color.
This means bookmark apps will always have nice icons (although not the
ones downloaded) and they will always be consistent across machines.
Once blob sync is available the downloaded icons will be kept and
synced.
BUG=439347
Review URL: https://codereview.chromium.org/782693002
Cr-Commit-Position: refs/heads/master@{#307889}
Diffstat (limited to 'extensions/common/image_util_unittest.cc')
-rw-r--r-- | extensions/common/image_util_unittest.cc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/extensions/common/image_util_unittest.cc b/extensions/common/image_util_unittest.cc new file mode 100644 index 0000000..ca13ab2 --- /dev/null +++ b/extensions/common/image_util_unittest.cc @@ -0,0 +1,52 @@ +// Copyright 2014 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 <string> + +#include "extensions/common/image_util.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/skia/include/core/SkColor.h" + +namespace extensions { + +void RunPassTest(const std::string& css_string, SkColor expected_result) { + SkColor color = 0; + EXPECT_TRUE(image_util::ParseCSSColorString(css_string, &color)); + EXPECT_EQ(color, expected_result); +} + +void RunFailTest(const std::string& css_string) { + SkColor color = 0; + EXPECT_FALSE(image_util::ParseCSSColorString(css_string, &color)); +} + +TEST(ImageUtilTest, ChangeBadgeBackgroundNormalCSS) { + RunPassTest("#34006A", SkColorSetARGB(0xFF, 0x34, 0, 0x6A)); +} + +TEST(ImageUtilTest, ChangeBadgeBackgroundShortCSS) { + RunPassTest("#A1E", SkColorSetARGB(0xFF, 0xAA, 0x11, 0xEE)); +} + +TEST(ImageUtilTest, ChangeBadgeBackgroundCSSNoHash) { + RunFailTest("11FF22"); +} + +TEST(ImageUtilTest, ChangeBadgeBackgroundCSSTooShort) { + RunFailTest("#FF22"); +} + +TEST(ImageUtilTest, ChangeBadgeBackgroundCSSTooLong) { + RunFailTest("#FF22128"); +} + +TEST(ImageUtilTest, ChangeBadgeBackgroundCSSInvalid) { + RunFailTest("#-22128"); +} + +TEST(ImageUtilTest, ChangeBadgeBackgroundCSSInvalidWithPlus) { + RunFailTest("#+22128"); +} + +} // namespace extensions |