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/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper( | 36 scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper( |
37 new CannedBrowsingDataIndexedDBHelper(browser()->profile())); | 37 new CannedBrowsingDataIndexedDBHelper(browser()->profile())); |
38 helper->AddIndexedDB(origin1, description); | 38 helper->AddIndexedDB(origin1, description); |
39 helper->AddIndexedDB(origin2, description); | 39 helper->AddIndexedDB(origin2, description); |
40 | 40 |
41 TestCompletionCallback callback; | 41 TestCompletionCallback callback; |
42 helper->StartFetching( | 42 helper->StartFetching( |
43 NewCallback(&callback, &TestCompletionCallback::callback)); | 43 NewCallback(&callback, &TestCompletionCallback::callback)); |
44 | 44 |
45 std::vector<BrowsingDataIndexedDBHelper::IndexedDBInfo> result = | 45 std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo> result = |
46 callback.result(); | 46 callback.result(); |
47 | 47 |
48 ASSERT_EQ(2U, result.size()); | 48 ASSERT_EQ(2U, result.size()); |
49 EXPECT_EQ(FilePath(file1).value(), result[0].file_path.BaseName().value()); | 49 std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo>::iterator info = |
50 EXPECT_EQ(FilePath(file2).value(), result[1].file_path.BaseName().value()); | 50 result.begin(); |
| 51 EXPECT_EQ(FilePath(file1).value(), info->file_path.BaseName().value()); |
| 52 info++; |
| 53 EXPECT_EQ(FilePath(file2).value(), info->file_path.BaseName().value()); |
51 } | 54 } |
52 | 55 |
53 IN_PROC_BROWSER_TEST_F(BrowsingDataIndexedDBHelperTest, CannedUnique) { | 56 IN_PROC_BROWSER_TEST_F(BrowsingDataIndexedDBHelperTest, CannedUnique) { |
54 const GURL origin("http://host1:1/"); | 57 const GURL origin("http://host1:1/"); |
55 const string16 description(ASCIIToUTF16("description")); | 58 const string16 description(ASCIIToUTF16("description")); |
56 const FilePath::CharType file[] = | 59 const FilePath::CharType file[] = |
57 FILE_PATH_LITERAL("http_host1_1.indexeddb.leveldb"); | 60 FILE_PATH_LITERAL("http_host1_1.indexeddb.leveldb"); |
58 | 61 |
59 scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper( | 62 scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper( |
60 new CannedBrowsingDataIndexedDBHelper(browser()->profile())); | 63 new CannedBrowsingDataIndexedDBHelper(browser()->profile())); |
61 helper->AddIndexedDB(origin, description); | 64 helper->AddIndexedDB(origin, description); |
62 helper->AddIndexedDB(origin, description); | 65 helper->AddIndexedDB(origin, description); |
63 | 66 |
64 TestCompletionCallback callback; | 67 TestCompletionCallback callback; |
65 helper->StartFetching( | 68 helper->StartFetching( |
66 NewCallback(&callback, &TestCompletionCallback::callback)); | 69 NewCallback(&callback, &TestCompletionCallback::callback)); |
67 | 70 |
68 std::vector<BrowsingDataIndexedDBHelper::IndexedDBInfo> result = | 71 std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo> result = |
69 callback.result(); | 72 callback.result(); |
70 | 73 |
71 ASSERT_EQ(1U, result.size()); | 74 ASSERT_EQ(1U, result.size()); |
72 EXPECT_EQ(FilePath(file).value(), result[0].file_path.BaseName().value()); | 75 EXPECT_EQ(FilePath(file).value(), |
| 76 result.begin()->file_path.BaseName().value()); |
73 } | 77 } |
74 } // namespace | 78 } // namespace |
OLD | NEW |