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" | |
|
mef
2016/11/17 15:58:48
IWYU - remove unused includes.
lilyhoughton
2016/11/22 20:48:42
Done.
| |
| 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 #include "url/gurl.h" | |
| 19 | |
| 20 namespace cronet { | |
| 21 | |
| 22 void StartCronetIfNecessary(); | |
| 23 | |
| 24 class NetLogTest : public ::testing::Test { | |
| 25 protected: | |
| 26 NetLogTest() {} | |
| 27 ~NetLogTest() override {} | |
| 28 | |
| 29 void SetUp() override { StartCronetIfNecessary(); } | |
| 30 }; | |
| 31 | |
| 32 TEST(NetLogTest, OpenFile) { | |
| 33 bool netlog_started = | |
| 34 [Cronet startNetLogToFile:@"cronet_netlog.json" logBytes:YES]; | |
| 35 [Cronet stopNetLog]; | |
| 36 | |
| 37 EXPECT_TRUE(netlog_started); | |
|
kapishnikov
2016/11/18 22:17:27
Can we check that the file was created? The file n
lilyhoughton
2016/12/02 16:30:07
Done.
| |
| 38 } | |
| 39 | |
| 40 TEST(NetLogTest, NonExistantDir) { | |
| 41 NSString* notdir = [[[NSProcessInfo processInfo] globallyUniqueString] | |
| 42 stringByAppendingString:@"/netlog.json"]; | |
| 43 bool netlog_started = [Cronet startNetLogToFile:notdir logBytes:NO]; | |
| 44 | |
| 45 EXPECT_FALSE(netlog_started); | |
| 46 } | |
| 47 | |
| 48 TEST(NetLogTest, EmptyFilename) { | |
| 49 bool netlog_started = [Cronet startNetLogToFile:@"" logBytes:NO]; | |
| 50 | |
| 51 EXPECT_FALSE(netlog_started); | |
| 52 } | |
| 53 } | |
| OLD | NEW |