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

Unified Diff: chrome/browser/extensions/api/tabs/tabs_test.cc

Issue 10829186: Tabs API is usable without tabs permission. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed sample extensions Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/tabs/tabs_test.cc
diff --git a/chrome/browser/extensions/api/tabs/tabs_test.cc b/chrome/browser/extensions/api/tabs/tabs_test.cc
index 1f74f520cbc5dd72ecb4b8b06d699bdd491695ec..cf7088de64fb3173d9d399de1b18315529b8b39e 100644
--- a/chrome/browser/extensions/api/tabs/tabs_test.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_test.cc
@@ -263,11 +263,14 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, UpdateNoPermissions) {
// Without a callback the function will not generate a result.
update_tab_function->set_has_callback(true);
- scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
+ scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
+ utils::RunFunctionAndReturnSingleResult(
update_tab_function.get(),
- "[null, {\"url\": \"neutrinos\"}]",
- browser()));
- EXPECT_EQ(base::Value::TYPE_NULL, result->GetType());
+ "[null, {\"url\": \"about:blank\", \"pinned\": true}]",
+ browser())));
+ // The url is stripped since the extension does not have tab permissions.
+ EXPECT_EQ(std::string(), utils::GetString(result.get(), "url"));
+ EXPECT_TRUE(utils::GetBoolean(result.get(), "pinned"));
}
IN_PROC_BROWSER_TEST_F(ExtensionTabsTest,
@@ -409,6 +412,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, QueryCurrentWindowTabs) {
// Get tabs in the 'current' window called from non-focused browser.
scoped_refptr<QueryTabsFunction> function = new QueryTabsFunction();
+ function->set_extension(utils::CreateEmptyExtension().get());
scoped_ptr<base::ListValue> result(utils::ToList(
utils::RunFunctionAndReturnSingleResult(function.get(),
"[{\"currentWindow\":true}]",
@@ -425,6 +429,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, QueryCurrentWindowTabs) {
// Get tabs NOT in the 'current' window called from non-focused browser.
function = new QueryTabsFunction();
+ function->set_extension(utils::CreateEmptyExtension().get());
result.reset(utils::ToList(
utils::RunFunctionAndReturnSingleResult(function.get(),
"[{\"currentWindow\":false}]",
@@ -506,6 +511,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DontCreateTabInClosingPopupWindow) {
chrome::CloseWindow(popup_browser);
scoped_refptr<CreateTabFunction> create_tab_function(new CreateTabFunction());
+ create_tab_function->set_extension(utils::CreateEmptyExtension().get());
// Without a callback the function will not generate a result.
create_tab_function->set_has_callback(true);

Powered by Google App Engine
This is Rietveld 408576698