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

Unified Diff: ios/web/net/web_http_protocol_handler_delegate_unittest.mm

Issue 2933383002: [ObjC ARC] Converts ios/web:ios_web_net_unittests to ARC. (Closed)
Patch Set: import -> include 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/net/request_tracker_impl_unittest.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/net/web_http_protocol_handler_delegate_unittest.mm
diff --git a/ios/web/net/web_http_protocol_handler_delegate_unittest.mm b/ios/web/net/web_http_protocol_handler_delegate_unittest.mm
index 0bb44c686ad3c54dfa5ba7964df79874340a38e4..251bc481b8b155ce223873f6fd345842d7d48a43 100644
--- a/ios/web/net/web_http_protocol_handler_delegate_unittest.mm
+++ b/ios/web/net/web_http_protocol_handler_delegate_unittest.mm
@@ -8,7 +8,6 @@
#include <memory>
-#import "base/mac/scoped_nsobject.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
@@ -19,6 +18,10 @@
#include "testing/gtest/include/gtest/gtest.h"
#import "third_party/ocmock/OCMock/OCMock.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
namespace web {
namespace {
@@ -65,57 +68,57 @@ class WebHTTPProtocolHandlerDelegateTest : public testing::Test {
} // namespace
TEST_F(WebHTTPProtocolHandlerDelegateTest, IsRequestSupported) {
- base::scoped_nsobject<NSMutableURLRequest> request;
+ NSMutableURLRequest* request;
for (unsigned int i = 0; i < arraysize(kSupportedURLs); ++i) {
- base::scoped_nsobject<NSString> url_string(
- [[NSString alloc] initWithUTF8String:kSupportedURLs[i]]);
- request.reset([[NSMutableURLRequest alloc]
- initWithURL:[NSURL URLWithString:url_string]]);
+ NSString* url_string =
+ [[NSString alloc] initWithUTF8String:kSupportedURLs[i]];
+ request = [[NSMutableURLRequest alloc]
+ initWithURL:[NSURL URLWithString:url_string]];
EXPECT_TRUE(delegate_->IsRequestSupported(request))
<< kSupportedURLs[i] << " should be supported.";
}
for (unsigned int i = 0; i < arraysize(kUnsupportedURLs); ++i) {
- base::scoped_nsobject<NSString> url_string(
- [[NSString alloc] initWithUTF8String:kUnsupportedURLs[i]]);
- request.reset([[NSMutableURLRequest alloc]
- initWithURL:[NSURL URLWithString:url_string]]);
+ NSString* url_string =
+ [[NSString alloc] initWithUTF8String:kUnsupportedURLs[i]];
+ request = [[NSMutableURLRequest alloc]
+ initWithURL:[NSURL URLWithString:url_string]];
EXPECT_FALSE(delegate_->IsRequestSupported(request))
<< kUnsupportedURLs[i] << " should NOT be supported.";
}
// Application specific scheme with main document URL.
- request.reset([[NSMutableURLRequest alloc]
- initWithURL:[NSURL URLWithString:@"appspecific:blank"]]);
+ request = [[NSMutableURLRequest alloc]
+ initWithURL:[NSURL URLWithString:@"appspecific:blank"]];
[request setMainDocumentURL:[NSURL URLWithString:@"http://foo"]];
EXPECT_FALSE(delegate_->IsRequestSupported(request));
[request setMainDocumentURL:[NSURL URLWithString:@"appspecific:main"]];
EXPECT_TRUE(delegate_->IsRequestSupported(request));
- request.reset([[NSMutableURLRequest alloc]
- initWithURL:[NSURL URLWithString:@"foo:blank"]]);
+ request = [[NSMutableURLRequest alloc]
+ initWithURL:[NSURL URLWithString:@"foo:blank"]];
[request setMainDocumentURL:[NSURL URLWithString:@"appspecific:main"]];
EXPECT_FALSE(delegate_->IsRequestSupported(request));
}
TEST_F(WebHTTPProtocolHandlerDelegateTest, IsRequestSupportedMalformed) {
- base::scoped_nsobject<NSURLRequest> request;
+ NSURLRequest* request;
// Null URL.
- request.reset([[NSMutableURLRequest alloc] init]);
+ request = [[NSMutableURLRequest alloc] init];
ASSERT_FALSE([request URL]);
EXPECT_FALSE(delegate_->IsRequestSupported(request));
// URL with no scheme.
- request.reset(
- [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"foo"]]);
+ request =
+ [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"foo"]];
ASSERT_TRUE([request URL]);
ASSERT_FALSE([[request URL] scheme]);
EXPECT_FALSE(delegate_->IsRequestSupported(request));
// Empty scheme.
- request.reset(
- [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@":foo"]]);
+ request =
+ [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@":foo"]];
ASSERT_TRUE([request URL]);
ASSERT_TRUE([[request URL] scheme]);
ASSERT_FALSE([[[request URL] scheme] length]);
« no previous file with comments | « ios/web/net/request_tracker_impl_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698