blob: 763d507730eb238045f4e52e02a1fa64adeb5dc3 [file] [log] [blame]
// Copyright 2018 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/chrome_cleaner/os/resource_util.h"
#include <windows.h>
#include <stdint.h>
#include "chrome/chrome_cleaner/test/resources/grit/test_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chrome_cleaner {
namespace {
// This resource id must not be used.
const uint32_t kUnusedResourceId = 42;
} // namespace
TEST(ResourceUtilTest, LoadResourceWithName) {
base::StringPiece content;
// Invalid resource type.
EXPECT_FALSE(LoadResourceOfKind(IDS_TEST_TEXT, L"ICON", &content));
// Invalid resource id.
EXPECT_FALSE(LoadResourceOfKind(kUnusedResourceId, L"BINDATA", &content));
// Valid resource.
EXPECT_TRUE(LoadResourceOfKind(IDS_TEST_TEXT, L"TEXT", &content));
EXPECT_GT(content.size(), 0U);
} // namespace chrome_cleaner