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