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

Unified Diff: ios/chrome/browser/metrics/size_class_recorder_unittest.mm

Issue 2894653002: [ObjC ARC] Converts ios/chrome/browser/metrics:unit_tests_internal to ARC. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « ios/chrome/browser/metrics/BUILD.gn ('k') | ios/chrome/browser/metrics/tab_usage_recorder_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/metrics/size_class_recorder_unittest.mm
diff --git a/ios/chrome/browser/metrics/size_class_recorder_unittest.mm b/ios/chrome/browser/metrics/size_class_recorder_unittest.mm
index 238e13a6b97d49a4a4df6a498a81538e041a5250..2709ad2f860ec031021f18e86f6686ee7a438275 100644
--- a/ios/chrome/browser/metrics/size_class_recorder_unittest.mm
+++ b/ios/chrome/browser/metrics/size_class_recorder_unittest.mm
@@ -7,12 +7,15 @@
#include <memory>
-#import "base/mac/scoped_nsobject.h"
#include "base/test/histogram_tester.h"
#import "ios/chrome/browser/ui/ui_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
using ios_internal::SizeClassForReporting;
using ios_internal::SizeClassForReportingForUIUserInterfaceSizeClass;
@@ -30,7 +33,7 @@ class SizeClassRecorderTest : public PlatformTest {
histogram_tester_.reset(new base::HistogramTester());
}
- base::scoped_nsobject<SizeClassRecorder> recorder_;
+ SizeClassRecorder* recorder_;
std::unique_ptr<base::HistogramTester> histogram_tester_;
};
@@ -39,9 +42,9 @@ TEST_F(SizeClassRecorderTest, Initialization_SizeClassUnspecified) {
if (!IsIPadIdiom())
return;
- recorder_.reset([[SizeClassRecorder alloc]
- initWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified]);
- recorder_.reset();
+ recorder_ = [[SizeClassRecorder alloc]
+ initWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified];
+ recorder_ = nil;
histogram_tester_->ExpectTotalCount(kSizeClassUsedHistogramName, 0);
histogram_tester_->ExpectTotalCount(kPageLoadSizeClassHistogramName, 0);
@@ -52,9 +55,9 @@ TEST_F(SizeClassRecorderTest, Initialization_SizeClassCompact) {
if (!IsIPadIdiom())
return;
- recorder_.reset([[SizeClassRecorder alloc]
- initWithHorizontalSizeClass:UIUserInterfaceSizeClassCompact]);
- recorder_.reset();
+ recorder_ = [[SizeClassRecorder alloc]
+ initWithHorizontalSizeClass:UIUserInterfaceSizeClassCompact];
+ recorder_ = nil;
histogram_tester_->ExpectTotalCount(kSizeClassUsedHistogramName, 0);
histogram_tester_->ExpectTotalCount(kPageLoadSizeClassHistogramName, 0);
@@ -65,9 +68,9 @@ TEST_F(SizeClassRecorderTest, Initialization_SizeClassRegular) {
if (!IsIPadIdiom())
return;
- recorder_.reset([[SizeClassRecorder alloc]
- initWithHorizontalSizeClass:UIUserInterfaceSizeClassRegular]);
- recorder_.reset();
+ recorder_ = [[SizeClassRecorder alloc]
+ initWithHorizontalSizeClass:UIUserInterfaceSizeClassRegular];
+ recorder_ = nil;
histogram_tester_->ExpectTotalCount(kSizeClassUsedHistogramName, 0);
histogram_tester_->ExpectTotalCount(kPageLoadSizeClassHistogramName, 0);
@@ -78,8 +81,8 @@ TEST_F(SizeClassRecorderTest, RecordInitialSizeClassOnAppBecomeActive) {
if (!IsIPadIdiom())
return;
- recorder_.reset([[SizeClassRecorder alloc]
- initWithHorizontalSizeClass:UIUserInterfaceSizeClassCompact]);
+ recorder_ = [[SizeClassRecorder alloc]
+ initWithHorizontalSizeClass:UIUserInterfaceSizeClassCompact];
[[NSNotificationCenter defaultCenter]
postNotificationName:UIApplicationDidBecomeActiveNotification
object:nil];
@@ -95,8 +98,8 @@ TEST_F(SizeClassRecorderTest,
if (!IsIPadIdiom())
return;
- recorder_.reset([[SizeClassRecorder alloc]
- initWithHorizontalSizeClass:UIUserInterfaceSizeClassCompact]);
+ recorder_ = [[SizeClassRecorder alloc]
+ initWithHorizontalSizeClass:UIUserInterfaceSizeClassCompact];
[[NSNotificationCenter defaultCenter]
postNotificationName:UIApplicationDidBecomeActiveNotification
object:nil];
@@ -114,8 +117,8 @@ TEST_F(SizeClassRecorderTest, RecordSizeClassChangeInForeground) {
if (!IsIPadIdiom())
return;
- recorder_.reset([[SizeClassRecorder alloc]
- initWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified]);
+ recorder_ = [[SizeClassRecorder alloc]
+ initWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified];
[recorder_ horizontalSizeClassDidChange:UIUserInterfaceSizeClassRegular];
histogram_tester_->ExpectUniqueSample(kSizeClassUsedHistogramName,
@@ -128,8 +131,8 @@ TEST_F(SizeClassRecorderTest, DontRecordSizeClassChangeInBackground) {
if (!IsIPadIdiom())
return;
- recorder_.reset([[SizeClassRecorder alloc]
- initWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified]);
+ recorder_ = [[SizeClassRecorder alloc]
+ initWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified];
[[NSNotificationCenter defaultCenter]
postNotificationName:UIApplicationDidEnterBackgroundNotification
object:nil];
@@ -145,8 +148,8 @@ TEST_F(SizeClassRecorderTest,
if (!IsIPadIdiom())
return;
- recorder_.reset([[SizeClassRecorder alloc]
- initWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified]);
+ recorder_ = [[SizeClassRecorder alloc]
+ initWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified];
[[NSNotificationCenter defaultCenter]
postNotificationName:UIApplicationDidEnterBackgroundNotification
object:nil];
@@ -165,8 +168,8 @@ TEST_F(SizeClassRecorderTest, RecordSizeClassOnPageLoaded_Unspecified) {
if (!IsIPadIdiom())
return;
- recorder_.reset([[SizeClassRecorder alloc]
- initWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified]);
+ recorder_ = [[SizeClassRecorder alloc]
+ initWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified];
[recorder_
pageLoadedWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified];
@@ -180,8 +183,8 @@ TEST_F(SizeClassRecorderTest, RecordSizeClassOnPageLoaded_Compact) {
if (!IsIPadIdiom())
return;
- recorder_.reset([[SizeClassRecorder alloc]
- initWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified]);
+ recorder_ = [[SizeClassRecorder alloc]
+ initWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified];
[recorder_ pageLoadedWithHorizontalSizeClass:UIUserInterfaceSizeClassCompact];
histogram_tester_->ExpectTotalCount(kSizeClassUsedHistogramName, 0);
@@ -194,8 +197,8 @@ TEST_F(SizeClassRecorderTest, RecordSizeClassOnPageLoaded_Regular) {
if (!IsIPadIdiom())
return;
- recorder_.reset([[SizeClassRecorder alloc]
- initWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified]);
+ recorder_ = [[SizeClassRecorder alloc]
+ initWithHorizontalSizeClass:UIUserInterfaceSizeClassUnspecified];
[recorder_ pageLoadedWithHorizontalSizeClass:UIUserInterfaceSizeClassRegular];
histogram_tester_->ExpectTotalCount(kSizeClassUsedHistogramName, 0);
« no previous file with comments | « ios/chrome/browser/metrics/BUILD.gn ('k') | ios/chrome/browser/metrics/tab_usage_recorder_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698