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 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "chrome/browser/media_gallery/media_gallery_database.h" | 9 #include "chrome/browser/media_gallery/media_gallery_database.h" |
10 #include "chrome/browser/media_gallery/media_gallery_database_types.h" | 10 #include "chrome/browser/media_gallery/media_gallery_database_types.h" |
11 #include "sql/connection.h" | 11 #include "sql/connection.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace chrome { | 14 namespace chrome { |
15 | 15 |
16 class MediaGalleryDatabaseTest : public testing::Test, | 16 class MediaGalleryDatabaseTest : public testing::Test, |
17 public MediaGalleryDatabase { | 17 public MediaGalleryDatabase { |
18 public: | 18 public: |
(...skipping 13 matching lines...) Expand all Loading... |
32 ASSERT_TRUE(db_.Open(db_file)); | 32 ASSERT_TRUE(db_.Open(db_file)); |
33 | 33 |
34 // Initialize the tables for this test. | 34 // Initialize the tables for this test. |
35 ASSERT_EQ(sql::INIT_OK, InitInternal(&db_)); | 35 ASSERT_EQ(sql::INIT_OK, InitInternal(&db_)); |
36 } | 36 } |
37 | 37 |
38 void TearDown() { | 38 void TearDown() { |
39 db_.Close(); | 39 db_.Close(); |
40 } | 40 } |
41 | 41 |
42 ScopedTempDir temp_dir_; | 42 base::ScopedTempDir temp_dir_; |
43 sql::Connection db_; | 43 sql::Connection db_; |
44 }; | 44 }; |
45 | 45 |
46 TEST_F(MediaGalleryDatabaseTest, Init) { | 46 TEST_F(MediaGalleryDatabaseTest, Init) { |
47 EXPECT_TRUE(DoesCollectionsTableExist(&GetDB())); | 47 EXPECT_TRUE(DoesCollectionsTableExist(&GetDB())); |
48 } | 48 } |
49 | 49 |
50 TEST_F(MediaGalleryDatabaseTest, AddCollection) { | 50 TEST_F(MediaGalleryDatabaseTest, AddCollection) { |
51 CollectionRow row1(FilePath(FILE_PATH_LITERAL("path1")), | 51 CollectionRow row1(FilePath(FILE_PATH_LITERAL("path1")), |
52 base::Time::FromDoubleT(12345), | 52 base::Time::FromDoubleT(12345), |
(...skipping 16 matching lines...) Expand all Loading... |
69 false); | 69 false); |
70 CollectionId rowid = CreateCollectionRow(&row1); | 70 CollectionId rowid = CreateCollectionRow(&row1); |
71 EXPECT_EQ(rowid, row1.id); | 71 EXPECT_EQ(rowid, row1.id); |
72 | 72 |
73 CollectionRow row2; | 73 CollectionRow row2; |
74 EXPECT_TRUE(GetCollectionRow(rowid, &row2)); | 74 EXPECT_TRUE(GetCollectionRow(rowid, &row2)); |
75 EXPECT_EQ(FILE_PATH_LITERAL("path1/path2"), row2.path.value()); | 75 EXPECT_EQ(FILE_PATH_LITERAL("path1/path2"), row2.path.value()); |
76 } | 76 } |
77 | 77 |
78 } // namespace chrome | 78 } // namespace chrome |
OLD | NEW |