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