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/manifest_tests/extension_manifest_test.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
11 #include "chrome/common/extensions/extension_manifest_constants.h" | 11 #include "chrome/common/extensions/extension_manifest_constants.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace errors = extension_manifest_errors; | 14 namespace errors = extension_manifest_errors; |
15 | 15 |
16 TEST_F(ExtensionManifestTest, PlatformApps) { | 16 TEST_F(ExtensionManifestTest, PlatformApps) { |
17 // A minimal platform app. | 17 // A minimal platform app. |
18 LoadAndExpectError("init_valid_platform_app.json", | 18 LoadAndExpectError("init_valid_platform_app.json", |
19 errors::kPlatformAppFlagRequired); | 19 errors::kPlatformAppFlagRequired); |
20 | 20 |
21 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); | 21 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); |
22 | 22 |
23 scoped_refptr<Extension> extension = | 23 scoped_refptr<extensions::Extension> extension = |
24 LoadAndExpectSuccess("init_valid_platform_app.json"); | 24 LoadAndExpectSuccess("init_valid_platform_app.json"); |
25 EXPECT_TRUE(extension->is_storage_isolated()); | 25 EXPECT_TRUE(extension->is_storage_isolated()); |
26 | 26 |
27 extension = LoadAndExpectSuccess("init_invalid_platform_app_1.json"); | 27 extension = LoadAndExpectSuccess("init_invalid_platform_app_1.json"); |
28 ASSERT_TRUE(extension); | 28 ASSERT_TRUE(extension); |
29 ASSERT_EQ(1u, extension->install_warnings().size()); | 29 ASSERT_EQ(1u, extension->install_warnings().size()); |
30 EXPECT_EQ("'app.launch' is not allowed for specified package type " | 30 EXPECT_EQ("'app.launch' is not allowed for specified package type " |
31 "(theme, app, etc.).", | 31 "(theme, app, etc.).", |
32 extension->install_warnings()[0]); | 32 extension->install_warnings()[0]); |
33 | 33 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 // Finally, we should succeed with both experimental and platform-app flags | 99 // Finally, we should succeed with both experimental and platform-app flags |
100 // set. | 100 // set. |
101 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); | 101 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); |
102 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { | 102 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { |
103 const char* api_name = kPlatformAppExperimentalApis[i]; | 103 const char* api_name = kPlatformAppExperimentalApis[i]; |
104 FilePath file_path = temp_dir.path().AppendASCII(api_name); | 104 FilePath file_path = temp_dir.path().AppendASCII(api_name); |
105 LoadAndExpectSuccess(file_path.MaybeAsASCII().c_str()); | 105 LoadAndExpectSuccess(file_path.MaybeAsASCII().c_str()); |
106 } | 106 } |
107 } | 107 } |
OLD | NEW |