Commit 9b2f59dc authored by jennyz's avatar jennyz Committed by Commit bot

Add more browser tests for Kiosk update from usb stick.

Review URL: https://codereview.chromium.org/509253003

BUG=410611

Review URL: https://codereview.chromium.org/540673003

Cr-Commit-Position: refs/heads/master@{#293567}
parent ec96ebfa
...@@ -423,6 +423,12 @@ void KioskAppManager::OnKioskAppCacheUpdated(const std::string& app_id) { ...@@ -423,6 +423,12 @@ void KioskAppManager::OnKioskAppCacheUpdated(const std::string& app_id) {
KioskAppManagerObserver, observers_, OnKioskAppCacheUpdated(app_id)); KioskAppManagerObserver, observers_, OnKioskAppCacheUpdated(app_id));
} }
void KioskAppManager::OnKioskAppExternalUpdateComplete(bool success) {
FOR_EACH_OBSERVER(KioskAppManagerObserver,
observers_,
OnKioskAppExternalUpdateComplete(success));
}
void KioskAppManager::PutValidatedExternalExtension( void KioskAppManager::PutValidatedExternalExtension(
const std::string& app_id, const std::string& app_id,
const base::FilePath& crx_path, const base::FilePath& crx_path,
......
...@@ -186,6 +186,10 @@ class KioskAppManager : public KioskAppDataDelegate, ...@@ -186,6 +186,10 @@ class KioskAppManager : public KioskAppDataDelegate,
// Invoked when kiosk app cache has been updated. // Invoked when kiosk app cache has been updated.
void OnKioskAppCacheUpdated(const std::string& app_id); void OnKioskAppCacheUpdated(const std::string& app_id);
// Invoked when kiosk app updating from usb stick has been completed.
// |success| indicates if all the updates are completed successfully.
void OnKioskAppExternalUpdateComplete(bool success);
// Installs the validated external extension into cache. // Installs the validated external extension into cache.
void PutValidatedExternalExtension( void PutValidatedExternalExtension(
const std::string& app_id, const std::string& app_id,
......
...@@ -29,6 +29,10 @@ class KioskAppManagerObserver { ...@@ -29,6 +29,10 @@ class KioskAppManagerObserver {
// Invoked when kiosk app cache is updated for |app_id|. // Invoked when kiosk app cache is updated for |app_id|.
virtual void OnKioskAppCacheUpdated(const std::string& app_id) {} virtual void OnKioskAppCacheUpdated(const std::string& app_id) {}
// Invoked when kiosk app updating from usb stick has been completed.
// |success| indicates if all the updates are completed successfully.
virtual void OnKioskAppExternalUpdateComplete(bool success) {}
protected: protected:
virtual ~KioskAppManagerObserver() {} virtual ~KioskAppManagerObserver() {}
}; };
......
...@@ -242,11 +242,13 @@ void KioskExternalUpdater::ProcessParsedManifest( ...@@ -242,11 +242,13 @@ void KioskExternalUpdater::ProcessParsedManifest(
NotifyKioskUpdateProgress( NotifyKioskUpdateProgress(
ui::ResourceBundle::GetSharedInstance().GetLocalizedString( ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
IDS_KIOSK_EXTERNAL_UPDATE_NO_MANIFEST)); IDS_KIOSK_EXTERNAL_UPDATE_NO_MANIFEST));
KioskAppManager::Get()->OnKioskAppExternalUpdateComplete(false);
return; return;
} else if (*parsing_error == ERROR_INVALID_MANIFEST) { } else if (*parsing_error == ERROR_INVALID_MANIFEST) {
NotifyKioskUpdateProgress( NotifyKioskUpdateProgress(
ui::ResourceBundle::GetSharedInstance().GetLocalizedString( ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
IDS_KIOSK_EXTERNAL_UPDATE_INVALID_MANIFEST)); IDS_KIOSK_EXTERNAL_UPDATE_INVALID_MANIFEST));
KioskAppManager::Get()->OnKioskAppExternalUpdateComplete(false);
return; return;
} }
...@@ -301,6 +303,7 @@ void KioskExternalUpdater::ProcessParsedManifest( ...@@ -301,6 +303,7 @@ void KioskExternalUpdater::ProcessParsedManifest(
NotifyKioskUpdateProgress( NotifyKioskUpdateProgress(
ui::ResourceBundle::GetSharedInstance().GetLocalizedString( ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
IDS_KIOSK_EXTERNAL_UPDATE_NO_UPDATES)); IDS_KIOSK_EXTERNAL_UPDATE_NO_UPDATES));
KioskAppManager::Get()->OnKioskAppExternalUpdateComplete(false);
return; return;
} }
...@@ -347,6 +350,17 @@ bool KioskExternalUpdater::IsExternalUpdatePending() { ...@@ -347,6 +350,17 @@ bool KioskExternalUpdater::IsExternalUpdatePending() {
return false; return false;
} }
bool KioskExternalUpdater::IsAllExternalUpdatesSucceeded() {
for (ExternalUpdateMap::iterator it = external_updates_.begin();
it != external_updates_.end();
++it) {
if (it->second.update_status != SUCCESS) {
return false;
}
}
return true;
}
bool KioskExternalUpdater::ShouldDoExternalUpdate( bool KioskExternalUpdater::ShouldDoExternalUpdate(
const std::string& app_id, const std::string& app_id,
const std::string& version, const std::string& version,
...@@ -440,6 +454,8 @@ void KioskExternalUpdater::MayBeNotifyKioskAppUpdate() { ...@@ -440,6 +454,8 @@ void KioskExternalUpdater::MayBeNotifyKioskAppUpdate() {
NotifyKioskUpdateProgress(GetUpdateReportMessage()); NotifyKioskUpdateProgress(GetUpdateReportMessage());
NotifyKioskAppUpdateAvailable(); NotifyKioskAppUpdateAvailable();
KioskAppManager::Get()->OnKioskAppExternalUpdateComplete(
IsAllExternalUpdatesSucceeded());
} }
void KioskExternalUpdater::NotifyKioskAppUpdateAvailable() { void KioskExternalUpdater::NotifyKioskAppUpdateAvailable() {
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/sequenced_task_runner.h" #include "base/sequenced_task_runner.h"
#include "chrome/browser/chromeos/app_mode/kiosk_external_update_validator.h" #include "chrome/browser/chromeos/app_mode/kiosk_external_update_validator.h"
#include "chromeos/disks/disk_mount_manager.h" #include "chromeos/disks/disk_mount_manager.h"
...@@ -89,6 +90,10 @@ class KioskExternalUpdater : public disks::DiskMountManager::Observer, ...@@ -89,6 +90,10 @@ class KioskExternalUpdater : public disks::DiskMountManager::Observer,
// Returns true if there are any external updates pending. // Returns true if there are any external updates pending.
bool IsExternalUpdatePending(); bool IsExternalUpdatePending();
// Returns true if all external updates specified in the manifest are
// completed successfully.
bool IsAllExternalUpdatesSucceeded();
// Returns true if the app with |app_id| should be updated to // Returns true if the app with |app_id| should be updated to
// |external_extension|. // |external_extension|.
bool ShouldDoExternalUpdate(const std::string& app_id, bool ShouldDoExternalUpdate(const std::string& app_id,
......
// Dictionary of external kiosk extensions to be updated. Each entry maps
// the extension's id to its crx's path (relative to this file) and the version
// of the extension contained in the crx.
{
"ajoggoflpgplnnjkjamcmbepjdjdnpdp" : {
"external_crx": "ajoggoflpgplnnjkjamcmbepjdjdnpdp-2.0.0.crx",
"external_version": "2.0.0"
}
}
// Dictionary of external kiosk extensions to be updated. Each entry maps
// the extension's id to its crx's path (relative to this file) and the version
// of the extension contained in the crx.
{
"ajoggoflpgplnnjkjamcmbepjdjdnpdp" : {
"external_crx": "ajoggoflpgplnnjkjamcmbepjdjdnpdp-2.0.0.crx",
"external_version": "2.0.0"
//} make this an invalid json file
}
// Dictionary of external kiosk extensions to be updated. Each entry maps
// the extension's id to its crx's path (relative to this file) and the version
// of the extension contained in the crx.
{
"ajoggoflpgplnnjkjamcmbepjdjdnpdp" : {
"external_crx": "ajoggoflpgplnnjkjamcmbepjdjdnpdp-1.0.0.crx",
"external_version": "1.0.0"
}
}
// Dictionary of external kiosk extensions to be updated. Each entry maps
// the extension's id to its crx's path (relative to this file) and the version
// of the extension contained in the crx.
{
"ajoggoflpgplnnjkjamcmbepjdjdnpdp" : {
"external_crx": "ajoggoflpgplnnjkjamcmbepjdjdnpdp-3.0.0.crx",
"external_version": "3.0.0"
}
}
// Dictionary of external kiosk extensions to be updated. Each entry maps
// the extension's id to its crx's path (relative to this file) and the version
// of the extension contained in the crx.
{
"ajoggoflpgplnnjkjamcmbepjdjdnpdp" : {
"external_crx": "ajoggoflpgplnnjkjamcmbepjdjdnpdp-2.0.0.crx",
"external_version": "2.0.0"
}
}
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