| OLD | NEW |
| 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/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 } | 1198 } |
| 1199 | 1199 |
| 1200 // Test invalid search parameters. | 1200 // Test invalid search parameters. |
| 1201 IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, | 1201 IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, |
| 1202 DownloadExtensionTest_SearchInvalid) { | 1202 DownloadExtensionTest_SearchInvalid) { |
| 1203 std::string error = RunFunctionAndReturnError( | 1203 std::string error = RunFunctionAndReturnError( |
| 1204 new DownloadsSearchFunction(), "[{\"filenameRegex\": \"(\"}]"); | 1204 new DownloadsSearchFunction(), "[{\"filenameRegex\": \"(\"}]"); |
| 1205 EXPECT_STREQ(download_extension_errors::kInvalidFilterError, | 1205 EXPECT_STREQ(download_extension_errors::kInvalidFilterError, |
| 1206 error.c_str()); | 1206 error.c_str()); |
| 1207 error = RunFunctionAndReturnError( | 1207 error = RunFunctionAndReturnError( |
| 1208 new DownloadsSearchFunction(), "[{\"danger\": \"goat\"}]"); | |
| 1209 EXPECT_STREQ(download_extension_errors::kInvalidDangerTypeError, | |
| 1210 error.c_str()); | |
| 1211 error = RunFunctionAndReturnError( | |
| 1212 new DownloadsSearchFunction(), "[{\"state\": \"goat\"}]"); | |
| 1213 EXPECT_STREQ(download_extension_errors::kInvalidStateError, | |
| 1214 error.c_str()); | |
| 1215 error = RunFunctionAndReturnError( | |
| 1216 new DownloadsSearchFunction(), "[{\"orderBy\": \"goat\"}]"); | 1208 new DownloadsSearchFunction(), "[{\"orderBy\": \"goat\"}]"); |
| 1217 EXPECT_STREQ(download_extension_errors::kInvalidOrderByError, | 1209 EXPECT_STREQ(download_extension_errors::kInvalidOrderByError, |
| 1218 error.c_str()); | 1210 error.c_str()); |
| 1219 error = RunFunctionAndReturnError( | 1211 error = RunFunctionAndReturnError( |
| 1220 new DownloadsSearchFunction(), "[{\"limit\": -1}]"); | 1212 new DownloadsSearchFunction(), "[{\"limit\": -1}]"); |
| 1221 EXPECT_STREQ(download_extension_errors::kInvalidQueryLimit, | 1213 EXPECT_STREQ(download_extension_errors::kInvalidQueryLimit, |
| 1222 error.c_str()); | 1214 error.c_str()); |
| 1223 } | 1215 } |
| 1224 | 1216 |
| 1225 // Test searching using multiple conditions through multiple downloads. | 1217 // Test searching using multiple conditions through multiple downloads. |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2085 " \"state\": {" | 2077 " \"state\": {" |
| 2086 " \"previous\": \"in_progress\"," | 2078 " \"previous\": \"in_progress\"," |
| 2087 " \"current\": \"complete\"}}]", | 2079 " \"current\": \"complete\"}}]", |
| 2088 result_id, | 2080 result_id, |
| 2089 GetFilename("on_record.txt.crdownload").c_str(), | 2081 GetFilename("on_record.txt.crdownload").c_str(), |
| 2090 GetFilename("on_record.txt").c_str()))); | 2082 GetFilename("on_record.txt").c_str()))); |
| 2091 std::string disk_data; | 2083 std::string disk_data; |
| 2092 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); | 2084 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); |
| 2093 EXPECT_STREQ(kPayloadData, disk_data.c_str()); | 2085 EXPECT_STREQ(kPayloadData, disk_data.c_str()); |
| 2094 } | 2086 } |
| OLD | NEW |