Commit 13d8b0a4 authored by gambard's avatar gambard Committed by Commit bot

[ObjC ARC] Converts ios/chrome/browser/ui/toolbar:unit_tests to ARC.

Automatically generated ARCMigrate commit
Notable issues:None
BUG=624363
TEST=None

Review-Url: https://codereview.chromium.org/2835413003
Cr-Commit-Position: refs/heads/master@{#467703}
parent eacfd594
...@@ -152,6 +152,7 @@ source_set("test_support") { ...@@ -152,6 +152,7 @@ source_set("test_support") {
} }
source_set("unit_tests") { source_set("unit_tests") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true testonly = true
sources = [ sources = [
"toolbar_controller_unittest.mm", "toolbar_controller_unittest.mm",
......
...@@ -5,13 +5,16 @@ ...@@ -5,13 +5,16 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include "base/format_macros.h" #include "base/format_macros.h"
#include "base/mac/scoped_nsobject.h"
#import "ios/chrome/browser/ui/toolbar/toolbar_controller.h" #import "ios/chrome/browser/ui/toolbar/toolbar_controller.h"
#import "ios/chrome/browser/ui/toolbar/toolbar_controller_private.h" #import "ios/chrome/browser/ui/toolbar/toolbar_controller_private.h"
#import "ios/chrome/browser/ui/ui_util.h" #import "ios/chrome/browser/ui/ui_util.h"
#include "testing/gtest_mac.h" #include "testing/gtest_mac.h"
#include "testing/platform_test.h" #include "testing/platform_test.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
// A constant holding some number of tabs that will trigger an easter egg. // A constant holding some number of tabs that will trigger an easter egg.
const NSInteger kStackButtonEasterEggTabCount = kStackButtonMaxTabCount + 1; const NSInteger kStackButtonEasterEggTabCount = kStackButtonMaxTabCount + 1;
...@@ -31,11 +34,12 @@ namespace { ...@@ -31,11 +34,12 @@ namespace {
class ToolbarControllerTest : public PlatformTest { class ToolbarControllerTest : public PlatformTest {
protected: protected:
void SetUp() override { void SetUp() override {
toolbarController_.reset([[ToolbarController alloc] PlatformTest::SetUp();
initWithStyle:ToolbarControllerStyleLightMode]); toolbarController_ = [[ToolbarController alloc]
initWithStyle:ToolbarControllerStyleLightMode];
} }
base::scoped_nsobject<ToolbarController> toolbarController_; ToolbarController* toolbarController_;
}; };
// Verify that if tab count is set to zero, the title is blank, but the a11y // Verify that if tab count is set to zero, the title is blank, but the a11y
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <memory> #include <memory>
#include "base/mac/scoped_nsobject.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
...@@ -31,6 +30,10 @@ ...@@ -31,6 +30,10 @@
#include "third_party/ocmock/gtest_support.h" #include "third_party/ocmock/gtest_support.h"
#include "third_party/ocmock/ocmock_extensions.h" #include "third_party/ocmock/ocmock_extensions.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace { namespace {
static const char kWebUrl[] = "http://www.chromium.org"; static const char kWebUrl[] = "http://www.chromium.org";
...@@ -39,6 +42,7 @@ static const char kNativeUrl[] = "chrome://version"; ...@@ -39,6 +42,7 @@ static const char kNativeUrl[] = "chrome://version";
class ToolbarModelImplIOSTest : public PlatformTest { class ToolbarModelImplIOSTest : public PlatformTest {
protected: protected:
void SetUp() override { void SetUp() override {
PlatformTest::SetUp();
TestChromeBrowserState::Builder test_cbs_builder; TestChromeBrowserState::Builder test_cbs_builder;
chrome_browser_state_ = test_cbs_builder.Build(); chrome_browser_state_ = test_cbs_builder.Build();
chrome_browser_state_->CreateBookmarkModel(true); chrome_browser_state_->CreateBookmarkModel(true);
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <memory> #include <memory>
#include "base/ios/ios_util.h" #include "base/ios/ios_util.h"
#include "base/mac/scoped_nsobject.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
...@@ -22,6 +21,10 @@ ...@@ -22,6 +21,10 @@
#include "testing/gtest_mac.h" #include "testing/gtest_mac.h"
#import "third_party/ocmock/OCMock/OCMock.h" #import "third_party/ocmock/OCMock/OCMock.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@interface UIView (SubViewTesting) @interface UIView (SubViewTesting)
- (NSMutableArray*)allSubviews; - (NSMutableArray*)allSubviews;
@end @end
...@@ -69,15 +72,15 @@ class WebToolbarControllerTest : public BlockCleanupTest { ...@@ -69,15 +72,15 @@ class WebToolbarControllerTest : public BlockCleanupTest {
id urlLoader = [OCMockObject niceMockForProtocol:@protocol(UrlLoader)]; id urlLoader = [OCMockObject niceMockForProtocol:@protocol(UrlLoader)];
// Create the WebToolbarController using the test objects. // Create the WebToolbarController using the test objects.
web_toolbar_controller_.reset([[WebToolbarController alloc] web_toolbar_controller_ = [[WebToolbarController alloc]
initWithDelegate:delegate initWithDelegate:delegate
urlLoader:urlLoader urlLoader:urlLoader
browserState:chrome_browser_state_.get() browserState:chrome_browser_state_.get()
preloadProvider:nil]); preloadProvider:nil];
[web_toolbar_controller_ setUnitTesting:YES]; [web_toolbar_controller_ setUnitTesting:YES];
} }
void TearDown() override { void TearDown() override {
web_toolbar_controller_.reset(); web_toolbar_controller_ = nil;
BlockCleanupTest::TearDown(); BlockCleanupTest::TearDown();
} }
...@@ -85,7 +88,7 @@ class WebToolbarControllerTest : public BlockCleanupTest { ...@@ -85,7 +88,7 @@ class WebToolbarControllerTest : public BlockCleanupTest {
std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; std::unique_ptr<TestChromeBrowserState> chrome_browser_state_;
TestToolbarModel* toolbar_model_; // weak. Owned by toolbar_model_ios_. TestToolbarModel* toolbar_model_; // weak. Owned by toolbar_model_ios_.
std::unique_ptr<TestToolbarModelIOS> toolbar_model_ios_; std::unique_ptr<TestToolbarModelIOS> toolbar_model_ios_;
base::scoped_nsobject<WebToolbarController> web_toolbar_controller_; WebToolbarController* web_toolbar_controller_;
}; };
TEST_F(WebToolbarControllerTest, TestUpdateToolbar_NavigationButtonsEnabled) { TEST_F(WebToolbarControllerTest, TestUpdateToolbar_NavigationButtonsEnabled) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment