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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/pickle.h" | 11 #include "base/pickle.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "base/test/histogram_tester.h" | 13 #include "base/test/histogram_tester.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "chrome/browser/history/history_service_factory.h" | 15 #include "chrome/browser/history/history_service_factory.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 17 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
18 #include "chrome/browser/safe_browsing/ui_manager.h" | 18 #include "chrome/browser/safe_browsing/ui_manager.h" |
19 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 19 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
20 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
21 #include "components/history/core/browser/history_backend.h" | 21 #include "components/history/core/browser/history_backend.h" |
22 #include "components/history/core/browser/history_service.h" | 22 #include "components/history/core/browser/history_service.h" |
23 #include "components/safe_browsing/browser/threat_details.h" | 23 #include "components/safe_browsing/browser/threat_details.h" |
24 #include "components/safe_browsing/browser/threat_details_history.h" | 24 #include "components/safe_browsing/browser/threat_details_history.h" |
25 #include "components/safe_browsing/common/safebrowsing_messages.h" | 25 #include "components/safe_browsing/common/safebrowsing_messages.h" |
26 #include "components/safe_browsing/csd.pb.h" | 26 #include "components/safe_browsing/csd.pb.h" |
27 #include "content/public/browser/render_process_host.h" | 27 #include "content/public/browser/render_process_host.h" |
28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
29 #include "content/public/test/web_contents_tester.h" | 29 #include "content/public/test/web_contents_tester.h" |
30 #include "content/test/test_render_frame_host.h" | |
30 #include "net/base/io_buffer.h" | 31 #include "net/base/io_buffer.h" |
31 #include "net/base/net_errors.h" | 32 #include "net/base/net_errors.h" |
32 #include "net/base/test_completion_callback.h" | 33 #include "net/base/test_completion_callback.h" |
33 #include "net/disk_cache/disk_cache.h" | 34 #include "net/disk_cache/disk_cache.h" |
34 #include "net/http/http_cache.h" | 35 #include "net/http/http_cache.h" |
35 #include "net/http/http_response_headers.h" | 36 #include "net/http/http_response_headers.h" |
36 #include "net/http/http_response_info.h" | 37 #include "net/http/http_response_info.h" |
37 #include "net/http/http_util.h" | 38 #include "net/http/http_util.h" |
38 #include "net/url_request/url_request_context.h" | 39 #include "net/url_request/url_request_context.h" |
39 #include "net/url_request/url_request_context_getter.h" | 40 #include "net/url_request/url_request_context_getter.h" |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
539 } | 540 } |
540 | 541 |
541 // Tests creating a threat report when receiving data from multiple renderers. | 542 // Tests creating a threat report when receiving data from multiple renderers. |
542 // We use three layers in this test: | 543 // We use three layers in this test: |
543 // kDOMParentURL | 544 // kDOMParentURL |
544 // \- <div id=outer> | 545 // \- <div id=outer> |
545 // \- <iframe src=kDOMChildURL foo=bar> | 546 // \- <iframe src=kDOMChildURL foo=bar> |
546 // \- <div id=inner bar=baz/> - div and script are at the same level. | 547 // \- <div id=inner bar=baz/> - div and script are at the same level. |
547 // \- <script src=kDOMChildURL2> | 548 // \- <script src=kDOMChildURL2> |
548 TEST_F(ThreatDetailsTest, ThreatDOMDetails_MultipleFrames) { | 549 TEST_F(ThreatDetailsTest, ThreatDOMDetails_MultipleFrames) { |
550 // Create a child renderer inside the main frame to house the inner iframe. | |
551 // Perform the navigation first in order to manipulate the frame tree. | |
552 content::WebContentsTester::For(web_contents()) | |
553 ->NavigateAndCommit(GURL(kLandingURL)); | |
554 content::TestRenderFrameHost* test_main_rfh = | |
Charlie Reis
2017/05/12 21:40:50
TestRenderFrameHost isn't a content/public class,
lpz
2017/05/15 18:49:07
Ahh great, thanks
| |
555 static_cast<content::TestRenderFrameHost*>(main_rfh()); | |
556 content::TestRenderFrameHost* child_rfh = | |
557 test_main_rfh->AppendChild("subframe"); | |
558 | |
549 // Define two sets of DOM nodes - one for an outer page containing an iframe, | 559 // Define two sets of DOM nodes - one for an outer page containing an iframe, |
550 // and then another for the inner page containing the contents of that iframe. | 560 // and then another for the inner page containing the contents of that iframe. |
551 std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node> outer_params; | 561 std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node> outer_params; |
552 SafeBrowsingHostMsg_ThreatDOMDetails_Node outer_child_div; | 562 SafeBrowsingHostMsg_ThreatDOMDetails_Node outer_child_div; |
553 outer_child_div.node_id = 1; | 563 outer_child_div.node_id = 1; |
554 outer_child_div.child_node_ids.push_back(2); | 564 outer_child_div.child_node_ids.push_back(2); |
555 outer_child_div.tag_name = "div"; | 565 outer_child_div.tag_name = "div"; |
556 outer_child_div.parent = GURL(kDOMParentURL); | 566 outer_child_div.parent = GURL(kDOMParentURL); |
557 outer_child_div.attributes.push_back(std::make_pair("id", "outer")); | 567 outer_child_div.attributes.push_back(std::make_pair("id", "outer")); |
558 outer_params.push_back(outer_child_div); | 568 outer_params.push_back(outer_child_div); |
559 | 569 |
560 SafeBrowsingHostMsg_ThreatDOMDetails_Node outer_child_iframe; | 570 SafeBrowsingHostMsg_ThreatDOMDetails_Node outer_child_iframe; |
561 outer_child_iframe.node_id = 2; | 571 outer_child_iframe.node_id = 2; |
562 outer_child_iframe.parent_node_id = 1; | 572 outer_child_iframe.parent_node_id = 1; |
563 outer_child_iframe.url = GURL(kDOMChildURL); | 573 outer_child_iframe.url = GURL(kDOMChildURL); |
564 outer_child_iframe.tag_name = "iframe"; | 574 outer_child_iframe.tag_name = "iframe"; |
565 outer_child_iframe.parent = GURL(kDOMParentURL); | 575 outer_child_iframe.parent = GURL(kDOMParentURL); |
566 outer_child_iframe.attributes.push_back(std::make_pair("src", kDOMChildURL)); | 576 outer_child_iframe.attributes.push_back(std::make_pair("src", kDOMChildURL)); |
567 outer_child_iframe.attributes.push_back(std::make_pair("foo", "bar")); | 577 outer_child_iframe.attributes.push_back(std::make_pair("foo", "bar")); |
578 outer_child_iframe.child_frame_routing_id = child_rfh->GetRoutingID(); | |
568 outer_params.push_back(outer_child_iframe); | 579 outer_params.push_back(outer_child_iframe); |
569 | 580 |
570 SafeBrowsingHostMsg_ThreatDOMDetails_Node outer_summary_node; | 581 SafeBrowsingHostMsg_ThreatDOMDetails_Node outer_summary_node; |
571 outer_summary_node.url = GURL(kDOMParentURL); | 582 outer_summary_node.url = GURL(kDOMParentURL); |
572 outer_summary_node.children.push_back(GURL(kDOMChildURL)); | 583 outer_summary_node.children.push_back(GURL(kDOMChildURL)); |
573 outer_params.push_back(outer_summary_node); | 584 outer_params.push_back(outer_summary_node); |
574 | 585 |
575 // Now define some more nodes for the body of the iframe. | 586 // Now define some more nodes for the body of the iframe. |
576 std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node> inner_params; | 587 std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node> inner_params; |
577 SafeBrowsingHostMsg_ThreatDOMDetails_Node inner_child_div; | 588 SafeBrowsingHostMsg_ThreatDOMDetails_Node inner_child_div; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
659 elem_dom_inner_div->add_attribute()->set_name("bar"); | 670 elem_dom_inner_div->add_attribute()->set_name("bar"); |
660 elem_dom_inner_div->mutable_attribute(1)->set_value("baz"); | 671 elem_dom_inner_div->mutable_attribute(1)->set_value("baz"); |
661 | 672 |
662 HTMLElement* elem_dom_inner_script = expected.add_dom(); | 673 HTMLElement* elem_dom_inner_script = expected.add_dom(); |
663 elem_dom_inner_script->set_id(3); | 674 elem_dom_inner_script->set_id(3); |
664 elem_dom_inner_script->set_tag("SCRIPT"); | 675 elem_dom_inner_script->set_tag("SCRIPT"); |
665 elem_dom_inner_script->set_resource_id(res_dom_child2->id()); | 676 elem_dom_inner_script->set_resource_id(res_dom_child2->id()); |
666 elem_dom_inner_script->add_attribute()->set_name("src"); | 677 elem_dom_inner_script->add_attribute()->set_name("src"); |
667 elem_dom_inner_script->mutable_attribute(0)->set_value(kDOMChildUrl2); | 678 elem_dom_inner_script->mutable_attribute(0)->set_value(kDOMChildUrl2); |
668 | 679 |
669 content::WebContentsTester::For(web_contents()) | |
670 ->NavigateAndCommit(GURL(kLandingURL)); | |
671 | |
672 UnsafeResource resource; | 680 UnsafeResource resource; |
673 InitResource(&resource, SB_THREAT_TYPE_URL_UNWANTED, | 681 InitResource(&resource, SB_THREAT_TYPE_URL_UNWANTED, |
674 true /* is_subresource */, GURL(kThreatURL)); | 682 true /* is_subresource */, GURL(kThreatURL)); |
675 | 683 |
676 // Send both sets of nodes, from different render frames. | 684 // Send both sets of nodes, from different render frames. |
677 { | 685 { |
678 scoped_refptr<ThreatDetailsWrap> report = new ThreatDetailsWrap( | 686 scoped_refptr<ThreatDetailsWrap> report = new ThreatDetailsWrap( |
679 ui_manager_.get(), web_contents(), resource, NULL, history_service()); | 687 ui_manager_.get(), web_contents(), resource, NULL, history_service()); |
680 | 688 |
681 // We call AddDOMDetails directly so we can specify different render frame | 689 // Send both sets of nodes from different render frames. |
682 // IDs. | 690 report->OnReceivedThreatDOMDetails(main_rfh(), outer_params); |
683 report->AddDOMDetails(100, GURL(kDOMParentURL), outer_params); | 691 report->OnReceivedThreatDOMDetails(child_rfh, inner_params); |
684 report->AddDOMDetails(200, GURL(kDOMChildURL), inner_params); | 692 |
685 std::string serialized = WaitForSerializedReport( | 693 std::string serialized = WaitForSerializedReport( |
686 report.get(), false /* did_proceed*/, 0 /* num_visit */); | 694 report.get(), false /* did_proceed*/, 0 /* num_visit */); |
687 ClientSafeBrowsingReportRequest actual; | 695 ClientSafeBrowsingReportRequest actual; |
688 actual.ParseFromString(serialized); | 696 actual.ParseFromString(serialized); |
689 VerifyResults(actual, expected); | 697 VerifyResults(actual, expected); |
690 } | 698 } |
691 | 699 |
692 // Try again but with the messages coming in a different order. The IDs change | 700 // Try again but with the messages coming in a different order. The IDs change |
693 // slightly, but everything else remains the same. | 701 // slightly, but everything else remains the same. |
694 { | 702 { |
695 // Adjust the expected IDs: the inner params come first, so InnerScript and | 703 // Adjust the expected IDs: the inner params come first, so InnerScript |
696 // appear before DomParent | 704 // and InnerDiv appear before DomParent |
697 res_dom_child2->set_id(2); | 705 res_dom_child2->set_id(2); |
698 res_dom_child2->set_parent_id(3); | 706 res_dom_child2->set_parent_id(3); |
699 res_dom_child->set_id(3); | 707 res_dom_child->set_id(3); |
700 res_dom_child->set_parent_id(4); | 708 res_dom_child->set_parent_id(4); |
701 res_dom_child->clear_child_ids(); | 709 res_dom_child->clear_child_ids(); |
702 res_dom_child->add_child_ids(2); | 710 res_dom_child->add_child_ids(2); |
703 res_dom_parent->set_id(4); | 711 res_dom_parent->set_id(4); |
704 res_dom_parent->clear_child_ids(); | 712 res_dom_parent->clear_child_ids(); |
705 res_dom_parent->add_child_ids(3); | 713 res_dom_parent->add_child_ids(3); |
706 | 714 |
707 // Also adjust the elements - they change order since InnerDiv and | 715 // Also adjust the elements - they change order since InnerDiv and |
708 // InnerScript come in first. | 716 // InnerScript come in first. |
709 elem_dom_inner_div->set_id(0); | 717 elem_dom_inner_div->set_id(0); |
710 elem_dom_inner_script->set_id(1); | 718 elem_dom_inner_script->set_id(1); |
711 elem_dom_inner_script->set_resource_id(res_dom_child2->id()); | 719 elem_dom_inner_script->set_resource_id(res_dom_child2->id()); |
712 | 720 |
713 elem_dom_outer_div->set_id(2); | 721 elem_dom_outer_div->set_id(2); |
714 elem_dom_outer_div->clear_child_ids(); | 722 elem_dom_outer_div->clear_child_ids(); |
715 elem_dom_outer_div->add_child_ids(3); | 723 elem_dom_outer_div->add_child_ids(3); |
716 elem_dom_outer_iframe->set_id(3); | 724 elem_dom_outer_iframe->set_id(3); |
717 elem_dom_outer_iframe->set_resource_id(res_dom_child->id()); | 725 elem_dom_outer_iframe->set_resource_id(res_dom_child->id()); |
718 elem_dom_outer_iframe->clear_child_ids(); | 726 elem_dom_outer_iframe->clear_child_ids(); |
719 elem_dom_outer_iframe->add_child_ids(0); | 727 elem_dom_outer_iframe->add_child_ids(0); |
720 elem_dom_outer_iframe->add_child_ids(1); | 728 elem_dom_outer_iframe->add_child_ids(1); |
721 | 729 |
722 scoped_refptr<ThreatDetailsWrap> report = new ThreatDetailsWrap( | 730 scoped_refptr<ThreatDetailsWrap> report = new ThreatDetailsWrap( |
723 ui_manager_.get(), web_contents(), resource, NULL, history_service()); | 731 ui_manager_.get(), web_contents(), resource, NULL, history_service()); |
724 | 732 |
725 // We call AddDOMDetails directly so we can specify different render frame | 733 // Send both sets of nodes from different render frames. |
726 // IDs. | 734 report->OnReceivedThreatDOMDetails(child_rfh, inner_params); |
727 report->AddDOMDetails(200, GURL(kDOMChildURL), inner_params); | 735 report->OnReceivedThreatDOMDetails(main_rfh(), outer_params); |
728 report->AddDOMDetails(100, GURL(kDOMParentURL), outer_params); | 736 |
729 std::string serialized = WaitForSerializedReport( | 737 std::string serialized = WaitForSerializedReport( |
730 report.get(), false /* did_proceed*/, 0 /* num_visit */); | 738 report.get(), false /* did_proceed*/, 0 /* num_visit */); |
731 ClientSafeBrowsingReportRequest actual; | 739 ClientSafeBrowsingReportRequest actual; |
732 actual.ParseFromString(serialized); | 740 actual.ParseFromString(serialized); |
733 VerifyResults(actual, expected); | 741 VerifyResults(actual, expected); |
734 } | 742 } |
735 } | 743 } |
736 | 744 |
737 // Tests an ambiguous DOM, meaning that an inner render frame has URL that can | 745 // Tests an ambiguous DOM, meaning that an inner render frame can not be mapped |
738 // not be mapped to an iframe element in the parent frame with that same URL. | 746 // to an iframe element in the parent frame, which is a failure to lookup the |
739 // Typically this happens when the iframe tag has a data URL. | 747 // frames in the frame tree and should not happen. |
740 // We use three layers in this test: | 748 // We use three layers in this test: |
741 // kDOMParentURL | 749 // kDOMParentURL |
742 // \- <iframe src=kDataURL> | 750 // \- <frame src=kDataURL> |
743 // \- <script src=kDOMChildURL2> | 751 // \- <script src=kDOMChildURL2> |
744 TEST_F(ThreatDetailsTest, ThreatDOMDetails_AmbiguousDOM) { | 752 TEST_F(ThreatDetailsTest, ThreatDOMDetails_AmbiguousDOM) { |
745 const char kAmbiguousDomMetric[] = "SafeBrowsing.ThreatReport.DomIsAmbiguous"; | 753 const char kAmbiguousDomMetric[] = "SafeBrowsing.ThreatReport.DomIsAmbiguous"; |
746 | 754 |
747 // Define two sets of DOM nodes - one for an outer page containing an iframe, | 755 // Create a child renderer inside the main frame to house the inner iframe. |
748 // and then another for the inner page containing the contents of that iframe. | 756 // Perform the navigation first in order to manipulate the frame tree. |
757 content::WebContentsTester::For(web_contents()) | |
758 ->NavigateAndCommit(GURL(kLandingURL)); | |
759 content::TestRenderFrameHost* test_main_rfh = | |
Charlie Reis
2017/05/12 21:40:50
Same here.
lpz
2017/05/15 18:49:07
Done.
| |
760 static_cast<content::TestRenderFrameHost*>(main_rfh()); | |
761 content::TestRenderFrameHost* child_rfh = | |
762 test_main_rfh->AppendChild("subframe"); | |
763 | |
764 // Define two sets of DOM nodes - one for an outer page containing a frame, | |
765 // and then another for the inner page containing the contents of that frame. | |
749 std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node> outer_params; | 766 std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node> outer_params; |
750 SafeBrowsingHostMsg_ThreatDOMDetails_Node outer_child_node; | 767 SafeBrowsingHostMsg_ThreatDOMDetails_Node outer_child_node; |
751 outer_child_node.url = GURL(kDataURL); | 768 outer_child_node.url = GURL(kDataURL); |
752 outer_child_node.tag_name = "frame"; | 769 outer_child_node.tag_name = "frame"; |
753 outer_child_node.parent = GURL(kDOMParentURL); | 770 outer_child_node.parent = GURL(kDOMParentURL); |
754 outer_child_node.attributes.push_back(std::make_pair("src", kDataURL)); | 771 outer_child_node.attributes.push_back(std::make_pair("src", kDataURL)); |
755 outer_params.push_back(outer_child_node); | 772 outer_params.push_back(outer_child_node); |
756 SafeBrowsingHostMsg_ThreatDOMDetails_Node outer_summary_node; | 773 SafeBrowsingHostMsg_ThreatDOMDetails_Node outer_summary_node; |
757 outer_summary_node.url = GURL(kDOMParentURL); | 774 outer_summary_node.url = GURL(kDOMParentURL); |
758 outer_summary_node.children.push_back(GURL(kDataURL)); | 775 outer_summary_node.children.push_back(GURL(kDataURL)); |
776 // Set |child_frame_routing_id| for this node to something non-sensical so | |
777 // that the child frame lookup fails. | |
778 outer_summary_node.child_frame_routing_id = -100; | |
759 outer_params.push_back(outer_summary_node); | 779 outer_params.push_back(outer_summary_node); |
760 | 780 |
761 // Now define some more nodes for the body of the iframe. The URL of this | 781 // Now define some more nodes for the body of the frame. The URL of this |
762 // inner frame is "about:blank". | 782 // inner frame is "about:blank". |
763 std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node> inner_params; | 783 std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node> inner_params; |
764 SafeBrowsingHostMsg_ThreatDOMDetails_Node inner_child_node; | 784 SafeBrowsingHostMsg_ThreatDOMDetails_Node inner_child_node; |
765 inner_child_node.url = GURL(kDOMChildUrl2); | 785 inner_child_node.url = GURL(kDOMChildUrl2); |
766 inner_child_node.tag_name = "script"; | 786 inner_child_node.tag_name = "script"; |
767 inner_child_node.parent = GURL(kBlankURL); | 787 inner_child_node.parent = GURL(kBlankURL); |
768 inner_child_node.attributes.push_back(std::make_pair("src", kDOMChildUrl2)); | 788 inner_child_node.attributes.push_back(std::make_pair("src", kDOMChildUrl2)); |
769 inner_params.push_back(inner_child_node); | 789 inner_params.push_back(inner_child_node); |
770 SafeBrowsingHostMsg_ThreatDOMDetails_Node inner_summary_node; | 790 SafeBrowsingHostMsg_ThreatDOMDetails_Node inner_summary_node; |
771 inner_summary_node.url = GURL(kBlankURL); | 791 inner_summary_node.url = GURL(kBlankURL); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
816 pb_element->add_attribute()->set_name("src"); | 836 pb_element->add_attribute()->set_name("src"); |
817 pb_element->mutable_attribute(0)->set_value(kDataURL); | 837 pb_element->mutable_attribute(0)->set_value(kDataURL); |
818 | 838 |
819 pb_element = expected.add_dom(); | 839 pb_element = expected.add_dom(); |
820 pb_element->set_id(1); | 840 pb_element->set_id(1); |
821 pb_element->set_tag("SCRIPT"); | 841 pb_element->set_tag("SCRIPT"); |
822 pb_element->set_resource_id(4); | 842 pb_element->set_resource_id(4); |
823 pb_element->add_attribute()->set_name("src"); | 843 pb_element->add_attribute()->set_name("src"); |
824 pb_element->mutable_attribute(0)->set_value(kDOMChildUrl2); | 844 pb_element->mutable_attribute(0)->set_value(kDOMChildUrl2); |
825 | 845 |
826 content::WebContentsTester::For(web_contents()) | |
827 ->NavigateAndCommit(GURL(kLandingURL)); | |
828 | |
829 UnsafeResource resource; | 846 UnsafeResource resource; |
830 InitResource(&resource, SB_THREAT_TYPE_URL_UNWANTED, | 847 InitResource(&resource, SB_THREAT_TYPE_URL_UNWANTED, |
831 true /* is_subresource */, GURL(kThreatURL)); | 848 true /* is_subresource */, GURL(kThreatURL)); |
832 scoped_refptr<ThreatDetailsWrap> report = new ThreatDetailsWrap( | 849 scoped_refptr<ThreatDetailsWrap> report = new ThreatDetailsWrap( |
833 ui_manager_.get(), web_contents(), resource, NULL, history_service()); | 850 ui_manager_.get(), web_contents(), resource, NULL, history_service()); |
834 base::HistogramTester histograms; | 851 base::HistogramTester histograms; |
835 | 852 |
836 // Send both sets of nodes, from different render frames. We call | 853 // Send both sets of nodes from different render frames. |
837 // AddDOMDetails directly so we can specify different render frame IDs. | 854 report->OnReceivedThreatDOMDetails(main_rfh(), outer_params); |
838 report->AddDOMDetails(100, GURL(kDOMParentURL), outer_params); | 855 report->OnReceivedThreatDOMDetails(child_rfh, inner_params); |
839 // The inner frame was using a data URL so its last committed URL is empty. | |
840 report->AddDOMDetails(200, GURL(), inner_params); | |
841 | 856 |
842 std::string serialized = WaitForSerializedReport( | 857 std::string serialized = WaitForSerializedReport( |
843 report.get(), false /* did_proceed*/, 0 /* num_visit */); | 858 report.get(), false /* did_proceed*/, 0 /* num_visit */); |
844 ClientSafeBrowsingReportRequest actual; | 859 ClientSafeBrowsingReportRequest actual; |
845 actual.ParseFromString(serialized); | 860 actual.ParseFromString(serialized); |
846 VerifyResults(actual, expected); | 861 VerifyResults(actual, expected); |
847 | 862 |
848 // This DOM should be ambiguous, expect the UMA metric to be incremented. | 863 // This DOM should be ambiguous, expect the UMA metric to be incremented. |
849 histograms.ExpectTotalCount(kAmbiguousDomMetric, 1); | 864 histograms.ExpectTotalCount(kAmbiguousDomMetric, 1); |
850 } | 865 } |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1329 pb_resource->set_parent_id(3); | 1344 pb_resource->set_parent_id(3); |
1330 pb_resource->set_url(kSecondRedirectURL); | 1345 pb_resource->set_url(kSecondRedirectURL); |
1331 pb_resource = expected.add_resources(); | 1346 pb_resource = expected.add_resources(); |
1332 pb_resource->set_id(3); | 1347 pb_resource->set_id(3); |
1333 pb_resource->set_url(kFirstRedirectURL); | 1348 pb_resource->set_url(kFirstRedirectURL); |
1334 | 1349 |
1335 VerifyResults(actual, expected); | 1350 VerifyResults(actual, expected); |
1336 } | 1351 } |
1337 | 1352 |
1338 } // namespace safe_browsing | 1353 } // namespace safe_browsing |
OLD | NEW |