| 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 #import "base/test/ios/wait_util.h" | 7 #import "base/test/ios/wait_util.h" |
| 8 #include "components/content_settings/core/common/content_settings.h" | 8 #include "components/content_settings/core/common/content_settings.h" |
| 9 #include "ios/chrome/test/app/settings_test_util.h" | 9 #include "ios/chrome/test/app/settings_test_util.h" |
| 10 #import "ios/chrome/test/app/tab_test_util.h" | 10 #import "ios/chrome/test/app/tab_test_util.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 AssertMainTabCount(1); | 53 AssertMainTabCount(1); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Tests that opening a link with target=_blank which then immediately closes | 56 // Tests that opening a link with target=_blank which then immediately closes |
| 57 // itself works. | 57 // itself works. |
| 58 - (void)testLinkWithBlankTargetWithImmediateClose { | 58 - (void)testLinkWithBlankTargetWithImmediateClose { |
| 59 TapWebViewElementWithId("webScenarioWindowOpenBlankTargetWithImmediateClose"); | 59 TapWebViewElementWithId("webScenarioWindowOpenBlankTargetWithImmediateClose"); |
| 60 AssertMainTabCount(1); | 60 AssertMainTabCount(1); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Tests that |sessionStorage| content is available for windows opened by DOM | 63 // Tests that sessionStorage content is available for windows opened by DOM via |
| 64 // via |target="_blank"| links. | 64 // target="_blank" links. |
| 65 // TODO(crbug.com/681434): Enable this test. | 65 - (void)testLinkWithBlankTargetSessionStorage { |
| 66 - (void)DISABLED_testLinkWithBlankTargetSessionStorage { | |
| 67 using chrome_test_util::ExecuteJavaScript; | 66 using chrome_test_util::ExecuteJavaScript; |
| 68 | 67 |
| 69 NSError* error = nil; | 68 NSError* error = nil; |
| 70 ExecuteJavaScript(@"sessionStorage.setItem('key', 'value');", &error); | 69 ExecuteJavaScript(@"sessionStorage.setItem('key', 'value');", &error); |
| 71 GREYAssert(!error, @"Error during script execution: %@", error); | 70 GREYAssert(!error, @"Error during script execution: %@", error); |
| 72 | 71 |
| 73 TapWebViewElementWithId("webScenarioWindowOpenSamePageWithBlankTarget"); | 72 TapWebViewElementWithId("webScenarioWindowOpenSamePageWithBlankTarget"); |
| 74 AssertMainTabCount(2); | 73 AssertMainTabCount(2); |
| 75 [[EarlGrey selectElementWithMatcher:WebViewContainingText("Expected result")] | 74 [[EarlGrey selectElementWithMatcher:WebViewContainingText("Expected result")] |
| 76 assertWithMatcher:grey_notNil()]; | 75 assertWithMatcher:grey_notNil()]; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 assertWithMatcher:grey_notNil()]; | 182 assertWithMatcher:grey_notNil()]; |
| 184 } | 183 } |
| 185 | 184 |
| 186 // Tests that closing the current window using DOM fails. | 185 // Tests that closing the current window using DOM fails. |
| 187 - (void)testCloseWindowNotOpenByDOM { | 186 - (void)testCloseWindowNotOpenByDOM { |
| 188 TapWebViewElementWithId("webScenarioWindowClose"); | 187 TapWebViewElementWithId("webScenarioWindowClose"); |
| 189 AssertMainTabCount(1); | 188 AssertMainTabCount(1); |
| 190 } | 189 } |
| 191 | 190 |
| 192 @end | 191 @end |
| OLD | NEW |