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 29 matching lines...) Expand all Loading... |
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 "extensions/common/extension.h" | 43 #include "extensions/common/extension.h" |
44 #include "extensions/common/manifest_constants.h" | 44 #include "extensions/common/manifest_constants.h" |
45 #include "testing/gtest/include/gtest/gtest.h" | 45 #include "testing/gtest/include/gtest/gtest.h" |
46 #include "ui/base/models/menu_model.h" | 46 #include "ui/base/models/menu_model.h" |
47 | 47 |
48 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
49 #include "apps/app_window_contents.h" | 49 #include "apps/app_window_contents.h" |
50 #include "apps/shell_window_registry.h" | 50 #include "apps/app_window_registry.h" |
51 #include "apps/ui/native_app_window.h" | 51 #include "apps/ui/native_app_window.h" |
52 #include "ash/test/test_session_state_delegate.h" | 52 #include "ash/test/test_session_state_delegate.h" |
53 #include "ash/test/test_shell_delegate.h" | 53 #include "ash/test/test_shell_delegate.h" |
54 #include "chrome/browser/chromeos/login/fake_user_manager.h" | 54 #include "chrome/browser/chromeos/login/fake_user_manager.h" |
55 #include "chrome/browser/ui/apps/chrome_shell_window_delegate.h" | 55 #include "chrome/browser/ui/apps/chrome_shell_window_delegate.h" |
56 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" | 56 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" |
57 #include "chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h" | 57 #include "chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h" |
58 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 58 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
59 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 59 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
60 #include "chrome/common/chrome_constants.h" | 60 #include "chrome/common/chrome_constants.h" |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 677 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
678 window->Init(aura::WINDOW_LAYER_TEXTURED); | 678 window->Init(aura::WINDOW_LAYER_TEXTURED); |
679 window->Show(); | 679 window->Show(); |
680 | 680 |
681 scoped_ptr<TestBrowserWindowAura> browser_window( | 681 scoped_ptr<TestBrowserWindowAura> browser_window( |
682 new TestBrowserWindowAura(window)); | 682 new TestBrowserWindowAura(window)); |
683 browser_window->CreateBrowser(params); | 683 browser_window->CreateBrowser(params); |
684 return browser_window.Pass(); | 684 return browser_window.Pass(); |
685 } | 685 } |
686 | 686 |
687 // A views delegate which allows creating shell windows. | 687 // A views delegate which allows creating app windows. |
688 class TestViewsDelegateForAppTest : public views::TestViewsDelegate { | 688 class TestViewsDelegateForAppTest : public views::TestViewsDelegate { |
689 public: | 689 public: |
690 TestViewsDelegateForAppTest() {} | 690 TestViewsDelegateForAppTest() {} |
691 virtual ~TestViewsDelegateForAppTest() {} | 691 virtual ~TestViewsDelegateForAppTest() {} |
692 | 692 |
693 // views::TestViewsDelegate overrides. | 693 // views::TestViewsDelegate overrides. |
694 virtual void OnBeforeWidgetInit( | 694 virtual void OnBeforeWidgetInit( |
695 views::Widget::InitParams* params, | 695 views::Widget::InitParams* params, |
696 views::internal::NativeWidgetDelegate* delegate) OVERRIDE { | 696 views::internal::NativeWidgetDelegate* delegate) OVERRIDE { |
697 if (!params->parent && !params->context) { | 697 if (!params->parent && !params->context) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 scoped_ptr<aura::Window> native_window_; | 775 scoped_ptr<aura::Window> native_window_; |
776 | 776 |
777 DISALLOW_COPY_AND_ASSIGN(V1App); | 777 DISALLOW_COPY_AND_ASSIGN(V1App); |
778 }; | 778 }; |
779 | 779 |
780 // A V2 application which gets created with an |extension| and for a |profile|. | 780 // A V2 application which gets created with an |extension| and for a |profile|. |
781 // Upon destruction it will properly close the application. | 781 // Upon destruction it will properly close the application. |
782 class V2App { | 782 class V2App { |
783 public: | 783 public: |
784 V2App(Profile* profile, const extensions::Extension* extension) { | 784 V2App(Profile* profile, const extensions::Extension* extension) { |
785 window_ = new apps::ShellWindow(profile, | 785 window_ = new apps::AppWindow( |
786 new ChromeShellWindowDelegate(), | 786 profile, new ChromeShellWindowDelegate(), extension); |
787 extension); | 787 apps::AppWindow::CreateParams params = apps::AppWindow::CreateParams(); |
788 apps::ShellWindow::CreateParams params = apps::ShellWindow::CreateParams(); | 788 window_->Init( |
789 window_->Init(GURL(std::string()), | 789 GURL(std::string()), new apps::AppWindowContentsImpl(window_), params); |
790 new apps::AppWindowContents(window_), | |
791 params); | |
792 } | 790 } |
793 | 791 |
794 virtual ~V2App() { | 792 virtual ~V2App() { |
795 WebContentsDestroyedWatcher destroyed_watcher(window_->web_contents()); | 793 WebContentsDestroyedWatcher destroyed_watcher(window_->web_contents()); |
796 window_->GetBaseWindow()->Close(); | 794 window_->GetBaseWindow()->Close(); |
797 destroyed_watcher.Wait(); | 795 destroyed_watcher.Wait(); |
798 } | 796 } |
799 | 797 |
800 private: | 798 private: |
801 // The shell window which represents the application. Note that the window | 799 // The app window which represents the application. Note that the window |
802 // deletes itself asynchronously after window_->GetBaseWindow()->Close() gets | 800 // deletes itself asynchronously after window_->GetBaseWindow()->Close() gets |
803 // called. | 801 // called. |
804 apps::ShellWindow* window_; | 802 apps::AppWindow* window_; |
805 | 803 |
806 DISALLOW_COPY_AND_ASSIGN(V2App); | 804 DISALLOW_COPY_AND_ASSIGN(V2App); |
807 }; | 805 }; |
808 | 806 |
809 // The testing framework to test multi profile scenarios. | 807 // The testing framework to test multi profile scenarios. |
810 class MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest | 808 class MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest |
811 : public ChromeLauncherControllerTest { | 809 : public ChromeLauncherControllerTest { |
812 protected: | 810 protected: |
813 MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest() { | 811 MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest() { |
814 } | 812 } |
(...skipping 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2789 | 2787 |
2790 EXPECT_EQ(1, app_icon_loader->fetch_count()); | 2788 EXPECT_EQ(1, app_icon_loader->fetch_count()); |
2791 ASSERT_EQ(initial_size + 1, model_->items().size()); | 2789 ASSERT_EQ(initial_size + 1, model_->items().size()); |
2792 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); | 2790 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); |
2793 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); | 2791 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); |
2794 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); | 2792 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); |
2795 | 2793 |
2796 launcher_controller_->UnpinAppWithID("1"); | 2794 launcher_controller_->UnpinAppWithID("1"); |
2797 ASSERT_EQ(initial_size, model_->items().size()); | 2795 ASSERT_EQ(initial_size, model_->items().size()); |
2798 } | 2796 } |
OLD | NEW |