| OLD | NEW |
| 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 <queue> | 5 #include <queue> |
| 6 #include <map> | 6 #include <map> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 ExtensionMsg_MessageInvoke::Param message_tuple; | 580 ExtensionMsg_MessageInvoke::Param message_tuple; |
| 581 ExtensionMsg_MessageInvoke::Read(message, &message_tuple); | 581 ExtensionMsg_MessageInvoke::Read(message, &message_tuple); |
| 582 ListValue& args = message_tuple.c; | 582 ListValue& args = message_tuple.c; |
| 583 | 583 |
| 584 std::string event_name; | 584 std::string event_name; |
| 585 if (!args.GetString(0, &event_name) || | 585 if (!args.GetString(0, &event_name) || |
| 586 event_name != std::string(keys::kOnSendHeaders) + "/3") { | 586 event_name != std::string(keys::kOnSendHeaders) + "/3") { |
| 587 continue; | 587 continue; |
| 588 } | 588 } |
| 589 | 589 |
| 590 std::string event_arg_string; | 590 ListValue* event_arg = NULL; |
| 591 ASSERT_TRUE(args.GetString(1, &event_arg_string)); | 591 ASSERT_TRUE(args.GetList(1, &event_arg)); |
| 592 | |
| 593 scoped_ptr<Value> event_arg_value( | |
| 594 JSONStringValueSerializer(event_arg_string).Deserialize(NULL, NULL)); | |
| 595 ASSERT_TRUE(event_arg_value.get() && | |
| 596 event_arg_value->IsType(Value::TYPE_LIST)); | |
| 597 | 592 |
| 598 DictionaryValue* event_arg_dict = NULL; | 593 DictionaryValue* event_arg_dict = NULL; |
| 599 ASSERT_TRUE( | 594 ASSERT_TRUE(event_arg->GetDictionary(0, &event_arg_dict)); |
| 600 static_cast<ListValue*>(event_arg_value.get())->GetDictionary( | |
| 601 0, &event_arg_dict)); | |
| 602 | 595 |
| 603 ListValue* request_headers = NULL; | 596 ListValue* request_headers = NULL; |
| 604 ASSERT_TRUE(event_arg_dict->GetList(keys::kRequestHeadersKey, | 597 ASSERT_TRUE(event_arg_dict->GetList(keys::kRequestHeadersKey, |
| 605 &request_headers)); | 598 &request_headers)); |
| 606 | 599 |
| 607 net::HttpRequestHeaders observed_headers; | 600 net::HttpRequestHeaders observed_headers; |
| 608 for (size_t j = 0; j < request_headers->GetSize(); ++j) { | 601 for (size_t j = 0; j < request_headers->GetSize(); ++j) { |
| 609 DictionaryValue* header = NULL; | 602 DictionaryValue* header = NULL; |
| 610 ASSERT_TRUE(request_headers->GetDictionary(j, &header)); | 603 ASSERT_TRUE(request_headers->GetDictionary(j, &header)); |
| 611 std::string key; | 604 std::string key; |
| (...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1640 deltas, &auth3, &conflicting_extensions, &net_log); | 1633 deltas, &auth3, &conflicting_extensions, &net_log); |
| 1641 EXPECT_TRUE(credentials_set); | 1634 EXPECT_TRUE(credentials_set); |
| 1642 EXPECT_FALSE(auth3.Empty()); | 1635 EXPECT_FALSE(auth3.Empty()); |
| 1643 EXPECT_EQ(username, auth1.username()); | 1636 EXPECT_EQ(username, auth1.username()); |
| 1644 EXPECT_EQ(password, auth1.password()); | 1637 EXPECT_EQ(password, auth1.password()); |
| 1645 EXPECT_EQ(1u, conflicting_extensions.size()); | 1638 EXPECT_EQ(1u, conflicting_extensions.size()); |
| 1646 EXPECT_TRUE(ContainsKey(conflicting_extensions, "extid2")); | 1639 EXPECT_TRUE(ContainsKey(conflicting_extensions, "extid2")); |
| 1647 EXPECT_EQ(3u, capturing_net_log.GetSize()); | 1640 EXPECT_EQ(3u, capturing_net_log.GetSize()); |
| 1648 } | 1641 } |
| 1649 | 1642 |
| OLD | NEW |