OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 5 #include "chrome/common/extensions/background_info.h" |
6 | |
7 #include "chrome/common/extensions/extension.h" | 6 #include "chrome/common/extensions/extension.h" |
8 #include "chrome/common/extensions/extension_manifest_constants.h" | 7 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 8 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 using extensions::Extension; | 11 using extensions::Extension; |
12 | 12 |
13 namespace errors = extension_manifest_errors; | 13 namespace errors = extension_manifest_errors; |
14 | 14 |
15 TEST_F(ExtensionManifestTest, OfflineEnabled) { | 15 namespace extensions { |
| 16 |
| 17 class ExtensionManifestOfflineEnabledTest : public ExtensionManifestTest { |
| 18 virtual void SetUp() OVERRIDE { |
| 19 ExtensionManifestTest::SetUp(); |
| 20 std::vector<std::string> background_keys(BackgroundManifestHandler::keys()); |
| 21 linked_ptr<BackgroundManifestHandler> background_handler( |
| 22 new BackgroundManifestHandler); |
| 23 for (size_t i = 0; i < background_keys.size(); ++i) |
| 24 ManifestHandler::Register(background_keys[i], background_handler); |
| 25 } |
| 26 }; |
| 27 |
| 28 TEST_F(ExtensionManifestOfflineEnabledTest, OfflineEnabled) { |
16 LoadAndExpectError("offline_enabled_invalid.json", | 29 LoadAndExpectError("offline_enabled_invalid.json", |
17 errors::kInvalidOfflineEnabled); | 30 errors::kInvalidOfflineEnabled); |
18 scoped_refptr<Extension> extension_0( | 31 scoped_refptr<Extension> extension_0( |
19 LoadAndExpectSuccess("offline_enabled_extension.json")); | 32 LoadAndExpectSuccess("offline_enabled_extension.json")); |
20 EXPECT_TRUE(extension_0->offline_enabled()); | 33 EXPECT_TRUE(extension_0->offline_enabled()); |
21 scoped_refptr<Extension> extension_1( | 34 scoped_refptr<Extension> extension_1( |
22 LoadAndExpectSuccess("offline_enabled_packaged_app.json")); | 35 LoadAndExpectSuccess("offline_enabled_packaged_app.json")); |
23 EXPECT_TRUE(extension_1->offline_enabled()); | 36 EXPECT_TRUE(extension_1->offline_enabled()); |
24 scoped_refptr<Extension> extension_2( | 37 scoped_refptr<Extension> extension_2( |
25 LoadAndExpectSuccess("offline_disabled_packaged_app.json")); | 38 LoadAndExpectSuccess("offline_disabled_packaged_app.json")); |
26 EXPECT_FALSE(extension_2->offline_enabled()); | 39 EXPECT_FALSE(extension_2->offline_enabled()); |
27 scoped_refptr<Extension> extension_3( | 40 scoped_refptr<Extension> extension_3( |
28 LoadAndExpectSuccess("offline_default_packaged_app.json")); | 41 LoadAndExpectSuccess("offline_default_packaged_app.json")); |
29 EXPECT_FALSE(extension_3->offline_enabled()); | 42 EXPECT_FALSE(extension_3->offline_enabled()); |
30 scoped_refptr<Extension> extension_4( | 43 scoped_refptr<Extension> extension_4( |
31 LoadAndExpectSuccess("offline_enabled_hosted_app.json")); | 44 LoadAndExpectSuccess("offline_enabled_hosted_app.json")); |
32 EXPECT_TRUE(extension_4->offline_enabled()); | 45 EXPECT_TRUE(extension_4->offline_enabled()); |
33 scoped_refptr<Extension> extension_5( | 46 scoped_refptr<Extension> extension_5( |
34 LoadAndExpectSuccess("offline_default_platform_app.json")); | 47 LoadAndExpectSuccess("offline_default_platform_app.json")); |
35 EXPECT_TRUE(extension_5->offline_enabled()); | 48 EXPECT_TRUE(extension_5->offline_enabled()); |
36 } | 49 } |
| 50 |
| 51 } // namespace extensions |
OLD | NEW |