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

Unified Diff: components/cronet/ios/test/cronet_http_test.mm

Issue 2273403003: Moving gRPC support interfaces out of cronet and into a new component. (Closed)
Patch Set: Address comments Created 4 years, 2 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
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 4b3e7465b530f5373aab28c06d654fde0e48ebf8..b511cbd89d59910e2d221c6658c85b088880a674 100644
--- a/components/cronet/ios/test/cronet_http_test.mm
+++ b/components/cronet/ios/test/cronet_http_test.mm
@@ -10,8 +10,9 @@
#include "base/logging.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
-#include "components/cronet/ios/test/quic_test_server.h"
+#include "components/cronet/ios/test/start_cronet.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"
@@ -112,9 +113,6 @@ namespace cronet {
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() {}
@@ -132,12 +130,12 @@ class HttpTest : public ::testing::Test {
// Take a reference to the session and store it so it doesn't get
// deallocated until this object does.
session_.reset([session retain]);
- StartQuicTestServer();
+ grpc_support::StartQuicTestServer();
TestServer::Start();
}
void TearDown() override {
- ShutdownQuicTestServer();
+ grpc_support::ShutdownQuicTestServer();
TestServer::Shutdown();
}
@@ -155,21 +153,23 @@ class HttpTest : public ::testing::Test {
};
TEST_F(HttpTest, NSURLSessionReceivesData) {
- NSURL* url = net::NSURLWithGURL(GURL(kTestServerUrl));
+ NSURL* url = net::NSURLWithGURL(GURL(grpc_support::kTestServerUrl));
NSURLSessionDataTask* task = [session_ dataTaskWithURL:url];
StartDataTaskAndWaitForCompletion(task);
EXPECT_EQ(nil, [delegate_ error]);
- EXPECT_STREQ(kHelloBodyValue, [[delegate_ responseBody] UTF8String]);
+ EXPECT_STREQ(grpc_support::kHelloBodyValue,
+ base::SysNSStringToUTF8([delegate_ responseBody]));
}
TEST_F(HttpTest, GetGlobalMetricsDeltas) {
NSData* delta1 = [Cronet getGlobalMetricsDeltas];
- NSURL* url = net::NSURLWithGURL(GURL(kTestServerUrl));
+ NSURL* url = net::NSURLWithGURL(GURL(grpc_support::kTestServerUrl));
NSURLSessionDataTask* task = [session_ dataTaskWithURL:url];
StartDataTaskAndWaitForCompletion(task);
EXPECT_EQ(nil, [delegate_ error]);
- EXPECT_STREQ(kHelloBodyValue, [[delegate_ responseBody] UTF8String]);
+ EXPECT_STREQ(grpc_support::kHelloBodyValue,
+ base::SysNSStringToUTF8([delegate_ responseBody]));
NSData* delta2 = [Cronet getGlobalMetricsDeltas];
EXPECT_FALSE([delta2 isEqualToData:delta1]);
« no previous file with comments | « components/cronet/ios/test/cronet_bidirectional_stream_test.mm ('k') | components/cronet/ios/test/get_stream_engine.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698