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
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/extension_action.h"
6 #include "chrome/browser/extensions/extension_apitest.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/test/base/ui_test_utils.h"
12 namespace extensions {
14 // Times out on win asan, http://crbug.com/166026
15 #if defined(OS_WIN) && defined(ADDRESS_SANITIZER)
16 #define MAYBE_ContextMenus DISABLED_ContextMenus
18 #define MAYBE_ContextMenus ContextMenus
20 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_ContextMenus) {
21 ASSERT_TRUE(RunExtensionTest("context_menus/basics")) << message_;
22 ASSERT_TRUE(RunExtensionTest("context_menus/no_perms")) << message_;
23 ASSERT_TRUE(RunExtensionTest("context_menus/item_ids")) << message_;
24 ASSERT_TRUE(RunExtensionTest("context_menus/event_page")) << message_;
27 // crbug.com/51436 -- creating context menus from multiple script contexts
29 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContextMenusFromMultipleContexts) {
30 ASSERT_TRUE(test_server()->Start());
31 ASSERT_TRUE(RunExtensionTest("context_menus/add_from_multiple_contexts"))
33 const extensions::Extension* extension = GetSingleLoadedExtension();
34 ASSERT_TRUE(extension) << message_;
37 // Tell the extension to update the page action state.
38 ResultCatcher catcher;
39 ui_test_utils::NavigateToURL(browser(),
40 extension->GetResourceURL("popup.html"));
41 ASSERT_TRUE(catcher.GetNextResult());
45 // Tell the extension to update the page action state again.
46 ResultCatcher catcher;
47 ui_test_utils::NavigateToURL(browser(),
48 extension->GetResourceURL("popup2.html"));
49 ASSERT_TRUE(catcher.GetNextResult());
53 } // namespace extensions