Home | History | Annotate | Download | only in extensions
      1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/extensions/extension_apitest.h"
      6 #include "chrome/browser/extensions/extension_browser_event_router.h"
      7 #include "chrome/browser/extensions/extension_service.h"
      8 #include "chrome/browser/profiles/profile.h"
      9 #include "chrome/browser/ui/browser.h"
     10 #include "chrome/common/extensions/extension_action.h"
     11 #include "chrome/test/ui_test_utils.h"
     12 #include "content/browser/tab_contents/tab_contents.h"
     13 
     14 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContextMenus) {
     15   ASSERT_TRUE(RunExtensionTest("context_menus/basics")) << message_;
     16   ASSERT_TRUE(RunExtensionTest("context_menus/no_perms")) << message_;
     17 }
     18 
     19 // crbug.com/51436 -- creating context menus from multiple script contexts
     20 // should work.
     21 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContextMenusFromMultipleContexts) {
     22   ASSERT_TRUE(test_server()->Start());
     23   ASSERT_TRUE(RunExtensionTest("context_menus/add_from_multiple_contexts"))
     24       << message_;
     25   const Extension* extension = GetSingleLoadedExtension();
     26   ASSERT_TRUE(extension) << message_;
     27 
     28   {
     29     // Tell the extension to update the page action state.
     30     ResultCatcher catcher;
     31     ui_test_utils::NavigateToURL(browser(),
     32         extension->GetResourceURL("popup.html"));
     33     ASSERT_TRUE(catcher.GetNextResult());
     34   }
     35 
     36   {
     37     // Tell the extension to update the page action state again.
     38     ResultCatcher catcher;
     39     ui_test_utils::NavigateToURL(browser(),
     40         extension->GetResourceURL("popup2.html"));
     41     ASSERT_TRUE(catcher.GetNextResult());
     42   }
     43 }
     44 
     45