| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #import <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // Ensure that the starting tab hasn't navigated. | 196 // Ensure that the starting tab hasn't navigated. |
| 197 chrome_test_util::CloseCurrentTab(); | 197 chrome_test_util::CloseCurrentTab(); |
| 198 const GURL URL = HttpServer::MakeUrl(kTestURL); | 198 const GURL URL = HttpServer::MakeUrl(kTestURL); |
| 199 [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())] | 199 [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())] |
| 200 assertWithMatcher:grey_notNil()]; | 200 assertWithMatcher:grey_notNil()]; |
| 201 } | 201 } |
| 202 | 202 |
| 203 // Tests opening a child window using the following link | 203 // Tests opening a child window using the following link |
| 204 // <a href="data:text/html,<script>window.location='about:newtab';</script>" | 204 // <a href="data:text/html,<script>window.location='about:newtab';</script>" |
| 205 // target="_blank"> | 205 // target="_blank"> |
| 206 // TODO(crbug.com/687863): Enable this test. | 206 - (void)testWindowOpenWithAboutNewTabScript { |
| 207 - (void)DISABLED_testWindowOpenWithAboutNewTabScript { | |
| 208 TapWebViewElementWithId("webScenarioWindowOpenWithAboutNewTabScript"); | 207 TapWebViewElementWithId("webScenarioWindowOpenWithAboutNewTabScript"); |
| 209 AssertMainTabCount(2); | 208 AssertMainTabCount(2); |
| 210 [[EarlGrey selectElementWithMatcher:OmniboxText("about:newtab")] | 209 [[EarlGrey selectElementWithMatcher:OmniboxText("about:newtab")] |
| 211 assertWithMatcher:grey_notNil()]; | 210 assertWithMatcher:grey_notNil()]; |
| 212 } | 211 } |
| 213 | 212 |
| 214 // Tests that closing the current window using DOM fails. | 213 // Tests that closing the current window using DOM fails. |
| 215 - (void)testCloseWindowNotOpenByDOM { | 214 - (void)testCloseWindowNotOpenByDOM { |
| 216 TapWebViewElementWithId("webScenarioWindowClose"); | 215 TapWebViewElementWithId("webScenarioWindowClose"); |
| 217 AssertMainTabCount(1); | 216 AssertMainTabCount(1); |
| 218 } | 217 } |
| 219 | 218 |
| 220 // Tests that popup blocking works when a popup is injected into a window before | 219 // Tests that popup blocking works when a popup is injected into a window before |
| 221 // its initial load is committed. | 220 // its initial load is committed. |
| 222 - (void)testBlockPopupInjectedIntoOpenedWindow { | 221 - (void)testBlockPopupInjectedIntoOpenedWindow { |
| 223 chrome_test_util::SetContentSettingsBlockPopups(CONTENT_SETTING_BLOCK); | 222 chrome_test_util::SetContentSettingsBlockPopups(CONTENT_SETTING_BLOCK); |
| 224 TapWebViewElementWithId("webScenarioOpenWindowAndInjectPopup"); | 223 TapWebViewElementWithId("webScenarioOpenWindowAndInjectPopup"); |
| 225 NSString* infobarText = GetBlockedPopupInfobarText(1); | 224 NSString* infobarText = GetBlockedPopupInfobarText(1); |
| 226 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(infobarText)] | 225 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(infobarText)] |
| 227 assertWithMatcher:grey_notNil()]; | 226 assertWithMatcher:grey_notNil()]; |
| 228 AssertMainTabCount(2); | 227 AssertMainTabCount(2); |
| 229 } | 228 } |
| 230 | 229 |
| 231 @end | 230 @end |
| OLD | NEW |