Commit f1207e30 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Make ProfileResetterTest.ResetExtensionsByDisabling more reliable

Wait for theme update by listening for notification instead of
RunUntilIdle. This fix is prospective: I couldn't get it to flake
locally with or without the change.

Bug: 995851
Change-Id: I5a3a4dda389178f6e3dd114ee14da9ea593254d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1762353Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688707}
parent 3886244e
......@@ -20,6 +20,7 @@
#include "base/test/bind_test_util.h"
#include "base/test/scoped_path_override.h"
#include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
......@@ -45,6 +46,7 @@
#include "components/search_engines/template_url_service.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_browser_thread.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h"
......@@ -508,28 +510,23 @@ TEST_F(ProfileResetterTest, ResetContentSettings) {
}
}
#if defined(OS_CHROMEOS)
// Flaky on ChromeOS: https://crbug.com/995851
#define MAYBE_ResetExtensionsByDisabling DISABLED_ResetExtensionsByDisabling
#else
#define MAYBE_ResetExtensionsByDisabling ResetExtensionsByDisabling
#endif
TEST_F(ProfileResetterTest, MAYBE_ResetExtensionsByDisabling) {
TEST_F(ProfileResetterTest, ResetExtensionsByDisabling) {
service_->Init();
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile());
content::WindowedNotificationObserver theme_change_observer(
chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
content::Source<ThemeService>(theme_service));
scoped_refptr<Extension> theme = CreateExtension(
base::ASCIIToUTF16("example1"), temp_dir.GetPath(), Manifest::UNPACKED,
extensions::Manifest::TYPE_THEME, false);
service_->FinishInstallationForTest(theme.get());
// Let ThemeService finish creating the theme pack.
base::RunLoop().RunUntilIdle();
theme_change_observer.Wait();
ThemeService* theme_service =
ThemeServiceFactory::GetForProfile(profile());
EXPECT_FALSE(theme_service->UsingDefaultTheme());
scoped_refptr<Extension> ext2 = CreateExtension(
......
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