Commit 8ec1bfd1 authored by Ben Wells's avatar Ben Wells Committed by Commit Bot

Speed up AppInfoDialogViewsTest.

These test a dialog which shows info about an app, including the size
of the app. When run in a test the app doesn't exist. The size
calculation still runs, however, and ends up calculaing the size of
the working directory, which can be really slow.

This change skips calculating the size if the app doesn't have a path.

Bug: 953964
Change-Id: Ie7ec878bfd26f2ac9c53bde3fa1c7c0327f0198c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1594384
Commit-Queue: Ben Wells <benwells@chromium.org>
Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658329}
parent 4f560b4c
...@@ -253,9 +253,14 @@ void AppInfoSummaryPanel::LinkClicked(views::Link* source, int event_flags) { ...@@ -253,9 +253,14 @@ void AppInfoSummaryPanel::LinkClicked(views::Link* source, int event_flags) {
} }
void AppInfoSummaryPanel::StartCalculatingAppSize() { void AppInfoSummaryPanel::StartCalculatingAppSize() {
extensions::path_util::CalculateAndFormatExtensionDirectorySize( // In tests the app may be a dummy app without a path. In this case, avoid
app_->path(), IDS_APPLICATION_INFO_SIZE_SMALL_LABEL, // calculating the directory size as it would calculate the size of the
base::Bind(&AppInfoSummaryPanel::OnAppSizeCalculated, AsWeakPtr())); // current directory, which is both potentially slow and meaningless.
if (!app_->path().empty()) {
extensions::path_util::CalculateAndFormatExtensionDirectorySize(
app_->path(), IDS_APPLICATION_INFO_SIZE_SMALL_LABEL,
base::BindOnce(&AppInfoSummaryPanel::OnAppSizeCalculated, AsWeakPtr()));
}
} }
void AppInfoSummaryPanel::OnAppSizeCalculated(const base::string16& size) { void AppInfoSummaryPanel::OnAppSizeCalculated(const base::string16& size) {
......
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