Commit f3257c1d authored by Jeremie Boulic's avatar Jeremie Boulic Committed by Commit Bot

Update Android storage to Apps and extensions

Before the change, on the storage page, the row "Android storage"
displayed the size of the android apps. The size of the apps and
extensions installed from the chrome web store were not reflected
anywhere on this page.

This row is renamed "Apps and extensions", and displays the size of
- android apps (including the default ones, which can be deleted if the
user disables the Play store)
- apps and extensions installed from the web store, which data is
located in the Extensions folder of the user's cryptohome, as opposed
to the system apps/extensions.

The size of web store apps/extensions and android apps are calculated
separately. The UI is always updated with the sum of both. Bytes
formatting happen on the C++ side, so summing web store and android
apps has to happen on the C++ side.

androidRunning_ on the JS side was used to display or hide the
"Android storage". The "Apps and extensions" row is now always
visible. androidRunning_ is not needed anymore.

unit_tests --gtest_filter="*StorageHandlerTest.AppsExtensionsSize"
browser_tests --gtest_filter="*OSSettingsDevicePageTest.StorageTest"

Test: 
Bug: 1039916
Change-Id: I4aeffad4a258356ab1cb48834b6bf2cba155f33a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032703Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Jeremie Boulic <jboulic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738058}
parent 13118d3f
...@@ -5072,8 +5072,8 @@ ...@@ -5072,8 +5072,8 @@
<message name="IDS_SETTINGS_STORAGE_ITEM_BROWSING_DATA" desc="In Device Settings > Storage, label for the size of browsing data."> <message name="IDS_SETTINGS_STORAGE_ITEM_BROWSING_DATA" desc="In Device Settings > Storage, label for the size of browsing data.">
Browsing data Browsing data
</message> </message>
<message name="IDS_SETTINGS_STORAGE_ITEM_ANDROID" desc="In Device Settings > Storage, label for the total size of Android apps and cache."> <message name="IDS_SETTINGS_STORAGE_ITEM_APPS" desc="In Device Settings > Storage, label for the total size of Android apps and web store apps and extensions.">
Android storage Apps and Extensions
</message> </message>
<message name="IDS_SETTINGS_STORAGE_ITEM_CROSTINI" desc="In Device Settings > Storage, label for the total size of Crostini VMs, apps and cache."> <message name="IDS_SETTINGS_STORAGE_ITEM_CROSTINI" desc="In Device Settings > Storage, label for the total size of Crostini VMs, apps and cache.">
Linux (Beta) storage Linux (Beta) storage
......
bcd38d8bb38b31ea158d97a99542ba5bb0140d08
\ No newline at end of file
...@@ -207,11 +207,9 @@ ...@@ -207,11 +207,9 @@
<cr-link-row id="browsingDataSize" class="hr" on-click="onBrowsingDataTap_" <cr-link-row id="browsingDataSize" class="hr" on-click="onBrowsingDataTap_"
label="$i18n{storageItemBrowsingData}" label="$i18n{storageItemBrowsingData}"
sub-label="$i18n{storageSizeComputing}" external></cr-link-row> sub-label="$i18n{storageSizeComputing}" external></cr-link-row>
<template is="dom-if" if="[[androidRunning_]]"> <cr-link-row id="appsSize" class="hr" on-click="onAppsTap_"
<cr-link-row id="androidSize" class="hr" on-click="onAndroidTap_" label="$i18n{storageItemApps}"
label="$i18n{storageItemAndroid}" sub-label="$i18n{storageSizeComputing}" external></cr-link-row>
sub-label="$i18n{storageSizeComputing}" external></cr-link-row>
</template>
<template is="dom-if" if="[[showCrostiniStorage_]]"> <template is="dom-if" if="[[showCrostiniStorage_]]">
<cr-link-row id="crostiniSize" class="hr" on-click="onCrostiniTap_" <cr-link-row id="crostiniSize" class="hr" on-click="onCrostiniTap_"
label="$i18n{storageItemCrostini}" label="$i18n{storageItemCrostini}"
......
...@@ -36,12 +36,6 @@ Polymer({ ...@@ -36,12 +36,6 @@ Polymer({
properties: { properties: {
androidEnabled: Boolean, androidEnabled: Boolean,
/** @private */
androidRunning_: {
type: Boolean,
value: false,
},
/** @private */ /** @private */
showCrostiniStorage_: { showCrostiniStorage_: {
type: Boolean, type: Boolean,
...@@ -85,8 +79,7 @@ Polymer({ ...@@ -85,8 +79,7 @@ Polymer({
'storage-browsing-data-size-changed', 'storage-browsing-data-size-changed',
this.handleBrowsingDataSizeChanged_.bind(this)); this.handleBrowsingDataSizeChanged_.bind(this));
this.addWebUIListener( this.addWebUIListener(
'storage-android-size-changed', 'storage-apps-size-changed', this.handleAppsSizeChanged_.bind(this));
this.handleAndroidSizeChanged_.bind(this));
this.addWebUIListener( this.addWebUIListener(
'storage-crostini-size-changed', 'storage-crostini-size-changed',
this.handleCrostiniSizeChanged_.bind(this)); this.handleCrostiniSizeChanged_.bind(this));
...@@ -95,9 +88,6 @@ Polymer({ ...@@ -95,9 +88,6 @@ Polymer({
'storage-other-users-size-changed', 'storage-other-users-size-changed',
this.handleOtherUsersSizeChanged_.bind(this)); this.handleOtherUsersSizeChanged_.bind(this));
} }
this.addWebUIListener(
'storage-android-running-changed',
this.handleAndroidRunningChanged_.bind(this));
}, },
ready() { ready() {
...@@ -151,11 +141,11 @@ Polymer({ ...@@ -151,11 +141,11 @@ Polymer({
}, },
/** /**
* Handler for tapping the "Android storage" item. * Handler for tapping the "Apps and Extensions" item.
* @private * @private
*/ */
onAndroidTap_() { onAppsTap_() {
chrome.send('openArcStorage'); window.location = 'chrome://os-settings/app-management';
}, },
/** /**
...@@ -216,14 +206,12 @@ Polymer({ ...@@ -216,14 +206,12 @@ Polymer({
}, },
/** /**
* @param {string} size Formatted string representing the size of Android * @param {string} size Formatted string representing the size of Apps and
* storage. * extensions storage.
* @private * @private
*/ */
handleAndroidSizeChanged_(size) { handleAppsSizeChanged_(size) {
if (this.androidRunning_) { this.$$('#appsSize').subLabel = size;
this.$$('#androidSize').subLabel = size;
}
}, },
/** /**
...@@ -247,14 +235,6 @@ Polymer({ ...@@ -247,14 +235,6 @@ Polymer({
} }
}, },
/**
* @param {boolean} running True if Android (ARC) is running.
* @private
*/
handleAndroidRunningChanged_(running) {
this.androidRunning_ = running;
},
/** /**
* @param {boolean} enabled True if Crostini is enabled. * @param {boolean} enabled True if Crostini is enabled.
* @private * @private
......
...@@ -69,6 +69,21 @@ void StorageHandler::TestAPI::UpdateMyFilesSize() { ...@@ -69,6 +69,21 @@ void StorageHandler::TestAPI::UpdateMyFilesSize() {
handler_->UpdateMyFilesSize(); handler_->UpdateMyFilesSize();
} }
void StorageHandler::TestAPI::UpdateAppsSize() {
handler_->UpdateAppsSize();
}
void StorageHandler::TestAPI::UpdateAndroidAppsSize(
uint64_t total_code_bytes,
uint64_t total_data_bytes,
uint64_t total_cache_bytes) {
arc::mojom::ApplicationsSizePtr result(::arc::mojom::ApplicationsSize::New());
result->total_code_bytes = total_code_bytes;
result->total_data_bytes = total_data_bytes;
result->total_cache_bytes = total_cache_bytes;
handler_->OnGetAndroidAppsSize(true /* succeeded */, std::move(result));
}
namespace { namespace {
void GetSizeStatBlocking(const base::FilePath& mount_path, void GetSizeStatBlocking(const base::FilePath& mount_path,
...@@ -98,9 +113,12 @@ StorageHandler::StorageHandler(Profile* profile, ...@@ -98,9 +113,12 @@ StorageHandler::StorageHandler(Profile* profile,
has_browser_cache_size_(false), has_browser_cache_size_(false),
browser_site_data_size_(-1), browser_site_data_size_(-1),
has_browser_site_data_size_(false), has_browser_site_data_size_(false),
apps_extensions_size_(0),
android_apps_size_(0),
updating_my_files_size_(false), updating_my_files_size_(false),
updating_browsing_data_size_(false), updating_browsing_data_size_(false),
updating_android_size_(false), updating_apps_size_(false),
updating_android_apps_size_(false),
updating_crostini_size_(false), updating_crostini_size_(false),
updating_other_users_size_(false), updating_other_users_size_(false),
is_android_running_(false), is_android_running_(false),
...@@ -150,7 +168,7 @@ void StorageHandler::OnJavascriptAllowed() { ...@@ -150,7 +168,7 @@ void StorageHandler::OnJavascriptAllowed() {
if (base::FeatureList::IsEnabled(arc::kUsbStorageUIFeature)) if (base::FeatureList::IsEnabled(arc::kUsbStorageUIFeature))
arc_observer_.Add(arc::ArcSessionManager::Get()); arc_observer_.Add(arc::ArcSessionManager::Get());
// Start observing the mojo connection UpdateAndroidSize() relies on. Note // Start observing the mojo connection UpdateAndroidAppsSize() relies on. Note
// that OnConnectionReady() will be called immediately if the connection has // that OnConnectionReady() will be called immediately if the connection has
// already been established. // already been established.
arc::ArcServiceManager::Get() arc::ArcServiceManager::Get()
...@@ -193,8 +211,8 @@ void StorageHandler::HandleUpdateStorageInfo(const base::ListValue* args) { ...@@ -193,8 +211,8 @@ void StorageHandler::HandleUpdateStorageInfo(const base::ListValue* args) {
UpdateSizeStat(); UpdateSizeStat();
UpdateMyFilesSize(); UpdateMyFilesSize();
UpdateBrowsingDataSize(); UpdateBrowsingDataSize();
UpdateAndroidRunning(); UpdateAppsSize();
UpdateAndroidSize(); UpdateAndroidAppsSize();
UpdateCrostiniSize(); UpdateCrostiniSize();
UpdateOtherUsersSize(); UpdateOtherUsersSize();
} }
...@@ -277,10 +295,10 @@ int64_t StorageHandler::ComputeLocalFilesSize( ...@@ -277,10 +295,10 @@ int64_t StorageHandler::ComputeLocalFilesSize(
const base::FilePath& android_files_path) { const base::FilePath& android_files_path) {
int64_t size = 0; int64_t size = 0;
// Compute directory size of My Files // Compute directory size of My Files.
size += base::ComputeDirectorySize(my_files_path); size += base::ComputeDirectorySize(my_files_path);
// Compute directory size of Play Files // Compute directory size of Play Files.
size += base::ComputeDirectorySize(android_files_path); size += base::ComputeDirectorySize(android_files_path);
// Remove size of Download. If Android is enabled, the size of the Download // Remove size of Download. If Android is enabled, the size of the Download
...@@ -365,42 +383,64 @@ void StorageHandler::OnGetBrowsingDataSize(bool is_site_data, int64_t size) { ...@@ -365,42 +383,64 @@ void StorageHandler::OnGetBrowsingDataSize(bool is_site_data, int64_t size) {
} }
} }
void StorageHandler::UpdateAndroidRunning() { void StorageHandler::UpdateAppsSize() {
FireWebUIListener("storage-android-running-changed", if (updating_apps_size_)
base::Value(is_android_running_)); return;
updating_apps_size_ = true;
// Apps and extensions installed from the web store located in
// [user-hash]/Extensions.
const base::FilePath extensions_path =
profile_->GetPath().AppendASCII("Extensions");
base::PostTaskAndReplyWithResult(
FROM_HERE,
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT},
base::BindOnce(&base::ComputeDirectorySize, extensions_path),
base::BindOnce(&StorageHandler::OnGetAppsSize,
weak_ptr_factory_.GetWeakPtr()));
}
void StorageHandler::OnGetAppsSize(int64_t total_bytes) {
apps_extensions_size_ = total_bytes;
updating_apps_size_ = false;
UpdateAppsAndExtensionsSize();
} }
void StorageHandler::UpdateAndroidSize() { void StorageHandler::UpdateAndroidAppsSize() {
if (!is_android_running_) if (!is_android_running_)
return; return;
if (updating_android_size_) if (updating_android_apps_size_)
return; return;
updating_android_size_ = true; updating_android_apps_size_ = true;
bool success = false; bool success = false;
auto* arc_storage_manager = auto* arc_storage_manager =
arc::ArcStorageManager::GetForBrowserContext(profile_); arc::ArcStorageManager::GetForBrowserContext(profile_);
if (arc_storage_manager) { if (arc_storage_manager) {
success = arc_storage_manager->GetApplicationsSize(base::BindOnce( success = arc_storage_manager->GetApplicationsSize(base::BindOnce(
&StorageHandler::OnGetAndroidSize, weak_ptr_factory_.GetWeakPtr())); &StorageHandler::OnGetAndroidAppsSize, weak_ptr_factory_.GetWeakPtr()));
} }
if (!success) if (!success)
updating_android_size_ = false; updating_android_apps_size_ = false;
} }
void StorageHandler::OnGetAndroidSize(bool succeeded, void StorageHandler::OnGetAndroidAppsSize(
arc::mojom::ApplicationsSizePtr size) { bool succeeded,
base::string16 size_string; arc::mojom::ApplicationsSizePtr size) {
if (succeeded) { if (succeeded) {
uint64_t total_bytes = size->total_code_bytes + size->total_data_bytes + android_apps_size_ = size->total_code_bytes + size->total_data_bytes +
size->total_cache_bytes; size->total_cache_bytes;
size_string = ui::FormatBytes(total_bytes);
} else {
size_string = l10n_util::GetStringUTF16(IDS_SETTINGS_STORAGE_SIZE_UNKNOWN);
} }
updating_android_size_ = false; updating_android_apps_size_ = false;
FireWebUIListener("storage-android-size-changed", base::Value(size_string)); UpdateAppsAndExtensionsSize();
}
void StorageHandler::UpdateAppsAndExtensionsSize() {
FireWebUIListener(
"storage-apps-size-changed",
base::Value(ui::FormatBytes(apps_extensions_size_ + android_apps_size_)));
} }
void StorageHandler::UpdateCrostiniSize() { void StorageHandler::UpdateCrostiniSize() {
...@@ -501,17 +541,14 @@ void StorageHandler::UpdateExternalStorages() { ...@@ -501,17 +541,14 @@ void StorageHandler::UpdateExternalStorages() {
void StorageHandler::OnConnectionReady() { void StorageHandler::OnConnectionReady() {
is_android_running_ = true; is_android_running_ = true;
UpdateAndroidRunning(); UpdateAndroidAppsSize();
UpdateAndroidSize();
} }
void StorageHandler::OnConnectionClosed() { void StorageHandler::OnConnectionClosed() {
is_android_running_ = false; is_android_running_ = false;
UpdateAndroidRunning();
} }
void StorageHandler::OnArcPlayStoreEnabledChanged(bool enabled) { void StorageHandler::OnArcPlayStoreEnabledChanged(bool enabled) {
FireWebUIListener("storage-android-enabled-changed", base::Value(enabled));
auto update = std::make_unique<base::DictionaryValue>(); auto update = std::make_unique<base::DictionaryValue>();
update->SetKey(kAndroidEnabled, base::Value(enabled)); update->SetKey(kAndroidEnabled, base::Value(enabled));
content::WebUIDataSource::Update(profile_, source_name_, std::move(update)); content::WebUIDataSource::Update(profile_, source_name_, std::move(update));
......
...@@ -70,6 +70,14 @@ class StorageHandler ...@@ -70,6 +70,14 @@ class StorageHandler
// Simulate a request to update MyFiles size. // Simulate a request to update MyFiles size.
void UpdateMyFilesSize(); void UpdateMyFilesSize();
// Simulate a request to update apps and extensions size.
void UpdateAppsSize();
// Simulate android apps size callback.
void UpdateAndroidAppsSize(uint64_t total_code_bytes,
uint64_t total_data_bytes,
uint64_t total_cache_bytes);
private: private:
StorageHandler* handler_; // Not owned. StorageHandler* handler_; // Not owned.
}; };
...@@ -128,14 +136,21 @@ class StorageHandler ...@@ -128,14 +136,21 @@ class StorageHandler
// Callback to update the UI about the size of browsing data. // Callback to update the UI about the size of browsing data.
void OnGetBrowsingDataSize(bool is_site_data, int64_t size); void OnGetBrowsingDataSize(bool is_site_data, int64_t size);
// Requests updating the flag that hides the Android size UI. // Requests updating the size of web store apps and extensions.
void UpdateAndroidRunning(); void UpdateAppsSize();
// Callback to update web store apps and extensions size.
void OnGetAppsSize(int64_t total_bytes);
// Requests updating the space size used by Android apps and cache. // Requests updating the size of android apps.
void UpdateAndroidSize(); void UpdateAndroidAppsSize();
// Callback to update the UI about Android apps and cache. // Callback to update Android apps and cache.
void OnGetAndroidSize(bool succeeded, arc::mojom::ApplicationsSizePtr size); void OnGetAndroidAppsSize(bool succeeded,
arc::mojom::ApplicationsSizePtr size);
// Callback to update the UI about apps and extensions.
void UpdateAppsAndExtensionsSize();
// Requests updating the space size used by Crostini VMs and their apps and // Requests updating the space size used by Crostini VMs and their apps and
// cache. // cache.
...@@ -169,6 +184,12 @@ class StorageHandler ...@@ -169,6 +184,12 @@ class StorageHandler
// True if we have already received the size of site data. // True if we have already received the size of site data.
bool has_browser_site_data_size_; bool has_browser_site_data_size_;
// Total size of apps and extensions
int64_t apps_extensions_size_;
// Total size of android apps
int64_t android_apps_size_;
// Helper to compute the total size of all types of site date. // Helper to compute the total size of all types of site date.
std::unique_ptr<SiteDataSizeCollector> site_data_size_collector_; std::unique_ptr<SiteDataSizeCollector> site_data_size_collector_;
...@@ -182,7 +203,8 @@ class StorageHandler ...@@ -182,7 +203,8 @@ class StorageHandler
// Flags indicating fetch operations for storage sizes are ongoing. // Flags indicating fetch operations for storage sizes are ongoing.
bool updating_my_files_size_; bool updating_my_files_size_;
bool updating_browsing_data_size_; bool updating_browsing_data_size_;
bool updating_android_size_; bool updating_apps_size_;
bool updating_android_apps_size_;
bool updating_crostini_size_; bool updating_crostini_size_;
bool updating_other_users_size_; bool updating_other_users_size_;
......
...@@ -256,11 +256,11 @@ TEST_F(StorageHandlerTest, MyFilesSize) { ...@@ -256,11 +256,11 @@ TEST_F(StorageHandlerTest, MyFilesSize) {
android_files_path)); android_files_path));
// Add files in My files and android files. // Add files in My files and android files.
AddFile("random.bin", 8092, my_files_path); // ~7.9K AddFile("random.bin", 8092, my_files_path); // ~7.9 KB
AddFile("tall.pdf", 15271, android_files_path); // ~14.9K AddFile("tall.pdf", 15271, android_files_path); // ~14.9 KB
// Add file in Downloads and simulate bind mount with // Add file in Downloads and simulate bind mount with
// [android files]/Download. // [android files]/Download.
AddFile("video.ogv", 59943, downloads_path); // ~58.6K AddFile("video.ogv", 59943, downloads_path); // ~58.6 KB
AddFile("video.ogv", 59943, android_files_download_path); AddFile("video.ogv", 59943, android_files_download_path);
// Calculate My files size. // Calculate My files size.
...@@ -275,6 +275,54 @@ TEST_F(StorageHandlerTest, MyFilesSize) { ...@@ -275,6 +275,54 @@ TEST_F(StorageHandlerTest, MyFilesSize) {
EXPECT_EQ("81.4 KB", callback->GetString()); EXPECT_EQ("81.4 KB", callback->GetString());
} }
TEST_F(StorageHandlerTest, AppsExtensionsSize) {
// The data for apps and extensions installed from the webstore is stored in
// the Extensions folder. Add data at a random location in the Extensions
// folder and check UI callback message.
const base::FilePath extensions_data_path =
profile_->GetPath()
.AppendASCII("Extensions")
.AppendASCII("fake_extension_id");
CHECK(base::CreateDirectory(extensions_data_path));
AddFile("id3Audio.mp3", 180999, extensions_data_path); // ~177 KB
// Calculate web store apps and extensions size.
handler_test_api_->UpdateAppsSize();
task_environment_.RunUntilIdle();
const base::Value* callback =
GetWebUICallbackMessage("storage-apps-size-changed");
ASSERT_TRUE(callback) << "No 'storage-apps-size-changed' callback";
// Check return value.
EXPECT_EQ("177 KB", callback->GetString());
// Simulate android apps size callback.
// 592840 + 25284 + 9987 = 628111 ~613 KB.
handler_test_api_->UpdateAndroidAppsSize(592840, 25284, 9987);
task_environment_.RunUntilIdle();
callback = GetWebUICallbackMessage("storage-apps-size-changed");
ASSERT_TRUE(callback) << "No 'storage-apps-size-changed' callback";
// Check return value.
EXPECT_EQ("790 KB", callback->GetString());
// Add more data in the Extensions folder to check that the sum of web store
// apps and extensions + android apps is correctly updated.
AddFile("video_long.ogv", 230096, extensions_data_path); // ~225 KB
// Calculate web store apps and extensions size.
handler_test_api_->UpdateAppsSize();
task_environment_.RunUntilIdle();
callback = GetWebUICallbackMessage("storage-apps-size-changed");
ASSERT_TRUE(callback) << "No 'storage-apps-size-changed' callback";
// Check return value.
EXPECT_EQ("1,015 KB", callback->GetString());
}
} // namespace } // namespace
} // namespace settings } // namespace settings
......
...@@ -846,7 +846,7 @@ void AddDeviceStorageStrings(content::WebUIDataSource* html_source) { ...@@ -846,7 +846,7 @@ void AddDeviceStorageStrings(content::WebUIDataSource* html_source) {
{"storageItemAvailable", IDS_SETTINGS_STORAGE_ITEM_AVAILABLE}, {"storageItemAvailable", IDS_SETTINGS_STORAGE_ITEM_AVAILABLE},
{"storageItemMyFiles", IDS_SETTINGS_STORAGE_ITEM_MY_FILES}, {"storageItemMyFiles", IDS_SETTINGS_STORAGE_ITEM_MY_FILES},
{"storageItemBrowsingData", IDS_SETTINGS_STORAGE_ITEM_BROWSING_DATA}, {"storageItemBrowsingData", IDS_SETTINGS_STORAGE_ITEM_BROWSING_DATA},
{"storageItemAndroid", IDS_SETTINGS_STORAGE_ITEM_ANDROID}, {"storageItemApps", IDS_SETTINGS_STORAGE_ITEM_APPS},
{"storageItemCrostini", IDS_SETTINGS_STORAGE_ITEM_CROSTINI}, {"storageItemCrostini", IDS_SETTINGS_STORAGE_ITEM_CROSTINI},
{"storageItemOtherUsers", IDS_SETTINGS_STORAGE_ITEM_OTHER_USERS}, {"storageItemOtherUsers", IDS_SETTINGS_STORAGE_ITEM_OTHER_USERS},
{"storageSizeComputing", IDS_SETTINGS_STORAGE_SIZE_CALCULATING}, {"storageSizeComputing", IDS_SETTINGS_STORAGE_SIZE_CALCULATING},
......
...@@ -1830,6 +1830,24 @@ cr.define('device_page_tests', function() { ...@@ -1830,6 +1830,24 @@ cr.define('device_page_tests', function() {
(element.offsetWidth == 0 && element.offsetHeight == 0); (element.offsetWidth == 0 && element.offsetHeight == 0);
} }
/**
* @param {string} id
* @return {string}
*/
function getStorageItemLabelFromId(id) {
const rowItem = storagePage.$$('#' + id).shadowRoot;
return rowItem.querySelector('#label').innerText;
}
/**
* @param {string} id
* @return {string}
*/
function getStorageItemSubLabelFromId(id) {
const rowItem = storagePage.$$('#' + id).shadowRoot;
return rowItem.querySelector('#subLabel').innerText;
}
suiteSetup(function() { suiteSetup(function() {
// Disable animations so sub-pages open within one event loop. // Disable animations so sub-pages open within one event loop.
testing.Test.disableAnimationsAndTransitions(); testing.Test.disableAnimationsAndTransitions();
...@@ -1905,6 +1923,17 @@ cr.define('device_page_tests', function() { ...@@ -1905,6 +1923,17 @@ cr.define('device_page_tests', function() {
storagePage.$.availableLabelArea.querySelector('.storage-size') storagePage.$.availableLabelArea.querySelector('.storage-size')
.innerText); .innerText);
}); });
test('apps extensions size', async function() {
assertEquals(
'Apps and Extensions', getStorageItemLabelFromId('appsSize'));
assertEquals('Calculating…', getStorageItemSubLabelFromId('appsSize'));
// Send apps size callback.
cr.webUIListenerCallback('storage-apps-size-changed', '59.5 KB');
Polymer.dom.flush();
assertEquals('59.5 KB', getStorageItemSubLabelFromId('appsSize'));
});
}); });
}); });
......
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