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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api_unittest.cc

Issue 15855010: Make ExtensionMsg_MessageInvoke run a module system function rather than a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test compile Created 7 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <map> 5 #include <map>
6 #include <queue> 6 #include <queue>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return false; 113 return false;
114 } 114 }
115 115
116 // Parses the JSON data attached to the |message| and tries to return it. 116 // Parses the JSON data attached to the |message| and tries to return it.
117 // |param| must outlive |out|. Returns NULL on failure. 117 // |param| must outlive |out|. Returns NULL on failure.
118 void GetPartOfMessageArguments(IPC::Message* message, 118 void GetPartOfMessageArguments(IPC::Message* message,
119 const DictionaryValue** out, 119 const DictionaryValue** out,
120 ExtensionMsg_MessageInvoke::Param* param) { 120 ExtensionMsg_MessageInvoke::Param* param) {
121 ASSERT_EQ(ExtensionMsg_MessageInvoke::ID, message->type()); 121 ASSERT_EQ(ExtensionMsg_MessageInvoke::ID, message->type());
122 ASSERT_TRUE(ExtensionMsg_MessageInvoke::Read(message, param)); 122 ASSERT_TRUE(ExtensionMsg_MessageInvoke::Read(message, param));
123 ASSERT_GE(param->c.GetSize(), 2u); 123 ASSERT_GE(param->d.GetSize(), 2u);
124 const Value* value = NULL; 124 const Value* value = NULL;
125 ASSERT_TRUE(param->c.Get(1, &value)); 125 ASSERT_TRUE(param->d.Get(1, &value));
126 const ListValue* list = NULL; 126 const ListValue* list = NULL;
127 ASSERT_TRUE(value->GetAsList(&list)); 127 ASSERT_TRUE(value->GetAsList(&list));
128 ASSERT_EQ(1u, list->GetSize()); 128 ASSERT_EQ(1u, list->GetSize());
129 ASSERT_TRUE(list->GetDictionary(0, out)); 129 ASSERT_TRUE(list->GetDictionary(0, out));
130 } 130 }
131 131
132 } // namespace 132 } // namespace
133 133
134 // A mock event router that responds to events with a pre-arranged queue of 134 // A mock event router that responds to events with a pre-arranged queue of
135 // Tasks. 135 // Tasks.
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 909
910 // Search the onSendHeaders signal in the IPC messages and check that 910 // Search the onSendHeaders signal in the IPC messages and check that
911 // it contained the correct headers. 911 // it contained the correct headers.
912 TestIPCSender::SentMessages::const_iterator i; 912 TestIPCSender::SentMessages::const_iterator i;
913 for (i = ipc_sender_.sent_begin(); i != ipc_sender_.sent_end(); ++i) { 913 for (i = ipc_sender_.sent_begin(); i != ipc_sender_.sent_end(); ++i) {
914 IPC::Message* message = i->get(); 914 IPC::Message* message = i->get();
915 if (ExtensionMsg_MessageInvoke::ID != message->type()) 915 if (ExtensionMsg_MessageInvoke::ID != message->type())
916 continue; 916 continue;
917 ExtensionMsg_MessageInvoke::Param message_tuple; 917 ExtensionMsg_MessageInvoke::Param message_tuple;
918 ExtensionMsg_MessageInvoke::Read(message, &message_tuple); 918 ExtensionMsg_MessageInvoke::Read(message, &message_tuple);
919 ListValue& args = message_tuple.c; 919 ListValue& args = message_tuple.d;
920 920
921 std::string event_name; 921 std::string event_name;
922 if (!args.GetString(0, &event_name) || 922 if (!args.GetString(0, &event_name) ||
923 event_name != std::string(keys::kOnSendHeadersEvent) + "/3") { 923 event_name != std::string(keys::kOnSendHeadersEvent) + "/3") {
924 continue; 924 continue;
925 } 925 }
926 926
927 ListValue* event_arg = NULL; 927 ListValue* event_arg = NULL;
928 ASSERT_TRUE(args.GetList(1, &event_arg)); 928 ASSERT_TRUE(args.GetList(1, &event_arg));
929 929
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 EXPECT_TRUE(credentials_set); 2133 EXPECT_TRUE(credentials_set);
2134 EXPECT_FALSE(auth3.Empty()); 2134 EXPECT_FALSE(auth3.Empty());
2135 EXPECT_EQ(username, auth1.username()); 2135 EXPECT_EQ(username, auth1.username());
2136 EXPECT_EQ(password, auth1.password()); 2136 EXPECT_EQ(password, auth1.password());
2137 EXPECT_EQ(1u, warning_set.size()); 2137 EXPECT_EQ(1u, warning_set.size());
2138 EXPECT_TRUE(HasWarning(warning_set, "extid2")); 2138 EXPECT_TRUE(HasWarning(warning_set, "extid2"));
2139 EXPECT_EQ(3u, capturing_net_log.GetSize()); 2139 EXPECT_EQ(3u, capturing_net_log.GetSize());
2140 } 2140 }
2141 2141
2142 } // namespace extensions 2142 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc ('k') | chrome/browser/extensions/app_window_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698