| 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 <memory> | 5 #include <memory> |
| 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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 Testcase error_testcases[] = { | 42 Testcase error_testcases[] = { |
| 43 Testcase("init_invalid_platform_app_2.json", | 43 Testcase("init_invalid_platform_app_2.json", |
| 44 errors::kBackgroundRequiredForPlatformApps), | 44 errors::kBackgroundRequiredForPlatformApps), |
| 45 Testcase("init_invalid_platform_app_3.json", | 45 Testcase("init_invalid_platform_app_3.json", |
| 46 ErrorUtils::FormatErrorMessage( | 46 ErrorUtils::FormatErrorMessage( |
| 47 errors::kInvalidManifestVersionOld, "2", "apps")), | 47 errors::kInvalidManifestVersionOld, "2", "apps")), |
| 48 }; | 48 }; |
| 49 RunTestcases(error_testcases, arraysize(error_testcases), EXPECT_TYPE_ERROR); | 49 RunTestcases(error_testcases, arraysize(error_testcases), EXPECT_TYPE_ERROR); |
| 50 | 50 |
| 51 Testcase warning_testcases[] = { | 51 Testcase warning_testcases[] = { |
| 52 Testcase( | 52 Testcase( |
| 53 "init_invalid_platform_app_1.json", | 53 "init_invalid_platform_app_1.json", |
| 54 "'app.launch' is only allowed for hosted apps and legacy packaged " | 54 "'app.launch' is only allowed for legacy packaged apps and hosted " |
| 55 "apps, but this is a packaged app."), | 55 "apps, but this is a packaged app."), |
| 56 Testcase( | 56 Testcase("init_invalid_platform_app_4.json", |
| 57 "init_invalid_platform_app_4.json", | 57 "'background' is only allowed for extensions, legacy packaged " |
| 58 "'background' is only allowed for extensions, hosted apps, and legacy " | 58 "apps, and" |
| 59 "packaged apps, but this is a packaged app."), | 59 " hosted apps, but this is a packaged app."), |
| 60 Testcase( | 60 Testcase("init_invalid_platform_app_5.json", |
| 61 "init_invalid_platform_app_5.json", | 61 "'background' is only allowed for extensions, legacy packaged " |
| 62 "'background' is only allowed for extensions, hosted apps, and legacy " | 62 "apps, and" |
| 63 "packaged apps, but this is a packaged app."), | 63 " hosted apps, but this is a packaged app."), |
| 64 Testcase("incognito_invalid_platform_app.json", | 64 Testcase("incognito_invalid_platform_app.json", |
| 65 "'incognito' is only allowed for extensions and legacy packaged apps, " | 65 "'incognito' is only allowed for extensions and legacy packaged " |
| 66 "but this is a packaged app."), | 66 "apps, " |
| 67 "but this is a packaged app."), |
| 67 }; | 68 }; |
| 68 RunTestcases( | 69 RunTestcases( |
| 69 warning_testcases, arraysize(warning_testcases), EXPECT_TYPE_WARNING); | 70 warning_testcases, arraysize(warning_testcases), EXPECT_TYPE_WARNING); |
| 70 } | 71 } |
| 71 | 72 |
| 72 TEST_F(PlatformAppsManifestTest, PlatformAppContentSecurityPolicy) { | 73 TEST_F(PlatformAppsManifestTest, PlatformAppContentSecurityPolicy) { |
| 73 // Normal platform apps can't specify a CSP value. | 74 // Normal platform apps can't specify a CSP value. |
| 74 Testcase warning_testcases[] = { | 75 Testcase warning_testcases[] = { |
| 75 Testcase( | 76 Testcase( |
| 76 "init_platform_app_csp_warning_1.json", | 77 "init_platform_app_csp_warning_1.json", |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } | 142 } |
| 142 | 143 |
| 143 // Now try again with the experimental flag set. | 144 // Now try again with the experimental flag set. |
| 144 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 145 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 145 switches::kEnableExperimentalExtensionApis); | 146 switches::kEnableExperimentalExtensionApis); |
| 146 for (const std::unique_ptr<ManifestData>& manifest : manifests) | 147 for (const std::unique_ptr<ManifestData>& manifest : manifests) |
| 147 LoadAndExpectSuccess(*manifest); | 148 LoadAndExpectSuccess(*manifest); |
| 148 } | 149 } |
| 149 | 150 |
| 150 } // namespace extensions | 151 } // namespace extensions |
| OLD | NEW |