| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // Tests that sessionStorage content is available for windows opened by DOM via | 63 // Tests that sessionStorage content is available for windows opened by DOM via |
| 64 // target="_blank" links. | 64 // target="_blank" links. |
| 65 - (void)testLinkWithBlankTargetSessionStorage { | 65 - (void)testLinkWithBlankTargetSessionStorage { |
| 66 using chrome_test_util::ExecuteJavaScript; | 66 using chrome_test_util::ExecuteJavaScript; |
| 67 | 67 |
| 68 NSError* error = nil; | 68 NSError* error = nil; |
| 69 ExecuteJavaScript(@"sessionStorage.setItem('key', 'value');", &error); | 69 ExecuteJavaScript(@"sessionStorage.setItem('key', 'value');", &error); |
| 70 GREYAssert(!error, @"Error during script execution: %@", error); | 70 GREYAssert(!error, @"Error during script execution: %@", error); |
| 71 | 71 |
| 72 TapWebViewElementWithId("webScenarioWindowOpenSamePageWithBlankTarget"); | 72 TapWebViewElementWithId("webScenarioWindowOpenSameURLWithBlankTarget"); |
| 73 AssertMainTabCount(2); | 73 AssertMainTabCount(2); |
| 74 [[EarlGrey selectElementWithMatcher:WebViewContainingText("Expected result")] | 74 [[EarlGrey selectElementWithMatcher:WebViewContainingText("Expected result")] |
| 75 assertWithMatcher:grey_notNil()]; | 75 assertWithMatcher:grey_notNil()]; |
| 76 | 76 |
| 77 id value = ExecuteJavaScript(@"sessionStorage.getItem('key');", &error); | 77 id value = ExecuteJavaScript(@"sessionStorage.getItem('key');", &error); |
| 78 GREYAssert(!error, @"Error during script execution: %@", error); | 78 GREYAssert(!error, @"Error during script execution: %@", error); |
| 79 GREYAssert([value isEqual:@"value"], @"sessionStorage is not shared"); | 79 GREYAssert([value isEqual:@"value"], @"sessionStorage is not shared"); |
| 80 } | 80 } |
| 81 | 81 |
| 82 // Tests a link with target="_blank". | 82 // Tests a link with target="_blank". |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 assertWithMatcher:grey_notNil()]; | 182 assertWithMatcher:grey_notNil()]; |
| 183 } | 183 } |
| 184 | 184 |
| 185 // Tests that closing the current window using DOM fails. | 185 // Tests that closing the current window using DOM fails. |
| 186 - (void)testCloseWindowNotOpenByDOM { | 186 - (void)testCloseWindowNotOpenByDOM { |
| 187 TapWebViewElementWithId("webScenarioWindowClose"); | 187 TapWebViewElementWithId("webScenarioWindowClose"); |
| 188 AssertMainTabCount(1); | 188 AssertMainTabCount(1); |
| 189 } | 189 } |
| 190 | 190 |
| 191 @end | 191 @end |
| OLD | NEW |