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

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

Issue 16924017: A few minor changes to the chrome.downloads extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r212092 Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
diff --git a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
similarity index 95%
rename from chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
rename to chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
index 7cca9bc062467e57f602cec3b314edfc06c6c7f7..7f8e1e90bf9c59da4502895989350ceeb0aebf74 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// TODO occam move to _browser_test.cc
+
#include <algorithm>
#include "base/file_util.h"
@@ -62,6 +64,8 @@ using content::URLRequestSlowDownloadJob;
namespace events = extensions::event_names;
+namespace errors = download_extension_errors;
+
namespace {
// Comparator that orders download items by their ID. Can be used with
@@ -349,19 +353,22 @@ class DownloadExtensionTest : public ExtensionApiTest {
current_browser()->profile(), event_name, json_args);
}
- bool WaitForInterruption(DownloadItem* item, int expected_error,
- const std::string& on_created_event) {
+ bool WaitForInterruption(
+ DownloadItem* item,
+ content::DownloadInterruptReason expected_error,
+ const std::string& on_created_event) {
if (!WaitFor(events::kOnDownloadCreated, on_created_event))
return false;
// Now, onCreated is always fired before interruption.
return WaitFor(events::kOnDownloadChanged,
base::StringPrintf("[{\"id\": %d,"
- " \"error\": {\"current\": %d},"
- " \"state\": {"
- " \"previous\": \"in_progress\","
- " \"current\": \"interrupted\"}}]",
- item->GetId(),
- expected_error));
+ " \"error\": {\"current\": \"%s\"},"
+ " \"state\": {"
+ " \"previous\": \"in_progress\","
+ " \"current\": \"interrupted\"}}]",
+ item->GetId(),
+ content::InterruptReasonDebugString(
+ expected_error).c_str()));
}
void ClearEvents() {
@@ -909,7 +916,7 @@ bool ItemIsInterrupted(DownloadItem* item) {
IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
DownloadExtensionTest_Open) {
LoadExtension("downloads_split");
- EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
+ EXPECT_STREQ(errors::kInvalidId,
RunFunctionAndReturnError(
new DownloadsOpenFunction(),
"[-42]").c_str());
@@ -925,7 +932,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
" \"paused\": false,"
" \"url\": \"%s\"}]",
download_item->GetURL().spec().c_str())));
- EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
+ EXPECT_STREQ(errors::kNotComplete,
RunFunctionAndReturnError(
new DownloadsOpenFunction(),
DownloadItemIdAsArgList(download_item)).c_str());
@@ -978,29 +985,25 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
DownloadItemIdAsArgList(download_item)));
EXPECT_EQ(DownloadItem::CANCELLED, download_item->GetState());
- // Calling paused on a non-active download yields kInvalidOperationError.
+ // Calling paused on a non-active download yields kInvalidId.
std::string error = RunFunctionAndReturnError(
new DownloadsPauseFunction(), DownloadItemIdAsArgList(download_item));
- EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
- error.c_str());
+ EXPECT_STREQ(errors::kNotInProgress, error.c_str());
- // Calling resume on a non-active download yields kInvalidOperationError
+ // Calling resume on a non-active download yields kInvalidId
error = RunFunctionAndReturnError(
new DownloadsResumeFunction(), DownloadItemIdAsArgList(download_item));
- EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
- error.c_str());
+ EXPECT_STREQ(errors::kNotInProgress, error.c_str());
- // Calling paused on a non-existent download yields kInvalidOperationError.
+ // Calling paused on a non-existent download yields kInvalidId.
error = RunFunctionAndReturnError(
new DownloadsPauseFunction(), "[-42]");
- EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
- error.c_str());
+ EXPECT_STREQ(errors::kInvalidId, error.c_str());
- // Calling resume on a non-existent download yields kInvalidOperationError
+ // Calling resume on a non-existent download yields kInvalidId
error = RunFunctionAndReturnError(
new DownloadsResumeFunction(), "[-42]");
- EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
- error.c_str());
+ EXPECT_STREQ(errors::kInvalidId, error.c_str());
int id = download_item->GetId();
scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -1096,16 +1099,16 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
IconLoader::NORMAL,
std::string()),
args32);
- EXPECT_STREQ(download_extension_errors::kIconNotFoundError, error.c_str());
+ EXPECT_STREQ(errors::kIconNotFound, error.c_str());
- // Once the download item is deleted, we should return kInvalidOperationError.
+ // Once the download item is deleted, we should return kInvalidId.
int id = download_item->GetId();
download_item->Remove();
download_item = NULL;
EXPECT_EQ(static_cast<DownloadItem*>(NULL),
GetCurrentManager()->GetDownload(id));
error = RunFunctionAndReturnError(new DownloadsGetFileIconFunction(), args32);
- EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
+ EXPECT_STREQ(errors::kInvalidId,
error.c_str());
}
@@ -1146,8 +1149,6 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
&result_string));
EXPECT_STREQ("hello", result_string.c_str());
}
-
- // The temporary files should be cleaned up when the base::ScopedTempDir is removed.
}
// Test passing the empty query to search().
@@ -1244,7 +1245,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
&items));
scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsSearchFunction(), "[{\"orderBy\": \"filename\"}]"));
+ new DownloadsSearchFunction(), "[{\"orderBy\": [\"filename\"]}]"));
ASSERT_TRUE(result.get());
base::ListValue* result_list = NULL;
ASSERT_TRUE(result->GetAsList(&result_list));
@@ -1277,7 +1278,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
&items));
scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsSearchFunction(), "[{\"orderBy\": \"\"}]"));
+ new DownloadsSearchFunction(), "[{\"orderBy\": []}]"));
ASSERT_TRUE(result.get());
base::ListValue* result_list = NULL;
ASSERT_TRUE(result->GetAsList(&result_list));
@@ -1354,15 +1355,15 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
DownloadExtensionTest_SearchInvalid) {
std::string error = RunFunctionAndReturnError(
new DownloadsSearchFunction(), "[{\"filenameRegex\": \"(\"}]");
- EXPECT_STREQ(download_extension_errors::kInvalidFilterError,
+ EXPECT_STREQ(errors::kInvalidFilter,
error.c_str());
error = RunFunctionAndReturnError(
- new DownloadsSearchFunction(), "[{\"orderBy\": \"goat\"}]");
- EXPECT_STREQ(download_extension_errors::kInvalidOrderByError,
+ new DownloadsSearchFunction(), "[{\"orderBy\": [\"goat\"]}]");
+ EXPECT_STREQ(errors::kInvalidOrderBy,
error.c_str());
error = RunFunctionAndReturnError(
new DownloadsSearchFunction(), "[{\"limit\": -1}]");
- EXPECT_STREQ(download_extension_errors::kInvalidQueryLimit,
+ EXPECT_STREQ(errors::kInvalidQueryLimit,
error.c_str());
}
@@ -1388,7 +1389,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
new DownloadsSearchFunction(), "[{"
"\"state\": \"complete\", "
"\"danger\": \"content\", "
- "\"orderBy\": \"filename\", "
+ "\"orderBy\": [\"filename\"], "
"\"limit\": 1}]"));
ASSERT_TRUE(result.get());
base::ListValue* result_list = NULL;
@@ -1468,16 +1469,16 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
// Pausing/Resuming the off-record item while on the record should return an
// error. Cancelling "non-existent" downloads is not an error.
error = RunFunctionAndReturnError(new DownloadsPauseFunction(), off_item_arg);
- EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
+ EXPECT_STREQ(errors::kInvalidId,
error.c_str());
error = RunFunctionAndReturnError(new DownloadsResumeFunction(),
off_item_arg);
- EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
+ EXPECT_STREQ(errors::kInvalidId,
error.c_str());
error = RunFunctionAndReturnError(
new DownloadsGetFileIconFunction(),
base::StringPrintf("[%d, {}]", off_item->GetId()));
- EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
+ EXPECT_STREQ(errors::kInvalidId,
error.c_str());
GoOffTheRecord();
@@ -1509,10 +1510,10 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
EXPECT_TRUE(RunFunction(new DownloadsCancelFunction(), on_item_arg));
EXPECT_EQ(DownloadItem::CANCELLED, on_item->GetState());
error = RunFunctionAndReturnError(new DownloadsPauseFunction(), on_item_arg);
- EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
+ EXPECT_STREQ(errors::kNotInProgress,
error.c_str());
error = RunFunctionAndReturnError(new DownloadsResumeFunction(), on_item_arg);
- EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
+ EXPECT_STREQ(errors::kNotInProgress,
error.c_str());
EXPECT_TRUE(RunFunction(new DownloadsPauseFunction(), off_item_arg));
EXPECT_TRUE(off_item->IsPaused());
@@ -1530,11 +1531,11 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
EXPECT_EQ(DownloadItem::CANCELLED, off_item->GetState());
error = RunFunctionAndReturnError(new DownloadsPauseFunction(),
off_item_arg);
- EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
+ EXPECT_STREQ(errors::kNotInProgress,
error.c_str());
error = RunFunctionAndReturnError(new DownloadsResumeFunction(),
off_item_arg);
- EXPECT_STREQ(download_extension_errors::kInvalidOperationError,
+ EXPECT_STREQ(errors::kNotInProgress,
error.c_str());
}
@@ -1673,7 +1674,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
for (size_t index = 0; index < arraysize(kUnsafeHeaders); ++index) {
std::string download_url = test_server()->GetURL("slow?0").spec();
- EXPECT_STREQ(download_extension_errors::kGenericError,
+ EXPECT_STREQ(errors::kInvalidHeader,
RunFunctionAndReturnError(new DownloadsDownloadFunction(),
base::StringPrintf(
"[{\"url\": \"%s\","
@@ -1687,8 +1688,6 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
}
}
-// Test that subdirectories (slashes) are disallowed in filenames.
-// TODO(benjhayden) Update this when subdirectories are supported.
IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
DownloadExtensionTest_Download_Subdirectory) {
LoadExtension("downloads_split");
@@ -1697,12 +1696,39 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
std::string download_url = test_server()->GetURL("slow?0").spec();
GoOnTheRecord();
- EXPECT_STREQ(download_extension_errors::kInvalidFilenameError,
- RunFunctionAndReturnError(new DownloadsDownloadFunction(),
- base::StringPrintf(
- "[{\"url\": \"%s\","
- " \"filename\": \"sub/dir/ect/ory.txt\"}]",
- download_url.c_str())).c_str());
+ scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(), base::StringPrintf(
+ "[{\"url\": \"%s\","
+ " \"filename\": \"sub/dir/ect/ory.txt\"}]",
+ download_url.c_str())));
+ ASSERT_TRUE(result.get());
+ int result_id = -1;
+ ASSERT_TRUE(result->GetAsInteger(&result_id));
+ DownloadItem* item = GetCurrentManager()->GetDownload(result_id);
+ ASSERT_TRUE(item);
+ ScopedCancellingItem canceller(item);
+ ASSERT_EQ(download_url, item->GetOriginalUrl().spec());
+
+ ASSERT_TRUE(WaitFor(events::kOnDownloadCreated,
+ base::StringPrintf("[{\"danger\": \"safe\","
+ " \"incognito\": false,"
+ " \"mime\": \"text/plain\","
+ " \"paused\": false,"
+ " \"url\": \"%s\"}]",
+ download_url.c_str())));
+ ASSERT_TRUE(WaitFor(events::kOnDownloadChanged,
+ base::StringPrintf("[{\"id\": %d,"
+ " \"filename\": {"
+ " \"previous\": \"\","
+ " \"current\": \"%s\"}}]",
+ result_id,
+ GetFilename("sub/dir/ect/ory.txt").c_str())));
+ ASSERT_TRUE(WaitFor(events::kOnDownloadChanged,
+ base::StringPrintf("[{\"id\": %d,"
+ " \"state\": {"
+ " \"previous\": \"in_progress\","
+ " \"current\": \"complete\"}}]",
+ result_id)));
}
// Test that invalid filenames are disallowed.
@@ -1714,7 +1740,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
std::string download_url = test_server()->GetURL("slow?0").spec();
GoOnTheRecord();
- EXPECT_STREQ(download_extension_errors::kInvalidFilenameError,
+ EXPECT_STREQ(errors::kInvalidFilename,
RunFunctionAndReturnError(new DownloadsDownloadFunction(),
base::StringPrintf(
"[{\"url\": \"%s\","
@@ -1732,20 +1758,32 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
"foo bar",
"../hello",
"/hello",
- "google.com/",
"http://",
"#frag",
"foo/bar.html#frag",
+ "google.com/",
+ };
+
+ for (size_t index = 0; index < arraysize(kInvalidURLs); ++index) {
+ EXPECT_STREQ(errors::kInvalidURL,
+ RunFunctionAndReturnError(new DownloadsDownloadFunction(),
+ base::StringPrintf(
+ "[{\"url\": \"%s\"}]", kInvalidURLs[index])).c_str())
+ << kInvalidURLs[index];
+ }
+
+ static const char* kNotPermittedURLs[] = {
"javascript:document.write(\\\"hello\\\");",
"javascript:return false;",
"ftp://example.com/example.txt",
};
- for (size_t index = 0; index < arraysize(kInvalidURLs); ++index) {
- EXPECT_STREQ(download_extension_errors::kInvalidURLError,
+ for (size_t index = 0; index < arraysize(kNotPermittedURLs); ++index) {
+ EXPECT_STREQ(errors::kNotPermittedURL,
RunFunctionAndReturnError(new DownloadsDownloadFunction(),
base::StringPrintf(
- "[{\"url\": \"%s\"}]", kInvalidURLs[index])).c_str());
+ "[{\"url\": \"%s\"}]", kNotPermittedURLs[index])).c_str())
+ << kNotPermittedURLs[index];
}
}
@@ -1912,13 +1950,15 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
ScopedCancellingItem canceller(item);
ASSERT_EQ(download_url, item->GetOriginalUrl().spec());
- ASSERT_TRUE(WaitForInterruption(item, 30, base::StringPrintf(
- "[{\"danger\": \"safe\","
- " \"incognito\": false,"
- " \"mime\": \"text/html\","
- " \"paused\": false,"
- " \"url\": \"%s\"}]",
- download_url.c_str())));
+ ASSERT_TRUE(WaitForInterruption(
+ item,
+ content::DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED,
+ base::StringPrintf("[{\"danger\": \"safe\","
+ " \"incognito\": false,"
+ " \"mime\": \"text/html\","
+ " \"paused\": false,"
+ " \"url\": \"%s\"}]",
+ download_url.c_str())));
}
// Test that DownloadsDownloadFunction propagates |headers| to the URLRequest.
@@ -1995,14 +2035,16 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
ScopedCancellingItem canceller(item);
ASSERT_EQ(download_url, item->GetOriginalUrl().spec());
- ASSERT_TRUE(WaitForInterruption(item, 33, base::StringPrintf(
- "[{\"danger\": \"safe\","
- " \"incognito\": false,"
- " \"bytesReceived\": 0,"
- " \"mime\": \"\","
- " \"paused\": false,"
- " \"url\": \"%s\"}]",
- download_url.c_str())));
+ ASSERT_TRUE(WaitForInterruption(
+ item,
+ content::DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT,
+ base::StringPrintf("[{\"danger\": \"safe\","
+ " \"incognito\": false,"
+ " \"bytesReceived\": 0,"
+ " \"mime\": \"\","
+ " \"paused\": false,"
+ " \"url\": \"%s\"}]",
+ download_url.c_str())));
}
// Test that DownloadsDownloadFunction propagates the Authorization header
@@ -2121,15 +2163,17 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
ScopedCancellingItem canceller(item);
ASSERT_EQ(download_url, item->GetOriginalUrl().spec());
- ASSERT_TRUE(WaitForInterruption(item, 33, base::StringPrintf(
- "[{\"danger\": \"safe\","
- " \"incognito\": false,"
- " \"mime\": \"\","
- " \"paused\": false,"
- " \"id\": %d,"
- " \"url\": \"%s\"}]",
- result_id,
- download_url.c_str())));
+ ASSERT_TRUE(WaitForInterruption(
+ item,
+ content::DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT,
+ base::StringPrintf("[{\"danger\": \"safe\","
+ " \"incognito\": false,"
+ " \"mime\": \"\","
+ " \"paused\": false,"
+ " \"id\": %d,"
+ " \"url\": \"%s\"}]",
+ result_id,
+ download_url.c_str())));
}
// Test that downloadPostSuccess would fail if the resource requires the POST
@@ -2160,15 +2204,17 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
ScopedCancellingItem canceller(item);
ASSERT_EQ(download_url, item->GetOriginalUrl().spec());
- ASSERT_TRUE(WaitForInterruption(item, 33, base::StringPrintf(
- "[{\"danger\": \"safe\","
- " \"incognito\": false,"
- " \"mime\": \"\","
- " \"paused\": false,"
- " \"id\": %d,"
- " \"url\": \"%s\"}]",
- result_id,
- download_url.c_str())));
+ ASSERT_TRUE(WaitForInterruption(
+ item,
+ content::DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT,
+ base::StringPrintf("[{\"danger\": \"safe\","
+ " \"incognito\": false,"
+ " \"mime\": \"\","
+ " \"paused\": false,"
+ " \"id\": %d,"
+ " \"url\": \"%s\"}]",
+ result_id,
+ download_url.c_str())));
}
// Test that cancel()ing an in-progress download causes its state to transition
@@ -2207,7 +2253,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
item->Cancel(true);
ASSERT_TRUE(WaitFor(events::kOnDownloadChanged,
base::StringPrintf("[{\"id\": %d,"
- " \"error\": {\"current\": 40},"
+ " \"error\": {\"current\":\"USER_CANCELED\"},"
" \"state\": {"
" \"previous\": \"in_progress\","
" \"current\": \"interrupted\"}}]",
@@ -2391,17 +2437,15 @@ IN_PROC_BROWSER_TEST_F(
base::StringPrintf("[{\"id\": %d,"
" \"danger\": {"
" \"previous\":\"safe\","
- " \"current\":\"file\"},"
- " \"dangerAccepted\": {"
- " \"current\":false}}]",
+ " \"current\":\"file\"}}]",
result_id)));
item->ValidateDangerousDownload();
ASSERT_TRUE(WaitFor(events::kOnDownloadChanged,
base::StringPrintf("[{\"id\": %d,"
- " \"dangerAccepted\": {"
- " \"previous\":false,"
- " \"current\":true}}]",
+ " \"danger\": {"
+ " \"previous\":\"file\","
+ " \"current\":\"accepted\"}}]",
result_id)));
ASSERT_TRUE(WaitFor(events::kOnDownloadChanged,
base::StringPrintf("[{\"id\": %d,"
@@ -2462,7 +2506,7 @@ IN_PROC_BROWSER_TEST_F(
base::FilePath(FILE_PATH_LITERAL("sneaky/../../sneaky.txt")),
extensions::api::downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY,
&error));
- EXPECT_STREQ(download_extension_errors::kInvalidFilenameError, error.c_str());
+ EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
ASSERT_TRUE(WaitFor(events::kOnDownloadChanged,
base::StringPrintf("[{\"id\": %d,"
" \"filename\": {"
@@ -2527,7 +2571,7 @@ IN_PROC_BROWSER_TEST_F(
base::FilePath(FILE_PATH_LITERAL("<")),
extensions::api::downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY,
&error));
- EXPECT_STREQ(download_extension_errors::kInvalidFilenameError, error.c_str());
+ EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
ASSERT_TRUE(WaitFor(events::kOnDownloadChanged, base::StringPrintf(
"[{\"id\": %d,"
" \"filename\": {"
@@ -2593,7 +2637,7 @@ IN_PROC_BROWSER_TEST_F(
"My Computer.{20D04FE0-3AEA-1069-A2D8-08002B30309D}/foo")),
extensions::api::downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY,
&error));
- EXPECT_STREQ(download_extension_errors::kInvalidFilenameError, error.c_str());
+ EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
ASSERT_TRUE(WaitFor(events::kOnDownloadChanged, base::StringPrintf(
"[{\"id\": %d,"
" \"filename\": {"
@@ -2658,7 +2702,7 @@ IN_PROC_BROWSER_TEST_F(
base::FilePath(FILE_PATH_LITERAL("con.foo")),
extensions::api::downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY,
&error));
- EXPECT_STREQ(download_extension_errors::kInvalidFilenameError, error.c_str());
+ EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
ASSERT_TRUE(WaitFor(events::kOnDownloadChanged, base::StringPrintf(
"[{\"id\": %d,"
" \"filename\": {"
@@ -2723,7 +2767,7 @@ IN_PROC_BROWSER_TEST_F(
base::FilePath(FILE_PATH_LITERAL(".")),
extensions::api::downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY,
&error));
- EXPECT_STREQ(download_extension_errors::kInvalidFilenameError, error.c_str());
+ EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
ASSERT_TRUE(WaitFor(events::kOnDownloadChanged,
base::StringPrintf("[{\"id\": %d,"
" \"filename\": {"
@@ -2788,7 +2832,7 @@ IN_PROC_BROWSER_TEST_F(
base::FilePath(FILE_PATH_LITERAL("..")),
extensions::api::downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY,
&error));
- EXPECT_STREQ(download_extension_errors::kInvalidFilenameError, error.c_str());
+ EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
ASSERT_TRUE(WaitFor(events::kOnDownloadChanged,
base::StringPrintf("[{\"id\": %d,"
" \"filename\": {"
@@ -2853,7 +2897,7 @@ IN_PROC_BROWSER_TEST_F(
downloads_directory().Append(FILE_PATH_LITERAL("sneaky.txt")),
extensions::api::downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY,
&error));
- EXPECT_STREQ(download_extension_errors::kInvalidFilenameError, error.c_str());
+ EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
ASSERT_TRUE(WaitFor(events::kOnDownloadChanged,
base::StringPrintf("[{\"id\": %d,"
@@ -2919,7 +2963,7 @@ IN_PROC_BROWSER_TEST_F(
base::FilePath(FILE_PATH_LITERAL("foo/")),
extensions::api::downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY,
&error));
- EXPECT_STREQ(download_extension_errors::kInvalidFilenameError, error.c_str());
+ EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
ASSERT_TRUE(WaitFor(events::kOnDownloadChanged,
base::StringPrintf("[{\"id\": %d,"
@@ -3479,7 +3523,7 @@ IN_PROC_BROWSER_TEST_F(
ASSERT_TRUE(interrupted.WaitForEvent());
ASSERT_TRUE(WaitFor(events::kOnDownloadChanged,
base::StringPrintf("[{\"id\": %d,"
- " \"error\":{\"current\":20},"
+ " \"error\":{\"current\":\"NETWORK_FAILED\"},"
" \"state\":{"
" \"previous\":\"in_progress\","
" \"current\":\"interrupted\"}}]",
@@ -3498,7 +3542,7 @@ IN_PROC_BROWSER_TEST_F(
ASSERT_TRUE(WaitFor(events::kOnDownloadChanged,
base::StringPrintf("[{\"id\": %d,"
- " \"error\":{\"previous\":20},"
+ " \"error\":{\"previous\":\"NETWORK_FAILED\"},"
" \"state\":{"
" \"previous\":\"interrupted\","
" \"current\":\"in_progress\"}}]",

Powered by Google App Engine
This is Rietveld 408576698