OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/favicon/content/content_favicon_driver.h" | 5 #include "components/favicon/content/content_favicon_driver.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/test/scoped_feature_list.h" | 12 #include "base/test/scoped_feature_list.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
16 #include "chrome/browser/favicon/favicon_service_factory.h" | 16 #include "chrome/browser/favicon/favicon_service_factory.h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_commands.h" | 18 #include "chrome/browser/ui/browser_commands.h" |
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
20 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
21 #include "chrome/test/base/ui_test_utils.h" | 21 #include "chrome/test/base/ui_test_utils.h" |
22 #include "components/favicon/core/favicon_handler.h" | 22 #include "components/favicon/core/favicon_handler.h" |
23 #include "components/favicon/core/favicon_service.h" | 23 #include "components/favicon/core/favicon_service.h" |
24 #include "components/favicon/core/features.h" | 24 #include "components/favicon/core/features.h" |
25 #include "content/public/browser/notification_observer.h" | |
26 #include "content/public/browser/notification_registrar.h" | |
27 #include "content/public/browser/notification_types.h" | |
28 #include "content/public/browser/resource_dispatcher_host.h" | 25 #include "content/public/browser/resource_dispatcher_host.h" |
29 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 26 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
27 #include "content/public/browser/web_contents_observer.h" | |
30 #include "net/base/load_flags.h" | 28 #include "net/base/load_flags.h" |
31 #include "net/test/embedded_test_server/embedded_test_server.h" | 29 #include "net/test/embedded_test_server/embedded_test_server.h" |
32 #include "net/url_request/url_request.h" | 30 #include "net/url_request/url_request.h" |
33 #include "url/url_constants.h" | 31 #include "url/url_constants.h" |
34 | 32 |
35 namespace { | 33 namespace { |
36 | 34 |
37 // Tracks whether the URL passed to the constructor is requested and whether | 35 // Tracks whether the URL passed to the constructor is requested and whether |
38 // the request bypasses the cache. | 36 // the request bypasses the cache. |
39 class TestResourceDispatcherHostDelegate | 37 class TestResourceDispatcherHostDelegate |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 } | 75 } |
78 | 76 |
79 private: | 77 private: |
80 GURL url_; | 78 GURL url_; |
81 bool was_requested_; | 79 bool was_requested_; |
82 bool bypassed_cache_; | 80 bool bypassed_cache_; |
83 | 81 |
84 DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcherHostDelegate); | 82 DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcherHostDelegate); |
85 }; | 83 }; |
86 | 84 |
87 // Checks whether the FaviconDriver is waiting for a download to complete or | |
88 // for data from the FaviconService. | |
89 class FaviconDriverPendingTaskChecker { | |
90 public: | |
91 virtual ~FaviconDriverPendingTaskChecker() {} | |
92 | |
93 virtual bool HasPendingTasks() = 0; | |
94 }; | |
95 | |
96 // Waits for the following the finish: | 85 // Waits for the following the finish: |
97 // - The pending navigation. | 86 // - The pending navigation. |
98 // - FaviconHandler's pending favicon database requests. | 87 // - FaviconHandler's pending favicon database requests. |
99 // - FaviconHandler's pending downloads. | 88 // - FaviconHandler's pending downloads. |
100 class PendingTaskWaiter : public content::NotificationObserver { | 89 // - Optionally, for a specific page URL (as a mechanism to wait of Javascript |
90 // completion). | |
91 class PendingTaskWaiter : public content::WebContentsObserver { | |
101 public: | 92 public: |
102 PendingTaskWaiter(content::WebContents* web_contents, | 93 PendingTaskWaiter(content::WebContents* web_contents, |
103 FaviconDriverPendingTaskChecker* checker) | 94 const GURL& required_url = GURL()) |
104 : checker_(checker), | 95 : WebContentsObserver(web_contents), |
105 load_stopped_(false), | 96 required_url_(required_url), |
106 weak_factory_(this) { | 97 weak_factory_(this) {} |
107 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, | |
108 content::Source<content::NavigationController>( | |
109 &web_contents->GetController())); | |
110 } | |
111 ~PendingTaskWaiter() override {} | 98 ~PendingTaskWaiter() override {} |
112 | 99 |
113 void Wait() { | 100 void Wait() { |
114 if (load_stopped_ && !checker_->HasPendingTasks()) | |
115 return; | |
116 | |
117 base::RunLoop run_loop; | 101 base::RunLoop run_loop; |
118 quit_closure_ = run_loop.QuitClosure(); | 102 quit_closure_ = run_loop.QuitClosure(); |
119 run_loop.Run(); | 103 run_loop.Run(); |
120 } | 104 } |
121 | 105 |
122 private: | 106 private: |
123 // content::NotificationObserver: | 107 // content::WebContentsObserver: |
124 void Observe(int type, | 108 void DidStopLoading() override { |
125 const content::NotificationSource& source, | 109 if (!required_url_.is_empty() && |
126 const content::NotificationDetails& details) override { | 110 required_url_ != web_contents()->GetVisibleURL()) { |
pkotwicz
2017/06/23 17:52:20
Should this be GetLastCommittedURL() instead?
mastiz
2017/06/27 08:57:36
I think both should be equally fine, and in seems
pkotwicz
2017/06/27 15:21:13
GetLastCommittedURL() is the typical function to u
mastiz
2017/06/28 09:02:13
Thanks for clarifying, I was not aware of that and
| |
127 if (type == content::NOTIFICATION_LOAD_STOP) | 111 return; |
128 load_stopped_ = true; | 112 } |
129 | 113 |
130 // We need to poll periodically because Delegate::OnFaviconUpdated() is not | 114 // We need to poll periodically because Delegate::OnFaviconUpdated() is not |
131 // guaranteed to be called upon completion of the last database request / | 115 // guaranteed to be called upon completion of the last database request / |
132 // download. In particular, OnFaviconUpdated() might not be called if a | 116 // download. In particular, OnFaviconUpdated() might not be called if a |
133 // database request confirms the data sent in the previous | 117 // database request confirms the data sent in the previous |
134 // OnFaviconUpdated() call. | 118 // OnFaviconUpdated() call. |
135 CheckStopWaitingPeriodically(); | 119 CheckStopWaitingPeriodically(); |
136 } | 120 } |
137 | 121 |
138 void CheckStopWaitingPeriodically() { | 122 void CheckStopWaitingPeriodically() { |
139 EndLoopIfCanStopWaiting(); | 123 EndLoopIfCanStopWaiting(); |
140 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 124 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
141 FROM_HERE, | 125 FROM_HERE, |
142 base::BindOnce(&PendingTaskWaiter::CheckStopWaitingPeriodically, | 126 base::BindOnce(&PendingTaskWaiter::CheckStopWaitingPeriodically, |
143 weak_factory_.GetWeakPtr()), | 127 weak_factory_.GetWeakPtr()), |
144 base::TimeDelta::FromSeconds(1)); | 128 base::TimeDelta::FromSeconds(1)); |
145 } | 129 } |
146 | 130 |
147 void EndLoopIfCanStopWaiting() { | 131 void EndLoopIfCanStopWaiting() { |
148 if (!quit_closure_.is_null() && | 132 CHECK(!quit_closure_.is_null()); |
pkotwicz
2017/06/23 17:52:20
Why are you making this a CHECK()?
It is possible
mastiz
2017/06/27 08:57:36
Reverted. I however suspect this cannot happen in
pkotwicz
2017/06/27 15:21:13
Aside: ui_test_utils::NavigateToURLWithDisposition
mastiz
2017/06/28 09:02:13
I don't think it is blocking with BROWSER_TEST_NON
| |
149 load_stopped_ && | 133 if (!favicon::ContentFaviconDriver::FromWebContents(web_contents()) |
150 !checker_->HasPendingTasks()) { | 134 ->HasPendingTasksForTest()) { |
151 quit_closure_.Run(); | 135 quit_closure_.Run(); |
152 } | 136 } |
153 } | 137 } |
154 | 138 |
155 FaviconDriverPendingTaskChecker* checker_; // Not owned. | |
156 bool load_stopped_; | |
157 base::Closure quit_closure_; | 139 base::Closure quit_closure_; |
158 content::NotificationRegistrar registrar_; | 140 const GURL required_url_; |
159 base::WeakPtrFactory<PendingTaskWaiter> weak_factory_; | 141 base::WeakPtrFactory<PendingTaskWaiter> weak_factory_; |
160 | 142 |
161 DISALLOW_COPY_AND_ASSIGN(PendingTaskWaiter); | 143 DISALLOW_COPY_AND_ASSIGN(PendingTaskWaiter); |
162 }; | 144 }; |
163 | 145 |
164 } // namespace | 146 } // namespace |
165 | 147 |
166 class ContentFaviconDriverTest : public InProcessBrowserTest, | 148 class ContentFaviconDriverTest : public InProcessBrowserTest { |
167 public FaviconDriverPendingTaskChecker { | |
168 public: | 149 public: |
169 ContentFaviconDriverTest() {} | 150 ContentFaviconDriverTest() {} |
170 ~ContentFaviconDriverTest() override {} | 151 ~ContentFaviconDriverTest() override {} |
171 | 152 |
172 content::WebContents* web_contents() { | 153 content::WebContents* web_contents() { |
173 return browser()->tab_strip_model()->GetActiveWebContents(); | 154 return browser()->tab_strip_model()->GetActiveWebContents(); |
174 } | 155 } |
175 | 156 |
176 // FaviconDriverPendingTaskChecker: | 157 favicon_base::FaviconRawBitmapResult GetFaviconForPageURL( |
177 bool HasPendingTasks() override { | 158 const GURL& url, |
178 return favicon::ContentFaviconDriver::FromWebContents(web_contents()) | 159 favicon_base::IconType icon_type) { |
179 ->HasPendingTasksForTest(); | |
180 } | |
181 | |
182 favicon_base::FaviconRawBitmapResult GetFaviconForPageURL(const GURL& url) { | |
183 favicon::FaviconService* favicon_service = | 160 favicon::FaviconService* favicon_service = |
184 FaviconServiceFactory::GetForProfile( | 161 FaviconServiceFactory::GetForProfile( |
185 browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS); | 162 browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS); |
186 | 163 |
187 std::vector<favicon_base::FaviconRawBitmapResult> results; | 164 std::vector<favicon_base::FaviconRawBitmapResult> results; |
188 base::CancelableTaskTracker tracker; | 165 base::CancelableTaskTracker tracker; |
189 base::RunLoop loop; | 166 base::RunLoop loop; |
190 favicon_service->GetFaviconForPageURL( | 167 favicon_service->GetFaviconForPageURL( |
191 url, favicon_base::FAVICON, /*desired_size_in_dip=*/0, | 168 url, icon_type, /*desired_size_in_dip=*/0, |
192 base::Bind( | 169 base::Bind( |
193 [](std::vector<favicon_base::FaviconRawBitmapResult>* save_results, | 170 [](std::vector<favicon_base::FaviconRawBitmapResult>* save_results, |
194 base::RunLoop* loop, | 171 base::RunLoop* loop, |
195 const std::vector<favicon_base::FaviconRawBitmapResult>& | 172 const std::vector<favicon_base::FaviconRawBitmapResult>& |
196 results) { | 173 results) { |
197 *save_results = results; | 174 *save_results = results; |
198 loop->Quit(); | 175 loop->Quit(); |
199 }, | 176 }, |
200 &results, &loop), | 177 &results, &loop), |
201 &tracker); | 178 &tracker); |
(...skipping 16 matching lines...) Expand all Loading... | |
218 ASSERT_TRUE(embedded_test_server()->Start()); | 195 ASSERT_TRUE(embedded_test_server()->Start()); |
219 GURL url = embedded_test_server()->GetURL("/favicon/page_with_favicon.html"); | 196 GURL url = embedded_test_server()->GetURL("/favicon/page_with_favicon.html"); |
220 GURL icon_url = embedded_test_server()->GetURL("/favicon/icon.png"); | 197 GURL icon_url = embedded_test_server()->GetURL("/favicon/icon.png"); |
221 | 198 |
222 std::unique_ptr<TestResourceDispatcherHostDelegate> delegate( | 199 std::unique_ptr<TestResourceDispatcherHostDelegate> delegate( |
223 new TestResourceDispatcherHostDelegate(icon_url)); | 200 new TestResourceDispatcherHostDelegate(icon_url)); |
224 content::ResourceDispatcherHost::Get()->SetDelegate(delegate.get()); | 201 content::ResourceDispatcherHost::Get()->SetDelegate(delegate.get()); |
225 | 202 |
226 // Initial visit in order to populate the cache. | 203 // Initial visit in order to populate the cache. |
227 { | 204 { |
228 PendingTaskWaiter waiter(web_contents(), this); | 205 PendingTaskWaiter waiter(web_contents()); |
229 ui_test_utils::NavigateToURLWithDisposition( | 206 ui_test_utils::NavigateToURLWithDisposition( |
230 browser(), url, WindowOpenDisposition::CURRENT_TAB, | 207 browser(), url, WindowOpenDisposition::CURRENT_TAB, |
231 ui_test_utils::BROWSER_TEST_NONE); | 208 ui_test_utils::BROWSER_TEST_NONE); |
232 waiter.Wait(); | 209 waiter.Wait(); |
233 } | 210 } |
234 ASSERT_TRUE(delegate->was_requested()); | 211 ASSERT_TRUE(delegate->was_requested()); |
235 EXPECT_FALSE(delegate->bypassed_cache()); | 212 EXPECT_FALSE(delegate->bypassed_cache()); |
236 delegate->Reset(); | 213 delegate->Reset(); |
237 | 214 |
238 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); | 215 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); |
239 | 216 |
240 // A normal visit should fetch the favicon from either the favicon database or | 217 // A normal visit should fetch the favicon from either the favicon database or |
241 // the HTTP cache. | 218 // the HTTP cache. |
242 { | 219 { |
243 PendingTaskWaiter waiter(web_contents(), this); | 220 PendingTaskWaiter waiter(web_contents()); |
244 ui_test_utils::NavigateToURLWithDisposition( | 221 ui_test_utils::NavigateToURLWithDisposition( |
245 browser(), url, WindowOpenDisposition::CURRENT_TAB, | 222 browser(), url, WindowOpenDisposition::CURRENT_TAB, |
246 ui_test_utils::BROWSER_TEST_NONE); | 223 ui_test_utils::BROWSER_TEST_NONE); |
247 waiter.Wait(); | 224 waiter.Wait(); |
248 } | 225 } |
249 EXPECT_FALSE(delegate->bypassed_cache()); | 226 EXPECT_FALSE(delegate->bypassed_cache()); |
250 delegate->Reset(); | 227 delegate->Reset(); |
251 | 228 |
252 // A reload ignoring the cache should refetch the favicon from the website. | 229 // A reload ignoring the cache should refetch the favicon from the website. |
253 { | 230 { |
254 PendingTaskWaiter waiter(web_contents(), this); | 231 PendingTaskWaiter waiter(web_contents()); |
255 chrome::ExecuteCommand(browser(), IDC_RELOAD_BYPASSING_CACHE); | 232 chrome::ExecuteCommand(browser(), IDC_RELOAD_BYPASSING_CACHE); |
256 waiter.Wait(); | 233 waiter.Wait(); |
257 } | 234 } |
258 ASSERT_TRUE(delegate->was_requested()); | 235 ASSERT_TRUE(delegate->was_requested()); |
259 EXPECT_TRUE(delegate->bypassed_cache()); | 236 EXPECT_TRUE(delegate->bypassed_cache()); |
260 } | 237 } |
261 | 238 |
262 // Test that loading a page that contains icons only in the Web Manifest causes | 239 // Test that loading a page that contains icons only in the Web Manifest causes |
263 // those icons to be used. | 240 // those icons to be used. |
264 IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest, LoadIconFromWebManifest) { | 241 IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest, LoadIconFromWebManifest) { |
265 base::test::ScopedFeatureList override_features; | 242 base::test::ScopedFeatureList override_features; |
266 override_features.InitAndEnableFeature(favicon::kFaviconsFromWebManifest); | 243 override_features.InitAndEnableFeature(favicon::kFaviconsFromWebManifest); |
267 | 244 |
268 ASSERT_TRUE(embedded_test_server()->Start()); | 245 ASSERT_TRUE(embedded_test_server()->Start()); |
269 GURL url = embedded_test_server()->GetURL("/favicon/page_with_manifest.html"); | 246 GURL url = embedded_test_server()->GetURL("/favicon/page_with_manifest.html"); |
270 GURL icon_url = embedded_test_server()->GetURL("/favicon/icon.png"); | 247 GURL icon_url = embedded_test_server()->GetURL("/favicon/icon.png"); |
271 | 248 |
272 std::unique_ptr<TestResourceDispatcherHostDelegate> delegate( | 249 std::unique_ptr<TestResourceDispatcherHostDelegate> delegate( |
273 new TestResourceDispatcherHostDelegate(icon_url)); | 250 new TestResourceDispatcherHostDelegate(icon_url)); |
274 content::ResourceDispatcherHost::Get()->SetDelegate(delegate.get()); | 251 content::ResourceDispatcherHost::Get()->SetDelegate(delegate.get()); |
275 | 252 |
276 PendingTaskWaiter waiter(web_contents(), this); | 253 PendingTaskWaiter waiter(web_contents()); |
277 ui_test_utils::NavigateToURLWithDisposition( | 254 ui_test_utils::NavigateToURLWithDisposition( |
278 browser(), url, WindowOpenDisposition::CURRENT_TAB, | 255 browser(), url, WindowOpenDisposition::CURRENT_TAB, |
279 ui_test_utils::BROWSER_TEST_NONE); | 256 ui_test_utils::BROWSER_TEST_NONE); |
280 waiter.Wait(); | 257 waiter.Wait(); |
281 | 258 |
282 #if defined(OS_ANDROID) | 259 #if defined(OS_ANDROID) |
283 EXPECT_TRUE(delegate->was_requested()); | 260 EXPECT_TRUE(delegate->was_requested()); |
261 EXPECT_NE( | |
262 nullptr, | |
263 GetFaviconForPageURL(url, favicon_base::WEB_MANIFEST_ICON).bitmap_data); | |
284 #else | 264 #else |
285 EXPECT_FALSE(delegate->was_requested()); | 265 EXPECT_FALSE(delegate->was_requested()); |
286 #endif | 266 #endif |
287 } | 267 } |
288 | 268 |
289 // Test that loading a page that contains a Web Manifest without icons and a | 269 // Test that loading a page that contains a Web Manifest without icons and a |
290 // regular favicon in the HTML reports the icon. The regular icon is initially | 270 // regular favicon in the HTML reports the icon. The regular icon is initially |
291 // cached in the Favicon database. | 271 // cached in the Favicon database. |
292 IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest, | 272 IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest, |
293 LoadRegularIconDespiteWebManifestWithoutIcons) { | 273 LoadRegularIconDespiteWebManifestWithoutIcons) { |
294 ASSERT_TRUE(embedded_test_server()->Start()); | 274 ASSERT_TRUE(embedded_test_server()->Start()); |
295 GURL url = embedded_test_server()->GetURL( | 275 GURL url = embedded_test_server()->GetURL( |
296 "/favicon/page_with_manifest_without_icons.html"); | 276 "/favicon/page_with_manifest_without_icons.html"); |
297 GURL icon_url = embedded_test_server()->GetURL("/favicon/icon.png"); | 277 GURL icon_url = embedded_test_server()->GetURL("/favicon/icon.png"); |
298 | 278 |
299 // Initial visit with the feature still disabled, to populate the cache. | 279 // Initial visit with the feature still disabled, to populate the cache. |
300 { | 280 { |
301 PendingTaskWaiter waiter(web_contents(), this); | 281 PendingTaskWaiter waiter(web_contents()); |
302 ui_test_utils::NavigateToURLWithDisposition( | 282 ui_test_utils::NavigateToURLWithDisposition( |
303 browser(), url, WindowOpenDisposition::CURRENT_TAB, | 283 browser(), url, WindowOpenDisposition::CURRENT_TAB, |
304 ui_test_utils::BROWSER_TEST_NONE); | 284 ui_test_utils::BROWSER_TEST_NONE); |
305 waiter.Wait(); | 285 waiter.Wait(); |
306 } | 286 } |
307 ASSERT_NE(nullptr, GetFaviconForPageURL(url).bitmap_data); | 287 ASSERT_NE(nullptr, |
288 GetFaviconForPageURL(url, favicon_base::FAVICON).bitmap_data); | |
308 | 289 |
309 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); | 290 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); |
310 | 291 |
311 // Enable the feature and visit the page again. | 292 // Enable the feature and visit the page again. |
312 base::test::ScopedFeatureList override_features; | 293 base::test::ScopedFeatureList override_features; |
313 override_features.InitAndEnableFeature(favicon::kFaviconsFromWebManifest); | 294 override_features.InitAndEnableFeature(favicon::kFaviconsFromWebManifest); |
314 | 295 |
315 { | 296 { |
316 PendingTaskWaiter waiter(web_contents(), this); | 297 PendingTaskWaiter waiter(web_contents()); |
317 ui_test_utils::NavigateToURLWithDisposition( | 298 ui_test_utils::NavigateToURLWithDisposition( |
318 browser(), url, WindowOpenDisposition::CURRENT_TAB, | 299 browser(), url, WindowOpenDisposition::CURRENT_TAB, |
319 ui_test_utils::BROWSER_TEST_NONE); | 300 ui_test_utils::BROWSER_TEST_NONE); |
320 waiter.Wait(); | 301 waiter.Wait(); |
321 } | 302 } |
322 | 303 |
323 EXPECT_NE(nullptr, GetFaviconForPageURL(url).bitmap_data); | 304 EXPECT_NE(nullptr, |
305 GetFaviconForPageURL(url, favicon_base::FAVICON).bitmap_data); | |
324 } | 306 } |
307 | |
308 #if defined(OS_ANDROID) || defined(OS_IOS) | |
pkotwicz
2017/06/23 17:52:20
Shouldn't this test be Android only given that iOS
mastiz
2017/06/27 08:57:36
Done.
| |
309 IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest, | |
310 LoadIconFromWebManifestDespitePushState) { | |
311 base::test::ScopedFeatureList override_features; | |
312 override_features.InitAndEnableFeature(favicon::kFaviconsFromWebManifest); | |
313 | |
314 ASSERT_TRUE(embedded_test_server()->Start()); | |
315 GURL url = | |
316 embedded_test_server()->GetURL("/favicon/pushstate_with_manifest.html"); | |
317 GURL pushstate_url = embedded_test_server()->GetURL( | |
318 "/favicon/pushstate_with_manifest.html#pushState"); | |
319 | |
320 PendingTaskWaiter waiter(web_contents(), /*required_url=*/pushstate_url); | |
321 ui_test_utils::NavigateToURLWithDisposition( | |
322 browser(), url, WindowOpenDisposition::CURRENT_TAB, | |
323 ui_test_utils::BROWSER_TEST_NONE); | |
324 waiter.Wait(); | |
325 | |
326 EXPECT_NE(nullptr, | |
327 GetFaviconForPageURL(pushstate_url, favicon_base::WEB_MANIFEST_ICON) | |
328 .bitmap_data); | |
329 } | |
330 #endif | |
OLD | NEW |