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

Side by Side Diff: chrome/browser/extensions/api/content_settings/content_settings_apitest.cc

Issue 1312453005: Removed Profile::GetHostContentSettingsMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed redundant functions Created 5 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
OLDNEW
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/location.h" 5 #include "base/location.h"
6 #include "base/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/content_settings/cookie_settings_factory.h" 12 #include "chrome/browser/content_settings/cookie_settings_factory.h"
13 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
13 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h" 14 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h"
14 #include "chrome/browser/extensions/extension_apitest.h" 15 #include "chrome/browser/extensions/extension_apitest.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
17 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
18 #include "components/content_settings/core/browser/cookie_settings.h" 19 #include "components/content_settings/core/browser/cookie_settings.h"
19 #include "components/content_settings/core/browser/host_content_settings_map.h" 20 #include "components/content_settings/core/browser/host_content_settings_map.h"
20 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
21 #include "content/public/browser/plugin_service.h" 22 #include "content/public/browser/plugin_service.h"
22 #include "content/public/common/webplugininfo.h" 23 #include "content/public/common/webplugininfo.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 base::ThreadTaskRunnerHandle::Get()->PostTask( 63 base::ThreadTaskRunnerHandle::Get()->PostTask(
63 FROM_HERE, base::Bind(&ReleaseBrowserProcessModule)); 64 FROM_HERE, base::Bind(&ReleaseBrowserProcessModule));
64 content::RunAllPendingInMessageLoop(); 65 content::RunAllPendingInMessageLoop();
65 66
66 ExtensionApiTest::TearDownOnMainThread(); 67 ExtensionApiTest::TearDownOnMainThread();
67 } 68 }
68 69
69 protected: 70 protected:
70 void CheckContentSettingsSet() { 71 void CheckContentSettingsSet() {
71 HostContentSettingsMap* map = 72 HostContentSettingsMap* map =
72 profile_->GetHostContentSettingsMap(); 73 HostContentSettingsMapFactory::GetForProfile(profile_);
73 content_settings::CookieSettings* cookie_settings = 74 content_settings::CookieSettings* cookie_settings =
74 CookieSettingsFactory::GetForProfile(profile_).get(); 75 CookieSettingsFactory::GetForProfile(profile_).get();
75 76
76 // Check default content settings by using an unknown URL. 77 // Check default content settings by using an unknown URL.
77 GURL example_url("http://www.example.com"); 78 GURL example_url("http://www.example.com");
78 EXPECT_TRUE(cookie_settings->IsReadingCookieAllowed( 79 EXPECT_TRUE(cookie_settings->IsReadingCookieAllowed(
79 example_url, example_url)); 80 example_url, example_url));
80 EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed( 81 EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed(
81 example_url, example_url)); 82 example_url, example_url));
82 EXPECT_TRUE(cookie_settings->IsCookieSessionOnly(example_url)); 83 EXPECT_TRUE(cookie_settings->IsCookieSessionOnly(example_url));
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 map->GetContentSetting( 180 map->GetContentSetting(
180 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); 181 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
181 EXPECT_EQ(CONTENT_SETTING_BLOCK, 182 EXPECT_EQ(CONTENT_SETTING_BLOCK,
182 map->GetContentSetting( 183 map->GetContentSetting(
183 url, url, CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, 184 url, url, CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS,
184 std::string())); 185 std::string()));
185 } 186 }
186 187
187 void CheckContentSettingsDefault() { 188 void CheckContentSettingsDefault() {
188 HostContentSettingsMap* map = 189 HostContentSettingsMap* map =
189 profile_->GetHostContentSettingsMap(); 190 HostContentSettingsMapFactory::GetForProfile(profile_);
190 content_settings::CookieSettings* cookie_settings = 191 content_settings::CookieSettings* cookie_settings =
191 CookieSettingsFactory::GetForProfile(profile_).get(); 192 CookieSettingsFactory::GetForProfile(profile_).get();
192 193
193 // Check content settings for www.google.com 194 // Check content settings for www.google.com
194 GURL url("http://www.google.com"); 195 GURL url("http://www.google.com");
195 EXPECT_TRUE(cookie_settings->IsReadingCookieAllowed(url, url)); 196 EXPECT_TRUE(cookie_settings->IsReadingCookieAllowed(url, url));
196 EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed(url, url)); 197 EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed(url, url));
197 EXPECT_FALSE(cookie_settings->IsCookieSessionOnly(url)); 198 EXPECT_FALSE(cookie_settings->IsCookieSessionOnly(url));
198 EXPECT_EQ(CONTENT_SETTING_ALLOW, 199 EXPECT_EQ(CONTENT_SETTING_ALLOW,
199 map->GetContentSetting( 200 map->GetContentSetting(
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 << message_; 297 << message_;
297 } 298 }
298 299
299 IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest, 300 IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest,
300 UnsupportedDefaultSettings) { 301 UnsupportedDefaultSettings) {
301 const char kExtensionPath[] = "content_settings/unsupporteddefaultsettings"; 302 const char kExtensionPath[] = "content_settings/unsupporteddefaultsettings";
302 EXPECT_TRUE(RunExtensionSubtest(kExtensionPath, "test.html")) << message_; 303 EXPECT_TRUE(RunExtensionSubtest(kExtensionPath, "test.html")) << message_;
303 } 304 }
304 305
305 } // namespace extensions 306 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698