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

Side by Side Diff: chrome/common/extensions/extension_manifests_unittest.cc

Issue 10086019: Use the non-localized "canonical name" of an extension to write to its sync (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rename, test Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/extension.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 scoped_refptr<Extension> extension(LoadAndExpectSuccess( 247 scoped_refptr<Extension> extension(LoadAndExpectSuccess(
248 "init_valid_minimal.json")); 248 "init_valid_minimal.json"));
249 249
250 FilePath path; 250 FilePath path;
251 PathService::Get(chrome::DIR_TEST_DATA, &path); 251 PathService::Get(chrome::DIR_TEST_DATA, &path);
252 path = path.AppendASCII("extensions"); 252 path = path.AppendASCII("extensions");
253 253
254 EXPECT_TRUE(Extension::IdIsValid(extension->id())); 254 EXPECT_TRUE(Extension::IdIsValid(extension->id()));
255 EXPECT_EQ("1.0.0.0", extension->VersionString()); 255 EXPECT_EQ("1.0.0.0", extension->VersionString());
256 EXPECT_EQ("my extension", extension->name()); 256 EXPECT_EQ("my extension", extension->name());
257 EXPECT_EQ("my extension", extension->non_localized_name());
257 EXPECT_EQ(extension->id(), extension->url().host()); 258 EXPECT_EQ(extension->id(), extension->url().host());
258 EXPECT_EQ(extension->path(), path); 259 EXPECT_EQ(extension->path(), path);
259 EXPECT_EQ(path, extension->path()); 260 EXPECT_EQ(path, extension->path());
260 261
261 // Test permissions scheme. 262 // Test permissions scheme.
262 // We allow unknown API permissions, so this will be valid until we better 263 // We allow unknown API permissions, so this will be valid until we better
263 // distinguish between API and host permissions. 264 // distinguish between API and host permissions.
264 extension = LoadAndExpectSuccess("init_valid_permissions.json"); 265 extension = LoadAndExpectSuccess("init_valid_permissions.json");
265 266
266 // Test with an options page. 267 // Test with an options page.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 #else 378 #else
378 std::string locale = l10n_util::GetApplicationLocale(""); 379 std::string locale = l10n_util::GetApplicationLocale("");
379 base::i18n::SetICUDefaultLocale("he"); 380 base::i18n::SetICUDefaultLocale("he");
380 #endif 381 #endif
381 382
382 // No strong RTL characters in name. 383 // No strong RTL characters in name.
383 scoped_refptr<Extension> extension(LoadAndExpectSuccess( 384 scoped_refptr<Extension> extension(LoadAndExpectSuccess(
384 "init_valid_name_no_rtl.json")); 385 "init_valid_name_no_rtl.json"));
385 386
386 string16 localized_name(ASCIIToUTF16("Dictionary (by Google)")); 387 string16 localized_name(ASCIIToUTF16("Dictionary (by Google)"));
388 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->non_localized_name()));
389
387 base::i18n::AdjustStringForLocaleDirection(&localized_name); 390 base::i18n::AdjustStringForLocaleDirection(&localized_name);
388 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name())); 391 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name()));
389 392
390 // Strong RTL characters in name. 393 // Strong RTL characters in name.
391 extension = LoadAndExpectSuccess("init_valid_name_strong_rtl.json"); 394 extension = LoadAndExpectSuccess("init_valid_name_strong_rtl.json");
392 395
393 localized_name = WideToUTF16(L"Dictionary (\x05D1\x05D2"L" Google)"); 396 localized_name = WideToUTF16(L"Dictionary (\x05D1\x05D2"L" Google)");
397 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->non_localized_name()));
398
394 base::i18n::AdjustStringForLocaleDirection(&localized_name); 399 base::i18n::AdjustStringForLocaleDirection(&localized_name);
395 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name())); 400 EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name()));
396 401
397 // Reset locale. 402 // Reset locale.
398 #if defined(TOOLKIT_GTK) 403 #if defined(TOOLKIT_GTK)
399 gtk_widget_set_default_direction(gtk_dir); 404 gtk_widget_set_default_direction(gtk_dir);
400 #else 405 #else
401 base::i18n::SetICUDefaultLocale(locale); 406 base::i18n::SetICUDefaultLocale(locale);
402 #endif 407 #endif
403 } 408 }
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 // Extension with manifest version 2 *can* use storage API. 1280 // Extension with manifest version 2 *can* use storage API.
1276 { 1281 {
1277 DictionaryValue manifest_with_version; 1282 DictionaryValue manifest_with_version;
1278 manifest_with_version.SetInteger(keys::kManifestVersion, 2); 1283 manifest_with_version.SetInteger(keys::kManifestVersion, 2);
1279 manifest_with_version.MergeDictionary(&base_manifest); 1284 manifest_with_version.MergeDictionary(&base_manifest);
1280 1285
1281 Manifest manifest(&manifest_with_version, "test"); 1286 Manifest manifest(&manifest_with_version, "test");
1282 LoadAndExpectSuccess(manifest); 1287 LoadAndExpectSuccess(manifest);
1283 } 1288 }
1284 } 1289 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698