| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 std::string error; | 376 std::string error; |
| 377 DictionaryValue input_value; | 377 DictionaryValue input_value; |
| 378 | 378 |
| 379 input_value.SetString(keys::kVersion, "1.0.0.0"); | 379 input_value.SetString(keys::kVersion, "1.0.0.0"); |
| 380 // No strong RTL characters in name. | 380 // No strong RTL characters in name. |
| 381 std::wstring name(L"Dictionary (by Google)"); | 381 std::wstring name(L"Dictionary (by Google)"); |
| 382 input_value.SetString(keys::kName, WideToUTF16Hack(name)); | 382 input_value.SetString(keys::kName, WideToUTF16Hack(name)); |
| 383 EXPECT_TRUE(extension.InitFromValue(input_value, false, &error)); | 383 EXPECT_TRUE(extension.InitFromValue(input_value, false, &error)); |
| 384 EXPECT_EQ("", error); | 384 EXPECT_EQ("", error); |
| 385 std::wstring localized_name(name); | 385 std::wstring localized_name(name); |
| 386 base::i18n::AdjustStringForLocaleDirection(localized_name, &localized_name); | 386 base::i18n::AdjustStringForLocaleDirection(&localized_name); |
| 387 EXPECT_EQ(localized_name, UTF8ToWide(extension.name())); | 387 EXPECT_EQ(localized_name, UTF8ToWide(extension.name())); |
| 388 | 388 |
| 389 // Strong RTL characters in name. | 389 // Strong RTL characters in name. |
| 390 name = L"Dictionary (\x05D1\x05D2"L" Google)"; | 390 name = L"Dictionary (\x05D1\x05D2"L" Google)"; |
| 391 input_value.SetString(keys::kName, WideToUTF16Hack(name)); | 391 input_value.SetString(keys::kName, WideToUTF16Hack(name)); |
| 392 EXPECT_TRUE(extension.InitFromValue(input_value, false, &error)); | 392 EXPECT_TRUE(extension.InitFromValue(input_value, false, &error)); |
| 393 EXPECT_EQ("", error); | 393 EXPECT_EQ("", error); |
| 394 localized_name = name; | 394 localized_name = name; |
| 395 base::i18n::AdjustStringForLocaleDirection(localized_name, &localized_name); | 395 base::i18n::AdjustStringForLocaleDirection(&localized_name); |
| 396 EXPECT_EQ(localized_name, UTF8ToWide(extension.name())); | 396 EXPECT_EQ(localized_name, UTF8ToWide(extension.name())); |
| 397 | 397 |
| 398 // Reset locale. | 398 // Reset locale. |
| 399 #if defined(TOOLKIT_GTK) | 399 #if defined(TOOLKIT_GTK) |
| 400 gtk_widget_set_default_direction(gtk_dir); | 400 gtk_widget_set_default_direction(gtk_dir); |
| 401 #else | 401 #else |
| 402 base::i18n::SetICUDefaultLocale(locale); | 402 base::i18n::SetICUDefaultLocale(locale); |
| 403 #endif | 403 #endif |
| 404 } | 404 } |
| 405 | 405 |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 EXPECT_TRUE(Extension::GenerateId("test", &result)); | 1160 EXPECT_TRUE(Extension::GenerateId("test", &result)); |
| 1161 EXPECT_EQ(result, "jpignaibiiemhngfjkcpokkamffknabf"); | 1161 EXPECT_EQ(result, "jpignaibiiemhngfjkcpokkamffknabf"); |
| 1162 | 1162 |
| 1163 EXPECT_TRUE(Extension::GenerateId("_", &result)); | 1163 EXPECT_TRUE(Extension::GenerateId("_", &result)); |
| 1164 EXPECT_EQ(result, "ncocknphbhhlhkikpnnlmbcnbgdempcd"); | 1164 EXPECT_EQ(result, "ncocknphbhhlhkikpnnlmbcnbgdempcd"); |
| 1165 | 1165 |
| 1166 EXPECT_TRUE(Extension::GenerateId( | 1166 EXPECT_TRUE(Extension::GenerateId( |
| 1167 "this_string_is_longer_than_a_single_sha256_hash_digest", &result)); | 1167 "this_string_is_longer_than_a_single_sha256_hash_digest", &result)); |
| 1168 EXPECT_EQ(result, "jimneklojkjdibfkgiiophfhjhbdgcfi"); | 1168 EXPECT_EQ(result, "jimneklojkjdibfkgiiophfhjhbdgcfi"); |
| 1169 } | 1169 } |
| OLD | NEW |