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

Unified Diff: ash/shelf/shelf_window_watcher_unittest.cc

Issue 2860503002: mash: Replace int ShelfIDs with AppLaunchID strings. (Closed)
Patch Set: Fix struct traits typo. Created 3 years, 7 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/shelf/shelf_window_watcher_item_delegate.cc ('k') | ash/shell/window_watcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_window_watcher_unittest.cc
diff --git a/ash/shelf/shelf_window_watcher_unittest.cc b/ash/shelf/shelf_window_watcher_unittest.cc
index 1319f4b98a981f32c469cfe9a3ee0b00f3a4c8dc..0cb5d9db6bf70915dfce0ce0107a4daefa897d9c 100644
--- a/ash/shelf/shelf_window_watcher_unittest.cc
+++ b/ash/shelf/shelf_window_watcher_unittest.cc
@@ -17,6 +17,7 @@
#include "ash/wm/window_resizer.h"
#include "ash/wm/window_state.h"
#include "ash/wm_window.h"
+#include "base/strings/string_number_conversions.h"
#include "ui/aura/window.h"
#include "ui/base/hit_test.h"
#include "ui/views/widget/widget.h"
@@ -39,10 +40,12 @@ class ShelfWindowWatcherTest : public test::AshTestBase {
}
static ShelfID CreateShelfItem(WmWindow* window) {
- ShelfID id = Shell::Get()->shelf_model()->next_id();
+ static int id = 0;
+ ShelfID shelf_id(base::IntToString(id++));
+ window->aura_window()->SetProperty(kShelfIDKey, new ShelfID(shelf_id));
window->aura_window()->SetProperty(kShelfItemTypeKey,
static_cast<int32_t>(TYPE_DIALOG));
- return id;
+ return shelf_id;
}
protected:
@@ -271,12 +274,14 @@ TEST_F(ShelfWindowWatcherTest, PanelWindow) {
std::unique_ptr<views::Widget> widget1 =
CreateTestWidget(nullptr, kShellWindowId_PanelContainer, gfx::Rect());
WmWindow* window1 = WmWindow::Get(widget1->GetNativeWindow());
+ window1->aura_window()->SetProperty(kShelfIDKey, new ShelfID("foo"));
window1->aura_window()->SetProperty(kShelfItemTypeKey,
static_cast<int32_t>(TYPE_APP_PANEL));
EXPECT_EQ(2, model_->item_count());
std::unique_ptr<views::Widget> widget2 =
CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect());
WmWindow* window2 = WmWindow::Get(widget2->GetNativeWindow());
+ window2->aura_window()->SetProperty(kShelfIDKey, new ShelfID("bar"));
window2->aura_window()->SetProperty(kShelfItemTypeKey,
static_cast<int32_t>(TYPE_APP_PANEL));
EXPECT_EQ(3, model_->item_count());
@@ -293,6 +298,7 @@ TEST_F(ShelfWindowWatcherTest, PanelWindow) {
panel_widget.Init(panel_params);
panel_widget.Show();
WmWindow* panel_window = WmWindow::Get(panel_widget.GetNativeWindow());
+ panel_window->aura_window()->SetProperty(kShelfIDKey, new ShelfID("baz"));
panel_window->aura_window()->SetProperty(
kShelfItemTypeKey, static_cast<int32_t>(TYPE_APP_PANEL));
EXPECT_EQ(4, model_->item_count());
@@ -312,6 +318,7 @@ TEST_F(ShelfWindowWatcherTest, DontCreateShelfEntriesForChildWindows) {
std::unique_ptr<aura::Window> window(
base::MakeUnique<aura::Window>(nullptr, ui::wm::WINDOW_TYPE_NORMAL));
window->Init(ui::LAYER_NOT_DRAWN);
+ window->SetProperty(kShelfIDKey, new ShelfID("foo"));
window->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_APP));
Shell::GetPrimaryRootWindow()
->GetChildById(kShellWindowId_DefaultContainer)
« no previous file with comments | « ash/shelf/shelf_window_watcher_item_delegate.cc ('k') | ash/shell/window_watcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698