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

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

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 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/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/tab_helper.h" 9 #include "chrome/browser/extensions/tab_helper.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_GetUserMediaTest) { 111 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_GetUserMediaTest) {
112 ExtensionTestMessageListener listener("ready", true); 112 ExtensionTestMessageListener listener("ready", true);
113 113
114 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "get_user_media_test.html")) 114 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "get_user_media_test.html"))
115 << message_; 115 << message_;
116 116
117 EXPECT_TRUE(listener.WaitUntilSatisfied()); 117 EXPECT_TRUE(listener.WaitUntilSatisfied());
118 118
119 content::OpenURLParams params(GURL("about:blank"), content::Referrer(), 119 content::OpenURLParams params(GURL("about:blank"), content::Referrer(),
120 NEW_FOREGROUND_TAB, 120 NEW_FOREGROUND_TAB,
121 content::PAGE_TRANSITION_LINK, false); 121 ui::PAGE_TRANSITION_LINK, false);
122 content::WebContents* web_contents = browser()->OpenURL(params); 122 content::WebContents* web_contents = browser()->OpenURL(params);
123 123
124 content::RenderFrameHost* const main_frame = web_contents->GetMainFrame(); 124 content::RenderFrameHost* const main_frame = web_contents->GetMainFrame();
125 ASSERT_TRUE(main_frame); 125 ASSERT_TRUE(main_frame);
126 listener.Reply(base::StringPrintf("web-contents-media-stream://%i:%i", 126 listener.Reply(base::StringPrintf("web-contents-media-stream://%i:%i",
127 main_frame->GetProcess()->GetID(), 127 main_frame->GetProcess()->GetID(),
128 main_frame->GetRoutingID())); 128 main_frame->GetRoutingID()));
129 129
130 ResultCatcher catcher; 130 ResultCatcher catcher;
131 catcher.RestrictToBrowserContext(browser()->profile()); 131 catcher.RestrictToBrowserContext(browser()->profile());
(...skipping 15 matching lines...) Expand all
147 ExtensionTestMessageListener before_whitelist_extension("ready4", true); 147 ExtensionTestMessageListener before_whitelist_extension("ready4", true);
148 148
149 ASSERT_TRUE(RunExtensionSubtest("tab_capture", 149 ASSERT_TRUE(RunExtensionSubtest("tab_capture",
150 "active_tab_permission_test.html")) 150 "active_tab_permission_test.html"))
151 << message_; 151 << message_;
152 152
153 // Open a new tab and make sure capture is denied. 153 // Open a new tab and make sure capture is denied.
154 EXPECT_TRUE(before_open_tab.WaitUntilSatisfied()); 154 EXPECT_TRUE(before_open_tab.WaitUntilSatisfied());
155 content::OpenURLParams params(GURL("http://google.com"), content::Referrer(), 155 content::OpenURLParams params(GURL("http://google.com"), content::Referrer(),
156 NEW_FOREGROUND_TAB, 156 NEW_FOREGROUND_TAB,
157 content::PAGE_TRANSITION_LINK, false); 157 ui::PAGE_TRANSITION_LINK, false);
158 content::WebContents* web_contents = browser()->OpenURL(params); 158 content::WebContents* web_contents = browser()->OpenURL(params);
159 before_open_tab.Reply(""); 159 before_open_tab.Reply("");
160 160
161 // Grant permission and make sure capture succeeds. 161 // Grant permission and make sure capture succeeds.
162 EXPECT_TRUE(before_grant_permission.WaitUntilSatisfied()); 162 EXPECT_TRUE(before_grant_permission.WaitUntilSatisfied());
163 const Extension* extension = ExtensionRegistry::Get( 163 const Extension* extension = ExtensionRegistry::Get(
164 web_contents->GetBrowserContext())->enabled_extensions().GetByID( 164 web_contents->GetBrowserContext())->enabled_extensions().GetByID(
165 kExtensionId); 165 kExtensionId);
166 TabHelper::FromWebContents(web_contents) 166 TabHelper::FromWebContents(web_contents)
167 ->active_tab_permission_granter()->GrantIfRequested(extension); 167 ->active_tab_permission_granter()->GrantIfRequested(extension);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 if (base::win::GetVersion() < base::win::VERSION_VISTA) { 200 if (base::win::GetVersion() < base::win::VERSION_VISTA) {
201 return; 201 return;
202 } 202 }
203 #endif 203 #endif
204 204
205 AddExtensionToCommandLineWhitelist(); 205 AddExtensionToCommandLineWhitelist();
206 206
207 content::OpenURLParams params(GURL("chrome://version"), 207 content::OpenURLParams params(GURL("chrome://version"),
208 content::Referrer(), 208 content::Referrer(),
209 CURRENT_TAB, 209 CURRENT_TAB,
210 content::PAGE_TRANSITION_LINK, false); 210 ui::PAGE_TRANSITION_LINK, false);
211 content::WebContents* web_contents = browser()->OpenURL(params); 211 content::WebContents* web_contents = browser()->OpenURL(params);
212 212
213 ExtensionTestMessageListener listeners_setup("ready1", true); 213 ExtensionTestMessageListener listeners_setup("ready1", true);
214 ExtensionTestMessageListener fullscreen_entered("ready2", true); 214 ExtensionTestMessageListener fullscreen_entered("ready2", true);
215 215
216 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "fullscreen_test.html")) 216 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "fullscreen_test.html"))
217 << message_; 217 << message_;
218 EXPECT_TRUE(listeners_setup.WaitUntilSatisfied()); 218 EXPECT_TRUE(listeners_setup.WaitUntilSatisfied());
219 219
220 // Toggle fullscreen after setting up listeners. 220 // Toggle fullscreen after setting up listeners.
(...skipping 24 matching lines...) Expand all
245 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_GrantForChromePages) { 245 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_GrantForChromePages) {
246 ExtensionTestMessageListener before_open_tab("ready1", true); 246 ExtensionTestMessageListener before_open_tab("ready1", true);
247 ASSERT_TRUE(RunExtensionSubtest("tab_capture", 247 ASSERT_TRUE(RunExtensionSubtest("tab_capture",
248 "active_tab_chrome_pages.html")) 248 "active_tab_chrome_pages.html"))
249 << message_; 249 << message_;
250 EXPECT_TRUE(before_open_tab.WaitUntilSatisfied()); 250 EXPECT_TRUE(before_open_tab.WaitUntilSatisfied());
251 251
252 // Open a tab on a chrome:// page and make sure we can capture. 252 // Open a tab on a chrome:// page and make sure we can capture.
253 content::OpenURLParams params(GURL("chrome://version"), content::Referrer(), 253 content::OpenURLParams params(GURL("chrome://version"), content::Referrer(),
254 NEW_FOREGROUND_TAB, 254 NEW_FOREGROUND_TAB,
255 content::PAGE_TRANSITION_LINK, false); 255 ui::PAGE_TRANSITION_LINK, false);
256 content::WebContents* web_contents = browser()->OpenURL(params); 256 content::WebContents* web_contents = browser()->OpenURL(params);
257 const Extension* extension = ExtensionRegistry::Get( 257 const Extension* extension = ExtensionRegistry::Get(
258 web_contents->GetBrowserContext())->enabled_extensions().GetByID( 258 web_contents->GetBrowserContext())->enabled_extensions().GetByID(
259 kExtensionId); 259 kExtensionId);
260 TabHelper::FromWebContents(web_contents) 260 TabHelper::FromWebContents(web_contents)
261 ->active_tab_permission_granter()->GrantIfRequested(extension); 261 ->active_tab_permission_granter()->GrantIfRequested(extension);
262 before_open_tab.Reply(""); 262 before_open_tab.Reply("");
263 263
264 ResultCatcher catcher; 264 ResultCatcher catcher;
265 catcher.RestrictToBrowserContext(browser()->profile()); 265 catcher.RestrictToBrowserContext(browser()->profile());
(...skipping 22 matching lines...) Expand all
288 #endif 288 #endif
289 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_Constraints) { 289 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_Constraints) {
290 AddExtensionToCommandLineWhitelist(); 290 AddExtensionToCommandLineWhitelist();
291 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "constraints.html")) 291 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "constraints.html"))
292 << message_; 292 << message_;
293 } 293 }
294 294
295 } // namespace 295 } // namespace
296 296
297 } // namespace extensions 297 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698