Commit 66633f78 authored by Wez's avatar Wez Committed by Commit Bot

Remove unnecessary WeakPtrFactory from test.

Bug: 847032
Change-Id: I09cb5743bcd6b7493329f6a578522362e1da32db
Reviewed-on: https://chromium-review.googlesource.com/1074505Reviewed-by: default avatarTaiju Tsuiki <tzik@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563014}
parent e090f195
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "storage/browser/test/mock_special_storage_policy.h" #include "storage/browser/test/mock_special_storage_policy.h"
#include "storage/browser/test/test_file_system_backend.h" #include "storage/browser/test/test_file_system_backend.h"
#include "storage/browser/test/test_file_system_context.h" #include "storage/browser/test/test_file_system_context.h"
#include "storage/browser/test/test_file_system_options.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/icu/source/i18n/unicode/datefmt.h" #include "third_party/icu/source/i18n/unicode/datefmt.h"
#include "third_party/icu/source/i18n/unicode/regex.h" #include "third_party/icu/source/i18n/unicode/regex.h"
...@@ -154,25 +155,27 @@ void ShutdownFileSystemContextOnIOThread( ...@@ -154,25 +155,27 @@ void ShutdownFileSystemContextOnIOThread(
class FileSystemURLLoaderFactoryTest : public ContentBrowserTest { class FileSystemURLLoaderFactoryTest : public ContentBrowserTest {
protected: protected:
FileSystemURLLoaderFactoryTest() : weak_factory_(this) {} FileSystemURLLoaderFactoryTest() {}
~FileSystemURLLoaderFactoryTest() override = default; ~FileSystemURLLoaderFactoryTest() override = default;
void SetUpOnMainThread() override { void SetUpOnMainThread() override {
feature_list_.InitAndEnableFeature(network::features::kNetworkService); feature_list_.InitAndEnableFeature(network::features::kNetworkService);
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
special_storage_policy_ = new MockSpecialStoragePolicy; special_storage_policy_ = new MockSpecialStoragePolicy;
// We use a test FileSystemContext which runs on the main thread, so we
// can work with it synchronously.
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
file_system_context_ = file_system_context_ =
CreateFileSystemContextForTesting(nullptr, temp_dir_.GetPath()); CreateFileSystemContextForTesting(nullptr, temp_dir_.GetPath());
base::RunLoop run_loop;
// We use the main thread so that we can get the root path synchronously.
file_system_context_->OpenFileSystem( file_system_context_->OpenFileSystem(
GURL("http://remote/"), storage::kFileSystemTypeTemporary, GURL("http://remote/"), storage::kFileSystemTypeTemporary,
storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
base::BindOnce(&FileSystemURLLoaderFactoryTest::OnOpenFileSystem, base::BindOnce(&FileSystemURLLoaderFactoryTest::OnOpenFileSystem,
weak_factory_.GetWeakPtr())); run_loop.QuitWhenIdleClosure()));
base::RunLoop().RunUntilIdle(); run_loop.Run();
ContentBrowserTest::SetUpOnMainThread(); ContentBrowserTest::SetUpOnMainThread();
} }
...@@ -333,6 +336,14 @@ class FileSystemURLLoaderFactoryTest : public ContentBrowserTest { ...@@ -333,6 +336,14 @@ class FileSystemURLLoaderFactoryTest : public ContentBrowserTest {
network::mojom::URLLoaderPtr loader_; network::mojom::URLLoaderPtr loader_;
private: private:
static void OnOpenFileSystem(base::OnceClosure done_closure,
const GURL& root_url,
const std::string& name,
base::File::Error result) {
ASSERT_EQ(base::File::FILE_OK, result);
std::move(done_closure).Run();
}
storage::FileSystemFileUtil* file_util() { storage::FileSystemFileUtil* file_util() {
return file_system_context_->sandbox_delegate()->sync_file_util(); return file_system_context_->sandbox_delegate()->sync_file_util();
} }
...@@ -344,12 +355,6 @@ class FileSystemURLLoaderFactoryTest : public ContentBrowserTest { ...@@ -344,12 +355,6 @@ class FileSystemURLLoaderFactoryTest : public ContentBrowserTest {
return context; return context;
} }
void OnOpenFileSystem(const GURL& root_url,
const std::string& name,
base::File::Error result) {
ASSERT_EQ(base::File::FILE_OK, result);
}
RenderFrameHost* render_frame_host() const { RenderFrameHost* render_frame_host() const {
return shell()->web_contents()->GetMainFrame(); return shell()->web_contents()->GetMainFrame();
} }
...@@ -393,7 +398,6 @@ class FileSystemURLLoaderFactoryTest : public ContentBrowserTest { ...@@ -393,7 +398,6 @@ class FileSystemURLLoaderFactoryTest : public ContentBrowserTest {
base::test::ScopedFeatureList feature_list_; base::test::ScopedFeatureList feature_list_;
scoped_refptr<MockSpecialStoragePolicy> special_storage_policy_; scoped_refptr<MockSpecialStoragePolicy> special_storage_policy_;
scoped_refptr<FileSystemContext> file_system_context_; scoped_refptr<FileSystemContext> file_system_context_;
base::WeakPtrFactory<FileSystemURLLoaderFactoryTest> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(FileSystemURLLoaderFactoryTest); DISALLOW_COPY_AND_ASSIGN(FileSystemURLLoaderFactoryTest);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment