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

Unified Diff: ash/wm/mru_window_tracker_unittest.cc

Issue 2852493002: chromeos: Converts more tests to AshTestBase (Closed)
Patch Set: Created 3 years, 8 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/system/screen_security/screen_tray_item_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/mru_window_tracker_unittest.cc
diff --git a/ash/wm/mru_window_tracker_unittest.cc b/ash/wm/mru_window_tracker_unittest.cc
index 9463941fd1ec23b86544e600569de5c0ebd7dd00..97364ca04aec61745ec4a96136af79419341a1b0 100644
--- a/ash/wm/mru_window_tracker_unittest.cc
+++ b/ash/wm/mru_window_tracker_unittest.cc
@@ -6,20 +6,22 @@
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h"
-#include "ash/test/ash_test.h"
+#include "ash/test/ash_test_base.h"
#include "ash/wm/window_state.h"
+#include "ash/wm/window_state_aura.h"
+#include "ash/wm/window_util.h"
#include "ash/wm_window.h"
#include "ui/base/hit_test.h"
namespace ash {
-class MruWindowTrackerTest : public AshTest {
+class MruWindowTrackerTest : public test::AshTestBase {
public:
MruWindowTrackerTest() {}
~MruWindowTrackerTest() override {}
- std::unique_ptr<WindowOwner> CreateTestWindow() {
- return AshTest::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
+ std::unique_ptr<aura::Window> CreateTestWindow() {
+ return AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
}
MruWindowTracker* mru_window_tracker() {
@@ -32,75 +34,66 @@ class MruWindowTrackerTest : public AshTest {
// Basic test that the activation order is tracked.
TEST_F(MruWindowTrackerTest, Basic) {
- std::unique_ptr<WindowOwner> w1_owner(CreateTestWindow());
- WmWindow* w1 = w1_owner->window();
- std::unique_ptr<WindowOwner> w2_owner(CreateTestWindow());
- WmWindow* w2 = w2_owner->window();
- std::unique_ptr<WindowOwner> w3_owner(CreateTestWindow());
- WmWindow* w3 = w3_owner->window();
- w3->Activate();
- w2->Activate();
- w1->Activate();
+ std::unique_ptr<aura::Window> w1(CreateTestWindow());
+ std::unique_ptr<aura::Window> w2(CreateTestWindow());
+ std::unique_ptr<aura::Window> w3(CreateTestWindow());
+ wm::ActivateWindow(w3.get());
+ wm::ActivateWindow(w2.get());
+ wm::ActivateWindow(w1.get());
WmWindow::Windows window_list = mru_window_tracker()->BuildMruWindowList();
ASSERT_EQ(3u, window_list.size());
- EXPECT_EQ(w1, window_list[0]);
- EXPECT_EQ(w2, window_list[1]);
- EXPECT_EQ(w3, window_list[2]);
+ EXPECT_EQ(w1.get(), window_list[0]->aura_window());
+ EXPECT_EQ(w2.get(), window_list[1]->aura_window());
+ EXPECT_EQ(w3.get(), window_list[2]->aura_window());
}
// Test that minimized windows are not treated specially.
TEST_F(MruWindowTrackerTest, MinimizedWindowsAreLru) {
- std::unique_ptr<WindowOwner> w1_owner(CreateTestWindow());
- WmWindow* w1 = w1_owner->window();
- std::unique_ptr<WindowOwner> w2_owner(CreateTestWindow());
- WmWindow* w2 = w2_owner->window();
- std::unique_ptr<WindowOwner> w3_owner(CreateTestWindow());
- WmWindow* w3 = w3_owner->window();
- std::unique_ptr<WindowOwner> w4_owner(CreateTestWindow());
- WmWindow* w4 = w4_owner->window();
- std::unique_ptr<WindowOwner> w5_owner(CreateTestWindow());
- WmWindow* w5 = w5_owner->window();
- std::unique_ptr<WindowOwner> w6_owner(CreateTestWindow());
- WmWindow* w6 = w6_owner->window();
- w6->Activate();
- w5->Activate();
- w4->Activate();
- w3->Activate();
- w2->Activate();
- w1->Activate();
-
- w1->GetWindowState()->Minimize();
- w4->GetWindowState()->Minimize();
- w5->GetWindowState()->Minimize();
+ std::unique_ptr<aura::Window> w1(CreateTestWindow());
+ std::unique_ptr<aura::Window> w2(CreateTestWindow());
+ std::unique_ptr<aura::Window> w3(CreateTestWindow());
+ std::unique_ptr<aura::Window> w4(CreateTestWindow());
+ std::unique_ptr<aura::Window> w5(CreateTestWindow());
+ std::unique_ptr<aura::Window> w6(CreateTestWindow());
+ wm::ActivateWindow(w6.get());
+ wm::ActivateWindow(w5.get());
+ wm::ActivateWindow(w4.get());
+ wm::ActivateWindow(w3.get());
+ wm::ActivateWindow(w2.get());
+ wm::ActivateWindow(w1.get());
+
+ wm::GetWindowState(w1.get())->Minimize();
+ wm::GetWindowState(w4.get())->Minimize();
+ wm::GetWindowState(w5.get())->Minimize();
// By minimizing the first window, we activate w2 which will move it to the
// front of the MRU queue.
- EXPECT_TRUE(w2->IsActive());
+ EXPECT_TRUE(wm::IsActiveWindow(w2.get()));
WmWindow::Windows window_list = mru_window_tracker()->BuildMruWindowList();
- EXPECT_EQ(w2, window_list[0]);
- EXPECT_EQ(w1, window_list[1]);
- EXPECT_EQ(w3, window_list[2]);
- EXPECT_EQ(w4, window_list[3]);
- EXPECT_EQ(w5, window_list[4]);
- EXPECT_EQ(w6, window_list[5]);
+ EXPECT_EQ(w2.get(), window_list[0]->aura_window());
+ EXPECT_EQ(w1.get(), window_list[1]->aura_window());
+ EXPECT_EQ(w3.get(), window_list[2]->aura_window());
+ EXPECT_EQ(w4.get(), window_list[3]->aura_window());
+ EXPECT_EQ(w5.get(), window_list[4]->aura_window());
+ EXPECT_EQ(w6.get(), window_list[5]->aura_window());
}
// Tests that windows being dragged are only in the WindowList once.
TEST_F(MruWindowTrackerTest, DraggedWindowsInListOnlyOnce) {
- std::unique_ptr<WindowOwner> w1_owner(CreateTestWindow());
- WmWindow* w1 = w1_owner->window();
- w1->Activate();
+ std::unique_ptr<aura::Window> w1(CreateTestWindow());
+ wm::ActivateWindow(w1.get());
// Start dragging the window.
- w1->GetWindowState()->CreateDragDetails(
+ wm::GetWindowState(w1.get())->CreateDragDetails(
gfx::Point(), HTRIGHT, aura::client::WINDOW_MOVE_SOURCE_TOUCH);
// The dragged window should only be in the list once.
WmWindow::Windows window_list =
mru_window_tracker()->BuildWindowListIgnoreModal();
- EXPECT_EQ(1, std::count(window_list.begin(), window_list.end(), w1));
+ EXPECT_EQ(1, std::count(window_list.begin(), window_list.end(),
+ WmWindow::Get(w1.get())));
}
} // namespace ash
« no previous file with comments | « ash/system/screen_security/screen_tray_item_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698