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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc

Issue 2274333002: ash: Move more code from Shelf to WmShelf (Closed)
Patch Set: tweak Created 4 years, 4 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
« ash/wm/window_animations.cc ('K') | « ash/wm/window_animations.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc
index 040a3946e257646e3d0b6b47f01ef815267a4c9c..e6c7968a9a113cee76e2cc1bc4736a8a02a0f443 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc
@@ -9,12 +9,12 @@
#include "ash/aura/wm_window_aura.h"
#include "ash/common/ash_switches.h"
#include "ash/common/shelf/app_list_button.h"
-#include "ash/common/shelf/shelf.h"
#include "ash/common/shelf/shelf_button.h"
#include "ash/common/shelf/shelf_constants.h"
#include "ash/common/shelf/shelf_model.h"
#include "ash/common/shelf/shelf_view.h"
#include "ash/common/shelf/shelf_widget.h"
+#include "ash/common/shelf/wm_shelf.h"
#include "ash/common/wm/window_state.h"
#include "ash/common/wm_shell.h"
#include "ash/shelf/shelf_util.h"
@@ -87,6 +87,11 @@ using content::WebContents;
namespace {
+// Make the call sites cleaner. C++ "using" doesn't work on methods.
msw 2016/08/25 00:22:24 optional nit: I'd just inline 'ash::WmShelf::'.
James Cook 2016/08/25 02:29:13 Done.
+void ActivateShelfItem(int index) {
+ ash::WmShelf::ActivateShelfItem(index);
+}
+
ChromeLauncherControllerImpl* GetChromeLauncherControllerImpl() {
return static_cast<ChromeLauncherControllerImpl*>(
ChromeLauncherController::instance());
@@ -190,13 +195,11 @@ void CloseBrowserWindow(Browser* browser,
class LauncherPlatformAppBrowserTest
: public extensions::PlatformAppBrowserTest {
protected:
- LauncherPlatformAppBrowserTest() : shelf_(NULL), controller_(NULL) {
- }
+ LauncherPlatformAppBrowserTest() : controller_(nullptr) {}
~LauncherPlatformAppBrowserTest() override {}
void RunTestOnMainThreadLoop() override {
- shelf_ = ash::Shelf::ForPrimaryDisplay();
controller_ = GetChromeLauncherControllerImpl();
return extensions::PlatformAppBrowserTest::RunTestOnMainThreadLoop();
}
@@ -238,16 +241,9 @@ class LauncherPlatformAppBrowserTest
return num_items;
}
- // Activate the shelf item with the given |id|.
- void ActivateShelfItem(int id) {
- shelf_->ActivateShelfItem(id);
- }
-
- ash::Shelf* shelf_;
ChromeLauncherControllerImpl* controller_;
private:
-
DISALLOW_COPY_AND_ASSIGN(LauncherPlatformAppBrowserTest);
};
@@ -328,11 +324,6 @@ class ShelfAppBrowserTest : public ExtensionBrowserTest {
controller_->Unpin(id);
}
- // Activate the shelf item with the given |id|.
- void ActivateShelfItem(int id) {
- shelf_->ActivateShelfItem(id);
- }
-
ash::ShelfID PinFakeApp(const std::string& name) {
return controller_->CreateAppShortcutLauncherItem(
name, model_->item_count());
@@ -1650,10 +1641,10 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser,
// Get the number of items in the browser menu.
EXPECT_EQ(0u, chrome::GetTotalBrowserCount());
// The first activation should create a browser at index 1 (App List @ 0).
- shelf_->ActivateShelfItem(1);
+ ActivateShelfItem(1);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
// A second activation should not create a new instance.
- shelf_->ActivateShelfItem(1);
+ ActivateShelfItem(1);
Browser* browser1 = chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow());
EXPECT_TRUE(browser1);
aura::Window* window1 = browser1->window()->GetNativeWindow();
@@ -1665,9 +1656,9 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser,
EXPECT_EQ(window2, ash::wm::GetActiveWindow());
// Activate multiple times the switcher to see that the windows get activated.
- shelf_->ActivateShelfItem(1);
+ ActivateShelfItem(1);
EXPECT_EQ(window1, ash::wm::GetActiveWindow());
- shelf_->ActivateShelfItem(1);
+ ActivateShelfItem(1);
EXPECT_EQ(window2, ash::wm::GetActiveWindow());
// Create a third browser - make sure that we do not toggle simply between
@@ -1680,13 +1671,13 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser,
EXPECT_NE(window2, window3);
EXPECT_EQ(window3, ash::wm::GetActiveWindow());
- shelf_->ActivateShelfItem(1);
+ ActivateShelfItem(1);
EXPECT_EQ(window1, ash::wm::GetActiveWindow());
- shelf_->ActivateShelfItem(1);
+ ActivateShelfItem(1);
EXPECT_EQ(window2, ash::wm::GetActiveWindow());
- shelf_->ActivateShelfItem(1);
+ ActivateShelfItem(1);
EXPECT_EQ(window3, ash::wm::GetActiveWindow());
- shelf_->ActivateShelfItem(1);
+ ActivateShelfItem(1);
EXPECT_EQ(window1, ash::wm::GetActiveWindow());
// Create anther app and make sure that none of our browsers is active.
@@ -1695,7 +1686,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser,
EXPECT_NE(window2, ash::wm::GetActiveWindow());
// After activation our browser should be active again.
- shelf_->ActivateShelfItem(1);
+ ActivateShelfItem(1);
EXPECT_EQ(window1, ash::wm::GetActiveWindow());
}
« ash/wm/window_animations.cc ('K') | « ash/wm/window_animations.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698