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

Side by Side Diff: ios/web/public/test/http_server_inttest.mm

Issue 2128533002: Convert ScopedVector<T> to std::vector<std::unique_ptr<T>>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/public/test/http_server.mm ('k') | ios/web/public/test/http_server_util.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 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 #import <Foundation/Foundation.h> 5 #import <Foundation/Foundation.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #import "base/mac/scoped_nsobject.h" 10 #import "base/mac/scoped_nsobject.h"
(...skipping 12 matching lines...) Expand all
23 23
24 // Tests that a web::test::HttpServer can be started and can send and receive 24 // Tests that a web::test::HttpServer can be started and can send and receive
25 // requests and response from |TestResponseProvider|. 25 // requests and response from |TestResponseProvider|.
26 TEST_F(HttpServerTest, StartAndInterfaceWithResponseProvider) { 26 TEST_F(HttpServerTest, StartAndInterfaceWithResponseProvider) {
27 const std::string kHelloWorld = "Hello World"; 27 const std::string kHelloWorld = "Hello World";
28 std::unique_ptr<web::StringResponseProvider> provider( 28 std::unique_ptr<web::StringResponseProvider> provider(
29 new web::StringResponseProvider(kHelloWorld)); 29 new web::StringResponseProvider(kHelloWorld));
30 30
31 web::test::HttpServer& server = web::test::HttpServer::GetSharedInstance(); 31 web::test::HttpServer& server = web::test::HttpServer::GetSharedInstance();
32 ASSERT_TRUE(server.IsRunning()); 32 ASSERT_TRUE(server.IsRunning());
33 server.AddResponseProvider(provider.release()); 33 server.AddResponseProvider(std::move(provider));
34 34
35 __block base::scoped_nsobject<NSString> page_result; 35 __block base::scoped_nsobject<NSString> page_result;
36 id completion_handler = 36 id completion_handler =
37 ^(NSData* data, NSURLResponse* response, NSError* error) { 37 ^(NSData* data, NSURLResponse* response, NSError* error) {
38 page_result.reset([[NSString alloc] 38 page_result.reset([[NSString alloc]
39 initWithData:data encoding:NSUTF8StringEncoding]); 39 initWithData:data encoding:NSUTF8StringEncoding]);
40 }; 40 };
41 NSURL* url = net::NSURLWithGURL(server.MakeUrl("http://whatever")); 41 NSURL* url = net::NSURLWithGURL(server.MakeUrl("http://whatever"));
42 NSURLSessionDataTask* data_task = 42 NSURLSessionDataTask* data_task =
43 [[NSURLSession sharedSession] dataTaskWithURL:url 43 [[NSURLSession sharedSession] dataTaskWithURL:url
44 completionHandler:completion_handler]; 44 completionHandler:completion_handler];
45 [data_task resume]; 45 [data_task resume];
46 base::test::ios::WaitUntilCondition(^bool() { 46 base::test::ios::WaitUntilCondition(^bool() {
47 return page_result; 47 return page_result;
48 }); 48 });
49 EXPECT_NSEQ(page_result, base::SysUTF8ToNSString(kHelloWorld)); 49 EXPECT_NSEQ(page_result, base::SysUTF8ToNSString(kHelloWorld));
50 } 50 }
OLDNEW
« no previous file with comments | « ios/web/public/test/http_server.mm ('k') | ios/web/public/test/http_server_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698