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

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

Issue 2655443003: Unify the "get" and "set" cookie access settings. (Closed)
Patch Set: rebase Created 3 years, 11 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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 7
8 #include "base/auto_reset.h" 8 #include "base/auto_reset.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 469
470 TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { 470 TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) {
471 TestingProfile profile; 471 TestingProfile profile;
472 HostContentSettingsMap* host_content_settings_map = 472 HostContentSettingsMap* host_content_settings_map =
473 HostContentSettingsMapFactory::GetForProfile(&profile); 473 HostContentSettingsMapFactory::GetForProfile(&profile);
474 content_settings::CookieSettings* cookie_settings = 474 content_settings::CookieSettings* cookie_settings =
475 CookieSettingsFactory::GetForProfile(&profile).get(); 475 CookieSettingsFactory::GetForProfile(&profile).get();
476 476
477 GURL host_ending_with_dot("http://example.com./"); 477 GURL host_ending_with_dot("http://example.com./");
478 478
479 EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed( 479 EXPECT_TRUE(cookie_settings->IsCookieAccessAllowed(host_ending_with_dot,
480 host_ending_with_dot, host_ending_with_dot)); 480 host_ending_with_dot));
481 host_content_settings_map->SetContentSettingDefaultScope( 481 host_content_settings_map->SetContentSettingDefaultScope(
482 host_ending_with_dot, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, 482 host_ending_with_dot, GURL(), CONTENT_SETTINGS_TYPE_COOKIES,
483 std::string(), CONTENT_SETTING_DEFAULT); 483 std::string(), CONTENT_SETTING_DEFAULT);
484 EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed( 484 EXPECT_TRUE(cookie_settings->IsCookieAccessAllowed(host_ending_with_dot,
485 host_ending_with_dot, host_ending_with_dot)); 485 host_ending_with_dot));
486 host_content_settings_map->SetContentSettingDefaultScope( 486 host_content_settings_map->SetContentSettingDefaultScope(
487 host_ending_with_dot, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, 487 host_ending_with_dot, GURL(), CONTENT_SETTINGS_TYPE_COOKIES,
488 std::string(), CONTENT_SETTING_BLOCK); 488 std::string(), CONTENT_SETTING_BLOCK);
489 EXPECT_FALSE(cookie_settings->IsSettingCookieAllowed( 489 EXPECT_FALSE(cookie_settings->IsCookieAccessAllowed(host_ending_with_dot,
490 host_ending_with_dot, host_ending_with_dot)); 490 host_ending_with_dot));
491 491
492 EXPECT_EQ(CONTENT_SETTING_ALLOW, 492 EXPECT_EQ(CONTENT_SETTING_ALLOW,
493 host_content_settings_map->GetContentSetting( 493 host_content_settings_map->GetContentSetting(
494 host_ending_with_dot, 494 host_ending_with_dot,
495 host_ending_with_dot, 495 host_ending_with_dot,
496 CONTENT_SETTINGS_TYPE_JAVASCRIPT, 496 CONTENT_SETTINGS_TYPE_JAVASCRIPT,
497 std::string())); 497 std::string()));
498 host_content_settings_map->SetContentSettingDefaultScope( 498 host_content_settings_map->SetContentSettingDefaultScope(
499 host_ending_with_dot, GURL(), CONTENT_SETTINGS_TYPE_JAVASCRIPT, 499 host_ending_with_dot, GURL(), CONTENT_SETTINGS_TYPE_JAVASCRIPT,
500 std::string(), CONTENT_SETTING_DEFAULT); 500 std::string(), CONTENT_SETTING_DEFAULT);
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1750 EXPECT_TRUE(map->CanSetNarrowestContentSetting( 1750 EXPECT_TRUE(map->CanSetNarrowestContentSetting(
1751 valid_url, valid_url, 1751 valid_url, valid_url,
1752 CONTENT_SETTINGS_TYPE_POPUPS)); 1752 CONTENT_SETTINGS_TYPE_POPUPS));
1753 1753
1754 GURL invalid_url("about:blank"); 1754 GURL invalid_url("about:blank");
1755 EXPECT_FALSE(map->CanSetNarrowestContentSetting( 1755 EXPECT_FALSE(map->CanSetNarrowestContentSetting(
1756 invalid_url, invalid_url, 1756 invalid_url, invalid_url,
1757 CONTENT_SETTINGS_TYPE_POPUPS)); 1757 CONTENT_SETTINGS_TYPE_POPUPS));
1758 } 1758 }
1759 1759
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698