| 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 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 std::string off_item_arg; | 1340 std::string off_item_arg; |
| 1341 std::string result_string; | 1341 std::string result_string; |
| 1342 | 1342 |
| 1343 // Set up one on-record item and one off-record item. | 1343 // Set up one on-record item and one off-record item. |
| 1344 // Set up the off-record item first because otherwise there are mysteriously 3 | 1344 // Set up the off-record item first because otherwise there are mysteriously 3 |
| 1345 // items total instead of 2. | 1345 // items total instead of 2. |
| 1346 // TODO(benjhayden): Figure out where the third item comes from. | 1346 // TODO(benjhayden): Figure out where the third item comes from. |
| 1347 GoOffTheRecord(); | 1347 GoOffTheRecord(); |
| 1348 DownloadItem* off_item = CreateSlowTestDownload(); | 1348 DownloadItem* off_item = CreateSlowTestDownload(); |
| 1349 ASSERT_TRUE(off_item); | 1349 ASSERT_TRUE(off_item); |
| 1350 ASSERT_TRUE(off_item->IsOtr()); | |
| 1351 off_item_arg = DownloadItemIdAsArgList(off_item); | 1350 off_item_arg = DownloadItemIdAsArgList(off_item); |
| 1352 | 1351 |
| 1353 GoOnTheRecord(); | 1352 GoOnTheRecord(); |
| 1354 DownloadItem* on_item = CreateSlowTestDownload(); | 1353 DownloadItem* on_item = CreateSlowTestDownload(); |
| 1355 ASSERT_TRUE(on_item); | 1354 ASSERT_TRUE(on_item); |
| 1356 ASSERT_FALSE(on_item->IsOtr()); | |
| 1357 on_item_arg = DownloadItemIdAsArgList(on_item); | 1355 on_item_arg = DownloadItemIdAsArgList(on_item); |
| 1358 ASSERT_TRUE(on_item->GetFullPath() != off_item->GetFullPath()); | 1356 ASSERT_TRUE(on_item->GetFullPath() != off_item->GetFullPath()); |
| 1359 | 1357 |
| 1360 // Extensions running in the incognito window should have access to both | 1358 // Extensions running in the incognito window should have access to both |
| 1361 // items because the Test extension is in spanning mode. | 1359 // items because the Test extension is in spanning mode. |
| 1362 GoOffTheRecord(); | 1360 GoOffTheRecord(); |
| 1363 result_value.reset(RunFunctionAndReturnResult( | 1361 result_value.reset(RunFunctionAndReturnResult( |
| 1364 new DownloadsSearchFunction(), "[{}]")); | 1362 new DownloadsSearchFunction(), "[{}]")); |
| 1365 ASSERT_TRUE(result_value.get()); | 1363 ASSERT_TRUE(result_value.get()); |
| 1366 ASSERT_TRUE(result_value->GetAsList(&result_list)); | 1364 ASSERT_TRUE(result_value->GetAsList(&result_list)); |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2154 " \"state\": {" | 2152 " \"state\": {" |
| 2155 " \"previous\": \"in_progress\"," | 2153 " \"previous\": \"in_progress\"," |
| 2156 " \"current\": \"complete\"}}]", | 2154 " \"current\": \"complete\"}}]", |
| 2157 result_id, | 2155 result_id, |
| 2158 GetFilename("on_record.txt.crdownload").c_str(), | 2156 GetFilename("on_record.txt.crdownload").c_str(), |
| 2159 GetFilename("on_record.txt").c_str()))); | 2157 GetFilename("on_record.txt").c_str()))); |
| 2160 std::string disk_data; | 2158 std::string disk_data; |
| 2161 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); | 2159 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); |
| 2162 EXPECT_STREQ(kPayloadData, disk_data.c_str()); | 2160 EXPECT_STREQ(kPayloadData, disk_data.c_str()); |
| 2163 } | 2161 } |
| OLD | NEW |