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 <map> | 5 #include <map> |
6 #include <queue> | 6 #include <queue> |
7 | 7 |
8 #include "base/basictypes.h" | |
8 #include "base/bind.h" | 9 #include "base/bind.h" |
9 #include "base/callback.h" | 10 #include "base/callback.h" |
10 #include "base/file_path.h" | 11 #include "base/file_path.h" |
11 #include "base/file_util.h" | 12 #include "base/file_util.h" |
12 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
13 #include "base/json/json_string_value_serializer.h" | 14 #include "base/json/json_string_value_serializer.h" |
14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
15 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
16 #include "base/path_service.h" | 17 #include "base/path_service.h" |
17 #include "base/prefs/public/pref_member.h" | 18 #include "base/prefs/public/pref_member.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
36 #include "chrome/test/base/testing_profile.h" | 37 #include "chrome/test/base/testing_profile.h" |
37 #include "content/public/test/test_browser_thread.h" | 38 #include "content/public/test/test_browser_thread.h" |
38 #include "net/base/auth.h" | 39 #include "net/base/auth.h" |
39 #include "net/base/capturing_net_log.h" | 40 #include "net/base/capturing_net_log.h" |
40 #include "net/base/mock_host_resolver.h" | 41 #include "net/base/mock_host_resolver.h" |
41 #include "net/base/net_util.h" | 42 #include "net/base/net_util.h" |
42 #include "net/base/upload_bytes_element_reader.h" | 43 #include "net/base/upload_bytes_element_reader.h" |
43 #include "net/base/upload_data_stream.h" | 44 #include "net/base/upload_data_stream.h" |
44 #include "net/base/upload_file_element_reader.h" | 45 #include "net/base/upload_file_element_reader.h" |
45 #include "net/url_request/url_request_test_util.h" | 46 #include "net/url_request/url_request_test_util.h" |
47 #include "testing/gtest/include/gtest/gtest-message.h" | |
46 #include "testing/gtest/include/gtest/gtest.h" | 48 #include "testing/gtest/include/gtest/gtest.h" |
47 | 49 |
48 namespace helpers = extension_web_request_api_helpers; | 50 namespace helpers = extension_web_request_api_helpers; |
49 namespace keys = extension_web_request_api_constants; | 51 namespace keys = extension_web_request_api_constants; |
50 | 52 |
51 using base::BinaryValue; | 53 using base::BinaryValue; |
52 using base::DictionaryValue; | 54 using base::DictionaryValue; |
53 using base::ListValue; | 55 using base::ListValue; |
54 using base::StringValue; | 56 using base::StringValue; |
55 using base::Time; | 57 using base::Time; |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
508 // We verify that URLRequest body is accessible to OnBeforeRequest listeners. | 510 // We verify that URLRequest body is accessible to OnBeforeRequest listeners. |
509 // These testing steps are repeated twice in a row: | 511 // These testing steps are repeated twice in a row: |
510 // 1. Register an extension requesting "requestBody" in ExtraInfoSpec and | 512 // 1. Register an extension requesting "requestBody" in ExtraInfoSpec and |
511 // file a POST URLRequest with a multipart-encoded form. See it getting | 513 // file a POST URLRequest with a multipart-encoded form. See it getting |
512 // parsed. | 514 // parsed. |
513 // 2. Do the same, but without requesting "requestBody". Nothing should be | 515 // 2. Do the same, but without requesting "requestBody". Nothing should be |
514 // parsed. | 516 // parsed. |
515 // 3. With "requestBody", fire a POST URLRequest which is not a parseable | 517 // 3. With "requestBody", fire a POST URLRequest which is not a parseable |
516 // HTML form. Raw data should be returned. | 518 // HTML form. Raw data should be returned. |
517 // 4. Do the same, but with a PUT method. Result should be the same. | 519 // 4. Do the same, but with a PUT method. Result should be the same. |
518 // Each of these steps is done once as if the channel was DEV or CANARY, | |
519 // and once as if it was BETA or STABLE. It is checked that parsed data is | |
520 // available on DEV/CANARY but not on BETA/STABLE. | |
521 const std::string kMethodPost("POST"); | 520 const std::string kMethodPost("POST"); |
522 const std::string kMethodPut("PUT"); | 521 const std::string kMethodPut("PUT"); |
523 | 522 |
524 // Input. | 523 // Input. |
525 const char kPlainBlock1[] = "abcd\n"; | 524 const char kPlainBlock1[] = "abcd\n"; |
526 const size_t kPlainBlock1Length = sizeof(kPlainBlock1) - 1; | 525 const size_t kPlainBlock1Length = sizeof(kPlainBlock1) - 1; |
527 std::vector<char> plain_1(kPlainBlock1, kPlainBlock1 + kPlainBlock1Length); | 526 std::vector<char> plain_1(kPlainBlock1, kPlainBlock1 + kPlainBlock1Length); |
528 const char kPlainBlock2[] = "1234\n"; | 527 const char kPlainBlock2[] = "1234\n"; |
529 const size_t kPlainBlock2Length = sizeof(kPlainBlock2) - 1; | 528 const size_t kPlainBlock2Length = sizeof(kPlainBlock2) - 1; |
530 std::vector<char> plain_2(kPlainBlock2, kPlainBlock2 + kPlainBlock2Length); | 529 std::vector<char> plain_2(kPlainBlock2, kPlainBlock2 + kPlainBlock2Length); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
577 extensions::subtle::AppendKeyValuePair( | 576 extensions::subtle::AppendKeyValuePair( |
578 keys::kRequestBodyRawBytesKey, | 577 keys::kRequestBodyRawBytesKey, |
579 BinaryValue::CreateWithCopiedBuffer(kPlainBlock2, kPlainBlock2Length), | 578 BinaryValue::CreateWithCopiedBuffer(kPlainBlock2, kPlainBlock2Length), |
580 &raw); | 579 &raw); |
581 // Summary. | 580 // Summary. |
582 const Value* const kExpected[] = { | 581 const Value* const kExpected[] = { |
583 form_data.get(), | 582 form_data.get(), |
584 NULL, | 583 NULL, |
585 &raw, | 584 &raw, |
586 &raw, | 585 &raw, |
587 NULL, NULL, NULL, NULL // These are for the disabled cases. | |
588 }; | 586 }; |
587 COMPILE_ASSERT(arraysize(kPath) == arraysize(kExpected), | |
588 the_arrays_kPath_and_kExpected_need_to_be_the_same_size); | |
589 // Header. | 589 // Header. |
590 const char kMultipart[] = "multipart/form-data; boundary=" kBoundary; | 590 const char kMultipart[] = "multipart/form-data; boundary=" kBoundary; |
591 #undef kBoundary | 591 #undef kBoundary |
592 | 592 |
593 // Set up a dummy extension name. | 593 // Set up a dummy extension name. |
594 const std::string kEventName(keys::kOnBeforeRequestEvent); | 594 const std::string kEventName(keys::kOnBeforeRequestEvent); |
595 ExtensionWebRequestEventRouter::RequestFilter filter; | 595 ExtensionWebRequestEventRouter::RequestFilter filter; |
596 std::string extension_id("1"); | 596 std::string extension_id("1"); |
597 const std::string string_spec_post("blocking,requestBody"); | 597 const std::string string_spec_post("blocking,requestBody"); |
598 const std::string string_spec_no_post("blocking"); | 598 const std::string string_spec_no_post("blocking"); |
599 int extra_info_spec_empty = 0; | 599 int extra_info_spec_empty = 0; |
600 int extra_info_spec_body = 0; | 600 int extra_info_spec_body = 0; |
601 base::WeakPtrFactory<TestIPCSender> ipc_sender_factory(&ipc_sender_); | 601 base::WeakPtrFactory<TestIPCSender> ipc_sender_factory(&ipc_sender_); |
602 | 602 |
603 // All the tests are done twice, once with the release channel pretending to | 603 // Part 1. |
vabr (Chromium)
2013/01/28 10:26:14
In this block I only removed the for loop, the add
| |
604 // be one of DEV/CANARY, once BETA/STABLE. Hence two passes. | 604 // Subscribe to OnBeforeRequest with requestBody requirement. |
605 for (int pass = 0; pass < 2; ++pass) { | 605 ASSERT_TRUE(GenerateInfoSpec(string_spec_post, &extra_info_spec_body)); |
606 { | 606 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( |
607 Feature::ScopedCurrentChannel sc( | 607 &profile_, extension_id, extension_id, kEventName, kEventName + "/1", |
608 pass > 0 ? VersionInfo::CHANNEL_BETA : VersionInfo::CHANNEL_CANARY); | 608 filter, extra_info_spec_body, -1, -1, |
609 ipc_sender_factory.GetWeakPtr()); | |
609 | 610 |
610 // Part 1. | 611 FireURLRequestWithData(kMethodPost, kMultipart, form_1, form_2); |
611 // Subscribe to OnBeforeRequest with requestBody requirement. | |
612 ASSERT_TRUE(GenerateInfoSpec(string_spec_post, &extra_info_spec_body)); | |
613 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( | |
614 &profile_, extension_id, extension_id, kEventName, kEventName + "/1", | |
615 filter, extra_info_spec_body, -1, -1, | |
616 ipc_sender_factory.GetWeakPtr()); | |
617 | 612 |
618 FireURLRequestWithData(kMethodPost, kMultipart, form_1, form_2); | 613 // We inspect the result in the message list of |ipc_sender_| later. |
614 MessageLoop::current()->RunUntilIdle(); | |
619 | 615 |
620 // We inspect the result in the message list of |ipc_sender_| later. | 616 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( |
621 MessageLoop::current()->RunUntilIdle(); | 617 &profile_, extension_id, kEventName + "/1"); |
622 | 618 |
623 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( | 619 // Part 2. |
624 &profile_, extension_id, kEventName + "/1"); | 620 // Now subscribe to OnBeforeRequest *without* the requestBody requirement. |
625 } | 621 ASSERT_TRUE( |
622 GenerateInfoSpec(string_spec_no_post, &extra_info_spec_empty)); | |
623 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( | |
624 &profile_, extension_id, extension_id, kEventName, kEventName + "/1", | |
625 filter, extra_info_spec_empty, -1, -1, | |
626 ipc_sender_factory.GetWeakPtr()); | |
626 | 627 |
627 { | 628 FireURLRequestWithData(kMethodPost, kMultipart, form_1, form_2); |
628 Feature::ScopedCurrentChannel sc( | |
629 pass > 0 ? VersionInfo::CHANNEL_STABLE : VersionInfo::CHANNEL_DEV); | |
630 | 629 |
631 // Part 2. | 630 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( |
632 // Now subscribe to OnBeforeRequest *without* the requestBody requirement. | 631 &profile_, extension_id, kEventName + "/1"); |
633 ASSERT_TRUE( | |
634 GenerateInfoSpec(string_spec_no_post, &extra_info_spec_empty)); | |
635 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( | |
636 &profile_, extension_id, extension_id, kEventName, kEventName + "/1", | |
637 filter, extra_info_spec_empty, -1, -1, | |
638 ipc_sender_factory.GetWeakPtr()); | |
639 | 632 |
640 FireURLRequestWithData(kMethodPost, kMultipart, form_1, form_2); | 633 // Subscribe to OnBeforeRequest with requestBody requirement. |
634 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( | |
635 &profile_, extension_id, extension_id, kEventName, kEventName + "/1", | |
636 filter, extra_info_spec_body, -1, -1, | |
637 ipc_sender_factory.GetWeakPtr()); | |
641 | 638 |
642 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( | 639 // Part 3. |
643 &profile_, extension_id, kEventName + "/1"); | 640 // Now send a POST request with body which is not parseable as a form. |
644 } | 641 FireURLRequestWithData(kMethodPost, NULL /*no header*/, plain_1, plain_2); |
645 | 642 |
646 { | 643 // Part 4. |
647 Feature::ScopedCurrentChannel sc( | 644 // Now send a PUT request with the same body as above. |
648 pass > 0 ? VersionInfo::CHANNEL_STABLE : VersionInfo::CHANNEL_DEV); | 645 FireURLRequestWithData(kMethodPut, NULL /*no header*/, plain_1, plain_2); |
649 | 646 |
650 // Subscribe to OnBeforeRequest with requestBody requirement. | 647 MessageLoop::current()->RunUntilIdle(); |
651 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( | |
652 &profile_, extension_id, extension_id, kEventName, kEventName + "/1", | |
653 filter, extra_info_spec_body, -1, -1, | |
654 ipc_sender_factory.GetWeakPtr()); | |
655 | 648 |
656 // Part 3. | 649 // Clean-up. |
657 // Now send a POST request with body which is not parseable as a form. | 650 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( |
658 FireURLRequestWithData(kMethodPost, NULL /*no header*/, plain_1, plain_2); | 651 &profile_, extension_id, kEventName + "/1"); |
659 | |
660 // Part 4. | |
661 // Now send a PUT request with the same body as above. | |
662 FireURLRequestWithData(kMethodPut, NULL /*no header*/, plain_1, plain_2); | |
663 | |
664 MessageLoop::current()->RunUntilIdle(); | |
665 | |
666 // Clean-up. | |
667 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( | |
668 &profile_, extension_id, kEventName + "/1"); | |
669 } | |
670 } | |
671 | 652 |
672 IPC::Message* message = NULL; | 653 IPC::Message* message = NULL; |
673 TestIPCSender::SentMessages::const_iterator i = ipc_sender_.sent_begin(); | 654 TestIPCSender::SentMessages::const_iterator i = ipc_sender_.sent_begin(); |
674 for (size_t test = 0; test < arraysize(kExpected); ++test) { | 655 for (size_t test = 0; test < arraysize(kExpected); ++test) { |
656 SCOPED_TRACE(testing::Message("iteration number ") << test); | |
675 EXPECT_NE(i, ipc_sender_.sent_end()); | 657 EXPECT_NE(i, ipc_sender_.sent_end()); |
676 message = (i++)->get(); | 658 message = (i++)->get(); |
677 const DictionaryValue* details; | 659 const DictionaryValue* details; |
678 ExtensionMsg_MessageInvoke::Param param; | 660 ExtensionMsg_MessageInvoke::Param param; |
679 GetPartOfMessageArguments(message, &details, ¶m); | 661 GetPartOfMessageArguments(message, &details, ¶m); |
680 ASSERT_TRUE(details != NULL); | 662 ASSERT_TRUE(details != NULL); |
681 const Value* result = NULL; | 663 const Value* result = NULL; |
682 EXPECT_EQ( | 664 if (kExpected[test]) { |
683 kExpected[test] != NULL, | 665 EXPECT_TRUE(details->Get(*(kPath[test]), &result)); |
684 details->Get(*(kPath[test % arraysize(kPath)]), &result)); | |
685 if (kExpected[test] != NULL) { | |
686 EXPECT_TRUE(kExpected[test]->Equals(result)); | 666 EXPECT_TRUE(kExpected[test]->Equals(result)); |
667 } else { | |
668 EXPECT_FALSE(details->Get(*(kPath[test]), &result)); | |
687 } | 669 } |
688 } | 670 } |
689 | 671 |
690 EXPECT_EQ(i, ipc_sender_.sent_end()); | 672 EXPECT_EQ(i, ipc_sender_.sent_end()); |
691 } | 673 } |
692 | 674 |
693 TEST_F(ExtensionWebRequestTest, NoAccessRequestBodyData) { | 675 TEST_F(ExtensionWebRequestTest, NoAccessRequestBodyData) { |
694 // We verify that URLRequest body is NOT accessible to OnBeforeRequest | 676 // We verify that URLRequest body is NOT accessible to OnBeforeRequest |
695 // listeners when the type of the request is different from POST or PUT, or | 677 // listeners when the type of the request is different from POST or PUT, or |
696 // when the request body is empty. 3 requests are fired, without upload data, | 678 // when the request body is empty. 3 requests are fired, without upload data, |
697 // a POST, PUT and GET request. For none of them the "requestBody" object | 679 // a POST, PUT and GET request. For none of them the "requestBody" object |
698 // property should be present in the details passed to the onBeforeRequest | 680 // property should be present in the details passed to the onBeforeRequest |
699 // event listener. | 681 // event listener. |
700 const char* kMethods[] = { "POST", "PUT", "GET" }; | 682 const char* kMethods[] = { "POST", "PUT", "GET" }; |
701 | 683 |
702 // Set up a dummy extension name. | 684 // Set up a dummy extension name. |
703 const std::string kEventName(keys::kOnBeforeRequestEvent); | 685 const std::string kEventName(keys::kOnBeforeRequestEvent); |
704 ExtensionWebRequestEventRouter::RequestFilter filter; | 686 ExtensionWebRequestEventRouter::RequestFilter filter; |
705 const std::string extension_id("1"); | 687 const std::string extension_id("1"); |
706 int extra_info_spec = 0; | 688 int extra_info_spec = 0; |
707 ASSERT_TRUE(GenerateInfoSpec("blocking,requestBody", &extra_info_spec)); | 689 ASSERT_TRUE(GenerateInfoSpec("blocking,requestBody", &extra_info_spec)); |
708 base::WeakPtrFactory<TestIPCSender> ipc_sender_factory(&ipc_sender_); | 690 base::WeakPtrFactory<TestIPCSender> ipc_sender_factory(&ipc_sender_); |
709 | 691 |
710 // We need to pretend to be on CANARY or DEV for the "requestBody" to work. | |
711 Feature::ScopedCurrentChannel sc(VersionInfo::CHANNEL_CANARY); | |
712 | |
713 // Subscribe to OnBeforeRequest with requestBody requirement. | 692 // Subscribe to OnBeforeRequest with requestBody requirement. |
714 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( | 693 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( |
715 &profile_, extension_id, extension_id, kEventName, kEventName + "/1", | 694 &profile_, extension_id, extension_id, kEventName, kEventName + "/1", |
716 filter, extra_info_spec, -1, -1, ipc_sender_factory.GetWeakPtr()); | 695 filter, extra_info_spec, -1, -1, ipc_sender_factory.GetWeakPtr()); |
717 | 696 |
718 // The request URL can be arbitrary but must have an HTTP or HTTPS scheme. | 697 // The request URL can be arbitrary but must have an HTTP or HTTPS scheme. |
719 const GURL request_url("http://www.example.com"); | 698 const GURL request_url("http://www.example.com"); |
720 | 699 |
721 for (size_t i = 0; i < arraysize(kMethods); ++i) { | 700 for (size_t i = 0; i < arraysize(kMethods); ++i) { |
722 net::URLRequest request(request_url, &delegate_, context_.get()); | 701 net::URLRequest request(request_url, &delegate_, context_.get()); |
723 request.set_method(kMethods[i]); | 702 request.set_method(kMethods[i]); |
724 ipc_sender_.PushTask(base::Bind(&base::DoNothing)); | 703 ipc_sender_.PushTask(base::Bind(&base::DoNothing)); |
725 request.Start(); | 704 request.Start(); |
726 } | 705 } |
727 | 706 |
728 // We inspect the result in the message list of |ipc_sender_| later. | 707 // We inspect the result in the message list of |ipc_sender_| later. |
729 MessageLoop::current()->RunUntilIdle(); | 708 MessageLoop::current()->RunUntilIdle(); |
730 | 709 |
731 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( | 710 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( |
732 &profile_, extension_id, kEventName + "/1"); | 711 &profile_, extension_id, kEventName + "/1"); |
733 | 712 |
734 TestIPCSender::SentMessages::const_iterator i = ipc_sender_.sent_begin(); | 713 TestIPCSender::SentMessages::const_iterator i = ipc_sender_.sent_begin(); |
735 for (size_t test = 0; test < arraysize(kMethods); ++test, ++i) { | 714 for (size_t test = 0; test < arraysize(kMethods); ++test, ++i) { |
715 SCOPED_TRACE(testing::Message("iteration number ") << test); | |
736 EXPECT_NE(i, ipc_sender_.sent_end()); | 716 EXPECT_NE(i, ipc_sender_.sent_end()); |
737 IPC::Message* message = i->get(); | 717 IPC::Message* message = i->get(); |
738 const DictionaryValue* details = NULL; | 718 const DictionaryValue* details = NULL; |
739 ExtensionMsg_MessageInvoke::Param param; | 719 ExtensionMsg_MessageInvoke::Param param; |
740 GetPartOfMessageArguments(message, &details, ¶m); | 720 GetPartOfMessageArguments(message, &details, ¶m); |
741 ASSERT_TRUE(details != NULL); | 721 ASSERT_TRUE(details != NULL); |
742 EXPECT_FALSE(details->HasKey(keys::kRequestBodyKey)) | 722 EXPECT_FALSE(details->HasKey(keys::kRequestBodyKey)); |
743 << "Failed during iteration number " << test << "."; | |
744 } | 723 } |
745 | 724 |
746 EXPECT_EQ(i, ipc_sender_.sent_end()); | 725 EXPECT_EQ(i, ipc_sender_.sent_end()); |
747 } | 726 } |
748 | 727 |
749 struct HeaderModificationTest_Header { | 728 struct HeaderModificationTest_Header { |
750 const char* name; | 729 const char* name; |
751 const char* value; | 730 const char* value; |
752 }; | 731 }; |
753 | 732 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
988 true, | 967 true, |
989 ExtensionWebRequestEventRouter::ExtraInfoSpec::RESPONSE_HEADERS); | 968 ExtensionWebRequestEventRouter::ExtraInfoSpec::RESPONSE_HEADERS); |
990 TestInitFromValue( | 969 TestInitFromValue( |
991 "blocking", | 970 "blocking", |
992 true, | 971 true, |
993 ExtensionWebRequestEventRouter::ExtraInfoSpec::BLOCKING); | 972 ExtensionWebRequestEventRouter::ExtraInfoSpec::BLOCKING); |
994 TestInitFromValue( | 973 TestInitFromValue( |
995 "asyncBlocking", | 974 "asyncBlocking", |
996 true, | 975 true, |
997 ExtensionWebRequestEventRouter::ExtraInfoSpec::ASYNC_BLOCKING); | 976 ExtensionWebRequestEventRouter::ExtraInfoSpec::ASYNC_BLOCKING); |
998 { | 977 TestInitFromValue( |
999 Feature::ScopedCurrentChannel sc(VersionInfo::CHANNEL_BETA); | 978 "requestBody", |
1000 TestInitFromValue( | 979 true, |
1001 "requestBody", | 980 ExtensionWebRequestEventRouter::ExtraInfoSpec::REQUEST_BODY); |
1002 true, | |
1003 0); | |
1004 } | |
1005 { | |
1006 Feature::ScopedCurrentChannel sc(VersionInfo::CHANNEL_DEV); | |
1007 TestInitFromValue( | |
1008 "requestBody", | |
1009 true, | |
1010 ExtensionWebRequestEventRouter::ExtraInfoSpec::REQUEST_BODY); | |
1011 } | |
1012 | 981 |
1013 // Multiple valid values are bitwise-or'ed. | 982 // Multiple valid values are bitwise-or'ed. |
1014 TestInitFromValue( | 983 TestInitFromValue( |
1015 "requestHeaders,blocking", | 984 "requestHeaders,blocking", |
1016 true, | 985 true, |
1017 ExtensionWebRequestEventRouter::ExtraInfoSpec::REQUEST_HEADERS | | 986 ExtensionWebRequestEventRouter::ExtraInfoSpec::REQUEST_HEADERS | |
1018 ExtensionWebRequestEventRouter::ExtraInfoSpec::BLOCKING); | 987 ExtensionWebRequestEventRouter::ExtraInfoSpec::BLOCKING); |
1019 | 988 |
1020 // Any invalid values lead to a bad parse. | 989 // Any invalid values lead to a bad parse. |
1021 TestInitFromValue("invalidValue", false, 0); | 990 TestInitFromValue("invalidValue", false, 0); |
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2149 EXPECT_TRUE(credentials_set); | 2118 EXPECT_TRUE(credentials_set); |
2150 EXPECT_FALSE(auth3.Empty()); | 2119 EXPECT_FALSE(auth3.Empty()); |
2151 EXPECT_EQ(username, auth1.username()); | 2120 EXPECT_EQ(username, auth1.username()); |
2152 EXPECT_EQ(password, auth1.password()); | 2121 EXPECT_EQ(password, auth1.password()); |
2153 EXPECT_EQ(1u, warning_set.size()); | 2122 EXPECT_EQ(1u, warning_set.size()); |
2154 EXPECT_TRUE(HasWarning(warning_set, "extid2")); | 2123 EXPECT_TRUE(HasWarning(warning_set, "extid2")); |
2155 EXPECT_EQ(3u, capturing_net_log.GetSize()); | 2124 EXPECT_EQ(3u, capturing_net_log.GetSize()); |
2156 } | 2125 } |
2157 | 2126 |
2158 } // namespace extensions | 2127 } // namespace extensions |
OLD | NEW |