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

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

Issue 570007: Replace __MSG_some_name__ template within extension css/html files with local... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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"
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 std::string error; 383 std::string error;
384 EXPECT_EQ(test_cases[i].pass, 384 EXPECT_EQ(test_cases[i].pass,
385 ExtensionMessageBundle::ReplaceVariables(messages, 385 ExtensionMessageBundle::ReplaceVariables(messages,
386 test_cases[i].begin_delimiter, 386 test_cases[i].begin_delimiter,
387 test_cases[i].end_delimiter, 387 test_cases[i].end_delimiter,
388 &text, 388 &text,
389 &error)); 389 &error));
390 EXPECT_EQ(test_cases[i].result, text); 390 EXPECT_EQ(test_cases[i].result, text);
391 } 391 }
392 } 392 }
393
394 ///////////////////////////////////////////////////////////////////////////////
395 //
396 // Renderer helper functions test.
397 //
398 ///////////////////////////////////////////////////////////////////////////////
399
400 TEST(GetExtensionToL10nMessagesMapTest, ReturnsTheSameObject) {
401 ExtensionToL10nMessagesMap* map1 = GetExtensionToL10nMessagesMap();
402 ASSERT_TRUE(NULL != map1);
403
404 ExtensionToL10nMessagesMap* map2 = GetExtensionToL10nMessagesMap();
405 ASSERT_EQ(map1, map2);
406 }
407
408 TEST(GetExtensionToL10nMessagesMapTest, ReturnsNullForUnknownExtensionId) {
409 const std::string extension_id("some_unique_12334212314234_id");
410 L10nMessagesMap* map = GetL10nMessagesMap(extension_id);
411 EXPECT_TRUE(NULL == map);
412 }
413
414 TEST(GetExtensionToL10nMessagesMapTest, ReturnsMapForKnownExtensionId) {
415 const std::string extension_id("some_unique_121212121212121_id");
416 // Store a map for given id.
417 L10nMessagesMap messages;
418 messages.insert(std::make_pair("message_name", "message_value"));
419 (*GetExtensionToL10nMessagesMap())[extension_id] = messages;
420
421 L10nMessagesMap* map = GetL10nMessagesMap(extension_id);
422 ASSERT_TRUE(NULL != map);
423 EXPECT_EQ(1U, map->size());
424 EXPECT_EQ("message_value", (*map)["message_name"]);
425 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_message_bundle.cc ('k') | chrome/common/extensions/extension_message_filter_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698