Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: ios/chrome/browser/web/window_open_by_dom_egtest.mm

Issue 2672893003: EG test for sessionStorage sharing. (Closed)
Patch Set: Self review Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ios/testing/data/http_server_files/window_open.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 open by DOM via
baxley 2017/02/03 15:23:38 nit: I don't quite understand "windows open by DOM
Eugene But (OOO till 7-30) 2017/02/03 19:04:23 Yes, it should be "windows opened by DOM". Done.
64 // |target="_blank"| links.
65 // TODO(crbug.com/681434): Enable this test.
66 - (void)DISABLED_testLinkWithBlankTargetSessionStorage {
67 using chrome_test_util::ExecuteJavaScript;
68
69 NSError* error = nil;
70 ExecuteJavaScript(@"sessionStorage.setItem('key', 'value');", &error);
71 GREYAssert(!error, @"Error during script execution: %@", error);
72
73 TapWebViewElementWithId("webScenarioWindowOpenSamePageWithBlankTarget");
74 AssertMainTabCount(2);
75 [[EarlGrey selectElementWithMatcher:WebViewContainingText("Expected result")]
76 assertWithMatcher:grey_notNil()];
77
78 id value = ExecuteJavaScript(@"sessionStorage.getItem('key');", &error);
79 GREYAssert(!error, @"Error during script execution: %@", error);
80 GREYAssert([value isEqual:@"value"], @"sessionStorage is not shared");
81 }
82
63 // Tests a link with target="_blank". 83 // Tests a link with target="_blank".
64 - (void)testLinkWithBlankTarget { 84 - (void)testLinkWithBlankTarget {
65 TapWebViewElementWithId("webScenarioWindowOpenRegularLink"); 85 TapWebViewElementWithId("webScenarioWindowOpenRegularLink");
66 AssertMainTabCount(2); 86 AssertMainTabCount(2);
67 } 87 }
68 88
69 // Tests a link with target="_blank" multiple times. 89 // Tests a link with target="_blank" multiple times.
70 - (void)testLinkWithBlankTargetMultipleTimes { 90 - (void)testLinkWithBlankTargetMultipleTimes {
71 TapWebViewElementWithId("webScenarioWindowOpenRegularLinkMultipleTimes"); 91 TapWebViewElementWithId("webScenarioWindowOpenRegularLinkMultipleTimes");
72 AssertMainTabCount(2); 92 AssertMainTabCount(2);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 assertWithMatcher:grey_notNil()]; 183 assertWithMatcher:grey_notNil()];
164 } 184 }
165 185
166 // Tests that closing the current window using DOM fails. 186 // Tests that closing the current window using DOM fails.
167 - (void)testCloseWindowNotOpenByDOM { 187 - (void)testCloseWindowNotOpenByDOM {
168 TapWebViewElementWithId("webScenarioWindowClose"); 188 TapWebViewElementWithId("webScenarioWindowClose");
169 AssertMainTabCount(1); 189 AssertMainTabCount(1);
170 } 190 }
171 191
172 @end 192 @end
OLDNEW
« no previous file with comments | « no previous file | ios/testing/data/http_server_files/window_open.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698