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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 return false; | 81 return false; |
82 } | 82 } |
83 | 83 |
84 } // namespace | 84 } // namespace |
85 | 85 |
86 class TextDatabaseTest : public PlatformTest { | 86 class TextDatabaseTest : public PlatformTest { |
87 public: | 87 public: |
88 TextDatabaseTest() {} | 88 TextDatabaseTest() {} |
89 | 89 |
90 protected: | 90 protected: |
91 void SetUp() { | 91 virtual void SetUp() { |
92 PlatformTest::SetUp(); | 92 PlatformTest::SetUp(); |
93 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 93 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
94 } | 94 } |
95 | 95 |
96 // Create databases with this function, which will ensure that the files are | 96 // Create databases with this function, which will ensure that the files are |
97 // deleted on shutdown. Only open one database for each file. Returns NULL on | 97 // deleted on shutdown. Only open one database for each file. Returns NULL on |
98 // failure. | 98 // failure. |
99 // | 99 // |
100 // Set |delete_file| to delete any existing file. If we are trying to create | 100 // Set |delete_file| to delete any existing file. If we are trying to create |
101 // the file for the first time, we don't want a previous test left in a | 101 // the file for the first time, we don't want a previous test left in a |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 db->GetTextMatches("google", options, &results, &unique_urls); | 298 db->GetTextMatches("google", options, &results, &unique_urls); |
299 EXPECT_TRUE(unique_urls.empty()) << "Didn't ask for unique URLs"; | 299 EXPECT_TRUE(unique_urls.empty()) << "Didn't ask for unique URLs"; |
300 | 300 |
301 // There should be one result, the most recent one. | 301 // There should be one result, the most recent one. |
302 EXPECT_EQ(1U, results.size()); | 302 EXPECT_EQ(1U, results.size()); |
303 EXPECT_TRUE(ResultsHaveURL(results, kURL2)); | 303 EXPECT_TRUE(ResultsHaveURL(results, kURL2)); |
304 EXPECT_EQ(kTime2, results.back().time.ToInternalValue()); | 304 EXPECT_EQ(kTime2, results.back().time.ToInternalValue()); |
305 } | 305 } |
306 | 306 |
307 } // namespace history | 307 } // namespace history |
OLD | NEW |