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

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

Issue 17298002: Allow tabCapture API to be granted for chrome:// pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
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/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "base/win/windows_version.h" 6 #include "base/win/windows_version.h"
7 #include "chrome/browser/extensions/extension_apitest.h" 7 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.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"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Add extension to whitelist and make sure capture succeeds. 156 // Add extension to whitelist and make sure capture succeeds.
157 EXPECT_TRUE(before_whitelist_extension.WaitUntilSatisfied()); 157 EXPECT_TRUE(before_whitelist_extension.WaitUntilSatisfied());
158 AddExtensionToCommandLineWhitelist(); 158 AddExtensionToCommandLineWhitelist();
159 before_whitelist_extension.Reply(""); 159 before_whitelist_extension.Reply("");
160 160
161 ResultCatcher catcher; 161 ResultCatcher catcher;
162 catcher.RestrictToProfile(browser()->profile()); 162 catcher.RestrictToProfile(browser()->profile());
163 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 163 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
164 } 164 }
165 165
166 // Make sure tabCapture API can be granted for Chrome:// pages.
167 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, GrantForChromePages) {
168 ExtensionTestMessageListener before_open_tab("ready1", true);
169 ASSERT_TRUE(RunExtensionSubtest("tab_capture/experimental",
170 "active_tab_chrome_pages.html")) << message_;
171 EXPECT_TRUE(before_open_tab.WaitUntilSatisfied());
172
173 // Open a tab on a chrome:// page and make sure we can capture.
174 content::OpenURLParams params(GURL("chrome://version"), content::Referrer(),
175 NEW_FOREGROUND_TAB,
176 content::PAGE_TRANSITION_LINK, false);
177 content::WebContents* web_contents = browser()->OpenURL(params);
178 ExtensionService* extension_service =
179 Profile::FromBrowserContext(web_contents->GetBrowserContext())
180 ->GetExtensionService();
181 extensions::TabHelper::FromWebContents(web_contents)
182 ->active_tab_permission_granter()->GrantIfRequested(
183 extension_service->GetExtensionById(kExtensionId, false));
184 before_open_tab.Reply("");
185
186 ResultCatcher catcher;
187 catcher.RestrictToProfile(browser()->profile());
188 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
189 }
190
166 } // namespace chrome 191 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698