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

Side by Side Diff: ios/web/net/web_http_protocol_handler_delegate_unittest.mm

Issue 1861593005: Convert //ios from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 years, 8 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/net/request_tracker_impl_unittest.mm ('k') | ios/web/public/app/web_main.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "ios/web/net/web_http_protocol_handler_delegate.h" 5 #include "ios/web/net/web_http_protocol_handler_delegate.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 8
9 #include <memory>
10
9 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/ptr_util.h"
12 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
13 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
14 #include "ios/web/public/test/scoped_testing_web_client.h" 16 #include "ios/web/public/test/scoped_testing_web_client.h"
15 #include "ios/web/public/web_client.h" 17 #include "ios/web/public/web_client.h"
16 #include "net/url_request/url_request_test_util.h" 18 #include "net/url_request/url_request_test_util.h"
17 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
18 #import "third_party/ocmock/OCMock/OCMock.h" 20 #import "third_party/ocmock/OCMock/OCMock.h"
19 21
20 namespace web { 22 namespace web {
21 23
(...skipping 22 matching lines...) Expand all
44 return url.SchemeIs(kAppSpecificScheme); 46 return url.SchemeIs(kAppSpecificScheme);
45 } 47 }
46 }; 48 };
47 49
48 class WebHTTPProtocolHandlerDelegateTest : public testing::Test { 50 class WebHTTPProtocolHandlerDelegateTest : public testing::Test {
49 public: 51 public:
50 WebHTTPProtocolHandlerDelegateTest() 52 WebHTTPProtocolHandlerDelegateTest()
51 : context_getter_(new net::TestURLRequestContextGetter( 53 : context_getter_(new net::TestURLRequestContextGetter(
52 base::ThreadTaskRunnerHandle::Get())), 54 base::ThreadTaskRunnerHandle::Get())),
53 delegate_(new WebHTTPProtocolHandlerDelegate(context_getter_.get())), 55 delegate_(new WebHTTPProtocolHandlerDelegate(context_getter_.get())),
54 web_client_(make_scoped_ptr(new AppSpecificURLTestWebClient)) {} 56 web_client_(base::WrapUnique(new AppSpecificURLTestWebClient)) {}
55 57
56 protected: 58 protected:
57 base::MessageLoop message_loop_; 59 base::MessageLoop message_loop_;
58 scoped_refptr<net::URLRequestContextGetter> context_getter_; 60 scoped_refptr<net::URLRequestContextGetter> context_getter_;
59 scoped_ptr<WebHTTPProtocolHandlerDelegate> delegate_; 61 std::unique_ptr<WebHTTPProtocolHandlerDelegate> delegate_;
60 web::ScopedTestingWebClient web_client_; 62 web::ScopedTestingWebClient web_client_;
61 }; 63 };
62 64
63 } // namespace 65 } // namespace
64 66
65 TEST_F(WebHTTPProtocolHandlerDelegateTest, IsRequestSupported) { 67 TEST_F(WebHTTPProtocolHandlerDelegateTest, IsRequestSupported) {
66 base::scoped_nsobject<NSMutableURLRequest> request; 68 base::scoped_nsobject<NSMutableURLRequest> request;
67 69
68 for (unsigned int i = 0; i < arraysize(kSupportedURLs); ++i) { 70 for (unsigned int i = 0; i < arraysize(kSupportedURLs); ++i) {
69 base::scoped_nsobject<NSString> url_string( 71 base::scoped_nsobject<NSString> url_string(
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Empty dictionary so User-Agent check fails. 152 // Empty dictionary so User-Agent check fails.
151 NSDictionary* headers = @{}; 153 NSDictionary* headers = @{};
152 NSURL* url = [NSURL URLWithString:@"file:///steal/this/file.html"]; 154 NSURL* url = [NSURL URLWithString:@"file:///steal/this/file.html"];
153 id mock_request = [OCMockObject mockForClass:[NSURLRequest class]]; 155 id mock_request = [OCMockObject mockForClass:[NSURLRequest class]];
154 [[[mock_request stub] andReturn:headers] allHTTPHeaderFields]; 156 [[[mock_request stub] andReturn:headers] allHTTPHeaderFields];
155 [[[mock_request stub] andReturn:url] URL]; 157 [[[mock_request stub] andReturn:url] URL];
156 EXPECT_FALSE(IsStaticFileRequest(mock_request)); 158 EXPECT_FALSE(IsStaticFileRequest(mock_request));
157 } 159 }
158 160
159 } // namespace web 161 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/net/request_tracker_impl_unittest.mm ('k') | ios/web/public/app/web_main.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698