Chromium Code Reviews| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 TapWebViewElementWithId("webScenarioWindowOpenWithPreventDefaultLink"); | 193 TapWebViewElementWithId("webScenarioWindowOpenWithPreventDefaultLink"); |
| 194 AssertMainTabCount(2); | 194 AssertMainTabCount(2); |
| 195 | 195 |
| 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 | |
| 204 // <a href="data:text/html,<script>window.location='about:newtab';</script>" | |
| 205 // target="_blank"> | |
|
baxley
2017/06/01 21:15:02
Is this comment too descriptive? Would it be bette
Eugene But (OOO till 7-30)
2017/06/01 23:24:57
I agree it would be better if these tests used inl
baxley
2017/06/01 23:40:15
No. Anything I suggest would make it less concrete
| |
| 206 // TODO(crbug.com/687863): Enable this test. | |
| 207 - (void)DISABLED_testWindowOpenWithAboutNewTabScript { | |
| 208 TapWebViewElementWithId("webScenarioWindowOpenWithAboutNewTabScript"); | |
| 209 AssertMainTabCount(2); | |
| 210 [[EarlGrey selectElementWithMatcher:OmniboxText("about:newtab")] | |
| 211 assertWithMatcher:grey_notNil()]; | |
| 212 } | |
| 213 | |
| 203 // Tests that closing the current window using DOM fails. | 214 // Tests that closing the current window using DOM fails. |
| 204 - (void)testCloseWindowNotOpenByDOM { | 215 - (void)testCloseWindowNotOpenByDOM { |
| 205 TapWebViewElementWithId("webScenarioWindowClose"); | 216 TapWebViewElementWithId("webScenarioWindowClose"); |
| 206 AssertMainTabCount(1); | 217 AssertMainTabCount(1); |
| 207 } | 218 } |
| 208 | 219 |
| 209 // Tests that popup blocking works when a popup is injected into a window before | 220 // Tests that popup blocking works when a popup is injected into a window before |
| 210 // its initial load is committed. | 221 // its initial load is committed. |
| 211 - (void)testBlockPopupInjectedIntoOpenedWindow { | 222 - (void)testBlockPopupInjectedIntoOpenedWindow { |
| 212 chrome_test_util::SetContentSettingsBlockPopups(CONTENT_SETTING_BLOCK); | 223 chrome_test_util::SetContentSettingsBlockPopups(CONTENT_SETTING_BLOCK); |
| 213 TapWebViewElementWithId("webScenarioOpenWindowAndInjectPopup"); | 224 TapWebViewElementWithId("webScenarioOpenWindowAndInjectPopup"); |
| 214 NSString* infobarText = GetBlockedPopupInfobarText(1); | 225 NSString* infobarText = GetBlockedPopupInfobarText(1); |
| 215 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(infobarText)] | 226 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(infobarText)] |
| 216 assertWithMatcher:grey_notNil()]; | 227 assertWithMatcher:grey_notNil()]; |
| 217 AssertMainTabCount(2); | 228 AssertMainTabCount(2); |
| 218 } | 229 } |
| 219 | 230 |
| 220 @end | 231 @end |
| OLD | NEW |