OLD | NEW |
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/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.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/content_settings/content_settings_details.h" | 10 #include "chrome/browser/content_settings/content_settings_details.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK); | 50 CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK); |
51 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 51 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
52 host_content_settings_map->GetDefaultContentSetting( | 52 host_content_settings_map->GetDefaultContentSetting( |
53 CONTENT_SETTINGS_TYPE_IMAGES, NULL)); | 53 CONTENT_SETTINGS_TYPE_IMAGES, NULL)); |
54 EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( | 54 EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( |
55 GURL(chrome::kChromeUINewTabURL), | 55 GURL(chrome::kChromeUINewTabURL), |
56 GURL(chrome::kChromeUINewTabURL), | 56 GURL(chrome::kChromeUINewTabURL), |
57 CONTENT_SETTINGS_TYPE_IMAGES, | 57 CONTENT_SETTINGS_TYPE_IMAGES, |
58 std::string())); | 58 std::string())); |
59 { | 59 { |
60 // Click-to-play needs to be enabled to set the content setting to ASK. | |
61 CommandLine* cmd = CommandLine::ForCurrentProcess(); | |
62 AutoReset<CommandLine> auto_reset(cmd, *cmd); | |
63 cmd->AppendSwitch(switches::kEnableClickToPlay); | |
64 | |
65 host_content_settings_map->SetDefaultContentSetting( | 60 host_content_settings_map->SetDefaultContentSetting( |
66 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ASK); | 61 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ASK); |
67 EXPECT_EQ(CONTENT_SETTING_ASK, | 62 EXPECT_EQ(CONTENT_SETTING_ASK, |
68 host_content_settings_map->GetDefaultContentSetting( | 63 host_content_settings_map->GetDefaultContentSetting( |
69 CONTENT_SETTINGS_TYPE_PLUGINS, NULL)); | 64 CONTENT_SETTINGS_TYPE_PLUGINS, NULL)); |
70 } | 65 } |
71 host_content_settings_map->SetDefaultContentSetting( | 66 host_content_settings_map->SetDefaultContentSetting( |
72 CONTENT_SETTINGS_TYPE_POPUPS, CONTENT_SETTING_ALLOW); | 67 CONTENT_SETTINGS_TYPE_POPUPS, CONTENT_SETTING_ALLOW); |
73 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 68 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
74 host_content_settings_map->GetDefaultContentSetting( | 69 host_content_settings_map->GetDefaultContentSetting( |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 CONTENT_SETTINGS_TYPE_IMAGES, | 1050 CONTENT_SETTINGS_TYPE_IMAGES, |
1056 std::string(), | 1051 std::string(), |
1057 CONTENT_SETTING_BLOCK); | 1052 CONTENT_SETTING_BLOCK); |
1058 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 1053 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
1059 host_content_settings_map->GetContentSetting( | 1054 host_content_settings_map->GetContentSetting( |
1060 host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); | 1055 host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); |
1061 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1056 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
1062 host_content_settings_map->GetContentSetting( | 1057 host_content_settings_map->GetContentSetting( |
1063 embedder, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); | 1058 embedder, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); |
1064 } | 1059 } |
OLD | NEW |