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

Side by Side Diff: content/browser/fileapi/obfuscated_file_util_unittest.cc

Issue 780713002: Fix remaining WeakPtrFactory ordering problems (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 // TODO(ericu): The vast majority of this and the other FSFU subclass tests 140 // TODO(ericu): The vast majority of this and the other FSFU subclass tests
141 // could theoretically be shared. It would basically be a FSFU interface 141 // could theoretically be shared. It would basically be a FSFU interface
142 // compliance test, and only the subclass-specific bits that look into the 142 // compliance test, and only the subclass-specific bits that look into the
143 // implementation would need to be written per-subclass. 143 // implementation would need to be written per-subclass.
144 class ObfuscatedFileUtilTest : public testing::Test { 144 class ObfuscatedFileUtilTest : public testing::Test {
145 public: 145 public:
146 ObfuscatedFileUtilTest() 146 ObfuscatedFileUtilTest()
147 : origin_(GURL("http://www.example.com")), 147 : origin_(GURL("http://www.example.com")),
148 type_(storage::kFileSystemTypeTemporary), 148 type_(storage::kFileSystemTypeTemporary),
149 weak_factory_(this),
150 sandbox_file_system_(origin_, type_), 149 sandbox_file_system_(origin_, type_),
151 quota_status_(storage::kQuotaStatusUnknown), 150 quota_status_(storage::kQuotaStatusUnknown),
152 usage_(-1) {} 151 usage_(-1),
152 weak_factory_(this) {}
153 153
154 void SetUp() override { 154 void SetUp() override {
155 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); 155 ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
156 156
157 storage_policy_ = new MockSpecialStoragePolicy(); 157 storage_policy_ = new MockSpecialStoragePolicy();
158 158
159 quota_manager_ = 159 quota_manager_ =
160 new storage::QuotaManager(false /* is_incognito */, 160 new storage::QuotaManager(false /* is_incognito */,
161 data_dir_.path(), 161 data_dir_.path(),
162 base::MessageLoopProxy::current().get(), 162 base::MessageLoopProxy::current().get(),
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 } 795 }
796 796
797 protected: 797 protected:
798 base::ScopedTempDir data_dir_; 798 base::ScopedTempDir data_dir_;
799 base::MessageLoopForIO message_loop_; 799 base::MessageLoopForIO message_loop_;
800 scoped_refptr<MockSpecialStoragePolicy> storage_policy_; 800 scoped_refptr<MockSpecialStoragePolicy> storage_policy_;
801 scoped_refptr<storage::QuotaManager> quota_manager_; 801 scoped_refptr<storage::QuotaManager> quota_manager_;
802 scoped_refptr<FileSystemContext> file_system_context_; 802 scoped_refptr<FileSystemContext> file_system_context_;
803 GURL origin_; 803 GURL origin_;
804 storage::FileSystemType type_; 804 storage::FileSystemType type_;
805 base::WeakPtrFactory<ObfuscatedFileUtilTest> weak_factory_;
806 SandboxFileSystemTestHelper sandbox_file_system_; 805 SandboxFileSystemTestHelper sandbox_file_system_;
807 storage::QuotaStatusCode quota_status_; 806 storage::QuotaStatusCode quota_status_;
808 int64 usage_; 807 int64 usage_;
809 storage::MockFileChangeObserver change_observer_; 808 storage::MockFileChangeObserver change_observer_;
810 storage::ChangeObserverList change_observers_; 809 storage::ChangeObserverList change_observers_;
810 base::WeakPtrFactory<ObfuscatedFileUtilTest> weak_factory_;
811 811
812 private: 812 private:
813 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtilTest); 813 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtilTest);
814 }; 814 };
815 815
816 TEST_F(ObfuscatedFileUtilTest, TestCreateAndDeleteFile) { 816 TEST_F(ObfuscatedFileUtilTest, TestCreateAndDeleteFile) {
817 FileSystemURL url = CreateURLFromUTF8("fake/file"); 817 FileSystemURL url = CreateURLFromUTF8("fake/file");
818 scoped_ptr<FileSystemOperationContext> context(NewContext(NULL)); 818 scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
819 int file_flags = base::File::FLAG_CREATE | base::File::FLAG_WRITE; 819 int file_flags = base::File::FLAG_CREATE | base::File::FLAG_WRITE;
820 820
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after
2562 ofu()->GetDirectoryForOriginAndType( 2562 ofu()->GetDirectoryForOriginAndType(
2563 origin2, GetTypeString(kFileSystemTypeTemporary), false, &error); 2563 origin2, GetTypeString(kFileSystemTypeTemporary), false, &error);
2564 ASSERT_EQ(base::File::FILE_OK, error); 2564 ASSERT_EQ(base::File::FILE_OK, error);
2565 error = base::File::FILE_ERROR_FAILED; 2565 error = base::File::FILE_ERROR_FAILED;
2566 ofu()->GetDirectoryForOriginAndType( 2566 ofu()->GetDirectoryForOriginAndType(
2567 origin2, GetTypeString(kFileSystemTypePersistent), false, &error); 2567 origin2, GetTypeString(kFileSystemTypePersistent), false, &error);
2568 ASSERT_EQ(base::File::FILE_OK, error); 2568 ASSERT_EQ(base::File::FILE_OK, error);
2569 } 2569 }
2570 2570
2571 } // namespace content 2571 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/file_system_url_request_job_unittest.cc ('k') | content/browser/gamepad/gamepad_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698