| OLD | NEW |
| 1 // Copyright (c) 2011 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 "chrome/browser/browsing_data_database_helper.h" | 5 #include "chrome/browser/browsing_data_database_helper.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 typedef testing::Test CannedBrowsingDataDatabaseTest; | 13 typedef testing::Test CannedBrowsingDataDatabaseHelperTest; |
| 14 | 14 |
| 15 TEST_F(CannedBrowsingDataDatabaseTest, Empty) { | 15 TEST_F(CannedBrowsingDataDatabaseHelperTest, Empty) { |
| 16 TestingProfile profile; | 16 TestingProfile profile; |
| 17 | 17 |
| 18 const GURL origin("http://host1:1/"); | 18 const GURL origin("http://host1:1/"); |
| 19 const char db[] = "db1"; | 19 const char db[] = "db1"; |
| 20 | 20 |
| 21 scoped_refptr<CannedBrowsingDataDatabaseHelper> helper( | 21 scoped_refptr<CannedBrowsingDataDatabaseHelper> helper( |
| 22 new CannedBrowsingDataDatabaseHelper(&profile)); | 22 new CannedBrowsingDataDatabaseHelper(&profile)); |
| 23 | 23 |
| 24 ASSERT_TRUE(helper->empty()); | 24 ASSERT_TRUE(helper->empty()); |
| 25 helper->AddDatabase(origin, db, ""); | 25 helper->AddDatabase(origin, db, ""); |
| 26 ASSERT_FALSE(helper->empty()); | 26 ASSERT_FALSE(helper->empty()); |
| 27 helper->Reset(); | 27 helper->Reset(); |
| 28 ASSERT_TRUE(helper->empty()); | 28 ASSERT_TRUE(helper->empty()); |
| 29 } | 29 } |
| 30 | 30 |
| 31 TEST_F(CannedBrowsingDataDatabaseHelperTest, IgnoreExtensionsAndDevTools) { |
| 32 TestingProfile profile; |
| 33 |
| 34 const GURL origin1("chrome-extension://abcdefghijklmnopqrstuvwxyz/"); |
| 35 const GURL origin2("chrome-devtools://abcdefghijklmnopqrstuvwxyz/"); |
| 36 const char db[] = "db1"; |
| 37 |
| 38 scoped_refptr<CannedBrowsingDataDatabaseHelper> helper( |
| 39 new CannedBrowsingDataDatabaseHelper(&profile)); |
| 40 |
| 41 ASSERT_TRUE(helper->empty()); |
| 42 helper->AddDatabase(origin1, db, ""); |
| 43 ASSERT_TRUE(helper->empty()); |
| 44 helper->AddDatabase(origin2, db, ""); |
| 45 ASSERT_TRUE(helper->empty()); |
| 46 helper->Reset(); |
| 47 ASSERT_TRUE(helper->empty()); |
| 48 } |
| 49 |
| 31 } // namespace | 50 } // namespace |
| OLD | NEW |