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

Side by Side Diff: ui/app_list/search/history_data_store_unittest.cc

Issue 2317123003: misc files R-U: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Just rebased Created 4 years, 2 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 | « tools/gn/function_write_file_unittest.cc ('k') | ui/base/resource/data_pack_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 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // testing::Test overrides: 46 // testing::Test overrides:
47 void SetUp() override { 47 void SetUp() override {
48 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 48 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
49 } 49 }
50 void TearDown() override { 50 void TearDown() override {
51 // Release |store_| while ui loop is still running. 51 // Release |store_| while ui loop is still running.
52 store_ = NULL; 52 store_ = NULL;
53 } 53 }
54 54
55 void OpenStore(const std::string& file_name) { 55 void OpenStore(const std::string& file_name) {
56 data_file_ = temp_dir_.path().AppendASCII(file_name); 56 data_file_ = temp_dir_.GetPath().AppendASCII(file_name);
57 store_ = new HistoryDataStore(scoped_refptr<DictionaryDataStore>( 57 store_ = new HistoryDataStore(scoped_refptr<DictionaryDataStore>(
58 new DictionaryDataStore(data_file_, worker_pool_owner_.pool().get()))); 58 new DictionaryDataStore(data_file_, worker_pool_owner_.pool().get())));
59 Load(); 59 Load();
60 } 60 }
61 61
62 void Flush() { store_->Flush(DictionaryDataStore::OnFlushedCallback()); } 62 void Flush() { store_->Flush(DictionaryDataStore::OnFlushedCallback()); }
63 63
64 void Load() { 64 void Load() {
65 store_->Load( 65 store_->Load(
66 base::Bind(&HistoryDataStoreTest::OnRead, base::Unretained(this))); 66 base::Bind(&HistoryDataStoreTest::OnRead, base::Unretained(this)));
67 run_loop_.reset(new base::RunLoop); 67 run_loop_.reset(new base::RunLoop);
68 run_loop_->Run(); 68 run_loop_->Run();
69 run_loop_.reset(); 69 run_loop_.reset();
70 } 70 }
71 71
72 void WriteDataFile(const std::string& file_name, const std::string& data) { 72 void WriteDataFile(const std::string& file_name, const std::string& data) {
73 base::WriteFile( 73 base::WriteFile(temp_dir_.GetPath().AppendASCII(file_name), data.c_str(),
74 temp_dir_.path().AppendASCII(file_name), data.c_str(), data.size()); 74 data.size());
75 } 75 }
76 76
77 HistoryDataStore* store() { return store_.get(); } 77 HistoryDataStore* store() { return store_.get(); }
78 const HistoryData::Associations& associations() const { 78 const HistoryData::Associations& associations() const {
79 return associations_; 79 return associations_;
80 } 80 }
81 81
82 private: 82 private:
83 void OnRead(std::unique_ptr<HistoryData::Associations> associations) { 83 void OnRead(std::unique_ptr<HistoryData::Associations> associations) {
84 associations_.clear(); 84 associations_.clear();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 EXPECT_EQ(now, it->second.update_time); 170 EXPECT_EQ(now, it->second.update_time);
171 171
172 store()->Delete(kQuery); 172 store()->Delete(kQuery);
173 Flush(); 173 Flush();
174 Load(); 174 Load();
175 EXPECT_TRUE(associations().empty()); 175 EXPECT_TRUE(associations().empty());
176 } 176 }
177 177
178 } // namespace test 178 } // namespace test
179 } // namespace app_list 179 } // namespace app_list
OLDNEW
« no previous file with comments | « tools/gn/function_write_file_unittest.cc ('k') | ui/base/resource/data_pack_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698