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

Unified Diff: chrome/browser/extensions/api/downloads/downloads_api_unittest.cc

Issue 10834129: Implement chrome.downloads.erase() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: @r172329 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
diff --git a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
index 552a7a174d8e9602df882ef8c11fa21e1872599b..a9b4e5a2fd2f512b40d9203e7fca4c70bc1f5283 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
@@ -7,7 +7,6 @@
#include "base/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_reader.h"
-#include "base/json/json_writer.h"
#include "base/message_loop.h"
#include "base/stl_util.h"
#include "base/stringprintf.h"
@@ -879,7 +878,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
}
IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
- DownloadExtensionTest_PauseResumeCancel) {
+ DownloadExtensionTest_PauseResumeCancelErase) {
DownloadItem* download_item = CreateSlowTestDownload();
ASSERT_TRUE(download_item);
@@ -942,6 +941,22 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
new DownloadsResumeFunction(), "[-42]");
EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
error.c_str());
+
+ int id = download_item->GetId();
+ scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsEraseFunction(),
+ base::StringPrintf("[{\"id\": %d}]", id)));
+ DownloadManager::DownloadVector items;
+ GetCurrentManager()->GetAllDownloads(&items);
+ EXPECT_EQ(0UL, items.size());
+ ASSERT_TRUE(result);
+ download_item = NULL;
+ base::ListValue* result_list = NULL;
+ ASSERT_TRUE(result->GetAsList(&result_list));
+ ASSERT_EQ(1UL, result_list->GetSize());
+ int element = -1;
+ ASSERT_TRUE(result_list->GetInteger(0, &element));
+ EXPECT_EQ(id, element);
}
scoped_refptr<UIThreadExtensionFunction> MockedGetFileIconFunction(
« 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