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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 void CheckResources(const base::FilePath& page_file_path, | 56 void CheckResources(const base::FilePath& page_file_path, |
57 const UrlVectorMatcher& expected_resources_matcher, | 57 const UrlVectorMatcher& expected_resources_matcher, |
58 const UrlVectorMatcher& expected_subframe_urls_matcher, | 58 const UrlVectorMatcher& expected_subframe_urls_matcher, |
59 const GURL& file_url, | 59 const GURL& file_url, |
60 int render_frame_routing_id) { | 60 int render_frame_routing_id) { |
61 // Get all savable resource links for the page. | 61 // Get all savable resource links for the page. |
62 std::vector<GURL> resources_list; | 62 std::vector<GURL> resources_list; |
63 std::vector<SavableSubframe> subframes; | 63 std::vector<SavableSubframe> subframes; |
64 SavableResourcesResult result(&resources_list, &subframes); | 64 SavableResourcesResult result(&resources_list, &subframes); |
65 | 65 |
66 const char* savable_schemes[] = { | |
67 "http", | |
68 "https", | |
69 "file", | |
70 NULL | |
71 }; | |
72 | |
73 RenderFrame* render_frame = | 66 RenderFrame* render_frame = |
74 RenderFrame::FromRoutingID(render_frame_routing_id); | 67 RenderFrame::FromRoutingID(render_frame_routing_id); |
75 | 68 |
76 ASSERT_TRUE(GetSavableResourceLinksForFrame( | 69 ASSERT_TRUE(GetSavableResourceLinksForFrame( |
77 render_frame->GetWebFrame(), | 70 render_frame->GetWebFrame(), &result)); |
78 &result, savable_schemes)); | |
79 | 71 |
80 EXPECT_THAT(resources_list, expected_resources_matcher); | 72 EXPECT_THAT(resources_list, expected_resources_matcher); |
81 | 73 |
82 std::vector<GURL> subframe_original_urls; | 74 std::vector<GURL> subframe_original_urls; |
83 for (const SavableSubframe& subframe : subframes) { | 75 for (const SavableSubframe& subframe : subframes) { |
84 subframe_original_urls.push_back(subframe.original_url); | 76 subframe_original_urls.push_back(subframe.original_url); |
85 } | 77 } |
86 EXPECT_THAT(subframe_original_urls, expected_subframe_urls_matcher); | 78 EXPECT_THAT(subframe_original_urls, expected_subframe_urls_matcher); |
87 } | 79 } |
88 }; | 80 }; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 122 |
131 auto expected_subresources_matcher = testing::IsEmpty(); | 123 auto expected_subresources_matcher = testing::IsEmpty(); |
132 | 124 |
133 auto expected_subframe_urls_matcher = testing::IsEmpty(); | 125 auto expected_subframe_urls_matcher = testing::IsEmpty(); |
134 | 126 |
135 GetSavableResourceLinksForPage(page_file_path, expected_subresources_matcher, | 127 GetSavableResourceLinksForPage(page_file_path, expected_subresources_matcher, |
136 expected_subframe_urls_matcher); | 128 expected_subframe_urls_matcher); |
137 } | 129 } |
138 | 130 |
139 } // namespace content | 131 } // namespace content |
OLD | NEW |