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
3 // found in the LICENSE file.
5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
6 #include "extensions/common/extension.h"
7 #include "extensions/common/manifest_constants.h"
8 #include "extensions/common/manifest_handlers/offline_enabled_info.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 namespace extensions
{
13 namespace errors
= manifest_errors
;
15 class ExtensionManifestOfflineEnabledTest
: public ExtensionManifestTest
{
18 TEST_F(ExtensionManifestOfflineEnabledTest
, OfflineEnabled
) {
19 LoadAndExpectError("offline_enabled_invalid.json",
20 errors::kInvalidOfflineEnabled
);
21 scoped_refptr
<Extension
> extension_0(
22 LoadAndExpectSuccess("offline_enabled_extension.json"));
23 EXPECT_TRUE(OfflineEnabledInfo::IsOfflineEnabled(extension_0
.get()));
24 scoped_refptr
<Extension
> extension_1(
25 LoadAndExpectSuccess("offline_enabled_packaged_app.json"));
26 EXPECT_TRUE(OfflineEnabledInfo::IsOfflineEnabled(extension_1
.get()));
27 scoped_refptr
<Extension
> extension_2(
28 LoadAndExpectSuccess("offline_disabled_packaged_app.json"));
29 EXPECT_FALSE(OfflineEnabledInfo::IsOfflineEnabled(extension_2
.get()));
30 scoped_refptr
<Extension
> extension_3(
31 LoadAndExpectSuccess("offline_default_packaged_app.json"));
32 EXPECT_FALSE(OfflineEnabledInfo::IsOfflineEnabled(extension_3
.get()));
33 scoped_refptr
<Extension
> extension_4(
34 LoadAndExpectSuccess("offline_enabled_hosted_app.json"));
35 EXPECT_TRUE(OfflineEnabledInfo::IsOfflineEnabled(extension_4
.get()));
36 scoped_refptr
<Extension
> extension_5(
37 LoadAndExpectSuccess("offline_default_platform_app.json"));
38 EXPECT_TRUE(OfflineEnabledInfo::IsOfflineEnabled(extension_5
.get()));
39 scoped_refptr
<Extension
> extension_6(
40 LoadAndExpectSuccess("offline_default_platform_app_with_webview.json"));
41 EXPECT_FALSE(OfflineEnabledInfo::IsOfflineEnabled(extension_6
.get()));
44 } // namespace extensions