| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/history/history.h" | 12 #include "chrome/browser/history/history.h" |
| 13 #include "chrome/test/testing_browser_process_test.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 15 |
| 15 using base::Time; | 16 using base::Time; |
| 16 using base::TimeDelta; | 17 using base::TimeDelta; |
| 17 | 18 |
| 18 // Tests the history service for querying functionality. | 19 // Tests the history service for querying functionality. |
| 19 | 20 |
| 20 namespace history { | 21 namespace history { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 if (result.visit_time() != test_entries[test_entry_index].time) | 61 if (result.visit_time() != test_entries[test_entry_index].time) |
| 61 return false; | 62 return false; |
| 62 | 63 |
| 63 // Now check the URL & title. | 64 // Now check the URL & title. |
| 64 return result.url() == GURL(test_entries[test_entry_index].url) && | 65 return result.url() == GURL(test_entries[test_entry_index].url) && |
| 65 result.title() == UTF8ToUTF16(test_entries[test_entry_index].title); | 66 result.title() == UTF8ToUTF16(test_entries[test_entry_index].title); |
| 66 } | 67 } |
| 67 | 68 |
| 68 } // namespace | 69 } // namespace |
| 69 | 70 |
| 70 class HistoryQueryTest : public testing::Test { | 71 class HistoryQueryTest : public TestingBrowserProcessTest { |
| 71 public: | 72 public: |
| 72 HistoryQueryTest() { | 73 HistoryQueryTest() { |
| 73 } | 74 } |
| 74 | 75 |
| 75 // Acts like a synchronous call to history's QueryHistory. | 76 // Acts like a synchronous call to history's QueryHistory. |
| 76 void QueryHistory(const std::string& text_query, | 77 void QueryHistory(const std::string& text_query, |
| 77 const QueryOptions& options, | 78 const QueryOptions& options, |
| 78 QueryResults* results) { | 79 QueryResults* results) { |
| 79 history_->QueryHistory(UTF8ToUTF16(text_query), options, &consumer_, | 80 history_->QueryHistory(UTF8ToUTF16(text_query), options, &consumer_, |
| 80 NewCallback(this, &HistoryQueryTest::QueryHistoryComplete)); | 81 NewCallback(this, &HistoryQueryTest::QueryHistoryComplete)); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 QueryOptions options; | 342 QueryOptions options; |
| 342 QueryResults results; | 343 QueryResults results; |
| 343 | 344 |
| 344 QueryHistory("Other", options, &results); | 345 QueryHistory("Other", options, &results); |
| 345 EXPECT_EQ(1, results.urls().size()); | 346 EXPECT_EQ(1, results.urls().size()); |
| 346 EXPECT_TRUE(NthResultIs(results, 0, 4)); | 347 EXPECT_TRUE(NthResultIs(results, 0, 4)); |
| 347 } | 348 } |
| 348 */ | 349 */ |
| 349 | 350 |
| 350 } // namespace history | 351 } // namespace history |
| OLD | NEW |