Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: chrome/browser/history/text_database_unittest.cc

Issue 39206: NO CODE CHANGE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/history/query_parser_unittest.cc ('k') | chrome/browser/history/url_database.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/history/text_database.h" 9 #include "chrome/browser/history/text_database.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/platform_test.h" 11 #include "testing/platform_test.h"
12 12
13 using base::Time; 13 using base::Time;
14 14
15 namespace history { 15 namespace history {
16 16
17 namespace { 17 namespace {
18 18
19 // Note that all pages have "COUNTTAG" which allows us to count the number of 19 // Note that all pages have "COUNTTAG" which allows us to count the number of
20 // pages in the database withoujt adding any extra functions to the DB object. 20 // pages in the database withoujt adding any extra functions to the DB object.
21 const char kURL1[] = "http://www.google.com/"; 21 const char kURL1[] = "http://www.google.com/";
22 const int kTime1 = 1000; 22 const int kTime1 = 1000;
23 const char kTitle1[] = "Google"; 23 const char kTitle1[] = "Google";
24 const char kBody1[] = "COUNTTAG Web Images Maps News Shopping Gmail more My Acco unt | " 24 const char kBody1[] =
25 "COUNTTAG Web Images Maps News Shopping Gmail more My Account | "
25 "Sign out Advanced Search Preferences Language Tools Advertising Programs " 26 "Sign out Advanced Search Preferences Language Tools Advertising Programs "
26 "- Business Solutions - About Google, 2008 Google"; 27 "- Business Solutions - About Google, 2008 Google";
27 28
28 const char kURL2[] = "http://images.google.com/"; 29 const char kURL2[] = "http://images.google.com/";
29 const int kTime2 = 2000; 30 const int kTime2 = 2000;
30 const char kTitle2[] = "Google Image Search"; 31 const char kTitle2[] = "Google Image Search";
31 const char kBody2[] = "COUNTTAG Web Images Maps News Shopping Gmail more My Acco unt | " 32 const char kBody2[] =
33 "COUNTTAG Web Images Maps News Shopping Gmail more My Account | "
32 "Sign out Advanced Image Search Preferences The most comprehensive image " 34 "Sign out Advanced Image Search Preferences The most comprehensive image "
33 "search on the web. Want to help improve Google Image Search? Try Google " 35 "search on the web. Want to help improve Google Image Search? Try Google "
34 "Image Labeler. Advertising Programs - Business Solutions - About Google " 36 "Image Labeler. Advertising Programs - Business Solutions - About Google "
35 "2008 Google"; 37 "2008 Google";
36 38
37 const char kURL3[] = "http://slashdot.org/"; 39 const char kURL3[] = "http://slashdot.org/";
38 const int kTime3 = 3000; 40 const int kTime3 = 3000;
39 const char kTitle3[] = "Slashdot: News for nerds, stuff that matters"; 41 const char kTitle3[] = "Slashdot: News for nerds, stuff that matters";
40 const char kBody3[] = "COUNTTAG Slashdot Log In Create Account Subscribe Firehos e Why " 42 const char kBody3[] =
43 "COUNTTAG Slashdot Log In Create Account Subscribe Firehose Why "
41 "Log In? Why Subscribe? Nickname Password Public Terminal Sections " 44 "Log In? Why Subscribe? Nickname Password Public Terminal Sections "
42 "Main Apple AskSlashdot Backslash Books Developers Games Hardware " 45 "Main Apple AskSlashdot Backslash Books Developers Games Hardware "
43 "Interviews IT Linux Mobile Politics Science YRO"; 46 "Interviews IT Linux Mobile Politics Science YRO";
44 47
45 // Returns the number of rows currently in the database. 48 // Returns the number of rows currently in the database.
46 int RowCount(TextDatabase* db) { 49 int RowCount(TextDatabase* db) {
47 QueryOptions options; 50 QueryOptions options;
48 options.begin_time = Time::FromInternalValue(0); 51 options.begin_time = Time::FromInternalValue(0);
49 // Leave end_time at now. 52 // Leave end_time at now.
50 53
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 320
318 // There should be one result, the most recent one. 321 // There should be one result, the most recent one.
319 EXPECT_EQ(1U, results.size()); 322 EXPECT_EQ(1U, results.size());
320 EXPECT_TRUE(ResultsHaveURL(results, kURL2)); 323 EXPECT_TRUE(ResultsHaveURL(results, kURL2));
321 324
322 // The max time considered should be the date of the returned item. 325 // The max time considered should be the date of the returned item.
323 EXPECT_EQ(kTime2, first_time_searched.ToInternalValue()); 326 EXPECT_EQ(kTime2, first_time_searched.ToInternalValue());
324 } 327 }
325 328
326 } // namespace history 329 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/query_parser_unittest.cc ('k') | chrome/browser/history/url_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698