| OLD | NEW |
| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 11 #include "base/scoped_temp_dir.h" | |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/history/history.h" | 13 #include "chrome/browser/history/history.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 using base::Time; | 16 using base::Time; |
| 17 using base::TimeDelta; | 17 using base::TimeDelta; |
| 18 | 18 |
| 19 // Tests the history service for querying functionality. | 19 // Tests the history service for querying functionality. |
| 20 | 20 |
| 21 namespace history { | 21 namespace history { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 history_.reset(); | 126 history_.reset(); |
| 127 MessageLoop::current()->Run(); // Wait for the other thread. | 127 MessageLoop::current()->Run(); // Wait for the other thread. |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 | 130 |
| 131 void QueryHistoryComplete(HistoryService::Handle, QueryResults* results) { | 131 void QueryHistoryComplete(HistoryService::Handle, QueryResults* results) { |
| 132 results->Swap(&last_query_results_); | 132 results->Swap(&last_query_results_); |
| 133 MessageLoop::current()->Quit(); // Will return out to QueryHistory. | 133 MessageLoop::current()->Quit(); // Will return out to QueryHistory. |
| 134 } | 134 } |
| 135 | 135 |
| 136 ScopedTempDir temp_dir_; | 136 base::ScopedTempDir temp_dir_; |
| 137 | 137 |
| 138 MessageLoop message_loop_; | 138 MessageLoop message_loop_; |
| 139 | 139 |
| 140 FilePath history_dir_; | 140 FilePath history_dir_; |
| 141 | 141 |
| 142 CancelableRequestConsumer consumer_; | 142 CancelableRequestConsumer consumer_; |
| 143 | 143 |
| 144 // The QueryHistoryComplete callback will put the results here so QueryHistory | 144 // The QueryHistoryComplete callback will put the results here so QueryHistory |
| 145 // can return them. | 145 // can return them. |
| 146 QueryResults last_query_results_; | 146 QueryResults last_query_results_; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 QueryOptions options; | 344 QueryOptions options; |
| 345 QueryResults results; | 345 QueryResults results; |
| 346 | 346 |
| 347 QueryHistory("Other", options, &results); | 347 QueryHistory("Other", options, &results); |
| 348 EXPECT_EQ(1, results.urls().size()); | 348 EXPECT_EQ(1, results.urls().size()); |
| 349 EXPECT_TRUE(NthResultIs(results, 0, 4)); | 349 EXPECT_TRUE(NthResultIs(results, 0, 4)); |
| 350 } | 350 } |
| 351 */ | 351 */ |
| 352 | 352 |
| 353 } // namespace history | 353 } // namespace history |
| OLD | NEW |