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

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

Issue 1047943002: Cache --whitelisted-extension-id in SimpleFeature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update tests that fail on memory bots. Created 5 years, 8 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
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 "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/chrome_manifest_test.h" 10 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h"
11 #include "components/crx_file/id_util.h" 11 #include "components/crx_file/id_util.h"
12 #include "extensions/common/extension.h" 12 #include "extensions/common/extension.h"
13 #include "extensions/common/features/simple_feature.h"
13 #include "extensions/common/manifest_constants.h" 14 #include "extensions/common/manifest_constants.h"
14 #include "extensions/common/manifest_handlers/options_page_info.h" 15 #include "extensions/common/manifest_handlers/options_page_info.h"
15 #include "extensions/common/switches.h" 16 #include "extensions/common/switches.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
18 19
19 namespace extensions { 20 namespace extensions {
20 21
21 namespace { 22 namespace {
22 23
23 // The ID of test manifests requiring whitelisting. 24 // The ID of test manifests requiring whitelisting.
24 const char kWhitelistID[] = "lmadimbbgapmngbiclpjjngmdickadpl"; 25 const char kWhitelistID[] = "lmadimbbgapmngbiclpjjngmdickadpl";
25 26
26 } // namespace 27 } // namespace
27 28
28 namespace errors = manifest_errors; 29 namespace errors = manifest_errors;
29 namespace keys = manifest_keys; 30 namespace keys = manifest_keys;
30 31
31 class InitValueManifestTest : public ChromeManifestTest { 32 class InitValueManifestTest : public ChromeManifestTest {
32 }; 33 };
33 34
34 TEST_F(InitValueManifestTest, InitFromValueInvalid) { 35 TEST_F(InitValueManifestTest, InitFromValueInvalid) {
35 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 36 extensions::SimpleFeature::ScopedWhitelistForTest whitelist(kWhitelistID);
36 extensions::switches::kWhitelistedExtensionID, kWhitelistID);
37 Testcase testcases[] = { 37 Testcase testcases[] = {
38 Testcase("init_invalid_version_missing.json", errors::kInvalidVersion), 38 Testcase("init_invalid_version_missing.json", errors::kInvalidVersion),
39 Testcase("init_invalid_version_invalid.json", errors::kInvalidVersion), 39 Testcase("init_invalid_version_invalid.json", errors::kInvalidVersion),
40 Testcase("init_invalid_version_name_invalid.json", 40 Testcase("init_invalid_version_name_invalid.json",
41 errors::kInvalidVersionName), 41 errors::kInvalidVersionName),
42 Testcase("init_invalid_name_missing.json", errors::kInvalidName), 42 Testcase("init_invalid_name_missing.json", errors::kInvalidName),
43 Testcase("init_invalid_name_invalid.json", errors::kInvalidName), 43 Testcase("init_invalid_name_invalid.json", errors::kInvalidName),
44 Testcase("init_invalid_description_invalid.json", 44 Testcase("init_invalid_description_invalid.json",
45 errors::kInvalidDescription), 45 errors::kInvalidDescription),
46 Testcase("init_invalid_icons_invalid.json", errors::kInvalidIcons), 46 Testcase("init_invalid_icons_invalid.json", errors::kInvalidIcons),
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 localized_name = base::WideToUTF16(L"Dictionary (\x05D1\x05D2" L" Google)"); 173 localized_name = base::WideToUTF16(L"Dictionary (\x05D1\x05D2" L" Google)");
174 base::i18n::AdjustStringForLocaleDirection(&localized_name); 174 base::i18n::AdjustStringForLocaleDirection(&localized_name);
175 EXPECT_EQ(localized_name, base::UTF8ToUTF16(extension->name())); 175 EXPECT_EQ(localized_name, base::UTF8ToUTF16(extension->name()));
176 176
177 // Reset locale. 177 // Reset locale.
178 base::i18n::SetICUDefaultLocale(locale); 178 base::i18n::SetICUDefaultLocale(locale);
179 } 179 }
180 180
181 } // namespace extensions 181 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698