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/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/download/download_service.h" | 11 #include "chrome/browser/download/download_service.h" |
12 #include "chrome/browser/download/download_service_factory.h" | 12 #include "chrome/browser/download/download_service_factory.h" |
13 #include "chrome/browser/download/download_test_file_activity_observer.h" | 13 #include "chrome/browser/download/download_test_file_activity_observer.h" |
14 #include "chrome/browser/net/url_request_mock_util.h" | 14 #include "chrome/browser/net/url_request_mock_util.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_iterator.h" | 18 #include "chrome/browser/ui/browser_iterator.h" |
19 #include "chrome/browser/ui/browser_tabstrip.h" | 19 #include "chrome/browser/ui/browser_tabstrip.h" |
20 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
21 #include "chrome/browser/ui/host_desktop.h" | 21 #include "chrome/browser/ui/host_desktop.h" |
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
23 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
25 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
26 #include "chrome/test/base/in_process_browser_test.h" | 26 #include "chrome/test/base/in_process_browser_test.h" |
27 #include "chrome/test/base/ui_test_utils.h" | 27 #include "chrome/test/base/ui_test_utils.h" |
28 #include "content/public/browser/download_item.h" | 28 #include "content/public/browser/download_item.h" |
29 #include "content/public/common/page_transition_types.h" | |
30 #include "content/public/test/browser_test_utils.h" | 29 #include "content/public/test/browser_test_utils.h" |
31 #include "content/public/test/download_test_observer.h" | 30 #include "content/public/test/download_test_observer.h" |
32 #include "content/test/net/url_request_slow_download_job.h" | 31 #include "content/test/net/url_request_slow_download_job.h" |
| 32 #include "ui/base/page_transition_types.h" |
33 | 33 |
34 using content::BrowserContext; | 34 using content::BrowserContext; |
35 using content::BrowserThread; | 35 using content::BrowserThread; |
36 using content::DownloadItem; | 36 using content::DownloadItem; |
37 using content::DownloadManager; | 37 using content::DownloadManager; |
38 using content::URLRequestSlowDownloadJob; | 38 using content::URLRequestSlowDownloadJob; |
39 | 39 |
40 class BrowserCloseTest : public InProcessBrowserTest { | 40 class BrowserCloseTest : public InProcessBrowserTest { |
41 public: | 41 public: |
42 // Structure defining test cases for DownloadsCloseCheck. | 42 // Structure defining test cases for DownloadsCloseCheck. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 // Create a Browser (with associated window) on the specified profile. | 176 // Create a Browser (with associated window) on the specified profile. |
177 Browser* CreateBrowserOnProfile(Profile* profile, | 177 Browser* CreateBrowserOnProfile(Profile* profile, |
178 chrome::HostDesktopType host_desktop_type) { | 178 chrome::HostDesktopType host_desktop_type) { |
179 Browser* new_browser = | 179 Browser* new_browser = |
180 new Browser(Browser::CreateParams(profile, host_desktop_type)); | 180 new Browser(Browser::CreateParams(profile, host_desktop_type)); |
181 chrome::AddSelectedTabWithURL(new_browser, | 181 chrome::AddSelectedTabWithURL(new_browser, |
182 GURL(url::kAboutBlankURL), | 182 GURL(url::kAboutBlankURL), |
183 content::PAGE_TRANSITION_AUTO_TOPLEVEL); | 183 ui::PAGE_TRANSITION_AUTO_TOPLEVEL); |
184 content::WaitForLoadStop( | 184 content::WaitForLoadStop( |
185 new_browser->tab_strip_model()->GetActiveWebContents()); | 185 new_browser->tab_strip_model()->GetActiveWebContents()); |
186 new_browser->window()->Show(); | 186 new_browser->window()->Show(); |
187 return new_browser; | 187 return new_browser; |
188 } | 188 } |
189 | 189 |
190 // Adjust the number of browsers and associated windows up or down | 190 // Adjust the number of browsers and associated windows up or down |
191 // to |num_windows|. This routine assumes that there is only a single | 191 // to |num_windows|. This routine assumes that there is only a single |
192 // browser associated with the profile on entry. |*base_browser| contains | 192 // browser associated with the profile on entry. |*base_browser| contains |
193 // this browser, and the profile is derived from that browser. On output, | 193 // this browser, and the profile is derived from that browser. On output, |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 } | 561 } |
562 } | 562 } |
563 | 563 |
564 IN_PROC_BROWSER_TEST_F(BrowserCloseTest, MAYBE_DownloadsCloseCheck_5) { | 564 IN_PROC_BROWSER_TEST_F(BrowserCloseTest, MAYBE_DownloadsCloseCheck_5) { |
565 ASSERT_TRUE(SetupForDownloadCloseCheck()); | 565 ASSERT_TRUE(SetupForDownloadCloseCheck()); |
566 for (size_t i = 5 * arraysize(download_close_check_cases) / 6; | 566 for (size_t i = 5 * arraysize(download_close_check_cases) / 6; |
567 i < 6 * arraysize(download_close_check_cases) / 6; ++i) { | 567 i < 6 * arraysize(download_close_check_cases) / 6; ++i) { |
568 ExecuteDownloadCloseCheckCase(i); | 568 ExecuteDownloadCloseCheckCase(i); |
569 } | 569 } |
570 } | 570 } |
OLD | NEW |