Commit 59d94e95 authored by Wei Lee's avatar Wei Lee Committed by Commit Bot

Fix bug that internal app list might change during iteration in unittest

Bug: b/144144757
Test: unit_tests --gtest_filter=ShelfContextMenuTest.InternalAppShelfContextMenuOptionsNumber

Change-Id: I1fa60c3a00373845511ef1695b85b3d9833993d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1950050
Commit-Queue: Wei Lee <wtlee@chromium.org>
Auto-Submit: Wei Lee <wtlee@chromium.org>
Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722381}
parent 079a0fa8
......@@ -480,7 +480,9 @@ TEST_F(ShelfContextMenuTest, ArcContextMenuOptions) {
// Tests that the context menu of internal app is correct.
TEST_F(ShelfContextMenuTest, InternalAppShelfContextMenu) {
for (const auto& internal_app : app_list::GetInternalAppList(profile())) {
const std::vector<app_list::InternalApp> internal_apps(
app_list::GetInternalAppList(profile()));
for (const auto& internal_app : internal_apps) {
if (!internal_app.show_in_launcher)
continue;
......@@ -510,7 +512,9 @@ TEST_F(ShelfContextMenuTest, InternalAppShelfContextMenu) {
// Tests that the number of context menu options of internal app is correct.
TEST_F(ShelfContextMenuTest, InternalAppShelfContextMenuOptionsNumber) {
for (const auto& internal_app : app_list::GetInternalAppList(profile())) {
const std::vector<app_list::InternalApp> internal_apps(
app_list::GetInternalAppList(profile()));
for (const auto& internal_app : internal_apps) {
const std::string app_id = internal_app.app_id;
const ash::ShelfID shelf_id(app_id);
// Pin internal app.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment