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

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

Issue 2553673003: [Merge to M55] Reland "Propagate information about how ARC apps are launched" (Closed)
Patch Set: Created 4 years 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>
(...skipping 24 matching lines...) Expand all
35 #include "chrome/test/base/testing_profile.h" 35 #include "chrome/test/base/testing_profile.h"
36 #include "components/arc/test/fake_app_instance.h" 36 #include "components/arc/test/fake_app_instance.h"
37 #include "components/arc/test/fake_arc_bridge_service.h" 37 #include "components/arc/test/fake_arc_bridge_service.h"
38 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
39 #include "extensions/browser/extension_system.h" 39 #include "extensions/browser/extension_system.h"
40 #include "extensions/common/extension.h" 40 #include "extensions/common/extension.h"
41 #include "extensions/common/manifest_constants.h" 41 #include "extensions/common/manifest_constants.h"
42 #include "testing/gtest/include/gtest/gtest.h" 42 #include "testing/gtest/include/gtest/gtest.h"
43 #include "ui/app_list/app_list_constants.h" 43 #include "ui/app_list/app_list_constants.h"
44 #include "ui/app_list/app_list_model.h" 44 #include "ui/app_list/app_list_model.h"
45 #include "ui/events/event_constants.h"
45 #include "ui/gfx/geometry/safe_integer_conversions.h" 46 #include "ui/gfx/geometry/safe_integer_conversions.h"
46 #include "ui/gfx/image/image_skia.h" 47 #include "ui/gfx/image/image_skia.h"
47 48
48 namespace { 49 namespace {
49 50
50 constexpr char kTestPackageName[] = "fake.package.name2"; 51 constexpr char kTestPackageName[] = "fake.package.name2";
51 52
52 class FakeAppIconLoaderDelegate : public AppIconLoaderDelegate { 53 class FakeAppIconLoaderDelegate : public AppIconLoaderDelegate {
53 public: 54 public:
54 FakeAppIconLoaderDelegate() {} 55 FakeAppIconLoaderDelegate() {}
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 app_info = prefs->GetApp(id1); 899 app_info = prefs->GetApp(id1);
899 ASSERT_NE(nullptr, app_info.get()); 900 ASSERT_NE(nullptr, app_info.get());
900 EXPECT_EQ(now_time, app_info->last_launch_time); 901 EXPECT_EQ(now_time, app_info->last_launch_time);
901 902
902 // Test setting last launch time via LaunchApp. 903 // Test setting last launch time via LaunchApp.
903 app_info = prefs->GetApp(id2); 904 app_info = prefs->GetApp(id2);
904 ASSERT_NE(nullptr, app_info.get()); 905 ASSERT_NE(nullptr, app_info.get());
905 EXPECT_EQ(base::Time(), app_info->last_launch_time); 906 EXPECT_EQ(base::Time(), app_info->last_launch_time);
906 907
907 base::Time time_before = base::Time::Now(); 908 base::Time time_before = base::Time::Now();
908 arc::LaunchApp(profile(), id2); 909 arc::LaunchApp(profile(), id2, ui::EF_NONE);
909 base::Time time_after = base::Time::Now(); 910 base::Time time_after = base::Time::Now();
910 911
911 app_info = prefs->GetApp(id2); 912 app_info = prefs->GetApp(id2);
912 ASSERT_NE(nullptr, app_info.get()); 913 ASSERT_NE(nullptr, app_info.get());
913 ASSERT_LE(time_before, app_info->last_launch_time); 914 ASSERT_LE(time_before, app_info->last_launch_time);
914 ASSERT_GE(time_after, app_info->last_launch_time); 915 ASSERT_GE(time_after, app_info->last_launch_time);
915 } 916 }
916 917
917 TEST_F(ArcPlayStoreAppTest, PlayStore) { 918 TEST_F(ArcPlayStoreAppTest, PlayStore) {
918 // Make sure PlayStore is available. 919 // Make sure PlayStore is available.
(...skipping 21 matching lines...) Expand all
940 app_info = prefs->GetApp(arc::kPlayStoreAppId); 941 app_info = prefs->GetApp(arc::kPlayStoreAppId);
941 ASSERT_TRUE(app_info); 942 ASSERT_TRUE(app_info);
942 EXPECT_TRUE(app_info->ready); 943 EXPECT_TRUE(app_info->ready);
943 944
944 arc_test()->arc_auth_service()->DisableArc(); 945 arc_test()->arc_auth_service()->DisableArc();
945 946
946 app_info = prefs->GetApp(arc::kPlayStoreAppId); 947 app_info = prefs->GetApp(arc::kPlayStoreAppId);
947 ASSERT_TRUE(app_info); 948 ASSERT_TRUE(app_info);
948 EXPECT_FALSE(app_info->ready); 949 EXPECT_FALSE(app_info->ready);
949 950
950 arc::LaunchApp(profile(), arc::kPlayStoreAppId); 951 arc::LaunchApp(profile(), arc::kPlayStoreAppId, ui::EF_NONE);
951 EXPECT_TRUE(arc_test()->arc_auth_service()->IsArcEnabled()); 952 EXPECT_TRUE(arc_test()->arc_auth_service()->IsArcEnabled());
952 } 953 }
953 954
954 // TODO(crbug.com/628425) -- reenable once this test is less flaky. 955 // TODO(crbug.com/628425) -- reenable once this test is less flaky.
955 TEST_F(ArcAppModelBuilderTest, DISABLED_IconLoader) { 956 TEST_F(ArcAppModelBuilderTest, DISABLED_IconLoader) {
956 const arc::mojom::AppInfo& app = fake_apps()[0]; 957 const arc::mojom::AppInfo& app = fake_apps()[0];
957 const std::string app_id = ArcAppTest::GetAppId(app); 958 const std::string app_id = ArcAppTest::GetAppId(app);
958 959
959 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get()); 960 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
960 ASSERT_NE(nullptr, prefs); 961 ASSERT_NE(nullptr, prefs);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 const ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(profile_.get()); 1149 const ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(profile_.get());
1149 ASSERT_TRUE(prefs); 1150 ASSERT_TRUE(prefs);
1150 1151
1151 // There is no default app for managed users except Play Store 1152 // There is no default app for managed users except Play Store
1152 for (const auto& app : fake_default_apps()) { 1153 for (const auto& app : fake_default_apps()) {
1153 const std::string app_id = ArcAppTest::GetAppId(app); 1154 const std::string app_id = ArcAppTest::GetAppId(app);
1154 EXPECT_FALSE(prefs->IsRegistered(app_id)); 1155 EXPECT_FALSE(prefs->IsRegistered(app_id));
1155 EXPECT_FALSE(prefs->GetApp(app_id)); 1156 EXPECT_FALSE(prefs->GetApp(app_id));
1156 } 1157 }
1157 } 1158 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_item.cc ('k') | chrome/browser/ui/app_list/arc/arc_app_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698