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