Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc

Issue 10544059: Change the platform app manifest structure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 13 matching lines...) Expand all
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
34 LoadAndExpectError( 34 Testcase testcases[] = {
35 "init_invalid_platform_app_2.json", 35 Testcase("init_invalid_platform_app_2.json",
36 extension_manifest_errors::kBackgroundRequiredForPlatformApps); 36 errors::kBackgroundRequiredForPlatformApps),
37 37 Testcase("init_invalid_platform_app_2.json",
38 LoadAndExpectError( 38 errors::kBackgroundRequiredForPlatformApps),
39 "init_invalid_platform_app_3.json", 39 Testcase("init_invalid_platform_app_3.json",
40 extension_manifest_errors::kPlatformAppNeedsManifestVersion2); 40 errors::kPlatformAppNeedsManifestVersion2),
41 Testcase("init_invalid_platform_app_4.json",
42 errors::kPlatformAppInvalidBackgroundScripts),
43 Testcase("init_invalid_platform_app_5.json",
44 errors::kPlatformAppInvalidBackgroundPage)
45 };
46 RunTestcases(testcases, arraysize(testcases),
47 EXPECT_TYPE_ERROR);
41 } 48 }
42 49
43 TEST_F(ExtensionManifestTest, CertainApisRequirePlatformApps) { 50 TEST_F(ExtensionManifestTest, CertainApisRequirePlatformApps) {
44 // Put APIs here that should be restricted to platform apps, but that haven't 51 // Put APIs here that should be restricted to platform apps, but that haven't
45 // yet graduated from experimental. 52 // yet graduated from experimental.
46 const char* kPlatformAppExperimentalApis[] = { 53 const char* kPlatformAppExperimentalApis[] = {
47 "dns", 54 "dns",
48 "serial", 55 "serial",
49 "socket", 56 "socket",
50 }; 57 };
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 105
99 // Finally, we should succeed with both experimental and platform-app flags 106 // Finally, we should succeed with both experimental and platform-app flags
100 // set. 107 // set.
101 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); 108 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps);
102 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { 109 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) {
103 const char* api_name = kPlatformAppExperimentalApis[i]; 110 const char* api_name = kPlatformAppExperimentalApis[i];
104 FilePath file_path = temp_dir.path().AppendASCII(api_name); 111 FilePath file_path = temp_dir.path().AppendASCII(api_name);
105 LoadAndExpectSuccess(file_path.MaybeAsASCII().c_str()); 112 LoadAndExpectSuccess(file_path.MaybeAsASCII().c_str());
106 } 113 }
107 } 114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698