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

Side by Side Diff: ios/web/browser_state_web_view_partition_inttest.mm

Issue 2935023002: Revert of [ObjC ARC] Converts ios/web:ios_web_inttests to ARC. (Closed)
Patch Set: Created 3 years, 6 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/web/BUILD.gn ('k') | ios/web/web_state/navigation_callbacks_inttest.mm » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <WebKit/WebKit.h> 5 #import <WebKit/WebKit.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 id result = web::ExecuteJavaScript(web_view, @"document.cookie"); 81 id result = web::ExecuteJavaScript(web_view, @"document.cookie");
82 return base::mac::ObjCCastStrict<NSString>(result); 82 return base::mac::ObjCCastStrict<NSString>(result);
83 } 83 }
84 84
85 // Sets a localstorage key, value pair on |web_view|. 85 // Sets a localstorage key, value pair on |web_view|.
86 void SetLocalStorageItem(NSString* key, 86 void SetLocalStorageItem(NSString* key,
87 NSString* value, 87 NSString* value,
88 WKWebView* web_view) { 88 WKWebView* web_view) {
89 NSString* set_local_storage_item = [NSString 89 NSString* set_local_storage_item = [NSString
90 stringWithFormat:@"localStorage.setItem('%@', '%@')", key, value]; 90 stringWithFormat:@"localStorage.setItem('%@', '%@')", key, value];
91 __unsafe_unretained NSError* unused_error = nil; 91 NSError* unused_error = nil;
92 web::ExecuteJavaScript(web_view, set_local_storage_item, &unused_error); 92 web::ExecuteJavaScript(web_view, set_local_storage_item, &unused_error);
93 } 93 }
94 94
95 // Returns the localstorage value associated with |key| from |web_view|. 95 // Returns the localstorage value associated with |key| from |web_view|.
96 id GetLocalStorageItem(NSString* key, WKWebView* web_view) { 96 id GetLocalStorageItem(NSString* key, WKWebView* web_view) {
97 NSString* get_local_storage_value = 97 NSString* get_local_storage_value =
98 [NSString stringWithFormat:@"localStorage.getItem('%@');", key]; 98 [NSString stringWithFormat:@"localStorage.getItem('%@');", key];
99 return web::ExecuteJavaScript(web_view, get_local_storage_value); 99 return web::ExecuteJavaScript(web_view, get_local_storage_value);
100 } 100 }
101 101
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 SetLocalStorageItem(@"someKey2", @"someValue2", web_view_2); 174 SetLocalStorageItem(@"someKey2", @"someValue2", web_view_2);
175 // Due to platform limitation, it's not possible to actually set localStorage 175 // Due to platform limitation, it's not possible to actually set localStorage
176 // item on an OTR BrowserState. Therefore, it's not possible to verify that a 176 // item on an OTR BrowserState. Therefore, it's not possible to verify that a
177 // localStorage item has been correctly set. 177 // localStorage item has been correctly set.
178 // Look at 178 // Look at
179 // http://stackoverflow.com/questions/14555347/html5-localstorage-error-with-s afari-quota-exceeded-err-dom-exception-22-an 179 // http://stackoverflow.com/questions/14555347/html5-localstorage-error-with-s afari-quota-exceeded-err-dom-exception-22-an
180 // for more details. 180 // for more details.
181 // Test that LocalStorage has not leaked over to |web_view_1|. 181 // Test that LocalStorage has not leaked over to |web_view_1|.
182 EXPECT_NSEQ([NSNull null], GetLocalStorageItem(@"someKey2", web_view_1)); 182 EXPECT_NSEQ([NSNull null], GetLocalStorageItem(@"someKey2", web_view_1));
183 } 183 }
OLDNEW
« no previous file with comments | « ios/web/BUILD.gn ('k') | ios/web/web_state/navigation_callbacks_inttest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698