| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 | 9 |
| 10 #include "chrome/browser/extensions/extension_event_router_forwarder.h" | 10 #include "chrome/browser/extensions/extension_event_router_forwarder.h" |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 if (!args.GetString(0, &event_name) || | 470 if (!args.GetString(0, &event_name) || |
| 471 event_name != std::string(keys::kOnSendHeaders) + "/3") { | 471 event_name != std::string(keys::kOnSendHeaders) + "/3") { |
| 472 continue; | 472 continue; |
| 473 } | 473 } |
| 474 | 474 |
| 475 std::string event_arg_string; | 475 std::string event_arg_string; |
| 476 ASSERT_TRUE(args.GetString(1, &event_arg_string)); | 476 ASSERT_TRUE(args.GetString(1, &event_arg_string)); |
| 477 | 477 |
| 478 scoped_ptr<Value> event_arg_value( | 478 scoped_ptr<Value> event_arg_value( |
| 479 JSONStringValueSerializer(event_arg_string).Deserialize(NULL, NULL)); | 479 JSONStringValueSerializer(event_arg_string).Deserialize(NULL, NULL)); |
| 480 ASSERT_TRUE(event_arg_value.get()); | 480 ASSERT_TRUE(event_arg_value.get() && |
| 481 ListValue* list = event_arg_value->AsList(); | 481 event_arg_value->IsType(Value::TYPE_LIST)); |
| 482 ASSERT_TRUE(list); | |
| 483 | 482 |
| 484 DictionaryValue* event_arg_dict = NULL; | 483 DictionaryValue* event_arg_dict = NULL; |
| 485 ASSERT_TRUE(list->GetDictionary(0, &event_arg_dict)); | 484 ASSERT_TRUE( |
| 485 static_cast<ListValue*>(event_arg_value.get())->GetDictionary( |
| 486 0, &event_arg_dict)); |
| 486 | 487 |
| 487 ListValue* request_headers = NULL; | 488 ListValue* request_headers = NULL; |
| 488 ASSERT_TRUE(event_arg_dict->GetList(keys::kRequestHeadersKey, | 489 ASSERT_TRUE(event_arg_dict->GetList(keys::kRequestHeadersKey, |
| 489 &request_headers)); | 490 &request_headers)); |
| 490 | 491 |
| 491 net::HttpRequestHeaders observed_headers; | 492 net::HttpRequestHeaders observed_headers; |
| 492 for (size_t j = 0; j < request_headers->GetSize(); ++j) { | 493 for (size_t j = 0; j < request_headers->GetSize(); ++j) { |
| 493 DictionaryValue* header = NULL; | 494 DictionaryValue* header = NULL; |
| 494 ASSERT_TRUE(request_headers->GetDictionary(j, &header)); | 495 ASSERT_TRUE(request_headers->GetDictionary(j, &header)); |
| 495 std::string key; | 496 std::string key; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 {"header2", "bar"} } | 645 {"header2", "bar"} } |
| 645 }, | 646 }, |
| 646 }; | 647 }; |
| 647 | 648 |
| 648 INSTANTIATE_TEST_CASE_P( | 649 INSTANTIATE_TEST_CASE_P( |
| 649 ExtensionWebRequest, | 650 ExtensionWebRequest, |
| 650 ExtensionWebRequestHeaderModificationTest, | 651 ExtensionWebRequestHeaderModificationTest, |
| 651 ::testing::ValuesIn(kTests)); | 652 ::testing::ValuesIn(kTests)); |
| 652 | 653 |
| 653 } // namespace | 654 } // namespace |
| OLD | NEW |