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

Side by Side Diff: ash/common/shelf/shelf_window_watcher_unittest.cc

Issue 2761373002: Move yet more from WmShell to Shell (Closed)
Patch Set: merge Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « ash/common/shelf/shelf_window_watcher_item_delegate.cc ('k') | ash/common/shelf/wm_shelf.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/shelf/shelf_window_watcher.h" 5 #include "ash/common/shelf/shelf_window_watcher.h"
6 6
7 #include "ash/common/session/session_controller.h" 7 #include "ash/common/session/session_controller.h"
8 #include "ash/common/shelf/shelf_model.h" 8 #include "ash/common/shelf/shelf_model.h"
9 #include "ash/common/wm/window_resizer.h" 9 #include "ash/common/wm/window_resizer.h"
10 #include "ash/common/wm/window_state.h" 10 #include "ash/common/wm/window_state.h"
(...skipping 11 matching lines...) Expand all
22 22
23 namespace ash { 23 namespace ash {
24 24
25 class ShelfWindowWatcherTest : public test::AshTestBase { 25 class ShelfWindowWatcherTest : public test::AshTestBase {
26 public: 26 public:
27 ShelfWindowWatcherTest() : model_(nullptr) {} 27 ShelfWindowWatcherTest() : model_(nullptr) {}
28 ~ShelfWindowWatcherTest() override {} 28 ~ShelfWindowWatcherTest() override {}
29 29
30 void SetUp() override { 30 void SetUp() override {
31 test::AshTestBase::SetUp(); 31 test::AshTestBase::SetUp();
32 model_ = WmShell::Get()->shelf_model(); 32 model_ = Shell::Get()->shelf_model();
33 } 33 }
34 34
35 void TearDown() override { 35 void TearDown() override {
36 model_ = nullptr; 36 model_ = nullptr;
37 test::AshTestBase::TearDown(); 37 test::AshTestBase::TearDown();
38 } 38 }
39 39
40 static ShelfID CreateShelfItem(WmWindow* window) { 40 static ShelfID CreateShelfItem(WmWindow* window) {
41 ShelfID id = WmShell::Get()->shelf_model()->next_id(); 41 ShelfID id = Shell::Get()->shelf_model()->next_id();
42 window->aura_window()->SetProperty(kShelfItemTypeKey, 42 window->aura_window()->SetProperty(kShelfItemTypeKey,
43 static_cast<int32_t>(TYPE_DIALOG)); 43 static_cast<int32_t>(TYPE_DIALOG));
44 return id; 44 return id;
45 } 45 }
46 46
47 protected: 47 protected:
48 ShelfModel* model_; 48 ShelfModel* model_;
49 49
50 private: 50 private:
51 DISALLOW_COPY_AND_ASSIGN(ShelfWindowWatcherTest); 51 DISALLOW_COPY_AND_ASSIGN(ShelfWindowWatcherTest);
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 EXPECT_EQ(initial_item_count + 1, model_->item_count()); 328 EXPECT_EQ(initial_item_count + 1, model_->item_count());
329 329
330 child_window.reset(); 330 child_window.reset();
331 window.reset(); 331 window.reset();
332 EXPECT_EQ(initial_item_count, model_->item_count()); 332 EXPECT_EQ(initial_item_count, model_->item_count());
333 } 333 }
334 334
335 // Ensures ShelfWindowWatcher supports windows opened prior to session start. 335 // Ensures ShelfWindowWatcher supports windows opened prior to session start.
336 using ShelfWindowWatcherSessionStartTest = test::NoSessionAshTestBase; 336 using ShelfWindowWatcherSessionStartTest = test::NoSessionAshTestBase;
337 TEST_F(ShelfWindowWatcherSessionStartTest, PreExistingWindow) { 337 TEST_F(ShelfWindowWatcherSessionStartTest, PreExistingWindow) {
338 ShelfModel* model = WmShell::Get()->shelf_model(); 338 ShelfModel* model = Shell::Get()->shelf_model();
339 ASSERT_FALSE( 339 ASSERT_FALSE(
340 WmShell::Get()->session_controller()->IsActiveUserSessionStarted()); 340 Shell::Get()->session_controller()->IsActiveUserSessionStarted());
341 341
342 // ShelfModel only has an APP_LIST item. 342 // ShelfModel only has an APP_LIST item.
343 EXPECT_EQ(1, model->item_count()); 343 EXPECT_EQ(1, model->item_count());
344 344
345 // Construct a window that should get a shelf item once the session starts. 345 // Construct a window that should get a shelf item once the session starts.
346 std::unique_ptr<views::Widget> widget = 346 std::unique_ptr<views::Widget> widget =
347 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); 347 CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
348 WmWindow* window = WmWindow::Get(widget->GetNativeWindow()); 348 WmWindow* window = WmWindow::Get(widget->GetNativeWindow());
349 ShelfWindowWatcherTest::CreateShelfItem(window); 349 ShelfWindowWatcherTest::CreateShelfItem(window);
350 EXPECT_EQ(1, model->item_count()); 350 EXPECT_EQ(1, model->item_count());
351 351
352 // Start the test user session; ShelfWindowWatcher will find the open window. 352 // Start the test user session; ShelfWindowWatcher will find the open window.
353 SetSessionStarted(true); 353 SetSessionStarted(true);
354 EXPECT_EQ(2, model->item_count()); 354 EXPECT_EQ(2, model->item_count());
355 } 355 }
356 356
357 } // namespace ash 357 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_window_watcher_item_delegate.cc ('k') | ash/common/shelf/wm_shelf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698