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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 years, 7 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 "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/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/common/chrome_paths.h" 10 #include "chrome/common/chrome_paths.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 errors::kChromeVersionTooLow), 67 errors::kChromeVersionTooLow),
68 Testcase("init_invalid_requirements_1.json", errors::kInvalidRequirements), 68 Testcase("init_invalid_requirements_1.json", errors::kInvalidRequirements),
69 Testcase("init_invalid_requirements_2.json", errors::kInvalidRequirement) 69 Testcase("init_invalid_requirements_2.json", errors::kInvalidRequirement)
70 }; 70 };
71 71
72 RunTestcases(testcases, arraysize(testcases), 72 RunTestcases(testcases, arraysize(testcases),
73 EXPECT_TYPE_ERROR); 73 EXPECT_TYPE_ERROR);
74 } 74 }
75 75
76 TEST_F(ExtensionManifestTest, InitFromValueValid) { 76 TEST_F(ExtensionManifestTest, InitFromValueValid) {
77 scoped_refptr<Extension> extension(LoadAndExpectSuccess( 77 scoped_refptr<extensions::Extension> extension(LoadAndExpectSuccess(
78 "init_valid_minimal.json")); 78 "init_valid_minimal.json"));
79 79
80 FilePath path; 80 FilePath path;
81 PathService::Get(chrome::DIR_TEST_DATA, &path); 81 PathService::Get(chrome::DIR_TEST_DATA, &path);
82 path = path.AppendASCII("extensions"); 82 path = path.AppendASCII("extensions");
83 83
84 EXPECT_TRUE(Extension::IdIsValid(extension->id())); 84 EXPECT_TRUE(extensions::Extension::IdIsValid(extension->id()));
85 EXPECT_EQ("1.0.0.0", extension->VersionString()); 85 EXPECT_EQ("1.0.0.0", extension->VersionString());
86 EXPECT_EQ("my extension", extension->name()); 86 EXPECT_EQ("my extension", extension->name());
87 EXPECT_EQ(extension->id(), extension->url().host()); 87 EXPECT_EQ(extension->id(), extension->url().host());
88 EXPECT_EQ(extension->path(), path); 88 EXPECT_EQ(extension->path(), path);
89 EXPECT_EQ(path, extension->path()); 89 EXPECT_EQ(path, extension->path());
90 90
91 // Test permissions scheme. 91 // Test permissions scheme.
92 // We allow unknown API permissions, so this will be valid until we better 92 // We allow unknown API permissions, so this will be valid until we better
93 // distinguish between API and host permissions. 93 // distinguish between API and host permissions.
94 LoadAndExpectSuccess("init_valid_permissions.json"); 94 LoadAndExpectSuccess("init_valid_permissions.json");
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 TEST_F(ExtensionManifestTest, InitFromValueValidNameInRTL) { 127 TEST_F(ExtensionManifestTest, InitFromValueValidNameInRTL) {
128 #if defined(TOOLKIT_GTK) 128 #if defined(TOOLKIT_GTK)
129 GtkTextDirection gtk_dir = gtk_widget_get_default_direction(); 129 GtkTextDirection gtk_dir = gtk_widget_get_default_direction();
130 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); 130 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL);
131 #else 131 #else
132 std::string locale = l10n_util::GetApplicationLocale(""); 132 std::string locale = l10n_util::GetApplicationLocale("");
133 base::i18n::SetICUDefaultLocale("he"); 133 base::i18n::SetICUDefaultLocale("he");
134 #endif 134 #endif
135 135
136 // No strong RTL characters in name. 136 // No strong RTL characters in name.
137 scoped_refptr<Extension> extension(LoadAndExpectSuccess( 137 scoped_refptr<extensions::Extension> extension(LoadAndExpectSuccess(
138 "init_valid_name_no_rtl.json")); 138 "init_valid_name_no_rtl.json"));
139 139
140 string16 localized_name(ASCIIToUTF16("Dictionary (by Google)")); 140 string16 localized_name(ASCIIToUTF16("Dictionary (by Google)"));
141 base::i18n::AdjustStringForLocaleDirection(&localized_name); 141 base::i18n::AdjustStringForLocaleDirection(&localized_name);
142 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name())); 142 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name()));
143 143
144 // Strong RTL characters in name. 144 // Strong RTL characters in name.
145 extension = LoadAndExpectSuccess("init_valid_name_strong_rtl.json"); 145 extension = LoadAndExpectSuccess("init_valid_name_strong_rtl.json");
146 146
147 localized_name = WideToUTF16(L"Dictionary (\x05D1\x05D2"L" Google)"); 147 localized_name = WideToUTF16(L"Dictionary (\x05D1\x05D2"L" Google)");
148 base::i18n::AdjustStringForLocaleDirection(&localized_name); 148 base::i18n::AdjustStringForLocaleDirection(&localized_name);
149 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name())); 149 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name()));
150 150
151 // Reset locale. 151 // Reset locale.
152 #if defined(TOOLKIT_GTK) 152 #if defined(TOOLKIT_GTK)
153 gtk_widget_set_default_direction(gtk_dir); 153 gtk_widget_set_default_direction(gtk_dir);
154 #else 154 #else
155 base::i18n::SetICUDefaultLocale(locale); 155 base::i18n::SetICUDefaultLocale(locale);
156 #endif 156 #endif
157 } 157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698