OLD | NEW |
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 "chrome/test/ppapi/ppapi_test.h" | 5 #include "chrome/test/ppapi/ppapi_test.h" |
6 | 6 |
7 #include "base/test/test_timeouts.h" | 7 #include "base/test/test_timeouts.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 10 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_navigator.h" | 12 #include "chrome/browser/ui/browser_navigator.h" |
11 #include "chrome/browser/ui/browser_tabstrip.h" | 13 #include "chrome/browser/ui/browser_tabstrip.h" |
12 #include "chrome/test/base/javascript_test_observer.h" | 14 #include "chrome/test/base/javascript_test_observer.h" |
13 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
14 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
15 #include "content/public/common/url_constants.h" | 17 #include "content/public/common/url_constants.h" |
16 #include "content/public/test/test_renderer_host.h" | 18 #include "content/public/test/test_renderer_host.h" |
17 | 19 |
18 using content::RenderViewHost; | 20 using content::RenderViewHost; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 131 |
130 // Disable tests under ASAN. http://crbug.com/104832. | 132 // Disable tests under ASAN. http://crbug.com/104832. |
131 // This is a bit heavy handed, but the majority of these tests fail under ASAN. | 133 // This is a bit heavy handed, but the majority of these tests fail under ASAN. |
132 // See bug for history. | 134 // See bug for history. |
133 #if !defined(ADDRESS_SANITIZER) | 135 #if !defined(ADDRESS_SANITIZER) |
134 | 136 |
135 TEST_PPAPI_IN_PROCESS(Broker) | 137 TEST_PPAPI_IN_PROCESS(Broker) |
136 // Flaky, http://crbug.com/111355 | 138 // Flaky, http://crbug.com/111355 |
137 TEST_PPAPI_OUT_OF_PROCESS(DISABLED_Broker) | 139 TEST_PPAPI_OUT_OF_PROCESS(DISABLED_Broker) |
138 | 140 |
| 141 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Accept) { |
| 142 // Accepting the infobar should grant permission to access the PPAPI broker. |
| 143 InfoBarObserver observer; |
| 144 observer.ExpectInfoBarAndAccept(true); |
| 145 |
| 146 GURL url = GetTestFileUrl("Broker_ConnectPermissionGranted"); |
| 147 RunTestURL(url); |
| 148 |
| 149 // It should also set a content settings exception for the site. |
| 150 HostContentSettingsMap* content_settings = |
| 151 browser()->profile()->GetHostContentSettingsMap(); |
| 152 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 153 content_settings->GetContentSetting( |
| 154 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); |
| 155 } |
| 156 |
| 157 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Deny) { |
| 158 // Canceling the infobar should deny permission to access the PPAPI broker. |
| 159 InfoBarObserver observer; |
| 160 observer.ExpectInfoBarAndAccept(false); |
| 161 |
| 162 GURL url = GetTestFileUrl("Broker_ConnectPermissionDenied"); |
| 163 RunTestURL(url); |
| 164 |
| 165 // It should *not* set a content settings exception for the site. |
| 166 HostContentSettingsMap* content_settings = |
| 167 browser()->profile()->GetHostContentSettingsMap(); |
| 168 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 169 content_settings->GetContentSetting( |
| 170 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); |
| 171 } |
| 172 |
| 173 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Blocked) { |
| 174 // Block access to the PPAPI broker. |
| 175 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
| 176 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_BLOCK); |
| 177 |
| 178 // We shouldn't see an infobar. |
| 179 InfoBarObserver observer; |
| 180 |
| 181 RunTest("Broker_ConnectPermissionDenied"); |
| 182 } |
| 183 |
| 184 IN_PROC_BROWSER_TEST_F(PPAPIBrokerInfoBarTest, Allowed) { |
| 185 // Always allow access to the PPAPI broker. |
| 186 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
| 187 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, CONTENT_SETTING_ALLOW); |
| 188 |
| 189 // We shouldn't see an infobar. |
| 190 InfoBarObserver observer; |
| 191 |
| 192 RunTest("Broker_ConnectPermissionGranted"); |
| 193 } |
| 194 |
139 TEST_PPAPI_IN_PROCESS(Core) | 195 TEST_PPAPI_IN_PROCESS(Core) |
140 TEST_PPAPI_OUT_OF_PROCESS(Core) | 196 TEST_PPAPI_OUT_OF_PROCESS(Core) |
141 TEST_PPAPI_NACL_VIA_HTTP(Core) | 197 TEST_PPAPI_NACL_VIA_HTTP(Core) |
142 | 198 |
143 #if defined(OS_CHROMEOS) | 199 #if defined(OS_CHROMEOS) |
144 #define MAYBE_InputEvent InputEvent | 200 #define MAYBE_InputEvent InputEvent |
145 #elif defined(OS_LINUX) | 201 #elif defined(OS_LINUX) |
146 // Times out on Linux. http://crbug.com/108859 | 202 // Times out on Linux. http://crbug.com/108859 |
147 #define MAYBE_InputEvent DISABLED_InputEvent | 203 #define MAYBE_InputEvent DISABLED_InputEvent |
148 #elif defined(OS_MACOSX) | 204 #elif defined(OS_MACOSX) |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 // Note to sheriffs: MessageLoop_Post starts a thread, which has a history of | 886 // Note to sheriffs: MessageLoop_Post starts a thread, which has a history of |
831 // slowness, particularly on Windows XP. If this test times out, please try | 887 // slowness, particularly on Windows XP. If this test times out, please try |
832 // marking it SLOW_ before disabling. | 888 // marking it SLOW_ before disabling. |
833 // - dmichael | 889 // - dmichael |
834 TEST_PPAPI_OUT_OF_PROCESS(MessageLoop_Post) | 890 TEST_PPAPI_OUT_OF_PROCESS(MessageLoop_Post) |
835 | 891 |
836 // Only enabled in out-of-process mode. | 892 // Only enabled in out-of-process mode. |
837 TEST_PPAPI_OUT_OF_PROCESS(FlashFile_CreateTemporaryFile) | 893 TEST_PPAPI_OUT_OF_PROCESS(FlashFile_CreateTemporaryFile) |
838 | 894 |
839 #endif // ADDRESS_SANITIZER | 895 #endif // ADDRESS_SANITIZER |
OLD | NEW |