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 "chrome/test/base/ui_test_utils.h" | 5 #include "chrome/test/base/ui_test_utils.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 if (ordinal) | 328 if (ordinal) |
329 *ordinal = observer.active_match_ordinal(); | 329 *ordinal = observer.active_match_ordinal(); |
330 if (selection_rect) | 330 if (selection_rect) |
331 *selection_rect = observer.selection_rect(); | 331 *selection_rect = observer.selection_rect(); |
332 return observer.number_of_matches(); | 332 return observer.number_of_matches(); |
333 } | 333 } |
334 | 334 |
335 void DownloadURL(Browser* browser, const GURL& download_url) { | 335 void DownloadURL(Browser* browser, const GURL& download_url) { |
336 base::ScopedTempDir downloads_directory; | 336 base::ScopedTempDir downloads_directory; |
337 ASSERT_TRUE(downloads_directory.CreateUniqueTempDir()); | 337 ASSERT_TRUE(downloads_directory.CreateUniqueTempDir()); |
338 browser->profile()->GetPrefs()->SetFilePath( | 338 browser->profile()->GetPrefs()->SetFilePath(prefs::kDownloadDefaultDirectory, |
339 prefs::kDownloadDefaultDirectory, downloads_directory.path()); | 339 downloads_directory.GetPath()); |
340 | 340 |
341 content::DownloadManager* download_manager = | 341 content::DownloadManager* download_manager = |
342 content::BrowserContext::GetDownloadManager(browser->profile()); | 342 content::BrowserContext::GetDownloadManager(browser->profile()); |
343 std::unique_ptr<content::DownloadTestObserver> observer( | 343 std::unique_ptr<content::DownloadTestObserver> observer( |
344 new content::DownloadTestObserverTerminal( | 344 new content::DownloadTestObserverTerminal( |
345 download_manager, 1, | 345 download_manager, 1, |
346 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT)); | 346 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT)); |
347 | 347 |
348 ui_test_utils::NavigateToURL(browser, download_url); | 348 ui_test_utils::NavigateToURL(browser, download_url); |
349 observer->WaitForFinished(); | 349 observer->WaitForFinished(); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 new content::MessageLoopRunner; | 534 new content::MessageLoopRunner; |
535 WaitHistoryLoadedObserver observer(runner.get()); | 535 WaitHistoryLoadedObserver observer(runner.get()); |
536 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> | 536 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> |
537 scoped_observer(&observer); | 537 scoped_observer(&observer); |
538 scoped_observer.Add(history_service); | 538 scoped_observer.Add(history_service); |
539 runner->Run(); | 539 runner->Run(); |
540 } | 540 } |
541 } | 541 } |
542 | 542 |
543 } // namespace ui_test_utils | 543 } // namespace ui_test_utils |
OLD | NEW |