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

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api_unittest.cc

Issue 10805020: Kill DownloadItem::IsOtr() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: . Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 std::string off_item_arg; 1356 std::string off_item_arg;
1357 std::string result_string; 1357 std::string result_string;
1358 1358
1359 // Set up one on-record item and one off-record item. 1359 // Set up one on-record item and one off-record item.
1360 // Set up the off-record item first because otherwise there are mysteriously 3 1360 // Set up the off-record item first because otherwise there are mysteriously 3
1361 // items total instead of 2. 1361 // items total instead of 2.
1362 // TODO(benjhayden): Figure out where the third item comes from. 1362 // TODO(benjhayden): Figure out where the third item comes from.
1363 GoOffTheRecord(); 1363 GoOffTheRecord();
1364 DownloadItem* off_item = CreateSlowTestDownload(); 1364 DownloadItem* off_item = CreateSlowTestDownload();
1365 ASSERT_TRUE(off_item); 1365 ASSERT_TRUE(off_item);
1366 ASSERT_TRUE(off_item->IsOtr());
1367 off_item_arg = DownloadItemIdAsArgList(off_item); 1366 off_item_arg = DownloadItemIdAsArgList(off_item);
1368 1367
1369 GoOnTheRecord(); 1368 GoOnTheRecord();
1370 DownloadItem* on_item = CreateSlowTestDownload(); 1369 DownloadItem* on_item = CreateSlowTestDownload();
1371 ASSERT_TRUE(on_item); 1370 ASSERT_TRUE(on_item);
1372 ASSERT_FALSE(on_item->IsOtr());
1373 on_item_arg = DownloadItemIdAsArgList(on_item); 1371 on_item_arg = DownloadItemIdAsArgList(on_item);
1374 ASSERT_TRUE(on_item->GetFullPath() != off_item->GetFullPath()); 1372 ASSERT_TRUE(on_item->GetFullPath() != off_item->GetFullPath());
1375 1373
1376 // Extensions running in the incognito window should have access to both 1374 // Extensions running in the incognito window should have access to both
1377 // items because the Test extension is in spanning mode. 1375 // items because the Test extension is in spanning mode.
1378 GoOffTheRecord(); 1376 GoOffTheRecord();
1379 result_value.reset(RunFunctionAndReturnResult( 1377 result_value.reset(RunFunctionAndReturnResult(
1380 new DownloadsSearchFunction(), "[{}]")); 1378 new DownloadsSearchFunction(), "[{}]"));
1381 ASSERT_TRUE(result_value.get()); 1379 ASSERT_TRUE(result_value.get());
1382 ASSERT_TRUE(result_value->GetAsList(&result_list)); 1380 ASSERT_TRUE(result_value->GetAsList(&result_list));
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 " \"state\": {" 2175 " \"state\": {"
2178 " \"previous\": \"in_progress\"," 2176 " \"previous\": \"in_progress\","
2179 " \"current\": \"complete\"}}]", 2177 " \"current\": \"complete\"}}]",
2180 result_id, 2178 result_id,
2181 GetFilename("on_record.txt.crdownload").c_str(), 2179 GetFilename("on_record.txt.crdownload").c_str(),
2182 GetFilename("on_record.txt").c_str()))); 2180 GetFilename("on_record.txt").c_str())));
2183 std::string disk_data; 2181 std::string disk_data;
2184 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); 2182 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data));
2185 EXPECT_STREQ(kPayloadData, disk_data.c_str()); 2183 EXPECT_STREQ(kPayloadData, disk_data.c_str());
2186 } 2184 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698