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

Unified Diff: ash/common/shelf/shelf_window_watcher_unittest.cc

Issue 2733303004: Removes WmShell::NewWindow() (Closed)
Patch Set: merge and feedback 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/aura/wm_shell_aura.cc ('k') | ash/common/test/ash_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d43accaef4401247df91be9ea8ce9812cf7de811 100644
--- a/ash/common/shelf/shelf_window_watcher_unittest.cc
+++ b/ash/common/shelf/shelf_window_watcher_unittest.cc
@@ -14,8 +14,11 @@
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/public/cpp/window_properties.h"
#include "ash/root_window_controller.h"
+#include "ash/shell.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 +348,27 @@ 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));
- WmShell::Get()
- ->GetPrimaryRootWindow()
- ->GetChildByShellWindowId(kShellWindowId_DefaultContainer)
- ->AddChild(window);
+ 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));
+ Shell::GetPrimaryRootWindow()
+ ->GetChildById(kShellWindowId_DefaultContainer)
+ ->AddChild(window.get());
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());
}
« no previous file with comments | « ash/aura/wm_shell_aura.cc ('k') | ash/common/test/ash_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698