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

Side by Side Diff: chrome/browser/ui/app_list/arc/arc_app_unittest.cc

Issue 2702723002: Extract kArcEnabled preference from ArcSessionManager part 1. (Closed)
Patch Set: Address comments. Created 3 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/task_runner_util.h" 18 #include "base/task_runner_util.h"
19 #include "base/threading/sequenced_worker_pool.h" 19 #include "base/threading/sequenced_worker_pool.h"
20 #include "base/values.h" 20 #include "base/values.h"
21 #include "chrome/browser/chromeos/arc/arc_support_host.h" 21 #include "chrome/browser/chromeos/arc/arc_support_host.h"
22 #include "chrome/browser/chromeos/arc/arc_util.h"
22 #include "chrome/browser/extensions/extension_service.h" 23 #include "chrome/browser/extensions/extension_service.h"
23 #include "chrome/browser/policy/profile_policy_connector.h" 24 #include "chrome/browser/policy/profile_policy_connector.h"
24 #include "chrome/browser/policy/profile_policy_connector_factory.h" 25 #include "chrome/browser/policy/profile_policy_connector_factory.h"
25 #include "chrome/browser/ui/app_list/app_list_test_util.h" 26 #include "chrome/browser/ui/app_list/app_list_test_util.h"
26 #include "chrome/browser/ui/app_list/arc/arc_app_icon.h" 27 #include "chrome/browser/ui/app_list/arc/arc_app_icon.h"
27 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" 28 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h"
28 #include "chrome/browser/ui/app_list/arc/arc_app_item.h" 29 #include "chrome/browser/ui/app_list/arc/arc_app_item.h"
29 #include "chrome/browser/ui/app_list/arc/arc_app_launcher.h" 30 #include "chrome/browser/ui/app_list/arc/arc_app_launcher.h"
30 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 31 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
31 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h" 32 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h"
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 app.sticky = false; 991 app.sticky = false;
991 apps.push_back(app); 992 apps.push_back(app);
992 993
993 app_instance()->RefreshAppList(); 994 app_instance()->RefreshAppList();
994 app_instance()->SendRefreshAppList(apps); 995 app_instance()->SendRefreshAppList(apps);
995 996
996 app_info = prefs->GetApp(arc::kPlayStoreAppId); 997 app_info = prefs->GetApp(arc::kPlayStoreAppId);
997 ASSERT_TRUE(app_info); 998 ASSERT_TRUE(app_info);
998 EXPECT_TRUE(app_info->ready); 999 EXPECT_TRUE(app_info->ready);
999 1000
1000 arc_test()->arc_session_manager()->SetArcPlayStoreEnabled(false); 1001 arc::SetArcPlayStoreEnabledForProfile(profile(), false);
1001 1002
1002 app_info = prefs->GetApp(arc::kPlayStoreAppId); 1003 app_info = prefs->GetApp(arc::kPlayStoreAppId);
1003 ASSERT_TRUE(app_info); 1004 ASSERT_TRUE(app_info);
1004 EXPECT_FALSE(app_info->ready); 1005 EXPECT_FALSE(app_info->ready);
1005 1006
1006 arc::LaunchApp(profile(), arc::kPlayStoreAppId, ui::EF_NONE); 1007 arc::LaunchApp(profile(), arc::kPlayStoreAppId, ui::EF_NONE);
1007 EXPECT_TRUE(arc_test()->arc_session_manager()->IsArcPlayStoreEnabled()); 1008 EXPECT_TRUE(arc::IsArcPlayStoreEnabledForProfile(profile()));
1008 } 1009 }
1009 1010
1010 // Test that icon is correctly extracted for shelf group. 1011 // Test that icon is correctly extracted for shelf group.
1011 TEST_F(ArcAppModelBuilderTest, IconLoaderForShelfGroup) { 1012 TEST_F(ArcAppModelBuilderTest, IconLoaderForShelfGroup) {
1012 const arc::mojom::AppInfo& app = fake_apps()[0]; 1013 const arc::mojom::AppInfo& app = fake_apps()[0];
1013 const std::string app_id = ArcAppTest::GetAppId(app); 1014 const std::string app_id = ArcAppTest::GetAppId(app);
1014 1015
1015 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get()); 1016 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
1016 ASSERT_NE(nullptr, prefs); 1017 ASSERT_NE(nullptr, prefs);
1017 1018
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 EXPECT_TRUE(app_info->ready); 1257 EXPECT_TRUE(app_info->ready);
1257 oem_states[app_id] = prefs->IsOem(app_id); 1258 oem_states[app_id] = prefs->IsOem(app_id);
1258 } 1259 }
1259 1260
1260 // Uninstall first default package. Default app should go away. 1261 // Uninstall first default package. Default app should go away.
1261 app_instance()->SendPackageUninstalled(all_apps[0].package_name); 1262 app_instance()->SendPackageUninstalled(all_apps[0].package_name);
1262 all_apps.erase(all_apps.begin()); 1263 all_apps.erase(all_apps.begin());
1263 ValidateHaveApps(all_apps); 1264 ValidateHaveApps(all_apps);
1264 1265
1265 // OptOut and default apps should exist minus first. 1266 // OptOut and default apps should exist minus first.
1266 arc_test()->arc_session_manager()->SetArcPlayStoreEnabled(false); 1267 arc::SetArcPlayStoreEnabledForProfile(profile(), false);
1267 all_apps = fake_default_apps(); 1268 all_apps = fake_default_apps();
1268 all_apps.erase(all_apps.begin()); 1269 all_apps.erase(all_apps.begin());
1269 ValidateHaveApps(all_apps); 1270 ValidateHaveApps(all_apps);
1270 1271
1271 // Sign-out and sign-in again. Removed default app should not appear. 1272 // Sign-out and sign-in again. Removed default app should not appear.
1272 arc_test()->TearDown(); 1273 arc_test()->TearDown();
1273 ResetBuilder(); 1274 ResetBuilder();
1274 ArcAppListPrefsFactory::GetInstance()->RecreateServiceInstanceForTesting( 1275 ArcAppListPrefsFactory::GetInstance()->RecreateServiceInstanceForTesting(
1275 profile_.get()); 1276 profile_.get());
1276 arc_test()->SetUp(profile_.get()); 1277 arc_test()->SetUp(profile_.get());
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 const ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(profile_.get()); 1360 const ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(profile_.get());
1360 ASSERT_TRUE(prefs); 1361 ASSERT_TRUE(prefs);
1361 1362
1362 // There is no default app for managed users except Play Store 1363 // There is no default app for managed users except Play Store
1363 for (const auto& app : fake_default_apps()) { 1364 for (const auto& app : fake_default_apps()) {
1364 const std::string app_id = ArcAppTest::GetAppId(app); 1365 const std::string app_id = ArcAppTest::GetAppId(app);
1365 EXPECT_FALSE(prefs->IsRegistered(app_id)); 1366 EXPECT_FALSE(prefs->IsRegistered(app_id));
1366 EXPECT_FALSE(prefs->GetApp(app_id)); 1367 EXPECT_FALSE(prefs->GetApp(app_id));
1367 } 1368 }
1368 } 1369 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_test.cc ('k') | chrome/browser/ui/app_list/arc/arc_app_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698