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

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, 4 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 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/downloads/downloads_api.cc ('k') | chrome/browser/ui/webui/downloads_dom_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698