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

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: Issue Fixed. Created 4 years, 4 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #include "chrome/common/extensions/extension_constants.h" 73 #include "chrome/common/extensions/extension_constants.h"
74 #include "chrome/common/pref_names.h" 74 #include "chrome/common/pref_names.h"
75 #include "chrome/test/base/browser_with_test_window_test.h" 75 #include "chrome/test/base/browser_with_test_window_test.h"
76 #include "chrome/test/base/test_browser_window_aura.h" 76 #include "chrome/test/base/test_browser_window_aura.h"
77 #include "chrome/test/base/testing_browser_process.h" 77 #include "chrome/test/base/testing_browser_process.h"
78 #include "chrome/test/base/testing_profile.h" 78 #include "chrome/test/base/testing_profile.h"
79 #include "chrome/test/base/testing_profile_manager.h" 79 #include "chrome/test/base/testing_profile_manager.h"
80 #include "chromeos/chromeos_switches.h" 80 #include "chromeos/chromeos_switches.h"
81 #include "components/arc/common/app.mojom.h" 81 #include "components/arc/common/app.mojom.h"
82 #include "components/arc/test/fake_app_instance.h" 82 #include "components/arc/test/fake_app_instance.h"
83 #include "components/arc/test/fake_arc_bridge_service.h"
84 #include "components/exo/shell_surface.h" 83 #include "components/exo/shell_surface.h"
85 #include "components/signin/core/account_id/account_id.h" 84 #include "components/signin/core/account_id/account_id.h"
86 #include "components/syncable_prefs/testing_pref_service_syncable.h" 85 #include "components/syncable_prefs/testing_pref_service_syncable.h"
87 #include "components/user_manager/fake_user_manager.h" 86 #include "components/user_manager/fake_user_manager.h"
88 #include "content/public/browser/web_contents.h" 87 #include "content/public/browser/web_contents.h"
89 #include "content/public/browser/web_contents_observer.h" 88 #include "content/public/browser/web_contents_observer.h"
90 #include "content/public/test/test_utils.h" 89 #include "content/public/test/test_utils.h"
91 #include "content/public/test/web_contents_tester.h" 90 #include "content/public/test/web_contents_tester.h"
92 #include "extensions/browser/app_window/app_window_contents.h" 91 #include "extensions/browser/app_window/app_window_contents.h"
93 #include "extensions/browser/app_window/app_window_registry.h" 92 #include "extensions/browser/app_window/app_window_registry.h"
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 1774
1776 const arc::mojom::AppInfo& app1 = arc_test_.fake_apps()[0]; 1775 const arc::mojom::AppInfo& app1 = arc_test_.fake_apps()[0];
1777 const arc::mojom::AppInfo& app2 = arc_test_.fake_apps()[1]; 1776 const arc::mojom::AppInfo& app2 = arc_test_.fake_apps()[1];
1778 const arc::mojom::AppInfo& app3 = arc_test_.fake_apps()[2]; 1777 const arc::mojom::AppInfo& app3 = arc_test_.fake_apps()[2];
1779 const std::string arc_app_id1 = ArcAppTest::GetAppId(app1); 1778 const std::string arc_app_id1 = ArcAppTest::GetAppId(app1);
1780 const std::string arc_app_id2 = ArcAppTest::GetAppId(app2); 1779 const std::string arc_app_id2 = ArcAppTest::GetAppId(app2);
1781 const std::string arc_app_id3 = ArcAppTest::GetAppId(app3); 1780 const std::string arc_app_id3 = ArcAppTest::GetAppId(app3);
1782 1781
1783 SendListOfArcApps(); 1782 SendListOfArcApps();
1784 1783
1785 arc_test_.bridge_service()->SetStopped(); 1784 arc_test_.SetBridgeServiceStopped();
1786 1785
1787 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1)); 1786 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1));
1788 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); 1787 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2));
1789 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id3)); 1788 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id3));
1790 1789
1791 arc::LaunchApp(profile(), arc_app_id1); 1790 arc::LaunchApp(profile(), arc_app_id1);
1792 arc::LaunchApp(profile(), arc_app_id1); 1791 arc::LaunchApp(profile(), arc_app_id1);
1793 arc::LaunchApp(profile(), arc_app_id2); 1792 arc::LaunchApp(profile(), arc_app_id2);
1794 arc::LaunchApp(profile(), arc_app_id3); 1793 arc::LaunchApp(profile(), arc_app_id3);
1795 arc::LaunchApp(profile(), arc_app_id3); 1794 arc::LaunchApp(profile(), arc_app_id3);
(...skipping 15 matching lines...) Expand all
1811 ASSERT_NE(nullptr, item_controller); 1810 ASSERT_NE(nullptr, item_controller);
1812 item_controller->Close(); 1811 item_controller->Close();
1813 base::RunLoop().RunUntilIdle(); 1812 base::RunLoop().RunUntilIdle();
1814 1813
1815 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1)); 1814 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1));
1816 EXPECT_EQ(shelf_id_app_2, 1815 EXPECT_EQ(shelf_id_app_2,
1817 launcher_controller_->GetShelfIDForAppID(arc_app_id2)); 1816 launcher_controller_->GetShelfIDForAppID(arc_app_id2));
1818 EXPECT_EQ(shelf_id_app_3, 1817 EXPECT_EQ(shelf_id_app_3,
1819 launcher_controller_->GetShelfIDForAppID(arc_app_id3)); 1818 launcher_controller_->GetShelfIDForAppID(arc_app_id3));
1820 1819
1821 arc_test_.bridge_service()->SetReady(); 1820 arc_test_.ResetBridgeServiceReady();
1822 SendListOfArcApps(); 1821 SendListOfArcApps();
1823 1822
1824 base::RunLoop().RunUntilIdle(); 1823 base::RunLoop().RunUntilIdle();
1825 1824
1826 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1)); 1825 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1));
1827 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); 1826 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2));
1828 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id3)); 1827 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id3));
1829 1828
1830 ASSERT_EQ(2U, arc_test_.app_instance()->launch_requests().size()); 1829 ASSERT_EQ(2U, arc_test_.app_instance()->launch_requests().size());
1831 1830
(...skipping 20 matching lines...) Expand all
1852 arc_test_.app_instance()->SendTaskCreated(2, arc_test_.fake_apps()[0]); 1851 arc_test_.app_instance()->SendTaskCreated(2, arc_test_.fake_apps()[0]);
1853 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); 1852 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1854 arc_test_.app_instance()->SendTaskDestroyed(1); 1853 arc_test_.app_instance()->SendTaskDestroyed(1);
1855 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); 1854 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1856 arc_test_.app_instance()->SendTaskDestroyed(2); 1855 arc_test_.app_instance()->SendTaskDestroyed(2);
1857 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); 1856 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1858 1857
1859 // Stopping bridge removes apps. 1858 // Stopping bridge removes apps.
1860 arc_test_.app_instance()->SendTaskCreated(3, arc_test_.fake_apps()[0]); 1859 arc_test_.app_instance()->SendTaskCreated(3, arc_test_.fake_apps()[0]);
1861 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); 1860 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1862 arc_test_.bridge_service()->SetStopped(); 1861 arc_test_.SetBridgeServiceStopped();
1863 base::RunLoop().RunUntilIdle(); 1862 base::RunLoop().RunUntilIdle();
1864 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id)); 1863 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1865 } 1864 }
1866 1865
1867 // Validate that Arc app is pinned correctly and pin is removed automatically 1866 // Validate that Arc app is pinned correctly and pin is removed automatically
1868 // once app is uninstalled. 1867 // once app is uninstalled.
1869 TEST_F(ChromeLauncherControllerImplTest, ArcAppPin) { 1868 TEST_F(ChromeLauncherControllerImplTest, ArcAppPin) {
1870 arc_test_.SetUp(profile()); 1869 arc_test_.SetUp(profile());
1871 InitLauncherController(); 1870 InitLauncherController();
1872 1871
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after
3698 EXPECT_FALSE(controller->rotation_locked()); 3697 EXPECT_FALSE(controller->rotation_locked());
3699 EXPECT_EQ(display::Display::ROTATE_0, 3698 EXPECT_EQ(display::Display::ROTATE_0,
3700 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); 3699 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3701 3700
3702 NotifyOnTaskOrientationLockRequested(task_id_current_, 3701 NotifyOnTaskOrientationLockRequested(task_id_current_,
3703 OrientationLock::CURRENT); 3702 OrientationLock::CURRENT);
3704 EXPECT_TRUE(controller->rotation_locked()); 3703 EXPECT_TRUE(controller->rotation_locked());
3705 EXPECT_EQ(display::Display::ROTATE_0, 3704 EXPECT_EQ(display::Display::ROTATE_0,
3706 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); 3705 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3707 } 3706 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698