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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 ExtensionMsg_MessageInvoke::Param message_tuple; | 576 ExtensionMsg_MessageInvoke::Param message_tuple; |
577 ExtensionMsg_MessageInvoke::Read(message, &message_tuple); | 577 ExtensionMsg_MessageInvoke::Read(message, &message_tuple); |
578 ListValue& args = message_tuple.c; | 578 ListValue& args = message_tuple.c; |
579 | 579 |
580 std::string event_name; | 580 std::string event_name; |
581 if (!args.GetString(0, &event_name) || | 581 if (!args.GetString(0, &event_name) || |
582 event_name != std::string(keys::kOnSendHeaders) + "/3") { | 582 event_name != std::string(keys::kOnSendHeaders) + "/3") { |
583 continue; | 583 continue; |
584 } | 584 } |
585 | 585 |
586 std::string event_arg_string; | 586 ListValue* event_arg = NULL; |
587 ASSERT_TRUE(args.GetString(1, &event_arg_string)); | 587 ASSERT_TRUE(args.GetList(1, &event_arg)); |
588 | |
589 scoped_ptr<Value> event_arg_value( | |
590 JSONStringValueSerializer(event_arg_string).Deserialize(NULL, NULL)); | |
591 ASSERT_TRUE(event_arg_value.get() && | |
592 event_arg_value->IsType(Value::TYPE_LIST)); | |
593 | 588 |
594 DictionaryValue* event_arg_dict = NULL; | 589 DictionaryValue* event_arg_dict = NULL; |
595 ASSERT_TRUE( | 590 ASSERT_TRUE(event_arg->GetDictionary(0, &event_arg_dict)); |
596 static_cast<ListValue*>(event_arg_value.get())->GetDictionary( | |
597 0, &event_arg_dict)); | |
598 | 591 |
599 ListValue* request_headers = NULL; | 592 ListValue* request_headers = NULL; |
600 ASSERT_TRUE(event_arg_dict->GetList(keys::kRequestHeadersKey, | 593 ASSERT_TRUE(event_arg_dict->GetList(keys::kRequestHeadersKey, |
601 &request_headers)); | 594 &request_headers)); |
602 | 595 |
603 net::HttpRequestHeaders observed_headers; | 596 net::HttpRequestHeaders observed_headers; |
604 for (size_t j = 0; j < request_headers->GetSize(); ++j) { | 597 for (size_t j = 0; j < request_headers->GetSize(); ++j) { |
605 DictionaryValue* header = NULL; | 598 DictionaryValue* header = NULL; |
606 ASSERT_TRUE(request_headers->GetDictionary(j, &header)); | 599 ASSERT_TRUE(request_headers->GetDictionary(j, &header)); |
607 std::string key; | 600 std::string key; |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1525 // Check that requests are rejected if their first party url is sensitive. | 1518 // Check that requests are rejected if their first party url is sensitive. |
1526 ASSERT_GE(arraysize(non_sensitive_urls), 1u); | 1519 ASSERT_GE(arraysize(non_sensitive_urls), 1u); |
1527 GURL non_sensitive_url(non_sensitive_urls[0]); | 1520 GURL non_sensitive_url(non_sensitive_urls[0]); |
1528 for (size_t i = 0; i < arraysize(sensitive_urls); ++i) { | 1521 for (size_t i = 0; i < arraysize(sensitive_urls); ++i) { |
1529 TestURLRequest request(non_sensitive_url, NULL, &context); | 1522 TestURLRequest request(non_sensitive_url, NULL, &context); |
1530 GURL sensitive_url(sensitive_urls[i]); | 1523 GURL sensitive_url(sensitive_urls[i]); |
1531 request.set_first_party_for_cookies(sensitive_url); | 1524 request.set_first_party_for_cookies(sensitive_url); |
1532 EXPECT_TRUE(helpers::HideRequest(&request)) << sensitive_urls[i]; | 1525 EXPECT_TRUE(helpers::HideRequest(&request)) << sensitive_urls[i]; |
1533 } | 1526 } |
1534 } | 1527 } |
OLD | NEW |