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