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

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

Issue 2465303002: [cronet] make startNetLogToFile write to correct file (Closed)
Patch Set: Created 4 years, 1 month 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_netlog_test.mm
diff --git a/components/cronet/ios/test/cronet_netlog_test.mm b/components/cronet/ios/test/cronet_netlog_test.mm
new file mode 100644
index 0000000000000000000000000000000000000000..6e5ac63682f8d7b5769ef406e1e9d206b84b8728
--- /dev/null
+++ b/components/cronet/ios/test/cronet_netlog_test.mm
@@ -0,0 +1,51 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import <Cronet/Cronet.h>
+#import <Foundation/Foundation.h>
+
+#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/test_server.h"
+#include "net/base/mac/url_conversions.h"
+#include "net/base/net_errors.h"
+#include "net/cert/mock_cert_verifier.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/gtest_mac.h"
+
mef 2016/11/10 17:09:48 nit: no need for empty line.
lilyhoughton 2016/11/16 16:04:10 Done.
+#include "url/gurl.h"
+
+namespace cronet {
+
+void StartCronetIfNecessary();
+
+TEST(NetLogTest, OpenFile) {
+ StartCronetIfNecessary();
mef 2016/11/10 17:09:49 Not having to repeat boiler-plate code (StartCrone
lilyhoughton 2016/11/16 16:04:10 Done.
+
+ bool res = [Cronet startNetLogToFile:@"cronet_netlog.json" logBytes:YES];
+ [Cronet stopNetLog];
+
+ EXPECT_TRUE(res);
+}
+
+TEST(NetLogTest, NonExistantDir) {
+ StartCronetIfNecessary();
+
+ NSString* notdir = [[[NSProcessInfo processInfo] globallyUniqueString]
+ stringByAppendingString:@"/netlog.json"];
+ bool res = [Cronet startNetLogToFile:notdir logBytes:NO];
+
+ EXPECT_FALSE(res);
+}
+
+TEST(NetLogTest, EmptyFilename) {
+ StartCronetIfNecessary();
+
+ bool res = [Cronet startNetLogToFile:@"" logBytes:NO];
+
+ EXPECT_FALSE(res);
+}
+}
« components/cronet/ios/cronet_environment.cc ('K') | « components/cronet/ios/test/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698