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 "chrome/browser/autocomplete/history_quick_provider.h" | 5 #include "chrome/browser/autocomplete/history_quick_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 transaction.Commit(); | 205 transaction.Commit(); |
206 | 206 |
207 // Add visits. | 207 // Add visits. |
208 for (int j = 0; j < cur.visit_count; ++j) { | 208 for (int j = 0; j < cur.visit_count; ++j) { |
209 // Assume earlier visits are at one-day intervals. | 209 // Assume earlier visits are at one-day intervals. |
210 visit_time -= TimeDelta::FromDays(1); | 210 visit_time -= TimeDelta::FromDays(1); |
211 transaction.Begin(); | 211 transaction.Begin(); |
212 // Mark the most recent |cur.typed_count| visits as typed. | 212 // Mark the most recent |cur.typed_count| visits as typed. |
213 std::string sql_cmd_line = base::StringPrintf( | 213 std::string sql_cmd_line = base::StringPrintf( |
214 "INSERT INTO \"visits\" VALUES(%" PRIuS ", %" PRIuS ", %" PRId64 | 214 "INSERT INTO \"visits\" VALUES(%" PRIuS ", %" PRIuS ", %" PRId64 |
215 ", 0, %d, 0, 0, 1)", | 215 ", 0, %d, 0, 1)", |
216 visit_id++, i + 1, visit_time.ToInternalValue(), | 216 visit_id++, i + 1, visit_time.ToInternalValue(), |
217 (j < cur.typed_count) ? content::PAGE_TRANSITION_TYPED : | 217 (j < cur.typed_count) ? content::PAGE_TRANSITION_TYPED : |
218 content::PAGE_TRANSITION_LINK); | 218 content::PAGE_TRANSITION_LINK); |
219 | 219 |
220 std::string sql_cmd(sql_cmd_line); | 220 std::string sql_cmd(sql_cmd_line); |
221 sql::Statement sql_stmt(db.GetUniqueStatement(sql_cmd_line.c_str())); | 221 sql::Statement sql_stmt(db.GetUniqueStatement(sql_cmd_line.c_str())); |
222 EXPECT_TRUE(sql_stmt.Run()); | 222 EXPECT_TRUE(sql_stmt.Run()); |
223 transaction.Commit(); | 223 transaction.Commit(); |
224 } | 224 } |
225 } | 225 } |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 } | 621 } |
622 | 622 |
623 TEST_F(HQPOrderingTest, TEAMatch) { | 623 TEST_F(HQPOrderingTest, TEAMatch) { |
624 std::vector<std::string> expected_urls; | 624 std::vector<std::string> expected_urls; |
625 expected_urls.push_back("http://www.teamliquid.net/"); | 625 expected_urls.push_back("http://www.teamliquid.net/"); |
626 expected_urls.push_back("http://www.teamliquid.net/tlpd"); | 626 expected_urls.push_back("http://www.teamliquid.net/tlpd"); |
627 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); | 627 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); |
628 RunTest(ASCIIToUTF16("tea"), expected_urls, true, | 628 RunTest(ASCIIToUTF16("tea"), expected_urls, true, |
629 ASCIIToUTF16("www.teamliquid.net")); | 629 ASCIIToUTF16("www.teamliquid.net")); |
630 } | 630 } |
OLD | NEW |