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

Unified Diff: chrome/browser/chromeos/policy/device_local_account_browsertest.cc

Issue 389313003: Fix races in DeviceLocalAccountTest.Extensions* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/extensions/device_local_account_external_policy_loader.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/policy/device_local_account_browsertest.cc
diff --git a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
index 27d4d0eb6a05d267f3907615d0ab44b4a58c1ce7..2b88a42b071c36c559ec660e87757a70cad538ab 100644
--- a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
+++ b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
@@ -35,6 +35,8 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/chromeos/extensions/device_local_account_external_policy_loader.h"
+#include "chrome/browser/chromeos/extensions/external_cache.h"
#include "chrome/browser/chromeos/login/existing_user_controller.h"
#include "chrome/browser/chromeos/login/screens/wizard_screen.h"
#include "chrome/browser/chromeos/login/ui/login_display_host.h"
@@ -750,16 +752,23 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsUncached) {
// Verify that the extension was not installed.
EXPECT_FALSE(extension_service->GetExtensionById(kGoodExtensionID, true));
- // Verify that the app was copied to the account's extension cache.
+ // Verify that the app was downloaded to the account's extension cache.
base::FilePath test_dir;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir));
EXPECT_TRUE(ContentsEqual(
GetCacheCRXFile(kAccountId1, kHostedAppID, kHostedAppVersion),
test_dir.Append(kHostedAppCRXPath)));
- // Verify that the extension was not copied to the account's extension cache.
- EXPECT_FALSE(PathExists(GetCacheCRXFile(
- kAccountId1, kGoodExtensionID, kGoodExtensionVersion)));
+ // Verify that the extension was removed from the account's extension cache
+ // after the installation failure.
+ DeviceLocalAccountPolicyBroker* broker =
+ g_browser_process->platform_part()->browser_policy_connector_chromeos()->
+ GetDeviceLocalAccountPolicyService()->GetBrokerForUser(user_id_1_);
+ ASSERT_TRUE(broker);
+ chromeos::ExternalCache* cache =
+ broker->extension_loader()->GetExternalCacheForTesting();
+ ASSERT_TRUE(cache);
+ EXPECT_FALSE(cache->GetExtension(kGoodExtensionID, NULL, NULL));
}
IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsCached) {
@@ -775,10 +784,9 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsCached) {
GetCacheCRXFile(kAccountId1, kHostedAppID, kHostedAppVersion);
EXPECT_TRUE(CopyFile(test_dir.Append(kHostedAppCRXPath),
cached_hosted_app));
- const base::FilePath cached_extension =
- GetCacheCRXFile(kAccountId1, kGoodExtensionID, kGoodExtensionVersion);
- EXPECT_TRUE(CopyFile(test_dir.Append(kGoodExtensionCRXPath),
- cached_extension));
+ EXPECT_TRUE(CopyFile(
+ test_dir.Append(kGoodExtensionCRXPath),
+ GetCacheCRXFile(kAccountId1, kGoodExtensionID, kGoodExtensionVersion)));
// Specify policy to force-install the hosted app.
em::StringList* forcelist = device_local_account_policy_.payload()
@@ -848,7 +856,14 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsCached) {
EXPECT_TRUE(PathExists(cached_hosted_app));
// Verify that the extension was removed from the account's extension cache.
- EXPECT_FALSE(PathExists(cached_extension));
+ DeviceLocalAccountPolicyBroker* broker =
+ g_browser_process->platform_part()->browser_policy_connector_chromeos()->
+ GetDeviceLocalAccountPolicyService()->GetBrokerForUser(user_id_1_);
+ ASSERT_TRUE(broker);
+ chromeos::ExternalCache* cache =
+ broker->extension_loader()->GetExternalCacheForTesting();
+ ASSERT_TRUE(cache);
+ EXPECT_FALSE(cache->GetExtension(kGoodExtensionID, NULL, NULL));
}
IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExternalData) {
« no previous file with comments | « chrome/browser/chromeos/extensions/device_local_account_external_policy_loader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698