| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/browser/ui/browser_list.h" | 33 #include "chrome/browser/ui/browser_list.h" |
| 34 #include "chrome/browser/ui/browser_tabstrip.h" | 34 #include "chrome/browser/ui/browser_tabstrip.h" |
| 35 #include "chrome/browser/ui/host_desktop.h" | 35 #include "chrome/browser/ui/host_desktop.h" |
| 36 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 36 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 37 #include "chrome/common/extensions/extension_constants.h" | 37 #include "chrome/common/extensions/extension_constants.h" |
| 38 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
| 39 #include "chrome/test/base/browser_with_test_window_test.h" | 39 #include "chrome/test/base/browser_with_test_window_test.h" |
| 40 #include "chrome/test/base/testing_pref_service_syncable.h" | 40 #include "chrome/test/base/testing_pref_service_syncable.h" |
| 41 #include "chrome/test/base/testing_profile.h" | 41 #include "chrome/test/base/testing_profile.h" |
| 42 #include "content/public/browser/web_contents.h" | 42 #include "content/public/browser/web_contents.h" |
| 43 #include "content/public/test/test_browser_thread.h" | |
| 44 #include "extensions/common/extension.h" | 43 #include "extensions/common/extension.h" |
| 45 #include "extensions/common/manifest_constants.h" | 44 #include "extensions/common/manifest_constants.h" |
| 46 #include "testing/gtest/include/gtest/gtest.h" | 45 #include "testing/gtest/include/gtest/gtest.h" |
| 47 #include "ui/base/models/menu_model.h" | 46 #include "ui/base/models/menu_model.h" |
| 48 | 47 |
| 49 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
| 50 #include "apps/app_window_contents.h" | 49 #include "apps/app_window_contents.h" |
| 51 #include "apps/shell_window_registry.h" | 50 #include "apps/shell_window_registry.h" |
| 52 #include "apps/ui/native_app_window.h" | 51 #include "apps/ui/native_app_window.h" |
| 53 #include "ash/test/test_session_state_delegate.h" | 52 #include "ash/test/test_session_state_delegate.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 virtual ui::MenuModel* CreateContextMenu(aura::Window* root_window) OVERRIDE { | 244 virtual ui::MenuModel* CreateContextMenu(aura::Window* root_window) OVERRIDE { |
| 246 return NULL; | 245 return NULL; |
| 247 } | 246 } |
| 248 virtual ash::ShelfMenuModel* CreateApplicationMenu(int event_flags) OVERRIDE { | 247 virtual ash::ShelfMenuModel* CreateApplicationMenu(int event_flags) OVERRIDE { |
| 249 return NULL; | 248 return NULL; |
| 250 } | 249 } |
| 251 virtual bool IsDraggable() OVERRIDE { return false; } | 250 virtual bool IsDraggable() OVERRIDE { return false; } |
| 252 virtual bool ShouldShowTooltip() OVERRIDE { return false; } | 251 virtual bool ShouldShowTooltip() OVERRIDE { return false; } |
| 253 | 252 |
| 254 private: | 253 private: |
| 255 | |
| 256 DISALLOW_COPY_AND_ASSIGN(TestV2AppLauncherItemController); | 254 DISALLOW_COPY_AND_ASSIGN(TestV2AppLauncherItemController); |
| 257 }; | 255 }; |
| 258 | 256 |
| 259 } // namespace | 257 } // namespace |
| 260 | 258 |
| 261 class ChromeLauncherControllerTest : public BrowserWithTestWindowTest { | 259 class ChromeLauncherControllerTest : public BrowserWithTestWindowTest { |
| 262 protected: | 260 protected: |
| 263 ChromeLauncherControllerTest() | 261 ChromeLauncherControllerTest() |
| 264 : BrowserWithTestWindowTest( | 262 : BrowserWithTestWindowTest( |
| 265 Browser::TYPE_TABBED, | 263 Browser::TYPE_TABBED, |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 scoped_ptr<TestShelfModelObserver> model_observer_; | 605 scoped_ptr<TestShelfModelObserver> model_observer_; |
| 608 scoped_ptr<ash::ShelfModel> model_; | 606 scoped_ptr<ash::ShelfModel> model_; |
| 609 | 607 |
| 610 // |item_delegate_manager_| owns |test_controller_|. | 608 // |item_delegate_manager_| owns |test_controller_|. |
| 611 LauncherItemController* test_controller_; | 609 LauncherItemController* test_controller_; |
| 612 | 610 |
| 613 ExtensionService* extension_service_; | 611 ExtensionService* extension_service_; |
| 614 | 612 |
| 615 ash::ShelfItemDelegateManager* item_delegate_manager_; | 613 ash::ShelfItemDelegateManager* item_delegate_manager_; |
| 616 | 614 |
| 615 private: |
| 617 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerTest); | 616 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerTest); |
| 618 }; | 617 }; |
| 619 | 618 |
| 620 // The testing framework to test the legacy shelf layout. | 619 // The testing framework to test the legacy shelf layout. |
| 621 class LegacyShelfLayoutChromeLauncherControllerTest | 620 class LegacyShelfLayoutChromeLauncherControllerTest |
| 622 : public ChromeLauncherControllerTest { | 621 : public ChromeLauncherControllerTest { |
| 623 protected: | 622 protected: |
| 624 LegacyShelfLayoutChromeLauncherControllerTest() { | 623 LegacyShelfLayoutChromeLauncherControllerTest() { |
| 625 } | 624 } |
| 626 | 625 |
| 627 virtual ~LegacyShelfLayoutChromeLauncherControllerTest() { | 626 virtual ~LegacyShelfLayoutChromeLauncherControllerTest() { |
| 628 } | 627 } |
| 629 | 628 |
| 630 // Overwrite the Setup function to use the legacy shelf layout option. | 629 // Overwrite the Setup function to use the legacy shelf layout option. |
| 631 virtual void SetUp() OVERRIDE { | 630 virtual void SetUp() OVERRIDE { |
| 632 CommandLine::ForCurrentProcess()->AppendSwitch( | 631 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 633 ash::switches::kAshDisableAlternateShelfLayout); | 632 ash::switches::kAshDisableAlternateShelfLayout); |
| 634 ChromeLauncherControllerTest::SetUp(); | 633 ChromeLauncherControllerTest::SetUp(); |
| 635 } | 634 } |
| 636 | 635 |
| 637 private: | 636 private: |
| 638 | |
| 639 DISALLOW_COPY_AND_ASSIGN(LegacyShelfLayoutChromeLauncherControllerTest); | 637 DISALLOW_COPY_AND_ASSIGN(LegacyShelfLayoutChromeLauncherControllerTest); |
| 640 }; | 638 }; |
| 641 | 639 |
| 642 #if defined(OS_CHROMEOS) | 640 #if defined(OS_CHROMEOS) |
| 643 // A browser window proxy which is able to associate an aura native window with | 641 // A browser window proxy which is able to associate an aura native window with |
| 644 // it. | 642 // it. |
| 645 class TestBrowserWindowAura : public TestBrowserWindow { | 643 class TestBrowserWindowAura : public TestBrowserWindow { |
| 646 public: | 644 public: |
| 647 // |native_window| will still be owned by the caller after the constructor | 645 // |native_window| will still be owned by the caller after the constructor |
| 648 // was called. | 646 // was called. |
| (...skipping 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2791 | 2789 |
| 2792 EXPECT_EQ(1, app_icon_loader->fetch_count()); | 2790 EXPECT_EQ(1, app_icon_loader->fetch_count()); |
| 2793 ASSERT_EQ(initial_size + 1, model_->items().size()); | 2791 ASSERT_EQ(initial_size + 1, model_->items().size()); |
| 2794 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); | 2792 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); |
| 2795 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); | 2793 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); |
| 2796 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); | 2794 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); |
| 2797 | 2795 |
| 2798 launcher_controller_->UnpinAppWithID("1"); | 2796 launcher_controller_->UnpinAppWithID("1"); |
| 2799 ASSERT_EQ(initial_size, model_->items().size()); | 2797 ASSERT_EQ(initial_size, model_->items().size()); |
| 2800 } | 2798 } |
| OLD | NEW |