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

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

Issue 27635002: Content settings for <audio> and <video>. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test fix. Created 6 years, 5 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/auto_reset.h" 5 #include "base/auto_reset.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 host_content_settings_map->GetContentSetting( 479 host_content_settings_map->GetContentSetting(
480 host_ending_with_dot, 480 host_ending_with_dot,
481 host_ending_with_dot, 481 host_ending_with_dot,
482 CONTENT_SETTINGS_TYPE_JAVASCRIPT, 482 CONTENT_SETTINGS_TYPE_JAVASCRIPT,
483 std::string())); 483 std::string()));
484 484
485 EXPECT_EQ(CONTENT_SETTING_ALLOW, 485 EXPECT_EQ(CONTENT_SETTING_ALLOW,
486 host_content_settings_map->GetContentSetting( 486 host_content_settings_map->GetContentSetting(
487 host_ending_with_dot, 487 host_ending_with_dot,
488 host_ending_with_dot, 488 host_ending_with_dot,
489 CONTENT_SETTINGS_TYPE_MEDIA,
490 std::string()));
491 host_content_settings_map->SetContentSetting(
492 pattern,
493 ContentSettingsPattern::Wildcard(),
494 CONTENT_SETTINGS_TYPE_MEDIA,
495 std::string(),
496 CONTENT_SETTING_DEFAULT);
497 EXPECT_EQ(
498 CONTENT_SETTING_ALLOW,
499 host_content_settings_map->GetContentSetting(host_ending_with_dot,
500 host_ending_with_dot,
501 CONTENT_SETTINGS_TYPE_MEDIA,
502 std::string()));
503 host_content_settings_map->SetContentSetting(
504 pattern,
505 ContentSettingsPattern::Wildcard(),
506 CONTENT_SETTINGS_TYPE_MEDIA,
507 std::string(),
508 CONTENT_SETTING_BLOCK);
509 EXPECT_EQ(
510 CONTENT_SETTING_BLOCK,
511 host_content_settings_map->GetContentSetting(host_ending_with_dot,
512 host_ending_with_dot,
513 CONTENT_SETTINGS_TYPE_MEDIA,
514 std::string()));
515
516 EXPECT_EQ(CONTENT_SETTING_ALLOW,
517 host_content_settings_map->GetContentSetting(
518 host_ending_with_dot,
519 host_ending_with_dot,
489 CONTENT_SETTINGS_TYPE_PLUGINS, 520 CONTENT_SETTINGS_TYPE_PLUGINS,
490 std::string())); 521 std::string()));
491 host_content_settings_map->SetContentSetting( 522 host_content_settings_map->SetContentSetting(
492 pattern, 523 pattern,
493 ContentSettingsPattern::Wildcard(), 524 ContentSettingsPattern::Wildcard(),
494 CONTENT_SETTINGS_TYPE_PLUGINS, 525 CONTENT_SETTINGS_TYPE_PLUGINS,
495 std::string(), 526 std::string(),
496 CONTENT_SETTING_DEFAULT); 527 CONTENT_SETTING_DEFAULT);
497 EXPECT_EQ(CONTENT_SETTING_ALLOW, 528 EXPECT_EQ(CONTENT_SETTING_ALLOW,
498 host_content_settings_map->GetContentSetting( 529 host_content_settings_map->GetContentSetting(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 HostContentSettingsMap* host_content_settings_map = 581 HostContentSettingsMap* host_content_settings_map =
551 profile.GetHostContentSettingsMap(); 582 profile.GetHostContentSettingsMap();
552 583
553 GURL host("http://a.b.example.com/"); 584 GURL host("http://a.b.example.com/");
554 ContentSettingsPattern pattern1 = 585 ContentSettingsPattern pattern1 =
555 ContentSettingsPattern::FromString("[*.]example.com"); 586 ContentSettingsPattern::FromString("[*.]example.com");
556 ContentSettingsPattern pattern2 = 587 ContentSettingsPattern pattern2 =
557 ContentSettingsPattern::FromString("[*.]b.example.com"); 588 ContentSettingsPattern::FromString("[*.]b.example.com");
558 ContentSettingsPattern pattern3 = 589 ContentSettingsPattern pattern3 =
559 ContentSettingsPattern::FromString("a.b.example.com"); 590 ContentSettingsPattern::FromString("a.b.example.com");
591 ContentSettingsPattern pattern4 =
592 ContentSettingsPattern::FromString("[*.]c.a.b.example.com");
560 593
561 host_content_settings_map->SetContentSetting( 594 host_content_settings_map->SetContentSetting(
562 pattern1, 595 pattern1,
563 ContentSettingsPattern::Wildcard(), 596 ContentSettingsPattern::Wildcard(),
564 CONTENT_SETTINGS_TYPE_IMAGES, 597 CONTENT_SETTINGS_TYPE_IMAGES,
565 std::string(), 598 std::string(),
566 CONTENT_SETTING_BLOCK); 599 CONTENT_SETTING_BLOCK);
567 600
568 host_content_settings_map->SetContentSetting( 601 host_content_settings_map->SetContentSetting(
569 pattern2, 602 pattern2,
570 ContentSettingsPattern::Wildcard(), 603 ContentSettingsPattern::Wildcard(),
571 CONTENT_SETTINGS_TYPE_COOKIES, 604 CONTENT_SETTINGS_TYPE_COOKIES,
572 std::string(), 605 std::string(),
573 CONTENT_SETTING_BLOCK); 606 CONTENT_SETTING_BLOCK);
574 607
575 host_content_settings_map->SetContentSetting( 608 host_content_settings_map->SetContentSetting(
576 pattern3, 609 pattern3,
577 ContentSettingsPattern::Wildcard(), 610 ContentSettingsPattern::Wildcard(),
578 CONTENT_SETTINGS_TYPE_PLUGINS, 611 CONTENT_SETTINGS_TYPE_PLUGINS,
579 std::string(), 612 std::string(),
580 CONTENT_SETTING_BLOCK); 613 CONTENT_SETTING_BLOCK);
581 host_content_settings_map->SetDefaultContentSetting( 614 host_content_settings_map->SetDefaultContentSetting(
582 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); 615 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK);
583 616
617 host_content_settings_map->SetDefaultContentSetting(
618 CONTENT_SETTINGS_TYPE_MEDIA, CONTENT_SETTING_BLOCK);
619 host_content_settings_map->SetContentSetting(
620 pattern4,
621 ContentSettingsPattern::Wildcard(),
622 CONTENT_SETTINGS_TYPE_MEDIA,
623 std::string(),
624 CONTENT_SETTING_ALLOW);
625
584 EXPECT_EQ(CONTENT_SETTING_BLOCK, 626 EXPECT_EQ(CONTENT_SETTING_BLOCK,
585 host_content_settings_map->GetContentSetting( 627 host_content_settings_map->GetContentSetting(
586 host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string())); 628 host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
587 EXPECT_EQ(CONTENT_SETTING_BLOCK, 629 EXPECT_EQ(CONTENT_SETTING_BLOCK,
588 host_content_settings_map->GetContentSetting( 630 host_content_settings_map->GetContentSetting(
589 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); 631 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
590 EXPECT_EQ(CONTENT_SETTING_BLOCK, 632 EXPECT_EQ(CONTENT_SETTING_BLOCK,
591 host_content_settings_map->GetContentSetting( 633 host_content_settings_map->GetContentSetting(
592 host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); 634 host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
593 EXPECT_EQ(CONTENT_SETTING_BLOCK, 635 EXPECT_EQ(CONTENT_SETTING_BLOCK,
594 host_content_settings_map->GetContentSetting( 636 host_content_settings_map->GetContentSetting(
637 host, host, CONTENT_SETTINGS_TYPE_MEDIA, std::string()));
638 EXPECT_EQ(CONTENT_SETTING_BLOCK,
639 host_content_settings_map->GetContentSetting(
595 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); 640 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string()));
596 EXPECT_EQ(CONTENT_SETTING_BLOCK, 641 EXPECT_EQ(CONTENT_SETTING_BLOCK,
597 host_content_settings_map->GetContentSetting( 642 host_content_settings_map->GetContentSetting(
598 host, host, CONTENT_SETTINGS_TYPE_POPUPS, std::string())); 643 host, host, CONTENT_SETTINGS_TYPE_POPUPS, std::string()));
599 EXPECT_EQ(CONTENT_SETTING_ASK, 644 EXPECT_EQ(CONTENT_SETTING_ASK,
600 host_content_settings_map->GetContentSetting( 645 host_content_settings_map->GetContentSetting(
601 host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string())); 646 host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
602 EXPECT_EQ( 647 EXPECT_EQ(
603 CONTENT_SETTING_ASK, 648 CONTENT_SETTING_ASK,
604 host_content_settings_map->GetContentSetting( 649 host_content_settings_map->GetContentSetting(
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 GURL("http://other.com"), 1020 GURL("http://other.com"),
976 CONTENT_SETTINGS_TYPE_COOKIES, 1021 CONTENT_SETTINGS_TYPE_COOKIES,
977 std::string())); 1022 std::string()));
978 EXPECT_EQ(CONTENT_SETTING_SESSION_ONLY, 1023 EXPECT_EQ(CONTENT_SETTING_SESSION_ONLY,
979 host_content_settings_map->GetContentSetting( 1024 host_content_settings_map->GetContentSetting(
980 GURL("http://third.com"), 1025 GURL("http://third.com"),
981 GURL("http://third.com"), 1026 GURL("http://third.com"),
982 CONTENT_SETTINGS_TYPE_COOKIES, 1027 CONTENT_SETTINGS_TYPE_COOKIES,
983 std::string())); 1028 std::string()));
984 } 1029 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698