| 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_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 <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 #include "chrome/common/extensions/extension_constants.h" | 71 #include "chrome/common/extensions/extension_constants.h" |
| 72 #include "chrome/common/pref_names.h" | 72 #include "chrome/common/pref_names.h" |
| 73 #include "chrome/test/base/browser_with_test_window_test.h" | 73 #include "chrome/test/base/browser_with_test_window_test.h" |
| 74 #include "chrome/test/base/test_browser_window_aura.h" | 74 #include "chrome/test/base/test_browser_window_aura.h" |
| 75 #include "chrome/test/base/testing_browser_process.h" | 75 #include "chrome/test/base/testing_browser_process.h" |
| 76 #include "chrome/test/base/testing_profile.h" | 76 #include "chrome/test/base/testing_profile.h" |
| 77 #include "chrome/test/base/testing_profile_manager.h" | 77 #include "chrome/test/base/testing_profile_manager.h" |
| 78 #include "chromeos/chromeos_switches.h" | 78 #include "chromeos/chromeos_switches.h" |
| 79 #include "components/arc/common/app.mojom.h" | 79 #include "components/arc/common/app.mojom.h" |
| 80 #include "components/arc/test/fake_app_instance.h" | 80 #include "components/arc/test/fake_app_instance.h" |
| 81 #include "components/arc/test/fake_arc_bridge_service.h" | |
| 82 #include "components/exo/shell_surface.h" | 81 #include "components/exo/shell_surface.h" |
| 83 #include "components/signin/core/account_id/account_id.h" | 82 #include "components/signin/core/account_id/account_id.h" |
| 84 #include "components/sync/api/fake_sync_change_processor.h" | 83 #include "components/sync/api/fake_sync_change_processor.h" |
| 85 #include "components/sync/api/sync_error_factory_mock.h" | 84 #include "components/sync/api/sync_error_factory_mock.h" |
| 86 #include "components/sync/protocol/sync.pb.h" | 85 #include "components/sync/protocol/sync.pb.h" |
| 87 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 86 #include "components/syncable_prefs/testing_pref_service_syncable.h" |
| 88 #include "components/user_manager/fake_user_manager.h" | 87 #include "components/user_manager/fake_user_manager.h" |
| 89 #include "content/public/browser/web_contents.h" | 88 #include "content/public/browser/web_contents.h" |
| 90 #include "content/public/browser/web_contents_observer.h" | 89 #include "content/public/browser/web_contents_observer.h" |
| 91 #include "content/public/test/test_utils.h" | 90 #include "content/public/test/test_utils.h" |
| (...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 | 1754 |
| 1756 const arc::mojom::AppInfo& app1 = arc_test_.fake_apps()[0]; | 1755 const arc::mojom::AppInfo& app1 = arc_test_.fake_apps()[0]; |
| 1757 const arc::mojom::AppInfo& app2 = arc_test_.fake_apps()[1]; | 1756 const arc::mojom::AppInfo& app2 = arc_test_.fake_apps()[1]; |
| 1758 const arc::mojom::AppInfo& app3 = arc_test_.fake_apps()[2]; | 1757 const arc::mojom::AppInfo& app3 = arc_test_.fake_apps()[2]; |
| 1759 const std::string arc_app_id1 = ArcAppTest::GetAppId(app1); | 1758 const std::string arc_app_id1 = ArcAppTest::GetAppId(app1); |
| 1760 const std::string arc_app_id2 = ArcAppTest::GetAppId(app2); | 1759 const std::string arc_app_id2 = ArcAppTest::GetAppId(app2); |
| 1761 const std::string arc_app_id3 = ArcAppTest::GetAppId(app3); | 1760 const std::string arc_app_id3 = ArcAppTest::GetAppId(app3); |
| 1762 | 1761 |
| 1763 SendListOfArcApps(); | 1762 SendListOfArcApps(); |
| 1764 | 1763 |
| 1765 arc_test_.bridge_service()->SetStopped(); | 1764 arc_test_.StopArcInstance(); |
| 1766 | 1765 |
| 1767 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1)); | 1766 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1)); |
| 1768 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); | 1767 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); |
| 1769 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id3)); | 1768 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id3)); |
| 1770 | 1769 |
| 1771 arc::LaunchApp(profile(), arc_app_id1); | 1770 arc::LaunchApp(profile(), arc_app_id1); |
| 1772 arc::LaunchApp(profile(), arc_app_id1); | 1771 arc::LaunchApp(profile(), arc_app_id1); |
| 1773 arc::LaunchApp(profile(), arc_app_id2); | 1772 arc::LaunchApp(profile(), arc_app_id2); |
| 1774 arc::LaunchApp(profile(), arc_app_id3); | 1773 arc::LaunchApp(profile(), arc_app_id3); |
| 1775 arc::LaunchApp(profile(), arc_app_id3); | 1774 arc::LaunchApp(profile(), arc_app_id3); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1791 ASSERT_NE(nullptr, item_controller); | 1790 ASSERT_NE(nullptr, item_controller); |
| 1792 item_controller->Close(); | 1791 item_controller->Close(); |
| 1793 base::RunLoop().RunUntilIdle(); | 1792 base::RunLoop().RunUntilIdle(); |
| 1794 | 1793 |
| 1795 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1)); | 1794 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1)); |
| 1796 EXPECT_EQ(shelf_id_app_2, | 1795 EXPECT_EQ(shelf_id_app_2, |
| 1797 launcher_controller_->GetShelfIDForAppID(arc_app_id2)); | 1796 launcher_controller_->GetShelfIDForAppID(arc_app_id2)); |
| 1798 EXPECT_EQ(shelf_id_app_3, | 1797 EXPECT_EQ(shelf_id_app_3, |
| 1799 launcher_controller_->GetShelfIDForAppID(arc_app_id3)); | 1798 launcher_controller_->GetShelfIDForAppID(arc_app_id3)); |
| 1800 | 1799 |
| 1801 arc_test_.bridge_service()->SetReady(); | 1800 arc_test_.RestartArcInstance(); |
| 1802 SendListOfArcApps(); | 1801 SendListOfArcApps(); |
| 1803 | 1802 |
| 1804 base::RunLoop().RunUntilIdle(); | 1803 base::RunLoop().RunUntilIdle(); |
| 1805 | 1804 |
| 1806 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1)); | 1805 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1)); |
| 1807 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); | 1806 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); |
| 1808 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id3)); | 1807 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id3)); |
| 1809 | 1808 |
| 1810 ASSERT_EQ(2U, arc_test_.app_instance()->launch_requests().size()); | 1809 ASSERT_EQ(2U, arc_test_.app_instance()->launch_requests().size()); |
| 1811 | 1810 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1832 arc_test_.app_instance()->SendTaskCreated(2, arc_test_.fake_apps()[0]); | 1831 arc_test_.app_instance()->SendTaskCreated(2, arc_test_.fake_apps()[0]); |
| 1833 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); | 1832 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); |
| 1834 arc_test_.app_instance()->SendTaskDestroyed(1); | 1833 arc_test_.app_instance()->SendTaskDestroyed(1); |
| 1835 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); | 1834 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); |
| 1836 arc_test_.app_instance()->SendTaskDestroyed(2); | 1835 arc_test_.app_instance()->SendTaskDestroyed(2); |
| 1837 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); | 1836 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); |
| 1838 | 1837 |
| 1839 // Stopping bridge removes apps. | 1838 // Stopping bridge removes apps. |
| 1840 arc_test_.app_instance()->SendTaskCreated(3, arc_test_.fake_apps()[0]); | 1839 arc_test_.app_instance()->SendTaskCreated(3, arc_test_.fake_apps()[0]); |
| 1841 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); | 1840 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); |
| 1842 arc_test_.bridge_service()->SetStopped(); | 1841 arc_test_.StopArcInstance(); |
| 1843 base::RunLoop().RunUntilIdle(); | 1842 base::RunLoop().RunUntilIdle(); |
| 1844 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); | 1843 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); |
| 1845 } | 1844 } |
| 1846 | 1845 |
| 1847 // Validate that Arc app is pinned correctly and pin is removed automatically | 1846 // Validate that Arc app is pinned correctly and pin is removed automatically |
| 1848 // once app is uninstalled. | 1847 // once app is uninstalled. |
| 1849 TEST_F(ChromeLauncherControllerImplTest, ArcAppPin) { | 1848 TEST_F(ChromeLauncherControllerImplTest, ArcAppPin) { |
| 1850 arc_test_.SetUp(profile()); | 1849 arc_test_.SetUp(profile()); |
| 1851 InitLauncherController(); | 1850 InitLauncherController(); |
| 1852 | 1851 |
| (...skipping 1801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3654 EXPECT_FALSE(controller->rotation_locked()); | 3653 EXPECT_FALSE(controller->rotation_locked()); |
| 3655 EXPECT_EQ(display::Display::ROTATE_0, | 3654 EXPECT_EQ(display::Display::ROTATE_0, |
| 3656 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); | 3655 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); |
| 3657 | 3656 |
| 3658 NotifyOnTaskOrientationLockRequested(task_id_current_, | 3657 NotifyOnTaskOrientationLockRequested(task_id_current_, |
| 3659 OrientationLock::CURRENT); | 3658 OrientationLock::CURRENT); |
| 3660 EXPECT_TRUE(controller->rotation_locked()); | 3659 EXPECT_TRUE(controller->rotation_locked()); |
| 3661 EXPECT_EQ(display::Display::ROTATE_0, | 3660 EXPECT_EQ(display::Display::ROTATE_0, |
| 3662 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); | 3661 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); |
| 3663 } | 3662 } |
| OLD | NEW |