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

Side by Side Diff: chrome/browser/download/download_browsertest.cc

Issue 11419276: Remove tabstrip wrappers in browser_tabstrip. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gtk Created 8 years 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 | Annotate | Revision Log
OLDNEW
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 <sstream> 5 #include <sstream>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 27 matching lines...) Expand all
38 #include "chrome/browser/prefs/pref_service.h" 38 #include "chrome/browser/prefs/pref_service.h"
39 #include "chrome/browser/profiles/profile.h" 39 #include "chrome/browser/profiles/profile.h"
40 #include "chrome/browser/tab_contents/render_view_context_menu.h" 40 #include "chrome/browser/tab_contents/render_view_context_menu.h"
41 #include "chrome/browser/ui/browser.h" 41 #include "chrome/browser/ui/browser.h"
42 #include "chrome/browser/ui/browser_commands.h" 42 #include "chrome/browser/ui/browser_commands.h"
43 #include "chrome/browser/ui/browser_list.h" 43 #include "chrome/browser/ui/browser_list.h"
44 #include "chrome/browser/ui/browser_tabstrip.h" 44 #include "chrome/browser/ui/browser_tabstrip.h"
45 #include "chrome/browser/ui/browser_window.h" 45 #include "chrome/browser/ui/browser_window.h"
46 #include "chrome/browser/ui/chrome_pages.h" 46 #include "chrome/browser/ui/chrome_pages.h"
47 #include "chrome/browser/ui/host_desktop.h" 47 #include "chrome/browser/ui/host_desktop.h"
48 #include "chrome/browser/ui/tabs/tab_strip_model.h"
48 #include "chrome/common/chrome_notification_types.h" 49 #include "chrome/common/chrome_notification_types.h"
49 #include "chrome/common/chrome_paths.h" 50 #include "chrome/common/chrome_paths.h"
50 #include "chrome/common/extensions/feature_switch.h" 51 #include "chrome/common/extensions/feature_switch.h"
51 #include "chrome/common/pref_names.h" 52 #include "chrome/common/pref_names.h"
52 #include "chrome/common/url_constants.h" 53 #include "chrome/common/url_constants.h"
53 #include "chrome/test/base/in_process_browser_test.h" 54 #include "chrome/test/base/in_process_browser_test.h"
54 #include "chrome/test/base/ui_test_utils.h" 55 #include "chrome/test/base/ui_test_utils.h"
55 #include "content/public/browser/download_item.h" 56 #include "content/public/browser/download_item.h"
56 #include "content/public/browser/download_manager.h" 57 #include "content/public/browser/download_manager.h"
57 #include "content/public/browser/download_save_info.h" 58 #include "content/public/browser/download_save_info.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // in the caller. 278 // in the caller.
278 virtual bool InitialSetup() { 279 virtual bool InitialSetup() {
279 bool have_test_dir = PathService::Get(chrome::DIR_TEST_DATA, &test_dir_); 280 bool have_test_dir = PathService::Get(chrome::DIR_TEST_DATA, &test_dir_);
280 EXPECT_TRUE(have_test_dir); 281 EXPECT_TRUE(have_test_dir);
281 if (!have_test_dir) 282 if (!have_test_dir)
282 return false; 283 return false;
283 284
284 // Sanity check default values for window / tab count and shelf visibility. 285 // Sanity check default values for window / tab count and shelf visibility.
285 int window_count = BrowserList::size(); 286 int window_count = BrowserList::size();
286 EXPECT_EQ(1, window_count); 287 EXPECT_EQ(1, window_count);
287 EXPECT_EQ(1, browser()->tab_count()); 288 EXPECT_EQ(1, browser()->tab_strip_model()->count());
288 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 289 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
289 290
290 // Set up the temporary download folder. 291 // Set up the temporary download folder.
291 bool created_downloads_dir = CreateAndSetDownloadsDirectory(browser()); 292 bool created_downloads_dir = CreateAndSetDownloadsDirectory(browser());
292 EXPECT_TRUE(created_downloads_dir); 293 EXPECT_TRUE(created_downloads_dir);
293 if (!created_downloads_dir) 294 if (!created_downloads_dir)
294 return false; 295 return false;
295 browser()->profile()->GetPrefs()->SetBoolean( 296 browser()->profile()->GetPrefs()->SetBoolean(
296 prefs::kPromptForDownload, false); 297 prefs::kPromptForDownload, false);
297 298
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 843
843 // Download a file due to the associated MIME type. 844 // Download a file due to the associated MIME type.
844 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeType) { 845 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeType) {
845 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 846 FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
846 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); 847 GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
847 848
848 // Download the file and wait. We do not expect the Select File dialog. 849 // Download the file and wait. We do not expect the Select File dialog.
849 DownloadAndWait(browser(), url); 850 DownloadAndWait(browser(), url);
850 851
851 // Check state. 852 // Check state.
852 EXPECT_EQ(1, browser()->tab_count()); 853 EXPECT_EQ(1, browser()->tab_strip_model()->count());
853 CheckDownload(browser(), file, file); 854 CheckDownload(browser(), file, file);
854 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 855 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
855 } 856 }
856 857
857 #if defined(OS_WIN) 858 #if defined(OS_WIN)
858 // Download a file and confirm that the zone identifier (on windows) 859 // Download a file and confirm that the zone identifier (on windows)
859 // is set to internet. 860 // is set to internet.
860 IN_PROC_BROWSER_TEST_F(DownloadTest, CheckInternetZone) { 861 IN_PROC_BROWSER_TEST_F(DownloadTest, CheckInternetZone) {
861 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 862 FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
862 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); 863 GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
863 864
864 // Download the file and wait. We do not expect the Select File dialog. 865 // Download the file and wait. We do not expect the Select File dialog.
865 DownloadAndWait(browser(), url); 866 DownloadAndWait(browser(), url);
866 867
867 // Check state. Special file state must be checked before CheckDownload, 868 // Check state. Special file state must be checked before CheckDownload,
868 // as CheckDownload will delete the output file. 869 // as CheckDownload will delete the output file.
869 EXPECT_EQ(1, browser()->tab_count()); 870 EXPECT_EQ(1, browser()->tab_strip_model()->count());
870 FilePath downloaded_file(DestinationFile(browser(), file)); 871 FilePath downloaded_file(DestinationFile(browser(), file));
871 if (file_util::VolumeSupportsADS(downloaded_file)) 872 if (file_util::VolumeSupportsADS(downloaded_file))
872 EXPECT_TRUE(file_util::HasInternetZoneIdentifier(downloaded_file)); 873 EXPECT_TRUE(file_util::HasInternetZoneIdentifier(downloaded_file));
873 CheckDownload(browser(), file, file); 874 CheckDownload(browser(), file, file);
874 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 875 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
875 } 876 }
876 #endif 877 #endif
877 878
878 // Put up a Select File dialog when the file is downloaded, due to 879 // Put up a Select File dialog when the file is downloaded, due to
879 // downloads preferences settings. 880 // downloads preferences settings.
(...skipping 15 matching lines...) Expand all
895 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); 896 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL));
896 ui_test_utils::NavigateToURLWithDisposition( 897 ui_test_utils::NavigateToURLWithDisposition(
897 browser(), url, CURRENT_TAB, 898 browser(), url, CURRENT_TAB,
898 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 899 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
899 observer->WaitForFinished(); 900 observer->WaitForFinished();
900 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::COMPLETE)); 901 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::COMPLETE));
901 CheckDownloadStates(1, DownloadItem::COMPLETE); 902 CheckDownloadStates(1, DownloadItem::COMPLETE);
902 EXPECT_TRUE(DidShowFileChooser()); 903 EXPECT_TRUE(DidShowFileChooser());
903 904
904 // Check state. 905 // Check state.
905 EXPECT_EQ(1, browser()->tab_count()); 906 EXPECT_EQ(1, browser()->tab_strip_model()->count());
906 CheckDownload(browser(), file, file); 907 CheckDownload(browser(), file, file);
907 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 908 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
908 } 909 }
909 910
910 // Access a file with a viewable mime-type, verify that a download 911 // Access a file with a viewable mime-type, verify that a download
911 // did not initiate. 912 // did not initiate.
912 IN_PROC_BROWSER_TEST_F(DownloadTest, NoDownload) { 913 IN_PROC_BROWSER_TEST_F(DownloadTest, NoDownload) {
913 FilePath file(FILE_PATH_LITERAL("download-test2.html")); 914 FilePath file(FILE_PATH_LITERAL("download-test2.html"));
914 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); 915 GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
915 FilePath file_path(DestinationFile(browser(), file)); 916 FilePath file_path(DestinationFile(browser(), file));
916 917
917 // Open a web page and wait. 918 // Open a web page and wait.
918 ui_test_utils::NavigateToURL(browser(), url); 919 ui_test_utils::NavigateToURL(browser(), url);
919 920
920 // Check that we did not download the web page. 921 // Check that we did not download the web page.
921 EXPECT_FALSE(file_util::PathExists(file_path)); 922 EXPECT_FALSE(file_util::PathExists(file_path));
922 923
923 // Check state. 924 // Check state.
924 EXPECT_EQ(1, browser()->tab_count()); 925 EXPECT_EQ(1, browser()->tab_strip_model()->count());
925 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 926 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
926 } 927 }
927 928
928 IN_PROC_BROWSER_TEST_F(DownloadTest, MimeTypesToShowNotDownload) { 929 IN_PROC_BROWSER_TEST_F(DownloadTest, MimeTypesToShowNotDownload) {
929 ASSERT_TRUE(test_server()->Start()); 930 ASSERT_TRUE(test_server()->Start());
930 931
931 // These files should all be displayed in the browser. 932 // These files should all be displayed in the browser.
932 const char* mime_types[] = { 933 const char* mime_types[] = {
933 // It is unclear whether to display text/css or download it. 934 // It is unclear whether to display text/css or download it.
934 // Firefox 3: Display 935 // Firefox 3: Display
(...skipping 15 matching lines...) Expand all
950 "image/jpeg", 951 "image/jpeg",
951 "image/bmp", 952 "image/bmp",
952 }; 953 };
953 for (size_t i = 0; i < arraysize(mime_types); ++i) { 954 for (size_t i = 0; i < arraysize(mime_types); ++i) {
954 const char* mime_type = mime_types[i]; 955 const char* mime_type = mime_types[i];
955 std::string path("contenttype?"); 956 std::string path("contenttype?");
956 GURL url(test_server()->GetURL(path + mime_type)); 957 GURL url(test_server()->GetURL(path + mime_type));
957 ui_test_utils::NavigateToURL(browser(), url); 958 ui_test_utils::NavigateToURL(browser(), url);
958 959
959 // Check state. 960 // Check state.
960 EXPECT_EQ(1, browser()->tab_count()); 961 EXPECT_EQ(1, browser()->tab_strip_model()->count());
961 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 962 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
962 } 963 }
963 } 964 }
964 965
965 // Verify that when the DownloadResourceThrottle cancels a download, the 966 // Verify that when the DownloadResourceThrottle cancels a download, the
966 // download never makes it to the downloads system. 967 // download never makes it to the downloads system.
967 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadResourceThrottleCancels) { 968 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadResourceThrottleCancels) {
968 // Navigate to a page with the same domain as the file to download. We can't 969 // Navigate to a page with the same domain as the file to download. We can't
969 // navigate directly to the file we don't want to download because cross-site 970 // navigate directly to the file we don't want to download because cross-site
970 // navigations reset the TabDownloadState. 971 // navigations reset the TabDownloadState.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 base::Bind(&content::RunMessageLoop), 1005 base::Bind(&content::RunMessageLoop),
1005 base::Bind(&MessageLoop::Quit, 1006 base::Bind(&MessageLoop::Quit,
1006 base::Unretained(MessageLoopForUI::current()))); 1007 base::Unretained(MessageLoopForUI::current())));
1007 1008
1008 // Check that we did not download the file. 1009 // Check that we did not download the file.
1009 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 1010 FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
1010 FilePath file_path(DestinationFile(browser(), file)); 1011 FilePath file_path(DestinationFile(browser(), file));
1011 EXPECT_FALSE(file_util::PathExists(file_path)); 1012 EXPECT_FALSE(file_util::PathExists(file_path));
1012 1013
1013 // Check state. 1014 // Check state.
1014 EXPECT_EQ(1, browser()->tab_count()); 1015 EXPECT_EQ(1, browser()->tab_strip_model()->count());
1015 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 1016 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
1016 1017
1017 // Verify that there's no pending download. The resource throttle 1018 // Verify that there's no pending download. The resource throttle
1018 // should have deleted it before it created a download item, so it 1019 // should have deleted it before it created a download item, so it
1019 // shouldn't be available as a cancelled download either. 1020 // shouldn't be available as a cancelled download either.
1020 DownloadManagerForBrowser(browser())->GetAllDownloads(&items); 1021 DownloadManagerForBrowser(browser())->GetAllDownloads(&items);
1021 EXPECT_EQ(0u, items.size()); 1022 EXPECT_EQ(0u, items.size());
1022 } 1023 }
1023 1024
1024 // Download a 0-size file with a content-disposition header, verify that the 1025 // Download a 0-size file with a content-disposition header, verify that the
1025 // download tab opened and the file exists as the filename specified in the 1026 // download tab opened and the file exists as the filename specified in the
1026 // header. This also ensures we properly handle empty file downloads. 1027 // header. This also ensures we properly handle empty file downloads.
1027 // The download shelf should be visible in the current tab. 1028 // The download shelf should be visible in the current tab.
1028 IN_PROC_BROWSER_TEST_F(DownloadTest, ContentDisposition) { 1029 IN_PROC_BROWSER_TEST_F(DownloadTest, ContentDisposition) {
1029 FilePath file(FILE_PATH_LITERAL("download-test3.gif")); 1030 FilePath file(FILE_PATH_LITERAL("download-test3.gif"));
1030 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); 1031 GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
1031 FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); 1032 FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif"));
1032 1033
1033 // Download a file and wait. 1034 // Download a file and wait.
1034 DownloadAndWait(browser(), url); 1035 DownloadAndWait(browser(), url);
1035 1036
1036 CheckDownload(browser(), download_file, file); 1037 CheckDownload(browser(), download_file, file);
1037 1038
1038 // Check state. 1039 // Check state.
1039 EXPECT_EQ(1, browser()->tab_count()); 1040 EXPECT_EQ(1, browser()->tab_strip_model()->count());
1040 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 1041 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
1041 } 1042 }
1042 1043
1043 // Test that the download shelf is per-window by starting a download in one 1044 // Test that the download shelf is per-window by starting a download in one
1044 // tab, opening a second tab, closing the shelf, going back to the first tab, 1045 // tab, opening a second tab, closing the shelf, going back to the first tab,
1045 // and checking that the shelf is closed. 1046 // and checking that the shelf is closed.
1046 IN_PROC_BROWSER_TEST_F(DownloadTest, PerWindowShelf) { 1047 IN_PROC_BROWSER_TEST_F(DownloadTest, PerWindowShelf) {
1047 FilePath file(FILE_PATH_LITERAL("download-test3.gif")); 1048 FilePath file(FILE_PATH_LITERAL("download-test3.gif"));
1048 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); 1049 GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
1049 FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); 1050 FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif"));
1050 1051
1051 // Download a file and wait. 1052 // Download a file and wait.
1052 DownloadAndWait(browser(), url); 1053 DownloadAndWait(browser(), url);
1053 1054
1054 CheckDownload(browser(), download_file, file); 1055 CheckDownload(browser(), download_file, file);
1055 1056
1056 // Check state. 1057 // Check state.
1057 EXPECT_EQ(1, browser()->tab_count()); 1058 EXPECT_EQ(1, browser()->tab_strip_model()->count());
1058 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 1059 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
1059 1060
1060 // Open a second tab and wait. 1061 // Open a second tab and wait.
1061 EXPECT_NE(static_cast<WebContents*>(NULL), 1062 EXPECT_NE(static_cast<WebContents*>(NULL),
1062 chrome::AddSelectedTabWithURL(browser(), GURL(), 1063 chrome::AddSelectedTabWithURL(browser(), GURL(),
1063 content::PAGE_TRANSITION_TYPED)); 1064 content::PAGE_TRANSITION_TYPED));
1064 EXPECT_EQ(2, browser()->tab_count()); 1065 EXPECT_EQ(2, browser()->tab_strip_model()->count());
1065 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 1066 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
1066 1067
1067 // Hide the download shelf. 1068 // Hide the download shelf.
1068 browser()->window()->GetDownloadShelf()->Close(); 1069 browser()->window()->GetDownloadShelf()->Close();
1069 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 1070 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
1070 1071
1071 // Go to the first tab. 1072 // Go to the first tab.
1072 chrome::ActivateTabAt(browser(), 0, true); 1073 browser()->tab_strip_model()->ActivateTabAt(0, true);
1073 EXPECT_EQ(2, browser()->tab_count()); 1074 EXPECT_EQ(2, browser()->tab_strip_model()->count());
1074 1075
1075 // The download shelf should not be visible. 1076 // The download shelf should not be visible.
1076 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 1077 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
1077 } 1078 }
1078 1079
1079 // Check whether the downloads shelf is closed when the downloads tab is 1080 // Check whether the downloads shelf is closed when the downloads tab is
1080 // invoked. 1081 // invoked.
1081 IN_PROC_BROWSER_TEST_F(DownloadTest, CloseShelfOnDownloadsTab) { 1082 IN_PROC_BROWSER_TEST_F(DownloadTest, CloseShelfOnDownloadsTab) {
1082 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 1083 FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
1083 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); 1084 GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
1084 1085
1085 // Download the file and wait. We do not expect the Select File dialog. 1086 // Download the file and wait. We do not expect the Select File dialog.
1086 DownloadAndWait(browser(), url); 1087 DownloadAndWait(browser(), url);
1087 1088
1088 // Check state. 1089 // Check state.
1089 EXPECT_EQ(1, browser()->tab_count()); 1090 EXPECT_EQ(1, browser()->tab_strip_model()->count());
1090 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 1091 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
1091 1092
1092 // Open the downloads tab. 1093 // Open the downloads tab.
1093 chrome::ShowDownloads(browser()); 1094 chrome::ShowDownloads(browser());
1094 // The shelf should now be closed. 1095 // The shelf should now be closed.
1095 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 1096 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
1096 } 1097 }
1097 1098
1098 // UnknownSize and KnownSize are tests which depend on 1099 // UnknownSize and KnownSize are tests which depend on
1099 // URLRequestSlowDownloadJob to serve content in a certain way. Data will be 1100 // URLRequestSlowDownloadJob to serve content in a certain way. Data will be
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 GURL url(URLRequestMockHTTPJob::GetMockUrl(file1)); 1174 GURL url(URLRequestMockHTTPJob::GetMockUrl(file1));
1174 1175
1175 // Open a web page and wait. 1176 // Open a web page and wait.
1176 ui_test_utils::NavigateToURLWithDisposition( 1177 ui_test_utils::NavigateToURLWithDisposition(
1177 browser(), 1178 browser(),
1178 url, 1179 url,
1179 NEW_BACKGROUND_TAB, 1180 NEW_BACKGROUND_TAB,
1180 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 1181 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
1181 1182
1182 // We should have two tabs now. 1183 // We should have two tabs now.
1183 EXPECT_EQ(2, browser()->tab_count()); 1184 EXPECT_EQ(2, browser()->tab_strip_model()->count());
1184 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 1185 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
1185 } 1186 }
1186 1187
1187 // Download a file in a background tab. Verify that the tab is closed 1188 // Download a file in a background tab. Verify that the tab is closed
1188 // automatically, and that the download shelf is visible in the current tab. 1189 // automatically, and that the download shelf is visible in the current tab.
1189 IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab1) { 1190 IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab1) {
1190 // Download a file in a new background tab and wait. The tab is automatically 1191 // Download a file in a new background tab and wait. The tab is automatically
1191 // closed when the download begins. 1192 // closed when the download begins.
1192 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 1193 FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
1193 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); 1194 GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
1194 DownloadAndWaitWithDisposition( 1195 DownloadAndWaitWithDisposition(
1195 browser(), 1196 browser(),
1196 url, 1197 url,
1197 NEW_BACKGROUND_TAB, 1198 NEW_BACKGROUND_TAB,
1198 0); 1199 0);
1199 1200
1200 // When the download finishes, we should still have one tab. 1201 // When the download finishes, we should still have one tab.
1201 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 1202 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
1202 EXPECT_EQ(1, browser()->tab_count()); 1203 EXPECT_EQ(1, browser()->tab_strip_model()->count());
1203 1204
1204 CheckDownload(browser(), file, file); 1205 CheckDownload(browser(), file, file);
1205 } 1206 }
1206 1207
1207 // Open a web page in the current tab, then download a file in another tab via 1208 // Open a web page in the current tab, then download a file in another tab via
1208 // a Javascript call. 1209 // a Javascript call.
1209 // Verify that we have 2 tabs, and the download shelf is visible in the current 1210 // Verify that we have 2 tabs, and the download shelf is visible in the current
1210 // tab. 1211 // tab.
1211 // 1212 //
1212 // The download_page1.html page contains an openNew() function that opens a 1213 // The download_page1.html page contains an openNew() function that opens a
1213 // tab and then downloads download-test1.lib. 1214 // tab and then downloads download-test1.lib.
1214 IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab2) { 1215 IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab2) {
1215 // Because it's an HTML link, it should open a web page rather than 1216 // Because it's an HTML link, it should open a web page rather than
1216 // downloading. 1217 // downloading.
1217 FilePath file1(FILE_PATH_LITERAL("download_page1.html")); 1218 FilePath file1(FILE_PATH_LITERAL("download_page1.html"));
1218 GURL url(URLRequestMockHTTPJob::GetMockUrl(file1)); 1219 GURL url(URLRequestMockHTTPJob::GetMockUrl(file1));
1219 1220
1220 // Open a web page and wait. 1221 // Open a web page and wait.
1221 ui_test_utils::NavigateToURL(browser(), url); 1222 ui_test_utils::NavigateToURL(browser(), url);
1222 1223
1223 // Download a file in a new tab and wait (via Javascript). 1224 // Download a file in a new tab and wait (via Javascript).
1224 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 1225 FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
1225 DownloadAndWaitWithDisposition(browser(), 1226 DownloadAndWaitWithDisposition(browser(),
1226 GURL("javascript:openNew()"), 1227 GURL("javascript:openNew()"),
1227 CURRENT_TAB, 1228 CURRENT_TAB,
1228 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); 1229 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
1229 1230
1230 // When the download finishes, we should have two tabs. 1231 // When the download finishes, we should have two tabs.
1231 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 1232 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
1232 EXPECT_EQ(2, browser()->tab_count()); 1233 EXPECT_EQ(2, browser()->tab_strip_model()->count());
1233 1234
1234 CheckDownload(browser(), file, file); 1235 CheckDownload(browser(), file, file);
1235 } 1236 }
1236 1237
1237 // Open a web page in the current tab, open another tab via a Javascript call, 1238 // Open a web page in the current tab, open another tab via a Javascript call,
1238 // then download a file in the new tab. 1239 // then download a file in the new tab.
1239 // Verify that we have 2 tabs, and the download shelf is visible in the current 1240 // Verify that we have 2 tabs, and the download shelf is visible in the current
1240 // tab. 1241 // tab.
1241 // 1242 //
1242 // The download_page2.html page contains an openNew() function that opens a 1243 // The download_page2.html page contains an openNew() function that opens a
1243 // tab. 1244 // tab.
1244 IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab3) { 1245 IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab3) {
1245 // Because it's an HTML link, it should open a web page rather than 1246 // Because it's an HTML link, it should open a web page rather than
1246 // downloading. 1247 // downloading.
1247 FilePath file1(FILE_PATH_LITERAL("download_page2.html")); 1248 FilePath file1(FILE_PATH_LITERAL("download_page2.html"));
1248 GURL url1(URLRequestMockHTTPJob::GetMockUrl(file1)); 1249 GURL url1(URLRequestMockHTTPJob::GetMockUrl(file1));
1249 1250
1250 // Open a web page and wait. 1251 // Open a web page and wait.
1251 ui_test_utils::NavigateToURL(browser(), url1); 1252 ui_test_utils::NavigateToURL(browser(), url1);
1252 1253
1253 // Open a new tab and wait. 1254 // Open a new tab and wait.
1254 ui_test_utils::NavigateToURLWithDisposition( 1255 ui_test_utils::NavigateToURLWithDisposition(
1255 browser(), 1256 browser(),
1256 GURL("javascript:openNew()"), 1257 GURL("javascript:openNew()"),
1257 CURRENT_TAB, 1258 CURRENT_TAB,
1258 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); 1259 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
1259 1260
1260 EXPECT_EQ(2, browser()->tab_count()); 1261 EXPECT_EQ(2, browser()->tab_strip_model()->count());
1261 1262
1262 // Download a file and wait. 1263 // Download a file and wait.
1263 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 1264 FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
1264 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); 1265 GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
1265 DownloadAndWaitWithDisposition(browser(), 1266 DownloadAndWaitWithDisposition(browser(),
1266 url, 1267 url,
1267 CURRENT_TAB, 1268 CURRENT_TAB,
1268 ui_test_utils::BROWSER_TEST_NONE); 1269 ui_test_utils::BROWSER_TEST_NONE);
1269 1270
1270 // When the download finishes, we should have two tabs. 1271 // When the download finishes, we should have two tabs.
1271 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 1272 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
1272 EXPECT_EQ(2, browser()->tab_count()); 1273 EXPECT_EQ(2, browser()->tab_strip_model()->count());
1273 1274
1274 CheckDownload(browser(), file, file); 1275 CheckDownload(browser(), file, file);
1275 } 1276 }
1276 1277
1277 // Open a web page in the current tab, then download a file via Javascript, 1278 // Open a web page in the current tab, then download a file via Javascript,
1278 // which will do so in a temporary tab. 1279 // which will do so in a temporary tab.
1279 // Verify that we have 1 tab, and the download shelf is visible. 1280 // Verify that we have 1 tab, and the download shelf is visible.
1280 // 1281 //
1281 // The download_page3.html page contains an openNew() function that opens a 1282 // The download_page3.html page contains an openNew() function that opens a
1282 // tab with download-test1.lib in the URL. When the URL is determined to be 1283 // tab with download-test1.lib in the URL. When the URL is determined to be
(...skipping 10 matching lines...) Expand all
1293 // Download a file and wait. 1294 // Download a file and wait.
1294 // The file to download is "download-test1.lib". 1295 // The file to download is "download-test1.lib".
1295 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 1296 FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
1296 DownloadAndWaitWithDisposition(browser(), 1297 DownloadAndWaitWithDisposition(browser(),
1297 GURL("javascript:openNew()"), 1298 GURL("javascript:openNew()"),
1298 CURRENT_TAB, 1299 CURRENT_TAB,
1299 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); 1300 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
1300 1301
1301 // When the download finishes, we should still have one tab. 1302 // When the download finishes, we should still have one tab.
1302 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 1303 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
1303 EXPECT_EQ(1, browser()->tab_count()); 1304 EXPECT_EQ(1, browser()->tab_strip_model()->count());
1304 1305
1305 CheckDownload(browser(), file, file); 1306 CheckDownload(browser(), file, file);
1306 } 1307 }
1307 1308
1308 // Open a web page in the current tab, then call Javascript via a button to 1309 // Open a web page in the current tab, then call Javascript via a button to
1309 // download a file in a new tab, which is closed automatically when the 1310 // download a file in a new tab, which is closed automatically when the
1310 // download begins. 1311 // download begins.
1311 // Verify that we have 1 tab, and the download shelf is visible. 1312 // Verify that we have 1 tab, and the download shelf is visible.
1312 // 1313 //
1313 // The download_page4.html page contains a form with download-test1.lib as the 1314 // The download_page4.html page contains a form with download-test1.lib as the
(...skipping 12 matching lines...) Expand all
1326 // The file to download is "download-test1.lib". 1327 // The file to download is "download-test1.lib".
1327 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 1328 FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
1328 DownloadAndWaitWithDisposition( 1329 DownloadAndWaitWithDisposition(
1329 browser(), 1330 browser(),
1330 GURL("javascript:document.getElementById('form').submit()"), 1331 GURL("javascript:document.getElementById('form').submit()"),
1331 CURRENT_TAB, 1332 CURRENT_TAB,
1332 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); 1333 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
1333 1334
1334 // When the download finishes, we should still have one tab. 1335 // When the download finishes, we should still have one tab.
1335 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 1336 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
1336 EXPECT_EQ(1, browser()->tab_count()); 1337 EXPECT_EQ(1, browser()->tab_strip_model()->count());
1337 1338
1338 CheckDownload(browser(), file, file); 1339 CheckDownload(browser(), file, file);
1339 } 1340 }
1340 1341
1341 // Download a file in a new window. 1342 // Download a file in a new window.
1342 // Verify that we have 2 windows, and the download shelf is not visible in the 1343 // Verify that we have 2 windows, and the download shelf is not visible in the
1343 // first window, but is visible in the second window. 1344 // first window, but is visible in the second window.
1344 // Close the new window. 1345 // Close the new window.
1345 // Verify that we have 1 window, and the download shelf is not visible. 1346 // Verify that we have 1 window, and the download shelf is not visible.
1346 // 1347 //
1347 // Regression test for http://crbug.com/44454 1348 // Regression test for http://crbug.com/44454
1348 IN_PROC_BROWSER_TEST_F(DownloadTest, NewWindow) { 1349 IN_PROC_BROWSER_TEST_F(DownloadTest, NewWindow) {
1349 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 1350 FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
1350 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); 1351 GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
1351 #if !defined(OS_MACOSX) 1352 #if !defined(OS_MACOSX)
1352 // See below. 1353 // See below.
1353 Browser* first_browser = browser(); 1354 Browser* first_browser = browser();
1354 #endif 1355 #endif
1355 1356
1356 // Download a file in a new window and wait. 1357 // Download a file in a new window and wait.
1357 DownloadAndWaitWithDisposition(browser(), 1358 DownloadAndWaitWithDisposition(browser(),
1358 url, 1359 url,
1359 NEW_WINDOW, 1360 NEW_WINDOW,
1360 ui_test_utils::BROWSER_TEST_NONE); 1361 ui_test_utils::BROWSER_TEST_NONE);
1361 1362
1362 // When the download finishes, the download shelf SHOULD NOT be visible in 1363 // When the download finishes, the download shelf SHOULD NOT be visible in
1363 // the first window. 1364 // the first window.
1364 ExpectWindowCountAfterDownload(2); 1365 ExpectWindowCountAfterDownload(2);
1365 EXPECT_EQ(1, browser()->tab_count()); 1366 EXPECT_EQ(1, browser()->tab_strip_model()->count());
1366 // Download shelf should close. Download panel stays open on ChromeOS. 1367 // Download shelf should close. Download panel stays open on ChromeOS.
1367 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 1368 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
1368 1369
1369 // The download shelf SHOULD be visible in the second window. 1370 // The download shelf SHOULD be visible in the second window.
1370 std::set<Browser*> original_browsers; 1371 std::set<Browser*> original_browsers;
1371 original_browsers.insert(browser()); 1372 original_browsers.insert(browser());
1372 Browser* download_browser = 1373 Browser* download_browser =
1373 ui_test_utils::GetBrowserNotInSet(original_browsers); 1374 ui_test_utils::GetBrowserNotInSet(original_browsers);
1374 ASSERT_TRUE(download_browser != NULL); 1375 ASSERT_TRUE(download_browser != NULL);
1375 EXPECT_NE(download_browser, browser()); 1376 EXPECT_NE(download_browser, browser());
(...skipping 11 matching lines...) Expand all
1387 1388
1388 // Close the new window. 1389 // Close the new window.
1389 chrome::CloseWindow(download_browser); 1390 chrome::CloseWindow(download_browser);
1390 1391
1391 #if !defined(OS_MACOSX) 1392 #if !defined(OS_MACOSX)
1392 signal.Wait(); 1393 signal.Wait();
1393 EXPECT_EQ(first_browser, browser()); 1394 EXPECT_EQ(first_browser, browser());
1394 ExpectWindowCountAfterDownload(1); 1395 ExpectWindowCountAfterDownload(1);
1395 #endif 1396 #endif
1396 1397
1397 EXPECT_EQ(1, browser()->tab_count()); 1398 EXPECT_EQ(1, browser()->tab_strip_model()->count());
1398 // Download shelf should close. Download panel stays open on ChromeOS. 1399 // Download shelf should close. Download panel stays open on ChromeOS.
1399 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 1400 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
1400 1401
1401 CheckDownload(browser(), file, file); 1402 CheckDownload(browser(), file, file);
1402 } 1403 }
1403 1404
1404 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryCheck) { 1405 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryCheck) {
1405 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 1406 FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
1406 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); 1407 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file));
1407 HistoryObserver observer(browser()->profile()); 1408 HistoryObserver observer(browser()->profile());
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 ASSERT_EQ(1u, downloads.size()); 1500 ASSERT_EQ(1u, downloads.size());
1500 EXPECT_EQ(DownloadItem::COMPLETE, downloads[0]->GetState()); 1501 EXPECT_EQ(DownloadItem::COMPLETE, downloads[0]->GetState());
1501 1502
1502 // Unfortunately, this will block forever, causing a timeout, if 1503 // Unfortunately, this will block forever, causing a timeout, if
1503 // the download is never opened. 1504 // the download is never opened.
1504 content::DownloadUpdatedObserver( 1505 content::DownloadUpdatedObserver(
1505 downloads[0], base::Bind(&WasAutoOpened)).WaitForEvent(); 1506 downloads[0], base::Bind(&WasAutoOpened)).WaitForEvent();
1506 EXPECT_TRUE(downloads[0]->GetOpened()); // Confirm it anyway. 1507 EXPECT_TRUE(downloads[0]->GetOpened()); // Confirm it anyway.
1507 1508
1508 // As long as we're here, confirmed everything else is good. 1509 // As long as we're here, confirmed everything else is good.
1509 EXPECT_EQ(1, browser()->tab_count()); 1510 EXPECT_EQ(1, browser()->tab_strip_model()->count());
1510 CheckDownload(browser(), file, file); 1511 CheckDownload(browser(), file, file);
1511 // Download shelf should close. Download panel stays open on ChromeOS. 1512 // Download shelf should close. Download panel stays open on ChromeOS.
1512 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 1513 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
1513 } 1514 }
1514 1515
1515 // Download an extension. Expect a dangerous download warning. 1516 // Download an extension. Expect a dangerous download warning.
1516 // Deny the download. 1517 // Deny the download.
1517 IN_PROC_BROWSER_TEST_F(DownloadTest, CrxDenyInstall) { 1518 IN_PROC_BROWSER_TEST_F(DownloadTest, CrxDenyInstall) {
1518 FeatureSwitch::ScopedOverride enable_easy_off_store_install( 1519 FeatureSwitch::ScopedOverride enable_easy_off_store_install(
1519 FeatureSwitch::easy_off_store_install(), true); 1520 FeatureSwitch::easy_off_store_install(), true);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 scoped_ptr<DownloadUrlParameters> params( 1695 scoped_ptr<DownloadUrlParameters> params(
1695 DownloadUrlParameters::FromWebContents(web_contents, url)); 1696 DownloadUrlParameters::FromWebContents(web_contents, url));
1696 params->set_prompt(true); 1697 params->set_prompt(true);
1697 DownloadManagerForBrowser(browser())->DownloadUrl(params.Pass()); 1698 DownloadManagerForBrowser(browser())->DownloadUrl(params.Pass());
1698 observer->WaitForFinished(); 1699 observer->WaitForFinished();
1699 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::COMPLETE)); 1700 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::COMPLETE));
1700 CheckDownloadStates(1, DownloadItem::COMPLETE); 1701 CheckDownloadStates(1, DownloadItem::COMPLETE);
1701 EXPECT_TRUE(DidShowFileChooser()); 1702 EXPECT_TRUE(DidShowFileChooser());
1702 1703
1703 // Check state. 1704 // Check state.
1704 EXPECT_EQ(1, browser()->tab_count()); 1705 EXPECT_EQ(1, browser()->tab_strip_model()->count());
1705 ASSERT_TRUE(CheckDownload(browser(), file, file)); 1706 ASSERT_TRUE(CheckDownload(browser(), file, file));
1706 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 1707 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
1707 } 1708 }
1708 1709
1709 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadUrlToPath) { 1710 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadUrlToPath) {
1710 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 1711 FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
1711 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); 1712 GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
1712 1713
1713 WebContents* web_contents = chrome::GetActiveWebContents(browser()); 1714 WebContents* web_contents = chrome::GetActiveWebContents(browser());
1714 ASSERT_TRUE(web_contents); 1715 ASSERT_TRUE(web_contents);
1715 1716
1716 base::ScopedTempDir other_directory; 1717 base::ScopedTempDir other_directory;
1717 ASSERT_TRUE(other_directory.CreateUniqueTempDir()); 1718 ASSERT_TRUE(other_directory.CreateUniqueTempDir());
1718 FilePath target_file_full_path 1719 FilePath target_file_full_path
1719 = other_directory.path().Append(file.BaseName()); 1720 = other_directory.path().Append(file.BaseName());
1720 content::DownloadTestObserver* observer(CreateWaiter(browser(), 1)); 1721 content::DownloadTestObserver* observer(CreateWaiter(browser(), 1));
1721 scoped_ptr<DownloadUrlParameters> params( 1722 scoped_ptr<DownloadUrlParameters> params(
1722 DownloadUrlParameters::FromWebContents(web_contents, url)); 1723 DownloadUrlParameters::FromWebContents(web_contents, url));
1723 params->set_file_path(target_file_full_path); 1724 params->set_file_path(target_file_full_path);
1724 DownloadManagerForBrowser(browser())->DownloadUrl(params.Pass()); 1725 DownloadManagerForBrowser(browser())->DownloadUrl(params.Pass());
1725 observer->WaitForFinished(); 1726 observer->WaitForFinished();
1726 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::COMPLETE)); 1727 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::COMPLETE));
1727 1728
1728 // Check state. 1729 // Check state.
1729 EXPECT_EQ(1, browser()->tab_count()); 1730 EXPECT_EQ(1, browser()->tab_strip_model()->count());
1730 ASSERT_TRUE(CheckDownloadFullPaths(browser(), 1731 ASSERT_TRUE(CheckDownloadFullPaths(browser(),
1731 target_file_full_path, 1732 target_file_full_path,
1732 OriginFile(file))); 1733 OriginFile(file)));
1733 1734
1734 // Temporary are treated as auto-opened, and after that open won't be 1735 // Temporary are treated as auto-opened, and after that open won't be
1735 // visible; wait for auto-open and confirm not visible. 1736 // visible; wait for auto-open and confirm not visible.
1736 std::vector<DownloadItem*> downloads; 1737 std::vector<DownloadItem*> downloads;
1737 DownloadManagerForBrowser(browser())->GetAllDownloads(&downloads); 1738 DownloadManagerForBrowser(browser())->GetAllDownloads(&downloads);
1738 ASSERT_EQ(1u, downloads.size()); 1739 ASSERT_EQ(1u, downloads.size());
1739 content::DownloadUpdatedObserver( 1740 content::DownloadUpdatedObserver(
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
2226 WebContents* web_contents = chrome::GetActiveWebContents(browser()); 2227 WebContents* web_contents = chrome::GetActiveWebContents(browser());
2227 scoped_ptr<DownloadUrlParameters> params( 2228 scoped_ptr<DownloadUrlParameters> params(
2228 DownloadUrlParameters::FromWebContents(web_contents, url)); 2229 DownloadUrlParameters::FromWebContents(web_contents, url));
2229 params->set_callback(base::Bind(&SetHiddenDownloadCallback)); 2230 params->set_callback(base::Bind(&SetHiddenDownloadCallback));
2230 download_manager->DownloadUrl(params.Pass()); 2231 download_manager->DownloadUrl(params.Pass());
2231 observer->WaitForFinished(); 2232 observer->WaitForFinished();
2232 2233
2233 // Verify that download shelf is not shown. 2234 // Verify that download shelf is not shown.
2234 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 2235 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
2235 } 2236 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_commands_unittest.cc ('k') | chrome/browser/extensions/api/extension_action/browser_action_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698