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

Side by Side Diff: chrome/browser/browsing_data_indexed_db_helper_browsertest.cc

Issue 7692016: Delete indexedDBs from the cookie tree ui. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
OLDNEW
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 10 matching lines...) Expand all
21 typedef BrowsingDataHelperCallback<BrowsingDataIndexedDBHelper::IndexedDBInfo> 21 typedef BrowsingDataHelperCallback<BrowsingDataIndexedDBHelper::IndexedDBInfo>
22 TestCompletionCallback; 22 TestCompletionCallback;
23 23
24 class BrowsingDataIndexedDBHelperTest : public InProcessBrowserTest { 24 class BrowsingDataIndexedDBHelperTest : public InProcessBrowserTest {
25 }; 25 };
26 26
27 IN_PROC_BROWSER_TEST_F(BrowsingDataIndexedDBHelperTest, CannedAddIndexedDB) { 27 IN_PROC_BROWSER_TEST_F(BrowsingDataIndexedDBHelperTest, CannedAddIndexedDB) {
28 const GURL origin1("http://host1:1/"); 28 const GURL origin1("http://host1:1/");
29 const GURL origin2("http://host2:1/"); 29 const GURL origin2("http://host2:1/");
30 const string16 description(ASCIIToUTF16("description")); 30 const string16 description(ASCIIToUTF16("description"));
31 const FilePath::CharType file1[] =
32 FILE_PATH_LITERAL("http_host1_1.indexeddb.leveldb");
33 const FilePath::CharType file2[] =
34 FILE_PATH_LITERAL("http_host2_1.indexeddb.leveldb");
35 31
36 scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper( 32 scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper(
37 new CannedBrowsingDataIndexedDBHelper(browser()->profile())); 33 new CannedBrowsingDataIndexedDBHelper());
38 helper->AddIndexedDB(origin1, description); 34 helper->AddIndexedDB(origin1, description);
39 helper->AddIndexedDB(origin2, description); 35 helper->AddIndexedDB(origin2, description);
40 36
41 TestCompletionCallback callback; 37 TestCompletionCallback callback;
42 helper->StartFetching( 38 helper->StartFetching(
43 NewCallback(&callback, &TestCompletionCallback::callback)); 39 NewCallback(&callback, &TestCompletionCallback::callback));
44 40
45 std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo> result = 41 std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo> result =
46 callback.result(); 42 callback.result();
47 43
48 ASSERT_EQ(2U, result.size()); 44 ASSERT_EQ(2U, result.size());
49 std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo>::iterator info = 45 std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo>::iterator info =
50 result.begin(); 46 result.begin();
51 EXPECT_EQ(FilePath(file1).value(), info->file_path.BaseName().value()); 47 EXPECT_EQ(origin1, info->origin);
52 info++; 48 info++;
53 EXPECT_EQ(FilePath(file2).value(), info->file_path.BaseName().value()); 49 EXPECT_EQ(origin2, info->origin);
54 } 50 }
55 51
56 IN_PROC_BROWSER_TEST_F(BrowsingDataIndexedDBHelperTest, CannedUnique) { 52 IN_PROC_BROWSER_TEST_F(BrowsingDataIndexedDBHelperTest, CannedUnique) {
57 const GURL origin("http://host1:1/"); 53 const GURL origin("http://host1:1/");
58 const string16 description(ASCIIToUTF16("description")); 54 const string16 description(ASCIIToUTF16("description"));
59 const FilePath::CharType file[] =
60 FILE_PATH_LITERAL("http_host1_1.indexeddb.leveldb");
61 55
62 scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper( 56 scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper(
63 new CannedBrowsingDataIndexedDBHelper(browser()->profile())); 57 new CannedBrowsingDataIndexedDBHelper());
64 helper->AddIndexedDB(origin, description); 58 helper->AddIndexedDB(origin, description);
65 helper->AddIndexedDB(origin, description); 59 helper->AddIndexedDB(origin, description);
66 60
67 TestCompletionCallback callback; 61 TestCompletionCallback callback;
68 helper->StartFetching( 62 helper->StartFetching(
69 NewCallback(&callback, &TestCompletionCallback::callback)); 63 NewCallback(&callback, &TestCompletionCallback::callback));
70 64
71 std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo> result = 65 std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo> result =
72 callback.result(); 66 callback.result();
73 67
74 ASSERT_EQ(1U, result.size()); 68 ASSERT_EQ(1U, result.size());
75 EXPECT_EQ(FilePath(file).value(), 69 EXPECT_EQ(origin, result.begin()->origin);
76 result.begin()->file_path.BaseName().value());
77 } 70 }
78 } // namespace 71 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_indexed_db_helper.cc ('k') | chrome/browser/browsing_data_indexed_db_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698