| Index: ios/chrome/browser/ui/omnibox_perftest.mm
|
| diff --git a/ios/chrome/browser/ui/omnibox_perftest.mm b/ios/chrome/browser/ui/omnibox_perftest.mm
|
| index cff7b6c6e54703bf729b30d4cb55353ca350c2cf..1c10b646a74ec00a377ac883117d29d80ffe74b1 100644
|
| --- a/ios/chrome/browser/ui/omnibox_perftest.mm
|
| +++ b/ios/chrome/browser/ui/omnibox_perftest.mm
|
| @@ -6,7 +6,6 @@
|
|
|
| #include <memory>
|
|
|
| -#include "base/mac/scoped_nsobject.h"
|
| #include "base/memory/ptr_util.h"
|
| #import "base/test/ios/wait_util.h"
|
| #include "base/time/time.h"
|
| @@ -26,6 +25,10 @@
|
| #import "third_party/ocmock/OCMock/OCMock.h"
|
| #import "ui/base/test/ios/keyboard_appearance_listener.h"
|
|
|
| +#if !defined(__has_feature) || !__has_feature(objc_arc)
|
| +#error "This file requires ARC support."
|
| +#endif
|
| +
|
| namespace {
|
|
|
| // Descends down a view hierarchy until the first view of |specificClass|
|
| @@ -65,11 +68,11 @@ class OmniboxPerfTest : public PerfTest {
|
| chrome_browser_state_.get());
|
|
|
| // Sets up the listener for keyboard activation/deactivation notifications.
|
| - keyboard_listener_.reset([[KeyboardAppearanceListener alloc] init]);
|
| + keyboard_listener_ = [[KeyboardAppearanceListener alloc] init];
|
|
|
| // Create a real window to host the Toolbar.
|
| CGRect screenBounds = [[UIScreen mainScreen] bounds];
|
| - window_.reset([[UIWindow alloc] initWithFrame:screenBounds]);
|
| + window_ = [[UIWindow alloc] initWithFrame:screenBounds];
|
| [window_ makeKeyAndVisible];
|
|
|
| // Create a WebStateList that will always return the test WebState as
|
| @@ -93,11 +96,11 @@ class OmniboxPerfTest : public PerfTest {
|
| [[[webToolbarDelegate stub] andReturnValue:OCMOCK_VALUE(model_for_mock)]
|
| toolbarModelIOS];
|
| id urlLoader = [OCMockObject niceMockForProtocol:@protocol(UrlLoader)];
|
| - toolbar_.reset([[WebToolbarController alloc]
|
| + toolbar_ = [[WebToolbarController alloc]
|
| initWithDelegate:webToolbarDelegate
|
| urlLoader:urlLoader
|
| browserState:chrome_browser_state_.get()
|
| - preloadProvider:nil]);
|
| + preloadProvider:nil];
|
| UIView* toolbarView = [toolbar_ view];
|
| CGRect toolbarFrame = toolbarView.frame;
|
| toolbarFrame.origin = CGPointZero;
|
| @@ -106,7 +109,7 @@ class OmniboxPerfTest : public PerfTest {
|
| // Add toolbar to window.
|
| [window_ addSubview:toolbarView];
|
| base::test::ios::WaitUntilCondition(^bool() {
|
| - return IsToolbarLoaded(window_.get());
|
| + return IsToolbarLoaded(window_);
|
| });
|
| }
|
|
|
| @@ -114,7 +117,7 @@ class OmniboxPerfTest : public PerfTest {
|
| // Remove toolbar from window.
|
| [[toolbar_ view] removeFromSuperview];
|
| base::test::ios::WaitUntilCondition(^bool() {
|
| - return !IsToolbarLoaded(window_.get());
|
| + return !IsToolbarLoaded(window_);
|
| });
|
| [toolbar_ browserStateDestroyed];
|
| PerfTest::TearDown();
|
| @@ -148,8 +151,8 @@ class OmniboxPerfTest : public PerfTest {
|
| // Omnibox focus timings. Call this function to preload keyboard before
|
| // doing the real test.
|
| base::TimeDelta PreLoadKeyboard() {
|
| - base::scoped_nsobject<UITextField> textField(
|
| - [[UITextField alloc] initWithFrame:CGRectMake(20, 100, 280, 29)]);
|
| + UITextField* textField =
|
| + [[UITextField alloc] initWithFrame:CGRectMake(20, 100, 280, 29)];
|
| [textField setBorderStyle:UITextBorderStyleRoundedRect];
|
| [window_ addSubview:textField];
|
| base::TimeDelta elapsed = base::test::ios::TimeUntilCondition(
|
| @@ -205,9 +208,9 @@ class OmniboxPerfTest : public PerfTest {
|
| std::unique_ptr<WebStateList> web_state_list_;
|
| std::unique_ptr<ToolbarModelDelegateIOS> toolbar_model_delegate_;
|
| std::unique_ptr<ToolbarModelIOS> toolbar_model_ios_;
|
| - base::scoped_nsobject<WebToolbarController> toolbar_;
|
| - base::scoped_nsobject<UIWindow> window_;
|
| - base::scoped_nsobject<KeyboardAppearanceListener> keyboard_listener_;
|
| + WebToolbarController* toolbar_;
|
| + UIWindow* window_;
|
| + KeyboardAppearanceListener* keyboard_listener_;
|
| };
|
|
|
| // Measures the amount of time it takes the Omnibox text field to activate
|
|
|