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

Unified Diff: chrome/browser/extensions/active_tab_apitest.cc

Issue 10815028: Make ActiveTabPermissionManager also grant the tabs permission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops Created 8 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/extensions/active_tab_permission_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/active_tab_apitest.cc
diff --git a/chrome/browser/extensions/active_tab_apitest.cc b/chrome/browser/extensions/active_tab_apitest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0470aa20f0dc9c5ebecf71e44659279d08e1f209
--- /dev/null
+++ b/chrome/browser/extensions/active_tab_apitest.cc
@@ -0,0 +1,51 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/logging.h"
+#include "chrome/browser/extensions/extension_apitest.h"
+#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_system.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_tabstrip.h"
+#include "chrome/common/extensions/extension.h"
+#include "chrome/test/base/ui_test_utils.h"
+
+namespace extensions {
+namespace {
+
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ActiveTab) {
+ ASSERT_TRUE(StartTestServer());
+
+ const Extension* extension =
+ LoadExtension(test_data_dir_.AppendASCII("active_tab"));
+ ASSERT_TRUE(extension);
+
+ ExtensionService* service =
+ ExtensionSystem::Get(browser()->profile())->extension_service();
+
+ // Shouldn't be initially granted based on activeTab.
+ {
+ ResultCatcher catcher;
+ ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("page.html"));
+ EXPECT_TRUE(catcher.GetNextResult()) << message_;
+ }
+
+ // Granting to the extension should give it access to page.html.
+ {
+ ResultCatcher catcher;
+ service->toolbar_model()->ExecuteBrowserAction(extension, browser(), NULL);
+ EXPECT_TRUE(catcher.GetNextResult()) << message_;
+ }
+
+ // Changing page should go back to it not having access.
+ {
+ ResultCatcher catcher;
+ ui_test_utils::NavigateToURL(browser(),
+ test_server()->GetURL("final_page.html"));
+ EXPECT_TRUE(catcher.GetNextResult()) << message_;
+ }
+}
+
+} // namespace
+} // namespace extensions
« no previous file with comments | « no previous file | chrome/browser/extensions/active_tab_permission_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698