| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/extensions/api/extension_action/extension_actions_api.h
" | 8 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| 9 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 namespace extensions { |
| 14 |
| 13 void RunPassTest(const std::string& css_string, SkColor expected_result) { | 15 void RunPassTest(const std::string& css_string, SkColor expected_result) { |
| 14 SkColor color = 0; | 16 SkColor color = 0; |
| 15 EXPECT_TRUE( | 17 EXPECT_TRUE( |
| 16 ExtensionActionFunction::ParseCSSColorString(css_string, &color)); | 18 ExtensionActionFunction::ParseCSSColorString(css_string, &color)); |
| 17 EXPECT_EQ(color, expected_result); | 19 EXPECT_EQ(color, expected_result); |
| 18 } | 20 } |
| 19 | 21 |
| 20 void RunFailTest(const std::string& css_string) { | 22 void RunFailTest(const std::string& css_string) { |
| 21 SkColor color = 0; | 23 SkColor color = 0; |
| 22 EXPECT_FALSE( | 24 EXPECT_FALSE( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 39 RunFailTest("#FF22"); | 41 RunFailTest("#FF22"); |
| 40 } | 42 } |
| 41 | 43 |
| 42 TEST(ExtensionBrowserActionsApiTest, ChangeBadgeBackgroundCSSTooLong) { | 44 TEST(ExtensionBrowserActionsApiTest, ChangeBadgeBackgroundCSSTooLong) { |
| 43 RunFailTest("#FF22128"); | 45 RunFailTest("#FF22128"); |
| 44 } | 46 } |
| 45 | 47 |
| 46 TEST(ExtensionBrowserActionsApiTest, ChangeBadgeBackgroundCSSInvalid) { | 48 TEST(ExtensionBrowserActionsApiTest, ChangeBadgeBackgroundCSSInvalid) { |
| 47 RunFailTest("#-22128"); | 49 RunFailTest("#-22128"); |
| 48 } | 50 } |
| 51 |
| 52 } // namespace extensions |
| OLD | NEW |