OLD | NEW |
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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 data_->AddObserver(this); | 40 data_->AddObserver(this); |
41 | 41 |
42 run_loop_.reset(new base::RunLoop); | 42 run_loop_.reset(new base::RunLoop); |
43 run_loop_->Run(); | 43 run_loop_->Run(); |
44 | 44 |
45 data_->RemoveObserver(this); | 45 data_->RemoveObserver(this); |
46 } | 46 } |
47 | 47 |
48 private: | 48 private: |
49 // HistoryDataObserver overrides: | 49 // HistoryDataObserver overrides: |
50 virtual void OnHistoryDataLoadedFromStore() OVERRIDE { | 50 virtual void OnHistoryDataLoadedFromStore() override { |
51 run_loop_->Quit(); | 51 run_loop_->Quit(); |
52 } | 52 } |
53 | 53 |
54 HistoryData* data_; // Not owned. | 54 HistoryData* data_; // Not owned. |
55 scoped_ptr<base::RunLoop> run_loop_; | 55 scoped_ptr<base::RunLoop> run_loop_; |
56 | 56 |
57 DISALLOW_COPY_AND_ASSIGN(HistoryDataLoadWaiter); | 57 DISALLOW_COPY_AND_ASSIGN(HistoryDataLoadWaiter); |
58 }; | 58 }; |
59 | 59 |
60 // StoreFlushWaiter waits for the given |store| to flush its data to disk. | 60 // StoreFlushWaiter waits for the given |store| to flush its data to disk. |
(...skipping 26 matching lines...) Expand all Loading... |
87 | 87 |
88 } // namespace | 88 } // namespace |
89 | 89 |
90 class SearchHistoryTest : public testing::Test { | 90 class SearchHistoryTest : public testing::Test { |
91 public: | 91 public: |
92 SearchHistoryTest() | 92 SearchHistoryTest() |
93 : ui_thread_(content::BrowserThread::UI, &message_loop_) {} | 93 : ui_thread_(content::BrowserThread::UI, &message_loop_) {} |
94 virtual ~SearchHistoryTest() {} | 94 virtual ~SearchHistoryTest() {} |
95 | 95 |
96 // testing::Test overrides: | 96 // testing::Test overrides: |
97 virtual void SetUp() OVERRIDE { | 97 virtual void SetUp() override { |
98 profile_.reset(new TestingProfile); | 98 profile_.reset(new TestingProfile); |
99 CreateHistory(); | 99 CreateHistory(); |
100 } | 100 } |
101 virtual void TearDown() OVERRIDE { | 101 virtual void TearDown() override { |
102 Flush(); | 102 Flush(); |
103 } | 103 } |
104 | 104 |
105 void CreateHistory() { | 105 void CreateHistory() { |
106 const char kStoreDataFileName[] = "app-launcher-test"; | 106 const char kStoreDataFileName[] = "app-launcher-test"; |
107 const base::FilePath data_file = | 107 const base::FilePath data_file = |
108 profile_->GetPath().AppendASCII(kStoreDataFileName); | 108 profile_->GetPath().AppendASCII(kStoreDataFileName); |
109 scoped_refptr<DictionaryDataStore> dictionary_data_store( | 109 scoped_refptr<DictionaryDataStore> dictionary_data_store( |
110 new DictionaryDataStore(data_file)); | 110 new DictionaryDataStore(data_file)); |
111 history_.reset(new History(scoped_refptr<HistoryDataStore>( | 111 history_.reset(new History(scoped_refptr<HistoryDataStore>( |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 294 |
295 // The oldest secondary is gone. | 295 // The oldest secondary is gone. |
296 EXPECT_EQ(UNKNOWN_RESULT, GetResultType("1")); | 296 EXPECT_EQ(UNKNOWN_RESULT, GetResultType("1")); |
297 | 297 |
298 // Touched oldest survived. | 298 // Touched oldest survived. |
299 EXPECT_EQ(PERFECT_SECONDARY, GetResultType("0")); | 299 EXPECT_EQ(PERFECT_SECONDARY, GetResultType("0")); |
300 } | 300 } |
301 | 301 |
302 } // namespace test | 302 } // namespace test |
303 } // namespace app_list | 303 } // namespace app_list |
OLD | NEW |