Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(687)

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc

Issue 2282023002: arc: Support window recreation. (Closed)
Patch Set: rebase + nits Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 1879
1880 // Arc window created after and closed before mojom notification. 1880 // Arc window created after and closed before mojom notification.
1881 std::string window_app_id2("org.chromium.arc.2"); 1881 std::string window_app_id2("org.chromium.arc.2");
1882 arc_test_.app_instance()->SendTaskCreated(2, arc_test_.fake_apps()[1]); 1882 arc_test_.app_instance()->SendTaskCreated(2, arc_test_.fake_apps()[1]);
1883 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); 1883 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2));
1884 arc_window = CreateArcWindow(window_app_id2); 1884 arc_window = CreateArcWindow(window_app_id2);
1885 ASSERT_TRUE(arc_window); 1885 ASSERT_TRUE(arc_window);
1886 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); 1886 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2));
1887 arc_window->Close(); 1887 arc_window->Close();
1888 base::RunLoop().RunUntilIdle(); 1888 base::RunLoop().RunUntilIdle();
1889 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); 1889 // Closing window does not close shelf item. It is closed on task destroy.
1890 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2));
1890 arc_test_.app_instance()->SendTaskDestroyed(2); 1891 arc_test_.app_instance()->SendTaskDestroyed(2);
1891 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); 1892 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2));
1892 } 1893 }
1893 1894
1895 TEST_F(ChromeLauncherControllerImplTest, ArcWindowRecreation) {
1896 arc_test_.SetUp(profile());
1897 InitLauncherController();
1898
1899 const std::string arc_app_id = ArcAppTest::GetAppId(arc_test_.fake_apps()[0]);
1900 SendListOfArcApps();
1901
1902 std::string window_app_id("org.chromium.arc.1");
1903 views::Widget* arc_window = CreateArcWindow(window_app_id);
1904 ASSERT_TRUE(arc_window);
1905 arc_test_.app_instance()->SendTaskCreated(1, arc_test_.fake_apps()[0]);
1906 const ash::ShelfID shelf_id =
1907 launcher_controller_->GetShelfIDForAppID(arc_app_id);
1908 EXPECT_NE(0, shelf_id);
1909
1910 for (int i = 0; i < 3; ++i) {
1911 arc_window->Close();
1912 base::RunLoop().RunUntilIdle();
1913 EXPECT_EQ(shelf_id, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1914
1915 arc_window = CreateArcWindow(window_app_id);
1916 ASSERT_TRUE(arc_window);
1917 base::RunLoop().RunUntilIdle();
1918 EXPECT_EQ(shelf_id, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1919 }
1920 }
1921
1894 // Validate that Arc app is pinned correctly and pin is removed automatically 1922 // Validate that Arc app is pinned correctly and pin is removed automatically
1895 // once app is uninstalled. 1923 // once app is uninstalled.
1896 TEST_F(ChromeLauncherControllerImplTest, ArcAppPin) { 1924 TEST_F(ChromeLauncherControllerImplTest, ArcAppPin) {
1897 arc_test_.SetUp(profile()); 1925 arc_test_.SetUp(profile());
1898 InitLauncherController(); 1926 InitLauncherController();
1899 1927
1900 const std::string arc_app_id = ArcAppTest::GetAppId(arc_test_.fake_apps()[0]); 1928 const std::string arc_app_id = ArcAppTest::GetAppId(arc_test_.fake_apps()[0]);
1901 1929
1902 SendListOfArcApps(); 1930 SendListOfArcApps();
1903 extension_service_->AddExtension(extension1_.get()); 1931 extension_service_->AddExtension(extension1_.get());
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
3701 EXPECT_FALSE(controller->rotation_locked()); 3729 EXPECT_FALSE(controller->rotation_locked());
3702 EXPECT_EQ(display::Display::ROTATE_0, 3730 EXPECT_EQ(display::Display::ROTATE_0,
3703 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); 3731 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3704 3732
3705 NotifyOnTaskOrientationLockRequested(task_id_current_, 3733 NotifyOnTaskOrientationLockRequested(task_id_current_,
3706 OrientationLock::CURRENT); 3734 OrientationLock::CURRENT);
3707 EXPECT_TRUE(controller->rotation_locked()); 3735 EXPECT_TRUE(controller->rotation_locked());
3708 EXPECT_EQ(display::Display::ROTATE_0, 3736 EXPECT_EQ(display::Display::ROTATE_0,
3709 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); 3737 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3710 } 3738 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698