summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources_util_unittest.cc
blob: dc28978b66107c36050afdb65e050d17f210652b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/resources_util.h"

#include "grit/theme_resources.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

struct TestCase {
  const char* name;
  int id;
};

}  // namespace

TEST(ResourcesUtil, SpotCheckIds) {
  const TestCase kTestCases[] = {
    {"IDR_BACK", IDR_BACK},
    {"IDR_STOP", IDR_STOP},
    {"IDR_OMNIBOX_STAR", IDR_OMNIBOX_STAR},
    {"IDR_SAD_TAB", IDR_SAD_TAB},
  };
  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"));
}