| 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 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1907 | 1907 |
| 1908 // Arc window created after and closed before mojom notification. | 1908 // Arc window created after and closed before mojom notification. |
| 1909 std::string window_app_id2("org.chromium.arc.2"); | 1909 std::string window_app_id2("org.chromium.arc.2"); |
| 1910 arc_test_.app_instance()->SendTaskCreated(2, arc_test_.fake_apps()[1]); | 1910 arc_test_.app_instance()->SendTaskCreated(2, arc_test_.fake_apps()[1]); |
| 1911 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); | 1911 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); |
| 1912 arc_window = CreateArcWindow(window_app_id2); | 1912 arc_window = CreateArcWindow(window_app_id2); |
| 1913 ASSERT_TRUE(arc_window); | 1913 ASSERT_TRUE(arc_window); |
| 1914 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); | 1914 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); |
| 1915 arc_window->Close(); | 1915 arc_window->Close(); |
| 1916 base::RunLoop().RunUntilIdle(); | 1916 base::RunLoop().RunUntilIdle(); |
| 1917 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); | 1917 // Closing window does not close shelf item. It is closed on task destroy. |
| 1918 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); |
| 1918 arc_test_.app_instance()->SendTaskDestroyed(2); | 1919 arc_test_.app_instance()->SendTaskDestroyed(2); |
| 1919 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); | 1920 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); |
| 1920 } | 1921 } |
| 1921 | 1922 |
| 1923 TEST_F(ChromeLauncherControllerImplTest, ArcWindowRecreation) { |
| 1924 arc_test_.SetUp(profile()); |
| 1925 InitLauncherController(); |
| 1926 |
| 1927 const std::string arc_app_id = ArcAppTest::GetAppId(arc_test_.fake_apps()[0]); |
| 1928 SendListOfArcApps(); |
| 1929 |
| 1930 std::string window_app_id("org.chromium.arc.1"); |
| 1931 views::Widget* arc_window = CreateArcWindow(window_app_id); |
| 1932 ASSERT_TRUE(arc_window); |
| 1933 arc_test_.app_instance()->SendTaskCreated(1, arc_test_.fake_apps()[0]); |
| 1934 const ash::ShelfID shelf_id = |
| 1935 launcher_controller_->GetShelfIDForAppID(arc_app_id); |
| 1936 EXPECT_NE(0, shelf_id); |
| 1937 |
| 1938 for (int i = 0; i < 3; ++i) { |
| 1939 arc_window->Close(); |
| 1940 base::RunLoop().RunUntilIdle(); |
| 1941 EXPECT_EQ(shelf_id, launcher_controller_->GetShelfIDForAppID(arc_app_id)); |
| 1942 |
| 1943 arc_window = CreateArcWindow(window_app_id); |
| 1944 ASSERT_TRUE(arc_window); |
| 1945 base::RunLoop().RunUntilIdle(); |
| 1946 EXPECT_EQ(shelf_id, launcher_controller_->GetShelfIDForAppID(arc_app_id)); |
| 1947 } |
| 1948 } |
| 1949 |
| 1922 // Validate that Arc app is pinned correctly and pin is removed automatically | 1950 // Validate that Arc app is pinned correctly and pin is removed automatically |
| 1923 // once app is uninstalled. | 1951 // once app is uninstalled. |
| 1924 TEST_F(ChromeLauncherControllerImplWithArcTest, ArcAppPin) { | 1952 TEST_F(ChromeLauncherControllerImplWithArcTest, ArcAppPin) { |
| 1925 InitLauncherController(); | 1953 InitLauncherController(); |
| 1926 | 1954 |
| 1927 const std::string arc_app_id = ArcAppTest::GetAppId(arc_test_.fake_apps()[0]); | 1955 const std::string arc_app_id = ArcAppTest::GetAppId(arc_test_.fake_apps()[0]); |
| 1928 | 1956 |
| 1929 SendListOfArcApps(); | 1957 SendListOfArcApps(); |
| 1930 extension_service_->AddExtension(extension1_.get()); | 1958 extension_service_->AddExtension(extension1_.get()); |
| 1931 extension_service_->AddExtension(extension2_.get()); | 1959 extension_service_->AddExtension(extension2_.get()); |
| (...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3795 EXPECT_FALSE(controller->rotation_locked()); | 3823 EXPECT_FALSE(controller->rotation_locked()); |
| 3796 EXPECT_EQ(display::Display::ROTATE_0, | 3824 EXPECT_EQ(display::Display::ROTATE_0, |
| 3797 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); | 3825 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); |
| 3798 | 3826 |
| 3799 NotifyOnTaskOrientationLockRequested(task_id_current_, | 3827 NotifyOnTaskOrientationLockRequested(task_id_current_, |
| 3800 OrientationLock::CURRENT); | 3828 OrientationLock::CURRENT); |
| 3801 EXPECT_TRUE(controller->rotation_locked()); | 3829 EXPECT_TRUE(controller->rotation_locked()); |
| 3802 EXPECT_EQ(display::Display::ROTATE_0, | 3830 EXPECT_EQ(display::Display::ROTATE_0, |
| 3803 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); | 3831 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); |
| 3804 } | 3832 } |
| OLD | NEW |