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

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

Issue 12047039: download: Remove DownloadManager::MockDownloadOpenForTesting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 815
816 } // namespace 816 } // namespace
817 817
818 IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, 818 IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
819 DownloadExtensionTest_Open) { 819 DownloadExtensionTest_Open) {
820 EXPECT_STREQ(download_extension_errors::kInvalidOperationError, 820 EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
821 RunFunctionAndReturnError( 821 RunFunctionAndReturnError(
822 new DownloadsOpenFunction(), 822 new DownloadsOpenFunction(),
823 "[-42]").c_str()); 823 "[-42]").c_str());
824 824
825 GetCurrentManager()->MockDownloadOpenForTesting();
826 DownloadItem* download_item = CreateSlowTestDownload(); 825 DownloadItem* download_item = CreateSlowTestDownload();
827 ASSERT_TRUE(download_item); 826 ASSERT_TRUE(download_item);
828 EXPECT_FALSE(download_item->GetOpened()); 827 EXPECT_FALSE(download_item->GetOpened());
829 EXPECT_FALSE(download_item->GetOpenWhenComplete()); 828 EXPECT_FALSE(download_item->GetOpenWhenComplete());
830 ASSERT_TRUE(WaitFor(events::kOnDownloadCreated, 829 ASSERT_TRUE(WaitFor(events::kOnDownloadCreated,
831 base::StringPrintf("[{\"danger\": \"safe\"," 830 base::StringPrintf("[{\"danger\": \"safe\","
832 " \"incognito\": false," 831 " \"incognito\": false,"
833 " \"mime\": \"application/octet-stream\"," 832 " \"mime\": \"application/octet-stream\","
834 " \"paused\": false," 833 " \"paused\": false,"
835 " \"url\": \"%s\"}]", 834 " \"url\": \"%s\"}]",
(...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after
2125 " \"state\": {" 2124 " \"state\": {"
2126 " \"previous\": \"in_progress\"," 2125 " \"previous\": \"in_progress\","
2127 " \"current\": \"complete\"}}]", 2126 " \"current\": \"complete\"}}]",
2128 result_id, 2127 result_id,
2129 GetFilename("on_record.txt.crdownload").c_str(), 2128 GetFilename("on_record.txt.crdownload").c_str(),
2130 GetFilename("on_record.txt").c_str()))); 2129 GetFilename("on_record.txt").c_str())));
2131 std::string disk_data; 2130 std::string disk_data;
2132 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); 2131 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data));
2133 EXPECT_STREQ(kPayloadData, disk_data.c_str()); 2132 EXPECT_STREQ(kPayloadData, disk_data.c_str());
2134 } 2133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698