Commit 1aed207b authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Populate manifest URL for wallpaper tests on the go

This is a preparation CL for migrating CustomizationWallpaperDownloader
from URLFetcher to SimpleURLLoader.

It brings in no functionality change, but it prepares the ground for
the use of EmbeddedTestServer rather than FakeURLFetcherFactory.
Basically, the manifest URL can not be static/constant because of
the way EmbeddedTestServer::GetURL works.

BUG=None

Change-Id: I30dfc24ed9083d952bfa9c0c72be1ea9350f5b5e
Reviewed-on: https://chromium-review.googlesource.com/1011302Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#550573}
parent 377fc2f2
......@@ -35,7 +35,7 @@ constexpr char kOEMWallpaperURL[] = "http://somedomain.com/image.png";
constexpr char kServicesManifest[] =
"{"
" \"version\": \"1.0\","
" \"default_wallpaper\": \"http://somedomain.com/image.png\",\n"
" \"default_wallpaper\": \"\%s\",\n"
" \"default_apps\": [\n"
" \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n"
" \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"\n"
......@@ -53,6 +53,10 @@ constexpr char kServicesManifest[] =
" }\n"
"}";
std::string ManifestForURL(const std::string& url) {
return base::StringPrintf(kServicesManifest, url.c_str());
}
// Expected minimal wallpaper download retry interval in milliseconds.
constexpr int kDownloadRetryIntervalMS = 100;
......@@ -100,7 +104,7 @@ bool ImageIsNearColor(gfx::ImageSkia image, SkColor expected_color) {
class TestWallpaperObserver : public ash::mojom::WallpaperObserver {
public:
explicit TestWallpaperObserver() : finished_(false), observer_binding_(this) {
TestWallpaperObserver() : finished_(false), observer_binding_(this) {
ash::mojom::WallpaperObserverAssociatedPtrInfo ptr_info;
observer_binding_.Bind(mojo::MakeRequest(&ptr_info));
WallpaperControllerClient::Get()->AddObserver(std::move(ptr_info));
......@@ -295,7 +299,7 @@ IN_PROC_BROWSER_TEST_F(CustomizationWallpaperDownloaderBrowserTest,
chromeos::ServicesCustomizationDocument* customization =
chromeos::ServicesCustomizationDocument::GetInstance();
EXPECT_TRUE(
customization->LoadManifestFromString(std::string(kServicesManifest)));
customization->LoadManifestFromString(ManifestForURL(kOEMWallpaperURL)));
observer.WaitForWallpaperChanged();
observer.Reset();
......@@ -326,7 +330,7 @@ IN_PROC_BROWSER_TEST_F(CustomizationWallpaperDownloaderBrowserTest,
chromeos::ServicesCustomizationDocument* customization =
chromeos::ServicesCustomizationDocument::GetInstance();
EXPECT_TRUE(
customization->LoadManifestFromString(std::string(kServicesManifest)));
customization->LoadManifestFromString(ManifestForURL(kOEMWallpaperURL)));
observer.WaitForWallpaperChanged();
observer.Reset();
......
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