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

Side by Side Diff: chrome/browser/chromeos/drive/file_cache_unittest.cc

Issue 1124813003: [chrome/browser/chromeos/drive] Avoid use of MessageLoopProxy by use of TTRH (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Review Comments 3 : Indent Created 5 years, 7 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
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 "chrome/browser/chromeos/drive/file_cache.h" 5 #include "chrome/browser/chromeos/drive/file_cache.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
11 #include "base/files/file_enumerator.h" 11 #include "base/files/file_enumerator.h"
12 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
13 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
14 #include "base/md5.h" 14 #include "base/md5.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/single_thread_task_runner.h"
17 #include "base/thread_task_runner_handle.h"
16 #include "chrome/browser/chromeos/drive/drive.pb.h" 18 #include "chrome/browser/chromeos/drive/drive.pb.h"
17 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" 19 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
18 #include "chrome/browser/chromeos/drive/file_system_util.h" 20 #include "chrome/browser/chromeos/drive/file_system_util.h"
19 #include "chrome/browser/chromeos/drive/resource_metadata_storage.h" 21 #include "chrome/browser/chromeos/drive/resource_metadata_storage.h"
20 #include "chrome/browser/chromeos/drive/test_util.h" 22 #include "chrome/browser/chromeos/drive/test_util.h"
21 #include "content/public/test/test_browser_thread_bundle.h" 23 #include "content/public/test/test_browser_thread_bundle.h"
22 #include "google_apis/drive/test_util.h" 24 #include "google_apis/drive/test_util.h"
23 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
24 26
25 namespace drive { 27 namespace drive {
(...skipping 12 matching lines...) Expand all
38 const base::FilePath metadata_dir = temp_dir_.path().AppendASCII("meta"); 40 const base::FilePath metadata_dir = temp_dir_.path().AppendASCII("meta");
39 cache_files_dir_ = temp_dir_.path().AppendASCII(kCacheFileDirectory); 41 cache_files_dir_ = temp_dir_.path().AppendASCII(kCacheFileDirectory);
40 42
41 ASSERT_TRUE(base::CreateDirectory(metadata_dir)); 43 ASSERT_TRUE(base::CreateDirectory(metadata_dir));
42 ASSERT_TRUE(base::CreateDirectory(cache_files_dir_)); 44 ASSERT_TRUE(base::CreateDirectory(cache_files_dir_));
43 45
44 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); 46 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter);
45 47
46 metadata_storage_.reset(new ResourceMetadataStorage( 48 metadata_storage_.reset(new ResourceMetadataStorage(
47 metadata_dir, 49 metadata_dir,
48 base::MessageLoopProxy::current().get())); 50 base::ThreadTaskRunnerHandle::Get().get()));
49 ASSERT_TRUE(metadata_storage_->Initialize()); 51 ASSERT_TRUE(metadata_storage_->Initialize());
50 52
51 cache_.reset(new FileCache( 53 cache_.reset(new FileCache(
52 metadata_storage_.get(), 54 metadata_storage_.get(),
53 cache_files_dir_, 55 cache_files_dir_,
54 base::MessageLoopProxy::current().get(), 56 base::ThreadTaskRunnerHandle::Get().get(),
55 fake_free_disk_space_getter_.get())); 57 fake_free_disk_space_getter_.get()));
56 ASSERT_TRUE(cache_->Initialize()); 58 ASSERT_TRUE(cache_->Initialize());
57 } 59 }
58 60
59 static bool RenameCacheFilesToNewFormat(FileCache* cache) { 61 static bool RenameCacheFilesToNewFormat(FileCache* cache) {
60 return cache->RenameCacheFilesToNewFormat(); 62 return cache->RenameCacheFilesToNewFormat();
61 } 63 }
62 64
63 content::TestBrowserThreadBundle thread_bundle_; 65 content::TestBrowserThreadBundle thread_bundle_;
64 base::ScopedTempDir temp_dir_; 66 base::ScopedTempDir temp_dir_;
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 553
552 // Clear cache. 554 // Clear cache.
553 EXPECT_TRUE(cache_->ClearAll()); 555 EXPECT_TRUE(cache_->ClearAll());
554 556
555 // Verify that the cache is removed. 557 // Verify that the cache is removed.
556 EXPECT_TRUE(base::IsDirectoryEmpty(cache_files_dir_)); 558 EXPECT_TRUE(base::IsDirectoryEmpty(cache_files_dir_));
557 } 559 }
558 560
559 } // namespace internal 561 } // namespace internal
560 } // namespace drive 562 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698