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

Side by Side Diff: chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/location.h" 6 #include "base/location.h"
7 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/test/test_timeouts.h" 9 #include "base/test/test_timeouts.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // Tests that getUserMedia() is NOT a way to start tab capture. 233 // Tests that getUserMedia() is NOT a way to start tab capture.
234 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_GetUserMediaTest) { 234 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_GetUserMediaTest) {
235 ExtensionTestMessageListener listener("ready", true); 235 ExtensionTestMessageListener listener("ready", true);
236 236
237 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "get_user_media_test.html")) 237 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "get_user_media_test.html"))
238 << message_; 238 << message_;
239 239
240 EXPECT_TRUE(listener.WaitUntilSatisfied()); 240 EXPECT_TRUE(listener.WaitUntilSatisfied());
241 241
242 content::OpenURLParams params(GURL("about:blank"), content::Referrer(), 242 content::OpenURLParams params(GURL("about:blank"), content::Referrer(),
243 NEW_FOREGROUND_TAB, 243 WindowOpenDisposition::NEW_FOREGROUND_TAB,
244 ui::PAGE_TRANSITION_LINK, false); 244 ui::PAGE_TRANSITION_LINK, false);
245 content::WebContents* web_contents = browser()->OpenURL(params); 245 content::WebContents* web_contents = browser()->OpenURL(params);
246 246
247 content::RenderFrameHost* const main_frame = web_contents->GetMainFrame(); 247 content::RenderFrameHost* const main_frame = web_contents->GetMainFrame();
248 ASSERT_TRUE(main_frame); 248 ASSERT_TRUE(main_frame);
249 listener.Reply(base::StringPrintf("web-contents-media-stream://%i:%i", 249 listener.Reply(base::StringPrintf("web-contents-media-stream://%i:%i",
250 main_frame->GetProcess()->GetID(), 250 main_frame->GetProcess()->GetID(),
251 main_frame->GetRoutingID())); 251 main_frame->GetRoutingID()));
252 252
253 ResultCatcher catcher; 253 ResultCatcher catcher;
(...skipping 15 matching lines...) Expand all
269 ExtensionTestMessageListener before_open_new_tab("ready3", true); 269 ExtensionTestMessageListener before_open_new_tab("ready3", true);
270 ExtensionTestMessageListener before_whitelist_extension("ready4", true); 270 ExtensionTestMessageListener before_whitelist_extension("ready4", true);
271 271
272 ASSERT_TRUE(RunExtensionSubtest("tab_capture", 272 ASSERT_TRUE(RunExtensionSubtest("tab_capture",
273 "active_tab_permission_test.html")) 273 "active_tab_permission_test.html"))
274 << message_; 274 << message_;
275 275
276 // Open a new tab and make sure capture is denied. 276 // Open a new tab and make sure capture is denied.
277 EXPECT_TRUE(before_open_tab.WaitUntilSatisfied()); 277 EXPECT_TRUE(before_open_tab.WaitUntilSatisfied());
278 content::OpenURLParams params(GURL("http://google.com"), content::Referrer(), 278 content::OpenURLParams params(GURL("http://google.com"), content::Referrer(),
279 NEW_FOREGROUND_TAB, 279 WindowOpenDisposition::NEW_FOREGROUND_TAB,
280 ui::PAGE_TRANSITION_LINK, false); 280 ui::PAGE_TRANSITION_LINK, false);
281 content::WebContents* web_contents = browser()->OpenURL(params); 281 content::WebContents* web_contents = browser()->OpenURL(params);
282 before_open_tab.Reply(""); 282 before_open_tab.Reply("");
283 283
284 // Grant permission and make sure capture succeeds. 284 // Grant permission and make sure capture succeeds.
285 EXPECT_TRUE(before_grant_permission.WaitUntilSatisfied()); 285 EXPECT_TRUE(before_grant_permission.WaitUntilSatisfied());
286 const Extension* extension = ExtensionRegistry::Get( 286 const Extension* extension = ExtensionRegistry::Get(
287 web_contents->GetBrowserContext())->enabled_extensions().GetByID( 287 web_contents->GetBrowserContext())->enabled_extensions().GetByID(
288 kExtensionId); 288 kExtensionId);
289 TabHelper::FromWebContents(web_contents) 289 TabHelper::FromWebContents(web_contents)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // Make sure tabCapture API can be granted for Chrome:// pages. 349 // Make sure tabCapture API can be granted for Chrome:// pages.
350 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_GrantForChromePages) { 350 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_GrantForChromePages) {
351 ExtensionTestMessageListener before_open_tab("ready1", true); 351 ExtensionTestMessageListener before_open_tab("ready1", true);
352 ASSERT_TRUE(RunExtensionSubtest("tab_capture", 352 ASSERT_TRUE(RunExtensionSubtest("tab_capture",
353 "active_tab_chrome_pages.html")) 353 "active_tab_chrome_pages.html"))
354 << message_; 354 << message_;
355 EXPECT_TRUE(before_open_tab.WaitUntilSatisfied()); 355 EXPECT_TRUE(before_open_tab.WaitUntilSatisfied());
356 356
357 // Open a tab on a chrome:// page and make sure we can capture. 357 // Open a tab on a chrome:// page and make sure we can capture.
358 content::OpenURLParams params(GURL("chrome://version"), content::Referrer(), 358 content::OpenURLParams params(GURL("chrome://version"), content::Referrer(),
359 NEW_FOREGROUND_TAB, 359 WindowOpenDisposition::NEW_FOREGROUND_TAB,
360 ui::PAGE_TRANSITION_LINK, false); 360 ui::PAGE_TRANSITION_LINK, false);
361 content::WebContents* web_contents = browser()->OpenURL(params); 361 content::WebContents* web_contents = browser()->OpenURL(params);
362 const Extension* extension = ExtensionRegistry::Get( 362 const Extension* extension = ExtensionRegistry::Get(
363 web_contents->GetBrowserContext())->enabled_extensions().GetByID( 363 web_contents->GetBrowserContext())->enabled_extensions().GetByID(
364 kExtensionId); 364 kExtensionId);
365 TabHelper::FromWebContents(web_contents) 365 TabHelper::FromWebContents(web_contents)
366 ->active_tab_permission_granter()->GrantIfRequested(extension); 366 ->active_tab_permission_granter()->GrantIfRequested(extension);
367 before_open_tab.Reply(""); 367 before_open_tab.Reply("");
368 368
369 ResultCatcher catcher; 369 ResultCatcher catcher;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 EXPECT_EQ(TabAlertState::TAB_CAPTURING, observer.last_alert_state()); 463 EXPECT_EQ(TabAlertState::TAB_CAPTURING, observer.last_alert_state());
464 return; 464 return;
465 } 465 }
466 content::RunMessageLoop(); 466 content::RunMessageLoop();
467 } 467 }
468 } 468 }
469 469
470 } // namespace 470 } // namespace
471 471
472 } // namespace extensions 472 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/sessions/sessions_api.cc ('k') | chrome/browser/extensions/api/tabs/tabs_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698