This source file includes following definitions.
- TEST_F
#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
#include "extensions/common/manifest_handlers/web_accessible_resources_info.h"
#include "testing/gtest/include/gtest/gtest.h"
using extensions::Extension;
using extensions::WebAccessibleResourcesInfo;
class WebAccessibleResourcesManifestTest : public ExtensionManifestTest {
};
TEST_F(WebAccessibleResourcesManifestTest, WebAccessibleResources) {
scoped_refptr<Extension> extension1(
LoadAndExpectSuccess("web_accessible_resources_1.json"));
scoped_refptr<Extension> extension2(
LoadAndExpectSuccess("web_accessible_resources_2.json"));
scoped_refptr<Extension> extension3(
LoadAndExpectSuccess("web_accessible_resources_3.json"));
scoped_refptr<Extension> extension4(
LoadAndExpectSuccess("web_accessible_resources_4.json"));
scoped_refptr<Extension> extension5(
LoadAndExpectSuccess("web_accessible_resources_5.json"));
scoped_refptr<Extension> extension6(
LoadAndExpectSuccess("web_accessible_resources_6.json"));
EXPECT_TRUE(
WebAccessibleResourcesInfo::HasWebAccessibleResources(extension1.get()));
EXPECT_FALSE(
WebAccessibleResourcesInfo::HasWebAccessibleResources(extension2.get()));
EXPECT_TRUE(
WebAccessibleResourcesInfo::HasWebAccessibleResources(extension3.get()));
EXPECT_FALSE(
WebAccessibleResourcesInfo::HasWebAccessibleResources(extension4.get()));
EXPECT_TRUE(
WebAccessibleResourcesInfo::HasWebAccessibleResources(extension5.get()));
EXPECT_TRUE(
WebAccessibleResourcesInfo::HasWebAccessibleResources(extension6.get()));
EXPECT_TRUE(WebAccessibleResourcesInfo::IsResourceWebAccessible(
extension1.get(), "test"));
EXPECT_FALSE(WebAccessibleResourcesInfo::IsResourceWebAccessible(
extension1.get(), "none"));
EXPECT_FALSE(WebAccessibleResourcesInfo::IsResourceWebAccessible(
extension2.get(), "test"));
EXPECT_TRUE(WebAccessibleResourcesInfo::IsResourceWebAccessible(
extension3.get(), "test"));
EXPECT_FALSE(WebAccessibleResourcesInfo::IsResourceWebAccessible(
extension3.get(), "none"));
EXPECT_TRUE(WebAccessibleResourcesInfo::IsResourceWebAccessible(
extension4.get(), "test"));
EXPECT_TRUE(WebAccessibleResourcesInfo::IsResourceWebAccessible(
extension4.get(), "none"));
EXPECT_TRUE(WebAccessibleResourcesInfo::IsResourceWebAccessible(
extension5.get(), "anything"));
EXPECT_TRUE(WebAccessibleResourcesInfo::IsResourceWebAccessible(
extension5.get(), "path/anything"));
EXPECT_TRUE(WebAccessibleResourcesInfo::IsResourceWebAccessible(
extension6.get(), "path/anything.ext"));
EXPECT_FALSE(WebAccessibleResourcesInfo::IsResourceWebAccessible(
extension6.get(), "anything.ext"));
EXPECT_FALSE(WebAccessibleResourcesInfo::IsResourceWebAccessible(
extension6.get(), "path/anything.badext"));
}