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

Side by Side Diff: ios/testing/data/http_server_files/state_operations.js

Issue 2601193003: Created a test page for window.history.[push/replace]State() tests. (Closed)
Patch Set: eugene's comments Created 3 years, 11 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
« no previous file with comments | « ios/testing/data/http_server_files/state_operations.html ('k') | 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Populates onload text and clear no-op text.
6 window.onload = function() {
7 updateOnLoadText('OnLoadText');
8 updateNoOpText('');
9 };
10
11 var updateOnLoadText = function(text) {
12 document.getElementById('on-load').innerHTML = text;
13 }
14
15 var updateNoOpText = function(text) {
16 document.getElementById('no-op').innerHTML = text;
17 }
18
19 var isOnLoadPlaceholderTextVisible = function() {
20 return document.getElementById('on-load').innerHTML == 'OnLoadText';
21 }
22
23 var isNoOpPlaceholderTextVisible = function() {
24 return document.getElementById('no-op').innerHTML == 'NoOpText';
25 }
26
27 // When a button is tapped, a 0,5s timeout begins that will call this function.
28 var onNoOpTimeout = function() {
29 document.getElementById('no-op').innerHTML = 'NoOpText';
30 }
31
32 // Updates |gStateParams| to hold the specified values. These are later used as
33 // input parameters to history state changes.
34 var gStateParams = {};
35 var updateStateParams = function(obj, title, url) {
36 gStateParams.obj = obj;
37 gStateParams.title = title;
38 gStateParams.url = url;
39 }
40
41 // Clears div text so tests can verify that the reported values are the result
42 // of the latest executed script.
43 var onButtonTapped = function() {
44 updateOnLoadText('');
45 updateNoOpText('');
46 setTimeout(onNoOpTimeout, 500);
47 }
48
49 var pushStateAction = function() {
50 onButtonTapped();
51 window.history.pushState(gStateParams.obj, gStateParams.title,
52 gStateParams.url);
53 }
54
55 var replaceStateAction = function() {
56 onButtonTapped();
57 window.history.replaceState(gStateParams.obj, gStateParams.title,
58 gStateParams.url);
59 }
60
OLDNEW
« no previous file with comments | « ios/testing/data/http_server_files/state_operations.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698