Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Unified Diff: ash/common/wm_window_unittest.cc

Issue 2699033002: Replace WmWindowObserver with aura::WindowObserver. (Closed)
Patch Set: Check for null images in ShelfWindowWatcher. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/wm_window_tracker.h ('k') | ash/common/wm_window_user_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm_window_unittest.cc
diff --git a/ash/common/wm_window_unittest.cc b/ash/common/wm_window_unittest.cc
index 58dd29d6092a2c77680be9012d26b96c47e98160..2cbe55360e6a68f94756fd100cfe3cd211b72b73 100644
--- a/ash/common/wm_window_unittest.cc
+++ b/ash/common/wm_window_unittest.cc
@@ -7,7 +7,8 @@
#include <memory>
#include "ash/common/test/ash_test.h"
-#include "ash/common/wm_window_observer.h"
+#include "ui/aura/window.h"
+#include "ui/aura/window_observer.h"
namespace ash {
@@ -16,17 +17,17 @@ using WmWindowTest = AshTest;
namespace {
// Tracks calls to OnWindowVisibilityChanged().
-class VisibilityObserver : public WmWindowObserver {
+class VisibilityObserver : public aura::WindowObserver {
public:
- // Attaches a WmWindowObserver to |window_to_add_observer_to| and sets
+ // Attaches a aura::WindowObserver to |window_to_add_observer_to| and sets
// |last_observed_window_| and |last_observed_visible_value_| to the values
// of the last call to OnWindowVisibilityChanged().
explicit VisibilityObserver(WmWindow* window_to_add_observer_to)
: window_to_add_observer_to_(window_to_add_observer_to) {
- window_to_add_observer_to_->AddObserver(this);
+ window_to_add_observer_to_->aura_window()->AddObserver(this);
}
~VisibilityObserver() override {
- window_to_add_observer_to_->RemoveObserver(this);
+ window_to_add_observer_to_->aura_window()->RemoveObserver(this);
}
// The values last supplied to OnWindowVisibilityChanged().
@@ -35,9 +36,9 @@ class VisibilityObserver : public WmWindowObserver {
return last_observed_visible_value_;
}
- // WmWindowObserver:
- void OnWindowVisibilityChanged(WmWindow* window, bool visible) override {
- last_observed_window_ = window;
+ // aura::WindowObserver:
+ void OnWindowVisibilityChanged(aura::Window* window, bool visible) override {
+ last_observed_window_ = WmWindow::Get(window);
last_observed_visible_value_ = visible;
}
@@ -51,7 +52,8 @@ class VisibilityObserver : public WmWindowObserver {
} // namespace
-// Verifies OnWindowVisibilityChanged() is called on a WmWindowObserver attached
+// Verifies OnWindowVisibilityChanged() is called on a aura::WindowObserver
+// attached
// to the parent when the child window's visibility changes.
TEST_F(WmWindowTest, OnWindowVisibilityChangedCalledOnAncestor) {
std::unique_ptr<WindowOwner> window_owner = CreateTestWindow();
@@ -65,7 +67,8 @@ TEST_F(WmWindowTest, OnWindowVisibilityChangedCalledOnAncestor) {
EXPECT_FALSE(observer.last_observed_visible_value());
}
-// Verifies OnWindowVisibilityChanged() is called on a WmWindowObserver attached
+// Verifies OnWindowVisibilityChanged() is called on a aura::WindowObserver
+// attached
// to a child when the parent window's visibility changes.
TEST_F(WmWindowTest, OnWindowVisibilityChangedCalledOnChild) {
std::unique_ptr<WindowOwner> parent_window_owner = CreateTestWindow();
« no previous file with comments | « ash/common/wm_window_tracker.h ('k') | ash/common/wm_window_user_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698