| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/theme_resources_util.h" | 5 #include "chrome/browser/theme_resources_util.h" |
| 6 | 6 |
| 7 #include "grit/theme_resources.h" | 7 #include "grit/theme_resources.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| 11 | 11 |
| 12 struct TestCase { | 12 struct TestCase { |
| 13 const char* name; | 13 const char* name; |
| 14 int id; | 14 int id; |
| 15 }; | 15 }; |
| 16 | 16 |
| 17 } // namespace | 17 } // namespace |
| 18 | 18 |
| 19 TEST(ThemeResourcesUtil, SpotCheckIds) { | 19 TEST(ThemeResourcesUtil, SpotCheckIds) { |
| 20 const TestCase kTestCases[] = { | 20 const TestCase kTestCases[] = { |
| 21 {"back", IDR_BACK}, | 21 {"back", IDR_BACK}, |
| 22 {"go", IDR_GO}, | 22 {"go", IDR_GO}, |
| 23 {"star", IDR_STAR}, | 23 {"omnibox_star", IDR_OMNIBOX_STAR}, |
| 24 {"sad_tab", IDR_SAD_TAB}, | 24 {"sad_tab", IDR_SAD_TAB}, |
| 25 }; | 25 }; |
| 26 for (size_t i = 0; i < arraysize(kTestCases); ++i) { | 26 for (size_t i = 0; i < arraysize(kTestCases); ++i) { |
| 27 EXPECT_EQ(kTestCases[i].id, ThemeResourcesUtil::GetId(kTestCases[i].name)); | 27 EXPECT_EQ(kTestCases[i].id, ThemeResourcesUtil::GetId(kTestCases[i].name)); |
| 28 } | 28 } |
| 29 | 29 |
| 30 // Should return -1 of unknown names. | 30 // Should return -1 of unknown names. |
| 31 EXPECT_EQ(-1, ThemeResourcesUtil::GetId("foobar")); | 31 EXPECT_EQ(-1, ThemeResourcesUtil::GetId("foobar")); |
| 32 EXPECT_EQ(-1, ThemeResourcesUtil::GetId("backstar")); | 32 EXPECT_EQ(-1, ThemeResourcesUtil::GetId("backstar")); |
| 33 } | 33 } |
| OLD | NEW |