Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1940)

Unified Diff: chrome/browser/resources_util_unittest.cc

Issue 11830002: Make ui_resources IDRs accessible via chrome://theme/<IDR>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update the ResourcesUtil.SpotCheckIds unit test. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources_util_unittest.cc
diff --git a/chrome/browser/resources_util_unittest.cc b/chrome/browser/resources_util_unittest.cc
index dc28978b66107c36050afdb65e050d17f210652b..20595d94cbe9b58e6d0cfae82ed504ba7452f658 100644
--- a/chrome/browser/resources_util_unittest.cc
+++ b/chrome/browser/resources_util_unittest.cc
@@ -5,30 +5,25 @@
#include "chrome/browser/resources_util.h"
#include "grit/theme_resources.h"
+#include "grit/ui_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace {
-
-struct TestCase {
- const char* name;
- int id;
-};
-
-} // namespace
-
TEST(ResourcesUtil, SpotCheckIds) {
- const TestCase kTestCases[] = {
+ const struct {
+ const char* name;
+ int id;
+ } cases[] = {
oshima 2013/01/08 22:36:34 shouldn't this still be kTestCases as it's still c
msw 2013/01/08 23:07:37 Done. For some reason, I thought I had seen the op
oshima 2013/01/08 23:10:27 If that's recommended style, then I'm fine. I just
+ // IDRs from chrome/app/theme/theme_resources.grd should be valid.
{"IDR_BACK", IDR_BACK},
{"IDR_STOP", IDR_STOP},
- {"IDR_OMNIBOX_STAR", IDR_OMNIBOX_STAR},
- {"IDR_SAD_TAB", IDR_SAD_TAB},
+ // IDRs from ui/resources/ui_resources.grd should be valid.
+ {"IDR_CHECKMARK", IDR_CHECKMARK},
+ {"IDR_THROBBER", IDR_THROBBER},
+ // Unknown names should be invalid and return -1.
+ {"foobar", -1},
+ {"backstar", -1},
};
- for (size_t i = 0; i < arraysize(kTestCases); ++i) {
- EXPECT_EQ(kTestCases[i].id,
- ResourcesUtil::GetThemeResourceId(kTestCases[i].name));
- }
- // Should return -1 of unknown names.
- EXPECT_EQ(-1, ResourcesUtil::GetThemeResourceId("foobar"));
- EXPECT_EQ(-1, ResourcesUtil::GetThemeResourceId("backstar"));
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i)
+ EXPECT_EQ(cases[i].id, ResourcesUtil::GetThemeResourceId(cases[i].name));
}

Powered by Google App Engine
This is Rietveld 408576698