Chromium Code Reviews| Index: ash/common/shelf/shelf_window_watcher_unittest.cc |
| diff --git a/ash/common/shelf/shelf_window_watcher_unittest.cc b/ash/common/shelf/shelf_window_watcher_unittest.cc |
| index f88eaa168a5fed0256597fe9ee114b0a4d7382f6..6e349ed7779e9cddab9700ff5c5d81016a56b2b9 100644 |
| --- a/ash/common/shelf/shelf_window_watcher_unittest.cc |
| +++ b/ash/common/shelf/shelf_window_watcher_unittest.cc |
| @@ -15,7 +15,9 @@ |
| #include "ash/public/cpp/window_properties.h" |
| #include "ash/root_window_controller.h" |
| #include "ash/test/ash_test_base.h" |
| +#include "ui/aura/window.h" |
| #include "ui/base/hit_test.h" |
| +#include "ui/compositor/layer_type.h" |
| #include "ui/views/widget/widget.h" |
| namespace ash { |
| @@ -345,28 +347,28 @@ TEST_F(ShelfWindowWatcherTest, PanelWindow) { |
| TEST_F(ShelfWindowWatcherTest, DontCreateShelfEntriesForChildWindows) { |
| const int initial_item_count = model_->item_count(); |
| - WmWindow* window = WmShell::Get()->NewWindow(ui::wm::WINDOW_TYPE_NORMAL, |
| - ui::LAYER_NOT_DRAWN); |
| - window->aura_window()->SetProperty(kShelfItemTypeKey, |
| - static_cast<int32_t>(TYPE_APP)); |
| + std::unique_ptr<aura::Window> window( |
| + base::MakeUnique<aura::Window>(nullptr, ui::wm::WINDOW_TYPE_NORMAL)); |
| + window->Init(ui::LAYER_NOT_DRAWN); |
| + window->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_APP)); |
| WmShell::Get() |
| ->GetPrimaryRootWindow() |
| ->GetChildByShellWindowId(kShellWindowId_DefaultContainer) |
| - ->AddChild(window); |
| + ->AddChild(WmWindow::Get(window.get())); |
|
msw
2017/03/08 21:38:24
optional nit: Shell::GetPrimaryRootWindow()->GetCh
sky
2017/03/08 22:58:17
Done.
|
| window->Show(); |
| EXPECT_EQ(initial_item_count + 1, model_->item_count()); |
| - WmWindow* child_window = WmShell::Get()->NewWindow(ui::wm::WINDOW_TYPE_NORMAL, |
| - ui::LAYER_NOT_DRAWN); |
| - child_window->aura_window()->SetProperty(kShelfItemTypeKey, |
| - static_cast<int32_t>(TYPE_APP)); |
| - window->AddChild(child_window); |
| + std::unique_ptr<aura::Window> child_window( |
| + base::MakeUnique<aura::Window>(nullptr, ui::wm::WINDOW_TYPE_NORMAL)); |
| + child_window->Init(ui::LAYER_NOT_DRAWN); |
| + child_window->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_APP)); |
| + window->AddChild(child_window.get()); |
| child_window->Show(); |
| // |child_window| should not result in adding a new entry. |
| EXPECT_EQ(initial_item_count + 1, model_->item_count()); |
| - child_window->Destroy(); |
| - window->Destroy(); |
| + child_window.reset(); |
| + window.reset(); |
| EXPECT_EQ(initial_item_count, model_->item_count()); |
| } |