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

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

Issue 2106663004: arc: Initial implemetation of Chrome sync for Arc packages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wrap bridge state related method in unit_tests. Created 4 years, 5 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
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 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 1775
1776 const arc::mojom::AppInfo& app1 = arc_test_.fake_apps()[0]; 1776 const arc::mojom::AppInfo& app1 = arc_test_.fake_apps()[0];
1777 const arc::mojom::AppInfo& app2 = arc_test_.fake_apps()[1]; 1777 const arc::mojom::AppInfo& app2 = arc_test_.fake_apps()[1];
1778 const arc::mojom::AppInfo& app3 = arc_test_.fake_apps()[2]; 1778 const arc::mojom::AppInfo& app3 = arc_test_.fake_apps()[2];
1779 const std::string arc_app_id1 = ArcAppTest::GetAppId(app1); 1779 const std::string arc_app_id1 = ArcAppTest::GetAppId(app1);
1780 const std::string arc_app_id2 = ArcAppTest::GetAppId(app2); 1780 const std::string arc_app_id2 = ArcAppTest::GetAppId(app2);
1781 const std::string arc_app_id3 = ArcAppTest::GetAppId(app3); 1781 const std::string arc_app_id3 = ArcAppTest::GetAppId(app3);
1782 1782
1783 SendListOfArcApps(); 1783 SendListOfArcApps();
1784 1784
1785 arc_test_.bridge_service()->SetStopped(); 1785 arc_test_.SetBridgeServiceStopped();
1786 1786
1787 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1)); 1787 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1));
1788 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); 1788 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2));
1789 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id3)); 1789 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id3));
1790 1790
1791 arc::LaunchApp(profile(), arc_app_id1); 1791 arc::LaunchApp(profile(), arc_app_id1);
1792 arc::LaunchApp(profile(), arc_app_id1); 1792 arc::LaunchApp(profile(), arc_app_id1);
1793 arc::LaunchApp(profile(), arc_app_id2); 1793 arc::LaunchApp(profile(), arc_app_id2);
1794 arc::LaunchApp(profile(), arc_app_id3); 1794 arc::LaunchApp(profile(), arc_app_id3);
1795 arc::LaunchApp(profile(), arc_app_id3); 1795 arc::LaunchApp(profile(), arc_app_id3);
(...skipping 15 matching lines...) Expand all
1811 ASSERT_NE(nullptr, item_controller); 1811 ASSERT_NE(nullptr, item_controller);
1812 item_controller->Close(); 1812 item_controller->Close();
1813 base::RunLoop().RunUntilIdle(); 1813 base::RunLoop().RunUntilIdle();
1814 1814
1815 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1)); 1815 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1));
1816 EXPECT_EQ(shelf_id_app_2, 1816 EXPECT_EQ(shelf_id_app_2,
1817 launcher_controller_->GetShelfIDForAppID(arc_app_id2)); 1817 launcher_controller_->GetShelfIDForAppID(arc_app_id2));
1818 EXPECT_EQ(shelf_id_app_3, 1818 EXPECT_EQ(shelf_id_app_3,
1819 launcher_controller_->GetShelfIDForAppID(arc_app_id3)); 1819 launcher_controller_->GetShelfIDForAppID(arc_app_id3));
1820 1820
1821 arc_test_.bridge_service()->SetReady(); 1821 arc_test_.ResetBridgeServiceReady();
1822 SendListOfArcApps(); 1822 SendListOfArcApps();
1823 1823
1824 base::RunLoop().RunUntilIdle(); 1824 base::RunLoop().RunUntilIdle();
1825 1825
1826 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1)); 1826 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1));
1827 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); 1827 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2));
1828 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id3)); 1828 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id3));
1829 1829
1830 ASSERT_EQ(2U, arc_test_.app_instance()->launch_requests().size()); 1830 ASSERT_EQ(2U, arc_test_.app_instance()->launch_requests().size());
1831 1831
(...skipping 20 matching lines...) Expand all
1852 arc_test_.app_instance()->SendTaskCreated(2, arc_test_.fake_apps()[0]); 1852 arc_test_.app_instance()->SendTaskCreated(2, arc_test_.fake_apps()[0]);
1853 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); 1853 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1854 arc_test_.app_instance()->SendTaskDestroyed(1); 1854 arc_test_.app_instance()->SendTaskDestroyed(1);
1855 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); 1855 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1856 arc_test_.app_instance()->SendTaskDestroyed(2); 1856 arc_test_.app_instance()->SendTaskDestroyed(2);
1857 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); 1857 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1858 1858
1859 // Stopping bridge removes apps. 1859 // Stopping bridge removes apps.
1860 arc_test_.app_instance()->SendTaskCreated(3, arc_test_.fake_apps()[0]); 1860 arc_test_.app_instance()->SendTaskCreated(3, arc_test_.fake_apps()[0]);
1861 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); 1861 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1862 arc_test_.bridge_service()->SetStopped(); 1862 arc_test_.SetBridgeServiceStopped();
1863 base::RunLoop().RunUntilIdle(); 1863 base::RunLoop().RunUntilIdle();
1864 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); 1864 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1865 } 1865 }
1866 1866
1867 // Validate that Arc app is pinned correctly and pin is removed automatically 1867 // Validate that Arc app is pinned correctly and pin is removed automatically
1868 // once app is uninstalled. 1868 // once app is uninstalled.
1869 TEST_F(ChromeLauncherControllerImplTest, ArcAppPin) { 1869 TEST_F(ChromeLauncherControllerImplTest, ArcAppPin) {
1870 arc_test_.SetUp(profile()); 1870 arc_test_.SetUp(profile());
1871 InitLauncherController(); 1871 InitLauncherController();
1872 1872
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after
3698 EXPECT_FALSE(controller->rotation_locked()); 3698 EXPECT_FALSE(controller->rotation_locked());
3699 EXPECT_EQ(display::Display::ROTATE_0, 3699 EXPECT_EQ(display::Display::ROTATE_0,
3700 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); 3700 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3701 3701
3702 NotifyOnTaskOrientationLockRequested(task_id_current_, 3702 NotifyOnTaskOrientationLockRequested(task_id_current_,
3703 OrientationLock::CURRENT); 3703 OrientationLock::CURRENT);
3704 EXPECT_TRUE(controller->rotation_locked()); 3704 EXPECT_TRUE(controller->rotation_locked());
3705 EXPECT_EQ(display::Display::ROTATE_0, 3705 EXPECT_EQ(display::Display::ROTATE_0,
3706 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); 3706 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3707 } 3707 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698