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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 #include "extensions/browser/app_window/native_app_window.h" | 96 #include "extensions/browser/app_window/native_app_window.h" |
97 #include "extensions/common/extension.h" | 97 #include "extensions/common/extension.h" |
98 #include "extensions/common/manifest_constants.h" | 98 #include "extensions/common/manifest_constants.h" |
99 #include "testing/gtest/include/gtest/gtest.h" | 99 #include "testing/gtest/include/gtest/gtest.h" |
100 #include "ui/aura/client/window_parenting_client.h" | 100 #include "ui/aura/client/window_parenting_client.h" |
101 #include "ui/aura/window.h" | 101 #include "ui/aura/window.h" |
102 #include "ui/base/models/menu_model.h" | 102 #include "ui/base/models/menu_model.h" |
103 #include "ui/display/display.h" | 103 #include "ui/display/display.h" |
104 #include "ui/display/display_switches.h" | 104 #include "ui/display/display_switches.h" |
105 #include "ui/display/screen.h" | 105 #include "ui/display/screen.h" |
| 106 #include "ui/events/event_constants.h" |
106 #include "ui/views/widget/widget.h" | 107 #include "ui/views/widget/widget.h" |
107 | 108 |
108 using base::ASCIIToUTF16; | 109 using base::ASCIIToUTF16; |
109 using extensions::Extension; | 110 using extensions::Extension; |
110 using extensions::Manifest; | 111 using extensions::Manifest; |
111 using extensions::UnloadedExtensionInfo; | 112 using extensions::UnloadedExtensionInfo; |
112 using arc::mojom::OrientationLock; | 113 using arc::mojom::OrientationLock; |
113 | 114 |
114 namespace { | 115 namespace { |
115 const char* offline_gmail_url = "https://mail.google.com/mail/mu/u"; | 116 const char* offline_gmail_url = "https://mail.google.com/mail/mu/u"; |
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 const std::string arc_app_id3 = ArcAppTest::GetAppId(app3); | 1782 const std::string arc_app_id3 = ArcAppTest::GetAppId(app3); |
1782 | 1783 |
1783 SendListOfArcApps(); | 1784 SendListOfArcApps(); |
1784 | 1785 |
1785 arc_test_.StopArcInstance(); | 1786 arc_test_.StopArcInstance(); |
1786 | 1787 |
1787 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1)); | 1788 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1)); |
1788 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); | 1789 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2)); |
1789 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id3)); | 1790 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id3)); |
1790 | 1791 |
1791 arc::LaunchApp(profile(), arc_app_id1); | 1792 arc::LaunchApp(profile(), arc_app_id1, ui::EF_NONE); |
1792 arc::LaunchApp(profile(), arc_app_id1); | 1793 arc::LaunchApp(profile(), arc_app_id1, ui::EF_NONE); |
1793 arc::LaunchApp(profile(), arc_app_id2); | 1794 arc::LaunchApp(profile(), arc_app_id2, ui::EF_NONE); |
1794 arc::LaunchApp(profile(), arc_app_id3); | 1795 arc::LaunchApp(profile(), arc_app_id3, ui::EF_NONE); |
1795 arc::LaunchApp(profile(), arc_app_id3); | 1796 arc::LaunchApp(profile(), arc_app_id3, ui::EF_NONE); |
1796 | 1797 |
1797 const ash::ShelfID shelf_id_app_1 = | 1798 const ash::ShelfID shelf_id_app_1 = |
1798 launcher_controller_->GetShelfIDForAppID(arc_app_id1); | 1799 launcher_controller_->GetShelfIDForAppID(arc_app_id1); |
1799 const ash::ShelfID shelf_id_app_2 = | 1800 const ash::ShelfID shelf_id_app_2 = |
1800 launcher_controller_->GetShelfIDForAppID(arc_app_id2); | 1801 launcher_controller_->GetShelfIDForAppID(arc_app_id2); |
1801 const ash::ShelfID shelf_id_app_3 = | 1802 const ash::ShelfID shelf_id_app_3 = |
1802 launcher_controller_->GetShelfIDForAppID(arc_app_id3); | 1803 launcher_controller_->GetShelfIDForAppID(arc_app_id3); |
1803 EXPECT_NE(0, shelf_id_app_1); | 1804 EXPECT_NE(0, shelf_id_app_1); |
1804 EXPECT_NE(0, shelf_id_app_2); | 1805 EXPECT_NE(0, shelf_id_app_2); |
1805 EXPECT_NE(0, shelf_id_app_3); | 1806 EXPECT_NE(0, shelf_id_app_3); |
(...skipping 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3926 launcher_controller_.get()); | 3927 launcher_controller_.get()); |
3927 | 3928 |
3928 ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs(); | 3929 ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs(); |
3929 EnableArc(false); | 3930 EnableArc(false); |
3930 EXPECT_FALSE(arc_test_.arc_session_manager()->IsArcEnabled()); | 3931 EXPECT_FALSE(arc_test_.arc_session_manager()->IsArcEnabled()); |
3931 ASSERT_TRUE(prefs->GetAppIds().size()); | 3932 ASSERT_TRUE(prefs->GetAppIds().size()); |
3932 | 3933 |
3933 const std::string app_id = | 3934 const std::string app_id = |
3934 ArcAppTest::GetAppId(arc_test_.fake_default_apps()[0]); | 3935 ArcAppTest::GetAppId(arc_test_.fake_default_apps()[0]); |
3935 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(app_id)); | 3936 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(app_id)); |
3936 EXPECT_TRUE(arc::LaunchApp(profile(), app_id)); | 3937 EXPECT_TRUE(arc::LaunchApp(profile(), app_id, ui::EF_NONE)); |
3937 EXPECT_TRUE(arc_test_.arc_session_manager()->IsArcEnabled()); | 3938 EXPECT_TRUE(arc_test_.arc_session_manager()->IsArcEnabled()); |
3938 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(app_id)); | 3939 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(app_id)); |
3939 | 3940 |
3940 // Stop Arc again. Shelf item should go away. | 3941 // Stop Arc again. Shelf item should go away. |
3941 EnableArc(false); | 3942 EnableArc(false); |
3942 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(app_id)); | 3943 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(app_id)); |
3943 | 3944 |
3944 EXPECT_TRUE(arc::LaunchApp(profile(), app_id)); | 3945 EXPECT_TRUE(arc::LaunchApp(profile(), app_id, ui::EF_NONE)); |
3945 EXPECT_TRUE(arc_test_.arc_session_manager()->IsArcEnabled()); | 3946 EXPECT_TRUE(arc_test_.arc_session_manager()->IsArcEnabled()); |
3946 | 3947 |
3947 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(app_id)); | 3948 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(app_id)); |
3948 EXPECT_TRUE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id)); | 3949 EXPECT_TRUE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id)); |
3949 | 3950 |
3950 std::string window_app_id("org.chromium.arc.1"); | 3951 std::string window_app_id("org.chromium.arc.1"); |
3951 CreateArcWindow(window_app_id); | 3952 CreateArcWindow(window_app_id); |
3952 arc_test_.app_instance()->SendTaskCreated(1, | 3953 arc_test_.app_instance()->SendTaskCreated(1, |
3953 arc_test_.fake_default_apps()[0]); | 3954 arc_test_.fake_default_apps()[0]); |
3954 | 3955 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4030 | 4031 |
4031 // Pinned state should not change. | 4032 // Pinned state should not change. |
4032 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); | 4033 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); |
4033 launcher_controller_->UnpinAppWithID(extension2_->id()); | 4034 launcher_controller_->UnpinAppWithID(extension2_->id()); |
4034 EXPECT_EQ("AppList, Chrome, App1", GetPinnedAppStatus()); | 4035 EXPECT_EQ("AppList, Chrome, App1", GetPinnedAppStatus()); |
4035 | 4036 |
4036 // Resume syncing and sync information overrides local copy. | 4037 // Resume syncing and sync information overrides local copy. |
4037 StartAppSyncService(copy_sync_list); | 4038 StartAppSyncService(copy_sync_list); |
4038 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); | 4039 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); |
4039 } | 4040 } |
OLD | NEW |