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

Side by Side Diff: chrome/browser/chromeos/policy/device_local_account_browsertest.cc

Issue 246933008: Update TermsOfServiceTest.TermsOfServiceScreen test to stop using 'screen' as JS variable name (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "apps/app_window_registry.h" 8 #include "apps/app_window_registry.h"
9 #include "apps/ui/native_app_window.h" 9 #include "apps/ui/native_app_window.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 // Wait for the Terms of Service to finish downloading, then get the status of 1298 // Wait for the Terms of Service to finish downloading, then get the status of
1299 // the screen's UI elements. 1299 // the screen's UI elements.
1300 chromeos::WebUILoginView* web_ui_login_view = host->GetWebUILoginView(); 1300 chromeos::WebUILoginView* web_ui_login_view = host->GetWebUILoginView();
1301 ASSERT_TRUE(web_ui_login_view); 1301 ASSERT_TRUE(web_ui_login_view);
1302 content::WebUI* web_ui = web_ui_login_view->GetWebUI(); 1302 content::WebUI* web_ui = web_ui_login_view->GetWebUI();
1303 ASSERT_TRUE(web_ui); 1303 ASSERT_TRUE(web_ui);
1304 content::WebContents* contents = web_ui->GetWebContents(); 1304 content::WebContents* contents = web_ui->GetWebContents();
1305 ASSERT_TRUE(contents); 1305 ASSERT_TRUE(contents);
1306 std::string json; 1306 std::string json;
1307 ASSERT_TRUE(content::ExecuteScriptAndExtractString(contents, 1307 ASSERT_TRUE(content::ExecuteScriptAndExtractString(contents,
1308 "var screen = document.getElementById('terms-of-service');" 1308 "var screenElement = document.getElementById('terms-of-service');"
1309 "function SendReplyIfDownloadDone() {" 1309 "function SendReplyIfDownloadDone() {"
1310 " if (screen.classList.contains('tos-loading'))" 1310 " if (screenElement.classList.contains('tos-loading'))"
1311 " return false;" 1311 " return false;"
1312 " var status = {};" 1312 " var status = {};"
1313 " status.heading = document.getElementById('tos-heading').textContent;" 1313 " status.heading = document.getElementById('tos-heading').textContent;"
1314 " status.subheading =" 1314 " status.subheading ="
1315 " document.getElementById('tos-subheading').textContent;" 1315 " document.getElementById('tos-subheading').textContent;"
1316 " status.contentHeading =" 1316 " status.contentHeading ="
1317 " document.getElementById('tos-content-heading').textContent;" 1317 " document.getElementById('tos-content-heading').textContent;"
1318 " status.content =" 1318 " status.content ="
1319 " document.getElementById('tos-content-main').textContent;" 1319 " document.getElementById('tos-content-main').textContent;"
1320 " status.error = screen.classList.contains('error');" 1320 " status.error = screenElement.classList.contains('error');"
1321 " status.acceptEnabled =" 1321 " status.acceptEnabled ="
1322 " !document.getElementById('tos-accept-button').disabled;" 1322 " !document.getElementById('tos-accept-button').disabled;"
1323 " domAutomationController.send(JSON.stringify(status));" 1323 " domAutomationController.send(JSON.stringify(status));"
1324 " observer.disconnect();" 1324 " observer.disconnect();"
1325 " return true;" 1325 " return true;"
1326 "}" 1326 "}"
1327 "var observer = new MutationObserver(SendReplyIfDownloadDone);" 1327 "var observer = new MutationObserver(SendReplyIfDownloadDone);"
1328 "if (!SendReplyIfDownloadDone()) {" 1328 "if (!SendReplyIfDownloadDone()) {"
1329 " var options = { attributes: true, attributeFilter: [ 'class' ] };" 1329 " var options = { attributes: true, attributeFilter: [ 'class' ] };"
1330 " observer.observe(screen, options);" 1330 " observer.observe(screenElement, options);"
1331 "}", 1331 "}",
1332 &json)); 1332 &json));
1333 scoped_ptr<base::Value> value_ptr(base::JSONReader::Read(json)); 1333 scoped_ptr<base::Value> value_ptr(base::JSONReader::Read(json));
1334 const base::DictionaryValue* status = NULL; 1334 const base::DictionaryValue* status = NULL;
1335 ASSERT_TRUE(value_ptr.get()); 1335 ASSERT_TRUE(value_ptr.get());
1336 ASSERT_TRUE(value_ptr->GetAsDictionary(&status)); 1336 ASSERT_TRUE(value_ptr->GetAsDictionary(&status));
1337 std::string heading; 1337 std::string heading;
1338 EXPECT_TRUE(status->GetString("heading", &heading)); 1338 EXPECT_TRUE(status->GetString("heading", &heading));
1339 std::string subheading; 1339 std::string subheading;
1340 EXPECT_TRUE(status->GetString("subheading", &subheading)); 1340 EXPECT_TRUE(status->GetString("subheading", &subheading));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 if (!IsSessionStarted()) { 1388 if (!IsSessionStarted()) {
1389 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED, 1389 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED,
1390 base::Bind(IsSessionStarted)).Wait(); 1390 base::Bind(IsSessionStarted)).Wait();
1391 } 1391 }
1392 } 1392 }
1393 1393
1394 INSTANTIATE_TEST_CASE_P(TermsOfServiceTestInstance, 1394 INSTANTIATE_TEST_CASE_P(TermsOfServiceTestInstance,
1395 TermsOfServiceTest, testing::Bool()); 1395 TermsOfServiceTest, testing::Bool());
1396 1396
1397 } // namespace policy 1397 } // namespace policy
OLDNEW
« 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