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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc

Issue 2731663002: Remove WmWindowProperty (Closed)
Patch Set: rebase 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
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 "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "ash/common/shelf/app_list_button.h" 9 #include "ash/common/shelf/app_list_button.h"
10 #include "ash/common/shelf/shelf_button.h" 10 #include "ash/common/shelf/shelf_button.h"
11 #include "ash/common/shelf/shelf_constants.h" 11 #include "ash/common/shelf/shelf_constants.h"
12 #include "ash/common/shelf/shelf_model.h" 12 #include "ash/common/shelf/shelf_model.h"
13 #include "ash/common/shelf/shelf_view.h" 13 #include "ash/common/shelf/shelf_view.h"
14 #include "ash/common/shelf/shelf_widget.h" 14 #include "ash/common/shelf/shelf_widget.h"
15 #include "ash/common/shelf/wm_shelf.h" 15 #include "ash/common/shelf/wm_shelf.h"
16 #include "ash/common/wm/window_state.h" 16 #include "ash/common/wm/window_state.h"
17 #include "ash/common/wm_shell.h" 17 #include "ash/common/wm_shell.h"
18 #include "ash/common/wm_window.h" 18 #include "ash/common/wm_window.h"
19 #include "ash/common/wm_window_property.h"
20 #include "ash/public/cpp/window_properties.h" 19 #include "ash/public/cpp/window_properties.h"
21 #include "ash/shell.h" 20 #include "ash/shell.h"
22 #include "ash/test/shelf_view_test_api.h" 21 #include "ash/test/shelf_view_test_api.h"
22 #include "ash/wm/window_properties.h"
23 #include "ash/wm/window_state_aura.h" 23 #include "ash/wm/window_state_aura.h"
24 #include "ash/wm/window_util.h" 24 #include "ash/wm/window_util.h"
25 #include "base/macros.h" 25 #include "base/macros.h"
26 #include "base/run_loop.h" 26 #include "base/run_loop.h"
27 #include "base/strings/stringprintf.h" 27 #include "base/strings/stringprintf.h"
28 #include "base/strings/utf_string_conversions.h" 28 #include "base/strings/utf_string_conversions.h"
29 #include "build/build_config.h" 29 #include "build/build_config.h"
30 #include "chrome/browser/apps/app_browsertest_util.h" 30 #include "chrome/browser/apps/app_browsertest_util.h"
31 #include "chrome/browser/chrome_notification_types.h" 31 #include "chrome/browser/chrome_notification_types.h"
32 #include "chrome/browser/extensions/extension_apitest.h" 32 #include "chrome/browser/extensions/extension_apitest.h"
(...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); 2155 EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
2156 EXPECT_EQ(1, browser()->tab_strip_model()->count()); 2156 EXPECT_EQ(1, browser()->tab_strip_model()->count());
2157 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); 2157 EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
2158 EXPECT_EQ(2, model_->item_count()); 2158 EXPECT_EQ(2, model_->item_count());
2159 2159
2160 ash::WmWindow* window = 2160 ash::WmWindow* window =
2161 ash::WmWindow::Get(browser()->window()->GetNativeWindow()); 2161 ash::WmWindow::Get(browser()->window()->GetNativeWindow());
2162 2162
2163 int browser_index = GetIndexOfShelfItemType(ash::TYPE_BROWSER_SHORTCUT); 2163 int browser_index = GetIndexOfShelfItemType(ash::TYPE_BROWSER_SHORTCUT);
2164 ash::ShelfID browser_id = model_->items()[browser_index].id; 2164 ash::ShelfID browser_id = model_->items()[browser_index].id;
2165 ash::ShelfID id = window->GetIntProperty(ash::WmWindowProperty::SHELF_ID); 2165 ash::ShelfID id = window->aura_window()->GetProperty(ash::kShelfIDKey);
2166 EXPECT_EQ(browser_id, id); 2166 EXPECT_EQ(browser_id, id);
2167 2167
2168 ash::ShelfID app_id = CreateShortcut("app1"); 2168 ash::ShelfID app_id = CreateShortcut("app1");
2169 EXPECT_EQ(3, model_->item_count()); 2169 EXPECT_EQ(3, model_->item_count());
2170 2170
2171 // Create and activate a new tab for "app1" and expect an application ShelfID. 2171 // Create and activate a new tab for "app1" and expect an application ShelfID.
2172 WmShelf::ActivateShelfItem(model_->ItemIndexByID(app_id)); 2172 WmShelf::ActivateShelfItem(model_->ItemIndexByID(app_id));
2173 EXPECT_EQ(2, browser()->tab_strip_model()->count()); 2173 EXPECT_EQ(2, browser()->tab_strip_model()->count());
2174 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); 2174 EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
2175 id = window->GetIntProperty(ash::WmWindowProperty::SHELF_ID); 2175 id = window->aura_window()->GetProperty(ash::kShelfIDKey);
2176 EXPECT_EQ(app_id, id); 2176 EXPECT_EQ(app_id, id);
2177 2177
2178 // Activate the tab at index 0 (NTP) and expect a browser ShelfID. 2178 // Activate the tab at index 0 (NTP) and expect a browser ShelfID.
2179 browser()->tab_strip_model()->ActivateTabAt(0, false); 2179 browser()->tab_strip_model()->ActivateTabAt(0, false);
2180 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); 2180 EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
2181 id = window->GetIntProperty(ash::WmWindowProperty::SHELF_ID); 2181 id = window->aura_window()->GetProperty(ash::kShelfIDKey);
2182 EXPECT_EQ(browser_id, id); 2182 EXPECT_EQ(browser_id, id);
2183 } 2183 }
2184 2184
2185 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, OverflowBubble) { 2185 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, OverflowBubble) {
2186 // Make sure to have a browser window 2186 // Make sure to have a browser window
2187 chrome::NewTab(browser()); 2187 chrome::NewTab(browser());
2188 2188
2189 // No overflow yet. 2189 // No overflow yet.
2190 EXPECT_FALSE(shelf_->shelf_widget()->IsShowingOverflowBubble()); 2190 EXPECT_FALSE(shelf_->shelf_widget()->IsShowingOverflowBubble());
2191 2191
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2392 2392
2393 // Close all windows via the menu item. 2393 // Close all windows via the menu item.
2394 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); 2394 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE);
2395 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); 2395 EXPECT_EQ(0u, BrowserList::GetInstance()->size());
2396 2396
2397 // Check if "Close" is removed from the context menu. 2397 // Check if "Close" is removed from the context menu.
2398 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); 2398 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu();
2399 ASSERT_FALSE( 2399 ASSERT_FALSE(
2400 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); 2400 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE));
2401 } 2401 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698