OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/browsing_data_database_helper.h" | |
6 | |
7 #include "base/file_util.h" | |
8 #include "base/message_loop.h" | |
9 #include "chrome/test/base/testing_profile.h" | |
10 #include "content/public/test/test_browser_thread.h" | |
11 #include "testing/gtest/include/gtest/gtest.h" | |
12 | |
13 using content::BrowserThread; | |
14 | |
15 namespace { | |
16 | |
17 class CannedBrowsingDataDatabaseHelperTest : public testing::Test { | |
18 public: | |
19 CannedBrowsingDataDatabaseHelperTest() | |
20 : ui_thread_(BrowserThread::UI, &message_loop_) { | |
21 } | |
22 | |
23 protected: | |
24 MessageLoop message_loop_; | |
25 content::TestBrowserThread ui_thread_; | |
26 }; | |
27 | |
28 TEST_F(CannedBrowsingDataDatabaseHelperTest, Empty) { | |
29 TestingProfile profile; | |
30 | |
31 const GURL origin("http://host1:1/"); | |
32 const char db[] = "db1"; | |
33 | |
34 scoped_refptr<CannedBrowsingDataDatabaseHelper> helper( | |
35 new CannedBrowsingDataDatabaseHelper(&profile)); | |
36 | |
37 ASSERT_TRUE(helper->empty()); | |
38 helper->AddDatabase(origin, db, ""); | |
39 ASSERT_FALSE(helper->empty()); | |
40 helper->Reset(); | |
41 ASSERT_TRUE(helper->empty()); | |
42 } | |
43 | |
44 TEST_F(CannedBrowsingDataDatabaseHelperTest, IgnoreExtensionsAndDevTools) { | |
45 TestingProfile profile; | |
46 | |
47 const GURL origin1("chrome-extension://abcdefghijklmnopqrstuvwxyz/"); | |
48 const GURL origin2("chrome-devtools://abcdefghijklmnopqrstuvwxyz/"); | |
49 const char db[] = "db1"; | |
50 | |
51 scoped_refptr<CannedBrowsingDataDatabaseHelper> helper( | |
52 new CannedBrowsingDataDatabaseHelper(&profile)); | |
53 | |
54 ASSERT_TRUE(helper->empty()); | |
55 helper->AddDatabase(origin1, db, ""); | |
56 ASSERT_TRUE(helper->empty()); | |
57 helper->AddDatabase(origin2, db, ""); | |
58 ASSERT_TRUE(helper->empty()); | |
59 helper->Reset(); | |
60 ASSERT_TRUE(helper->empty()); | |
61 } | |
62 | |
63 } // namespace | |
OLD | NEW |