| OLD | NEW |
| 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 <string> | 10 #include <string> |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 EXPECT_FALSE(launcher3.app_launched()); | 932 EXPECT_FALSE(launcher3.app_launched()); |
| 933 EXPECT_FALSE(prefs->HasObserver(&launcher1)); | 933 EXPECT_FALSE(prefs->HasObserver(&launcher1)); |
| 934 EXPECT_TRUE(prefs->HasObserver(&launcher3)); | 934 EXPECT_TRUE(prefs->HasObserver(&launcher3)); |
| 935 | 935 |
| 936 ArcAppLauncher launcher2(profile(), id2, true); | 936 ArcAppLauncher launcher2(profile(), id2, true); |
| 937 EXPECT_TRUE(launcher2.app_launched()); | 937 EXPECT_TRUE(launcher2.app_launched()); |
| 938 EXPECT_FALSE(prefs->HasObserver(&launcher2)); | 938 EXPECT_FALSE(prefs->HasObserver(&launcher2)); |
| 939 ASSERT_EQ(2u, app_instance()->launch_requests().size()); | 939 ASSERT_EQ(2u, app_instance()->launch_requests().size()); |
| 940 EXPECT_TRUE(app_instance()->launch_requests()[1]->IsForApp(app2)); | 940 EXPECT_TRUE(app_instance()->launch_requests()[1]->IsForApp(app2)); |
| 941 } | 941 } |
| 942 |
| 943 // Validates an app that have no launchable flag. |
| 944 TEST_F(ArcAppModelBuilderTest, NonLaunchableApp) { |
| 945 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get()); |
| 946 ASSERT_NE(nullptr, prefs); |
| 947 |
| 948 ValidateHaveApps(std::vector<arc::mojom::AppInfo>()); |
| 949 bridge_service()->SetReady(); |
| 950 app_instance()->RefreshAppList(); |
| 951 // Send all except first. |
| 952 std::vector<arc::mojom::AppInfo> apps(fake_apps().begin() + 1, |
| 953 fake_apps().end()); |
| 954 app_instance()->SendRefreshAppList(apps); |
| 955 ValidateHaveApps(apps); |
| 956 |
| 957 const std::string app_id = ArcAppTest::GetAppId(fake_apps()[0]); |
| 958 |
| 959 EXPECT_FALSE(prefs->IsRegistered(app_id)); |
| 960 EXPECT_FALSE(FindArcItem(app_id)); |
| 961 app_instance()->SendTaskCreated(0, fake_apps()[0]); |
| 962 // App should not appear now in the model but should be registered. |
| 963 EXPECT_FALSE(FindArcItem(app_id)); |
| 964 EXPECT_TRUE(prefs->IsRegistered(app_id)); |
| 965 } |
| 966 |
| OLD | NEW |