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

Side by Side Diff: chrome/browser/chromeos/customization_document_unittest.cc

Issue 236013002: Apply default wallpaper from customization manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove wallpaper URL from ServicesCustomizationDocumentTest. Created 6 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/customization_document.h" 5 #include "chrome/browser/chromeos/customization_document.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/prefs/testing_pref_service.h" 8 #include "base/prefs/testing_pref_service.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 " \"keyboard_layout\" : \"xkb:ru::rus\"," 69 " \"keyboard_layout\" : \"xkb:ru::rus\","
70 " }," 70 " },"
71 " ]," 71 " ],"
72 "}"; 72 "}";
73 73
74 const char kBadManifest[] = "{\"version\": \"1\"}"; 74 const char kBadManifest[] = "{\"version\": \"1\"}";
75 75
76 const char kGoodServicesManifest[] = 76 const char kGoodServicesManifest[] =
77 "{" 77 "{"
78 " \"version\": \"1.0\"," 78 " \"version\": \"1.0\","
79 " \"default_wallpaper\": \"http://somedomain.com/image.png\",\n"
Dmitry Polukhin 2014/04/23 20:24:04 Why did you do this instead of adding test? Moreov
80 " \"default_apps\": [\n" 79 " \"default_apps\": [\n"
81 " \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n" 80 " \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n"
82 " \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"\n" 81 " \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"\n"
83 " ],\n" 82 " ],\n"
84 " \"localized_content\": {\n" 83 " \"localized_content\": {\n"
85 " \"en-US\": {\n" 84 " \"en-US\": {\n"
86 " \"default_apps_folder_name\": \"EN-US OEM Name\"\n" 85 " \"default_apps_folder_name\": \"EN-US OEM Name\"\n"
87 " },\n" 86 " },\n"
88 " \"en\": {\n" 87 " \"en\": {\n"
89 " \"default_apps_folder_name\": \"EN OEM Name\"\n" 88 " \"default_apps_folder_name\": \"EN OEM Name\"\n"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 AddExpectedManifest(kDummyCustomizationID, kGoodServicesManifest); 315 AddExpectedManifest(kDummyCustomizationID, kGoodServicesManifest);
317 316
318 ServicesCustomizationDocument* doc = 317 ServicesCustomizationDocument* doc =
319 ServicesCustomizationDocument::GetInstance(); 318 ServicesCustomizationDocument::GetInstance();
320 EXPECT_FALSE(doc->IsReady()); 319 EXPECT_FALSE(doc->IsReady());
321 320
322 doc->StartFetching(); 321 doc->StartFetching();
323 RunUntilIdle(); 322 RunUntilIdle();
324 EXPECT_TRUE(doc->IsReady()); 323 EXPECT_TRUE(doc->IsReady());
325 324
326 EXPECT_EQ(doc->GetDefaultWallpaperUrl().spec(), 325 GURL wallpaper_url;
327 "http://somedomain.com/image.png"); 326 EXPECT_FALSE(doc->GetDefaultWallpaperUrl(&wallpaper_url));
327 EXPECT_EQ("", wallpaper_url.spec());
328 328
329 std::vector<std::string> default_apps; 329 std::vector<std::string> default_apps;
330 EXPECT_TRUE(doc->GetDefaultApps(&default_apps)); 330 EXPECT_TRUE(doc->GetDefaultApps(&default_apps));
331 ASSERT_EQ(default_apps.size(), 2u); 331 ASSERT_EQ(default_apps.size(), 2u);
332 332
333 EXPECT_EQ(default_apps[0], "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); 333 EXPECT_EQ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", default_apps[0]);
334 EXPECT_EQ(default_apps[1], "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); 334 EXPECT_EQ("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", default_apps[1]);
335 335
336 EXPECT_EQ(doc->GetOemAppsFolderName("en-US"), "EN-US OEM Name"); 336 EXPECT_EQ("EN-US OEM Name", doc->GetOemAppsFolderName("en-US"));
337 EXPECT_EQ(doc->GetOemAppsFolderName("en"), "EN OEM Name"); 337 EXPECT_EQ("EN OEM Name", doc->GetOemAppsFolderName("en"));
338 EXPECT_EQ(doc->GetOemAppsFolderName("ru"), "Default OEM Name"); 338 EXPECT_EQ("Default OEM Name", doc->GetOemAppsFolderName("ru"));
339 } 339 }
340 340
341 TEST_F(ServicesCustomizationDocumentTest, NoCustomizationIdInVpd) { 341 TEST_F(ServicesCustomizationDocumentTest, NoCustomizationIdInVpd) {
342 ServicesCustomizationDocument* doc = 342 ServicesCustomizationDocument* doc =
343 ServicesCustomizationDocument::GetInstance(); 343 ServicesCustomizationDocument::GetInstance();
344 EXPECT_FALSE(doc->IsReady()); 344 EXPECT_FALSE(doc->IsReady());
345 345
346 scoped_ptr<TestingProfile> profile = CreateProfile(); 346 scoped_ptr<TestingProfile> profile = CreateProfile();
347 extensions::ExternalLoader* loader = doc->CreateExternalLoader(profile.get()); 347 extensions::ExternalLoader* loader = doc->CreateExternalLoader(profile.get());
348 EXPECT_TRUE(loader); 348 EXPECT_TRUE(loader);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 .Times(2); 420 .Times(2);
421 EXPECT_CALL(visitor, OnExternalProviderReady(_)) 421 EXPECT_CALL(visitor, OnExternalProviderReady(_))
422 .Times(1); 422 .Times(1);
423 423
424 RunUntilIdle(); 424 RunUntilIdle();
425 EXPECT_TRUE(doc->IsReady()); 425 EXPECT_TRUE(doc->IsReady());
426 426
427 app_list::AppListSyncableService* service = 427 app_list::AppListSyncableService* service =
428 app_list::AppListSyncableServiceFactory::GetForProfile(profile.get()); 428 app_list::AppListSyncableServiceFactory::GetForProfile(profile.get());
429 ASSERT_TRUE(service); 429 ASSERT_TRUE(service);
430 EXPECT_EQ(service->GetOemFolderNameForTest(), "EN OEM Name"); 430 EXPECT_EQ("EN OEM Name", service->GetOemFolderNameForTest());
431 } 431 }
432 432
433 TEST_F(ServicesCustomizationDocumentTest, CustomizationManifestNotFound) { 433 TEST_F(ServicesCustomizationDocumentTest, CustomizationManifestNotFound) {
434 AddCustomizationIdToVp(kDummyCustomizationID); 434 AddCustomizationIdToVp(kDummyCustomizationID);
435 AddManifestNotFound(kDummyCustomizationID); 435 AddManifestNotFound(kDummyCustomizationID);
436 436
437 ServicesCustomizationDocument* doc = 437 ServicesCustomizationDocument* doc =
438 ServicesCustomizationDocument::GetInstance(); 438 ServicesCustomizationDocument::GetInstance();
439 EXPECT_FALSE(doc->IsReady()); 439 EXPECT_FALSE(doc->IsReady());
440 440
(...skipping 28 matching lines...) Expand all
469 EXPECT_CALL(visitor, OnExternalExtensionUpdateUrlFound(_, _, _, _, _, _)) 469 EXPECT_CALL(visitor, OnExternalExtensionUpdateUrlFound(_, _, _, _, _, _))
470 .Times(0); 470 .Times(0);
471 EXPECT_CALL(visitor, OnExternalProviderReady(_)) 471 EXPECT_CALL(visitor, OnExternalProviderReady(_))
472 .Times(1); 472 .Times(1);
473 473
474 RunUntilIdle(); 474 RunUntilIdle();
475 EXPECT_TRUE(doc->IsReady()); 475 EXPECT_TRUE(doc->IsReady());
476 } 476 }
477 477
478 } // namespace chromeos 478 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/customization_document.cc ('k') | chrome/browser/chromeos/customization_wallpaper_downloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698