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

Side by Side Diff: ios/chrome/browser/net/metrics_network_client_unittest.mm

Issue 2517633002: [ObjC ARC] Converts ios/chrome/browser/net:unit_tests to ARC.Automatically generated ARCMigrate c… (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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ios/chrome/browser/net/metrics_network_client.h" 5 #include "ios/chrome/browser/net/metrics_network_client.h"
6 6
7 #include "base/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "base/test/histogram_tester.h" 8 #include "base/test/histogram_tester.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support."
14 #endif
15
12 // Dummy client to be registered as underlying client for the 16 // Dummy client to be registered as underlying client for the
13 // MetricsNetworkClient. 17 // MetricsNetworkClient.
14 @interface MetricsMockClient : CRNForwardingNetworkClient 18 @interface MetricsMockClient : CRNForwardingNetworkClient
15 @end 19 @end
16 20
17 @implementation MetricsMockClient 21 @implementation MetricsMockClient
18 22
19 - (void)didFailWithNSErrorCode:(NSInteger)nsErrorCode 23 - (void)didFailWithNSErrorCode:(NSInteger)nsErrorCode
20 netErrorCode:(int)netErrorCode { 24 netErrorCode:(int)netErrorCode {
21 } 25 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 netErrorCode:net_error]; 67 netErrorCode:net_error];
64 // |net_error| is negative, the histogram reports the opposite value. 68 // |net_error| is negative, the histogram reports the opposite value.
65 histogram_tester_.ExpectUniqueSample(kHistogramName, -net_error, 1); 69 histogram_tester_.ExpectUniqueSample(kHistogramName, -net_error, 1);
66 } 70 }
67 71
68 TEST_F(MetricsNetworkClientTest, HistogramUpdatedOnSuccess) { 72 TEST_F(MetricsNetworkClientTest, HistogramUpdatedOnSuccess) {
69 VerifyNoSamples(); 73 VerifyNoSamples();
70 [client_ didFinishLoading]; 74 [client_ didFinishLoading];
71 histogram_tester_.ExpectUniqueSample(kHistogramName, -net::OK, 1); 75 histogram_tester_.ExpectUniqueSample(kHistogramName, -net::OK, 1);
72 } 76 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/net/image_fetcher_unittest.mm ('k') | ios/chrome/browser/net/retryable_url_fetcher_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698