OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 package org.chromium.chrome.test; | 5 package org.chromium.chrome.test; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.test.InstrumentationTestCase; | 8 import android.test.InstrumentationTestCase; |
9 import android.text.TextUtils; | 9 import android.text.TextUtils; |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 + " body {margin: 0em;} div {width: 100%; height: 100%; backgro
und: #011684;}" | 73 + " body {margin: 0em;} div {width: 100%; height: 100%; backgro
und: #011684;}" |
74 + " </style>" | 74 + " </style>" |
75 + " </head>" | 75 + " </head>" |
76 + " <body>" | 76 + " <body>" |
77 + " <a href='" + URL_4 + "' target='_blank' rel='noreferrer'><div
></div></a>" | 77 + " <a href='" + URL_4 + "' target='_blank' rel='noreferrer'><div
></div></a>" |
78 + " </body>" | 78 + " </body>" |
79 + "</html>"); | 79 + "</html>"); |
80 | 80 |
81 /** Clicking the body triggers a window.open() call to open URL_4. */ | 81 /** Clicking the body triggers a window.open() call to open URL_4. */ |
82 protected static final String SUCCESS_URL = UrlUtils.encodeHtmlDataUri("open
ed!"); | 82 protected static final String SUCCESS_URL = UrlUtils.encodeHtmlDataUri("open
ed!"); |
83 protected static final String ONCLICK_LINK = UrlUtils.encodeHtmlDataUri( | 83 protected static final String ONCLICK_LINK = UrlUtils.encodeHtmlDataUri("<ht
ml>" |
84 "<html>" | |
85 + " <head>" | 84 + " <head>" |
86 + " <title>window.open page</title>" | 85 + " <title>window.open page</title>" |
87 + " <meta name='viewport'" | 86 + " <meta name='viewport'" |
88 + " content='width=device-width initial-scale=0.5, maximum-sc
ale=0.5'>" | 87 + " content='width=device-width initial-scale=0.5, maximum-sc
ale=0.5'>" |
89 + " <style>" | 88 + " <style>" |
90 + " body {margin: 0em;} div {width: 100%; height: 100%; backgro
und: #011684;}" | 89 + " body {margin: 0em;} div {width: 100%; height: 100%; backgro
und: #011684;}" |
91 + " </style>" | 90 + " </style>" |
92 + " <script>" | 91 + " <script>" |
93 + " function openNewWindow() {" | 92 + " function openNewWindow() {" |
94 + " var site = window.open('" + URL_4 + "');" | 93 + " var site = window.open('about:blank');" |
95 + " if (site) location.href = '" + SUCCESS_URL + "';" | 94 + " if (site) {" |
| 95 + " site.document.write('" + URL_4 + "');" |
| 96 + " location.href = '" + SUCCESS_URL + "';" |
| 97 + " }" |
96 + " }" | 98 + " }" |
97 + " </script>" | 99 + " </script>" |
98 + " </head>" | 100 + " </head>" |
99 + " <body id='body'>" | 101 + " <body id='body'>" |
100 + " <div onclick='openNewWindow()'></div>" | 102 + " <div onclick='openNewWindow()'></div>" |
101 + " </body>" | 103 + " </body>" |
102 + "</html>"); | 104 + "</html>"); |
103 | 105 |
104 /** Opens a new page via window.open(), but get rid of the opener. */ | 106 /** Opens a new page via window.open(), but get rid of the opener. */ |
105 protected static final String ONCLICK_NO_REFERRER_LINK = UrlUtils.encodeHtml
DataUri( | 107 protected static final String ONCLICK_NO_REFERRER_LINK = UrlUtils.encodeHtml
DataUri( |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 "<html>" | 252 "<html>" |
251 + " <head>" | 253 + " <head>" |
252 + " <title>Page " + index + "</title>" | 254 + " <title>Page " + index + "</title>" |
253 + " <meta name='viewport' content='width=device-width " | 255 + " <meta name='viewport' content='width=device-width " |
254 + " initial-scale=0.5 maximum-scale=0.5'>" | 256 + " initial-scale=0.5 maximum-scale=0.5'>" |
255 + " </head>" | 257 + " </head>" |
256 + " <body style='margin: 0em; background: " + colors[index] + ";'><
/body>" | 258 + " <body style='margin: 0em; background: " + colors[index] + ";'><
/body>" |
257 + "</html>"); | 259 + "</html>"); |
258 } | 260 } |
259 } | 261 } |
OLD | NEW |