Skip to content

Commit

Permalink
Converts ash/wm/mru_window_tracker_unittest.cc to use AshTest
Browse files Browse the repository at this point in the history
And nukes the wm one. I'll move the file to common in a follow on
patch. In order to get this working I needed to add a couple of
things:

. Wire up WmWindowProperty::EXCLUDE_FROM_MRU in WmWindowMus.
. Fix bug in WmShell that resulted in OnWindowActivated() not being
  called correctly (and with wrong args).
. Make ui::WindowObserver::OnWindowDestroyed() be called at the same
  time as that of aura::WindowObserver.

BUG=618058, 654887
TEST=covered by tests
R=msw@chromium.org

Review-Url: https://codereview.chromium.org/2411913003
Cr-Commit-Position: refs/heads/master@{#424603}
  • Loading branch information
sky authored and Commit bot committed Oct 12, 2016
1 parent fa1eb5b commit 829e1b2
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 187 deletions.
1 change: 0 additions & 1 deletion ash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,6 @@ test("ash_unittests") {
"wm/maximize_mode/accelerometer_test_data_literals.cc",
"wm/maximize_mode/maximize_mode_controller_unittest.cc",
"wm/maximize_mode/maximize_mode_window_manager_unittest.cc",
"wm/mru_window_tracker_unittest.cc",
"wm/overlay_event_filter_unittest.cc",
"wm/overview/window_selector_unittest.cc",
"wm/panels/panel_layout_manager_unittest.cc",
Expand Down
1 change: 1 addition & 0 deletions ash/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
source_set("unittests") {
testonly = true
sources = [
"../wm/mru_window_tracker_unittest.cc",
"accelerators/accelerator_table_unittest.cc",
"wm/container_finder_unittest.cc",
"wm/workspace/workspace_layout_manager_unittest.cc",
Expand Down
2 changes: 1 addition & 1 deletion ash/common/wm/window_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ bool WindowState::IsUserPositionable() const {
}

bool WindowState::ShouldBeExcludedFromMru() const {
return (window_->GetBoolProperty(ash::WmWindowProperty::EXCLUDE_FROM_MRU));
return window_->GetBoolProperty(ash::WmWindowProperty::EXCLUDE_FROM_MRU);
}

bool WindowState::CanMaximize() const {
Expand Down
1 change: 0 additions & 1 deletion ash/mus/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ source_set("unittests") {
"test/wm_test_helper.cc",
"test/wm_test_helper.h",
"window_manager_unittest.cc",
"wm/mru_window_tracker_unittest.cc",
]

deps = [
Expand Down
2 changes: 1 addition & 1 deletion ash/mus/bridge/wm_shell_mus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ void WmShellMus::OnWindowTreeFocusChanged(ui::Window* gained_focus,
if (gained_active)
set_root_window_for_new_windows(gained_active->GetRootWindow());

WmWindow* lost_active = GetToplevelAncestor(gained_focus);
WmWindow* lost_active = GetToplevelAncestor(lost_focus);
if (gained_active == lost_active)
return;

Expand Down
13 changes: 7 additions & 6 deletions ash/mus/bridge/wm_window_mus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ ui::mojom::ShowState MojomWindowShowStateFromUI(ui::WindowShowState state) {
WmWindowProperty WmWindowPropertyFromUI(const std::string& ui_window_key) {
if (ui_window_key == ui::mojom::WindowManager::kAlwaysOnTop_Property)
return WmWindowProperty::ALWAYS_ON_TOP;
if (ui_window_key == ui::mojom::WindowManager::kExcludeFromMru_Property)
return WmWindowProperty::EXCLUDE_FROM_MRU;
if (ui_window_key == ui::mojom::WindowManager::kShelfIconResourceId_Property)
return WmWindowProperty::SHELF_ICON_RESOURCE_ID;
if (ui_window_key == ui::mojom::WindowManager::kShelfItemType_Property)
Expand Down Expand Up @@ -371,15 +373,14 @@ bool WmWindowMus::IsSystemModal() const {

bool WmWindowMus::GetBoolProperty(WmWindowProperty key) {
switch (key) {
case WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY:
return snap_children_to_pixel_boundary_;

case WmWindowProperty::ALWAYS_ON_TOP:
return IsAlwaysOnTop();

case WmWindowProperty::EXCLUDE_FROM_MRU:
NOTIMPLEMENTED();
return false;
return GetExcludeFromMru(window_);

case WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY:
return snap_children_to_pixel_boundary_;

default:
NOTREACHED();
Expand Down Expand Up @@ -836,7 +837,7 @@ void WmWindowMus::Unminimize() {
}

void WmWindowMus::SetExcludedFromMru(bool excluded_from_mru) {
NOTIMPLEMENTED();
SetExcludeFromMru(window_, excluded_from_mru);
}

std::vector<WmWindow*> WmWindowMus::GetChildren() {
Expand Down
12 changes: 12 additions & 0 deletions ash/mus/property_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,5 +265,17 @@ int64_t GetInitialDisplayId(const ui::Window::SharedProperties& properties) {
: mojo::ConvertTo<int64_t>(iter->second);
}

void SetExcludeFromMru(ui::Window* window, bool value) {
window->SetSharedProperty<bool>(
ui::mojom::WindowManager::kExcludeFromMru_Property, value);
}

bool GetExcludeFromMru(const ui::Window* window) {
return window->HasSharedProperty(
ui::mojom::WindowManager::kExcludeFromMru_Property) &&
window->GetSharedProperty<bool>(
ui::mojom::WindowManager::kExcludeFromMru_Property);
}

} // namespace mus
} // namespace ash
6 changes: 6 additions & 0 deletions ash/mus/property_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ bool ShouldRenderParentTitleArea(ui::Window* window);
// kInvalidDisplayID.
int64_t GetInitialDisplayId(const ui::Window::SharedProperties& properties);

// Manipulates the kExcludeFromMru_Property property.
void SetExcludeFromMru(ui::Window* window, bool value);

// Returns true if the property is set and true, otherwise false.
bool GetExcludeFromMru(const ui::Window* window);

} // namespace mus
} // namespace ash

Expand Down
99 changes: 0 additions & 99 deletions ash/mus/wm/mru_window_tracker_unittest.cc

This file was deleted.

Loading

0 comments on commit 829e1b2

Please sign in to comment.