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

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

Issue 1073005: Move RTL related functions from app/l10n_util to base/i18n/rtl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_message_bundle.h" 5 #include "chrome/common/extensions/extension_message_bundle.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
11 #include "base/i18n/rtl.h"
11 #include "base/linked_ptr.h" 12 #include "base/linked_ptr.h"
12 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
13 #include "base/string_util.h" 14 #include "base/string_util.h"
14 #include "base/values.h" 15 #include "base/values.h"
15 #include "chrome/common/extensions/extension_constants.h" 16 #include "chrome/common/extensions/extension_constants.h"
16 #include "chrome/common/extensions/extension_error_utils.h" 17 #include "chrome/common/extensions/extension_error_utils.h"
17 #include "chrome/common/extensions/extension_l10n_util.h" 18 #include "chrome/common/extensions/extension_l10n_util.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 20
20 namespace errors = extension_manifest_errors; 21 namespace errors = extension_manifest_errors;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // Update when adding new reserved messages. 123 // Update when adding new reserved messages.
123 return 5U; 124 return 5U;
124 } 125 }
125 126
126 void CheckReservedMessages(ExtensionMessageBundle* handler) { 127 void CheckReservedMessages(ExtensionMessageBundle* handler) {
127 std::string ui_locale = extension_l10n_util::CurrentLocaleOrDefault(); 128 std::string ui_locale = extension_l10n_util::CurrentLocaleOrDefault();
128 EXPECT_EQ(ui_locale, 129 EXPECT_EQ(ui_locale,
129 handler->GetL10nMessage(ExtensionMessageBundle::kUILocaleKey)); 130 handler->GetL10nMessage(ExtensionMessageBundle::kUILocaleKey));
130 131
131 std::string text_dir = "ltr"; 132 std::string text_dir = "ltr";
132 if (l10n_util::GetTextDirectionForLocale(ui_locale.c_str()) == 133 if (base::i18n::GetTextDirectionForLocale(ui_locale.c_str()) ==
133 l10n_util::RIGHT_TO_LEFT) 134 base::i18n::RIGHT_TO_LEFT)
134 text_dir = "rtl"; 135 text_dir = "rtl";
135 136
136 EXPECT_EQ(text_dir, handler->GetL10nMessage( 137 EXPECT_EQ(text_dir, handler->GetL10nMessage(
137 ExtensionMessageBundle::kBidiDirectionKey)); 138 ExtensionMessageBundle::kBidiDirectionKey));
138 } 139 }
139 140
140 bool AppendReservedMessages(const std::string& application_locale) { 141 bool AppendReservedMessages(const std::string& application_locale) {
141 std::string error; 142 std::string error;
142 return handler_->AppendReservedMessagesForLocale( 143 return handler_->AppendReservedMessagesForLocale(
143 application_locale, &error); 144 application_locale, &error);
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 // Store a map for given id. 417 // Store a map for given id.
417 L10nMessagesMap messages; 418 L10nMessagesMap messages;
418 messages.insert(std::make_pair("message_name", "message_value")); 419 messages.insert(std::make_pair("message_name", "message_value"));
419 (*GetExtensionToL10nMessagesMap())[extension_id] = messages; 420 (*GetExtensionToL10nMessagesMap())[extension_id] = messages;
420 421
421 L10nMessagesMap* map = GetL10nMessagesMap(extension_id); 422 L10nMessagesMap* map = GetL10nMessagesMap(extension_id);
422 ASSERT_TRUE(NULL != map); 423 ASSERT_TRUE(NULL != map);
423 EXPECT_EQ(1U, map->size()); 424 EXPECT_EQ(1U, map->size());
424 EXPECT_EQ("message_value", (*map)["message_name"]); 425 EXPECT_EQ("message_value", (*map)["message_name"]);
425 } 426 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_message_bundle.cc ('k') | chrome/renderer/localized_error.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698