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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 virtual ~KeywordTableTest() {} | 27 virtual ~KeywordTableTest() {} |
28 | 28 |
29 protected: | 29 protected: |
30 virtual void SetUp() { | 30 virtual void SetUp() { |
31 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 31 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
32 file_ = temp_dir_.path().AppendASCII("TestWebDatabase"); | 32 file_ = temp_dir_.path().AppendASCII("TestWebDatabase"); |
33 | 33 |
34 table_.reset(new KeywordTable); | 34 table_.reset(new KeywordTable); |
35 db_.reset(new WebDatabase); | 35 db_.reset(new WebDatabase); |
36 db_->AddTable(table_.get()); | 36 db_->AddTable(table_.get()); |
37 ASSERT_EQ(sql::INIT_OK, db_->Init(file_, std::string())); | 37 ASSERT_EQ(sql::INIT_OK, db_->Init(file_)); |
38 } | 38 } |
39 | 39 |
40 base::FilePath file_; | 40 base::FilePath file_; |
41 base::ScopedTempDir temp_dir_; | 41 base::ScopedTempDir temp_dir_; |
42 scoped_ptr<KeywordTable> table_; | 42 scoped_ptr<KeywordTable> table_; |
43 scoped_ptr<WebDatabase> db_; | 43 scoped_ptr<WebDatabase> db_; |
44 | 44 |
45 private: | 45 private: |
46 DISALLOW_COPY_AND_ASSIGN(KeywordTableTest); | 46 DISALLOW_COPY_AND_ASSIGN(KeywordTableTest); |
47 }; | 47 }; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 sql::Statement s(table_->db_->GetUniqueStatement( | 296 sql::Statement s(table_->db_->GetUniqueStatement( |
297 "UPDATE keywords SET url=? WHERE id=?")); | 297 "UPDATE keywords SET url=? WHERE id=?")); |
298 s.BindString16(0, string16()); | 298 s.BindString16(0, string16()); |
299 s.BindInt64(1, 2000); | 299 s.BindInt64(1, 2000); |
300 EXPECT_TRUE(s.Run()); | 300 EXPECT_TRUE(s.Run()); |
301 | 301 |
302 // GetKeywords() should erase the entry with the empty URL field. | 302 // GetKeywords() should erase the entry with the empty URL field. |
303 EXPECT_TRUE(table_->GetKeywords(&keywords)); | 303 EXPECT_TRUE(table_->GetKeywords(&keywords)); |
304 EXPECT_EQ(1U, keywords.size()); | 304 EXPECT_EQ(1U, keywords.size()); |
305 } | 305 } |
OLD | NEW |