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

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

Issue 10909182: Make FileSystemContext respect StoragePartitions. filesystem:// urls will be properly isolated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch unittest fix from michael Created 8 years, 3 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 17 matching lines...) Expand all
28 #include "chrome/common/chrome_notification_types.h" 28 #include "chrome/common/chrome_notification_types.h"
29 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
30 #include "chrome/test/base/in_process_browser_test.h" 30 #include "chrome/test/base/in_process_browser_test.h"
31 #include "chrome/test/base/ui_test_utils.h" 31 #include "chrome/test/base/ui_test_utils.h"
32 #include "content/public/browser/browser_context.h" 32 #include "content/public/browser/browser_context.h"
33 #include "content/public/browser/browser_thread.h" 33 #include "content/public/browser/browser_thread.h"
34 #include "content/public/browser/download_item.h" 34 #include "content/public/browser/download_item.h"
35 #include "content/public/browser/download_manager.h" 35 #include "content/public/browser/download_manager.h"
36 #include "content/public/browser/download_persistent_store_info.h" 36 #include "content/public/browser/download_persistent_store_info.h"
37 #include "content/public/browser/notification_service.h" 37 #include "content/public/browser/notification_service.h"
38 #include "content/public/browser/storage_partition.h"
38 #include "content/public/browser/web_contents.h" 39 #include "content/public/browser/web_contents.h"
39 #include "content/public/common/page_transition_types.h" 40 #include "content/public/common/page_transition_types.h"
40 #include "content/public/test/download_test_observer.h" 41 #include "content/public/test/download_test_observer.h"
41 #include "content/test/net/url_request_slow_download_job.h" 42 #include "content/test/net/url_request_slow_download_job.h"
42 #include "net/base/data_url.h" 43 #include "net/base/data_url.h"
43 #include "net/base/net_util.h" 44 #include "net/base/net_util.h"
44 #include "net/url_request/url_request.h" 45 #include "net/url_request/url_request.h"
45 #include "net/url_request/url_request_context.h" 46 #include "net/url_request/url_request_context.h"
46 #include "net/url_request/url_request_job.h" 47 #include "net/url_request/url_request_job.h"
47 #include "net/url_request/url_request_job_factory_impl.h" 48 #include "net/url_request/url_request_job_factory_impl.h"
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 const std::string& filename, 674 const std::string& filename,
674 const std::string& origin, 675 const std::string& origin,
675 DownloadsEventsListener* events_listener, 676 DownloadsEventsListener* events_listener,
676 const std::string& payload) 677 const std::string& payload)
677 : profile_(profile), 678 : profile_(profile),
678 filename_(filename), 679 filename_(filename),
679 origin_(origin), 680 origin_(origin),
680 events_listener_(events_listener), 681 events_listener_(events_listener),
681 blob_data_(new webkit_blob::BlobData()), 682 blob_data_(new webkit_blob::BlobData()),
682 payload_(payload), 683 payload_(payload),
683 fs_(BrowserContext::GetFileSystemContext(profile_)) { 684 fs_(BrowserContext::GetDefaultStoragePartition(profile_)->
685 GetFileSystemContext()) {
684 CHECK(profile_); 686 CHECK(profile_);
685 CHECK(events_listener_); 687 CHECK(events_listener_);
686 CHECK(fs_); 688 CHECK(fs_);
687 } 689 }
688 690
689 ~HTML5FileWriter() { 691 ~HTML5FileWriter() {
690 CHECK(BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( 692 CHECK(BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(
691 &HTML5FileWriter::TearDownURLRequestContext, base::Unretained(this)))); 693 &HTML5FileWriter::TearDownURLRequestContext, base::Unretained(this))));
692 events_listener_->WaitFor(profile_, kURLRequestContextToreDown, ""); 694 events_listener_->WaitFor(profile_, kURLRequestContextToreDown, "");
693 } 695 }
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 " \"state\": {" 2087 " \"state\": {"
2086 " \"previous\": \"in_progress\"," 2088 " \"previous\": \"in_progress\","
2087 " \"current\": \"complete\"}}]", 2089 " \"current\": \"complete\"}}]",
2088 result_id, 2090 result_id,
2089 GetFilename("on_record.txt.crdownload").c_str(), 2091 GetFilename("on_record.txt.crdownload").c_str(),
2090 GetFilename("on_record.txt").c_str()))); 2092 GetFilename("on_record.txt").c_str())));
2091 std::string disk_data; 2093 std::string disk_data;
2092 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); 2094 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data));
2093 EXPECT_STREQ(kPayloadData, disk_data.c_str()); 2095 EXPECT_STREQ(kPayloadData, disk_data.c_str());
2094 } 2096 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698