Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import <Cronet/Cronet.h> | |
| 6 #import <Foundation/Foundation.h> | |
| 7 | |
| 8 #include "base/logging.h" | |
| 9 #include "base/mac/scoped_nsobject.h" | |
| 10 #include "base/strings/sys_string_conversions.h" | |
| 11 #include "components/cronet/ios/test/quic_test_server.h" | |
| 12 #include "components/cronet/ios/test/test_server.h" | |
| 13 #include "net/base/mac/url_conversions.h" | |
| 14 #include "net/base/net_errors.h" | |
| 15 #include "net/cert/mock_cert_verifier.h" | |
| 16 #include "testing/gtest/include/gtest/gtest.h" | |
| 17 #include "testing/gtest_mac.h" | |
| 18 | |
|
mef
2016/11/10 17:09:48
nit: no need for empty line.
lilyhoughton
2016/11/16 16:04:10
Done.
| |
| 19 #include "url/gurl.h" | |
| 20 | |
| 21 namespace cronet { | |
| 22 | |
| 23 void StartCronetIfNecessary(); | |
| 24 | |
| 25 TEST(NetLogTest, OpenFile) { | |
| 26 StartCronetIfNecessary(); | |
|
mef
2016/11/10 17:09:49
Not having to repeat boiler-plate code (StartCrone
lilyhoughton
2016/11/16 16:04:10
Done.
| |
| 27 | |
| 28 bool res = [Cronet startNetLogToFile:@"cronet_netlog.json" logBytes:YES]; | |
| 29 [Cronet stopNetLog]; | |
| 30 | |
| 31 EXPECT_TRUE(res); | |
| 32 } | |
| 33 | |
| 34 TEST(NetLogTest, NonExistantDir) { | |
| 35 StartCronetIfNecessary(); | |
| 36 | |
| 37 NSString* notdir = [[[NSProcessInfo processInfo] globallyUniqueString] | |
| 38 stringByAppendingString:@"/netlog.json"]; | |
| 39 bool res = [Cronet startNetLogToFile:notdir logBytes:NO]; | |
| 40 | |
| 41 EXPECT_FALSE(res); | |
| 42 } | |
| 43 | |
| 44 TEST(NetLogTest, EmptyFilename) { | |
| 45 StartCronetIfNecessary(); | |
| 46 | |
| 47 bool res = [Cronet startNetLogToFile:@"" logBytes:NO]; | |
| 48 | |
| 49 EXPECT_FALSE(res); | |
| 50 } | |
| 51 } | |
| OLD | NEW |