0

chromeos: removes usage of ui/aura/mus from somes places

Specifically the Mode and waiting for changes to complete. ui/aura/mus
will go away entirely soon.

BUG=958245
TEST=covered by tests
TBR=emaxx@chromium.org

Change-Id: Ic1e421af16640482a3fc3c95bc6e56de2a1b7e9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1613645
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Maksim Ivanov <emaxx@chromium.org>
Reviewed-by: Michael Wasserman <msw@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660148}
This commit is contained in:
Scott Violet
2019-05-15 21:57:15 +00:00
committed by Commit Bot
parent 324910e2f1
commit aad4d1ab76
28 changed files with 39 additions and 238 deletions

@ -15,7 +15,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/env.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/ui_base_paths.h"
#include "ui/gl/test/gl_surface_test_support.h"
@ -44,9 +43,7 @@ class AppListTestSuite : public base::TestSuite {
base::DiscardableMemoryAllocator::SetInstance(
&discardable_memory_allocator_);
env_ = aura::Env::CreateInstance(features::IsSingleProcessMash()
? aura::Env::Mode::MUS
: aura::Env::Mode::LOCAL);
env_ = aura::Env::CreateInstance();
}
void Shutdown() override {

@ -29,7 +29,6 @@
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/aura/window_observer.h"
@ -109,10 +108,6 @@ bool IsAllowedStateTransition(KeyboardControllerState from,
}
void SetTouchEventLogging(bool enable) {
// TODO(moshayedi): crbug.com/642863. Revisit when we have mojo interface for
// InputController for processes that aren't mus-ws.
if (aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS)
return;
ui::InputController* controller =
ui::OzonePlatform::GetInstance()->GetInputController();
if (controller)

@ -15,7 +15,6 @@
#include "ash/public/cpp/window_properties.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "ui/aura/env.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/hit_test.h"
#include "ui/base/l10n/l10n_util.h"
@ -492,12 +491,6 @@ void FrameCaptionButtonContainerView::SetHoveredAndPressedButtons(
}
}
aura::Window* FrameCaptionButtonContainerView::GetFrameWindow() {
aura::Window* window = frame_->GetNativeWindow();
return window->env()->mode() == aura::Env::Mode::MUS ? window->GetRootWindow()
: window;
}
bool FrameCaptionButtonContainerView::CanSnap() {
return SnapController::Get()->CanSnap(frame_->GetNativeWindow());
}

@ -136,7 +136,6 @@ class ASH_PUBLIC_EXPORT FrameCaptionButtonContainerView
void SetHoveredAndPressedButtons(
const views::FrameCaptionButton* to_hover,
const views::FrameCaptionButton* to_press) override;
aura::Window* GetFrameWindow() override;
bool CanSnap() override;
void ShowSnapPreview(SnapDirection snap) override;
void CommitSnap(SnapDirection snap) override;

@ -212,7 +212,7 @@ void FrameSizeButton::AnimateButtonsToSnapMode() {
// Start observing the to-be-snapped window.
snapping_window_observer_ = std::make_unique<SnappingWindowObserver>(
delegate_->GetFrameWindow(), this);
GetWidget()->GetNativeWindow(), this);
}
void FrameSizeButton::SetButtonsToSnapMode(

@ -8,10 +8,6 @@
#include "ash/public/cpp/ash_public_export.h"
#include "ui/views/window/caption_button_types.h"
namespace aura {
class Window;
}
namespace gfx {
class Point;
}
@ -53,9 +49,6 @@ class ASH_PUBLIC_EXPORT FrameSizeButtonDelegate {
const views::FrameCaptionButton* to_hover,
const views::FrameCaptionButton* to_press) = 0;
// Returns the top level aura::Window that the buttons act on.
virtual aura::Window* GetFrameWindow() = 0;
// Thunks to methods of the same name in FrameCaptionDelegate.
virtual bool CanSnap() = 0;
virtual void ShowSnapPreview(SnapDirection snap) = 0;

@ -317,10 +317,7 @@ void ImmersiveFullscreenController::EnableEventObservers(bool enable) {
event_observers_enabled_ = enable;
aura::Window* window = widget_->GetNativeWindow();
// For Mash, handle events sent to the Mus client's root window.
if (window->env()->mode() == aura::Env::Mode::MUS)
window = window->GetRootWindow();
aura::Env* env = window->env();
aura::Env* env = aura::Env::GetInstance();
if (enable) {
immersive_focus_watcher_ = std::make_unique<ImmersiveFocusWatcher>(this);
std::set<ui::EventType> types = {

@ -11,7 +11,6 @@
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/ui_base_paths.h"
#include "ui/base/ui_base_switches.h"
#include "ui/gl/gl_switches.h"
@ -60,10 +59,7 @@ void AshTestSuite::Initialize() {
}
base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_);
// Simulate what happens with single-process-mash.
env_ = aura::Env::CreateInstance(::features::IsSingleProcessMash()
? aura::Env::Mode::MUS
: aura::Env::Mode::LOCAL);
env_ = aura::Env::CreateInstance();
}
void AshTestSuite::Shutdown() {

@ -148,7 +148,6 @@
#include "services/identity/public/cpp/identity_manager.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/icu/source/common/unicode/locid.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/base/ime/chromeos/extension_ime_util.h"
#include "ui/base/ime/chromeos/input_method_descriptor.h"
#include "ui/base/ime/chromeos/input_method_manager.h"
@ -249,9 +248,6 @@ const char kFakeOncWithCertificate[] =
"]}";
bool IsLogoutConfirmationDialogShowing() {
// Wait for any browser window close mojo messages to propagate to ash.
aura::test::WaitForAllChangesToComplete();
// TODO(mash): Add mojo test API for this.
return !!ash::Shell::Get()
->logout_confirmation_controller()

@ -4,15 +4,9 @@
#include "chrome/browser/fullscreen.h"
#include "ui/aura/env.h"
#include "base/logging.h"
bool IsFullScreenMode() {
if (aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS) {
// TODO: http://crbug.com/640390.
NOTIMPLEMENTED();
return false;
}
// TODO: https://crbug.com/843018
NOTIMPLEMENTED();
return false;

@ -37,10 +37,6 @@
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#if defined(OS_CHROMEOS)
#include "ui/aura/env.h"
#endif
namespace printing {
namespace {
@ -578,12 +574,6 @@ IN_PROC_BROWSER_TEST_F(IsolateOriginsPrintBrowserTest, OopifPrinting) {
// Printing an extension option page.
// The test should not crash or timeout.
IN_PROC_BROWSER_TEST_F(PrintExtensionBrowserTest, PrintOptionPage) {
#if defined(OS_CHROMEOS)
// Mus can not support this test now https://crbug.com/823782.
if (aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS)
return;
#endif
LoadExtensionAndNavigateToOptionPage();
PrintAndWaitUntilPreviewIsReady(/*print_only_selection=*/false);
}
@ -592,12 +582,6 @@ IN_PROC_BROWSER_TEST_F(PrintExtensionBrowserTest, PrintOptionPage) {
// The test should not crash or timeout.
IN_PROC_BROWSER_TEST_F(SitePerProcessPrintExtensionBrowserTest,
PrintOptionPage) {
#if defined(OS_CHROMEOS)
// Mus can not support this test now https://crbug.com/823782.
if (aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS)
return;
#endif
LoadExtensionAndNavigateToOptionPage();
PrintAndWaitUntilPreviewIsReady(/*print_only_selection=*/false);
}

@ -24,7 +24,6 @@
#include "services/service_manager/public/cpp/connector.h"
#include "services/ws/public/mojom/window_tree_constants.mojom.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
#include "ui/base/ui_base_features.h"
@ -49,13 +48,6 @@ class MaximizableWidgetDelegate : public views::WidgetDelegateView {
DISALLOW_COPY_AND_ASSIGN(MaximizableWidgetDelegate);
};
// Tells Ash to toggle fullscreen as if the user had pressed the hardware
// fullscreen key.
void ToggleFullscreen() {
ash::ShellTestApi().ToggleFullscreen();
aura::test::WaitForAllChangesToComplete();
}
bool IsInImmersive(aura::Window* window) {
aura::Window* toplevel =
features::IsUsingWindowService() ? window->GetRootWindow() : window;
@ -107,24 +99,20 @@ IN_PROC_BROWSER_TEST_P(AcceleratorCommandsFullscreenBrowserTest,
SetToInitialShowState(widget);
EXPECT_TRUE(IsInitialShowState(widget));
// Wait for Ash to become aware of active widget.
aura::test::WaitForAllChangesToComplete();
ToggleFullscreen();
ash::ShellTestApi().ToggleFullscreen();
EXPECT_TRUE(IsInImmersive(window));
ToggleFullscreen();
ash::ShellTestApi().ToggleFullscreen();
EXPECT_FALSE(IsInImmersive(window));
EXPECT_TRUE(IsInitialShowState(widget));
// 2) ToggleFullscreen() should have no effect on windows which cannot be
// maximized.
// 2) ash::ShellTestApi().ToggleFullscreen() should have no effect on windows
// which cannot be maximized.
aura::Window* toplevel =
features::IsUsingWindowService() ? window->GetRootWindow() : window;
toplevel->SetProperty(aura::client::kResizeBehaviorKey,
ws::mojom::kResizeBehaviorNone);
aura::test::WaitForAllChangesToComplete();
ToggleFullscreen();
ash::ShellTestApi().ToggleFullscreen();
EXPECT_TRUE(IsInitialShowState(widget));
// 3) Hosted apps.
@ -142,13 +130,10 @@ IN_PROC_BROWSER_TEST_P(AcceleratorCommandsFullscreenBrowserTest,
SetToInitialShowState(widget);
EXPECT_TRUE(IsInitialShowState(widget));
// Wait for Ash to become aware of active widget.
aura::test::WaitForAllChangesToComplete();
ToggleFullscreen();
ash::ShellTestApi().ToggleFullscreen();
EXPECT_TRUE(IsInImmersive(window));
ToggleFullscreen();
ash::ShellTestApi().ToggleFullscreen();
EXPECT_FALSE(IsInImmersive(window));
EXPECT_TRUE(IsInitialShowState(widget));
@ -165,13 +150,10 @@ IN_PROC_BROWSER_TEST_P(AcceleratorCommandsFullscreenBrowserTest,
SetToInitialShowState(widget);
EXPECT_TRUE(IsInitialShowState(widget));
// Wait for Ash to become aware of active widget.
aura::test::WaitForAllChangesToComplete();
ToggleFullscreen();
ash::ShellTestApi().ToggleFullscreen();
EXPECT_TRUE(IsInImmersive(window));
ToggleFullscreen();
ash::ShellTestApi().ToggleFullscreen();
EXPECT_FALSE(IsInImmersive(window));
EXPECT_TRUE(IsInitialShowState(widget));
@ -189,13 +171,10 @@ IN_PROC_BROWSER_TEST_P(AcceleratorCommandsFullscreenBrowserTest,
SetToInitialShowState(widget);
EXPECT_TRUE(IsInitialShowState(widget));
// Wait for Ash to become aware of active widget.
aura::test::WaitForAllChangesToComplete();
ToggleFullscreen();
ash::ShellTestApi().ToggleFullscreen();
EXPECT_TRUE(IsInImmersive(window));
ToggleFullscreen();
ash::ShellTestApi().ToggleFullscreen();
EXPECT_FALSE(IsInImmersive(window));
EXPECT_TRUE(IsInitialShowState(widget));
@ -261,14 +240,11 @@ IN_PROC_BROWSER_TEST_P(AcceleratorCommandsPlatformAppFullscreenBrowserTest,
ASSERT_TRUE(app_window->GetBaseWindow()->IsActive());
EXPECT_TRUE(IsInitialShowState(app_window));
// Wait for Ash to become aware of active widget.
aura::test::WaitForAllChangesToComplete();
ToggleFullscreen();
ash::ShellTestApi().ToggleFullscreen();
EXPECT_TRUE(native_app_window->IsFullscreen());
EXPECT_TRUE(IsInImmersive(native_app_window->GetNativeWindow()));
ToggleFullscreen();
ash::ShellTestApi().ToggleFullscreen();
EXPECT_FALSE(native_app_window->IsFullscreen());
EXPECT_TRUE(IsInitialShowState(app_window));
@ -288,14 +264,11 @@ IN_PROC_BROWSER_TEST_P(AcceleratorCommandsPlatformAppFullscreenBrowserTest,
SetToInitialShowState(app_window);
EXPECT_TRUE(IsInitialShowState(app_window));
// Wait for Ash to become aware of active widget.
aura::test::WaitForAllChangesToComplete();
ToggleFullscreen();
ash::ShellTestApi().ToggleFullscreen();
EXPECT_TRUE(native_app_window->IsFullscreen());
EXPECT_FALSE(IsInImmersive(native_app_window->GetNativeWindow()));
ToggleFullscreen();
ash::ShellTestApi().ToggleFullscreen();
EXPECT_FALSE(native_app_window->IsFullscreen());
EXPECT_TRUE(IsInitialShowState(app_window));

@ -21,7 +21,6 @@
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/value_builder.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/ime/dummy_text_input_client.h"
#include "ui/base/ime/init/input_method_factory.h"
@ -159,13 +158,6 @@ class KeyboardControllerWebContentTest : public InProcessBrowserTest {
// Mock window.resizeTo that is expected to be called after navigate to a
// new virtual keyboard.
keyboard_controller->GetKeyboardWindow()->SetBounds(init_bounds);
// SetBounds() of the keyboard window in this context will end up with
// invisible bounds so that the virtual keyboard isn't going to be visible
// in this context. We need to wait for the processing of this bounds
// change, otherwise further SetBounds invocations in
// FocusEditableNodeeAndShowKeyboard() will be ignored.
aura::test::WaitForAllChangesToComplete();
}
private:

@ -16,7 +16,6 @@
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/test/browser_test_utils.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/aura/window_tree_host.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
@ -345,7 +344,6 @@ class KeyboardEndToEndOverscrollTest : public KeyboardEndToEndTest {
IN_PROC_BROWSER_TEST_F(KeyboardEndToEndOverscrollTest,
ToggleKeyboardOnMaximizedWindowAffectsViewport) {
browser()->window()->Maximize();
aura::test::WaitForAllChangesToComplete();
const int old_height = GetViewportHeight(web_contents_);
@ -368,7 +366,6 @@ IN_PROC_BROWSER_TEST_F(
gfx::Size screen_bounds = GetScreenBounds();
browser()->window()->SetBounds(
gfx::Rect(0, 0, screen_bounds.width(), screen_bounds.height() / 2));
aura::test::WaitForAllChangesToComplete();
const int old_height = GetViewportHeight(web_contents_);
@ -393,8 +390,6 @@ IN_PROC_BROWSER_TEST_F(
browser()->window()->SetBounds(gfx::Rect(0, screen_bounds.height() / 2,
screen_bounds.width(),
screen_bounds.height() / 2));
aura::test::WaitForAllChangesToComplete();
const auto old_browser_bounds = browser()->window()->GetBounds();
const int old_height = GetViewportHeight(web_contents_);
@ -423,8 +418,6 @@ IN_PROC_BROWSER_TEST_F(
browser()->window()->SetBounds(gfx::Rect(0, screen_bounds.height() / 3,
screen_bounds.width(),
screen_bounds.height() / 3 * 2));
aura::test::WaitForAllChangesToComplete();
const auto old_browser_bounds = browser()->window()->GetBounds();
const int old_height = GetViewportHeight(web_contents_);

@ -71,7 +71,6 @@
#include "extensions/test/extension_test_message_listener.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/aura/window.h"
#include "ui/base/base_window.h"
#include "ui/base/window_open_disposition.h"
@ -92,10 +91,7 @@ namespace {
ash::ShelfAction SelectItem(const ash::ShelfID& id,
ui::EventType event_type = ui::ET_MOUSE_PRESSED,
int64_t display_id = display::kInvalidDisplayId) {
ash::ShelfAction action = SelectShelfItem(id, event_type, display_id);
// Wait for window manager to stabilize.
aura::test::WaitForAllChangesToComplete();
return action;
return SelectShelfItem(id, event_type, display_id);
}
class TestEvent : public ui::Event {
@ -139,30 +135,6 @@ void CloseBrowserWindow(Browser* browser,
close_observer.Wait();
}
// Activates a window. Waits until ash and ui services are aware of the change.
void ActivateWindow(ui::BaseWindow* window) {
window->Activate();
aura::test::WaitForAllChangesToComplete();
}
// Maximizes a window. Waits until ash and ui services are aware of the change.
void MaximizeWindow(ui::BaseWindow* window) {
window->Maximize();
aura::test::WaitForAllChangesToComplete();
}
// Minimizes a window. Waits until ash and ui services are aware of the change.
void MinimizeWindow(ui::BaseWindow* window) {
window->Minimize();
aura::test::WaitForAllChangesToComplete();
}
// Restores a window. Waits until ash and ui services are aware of the change.
void RestoreWindow(ui::BaseWindow* window) {
window->Restore();
aura::test::WaitForAllChangesToComplete();
}
int64_t GetDisplayIdForBrowserWindow(BrowserWindow* window) {
return display::Screen::GetScreen()
->GetDisplayNearestWindow(window->GetNativeWindow())
@ -395,7 +367,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPinned) {
// Open a window. Confirm the item is now running.
AppWindow* window = CreateAppWindow(browser()->profile(), extension);
ActivateWindow(window->GetBaseWindow());
window->GetBaseWindow()->Activate();
ASSERT_EQ(item_count, shelf_model()->item_count());
item = *shelf_model()->ItemByID(shortcut_id);
EXPECT_EQ(ash::TYPE_PINNED_APP, item.type);
@ -476,7 +448,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, UnpinRunning) {
// Open a window. Confirm the item is now running.
AppWindow* window = CreateAppWindow(browser()->profile(), extension);
ActivateWindow(window->GetBaseWindow());
window->GetBaseWindow()->Activate();
ASSERT_EQ(item_count, shelf_model()->item_count());
item = *shelf_model()->ItemByID(shortcut_id);
EXPECT_EQ(ash::TYPE_PINNED_APP, item.type);
@ -612,7 +584,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowActivation) {
// Add window for app1. This will activate it.
AppWindow* window1b = CreateAppWindow(browser()->profile(), extension1);
ActivateWindow(window1b->GetBaseWindow());
window1b->GetBaseWindow()->Activate();
EXPECT_FALSE(window1->GetBaseWindow()->IsActive());
EXPECT_FALSE(window2->GetBaseWindow()->IsActive());
EXPECT_TRUE(window1b->GetBaseWindow()->IsActive());
@ -674,13 +646,13 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest,
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
// Maximizing a window should preserve state after minimize + click.
MaximizeWindow(window1->GetBaseWindow());
MinimizeWindow(window1->GetBaseWindow());
window1->GetBaseWindow()->Maximize();
window1->GetBaseWindow()->Minimize();
SelectItem(item.id);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized());
RestoreWindow(window1->GetBaseWindow());
window1->GetBaseWindow()->Restore();
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
EXPECT_FALSE(window1->GetBaseWindow()->IsMaximized());
@ -725,7 +697,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) {
EXPECT_EQ(ash::TYPE_APP, item.type);
EXPECT_EQ(ash::STATUS_RUNNING, item.status);
ActivateWindow(browser()->window());
browser()->window()->Activate();
EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status);
}
@ -851,7 +823,6 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchAppFromDisplayWithoutFocus0) {
// Ensures browser 2 is above browser 1 in display 1.
browser_list->SetLastActive(browser2);
browser_list->SetLastActive(browser0);
aura::test::WaitForAllChangesToComplete();
EXPECT_EQ(browser_list->size(), 3U);
EXPECT_EQ(displays[0].id(), GetDisplayIdForBrowserWindow(browser0->window()));
EXPECT_EQ(displays[1].id(), GetDisplayIdForBrowserWindow(browser1->window()));
@ -894,7 +865,6 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchAppFromDisplayWithoutFocus1) {
BrowserList* browser_list = BrowserList::GetInstance();
Browser* browser0 = browser();
browser0->window()->SetBounds(displays[0].work_area());
aura::test::WaitForAllChangesToComplete();
EXPECT_EQ(browser_list->size(), 1U);
EXPECT_EQ(displays[0].id(), GetDisplayIdForBrowserWindow(browser0->window()));
EXPECT_EQ(browser0->tab_strip_model()->count(), 1);
@ -943,13 +913,13 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchInBackground) {
// Confirm that clicking a icon for an app running in one of 2 maximized windows
// activates the right window.
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchMaximized) {
MaximizeWindow(browser()->window());
browser()->window()->Maximize();
// Load about:blank in a new window.
Browser* browser2 = CreateBrowser(browser()->profile());
EXPECT_NE(browser(), browser2);
TabStripModel* tab_strip = browser2->tab_strip_model();
int tab_count = tab_strip->count();
MaximizeWindow(browser2->window());
browser2->window()->Maximize();
ash::ShelfID shortcut_id = CreateShortcut("app1");
SelectItem(shortcut_id);
@ -957,7 +927,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchMaximized) {
EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(shortcut_id)->status);
// Activate the first browser window.
ActivateWindow(browser()->window());
browser()->window()->Activate();
EXPECT_FALSE(browser2->window()->IsActive());
// Selecting the shortcut activates the second window.
@ -1164,7 +1134,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, AppWindowRestoreBehaviorTest) {
ASSERT_TRUE(app_browser);
BrowserWindow* window = app_browser->window();
EXPECT_FALSE(window->IsMaximized());
MaximizeWindow(window);
window->Maximize();
EXPECT_TRUE(window->IsMaximized());
CloseAppBrowserWindow(app_browser);
@ -1177,7 +1147,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, AppWindowRestoreBehaviorTest) {
window = app_browser->window();
EXPECT_TRUE(window->IsMaximized());
RestoreWindow(window);
window->Restore();
EXPECT_FALSE(window->IsMaximized());
app_browser->window()->Close();
CloseAppBrowserWindow(app_browser);
@ -1648,7 +1618,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser,
// Minimize Window.
Browser* browser = chrome::FindLastActive();
ASSERT_TRUE(browser);
MinimizeWindow(browser->window());
browser->window()->Minimize();
EXPECT_TRUE(browser->window()->IsMinimized());
// Activate again. This doesn't create new browser, it activates the window.

@ -116,7 +116,6 @@
#include "services/network/test/test_network_connection_tracker.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/window_parenting_client.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/aura/window.h"
#include "ui/base/models/menu_model.h"
#include "ui/base/resource/resource_bundle.h"

@ -62,7 +62,6 @@
#include "services/ws/common/util.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/env_test_helper.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/ui_base_features.h"
@ -134,14 +133,8 @@ class MultiProfileSupportTest : public ChromeAshTestBase {
protected:
void SwitchActiveUser(const AccountId& id) {
// WaitForAllChangesToComplete() does nothing in classic mode.
// WaitForAllChangesToComplete() is called before and after to ensure all
// changes have been pushed to ash before a switch, and similarly after a
// switch.
aura::test::WaitForAllChangesToComplete();
fake_user_manager_->SwitchActiveUser(id);
ash::MultiUserWindowManagerImpl::Get()->OnActiveUserSessionChanged(id);
aura::test::WaitForAllChangesToComplete();
}
// Set up the test environment for this many windows.

@ -19,7 +19,6 @@
#include "components/user_manager/user_names.h"
#include "content/public/common/service_manager_connection.h"
#include "services/service_manager/public/cpp/connector.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"

@ -9,7 +9,6 @@
#include "content/public/common/service_manager_connection.h"
#include "services/service_manager/public/cpp/connector.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
namespace test {
@ -53,7 +52,6 @@ void SetAndWaitForTabletMode(bool enabled) {
TestTabletModeClientObserver observer(enabled);
observer.run_loop()->Run();
aura::test::WaitForAllChangesToComplete();
ASSERT_EQ(enabled, TabletModeClient::Get()->tablet_mode_enabled());
}

@ -83,7 +83,6 @@
#include "services/ws/public/mojom/window_tree_constants.mojom.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/env_test_helper.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/base/class_property.h"
#include "ui/base/hit_test.h"
#include "ui/base/test/material_design_controller_test_api.h"

@ -30,7 +30,6 @@
#include "net/cert/mock_cert_verifier.h"
#include "services/service_manager/public/cpp/connector.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/views/animation/test/ink_drop_host_view_test_api.h"
#include "ui/views/window/frame_caption_button.h"
@ -226,7 +225,6 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshHostedAppBrowserTest,
// Verify that after minimizing, immersive mode is disabled.
browser()->window()->Minimize();
aura::test::WaitForAllChangesToComplete();
EXPECT_TRUE(browser()->window()->IsMinimized());
EXPECT_FALSE(controller()->IsEnabled());

@ -84,8 +84,6 @@
#include "services/service_manager/public/cpp/connector.h"
#include "ui/aura/client/cursor_client.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/mus/window_mus.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/ui_base_features.h"
#include "ui/display/manager/display_manager.h"
@ -154,9 +152,6 @@ class QuitDraggingObserver : public content::NotificationObserver {
void Wait() {
run_loop_.Run();
#if defined(OS_CHROMEOS)
aura::test::WaitForAllChangesToComplete();
#endif
}
private:
@ -227,9 +222,6 @@ void TabDragControllerTest::AddTabAndResetBrowser(Browser* browser) {
AddBlankTabAndShow(browser);
StopAnimating(GetTabStripForBrowser(browser));
ResetIDs(browser->tab_strip_model(), 0);
#if defined(OS_CHROMEOS)
aura::test::WaitForAllChangesToComplete();
#endif
}
Browser* TabDragControllerTest::CreateAnotherBrowserAndResize() {
@ -246,9 +238,6 @@ Browser* TabDragControllerTest::CreateAnotherBrowserAndResize() {
browser()->window()->SetBounds(browser_rect);
browser_rect.set_x(browser_rect.right());
browser2->window()->SetBounds(browser_rect);
#if defined(OS_CHROMEOS)
aura::test::WaitForAllChangesToComplete();
#endif
return browser2;
}
@ -425,7 +414,6 @@ class DetachToBrowserTabDragControllerTest
// tests' touch events.
ui::GestureConfiguration::GetInstance()->set_min_fling_velocity(
std::numeric_limits<float>::max());
aura::test::WaitForAllChangesToComplete();
#endif
#if defined(OS_MACOSX)
// Currently MacViews' browser windows are shown in the background and could
@ -1074,7 +1062,6 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
// Forcively reveal the tabstrip immediately.
std::unique_ptr<ImmersiveRevealedLock> lock(
controller->GetRevealedLock(ImmersiveModeController::ANIMATE_REVEAL_NO));
aura::test::WaitForAllChangesToComplete();
// Add another tab.
AddTabAndResetBrowser(browser());
@ -1750,7 +1737,6 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
browser()->window()->SetBounds(browser()->window()->GetBounds() +
gfx::Vector2d(100, 50));
browser()->window()->Maximize();
aura::test::WaitForAllChangesToComplete();
DragWindowAndVerifyOffset(this, GetTabStripForBrowser(browser()), 0);
ASSERT_FALSE(TabDragController::IsActive());
@ -2355,10 +2341,6 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
display::Screen* screen = display::Screen::GetScreen();
Display second_display = ui_test_utils::GetSecondaryDisplay(screen);
browser2->window()->SetBounds(second_display.work_area());
// In Mash, the display change as the result of the bounds change is processed
// asynchronously in the window server, it should wait for those changes to
// complete.
aura::test::WaitForAllChangesToComplete();
EXPECT_EQ(
second_display.id(),
screen->GetDisplayNearestWindow(browser2->window()->GetNativeWindow())
@ -2477,8 +2459,6 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
// Sanity check: second browser should still be on the second display.
ASSERT_LT(work_area.x(), second_display.work_area().right());
browser2->window()->SetBounds(work_area);
// Wait for the display changes. See the earlier comments for the details.
aura::test::WaitForAllChangesToComplete();
EXPECT_EQ(
second_display.id(),
screen->GetDisplayNearestWindow(browser()->window()->GetNativeWindow())
@ -2599,8 +2579,6 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
display::Screen* screen = display::Screen::GetScreen();
const std::pair<Display, Display> displays = GetDisplays(screen);
browser2->window()->SetBounds(displays.second.work_area());
// Wait for the display changes. See the earlier comments for the details.
aura::test::WaitForAllChangesToComplete();
EXPECT_EQ(
displays.second.id(),
screen->GetDisplayNearestWindow(browser2->window()->GetNativeWindow())
@ -2861,8 +2839,6 @@ IN_PROC_BROWSER_TEST_P(
.id());
browser()->window()->SetBounds(displays.second.work_area());
// Wait for the display changes. See the earlier comments for the details.
aura::test::WaitForAllChangesToComplete();
EXPECT_EQ(
displays.second.id(),
screen->GetDisplayNearestWindow(browser()->window()->GetNativeWindow())

@ -23,7 +23,6 @@
#include "content/public/common/web_preferences.h"
#include "services/service_manager/public/cpp/connector.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/base/ui_base_features.h"
#include "url/gurl.h"
@ -34,15 +33,6 @@ namespace {
constexpr char kTestUser[] = "test-user@gmail.com";
constexpr char kTestUserGaiaId[] = "1234567890";
// Returns whether a system modal window (e.g. modal dialog) is open. Blocks
// until the ash service responds.
bool IsSystemModalWindowOpen() {
// Wait for window visibility to stabilize.
aura::test::WaitForAllChangesToComplete();
return ash::ShellTestApi().IsSystemModalWindowOpen();
}
class MockSystemWebDialog : public SystemWebDialogDelegate {
public:
explicit MockSystemWebDialog(const char* id = nullptr)
@ -77,7 +67,7 @@ class SystemWebDialogLoginTest : public LoginManagerTest {
IN_PROC_BROWSER_TEST_F(SystemWebDialogLoginTest, ModalTest) {
auto* dialog = new MockSystemWebDialog();
dialog->ShowSystemDialog();
EXPECT_TRUE(IsSystemModalWindowOpen());
EXPECT_TRUE(ash::ShellTestApi().IsSystemModalWindowOpen());
}
IN_PROC_BROWSER_TEST_F(SystemWebDialogLoginTest, PRE_NonModalTest) {
@ -90,7 +80,7 @@ IN_PROC_BROWSER_TEST_F(SystemWebDialogLoginTest, NonModalTest) {
LoginUser(AccountId::FromUserEmailGaiaId(kTestUser, kTestUserGaiaId));
auto* dialog = new MockSystemWebDialog();
dialog->ShowSystemDialog();
EXPECT_FALSE(IsSystemModalWindowOpen());
EXPECT_FALSE(ash::ShellTestApi().IsSystemModalWindowOpen());
aura::Window* window_to_test = dialog->dialog_window();
// In Mash, the AlwaysOnTop property will be set on the parent.
if (::features::IsUsingWindowService())

@ -99,7 +99,6 @@
#include "chromeos/services/device_sync/device_sync_impl.h"
#include "chromeos/services/device_sync/fake_device_sync.h"
#include "components/user_manager/user_names.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/events/test/event_generator.h"
#endif // defined(OS_CHROMEOS)
@ -386,9 +385,6 @@ void InProcessBrowserTest::CloseBrowserSynchronously(Browser* browser) {
chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(browser));
CloseBrowserAsynchronously(browser);
observer.Wait();
#if defined(OS_CHROMEOS)
aura::test::WaitForAllChangesToComplete();
#endif
}
void InProcessBrowserTest::CloseBrowserAsynchronously(Browser* browser) {

@ -80,10 +80,8 @@ class TouchSelectionControllerClientAura::EnvEventObserver
// Check IsMouseEventsEnabled, except on Mus, where it's disabled on touch
// events in this client, but not re-enabled on mouse events elsewhere.
auto* cursor = aura::client::GetCursorClient(window_->GetRootWindow());
if (cursor && !cursor->IsMouseEventsEnabled() &&
aura::Env::GetInstance()->mode() != aura::Env::Mode::MUS) {
if (cursor && !cursor->IsMouseEventsEnabled())
return;
}
// Windows OS unhandled WM_POINTER* may be redispatched as WM_MOUSE*.
// Avoid adjusting the handles on synthesized events or events generated

@ -167,7 +167,6 @@
#endif
#if defined(OS_CHROMEOS)
#include "ui/aura/env.h"
#include "ui/aura/test/test_screen.h"
#endif
@ -962,9 +961,6 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest,
#if defined(OS_CHROMEOS)
IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
SubframeUpdateToCorrectDeviceScaleFactor) {
if (aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS)
return;
GURL main_url(embedded_test_server()->GetURL(
"a.com", "/cross_site_iframe_factory.html?a(b)"));
EXPECT_TRUE(NavigateToURL(shell(), main_url));

@ -226,10 +226,6 @@ class TouchSelectionControllerImpl::EditingHandleView
targeter_ = new aura::WindowTargeter();
aura::Window* window = widget_->GetNativeWindow();
// For Mus clients, adjust targeting of the handle's client root window,
// constructed by the window server for the handle's "content" window.
if (window->env()->mode() == aura::Env::Mode::MUS)
window = window->GetRootWindow();
window->SetEventTargeter(std::unique_ptr<aura::WindowTargeter>(targeter_));
// We are owned by the TouchSelectionControllerImpl.
@ -639,14 +635,10 @@ void TouchSelectionControllerImpl::OnWidgetBoundsChanged(
void TouchSelectionControllerImpl::OnEvent(const ui::Event& event) {
if (event.IsMouseEvent()) {
// Check IsMouseEventsEnabled, except on Mus, where it's disabled on touch
// events in this client, but not re-enabled on mouse events elsewhere.
auto* cursor = aura::client::GetCursorClient(
client_view_->GetNativeView()->GetRootWindow());
if (cursor && !cursor->IsMouseEventsEnabled() &&
aura::Env::GetInstance()->mode() != aura::Env::Mode::MUS) {
if (cursor && !cursor->IsMouseEventsEnabled())
return;
}
// Windows OS unhandled WM_POINTER* may be redispatched as WM_MOUSE*.
// Avoid adjusting the handles on synthesized events or events generated

@ -6,7 +6,6 @@
#include "content/public/browser/context_factory.h"
#include "content/public/common/service_manager_connection.h"
#include "content/shell/browser/shell_browser_context.h"
#include "ui/aura/env.h"
#include "ui/aura/test/test_screen.h"
#include "ui/aura/window.h"
#include "ui/display/screen.h"
@ -51,14 +50,10 @@ void ViewsContentClientMainPartsChromeOS::PreMainMessageLoopRun() {
test_screen_.reset(aura::TestScreen::Create(host_size));
display::Screen::SetScreenInstance(test_screen_.get());
// Set up basic pieces of views::corewm.
ui::ContextFactory* ui_context_factory =
aura::Env::GetInstance()->mode() == aura::Env::Mode::LOCAL
? content::GetContextFactory()
: nullptr;
wm_test_helper_ = std::make_unique<wm::WMTestHelper>(
host_size,
content::ServiceManagerConnection::GetForProcess()->GetConnector(),
ui_context_factory);
content::GetContextFactory());
// Ensure the X window gets mapped.
wm_test_helper_->host()->Show();