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

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

Issue 2540713003: Revert of 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 26 matching lines...) Expand all
37 #include "chrome/test/base/testing_profile.h" 37 #include "chrome/test/base/testing_profile.h"
38 #include "components/arc/test/fake_app_instance.h" 38 #include "components/arc/test/fake_app_instance.h"
39 #include "components/arc/test/fake_arc_bridge_service.h" 39 #include "components/arc/test/fake_arc_bridge_service.h"
40 #include "content/public/browser/browser_thread.h" 40 #include "content/public/browser/browser_thread.h"
41 #include "extensions/browser/extension_system.h" 41 #include "extensions/browser/extension_system.h"
42 #include "extensions/common/extension.h" 42 #include "extensions/common/extension.h"
43 #include "extensions/common/manifest_constants.h" 43 #include "extensions/common/manifest_constants.h"
44 #include "testing/gtest/include/gtest/gtest.h" 44 #include "testing/gtest/include/gtest/gtest.h"
45 #include "ui/app_list/app_list_constants.h" 45 #include "ui/app_list/app_list_constants.h"
46 #include "ui/app_list/app_list_model.h" 46 #include "ui/app_list/app_list_model.h"
47 #include "ui/events/event_constants.h"
48 #include "ui/gfx/geometry/safe_integer_conversions.h" 47 #include "ui/gfx/geometry/safe_integer_conversions.h"
49 #include "ui/gfx/image/image_skia.h" 48 #include "ui/gfx/image/image_skia.h"
50 49
51 namespace { 50 namespace {
52 51
53 constexpr char kTestPackageName[] = "fake.package.name2"; 52 constexpr char kTestPackageName[] = "fake.package.name2";
54 53
55 class FakeAppIconLoaderDelegate : public AppIconLoaderDelegate { 54 class FakeAppIconLoaderDelegate : public AppIconLoaderDelegate {
56 public: 55 public:
57 FakeAppIconLoaderDelegate() = default; 56 FakeAppIconLoaderDelegate() = default;
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 app_info = prefs->GetApp(id1); 919 app_info = prefs->GetApp(id1);
921 ASSERT_NE(nullptr, app_info.get()); 920 ASSERT_NE(nullptr, app_info.get());
922 EXPECT_EQ(now_time, app_info->last_launch_time); 921 EXPECT_EQ(now_time, app_info->last_launch_time);
923 922
924 // Test setting last launch time via LaunchApp. 923 // Test setting last launch time via LaunchApp.
925 app_info = prefs->GetApp(id2); 924 app_info = prefs->GetApp(id2);
926 ASSERT_NE(nullptr, app_info.get()); 925 ASSERT_NE(nullptr, app_info.get());
927 EXPECT_EQ(base::Time(), app_info->last_launch_time); 926 EXPECT_EQ(base::Time(), app_info->last_launch_time);
928 927
929 base::Time time_before = base::Time::Now(); 928 base::Time time_before = base::Time::Now();
930 arc::LaunchApp(profile(), id2, ui::EF_NONE); 929 arc::LaunchApp(profile(), id2);
931 base::Time time_after = base::Time::Now(); 930 base::Time time_after = base::Time::Now();
932 931
933 app_info = prefs->GetApp(id2); 932 app_info = prefs->GetApp(id2);
934 ASSERT_NE(nullptr, app_info.get()); 933 ASSERT_NE(nullptr, app_info.get());
935 ASSERT_LE(time_before, app_info->last_launch_time); 934 ASSERT_LE(time_before, app_info->last_launch_time);
936 ASSERT_GE(time_after, app_info->last_launch_time); 935 ASSERT_GE(time_after, app_info->last_launch_time);
937 } 936 }
938 937
939 // Validate that arc model contains expected elements on restart. 938 // Validate that arc model contains expected elements on restart.
940 TEST_F(ArcAppModelBuilderRecreate, AppModelRestart) { 939 TEST_F(ArcAppModelBuilderRecreate, AppModelRestart) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 app_info = prefs->GetApp(arc::kPlayStoreAppId); 995 app_info = prefs->GetApp(arc::kPlayStoreAppId);
997 ASSERT_TRUE(app_info); 996 ASSERT_TRUE(app_info);
998 EXPECT_TRUE(app_info->ready); 997 EXPECT_TRUE(app_info->ready);
999 998
1000 arc_test()->arc_session_manager()->DisableArc(); 999 arc_test()->arc_session_manager()->DisableArc();
1001 1000
1002 app_info = prefs->GetApp(arc::kPlayStoreAppId); 1001 app_info = prefs->GetApp(arc::kPlayStoreAppId);
1003 ASSERT_TRUE(app_info); 1002 ASSERT_TRUE(app_info);
1004 EXPECT_FALSE(app_info->ready); 1003 EXPECT_FALSE(app_info->ready);
1005 1004
1006 arc::LaunchApp(profile(), arc::kPlayStoreAppId, ui::EF_NONE); 1005 arc::LaunchApp(profile(), arc::kPlayStoreAppId);
1007 EXPECT_TRUE(arc_test()->arc_session_manager()->IsArcEnabled()); 1006 EXPECT_TRUE(arc_test()->arc_session_manager()->IsArcEnabled());
1008 } 1007 }
1009 1008
1010 // TODO(crbug.com/628425) -- reenable once this test is less flaky. 1009 // TODO(crbug.com/628425) -- reenable once this test is less flaky.
1011 TEST_F(ArcAppModelBuilderTest, DISABLED_IconLoader) { 1010 TEST_F(ArcAppModelBuilderTest, DISABLED_IconLoader) {
1012 const arc::mojom::AppInfo& app = fake_apps()[0]; 1011 const arc::mojom::AppInfo& app = fake_apps()[0];
1013 const std::string app_id = ArcAppTest::GetAppId(app); 1012 const std::string app_id = ArcAppTest::GetAppId(app);
1014 1013
1015 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get()); 1014 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
1016 ASSERT_NE(nullptr, prefs); 1015 ASSERT_NE(nullptr, prefs);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 const ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(profile_.get()); 1203 const ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(profile_.get());
1205 ASSERT_TRUE(prefs); 1204 ASSERT_TRUE(prefs);
1206 1205
1207 // There is no default app for managed users except Play Store 1206 // There is no default app for managed users except Play Store
1208 for (const auto& app : fake_default_apps()) { 1207 for (const auto& app : fake_default_apps()) {
1209 const std::string app_id = ArcAppTest::GetAppId(app); 1208 const std::string app_id = ArcAppTest::GetAppId(app);
1210 EXPECT_FALSE(prefs->IsRegistered(app_id)); 1209 EXPECT_FALSE(prefs->IsRegistered(app_id));
1211 EXPECT_FALSE(prefs->GetApp(app_id)); 1210 EXPECT_FALSE(prefs->GetApp(app_id));
1212 } 1211 }
1213 } 1212 }
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