| OLD | NEW |
| 1 // Copyright (c) 2012 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 "base/string16.h" | 5 #include "base/string16.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 10 #include "content/public/test/test_browser_thread.h" | 10 #include "content/public/test/test_browser_thread.h" |
| 11 #include "net/cookies/cookie_monster.h" | 11 #include "net/cookies/canonical_cookie.h" |
| 12 #include "net/cookies/cookie_options.h" |
| 12 #include "net/cookies/parsed_cookie.h" | 13 #include "net/cookies/parsed_cookie.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 15 | 16 |
| 16 using content::BrowserThread; | 17 using content::BrowserThread; |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 class MockSiteDataObserver | 21 class MockSiteDataObserver |
| 21 : public TabSpecificContentSettings::SiteDataObserver { | 22 : public TabSpecificContentSettings::SiteDataObserver { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 EXPECT_CALL(mock_observer, OnSiteDataAccessed()).Times(6); | 184 EXPECT_CALL(mock_observer, OnSiteDataAccessed()).Times(6); |
| 184 | 185 |
| 185 bool blocked_by_policy = false; | 186 bool blocked_by_policy = false; |
| 186 content_settings.OnCookieChanged(GURL("http://google.com"), | 187 content_settings.OnCookieChanged(GURL("http://google.com"), |
| 187 GURL("http://google.com"), | 188 GURL("http://google.com"), |
| 188 "A=B", | 189 "A=B", |
| 189 net::CookieOptions(), | 190 net::CookieOptions(), |
| 190 blocked_by_policy); | 191 blocked_by_policy); |
| 191 net::CookieList cookie_list; | 192 net::CookieList cookie_list; |
| 192 net::ParsedCookie parsed_cookie("CookieName=CookieValue"); | 193 net::ParsedCookie parsed_cookie("CookieName=CookieValue"); |
| 193 scoped_ptr<net::CookieMonster::CanonicalCookie> cookie( | 194 scoped_ptr<net::CanonicalCookie> cookie( |
| 194 net::CookieMonster::CanonicalCookie::Create(GURL("http://google.com"), | 195 net::CanonicalCookie::Create(GURL("http://google.com"), parsed_cookie)); |
| 195 parsed_cookie)); | |
| 196 cookie_list.push_back(*cookie); | 196 cookie_list.push_back(*cookie); |
| 197 content_settings.OnCookiesRead(GURL("http://google.com"), | 197 content_settings.OnCookiesRead(GURL("http://google.com"), |
| 198 GURL("http://google.com"), | 198 GURL("http://google.com"), |
| 199 cookie_list, | 199 cookie_list, |
| 200 blocked_by_policy); | 200 blocked_by_policy); |
| 201 content_settings.OnFileSystemAccessed(GURL("http://google.com"), | 201 content_settings.OnFileSystemAccessed(GURL("http://google.com"), |
| 202 blocked_by_policy); | 202 blocked_by_policy); |
| 203 content_settings.OnIndexedDBAccessed(GURL("http://google.com"), | 203 content_settings.OnIndexedDBAccessed(GURL("http://google.com"), |
| 204 UTF8ToUTF16("text"), | 204 UTF8ToUTF16("text"), |
| 205 blocked_by_policy); | 205 blocked_by_policy); |
| 206 content_settings.OnLocalStorageAccessed(GURL("http://google.com"), | 206 content_settings.OnLocalStorageAccessed(GURL("http://google.com"), |
| 207 true, | 207 true, |
| 208 blocked_by_policy); | 208 blocked_by_policy); |
| 209 content_settings.OnWebDatabaseAccessed(GURL("http://google.com"), | 209 content_settings.OnWebDatabaseAccessed(GURL("http://google.com"), |
| 210 UTF8ToUTF16("name"), | 210 UTF8ToUTF16("name"), |
| 211 UTF8ToUTF16("display_name"), | 211 UTF8ToUTF16("display_name"), |
| 212 blocked_by_policy); | 212 blocked_by_policy); |
| 213 } | 213 } |
| OLD | NEW |