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 "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
10 #include "chrome/common/extensions/extension_error_utils.h" | 10 #include "chrome/common/extensions/extension_error_utils.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 ExtensionErrorUtils::FormatErrorMessage( | 47 ExtensionErrorUtils::FormatErrorMessage( |
48 errors::kInvalidLaunchValue, | 48 errors::kInvalidLaunchValue, |
49 keys::kLaunchWidth)), | 49 keys::kLaunchWidth)), |
50 Testcase("launch_height_invalid.json", | 50 Testcase("launch_height_invalid.json", |
51 ExtensionErrorUtils::FormatErrorMessage( | 51 ExtensionErrorUtils::FormatErrorMessage( |
52 errors::kInvalidLaunchValueContainer, | 52 errors::kInvalidLaunchValueContainer, |
53 keys::kLaunchHeight)), | 53 keys::kLaunchHeight)), |
54 Testcase("launch_height_negative.json", | 54 Testcase("launch_height_negative.json", |
55 ExtensionErrorUtils::FormatErrorMessage( | 55 ExtensionErrorUtils::FormatErrorMessage( |
56 errors::kInvalidLaunchValue, | 56 errors::kInvalidLaunchValue, |
57 keys::kLaunchHeight)), | 57 keys::kLaunchHeight)) |
58 Testcase("launch_min_width_invalid.json", | |
59 ExtensionErrorUtils::FormatErrorMessage( | |
60 errors::kInvalidLaunchValueContainer, | |
61 keys::kLaunchMinWidth)), | |
62 Testcase("launch_min_width_negative.json", | |
63 ExtensionErrorUtils::FormatErrorMessage( | |
64 errors::kInvalidLaunchValue, | |
65 keys::kLaunchMinWidth)), | |
66 Testcase("launch_min_height_invalid.json", | |
67 ExtensionErrorUtils::FormatErrorMessage( | |
68 errors::kInvalidLaunchValueContainer, | |
69 keys::kLaunchMinHeight)), | |
70 Testcase("launch_min_height_negative.json", | |
71 ExtensionErrorUtils::FormatErrorMessage( | |
72 errors::kInvalidLaunchValue, | |
73 keys::kLaunchMinHeight)), | |
74 Testcase("launch_container_missing_size_for_platform.json", | |
75 ExtensionErrorUtils::FormatErrorMessage( | |
76 errors::kInvalidLaunchValue, | |
77 keys::kLaunchWidth)), | |
78 Testcase("launch_container_invalid_size_constraints.json", | |
79 ExtensionErrorUtils::FormatErrorMessage( | |
80 errors::kInvalidLaunchValue, | |
81 keys::kLaunchMaxWidth)) | |
82 }; | 58 }; |
83 RunTestcases(testcases, arraysize(testcases), | 59 RunTestcases(testcases, arraysize(testcases), |
84 EXPECT_TYPE_ERROR); | 60 EXPECT_TYPE_ERROR); |
85 } | 61 } |
86 | 62 |
87 TEST_F(ExtensionManifestTest, PlatformAppLaunchContainer) { | |
88 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); | |
89 | |
90 LoadAndExpectError("launch_container_invalid_type_for_platform.json", | |
91 errors::kInvalidLaunchContainerForPlatform); | |
92 } | |
93 | |
94 TEST_F(ExtensionManifestTest, AppLaunchURL) { | 63 TEST_F(ExtensionManifestTest, AppLaunchURL) { |
95 Testcase testcases[] = { | 64 Testcase testcases[] = { |
96 Testcase("launch_path_and_url.json", | 65 Testcase("launch_path_and_url.json", |
97 errors::kLaunchPathAndURLAreExclusive), | 66 errors::kLaunchPathAndURLAreExclusive), |
98 Testcase("launch_path_and_extent.json", | 67 Testcase("launch_path_and_extent.json", |
99 errors::kLaunchPathAndExtentAreExclusive), | 68 errors::kLaunchPathAndExtentAreExclusive), |
100 Testcase("launch_path_invalid_type.json", | 69 Testcase("launch_path_invalid_type.json", |
101 ExtensionErrorUtils::FormatErrorMessage( | 70 ExtensionErrorUtils::FormatErrorMessage( |
102 errors::kInvalidLaunchValue, | 71 errors::kInvalidLaunchValue, |
103 keys::kLaunchLocalPath)), | 72 keys::kLaunchLocalPath)), |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 errors::kInvalidLaunchValue, | 112 errors::kInvalidLaunchValue, |
144 keys::kLaunchWebURL)); | 113 keys::kLaunchWebURL)); |
145 | 114 |
146 extension = LoadAndExpectSuccess("launch_web_url_absolute.json"); | 115 extension = LoadAndExpectSuccess("launch_web_url_absolute.json"); |
147 EXPECT_EQ(GURL("http://www.google.com/launch.html"), | 116 EXPECT_EQ(GURL("http://www.google.com/launch.html"), |
148 extension->GetFullLaunchURL()); | 117 extension->GetFullLaunchURL()); |
149 extension = LoadAndExpectSuccess("launch_web_url_localized.json"); | 118 extension = LoadAndExpectSuccess("launch_web_url_localized.json"); |
150 EXPECT_EQ(GURL("http://www.google.com/launch.html"), | 119 EXPECT_EQ(GURL("http://www.google.com/launch.html"), |
151 extension->GetFullLaunchURL()); | 120 extension->GetFullLaunchURL()); |
152 } | 121 } |
OLD | NEW |