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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/extensions/extension_test_message_listener.h" | 9 #include "chrome/browser/extensions/extension_test_message_listener.h" |
10 #include "chrome/browser/extensions/tab_helper.h" | 10 #include "chrome/browser/extensions/tab_helper.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 12 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
13 #include "chrome/common/chrome_version_info.h" | 13 #include "chrome/common/chrome_version_info.h" |
14 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
15 #include "content/public/browser/render_process_host.h" | 15 #include "content/public/browser/render_process_host.h" |
16 #include "extensions/browser/extension_registry.h" | 16 #include "extensions/browser/extension_registry.h" |
17 #include "extensions/common/switches.h" | 17 #include "extensions/common/switches.h" |
| 18 #include "extensions/test/result_catcher.h" |
18 | 19 |
19 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
20 #include "base/win/windows_version.h" | 21 #include "base/win/windows_version.h" |
21 #endif | 22 #endif |
22 | 23 |
23 #if defined(OS_WIN) && defined(USE_ASH) | 24 #if defined(OS_WIN) && defined(USE_ASH) |
24 #include "chrome/test/base/test_switches.h" | 25 #include "chrome/test/base/test_switches.h" |
25 #endif | 26 #endif |
26 | 27 |
27 namespace extensions { | 28 namespace extensions { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 content::PAGE_TRANSITION_LINK, false); | 121 content::PAGE_TRANSITION_LINK, false); |
121 content::WebContents* web_contents = browser()->OpenURL(params); | 122 content::WebContents* web_contents = browser()->OpenURL(params); |
122 | 123 |
123 content::RenderFrameHost* const main_frame = web_contents->GetMainFrame(); | 124 content::RenderFrameHost* const main_frame = web_contents->GetMainFrame(); |
124 ASSERT_TRUE(main_frame); | 125 ASSERT_TRUE(main_frame); |
125 listener.Reply(base::StringPrintf("web-contents-media-stream://%i:%i", | 126 listener.Reply(base::StringPrintf("web-contents-media-stream://%i:%i", |
126 main_frame->GetProcess()->GetID(), | 127 main_frame->GetProcess()->GetID(), |
127 main_frame->GetRoutingID())); | 128 main_frame->GetRoutingID())); |
128 | 129 |
129 ResultCatcher catcher; | 130 ResultCatcher catcher; |
130 catcher.RestrictToProfile(browser()->profile()); | 131 catcher.RestrictToBrowserContext(browser()->profile()); |
131 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 132 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
132 } | 133 } |
133 | 134 |
134 // http://crbug.com/177163 | 135 // http://crbug.com/177163 |
135 #if defined(OS_WIN) && !defined(NDEBUG) | 136 #if defined(OS_WIN) && !defined(NDEBUG) |
136 #define MAYBE_ActiveTabPermission DISABLED_ActiveTabPermission | 137 #define MAYBE_ActiveTabPermission DISABLED_ActiveTabPermission |
137 #else | 138 #else |
138 #define MAYBE_ActiveTabPermission ActiveTabPermission | 139 #define MAYBE_ActiveTabPermission ActiveTabPermission |
139 #endif | 140 #endif |
140 // Make sure tabCapture.capture only works if the tab has been granted | 141 // Make sure tabCapture.capture only works if the tab has been granted |
(...skipping 29 matching lines...) Expand all Loading... |
170 EXPECT_TRUE(before_open_new_tab.WaitUntilSatisfied()); | 171 EXPECT_TRUE(before_open_new_tab.WaitUntilSatisfied()); |
171 browser()->OpenURL(params); | 172 browser()->OpenURL(params); |
172 before_open_new_tab.Reply(""); | 173 before_open_new_tab.Reply(""); |
173 | 174 |
174 // Add extension to whitelist and make sure capture succeeds. | 175 // Add extension to whitelist and make sure capture succeeds. |
175 EXPECT_TRUE(before_whitelist_extension.WaitUntilSatisfied()); | 176 EXPECT_TRUE(before_whitelist_extension.WaitUntilSatisfied()); |
176 AddExtensionToCommandLineWhitelist(); | 177 AddExtensionToCommandLineWhitelist(); |
177 before_whitelist_extension.Reply(""); | 178 before_whitelist_extension.Reply(""); |
178 | 179 |
179 ResultCatcher catcher; | 180 ResultCatcher catcher; |
180 catcher.RestrictToProfile(browser()->profile()); | 181 catcher.RestrictToBrowserContext(browser()->profile()); |
181 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 182 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
182 } | 183 } |
183 | 184 |
184 // http://crbug.com/177163 | 185 // http://crbug.com/177163 |
185 #if defined(OS_WIN) && !defined(NDEBUG) | 186 #if defined(OS_WIN) && !defined(NDEBUG) |
186 #define MAYBE_FullscreenEvents DISABLED_FullscreenEvents | 187 #define MAYBE_FullscreenEvents DISABLED_FullscreenEvents |
187 #elif defined(USE_AURA) || defined(OS_MACOSX) | 188 #elif defined(USE_AURA) || defined(OS_MACOSX) |
188 // These don't always fire fullscreen events when run in tests. Tested manually. | 189 // These don't always fire fullscreen events when run in tests. Tested manually. |
189 #define MAYBE_FullscreenEvents DISABLED_FullscreenEvents | 190 #define MAYBE_FullscreenEvents DISABLED_FullscreenEvents |
190 #elif defined(OS_LINUX) | 191 #elif defined(OS_LINUX) |
(...skipping 30 matching lines...) Expand all Loading... |
221 true); | 222 true); |
222 listeners_setup.Reply(""); | 223 listeners_setup.Reply(""); |
223 | 224 |
224 // Toggle again after JS should have the event. | 225 // Toggle again after JS should have the event. |
225 EXPECT_TRUE(fullscreen_entered.WaitUntilSatisfied()); | 226 EXPECT_TRUE(fullscreen_entered.WaitUntilSatisfied()); |
226 browser()->fullscreen_controller()->ToggleFullscreenModeForTab(web_contents, | 227 browser()->fullscreen_controller()->ToggleFullscreenModeForTab(web_contents, |
227 false); | 228 false); |
228 fullscreen_entered.Reply(""); | 229 fullscreen_entered.Reply(""); |
229 | 230 |
230 ResultCatcher catcher; | 231 ResultCatcher catcher; |
231 catcher.RestrictToProfile(browser()->profile()); | 232 catcher.RestrictToBrowserContext(browser()->profile()); |
232 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 233 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
233 } | 234 } |
234 | 235 |
235 // Times out on Win dbg bots: http://crbug.com/177163 | 236 // Times out on Win dbg bots: http://crbug.com/177163 |
236 // #if defined(OS_WIN) && !defined(NDEBUG) | 237 // #if defined(OS_WIN) && !defined(NDEBUG) |
237 // Times out on all Win bots, flaky on MSan bots: http://crbug.com/294431 | 238 // Times out on all Win bots, flaky on MSan bots: http://crbug.com/294431 |
238 #if defined(OS_WIN) || defined(MEMORY_SANITIZER) | 239 #if defined(OS_WIN) || defined(MEMORY_SANITIZER) |
239 #define MAYBE_GrantForChromePages DISABLED_GrantForChromePages | 240 #define MAYBE_GrantForChromePages DISABLED_GrantForChromePages |
240 #else | 241 #else |
241 #define MAYBE_GrantForChromePages GrantForChromePages | 242 #define MAYBE_GrantForChromePages GrantForChromePages |
(...skipping 12 matching lines...) Expand all Loading... |
254 content::PAGE_TRANSITION_LINK, false); | 255 content::PAGE_TRANSITION_LINK, false); |
255 content::WebContents* web_contents = browser()->OpenURL(params); | 256 content::WebContents* web_contents = browser()->OpenURL(params); |
256 const Extension* extension = ExtensionRegistry::Get( | 257 const Extension* extension = ExtensionRegistry::Get( |
257 web_contents->GetBrowserContext())->enabled_extensions().GetByID( | 258 web_contents->GetBrowserContext())->enabled_extensions().GetByID( |
258 kExtensionId); | 259 kExtensionId); |
259 TabHelper::FromWebContents(web_contents) | 260 TabHelper::FromWebContents(web_contents) |
260 ->active_tab_permission_granter()->GrantIfRequested(extension); | 261 ->active_tab_permission_granter()->GrantIfRequested(extension); |
261 before_open_tab.Reply(""); | 262 before_open_tab.Reply(""); |
262 | 263 |
263 ResultCatcher catcher; | 264 ResultCatcher catcher; |
264 catcher.RestrictToProfile(browser()->profile()); | 265 catcher.RestrictToBrowserContext(browser()->profile()); |
265 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 266 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
266 } | 267 } |
267 | 268 |
268 #if (defined(OS_WIN) && !defined(NDEBUG)) || defined(OS_MACOSX) | 269 #if (defined(OS_WIN) && !defined(NDEBUG)) || defined(OS_MACOSX) |
269 // http://crbug.com/326319 | 270 // http://crbug.com/326319 |
270 #define MAYBE_CaptureInSplitIncognitoMode DISABLED_CaptureInSplitIncognitoMode | 271 #define MAYBE_CaptureInSplitIncognitoMode DISABLED_CaptureInSplitIncognitoMode |
271 #else | 272 #else |
272 #define MAYBE_CaptureInSplitIncognitoMode CaptureInSplitIncognitoMode | 273 #define MAYBE_CaptureInSplitIncognitoMode CaptureInSplitIncognitoMode |
273 #endif | 274 #endif |
274 // Test that a tab can be captured in split incognito mode. | 275 // Test that a tab can be captured in split incognito mode. |
(...skipping 12 matching lines...) Expand all Loading... |
287 #endif | 288 #endif |
288 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_Constraints) { | 289 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_Constraints) { |
289 AddExtensionToCommandLineWhitelist(); | 290 AddExtensionToCommandLineWhitelist(); |
290 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "constraints.html")) | 291 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "constraints.html")) |
291 << message_; | 292 << message_; |
292 } | 293 } |
293 | 294 |
294 } // namespace | 295 } // namespace |
295 | 296 |
296 } // namespace extensions | 297 } // namespace extensions |
OLD | NEW |