Commit e240c0b7 authored by Sammie Quon's avatar Sammie Quon Committed by Chromium LUCI CQ

cros: Remove ShellTestApi::ShowContextMenu.

Addressing missed feedback from crrev.com/c/2581027, use right
click instead of adding new API.

Bug: none
Test: compiles
Change-Id: I988c92c87e9339702a5554bd7e5375d467616412
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2623424Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842603}
parent a8366146
......@@ -116,10 +116,6 @@ class ASH_EXPORT ShellTestApi {
// It returns nullptr when app-list is not shown.
PaginationModel* GetAppListPaginationModel();
// Shows the context menu associated with the primary root window at point (1,
// 1).
void ShowContextMenu();
// Returns true if the context menu associated with the primary root window is
// shown.
bool IsContextMenuShown() const;
......
......@@ -252,11 +252,6 @@ PaginationModel* ShellTestApi::GetAppListPaginationModel() {
return view->GetAppsPaginationModel();
}
void ShellTestApi::ShowContextMenu() {
Shell::GetPrimaryRootWindowController()->ShowContextMenu(
gfx::Point(1, 1), ui::MENU_SOURCE_MOUSE);
}
bool ShellTestApi::IsContextMenuShown() const {
return Shell::GetPrimaryRootWindowController()->IsContextMenuShown();
}
......
......@@ -6,9 +6,15 @@
#include "ash/public/cpp/capture_mode_test_api.h"
#include "ash/public/cpp/test/shell_test_api.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/test/browser_test.h"
#include "ui/aura/window.h"
#include "ui/events/test/event_generator.h"
// Testing class to test CrOS capture mode, which is a feature to take
// screenshots and record video.
class CaptureModeBrowserTest : public InProcessBrowserTest {
public:
CaptureModeBrowserTest() = default;
......@@ -27,8 +33,16 @@ class CaptureModeBrowserTest : public InProcessBrowserTest {
};
IN_PROC_BROWSER_TEST_F(CaptureModeBrowserTest, ContextMenuStaysOpen) {
// Right click the desktop to open a context menu.
aura::Window* browser_window = browser()->window()->GetNativeWindow();
const gfx::Point point_on_desktop(1, 1);
ASSERT_FALSE(browser_window->bounds().Contains(point_on_desktop));
ui::test::EventGenerator event_generator(browser_window->GetRootWindow(),
point_on_desktop);
event_generator.ClickRightButton();
ash::ShellTestApi shell_test_api;
shell_test_api.ShowContextMenu();
ASSERT_TRUE(shell_test_api.IsContextMenuShown());
ash::CaptureModeTestApi().StartForWindow(/*for_video=*/false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment