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/browsing_data/browsing_data_file_system_helper_unittest.cc

Issue 2083363002: Remove calls to deprecated MessageLoop methods in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/browsing_data/browsing_data_remover_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h"
14 #include "base/stl_util.h" 15 #include "base/stl_util.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" 17 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h"
17 #include "chrome/test/base/testing_profile.h" 18 #include "chrome/test/base/testing_profile.h"
18 #include "content/public/browser/storage_partition.h" 19 #include "content/public/browser/storage_partition.h"
19 #include "content/public/test/test_browser_thread.h" 20 #include "content/public/test/test_browser_thread.h"
20 #include "content/public/test/test_browser_thread_bundle.h" 21 #include "content/public/test/test_browser_thread_bundle.h"
21 #include "storage/browser/fileapi/file_system_context.h" 22 #include "storage/browser/fileapi/file_system_context.h"
22 #include "storage/browser/fileapi/file_system_url.h" 23 #include "storage/browser/fileapi/file_system_url.h"
23 #include "storage/common/fileapi/file_system_types.h" 24 #include "storage/common/fileapi/file_system_types.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // implemented as a class method that that calls Notify() at an appropriate 64 // implemented as a class method that that calls Notify() at an appropriate
64 // point. 65 // point.
65 class BrowsingDataFileSystemHelperTest : public testing::Test { 66 class BrowsingDataFileSystemHelperTest : public testing::Test {
66 public: 67 public:
67 BrowsingDataFileSystemHelperTest() { 68 BrowsingDataFileSystemHelperTest() {
68 profile_.reset(new TestingProfile()); 69 profile_.reset(new TestingProfile());
69 70
70 helper_ = BrowsingDataFileSystemHelper::Create( 71 helper_ = BrowsingDataFileSystemHelper::Create(
71 BrowserContext::GetDefaultStoragePartition(profile_.get())-> 72 BrowserContext::GetDefaultStoragePartition(profile_.get())->
72 GetFileSystemContext()); 73 GetFileSystemContext());
73 base::MessageLoop::current()->RunUntilIdle(); 74 base::RunLoop().RunUntilIdle();
74 canned_helper_ = new CannedBrowsingDataFileSystemHelper(profile_.get()); 75 canned_helper_ = new CannedBrowsingDataFileSystemHelper(profile_.get());
75 } 76 }
76 ~BrowsingDataFileSystemHelperTest() override { 77 ~BrowsingDataFileSystemHelperTest() override {
77 // Avoid memory leaks. 78 // Avoid memory leaks.
78 profile_.reset(); 79 profile_.reset();
79 base::MessageLoop::current()->RunUntilIdle(); 80 base::RunLoop().RunUntilIdle();
80 } 81 }
81 82
82 TestingProfile* GetProfile() { 83 TestingProfile* GetProfile() {
83 return profile_.get(); 84 return profile_.get();
84 } 85 }
85 86
86 // Blocks on the current MessageLoop until Notify() is called. 87 // Blocks on the current MessageLoop until Notify() is called.
87 void BlockUntilNotified() { 88 void BlockUntilNotified() { base::RunLoop().Run(); }
88 base::MessageLoop::current()->Run();
89 }
90 89
91 // Unblocks the current MessageLoop. Should be called in response to some sort 90 // Unblocks the current MessageLoop. Should be called in response to some sort
92 // of async activity in a callback method. 91 // of async activity in a callback method.
93 void Notify() { base::MessageLoop::current()->QuitWhenIdle(); } 92 void Notify() { base::MessageLoop::current()->QuitWhenIdle(); }
94 93
95 // Callback that should be executed in response to 94 // Callback that should be executed in response to
96 // storage::FileSystemContext::OpenFileSystem. 95 // storage::FileSystemContext::OpenFileSystem.
97 void OpenFileSystemCallback(const GURL& root, 96 void OpenFileSystemCallback(const GURL& root,
98 const std::string& name, 97 const std::string& name,
99 base::File::Error error) { 98 base::File::Error error) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 // extension and devtools schemes. 297 // extension and devtools schemes.
299 TEST_F(BrowsingDataFileSystemHelperTest, IgnoreExtensionsAndDevTools) { 298 TEST_F(BrowsingDataFileSystemHelperTest, IgnoreExtensionsAndDevTools) {
300 ASSERT_TRUE(canned_helper_->empty()); 299 ASSERT_TRUE(canned_helper_->empty());
301 canned_helper_->AddFileSystem(kOriginExt, kTemporary, 0); 300 canned_helper_->AddFileSystem(kOriginExt, kTemporary, 0);
302 ASSERT_TRUE(canned_helper_->empty()); 301 ASSERT_TRUE(canned_helper_->empty());
303 canned_helper_->AddFileSystem(kOriginDevTools, kTemporary, 0); 302 canned_helper_->AddFileSystem(kOriginDevTools, kTemporary, 0);
304 ASSERT_TRUE(canned_helper_->empty()); 303 ASSERT_TRUE(canned_helper_->empty());
305 } 304 }
306 305
307 } // namespace 306 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browsing_data/browsing_data_remover_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698