Commit 3b97bb29 authored by Shengsong Tan's avatar Shengsong Tan Committed by Commit Bot

ash: expose caption height and button statement on ARC windows to private

autotest JS

Some Tast Tests need to know the statement of ARC window caption, such
as whether caption buttons enable or visible. But currently there isn't any
function to get these information.

This CL add caption information of arc window in GetAppWindowList.

Bug: b/142446508
Bug: b/141978622
Test: tast -verbose run my_crbook arc.CompanionLibrary
Change-Id: Ib9c0ebde1ec2304fd5cd9d77523207b64deb7767
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1883453
Commit-Queue: Shengsong Tan <sstan@google.com>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711105}
parent 00fccd49
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "ash/public/cpp/autotest_private_api_utils.h" #include "ash/public/cpp/autotest_private_api_utils.h"
#include "ash/frame/non_client_frame_view_ash.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wm/mru_window_tracker.h" #include "ash/wm/mru_window_tracker.h"
#include "ash/wm/tablet_mode/scoped_skip_user_session_blocked_check.h" #include "ash/wm/tablet_mode/scoped_skip_user_session_blocked_check.h"
...@@ -16,4 +17,8 @@ std::vector<aura::Window*> GetAppWindowList() { ...@@ -16,4 +17,8 @@ std::vector<aura::Window*> GetAppWindowList() {
ash::kAllDesks); ash::kAllDesks);
} }
} // namespace ash ash::HeaderView* GetHeaderViewForWindow(aura::Window* window) {
return ash::NonClientFrameViewAsh::Get(window)->GetHeaderView();
}
} // namespace ash
\ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <vector> #include <vector>
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/frame/header_view.h"
namespace aura { namespace aura {
class Window; class Window;
...@@ -19,6 +20,8 @@ namespace ash { ...@@ -19,6 +20,8 @@ namespace ash {
// Get application windows, windows that are shown in overview grid. // Get application windows, windows that are shown in overview grid.
ASH_EXPORT std::vector<aura::Window*> GetAppWindowList(); ASH_EXPORT std::vector<aura::Window*> GetAppWindowList();
// Get HeaderView from application windows.
ASH_EXPORT ash::HeaderView* GetHeaderViewForWindow(aura::Window* window);
} // namespace ash } // namespace ash
#endif // ASH_PUBLIC_CPP_AUTOTEST_PRIVATE_API_UTILS_H_ #endif // ASH_PUBLIC_CPP_AUTOTEST_PRIVATE_API_UTILS_H_
...@@ -11,7 +11,9 @@ ...@@ -11,7 +11,9 @@
#include "ash/public/cpp/app_types.h" #include "ash/public/cpp/app_types.h"
#include "ash/public/cpp/ash_pref_names.h" #include "ash/public/cpp/ash_pref_names.h"
#include "ash/public/cpp/autotest_private_api_utils.h" #include "ash/public/cpp/autotest_private_api_utils.h"
#include "ash/public/cpp/default_frame_header.h"
#include "ash/public/cpp/desks_helper.h" #include "ash/public/cpp/desks_helper.h"
#include "ash/public/cpp/frame_header.h"
#include "ash/public/cpp/login_screen.h" #include "ash/public/cpp/login_screen.h"
#include "ash/public/cpp/overview_test_api.h" #include "ash/public/cpp/overview_test_api.h"
#include "ash/public/cpp/shelf_item.h" #include "ash/public/cpp/shelf_item.h"
...@@ -2938,6 +2940,35 @@ AutotestPrivateGetAppWindowListFunction::Run() { ...@@ -2938,6 +2940,35 @@ AutotestPrivateGetAppWindowListFunction::Run() {
static_cast<int>(ash::AppType::ARC_APP)) { static_cast<int>(ash::AppType::ARC_APP)) {
window_info.arc_package_name = std::make_unique<std::string>( window_info.arc_package_name = std::make_unique<std::string>(
*window->GetProperty(ash::kArcPackageNameKey)); *window->GetProperty(ash::kArcPackageNameKey));
ash::HeaderView* header_view = ash::GetHeaderViewForWindow(window);
ash::DefaultFrameHeader* frame_header = header_view->GetFrameHeader();
window_info.caption_height = frame_header->GetHeaderHeight();
const ash::CaptionButtonModel* buttonModel =
header_view->caption_button_container()->model();
int caption_button_enabled_status = 0;
int caption_button_visible_status = 0;
constexpr views::CaptionButtonIcon all_button_icons[] = {
views::CAPTION_BUTTON_ICON_MINIMIZE,
views::CAPTION_BUTTON_ICON_MAXIMIZE_RESTORE,
views::CAPTION_BUTTON_ICON_CLOSE,
views::CAPTION_BUTTON_ICON_LEFT_SNAPPED,
views::CAPTION_BUTTON_ICON_RIGHT_SNAPPED,
views::CAPTION_BUTTON_ICON_BACK,
views::CAPTION_BUTTON_ICON_LOCATION,
views::CAPTION_BUTTON_ICON_MENU,
views::CAPTION_BUTTON_ICON_ZOOM,
views::CAPTION_BUTTON_ICON_COUNT};
for (const auto button : all_button_icons) {
if (buttonModel->IsEnabled(button))
caption_button_enabled_status |= (1 << button);
if (buttonModel->IsVisible(button))
caption_button_visible_status |= (1 << button);
}
window_info.caption_button_enabled_status = caption_button_enabled_status;
window_info.caption_button_visible_status = caption_button_visible_status;
} }
result_list.emplace_back(std::move(window_info)); result_list.emplace_back(std::move(window_info));
} }
......
...@@ -347,6 +347,12 @@ namespace autotestPrivate { ...@@ -347,6 +347,12 @@ namespace autotestPrivate {
boolean hasFocus; boolean hasFocus;
boolean onActiveDesk; boolean onActiveDesk;
boolean hasCapture; boolean hasCapture;
// Window frame info
long captionHeight;
long captionButtonEnabledStatus;
long captionButtonVisibleStatus;
DOMString? arcPackageName; DOMString? arcPackageName;
}; };
......
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