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 "chrome/browser/resources_util.h" | 5 #include "chrome/browser/resources_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/grit/theme_resources.h" | 11 #include "chrome/grit/theme_resources.h" |
12 #include "components/grit/components_scaled_resources.h" | 12 #include "components/grit/components_scaled_resources.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "ui/resources/grit/ui_resources.h" | 14 #include "ui/resources/grit/ui_resources.h" |
15 | 15 |
16 #if defined(OS_CHROMEOS) | 16 #if defined(OS_CHROMEOS) |
17 #include "grit/ui_chromeos_resources.h" | 17 #include "ui/chromeos/resources/grit/ui_chromeos_resources.h" |
18 #endif | 18 #endif |
19 | 19 |
20 TEST(ResourcesUtil, SpotCheckIds) { | 20 TEST(ResourcesUtil, SpotCheckIds) { |
21 const struct { | 21 const struct { |
22 const char* name; | 22 const char* name; |
23 int id; | 23 int id; |
24 } kCases[] = { | 24 } kCases[] = { |
25 // IDRs from chrome/app/theme/theme_resources.grd should be valid. | 25 // IDRs from chrome/app/theme/theme_resources.grd should be valid. |
26 {"IDR_ERROR_NETWORK_GENERIC", IDR_ERROR_NETWORK_GENERIC}, | 26 {"IDR_ERROR_NETWORK_GENERIC", IDR_ERROR_NETWORK_GENERIC}, |
27 {"IDR_PAGEINFO_BAD", IDR_PAGEINFO_BAD}, | 27 {"IDR_PAGEINFO_BAD", IDR_PAGEINFO_BAD}, |
28 // IDRs from ui/resources/ui_resources.grd should be valid. | 28 // IDRs from ui/resources/ui_resources.grd should be valid. |
29 {"IDR_FOLDER_CLOSED", IDR_FOLDER_CLOSED}, | 29 {"IDR_FOLDER_CLOSED", IDR_FOLDER_CLOSED}, |
30 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
31 // Check IDRs from ui/chromeos/resources/ui_chromeos_resources.grd. | 31 // Check IDRs from ui/chromeos/resources/ui_chromeos_resources.grd. |
32 {"IDR_LOGIN_DEFAULT_USER", IDR_LOGIN_DEFAULT_USER}, | 32 {"IDR_LOGIN_DEFAULT_USER", IDR_LOGIN_DEFAULT_USER}, |
33 #endif | 33 #endif |
34 // Unknown names should be invalid and return -1. | 34 // Unknown names should be invalid and return -1. |
35 {"foobar", -1}, | 35 {"foobar", -1}, |
36 {"backstar", -1}, | 36 {"backstar", -1}, |
37 }; | 37 }; |
38 | 38 |
39 for (size_t i = 0; i < arraysize(kCases); ++i) | 39 for (size_t i = 0; i < arraysize(kCases); ++i) |
40 EXPECT_EQ(kCases[i].id, ResourcesUtil::GetThemeResourceId(kCases[i].name)); | 40 EXPECT_EQ(kCases[i].id, ResourcesUtil::GetThemeResourceId(kCases[i].name)); |
41 } | 41 } |
OLD | NEW |