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