| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/download/download_service.h" | 10 #include "chrome/browser/download/download_service.h" |
| 11 #include "chrome/browser/download/download_service_factory.h" | 11 #include "chrome/browser/download/download_service_factory.h" |
| 12 #include "chrome/browser/download/download_test_observer.h" | 12 #include "chrome/browser/download/download_test_observer.h" |
| 13 #include "chrome/browser/net/url_request_mock_util.h" | 13 #include "chrome/browser/net/url_request_mock_util.h" |
| 14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/browser/ui/webui/chromeos/active_downloads_ui.h" | |
| 20 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
| 21 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 22 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
| 23 #include "chrome/test/base/in_process_browser_test.h" | 22 #include "chrome/test/base/in_process_browser_test.h" |
| 24 #include "chrome/test/base/ui_test_utils.h" | 23 #include "chrome/test/base/ui_test_utils.h" |
| 25 #include "content/public/browser/download_item.h" | 24 #include "content/public/browser/download_item.h" |
| 26 #include "content/public/common/page_transition_types.h" | 25 #include "content/public/common/page_transition_types.h" |
| 27 #include "content/test/net/url_request_slow_download_job.h" | 26 #include "content/test/net/url_request_slow_download_job.h" |
| 28 | 27 |
| 29 using content::BrowserThread; | 28 using content::BrowserThread; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 check_case.profile_b.incognito.windows, | 310 check_case.profile_b.incognito.windows, |
| 312 }; | 311 }; |
| 313 for (size_t j = 0; j < arraysize(browsers); ++j) { | 312 for (size_t j = 0; j < arraysize(browsers); ++j) { |
| 314 bool result = AdjustBrowsersOnProfile(browsers[j], window_counts[j]); | 313 bool result = AdjustBrowsersOnProfile(browsers[j], window_counts[j]); |
| 315 EXPECT_TRUE(result); | 314 EXPECT_TRUE(result); |
| 316 if (!result) | 315 if (!result) |
| 317 return false; | 316 return false; |
| 318 } | 317 } |
| 319 ui_test_utils::RunAllPendingInMessageLoop(); | 318 ui_test_utils::RunAllPendingInMessageLoop(); |
| 320 | 319 |
| 321 #if defined(OS_CHROMEOS) | |
| 322 // Get rid of downloads panel on ChromeOS | |
| 323 Browser* panel = ActiveDownloadsUI::GetPopup(); | |
| 324 if (panel) | |
| 325 panel->CloseWindow(); | |
| 326 ui_test_utils::RunAllPendingInMessageLoop(); | |
| 327 #endif | |
| 328 | |
| 329 // All that work, for this one little test. | 320 // All that work, for this one little test. |
| 330 EXPECT_TRUE((check_case.window_to_probe == | 321 EXPECT_TRUE((check_case.window_to_probe == |
| 331 DownloadsCloseCheckCase::REGULAR) || | 322 DownloadsCloseCheckCase::REGULAR) || |
| 332 (check_case.window_to_probe == | 323 (check_case.window_to_probe == |
| 333 DownloadsCloseCheckCase::INCOGNITO)); | 324 DownloadsCloseCheckCase::INCOGNITO)); |
| 334 if (!((check_case.window_to_probe == | 325 if (!((check_case.window_to_probe == |
| 335 DownloadsCloseCheckCase::REGULAR) || | 326 DownloadsCloseCheckCase::REGULAR) || |
| 336 (check_case.window_to_probe == | 327 (check_case.window_to_probe == |
| 337 DownloadsCloseCheckCase::INCOGNITO))) | 328 DownloadsCloseCheckCase::INCOGNITO))) |
| 338 return false; | 329 return false; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 #define MAYBE_DownloadsCloseCheck_5 DownloadsCloseCheck_5 | 546 #define MAYBE_DownloadsCloseCheck_5 DownloadsCloseCheck_5 |
| 556 #endif | 547 #endif |
| 557 | 548 |
| 558 IN_PROC_BROWSER_TEST_F(BrowserCloseTest, MAYBE_DownloadsCloseCheck_5) { | 549 IN_PROC_BROWSER_TEST_F(BrowserCloseTest, MAYBE_DownloadsCloseCheck_5) { |
| 559 ASSERT_TRUE(SetupForDownloadCloseCheck()); | 550 ASSERT_TRUE(SetupForDownloadCloseCheck()); |
| 560 for (size_t i = 5 * arraysize(download_close_check_cases) / 6; | 551 for (size_t i = 5 * arraysize(download_close_check_cases) / 6; |
| 561 i < 6 * arraysize(download_close_check_cases) / 6; ++i) { | 552 i < 6 * arraysize(download_close_check_cases) / 6; ++i) { |
| 562 ExecuteDownloadCloseCheckCase(i); | 553 ExecuteDownloadCloseCheckCase(i); |
| 563 } | 554 } |
| 564 } | 555 } |
| OLD | NEW |