| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/app_list/arc/arc_app_dialog.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_app_dialog.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 9 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 private: | 102 private: |
| 103 ArcAppListPrefs* arc_app_list_pref_ = nullptr; | 103 ArcAppListPrefs* arc_app_list_pref_ = nullptr; |
| 104 | 104 |
| 105 Profile* profile_ = nullptr; | 105 Profile* profile_ = nullptr; |
| 106 | 106 |
| 107 std::unique_ptr<arc::FakeAppInstance> app_instance_; | 107 std::unique_ptr<arc::FakeAppInstance> app_instance_; |
| 108 | 108 |
| 109 DISALLOW_COPY_AND_ASSIGN(ArcAppUninstallDialogViewBrowserTest); | 109 DISALLOW_COPY_AND_ASSIGN(ArcAppUninstallDialogViewBrowserTest); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 // User confirms/cancels Arc app uninstall. Note that the shortcut is removed | 112 // User confirms/cancels ARC app uninstall. Note that the shortcut is removed |
| 113 // when the app and the package are uninstalled since the shortcut and the app | 113 // when the app and the package are uninstalled since the shortcut and the app |
| 114 // share same package. | 114 // share same package. |
| 115 IN_PROC_BROWSER_TEST_F(ArcAppUninstallDialogViewBrowserTest, | 115 IN_PROC_BROWSER_TEST_F(ArcAppUninstallDialogViewBrowserTest, |
| 116 UserConfirmsUninstall) { | 116 UserConfirmsUninstall) { |
| 117 std::vector<std::string> app_ids = arc_app_list_pref()->GetAppIds(); | 117 std::vector<std::string> app_ids = arc_app_list_pref()->GetAppIds(); |
| 118 EXPECT_EQ(app_ids.size(), 2u); | 118 EXPECT_EQ(app_ids.size(), 2u); |
| 119 std::string package_name = base::StringPrintf("fake.package.%d", 0); | 119 std::string package_name = base::StringPrintf("fake.package.%d", 0); |
| 120 std::string app_activity = base::StringPrintf("fake.app.%d.activity", 0); | 120 std::string app_activity = base::StringPrintf("fake.app.%d.activity", 0); |
| 121 std::string app_id = | 121 std::string app_id = |
| 122 arc_app_list_pref()->GetAppId(package_name, app_activity); | 122 arc_app_list_pref()->GetAppId(package_name, app_activity); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 137 ShowArcAppUninstallDialog(browser()->profile(), controller, app_id); | 137 ShowArcAppUninstallDialog(browser()->profile(), controller, app_id); |
| 138 content::RunAllPendingInMessageLoop(); | 138 content::RunAllPendingInMessageLoop(); |
| 139 | 139 |
| 140 EXPECT_TRUE(CloseAppDialogViewAndConfirmForTest(true)); | 140 EXPECT_TRUE(CloseAppDialogViewAndConfirmForTest(true)); |
| 141 content::RunAllPendingInMessageLoop(); | 141 content::RunAllPendingInMessageLoop(); |
| 142 app_ids = arc_app_list_pref()->GetAppIds(); | 142 app_ids = arc_app_list_pref()->GetAppIds(); |
| 143 EXPECT_EQ(app_ids.size(), 0u); | 143 EXPECT_EQ(app_ids.size(), 0u); |
| 144 controller->DismissView(); | 144 controller->DismissView(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 // User confirms/cancels Arc app shortcut removal. Note that the app is not | 147 // User confirms/cancels ARC app shortcut removal. Note that the app is not |
| 148 // uninstalled when the shortcut is removed. | 148 // uninstalled when the shortcut is removed. |
| 149 IN_PROC_BROWSER_TEST_F(ArcAppUninstallDialogViewBrowserTest, | 149 IN_PROC_BROWSER_TEST_F(ArcAppUninstallDialogViewBrowserTest, |
| 150 UserConfirmsUninstallShortcut) { | 150 UserConfirmsUninstallShortcut) { |
| 151 std::vector<std::string> app_ids = arc_app_list_pref()->GetAppIds(); | 151 std::vector<std::string> app_ids = arc_app_list_pref()->GetAppIds(); |
| 152 EXPECT_EQ(app_ids.size(), 2u); | 152 EXPECT_EQ(app_ids.size(), 2u); |
| 153 std::string package_name = base::StringPrintf("fake.package.%d", 0); | 153 std::string package_name = base::StringPrintf("fake.package.%d", 0); |
| 154 std::string intent_uri = base::StringPrintf("Fake Shortcut uri %d", 0); | 154 std::string intent_uri = base::StringPrintf("Fake Shortcut uri %d", 0); |
| 155 std::string app_id = arc_app_list_pref()->GetAppId(package_name, intent_uri); | 155 std::string app_id = arc_app_list_pref()->GetAppId(package_name, intent_uri); |
| 156 | 156 |
| 157 AppListService* service = AppListService::Get(); | 157 AppListService* service = AppListService::Get(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 171 content::RunAllPendingInMessageLoop(); | 171 content::RunAllPendingInMessageLoop(); |
| 172 | 172 |
| 173 EXPECT_TRUE(CloseAppDialogViewAndConfirmForTest(true)); | 173 EXPECT_TRUE(CloseAppDialogViewAndConfirmForTest(true)); |
| 174 content::RunAllPendingInMessageLoop(); | 174 content::RunAllPendingInMessageLoop(); |
| 175 app_ids = arc_app_list_pref()->GetAppIds(); | 175 app_ids = arc_app_list_pref()->GetAppIds(); |
| 176 EXPECT_EQ(app_ids.size(), 1u); | 176 EXPECT_EQ(app_ids.size(), 1u); |
| 177 controller->DismissView(); | 177 controller->DismissView(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace arc | 180 } // namespace arc |
| OLD | NEW |