Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1453)

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc

Issue 2845593003: Properly wait for download items in SBNavigationObserverBrowserTests (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "chrome/browser/chrome_notification_types.h" 6 #include "chrome/browser/chrome_notification_types.h"
7 #include "chrome/browser/download/download_prefs.h" 7 #include "chrome/browser/download/download_prefs.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/safe_browsing/download_protection_service.h" 9 #include "chrome/browser/safe_browsing/download_protection_service.h"
10 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer.h" 10 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 if (!item->IsDone()) 218 if (!item->IsDone())
219 item->Cancel(true); 219 item->Cancel(true);
220 } 220 }
221 } 221 }
222 222
223 DownloadItem* GetDownload() { 223 DownloadItem* GetDownload() {
224 std::vector<DownloadItem*> download_items; 224 std::vector<DownloadItem*> download_items;
225 content::DownloadManager* manager = 225 content::DownloadManager* manager =
226 content::BrowserContext::GetDownloadManager(browser()->profile()); 226 content::BrowserContext::GetDownloadManager(browser()->profile());
227 manager->GetAllDownloads(&download_items); 227 manager->GetAllDownloads(&download_items);
228 if (download_items.empty())
229 DownloadItemCreatedObserver(manager).WaitForDownloadItem(&download_items);
228 EXPECT_EQ(1U, download_items.size()); 230 EXPECT_EQ(1U, download_items.size());
229 return download_items[0]; 231 return download_items[0];
230 } 232 }
231 233
232 // This function needs javascript support from the test page hosted at 234 // This function needs javascript support from the test page hosted at
233 // |page_url|. It calls "clickLink(..)" javascript function to "click" on the 235 // |page_url|. It calls "clickLink(..)" javascript function to "click" on the
234 // html element with ID specified by |element_id|, and waits for 236 // html element with ID specified by |element_id|, and waits for
235 // |number_of_navigations| to complete. 237 // |number_of_navigations| to complete.
236 void ClickTestLink(const char* element_id, 238 void ClickTestLink(const char* element_id,
237 int number_of_navigations, 239 int number_of_navigations,
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 GURL(), // main_frame_url 1961 GURL(), // main_frame_url
1960 ReferrerChainEntry::CLIENT_REDIRECT, // type 1962 ReferrerChainEntry::CLIENT_REDIRECT, // type
1961 test_server_ip, // ip_address 1963 test_server_ip, // ip_address
1962 GURL(), // referrer_url 1964 GURL(), // referrer_url
1963 GURL(), // referrer_main_frame_url 1965 GURL(), // referrer_main_frame_url
1964 false, // is_retargeting 1966 false, // is_retargeting
1965 std::vector<GURL>(), // server redirects 1967 std::vector<GURL>(), // server redirects
1966 referrer_chain.Get(0)); 1968 referrer_chain.Get(0));
1967 } 1969 }
1968 } // namespace safe_browsing 1970 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698