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.
5 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
7 #include "chrome/test/base/testing_profile.h"
8 #include "content/public/test/test_browser_thread_bundle.h"
9 #include "testing/gtest/include/gtest/gtest.h"
13 class CannedBrowsingDataLocalStorageTest : public testing::Test {
14 content::TestBrowserThreadBundle thread_bundle_;
17 TEST_F(CannedBrowsingDataLocalStorageTest, Empty) {
18 TestingProfile profile;
20 const GURL origin("http://host1:1/");
22 scoped_refptr<CannedBrowsingDataLocalStorageHelper> helper(
23 new CannedBrowsingDataLocalStorageHelper(&profile));
25 ASSERT_TRUE(helper->empty());
26 helper->AddLocalStorage(origin);
27 ASSERT_FALSE(helper->empty());
29 ASSERT_TRUE(helper->empty());
32 TEST_F(CannedBrowsingDataLocalStorageTest, IgnoreExtensionsAndDevTools) {
33 TestingProfile profile;
35 const GURL origin1("chrome-extension://abcdefghijklmnopqrstuvwxyz/");
36 const GURL origin2("chrome-devtools://abcdefghijklmnopqrstuvwxyz/");
38 scoped_refptr<CannedBrowsingDataLocalStorageHelper> helper(
39 new CannedBrowsingDataLocalStorageHelper(&profile));
41 ASSERT_TRUE(helper->empty());
42 helper->AddLocalStorage(origin1);
43 ASSERT_TRUE(helper->empty());
44 helper->AddLocalStorage(origin2);
45 ASSERT_TRUE(helper->empty());