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

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

Issue 2890003002: [ObjC ARC] Converts ios/chrome/browser/web:eg_tests to ARC. (Closed)
Patch Set: Created 3 years, 7 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 | « ios/chrome/browser/web/visible_url_egtest.mm ('k') | no next file » | 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"
11 #include "ios/chrome/test/app/web_view_interaction_test_util.h" 11 #include "ios/chrome/test/app/web_view_interaction_test_util.h"
12 #import "ios/chrome/test/earl_grey/chrome_assertions.h" 12 #import "ios/chrome/test/earl_grey/chrome_assertions.h"
13 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" 13 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
14 #import "ios/chrome/test/earl_grey/chrome_matchers.h" 14 #import "ios/chrome/test/earl_grey/chrome_matchers.h"
15 #import "ios/chrome/test/earl_grey/chrome_test_case.h" 15 #import "ios/chrome/test/earl_grey/chrome_test_case.h"
16 #import "ios/web/public/test/http_server.h" 16 #import "ios/web/public/test/http_server.h"
17 #include "ios/web/public/test/http_server_util.h" 17 #include "ios/web/public/test/http_server_util.h"
18 18
19 #if !defined(__has_feature) || !__has_feature(objc_arc)
20 #error "This file requires ARC support."
21 #endif
22
19 using chrome_test_util::AssertMainTabCount; 23 using chrome_test_util::AssertMainTabCount;
20 using chrome_test_util::OmniboxText; 24 using chrome_test_util::OmniboxText;
21 using chrome_test_util::TapWebViewElementWithId; 25 using chrome_test_util::TapWebViewElementWithId;
22 using chrome_test_util::WebViewContainingText; 26 using chrome_test_util::WebViewContainingText;
23 using web::test::HttpServer; 27 using web::test::HttpServer;
24 28
25 namespace { 29 namespace {
26 const char kTestURL[] = 30 const char kTestURL[] =
27 "http://ios/testing/data/http_server_files/window_open.html"; 31 "http://ios/testing/data/http_server_files/window_open.html";
28 } // namespace 32 } // namespace
(...skipping 29 matching lines...) Expand all
58 - (void)testLinkWithBlankTargetWithImmediateClose { 62 - (void)testLinkWithBlankTargetWithImmediateClose {
59 TapWebViewElementWithId("webScenarioWindowOpenBlankTargetWithImmediateClose"); 63 TapWebViewElementWithId("webScenarioWindowOpenBlankTargetWithImmediateClose");
60 AssertMainTabCount(1); 64 AssertMainTabCount(1);
61 } 65 }
62 66
63 // Tests that sessionStorage content is available for windows opened by DOM via 67 // Tests that sessionStorage content is available for windows opened by DOM via
64 // target="_blank" links. 68 // target="_blank" links.
65 - (void)testLinkWithBlankTargetSessionStorage { 69 - (void)testLinkWithBlankTargetSessionStorage {
66 using chrome_test_util::ExecuteJavaScript; 70 using chrome_test_util::ExecuteJavaScript;
67 71
68 NSError* error = nil; 72 __unsafe_unretained NSError* error = nil;
69 ExecuteJavaScript(@"sessionStorage.setItem('key', 'value');", &error); 73 ExecuteJavaScript(@"sessionStorage.setItem('key', 'value');", &error);
70 GREYAssert(!error, @"Error during script execution: %@", error); 74 GREYAssert(!error, @"Error during script execution: %@", error);
71 75
72 TapWebViewElementWithId("webScenarioWindowOpenSameURLWithBlankTarget"); 76 TapWebViewElementWithId("webScenarioWindowOpenSameURLWithBlankTarget");
73 AssertMainTabCount(2); 77 AssertMainTabCount(2);
74 [[EarlGrey selectElementWithMatcher:WebViewContainingText("Expected result")] 78 [[EarlGrey selectElementWithMatcher:WebViewContainingText("Expected result")]
75 assertWithMatcher:grey_notNil()]; 79 assertWithMatcher:grey_notNil()];
76 80
77 id value = ExecuteJavaScript(@"sessionStorage.getItem('key');", &error); 81 id value = ExecuteJavaScript(@"sessionStorage.getItem('key');", &error);
78 GREYAssert(!error, @"Error during script execution: %@", error); 82 GREYAssert(!error, @"Error during script execution: %@", error);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 assertWithMatcher:grey_notNil()]; 186 assertWithMatcher:grey_notNil()];
183 } 187 }
184 188
185 // Tests that closing the current window using DOM fails. 189 // Tests that closing the current window using DOM fails.
186 - (void)testCloseWindowNotOpenByDOM { 190 - (void)testCloseWindowNotOpenByDOM {
187 TapWebViewElementWithId("webScenarioWindowClose"); 191 TapWebViewElementWithId("webScenarioWindowClose");
188 AssertMainTabCount(1); 192 AssertMainTabCount(1);
189 } 193 }
190 194
191 @end 195 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/web/visible_url_egtest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698