#include <memory>
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/menu_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
#include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/extensions/api/context_menus.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/version_info/channel.h"
#include "content/public/browser/context_menu_params.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/browser/extension_action.h"
#include "extensions/common/extension_id.h"
#include "extensions/test/result_catcher.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "ui/base/models/menu_model.h"
namespace extensions {
ContextType;
class ExtensionContextMenuApiTest : public ExtensionApiTest { … };
class ExtensionContextMenuApiTestWithContextType
: public ExtensionContextMenuApiTest,
public testing::WithParamInterface<ContextType> { … };
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
ExtensionContextMenuApiLazyTest;
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(ExtensionContextMenuApiLazyTest, ContextMenus) { … }
IN_PROC_BROWSER_TEST_P(ExtensionContextMenuApiTestWithContextType, Count) { … }
IN_PROC_BROWSER_TEST_P(ExtensionContextMenuApiTestWithContextType,
ContextMenusFromMultipleContexts) { … }
IN_PROC_BROWSER_TEST_P(ExtensionContextMenuApiTestWithContextType,
ContextMenusBasics) { … }
IN_PROC_BROWSER_TEST_P(ExtensionContextMenuApiTestWithContextType,
ContextMenusNoPerms) { … }
IN_PROC_BROWSER_TEST_P(ExtensionContextMenuApiTestWithContextType,
ContextMenusMultipleIds) { … }
class ExtensionContextMenuVisibilityApiTest
: public ExtensionContextMenuApiTest { … };
IN_PROC_BROWSER_TEST_F(ExtensionContextMenuVisibilityApiTest,
ShowOneTopLevelItem) { … }
IN_PROC_BROWSER_TEST_F(ExtensionContextMenuVisibilityApiTest,
HideTopLevelItem) { … }
IN_PROC_BROWSER_TEST_F(ExtensionContextMenuVisibilityApiTest,
HideTopLevelSubmenuItemIfHiddenAndChildrenHidden) { … }
IN_PROC_BROWSER_TEST_F(ExtensionContextMenuVisibilityApiTest,
HideTopLevelSubmenuItemIfHiddenAndSomeChildrenVisible) { … }
IN_PROC_BROWSER_TEST_F(ExtensionContextMenuVisibilityApiTest,
ShowTopLevelItemIfAllItsChildrenAreHidden) { … }
IN_PROC_BROWSER_TEST_F(ExtensionContextMenuVisibilityApiTest,
ShowTopLevelSubmenuItemIfSomeOfChildrenAreVisible) { … }
IN_PROC_BROWSER_TEST_F(
ExtensionContextMenuVisibilityApiTest,
ShowTopLevelItemWithASubmenuWhereAllSubmenusChildrenAreHidden) { … }
IN_PROC_BROWSER_TEST_F(ExtensionContextMenuVisibilityApiTest,
HideExtensionNamedTopLevelItemIfAllChildrenAreHidden) { … }
IN_PROC_BROWSER_TEST_F(ExtensionContextMenuVisibilityApiTest,
UpdateTopLevelItem) { … }
IN_PROC_BROWSER_TEST_F(ExtensionContextMenuVisibilityApiTest,
UpdateExtensionNamedTopLevelItem) { … }
IN_PROC_BROWSER_TEST_F(ExtensionContextMenuVisibilityApiTest,
ShowExtensionNamedTopLevelItemIfSomeChildrenAreVisible) { … }
IN_PROC_BROWSER_TEST_F(ExtensionContextMenuVisibilityApiTest,
ShowMultipleExtensionNamedTopLevelItemsWithChidlren) { … }
}