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

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc

Issue 132353002: Change chrome.downloads.DownloadItem.{fileSize,bytesReceived,totalBytes} from longs to doubles for … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 11 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 // Disable everything on windows only. http://crbug.com/306144 5 // Disable everything on windows only. http://crbug.com/306144
6 #ifndef OS_WIN 6 #ifndef OS_WIN
7 7
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 DownloadItem* item = GetCurrentManager()->GetDownload(result_id); 1936 DownloadItem* item = GetCurrentManager()->GetDownload(result_id);
1937 ASSERT_TRUE(item); 1937 ASSERT_TRUE(item);
1938 ScopedCancellingItem canceller(item); 1938 ScopedCancellingItem canceller(item);
1939 ASSERT_EQ(download_url, item->GetOriginalUrl().spec()); 1939 ASSERT_EQ(download_url, item->GetOriginalUrl().spec());
1940 1940
1941 ASSERT_TRUE(WaitForInterruption( 1941 ASSERT_TRUE(WaitForInterruption(
1942 item, 1942 item,
1943 content::DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT, 1943 content::DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT,
1944 base::StringPrintf("[{\"danger\": \"safe\"," 1944 base::StringPrintf("[{\"danger\": \"safe\","
1945 " \"incognito\": false," 1945 " \"incognito\": false,"
1946 " \"bytesReceived\": 0," 1946 " \"bytesReceived\": 0.0,"
1947 " \"fileSize\": 0.0,"
1947 " \"mime\": \"\"," 1948 " \"mime\": \"\","
1948 " \"paused\": false," 1949 " \"paused\": false,"
1949 " \"url\": \"%s\"}]", 1950 " \"url\": \"%s\"}]",
1950 download_url.c_str()))); 1951 download_url.c_str())));
1951 } 1952 }
1952 1953
1953 // Test that DownloadsDownloadFunction propagates the Authorization header 1954 // Test that DownloadsDownloadFunction propagates the Authorization header
1954 // correctly. 1955 // correctly.
1955 IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, 1956 IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
1956 DownloadExtensionTest_Download_AuthBasic) { 1957 DownloadExtensionTest_Download_AuthBasic) {
(...skipping 16 matching lines...) Expand all
1973 ASSERT_TRUE(result.get()); 1974 ASSERT_TRUE(result.get());
1974 int result_id = -1; 1975 int result_id = -1;
1975 ASSERT_TRUE(result->GetAsInteger(&result_id)); 1976 ASSERT_TRUE(result->GetAsInteger(&result_id));
1976 DownloadItem* item = GetCurrentManager()->GetDownload(result_id); 1977 DownloadItem* item = GetCurrentManager()->GetDownload(result_id);
1977 ASSERT_TRUE(item); 1978 ASSERT_TRUE(item);
1978 ScopedCancellingItem canceller(item); 1979 ScopedCancellingItem canceller(item);
1979 ASSERT_EQ(download_url, item->GetOriginalUrl().spec()); 1980 ASSERT_EQ(download_url, item->GetOriginalUrl().spec());
1980 1981
1981 ASSERT_TRUE(WaitFor(api::OnCreated::kEventName, 1982 ASSERT_TRUE(WaitFor(api::OnCreated::kEventName,
1982 base::StringPrintf("[{\"danger\": \"safe\"," 1983 base::StringPrintf("[{\"danger\": \"safe\","
1983 " \"incognito\": false," 1984 " \"incognito\": false,"
1984 " \"mime\": \"text/html\"," 1985 " \"bytesReceived\": 0.0,"
1985 " \"paused\": false," 1986 " \"fileSize\": 0.0,"
1986 " \"url\": \"%s\"}]", download_url.c_str()))); 1987 " \"mime\": \"text/html\","
1988 " \"paused\": false,"
1989 " \"url\": \"%s\"}]", download_url.c_str())));
1987 ASSERT_TRUE(WaitFor(api::OnChanged::kEventName, 1990 ASSERT_TRUE(WaitFor(api::OnChanged::kEventName,
1988 base::StringPrintf("[{\"id\": %d," 1991 base::StringPrintf("[{\"id\": %d,"
1989 " \"state\": {" 1992 " \"state\": {"
1990 " \"previous\": \"in_progress\"," 1993 " \"previous\": \"in_progress\","
1991 " \"current\": \"complete\"}}]", result_id))); 1994 " \"current\": \"complete\"}}]", result_id)));
1992 } 1995 }
1993 1996
1994 // Test that DownloadsDownloadFunction propagates the |method| and |body| 1997 // Test that DownloadsDownloadFunction propagates the |method| and |body|
1995 // parameters to the URLRequest. 1998 // parameters to the URLRequest.
1996 IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, 1999 IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
1997 DownloadExtensionTest_Download_Post) { 2000 DownloadExtensionTest_Download_Post) {
1998 LoadExtension("downloads_split"); 2001 LoadExtension("downloads_split");
1999 ASSERT_TRUE(StartEmbeddedTestServer()); 2002 ASSERT_TRUE(StartEmbeddedTestServer());
2000 ASSERT_TRUE(test_server()->Start()); 2003 ASSERT_TRUE(test_server()->Start());
2001 std::string download_url = test_server()->GetURL("files/post/downloads/" 2004 std::string download_url = test_server()->GetURL("files/post/downloads/"
(...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after
3631 EXPECT_EQ("suggester", winner_id); 3634 EXPECT_EQ("suggester", winner_id);
3632 EXPECT_EQ(FILE_PATH_LITERAL("b"), filename.value()); 3635 EXPECT_EQ(FILE_PATH_LITERAL("b"), filename.value());
3633 EXPECT_EQ(api::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); 3636 EXPECT_EQ(api::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action);
3634 EXPECT_FALSE(warnings.empty()); 3637 EXPECT_FALSE(warnings.empty());
3635 EXPECT_EQ(extensions::ExtensionWarning::kDownloadFilenameConflict, 3638 EXPECT_EQ(extensions::ExtensionWarning::kDownloadFilenameConflict,
3636 warnings.begin()->warning_type()); 3639 warnings.begin()->warning_type());
3637 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); 3640 EXPECT_EQ("incumbent", warnings.begin()->extension_id());
3638 } 3641 }
3639 3642
3640 #endif // http://crbug.com/3061144 3643 #endif // http://crbug.com/3061144
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/downloads/downloads_api.cc ('k') | chrome/common/extensions/api/downloads.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698