| OLD | NEW |
| 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.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 265 |
| 266 private: | 266 private: |
| 267 DISALLOW_COPY_AND_ASSIGN(TestV2AppLauncherItemController); | 267 DISALLOW_COPY_AND_ASSIGN(TestV2AppLauncherItemController); |
| 268 }; | 268 }; |
| 269 | 269 |
| 270 } // namespace | 270 } // namespace |
| 271 | 271 |
| 272 class ChromeLauncherControllerTest : public BrowserWithTestWindowTest { | 272 class ChromeLauncherControllerTest : public BrowserWithTestWindowTest { |
| 273 protected: | 273 protected: |
| 274 ChromeLauncherControllerTest() | 274 ChromeLauncherControllerTest() |
| 275 : BrowserWithTestWindowTest( | 275 : BrowserWithTestWindowTest(Browser::TYPE_TABBED, false), |
| 276 Browser::TYPE_TABBED, | |
| 277 chrome::HOST_DESKTOP_TYPE_ASH, | |
| 278 false), | |
| 279 test_controller_(NULL), | 276 test_controller_(NULL), |
| 280 extension_service_(NULL) { | 277 extension_service_(NULL) {} |
| 281 } | |
| 282 | 278 |
| 283 ~ChromeLauncherControllerTest() override {} | 279 ~ChromeLauncherControllerTest() override {} |
| 284 | 280 |
| 285 void SetUp() override { | 281 void SetUp() override { |
| 286 BrowserWithTestWindowTest::SetUp(); | 282 BrowserWithTestWindowTest::SetUp(); |
| 287 | 283 |
| 288 model_.reset(new ash::ShelfModel); | 284 model_.reset(new ash::ShelfModel); |
| 289 model_observer_.reset(new TestShelfModelObserver); | 285 model_observer_.reset(new TestShelfModelObserver); |
| 290 model_->AddObserver(model_observer_.get()); | 286 model_->AddObserver(model_observer_.get()); |
| 291 | 287 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 model_.reset(); | 432 model_.reset(); |
| 437 | 433 |
| 438 BrowserWithTestWindowTest::TearDown(); | 434 BrowserWithTestWindowTest::TearDown(); |
| 439 } | 435 } |
| 440 | 436 |
| 441 BrowserWindow* CreateBrowserWindow() override { | 437 BrowserWindow* CreateBrowserWindow() override { |
| 442 return CreateTestBrowserWindowAura(); | 438 return CreateTestBrowserWindowAura(); |
| 443 } | 439 } |
| 444 | 440 |
| 445 scoped_ptr<Browser> CreateBrowserWithTestWindowForProfile(Profile* profile) { | 441 scoped_ptr<Browser> CreateBrowserWithTestWindowForProfile(Profile* profile) { |
| 446 TestBrowserWindow* browser_widnow = CreateTestBrowserWindowAura(); | 442 TestBrowserWindow* browser_window = CreateTestBrowserWindowAura(); |
| 447 new TestBrowserWindowOwner(browser_widnow); | 443 new TestBrowserWindowOwner(browser_window); |
| 448 return make_scoped_ptr(CreateBrowser(profile, Browser::TYPE_TABBED, false, | 444 return make_scoped_ptr( |
| 449 chrome::HOST_DESKTOP_TYPE_ASH, | 445 CreateBrowser(profile, Browser::TYPE_TABBED, false, browser_window)); |
| 450 browser_widnow)); | |
| 451 } | 446 } |
| 452 | 447 |
| 453 void AddAppListLauncherItem() { | 448 void AddAppListLauncherItem() { |
| 454 ash::ShelfItem app_list; | 449 ash::ShelfItem app_list; |
| 455 app_list.type = ash::TYPE_APP_LIST; | 450 app_list.type = ash::TYPE_APP_LIST; |
| 456 model_->Add(app_list); | 451 model_->Add(app_list); |
| 457 } | 452 } |
| 458 | 453 |
| 459 void InitLauncherController() { | 454 void InitLauncherController() { |
| 460 AddAppListLauncherItem(); | 455 AddAppListLauncherItem(); |
| (...skipping 2302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2763 | 2758 |
| 2764 EXPECT_EQ(1, app_icon_loader->fetch_count()); | 2759 EXPECT_EQ(1, app_icon_loader->fetch_count()); |
| 2765 ASSERT_EQ(initial_size + 1, model_->items().size()); | 2760 ASSERT_EQ(initial_size + 1, model_->items().size()); |
| 2766 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); | 2761 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); |
| 2767 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); | 2762 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); |
| 2768 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); | 2763 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); |
| 2769 | 2764 |
| 2770 launcher_controller_->UnpinAppWithID("1"); | 2765 launcher_controller_->UnpinAppWithID("1"); |
| 2771 ASSERT_EQ(initial_size, model_->items().size()); | 2766 ASSERT_EQ(initial_size, model_->items().size()); |
| 2772 } | 2767 } |
| OLD | NEW |