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

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

Issue 230103002: [Downloads] Ask DownloadHistory if a download was from history. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move responsibility of determining whether to show a download in the UI to DownloadItemModel Created 6 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 | 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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 EXPECT_EQ(file.value(), item->GetTargetFilePath().BaseName().value()); 1932 EXPECT_EQ(file.value(), item->GetTargetFilePath().BaseName().value());
1933 EXPECT_EQ(download_url, item->GetURL()); 1933 EXPECT_EQ(download_url, item->GetURL());
1934 // The following are set by download-test1.lib.mock-http-headers. 1934 // The following are set by download-test1.lib.mock-http-headers.
1935 std::string etag = item->GetETag(); 1935 std::string etag = item->GetETag();
1936 base::TrimWhitespaceASCII(etag, base::TRIM_ALL, &etag); 1936 base::TrimWhitespaceASCII(etag, base::TRIM_ALL, &etag);
1937 EXPECT_EQ("abracadabra", etag); 1937 EXPECT_EQ("abracadabra", etag);
1938 1938
1939 std::string last_modified = item->GetLastModifiedTime(); 1939 std::string last_modified = item->GetLastModifiedTime();
1940 base::TrimWhitespaceASCII(last_modified, base::TRIM_ALL, &last_modified); 1940 base::TrimWhitespaceASCII(last_modified, base::TRIM_ALL, &last_modified);
1941 EXPECT_EQ("Mon, 13 Nov 2006 20:31:09 GMT", last_modified); 1941 EXPECT_EQ("Mon, 13 Nov 2006 20:31:09 GMT", last_modified);
1942
1943 // Downloads that were restored from history shouldn't cause the download
1944 // shelf to be displayed.
1945 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
1942 } 1946 }
1943 1947
1944 // Test for crbug.com/14505. This tests that chrome:// urls are still functional 1948 // Test for crbug.com/14505. This tests that chrome:// urls are still functional
1945 // after download of a file while viewing another chrome://. 1949 // after download of a file while viewing another chrome://.
1946 IN_PROC_BROWSER_TEST_F(DownloadTest, ChromeURLAfterDownload) { 1950 IN_PROC_BROWSER_TEST_F(DownloadTest, ChromeURLAfterDownload) {
1947 base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 1951 base::FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
1948 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); 1952 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file));
1949 GURL flags_url(chrome::kChromeUIFlagsURL); 1953 GURL flags_url(chrome::kChromeUIFlagsURL);
1950 GURL extensions_url(chrome::kChromeUIExtensionsFrameURL); 1954 GURL extensions_url(chrome::kChromeUIExtensionsFrameURL);
1951 1955
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
3205 3209
3206 // No errors this time. The download should complete successfully. 3210 // No errors this time. The download should complete successfully.
3207 EXPECT_FALSE(completion_observer->IsFinished()); 3211 EXPECT_FALSE(completion_observer->IsFinished());
3208 completion_observer->StartObserving(); 3212 completion_observer->StartObserving();
3209 download->Resume(); 3213 download->Resume();
3210 completion_observer->WaitForFinished(); 3214 completion_observer->WaitForFinished();
3211 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); 3215 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState());
3212 3216
3213 EXPECT_FALSE(DidShowFileChooser()); 3217 EXPECT_FALSE(DidShowFileChooser());
3214 } 3218 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_history.h » ('j') | chrome/browser/download/download_history_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698