| Index: components/cronet/ios/test/cronet_http_test.mm
|
| diff --git a/components/cronet/ios/test/cronet_http_test.mm b/components/cronet/ios/test/cronet_http_test.mm
|
| index 89e64a2422d9b01f83fcc0154ca2b68784ad1062..4b3e7465b530f5373aab28c06d654fde0e48ebf8 100644
|
| --- a/components/cronet/ios/test/cronet_http_test.mm
|
| +++ b/components/cronet/ios/test/cronet_http_test.mm
|
| @@ -10,9 +10,8 @@
|
| #include "base/logging.h"
|
| #include "base/mac/scoped_nsobject.h"
|
| #include "base/strings/sys_string_conversions.h"
|
| -#include "components/cronet/ios/test/start_cronet.h"
|
| +#include "components/cronet/ios/test/quic_test_server.h"
|
| #include "components/cronet/ios/test/test_server.h"
|
| -#include "components/grpc_support/test/quic_test_server.h"
|
| #include "net/base/mac/url_conversions.h"
|
| #include "net/base/net_errors.h"
|
| #include "net/cert/mock_cert_verifier.h"
|
| @@ -113,16 +112,16 @@
|
| static const int64_t ns_in_second = 1000000000LL;
|
| const char kUserAgent[] = "CronetTest/1.0.0.0";
|
|
|
| +// TODO(mef): Create common header file to declare this.
|
| +void StartCronetIfNecessary();
|
| +
|
| class HttpTest : public ::testing::Test {
|
| protected:
|
| HttpTest() {}
|
| ~HttpTest() override {}
|
|
|
| void SetUp() override {
|
| - grpc_support::StartQuicTestServer();
|
| - TestServer::Start();
|
| -
|
| - StartCronetIfNecessary(grpc_support::GetQuicTestServerPort());
|
| + StartCronetIfNecessary();
|
| NSURLSessionConfiguration* config =
|
| [NSURLSessionConfiguration ephemeralSessionConfiguration];
|
| [Cronet installIntoSessionConfiguration:config];
|
| @@ -133,10 +132,12 @@
|
| // Take a reference to the session and store it so it doesn't get
|
| // deallocated until this object does.
|
| session_.reset([session retain]);
|
| + StartQuicTestServer();
|
| + TestServer::Start();
|
| }
|
|
|
| void TearDown() override {
|
| - grpc_support::ShutdownQuicTestServer();
|
| + ShutdownQuicTestServer();
|
| TestServer::Shutdown();
|
| }
|
|
|
| @@ -154,23 +155,21 @@
|
| };
|
|
|
| TEST_F(HttpTest, NSURLSessionReceivesData) {
|
| - NSURL* url = net::NSURLWithGURL(GURL(grpc_support::kTestServerUrl));
|
| - NSURLSessionDataTask* task = [session_ dataTaskWithURL:url];
|
| - StartDataTaskAndWaitForCompletion(task);
|
| - EXPECT_EQ(nil, [delegate_ error]);
|
| - EXPECT_STREQ(grpc_support::kHelloBodyValue,
|
| - base::SysNSStringToUTF8([delegate_ responseBody]).c_str());
|
| + NSURL* url = net::NSURLWithGURL(GURL(kTestServerUrl));
|
| + NSURLSessionDataTask* task = [session_ dataTaskWithURL:url];
|
| + StartDataTaskAndWaitForCompletion(task);
|
| + EXPECT_EQ(nil, [delegate_ error]);
|
| + EXPECT_STREQ(kHelloBodyValue, [[delegate_ responseBody] UTF8String]);
|
| }
|
|
|
| TEST_F(HttpTest, GetGlobalMetricsDeltas) {
|
| NSData* delta1 = [Cronet getGlobalMetricsDeltas];
|
|
|
| - NSURL* url = net::NSURLWithGURL(GURL(grpc_support::kTestServerUrl));
|
| - NSURLSessionDataTask* task = [session_ dataTaskWithURL:url];
|
| - StartDataTaskAndWaitForCompletion(task);
|
| - EXPECT_EQ(nil, [delegate_ error]);
|
| - EXPECT_STREQ(grpc_support::kHelloBodyValue,
|
| - base::SysNSStringToUTF8([delegate_ responseBody]).c_str());
|
| + NSURL* url = net::NSURLWithGURL(GURL(kTestServerUrl));
|
| + NSURLSessionDataTask* task = [session_ dataTaskWithURL:url];
|
| + StartDataTaskAndWaitForCompletion(task);
|
| + EXPECT_EQ(nil, [delegate_ error]);
|
| + EXPECT_STREQ(kHelloBodyValue, [[delegate_ responseBody] UTF8String]);
|
|
|
| NSData* delta2 = [Cronet getGlobalMetricsDeltas];
|
| EXPECT_FALSE([delta2 isEqualToData:delta1]);
|
|
|