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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/i18n/rtl.h" | 6 #include "base/i18n/rtl.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
10 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 10 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
11 #include "chrome/common/extensions/manifest_url_handler.h" | |
12 #include "components/crx_file/id_util.h" | 11 #include "components/crx_file/id_util.h" |
13 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
14 #include "extensions/common/manifest_constants.h" | 13 #include "extensions/common/manifest_constants.h" |
| 14 #include "extensions/common/manifest_handlers/options_page_info.h" |
15 #include "extensions/common/switches.h" | 15 #include "extensions/common/switches.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
18 | 18 |
19 namespace extensions { | 19 namespace extensions { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 // The ID of test manifests requiring whitelisting. | 23 // The ID of test manifests requiring whitelisting. |
24 const char kWhitelistID[] = "lmadimbbgapmngbiclpjjngmdickadpl"; | 24 const char kWhitelistID[] = "lmadimbbgapmngbiclpjjngmdickadpl"; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 EXPECT_EQ(path, extension->path()); | 112 EXPECT_EQ(path, extension->path()); |
113 | 113 |
114 // Test permissions scheme. | 114 // Test permissions scheme. |
115 // We allow unknown API permissions, so this will be valid until we better | 115 // We allow unknown API permissions, so this will be valid until we better |
116 // distinguish between API and host permissions. | 116 // distinguish between API and host permissions. |
117 LoadAndExpectSuccess("init_valid_permissions.json"); | 117 LoadAndExpectSuccess("init_valid_permissions.json"); |
118 | 118 |
119 // Test with an options page. | 119 // Test with an options page. |
120 extension = LoadAndExpectSuccess("init_valid_options.json"); | 120 extension = LoadAndExpectSuccess("init_valid_options.json"); |
121 EXPECT_EQ("chrome-extension", | 121 EXPECT_EQ("chrome-extension", |
122 ManifestURL::GetOptionsPage(extension.get()).scheme()); | 122 OptionsPageInfo::GetOptionsPage(extension.get()).scheme()); |
123 EXPECT_EQ("/options.html", | 123 EXPECT_EQ("/options.html", |
124 ManifestURL::GetOptionsPage(extension.get()).path()); | 124 OptionsPageInfo::GetOptionsPage(extension.get()).path()); |
125 | 125 |
126 // Test optional short_name field. | 126 // Test optional short_name field. |
127 extension = LoadAndExpectSuccess("init_valid_short_name.json"); | 127 extension = LoadAndExpectSuccess("init_valid_short_name.json"); |
128 EXPECT_EQ("a very descriptive extension name", extension->name()); | 128 EXPECT_EQ("a very descriptive extension name", extension->name()); |
129 EXPECT_EQ("concise name", extension->short_name()); | 129 EXPECT_EQ("concise name", extension->short_name()); |
130 | 130 |
131 Testcase testcases[] = { | 131 Testcase testcases[] = { |
132 // Test that an empty list of page actions does not stop a browser action | 132 // Test that an empty list of page actions does not stop a browser action |
133 // from being loaded. | 133 // from being loaded. |
134 Testcase("init_valid_empty_page_actions.json"), | 134 Testcase("init_valid_empty_page_actions.json"), |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 localized_name = base::WideToUTF16(L"Dictionary (\x05D1\x05D2" L" Google)"); | 172 localized_name = base::WideToUTF16(L"Dictionary (\x05D1\x05D2" L" Google)"); |
173 base::i18n::AdjustStringForLocaleDirection(&localized_name); | 173 base::i18n::AdjustStringForLocaleDirection(&localized_name); |
174 EXPECT_EQ(localized_name, base::UTF8ToUTF16(extension->name())); | 174 EXPECT_EQ(localized_name, base::UTF8ToUTF16(extension->name())); |
175 | 175 |
176 // Reset locale. | 176 // Reset locale. |
177 base::i18n::SetICUDefaultLocale(locale); | 177 base::i18n::SetICUDefaultLocale(locale); |
178 } | 178 } |
179 | 179 |
180 } // namespace extensions | 180 } // namespace extensions |
OLD | NEW |