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

Unified Diff: chrome/browser/chromeos/login/wallpaper_manager_policy_browsertest.cc

Issue 219143004: Improve wallpaper policy tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wallpaper-2nd-test
Patch Set: Fix comment. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/wallpaper_manager_policy_browsertest.cc
diff --git a/chrome/browser/chromeos/login/wallpaper_manager_policy_browsertest.cc b/chrome/browser/chromeos/login/wallpaper_manager_policy_browsertest.cc
index 69159fdc41b989e17545c7416b402afe0bd3688d..d4751fe6fd79b828a5313e28a4ac2119781094bc 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager_policy_browsertest.cc
+++ b/chrome/browser/chromeos/login/wallpaper_manager_policy_browsertest.cc
@@ -17,6 +17,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/run_loop.h"
+#include "chrome/browser/chromeos/login/login_display_host_impl.h"
#include "chrome/browser/chromeos/login/login_manager_test.h"
#include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/chromeos/login/user.h"
@@ -39,6 +40,7 @@
#include "components/policy/core/common/cloud/cloud_policy_store.h"
#include "components/policy/core/common/cloud/cloud_policy_validator.h"
#include "components/policy/core/common/cloud/policy_builder.h"
+#include "content/public/test/browser_test_utils.h"
#include "crypto/rsa_private_key.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "policy/proto/cloud_policy.pb.h"
@@ -327,12 +329,14 @@ IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, SetResetClear) {
}
IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest,
- PRE_PRE_WallpaperOnLoginScreen) {
+ PRE_PRE_PRE_WallpaperOnLoginScreen) {
RegisterUser(kTestUsers[0]);
+ RegisterUser(kTestUsers[1]);
StartupUtils::MarkOobeCompleted();
}
-IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PRE_WallpaperOnLoginScreen) {
+IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest,
+ PRE_PRE_WallpaperOnLoginScreen) {
LoginUser(kTestUsers[0]);
// Wait until default wallpaper has been loaded.
@@ -343,11 +347,62 @@ IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PRE_WallpaperOnLoginScreen) {
// Run until wallpaper has changed.
RunUntilWallpaperChangeCount(2);
+ ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor());
+}
+
+IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PRE_WallpaperOnLoginScreen) {
+ LoginUser(kTestUsers[1]);
+
+ // Wait until default wallpaper has been loaded.
+ RunUntilWallpaperChangeCount(1);
+
+ // Set wallpaper policy to green image.
+ InjectPolicy(1, kGreenImageFileName);
+
+ // Run until wallpaper has changed.
+ RunUntilWallpaperChangeCount(2);
+ ASSERT_EQ(kGreenImageColor, GetAverageBackgroundColor());
}
IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, WallpaperOnLoginScreen) {
// Wait for active pod's wallpaper to be loaded.
RunUntilWallpaperChangeCount(1);
+ ASSERT_EQ(kGreenImageColor, GetAverageBackgroundColor());
+
+ // Select the second pod (belonging to user 1).
+ ASSERT_TRUE(content::ExecuteScript(
+ static_cast<chromeos::LoginDisplayHostImpl*>(
+ chromeos::LoginDisplayHostImpl::default_host())->GetOobeUI()->
+ web_ui()->GetWebContents(),
+ "document.getElementsByClassName('pod')[1].focus();"));
+ RunUntilWallpaperChangeCount(2);
+ ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor());
+}
+
+IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PRE_PRE_PersistOverLogout) {
+ RegisterUser(kTestUsers[0]);
+ StartupUtils::MarkOobeCompleted();
+}
+
+IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PRE_PersistOverLogout) {
+ LoginUser(kTestUsers[0]);
+
+ // Wait until default wallpaper has been loaded.
+ RunUntilWallpaperChangeCount(1);
+
+ // Set wallpaper policy to red image.
+ InjectPolicy(0, kRedImageFileName);
+
+ // Run until wallpaper has changed.
+ RunUntilWallpaperChangeCount(2);
+ ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor());
+}
+
+IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PersistOverLogout) {
+ LoginUser(kTestUsers[0]);
+
+ // Wait until wallpaper has been loaded.
+ RunUntilWallpaperChangeCount(1);
ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698