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

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

Issue 158833003: Represent kiosk apps as user pods instead of menu items. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review + fixes Created 6 years, 10 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
Index: chrome/browser/chromeos/login/kiosk_browsertest.cc
diff --git a/chrome/browser/chromeos/login/kiosk_browsertest.cc b/chrome/browser/chromeos/login/kiosk_browsertest.cc
index 7c54d77e84757919950fde7baf85cfe5a5638713..e5ca169982275bf56e89a5c4280f389353e38325 100644
--- a/chrome/browser/chromeos/login/kiosk_browsertest.cc
+++ b/chrome/browser/chromeos/login/kiosk_browsertest.cc
@@ -71,6 +71,16 @@ const char kTestClientId[] = "fake-client-id";
const char kTestAppScope[] =
"https://www.googleapis.com/auth/userinfo.profile";
+const char kLaunchAppForTestNewAPI[] =
+ "login.AccountPickerScreen.runAppForTesting";
+const char kLaunchAppForTestOldAPI[] =
+ "login.AppsMenuButton.runAppForTesting";
+
+const char kCheckDiagnosticModeNewAPI[] =
+ "$('pod_row').confirmDiagnosticMode_";
+const char kCheckDiagnosticModeOldAPI[] =
+ "$('show-apps-button').confirmDiagnosticMode_";
+
// Helper function for GetConsumerKioskModeStatusCallback.
void ConsumerKioskModeStatusCheck(
KioskAppManager::ConsumerKioskModeStatus* out_status,
@@ -284,6 +294,15 @@ class KioskTest : public OobeBaseTest {
"/chromeos/app_mode/webstore/downloads/%s.crx").spec());
}
+ void LaunchApp(const std::string& app_id, bool diagnostic_mode) {
+ bool new_kiosk_ui = !CommandLine::ForCurrentProcess()->
+ HasSwitch(switches::kDisableNewKioskUI);
+ GetLoginUI()->CallJavascriptFunction(new_kiosk_ui ?
+ kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI,
+ base::StringValue(app_id),
+ base::FundamentalValue(diagnostic_mode));
+ }
+
void ReloadKioskApps() {
KioskAppManager::Get()->AddApp(kTestKioskApp);
}
@@ -321,9 +340,7 @@ class KioskTest : public OobeBaseTest {
if (!network_setup_cb.is_null())
network_setup_cb.Run();
- GetLoginUI()->CallJavascriptFunction(
- "login.AppsMenuButton.runAppForTesting",
- base::StringValue(kTestKioskApp));
+ LaunchApp(kTestKioskApp, false);
}
void WaitForAppLaunchSuccess() {
@@ -523,21 +540,22 @@ IN_PROC_BROWSER_TEST_F(KioskTest, LaunchInDiagnosticMode) {
PrepareAppLaunch();
SimulateNetworkOnline();
- GetLoginUI()->CallJavascriptFunction(
- "login.AppsMenuButton.runAppForTesting",
- base::StringValue(kTestKioskApp),
- base::FundamentalValue(true));
+ LaunchApp(kTestKioskApp, true);
content::WebContents* login_contents = GetLoginUI()->GetWebContents();
- JsConditionWaiter(login_contents,
- "$('show-apps-button').confirmDiagnosticMode_").Wait();
+ bool new_kiosk_ui = !CommandLine::ForCurrentProcess()->
+ HasSwitch(switches::kDisableNewKioskUI);
+ JsConditionWaiter(login_contents, new_kiosk_ui ?
+ kCheckDiagnosticModeNewAPI : kCheckDiagnosticModeOldAPI).Wait();
+ std::string diagnosticMode(new_kiosk_ui ?
+ kCheckDiagnosticModeNewAPI : kCheckDiagnosticModeOldAPI);
ASSERT_TRUE(content::ExecuteScript(
login_contents,
"(function() {"
- "var e = new Event('click');"
- "$('show-apps-button').confirmDiagnosticMode_."
+ "var e = new Event('click');" +
+ diagnosticMode + "."
"okButton_.dispatchEvent(e);"
"})();"));
@@ -862,9 +880,7 @@ IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, EnterpriseKioskApp) {
base::Unretained(KioskAppManager::Get()),
kTestEnterpriseKioskApp, &app)).Wait();
- GetLoginUI()->CallJavascriptFunction(
- "login.AppsMenuButton.runAppForTesting",
- base::StringValue(kTestEnterpriseKioskApp));
+ LaunchApp(kTestEnterpriseKioskApp, false);
// Wait for the Kiosk App to launch.
content::WindowedNotificationObserver(

Powered by Google App Engine
This is Rietveld 408576698