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

Side by Side Diff: chrome/browser/content_settings/content_settings_browsertest.cc

Issue 7713034: HostContentSettingsMap refactoring. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Code review comments. Created 9 years, 3 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 "base/stringprintf.h" 5 #include "base/stringprintf.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/content_settings/cookie_settings.h"
8 #include "chrome/browser/content_settings/cookie_settings_factory.h"
7 #include "chrome/browser/content_settings/host_content_settings_map.h" 9 #include "chrome/browser/content_settings/host_content_settings_map.h"
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
9 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
12 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
13 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
14 #include "net/test/test_server.h" 16 #include "net/test/test_server.h"
15 17
16 // Regression test for http://crbug.com/63649. 18 // Regression test for http://crbug.com/63649.
17 IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, RedirectLoopCookies) { 19 IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, RedirectLoopCookies) {
18 ASSERT_TRUE(test_server()->Start()); 20 ASSERT_TRUE(test_server()->Start());
19 21
20 GURL test_url = test_server()->GetURL("files/redirect-loop.html"); 22 GURL test_url = test_server()->GetURL("files/redirect-loop.html");
21 23
22 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( 24 CookieSettingsFactory::GetForProfile(browser()->profile())->
23 CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_BLOCK); 25 SetDefaultSetting(CONTENT_SETTING_BLOCK);
24 26
25 ui_test_utils::NavigateToURL(browser(), test_url); 27 ui_test_utils::NavigateToURL(browser(), test_url);
26 28
27 TabContentsWrapper* tab_contents = browser()->GetSelectedTabContentsWrapper(); 29 TabContentsWrapper* tab_contents = browser()->GetSelectedTabContentsWrapper();
28 ASSERT_EQ(UTF8ToUTF16(test_url.spec() + " failed to load"), 30 ASSERT_EQ(UTF8ToUTF16(test_url.spec() + " failed to load"),
29 tab_contents->tab_contents()->GetTitle()); 31 tab_contents->tab_contents()->GetTitle());
30 32
31 EXPECT_TRUE(tab_contents->content_settings()->IsContentBlocked( 33 EXPECT_TRUE(tab_contents->content_settings()->IsContentBlocked(
32 CONTENT_SETTINGS_TYPE_COOKIES)); 34 CONTENT_SETTINGS_TYPE_COOKIES));
33 } 35 }
(...skipping 29 matching lines...) Expand all
63 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( 65 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
64 CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_BLOCK); 66 CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_BLOCK);
65 67
66 ui_test_utils::NavigateToURL(browser(), test_url); 68 ui_test_utils::NavigateToURL(browser(), test_url);
67 69
68 TabContentsWrapper* tab_contents = browser()->GetSelectedTabContentsWrapper(); 70 TabContentsWrapper* tab_contents = browser()->GetSelectedTabContentsWrapper();
69 71
70 EXPECT_TRUE(tab_contents->content_settings()->IsContentBlocked( 72 EXPECT_TRUE(tab_contents->content_settings()->IsContentBlocked(
71 CONTENT_SETTINGS_TYPE_COOKIES)); 73 CONTENT_SETTINGS_TYPE_COOKIES));
72 } 74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698