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

Unified Diff: chrome/browser/extensions/menu_manager_unittest.cc

Issue 10694085: Refactor extension event distribution to use Values instead of JSON strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and review changes. Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/menu_manager_unittest.cc
diff --git a/chrome/browser/extensions/menu_manager_unittest.cc b/chrome/browser/extensions/menu_manager_unittest.cc
index fb238e862ff6afb0568a58e7fc96bbc5665d7ed6..2a72944d2eb949c18f852e08f88d4332410054d5 100644
--- a/chrome/browser/extensions/menu_manager_unittest.cc
+++ b/chrome/browser/extensions/menu_manager_unittest.cc
@@ -378,7 +378,7 @@ class MockExtensionEventRouter : public ExtensionEventRouter {
MOCK_METHOD6(DispatchEventToExtension,
void(const std::string& extension_id,
const std::string& event_name,
- const std::string& event_args,
+ base::ListValue* event_args,
Profile* source_profile,
const GURL& event_url,
ExtensionEventRouter::UserGestureState state));
@@ -474,7 +474,7 @@ TEST_F(MenuManagerTest, ExecuteCommand) {
// Use the magic of googlemock to save a parameter to our mock's
// DispatchEventToExtension method into event_args.
- std::string event_args;
+ base::ListValue* list = NULL;
{
InSequence s;
EXPECT_CALL(*mock_event_router.get(),
@@ -486,7 +486,7 @@ TEST_F(MenuManagerTest, ExecuteCommand) {
GURL(),
ExtensionEventRouter::USER_GESTURE_ENABLED))
.Times(1)
- .WillOnce(SaveArg<2>(&event_args));
+ .WillOnce(SaveArg<2>(&list));
EXPECT_CALL(*mock_event_router.get(),
DispatchEventToExtension(
item->extension_id(),
@@ -499,15 +499,6 @@ TEST_F(MenuManagerTest, ExecuteCommand) {
}
manager_.ExecuteCommand(&profile, NULL /* tab_contents */, params, id);
- // Parse the json event_args, which should turn into a 2-element list where
- // the first element is a dictionary we want to inspect for the correct
- // values.
- scoped_ptr<Value> result(
- base::JSONReader::Read(event_args, base::JSON_ALLOW_TRAILING_COMMAS));
- Value* value = result.get();
- ASSERT_TRUE(result.get() != NULL);
- ASSERT_EQ(Value::TYPE_LIST, value->GetType());
- ListValue* list = static_cast<ListValue*>(value);
ASSERT_EQ(2u, list->GetSize());
DictionaryValue* info;

Powered by Google App Engine
This is Rietveld 408576698