summaryrefslogtreecommitdiffstats
path: root/chrome/browser/character_encoding.cc
diff options
context:
space:
mode:
authorjnd@google.com <jnd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-19 01:48:16 +0000
committerjnd@google.com <jnd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-19 01:48:16 +0000
commit97fa6ce336fe635fc0ac06ebefe925d1bc235897 (patch)
treee8797c5e25c209305a8d864a9f17744486626cce /chrome/browser/character_encoding.cc
parent0844615584c64925c47141d519942655b04b52eb (diff)
downloadchromium_src-97fa6ce336fe635fc0ac06ebefe925d1bc235897.zip
chromium_src-97fa6ce336fe635fc0ac06ebefe925d1bc235897.tar.gz
chromium_src-97fa6ce336fe635fc0ac06ebefe925d1bc235897.tar.bz2
We need to add UI test for "Encoding" menu to avoid regression.
For this purpose, I have created several methods in automation API. They can be used for the above UI tests. 1 get the current used encoding name of the page in the specified tab. 2 get value of the encoding auto detection option. 3 enables and disable the encoding auto detection. 4 use the specified encoding to override the encoding of the page in the specified tab. BUG=5515 The corresponding UI test is coming soon Review URL: http://codereview.chromium.org/14162 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7286 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/character_encoding.cc')
-rw-r--r--chrome/browser/character_encoding.cc35
1 files changed, 17 insertions, 18 deletions
diff --git a/chrome/browser/character_encoding.cc b/chrome/browser/character_encoding.cc
index 4bb9575..7144ca0 100644
--- a/chrome/browser/character_encoding.cc
+++ b/chrome/browser/character_encoding.cc
@@ -129,23 +129,6 @@ const CanonicalEncodingNameToIdMapType* CanonicalEncodingMap::GetCanonicalEncodi
// encoding names.
static CanonicalEncodingMap canonical_encoding_name_map_singleton;
-// Static.
-// Get encoding command id according to input encoding name. If the name is
-// valid, return corresponding encoding command id. Otherwise return 0;
-static int GetCommandIdByCanonicalEncodingName(
- const std::wstring& encoding_name) {
- const CanonicalEncodingNameToIdMapType* map =
- canonical_encoding_name_map_singleton.
- GetCanonicalEncodingNameToIdMapData();
- DCHECK(map);
-
- CanonicalEncodingNameToIdMapType::const_iterator found_id =
- map->find(encoding_name);
- if (found_id != map->end())
- return found_id->second;
- return 0;
-}
-
const int default_encoding_menus[] = {
IDC_ENCODING_UTF16LE,
0,
@@ -204,7 +187,8 @@ static void ParseEncodingListSeparatedWithComma(
size_t maximum_size) {
WStringTokenizer tokenizer(encoding_list, L",");
while (tokenizer.GetNext()) {
- int id = GetCommandIdByCanonicalEncodingName(tokenizer.token());
+ int id = CharacterEncoding::GetCommandIdByCanonicalEncodingName(
+ tokenizer.token());
// Ignore invalid encoding.
if (!id)
continue;
@@ -230,6 +214,21 @@ std::wstring GetEncodingDisplayName(std::wstring encoding_name,
} // namespace
// Static.
+int CharacterEncoding::GetCommandIdByCanonicalEncodingName(
+ const std::wstring& encoding_name) {
+ const CanonicalEncodingNameToIdMapType* map =
+ canonical_encoding_name_map_singleton.
+ GetCanonicalEncodingNameToIdMapData();
+ DCHECK(map);
+
+ CanonicalEncodingNameToIdMapType::const_iterator found_id =
+ map->find(encoding_name);
+ if (found_id != map->end())
+ return found_id->second;
+ return 0;
+}
+
+// Static.
std::wstring CharacterEncoding::GetCanonicalEncodingNameByCommandId(int id) {
const IdToCanonicalEncodingNameMapType* map =
canonical_encoding_name_map_singleton.