Commit ada7cc03 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Ensure autorelease pool is drained between tests

The testing::Test fixture (used by TEST macro) does not drain the
autorelease pool after a test. PlatformTest should be used.

Bug: none
Change-Id: I7b33f0c53bc57fb8f2266bc58eb578d71da642b4
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Reviewed-on: https://chromium-review.googlesource.com/940132
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539798}
parent 7e30720e
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "ios/chrome/browser/passwords/test_helpers.h" #include "ios/chrome/browser/passwords/test_helpers.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
using autofill::PasswordFormFillData; using autofill::PasswordFormFillData;
using password_manager::AccountSelectFillData; using password_manager::AccountSelectFillData;
...@@ -27,7 +28,7 @@ const char* kPasswords[] = {"password0", "secret"}; ...@@ -27,7 +28,7 @@ const char* kPasswords[] = {"password0", "secret"};
const char* kAdditionalUsernames[] = {"u$er2", nullptr}; const char* kAdditionalUsernames[] = {"u$er2", nullptr};
const char* kAdditionalPasswords[] = {"secret", nullptr}; const char* kAdditionalPasswords[] = {"secret", nullptr};
class AccountSelectFillDataTest : public testing::Test { class AccountSelectFillDataTest : public PlatformTest {
public: public:
AccountSelectFillDataTest() { AccountSelectFillDataTest() {
for (size_t i = 0; i < arraysize(form_data_); ++i) { for (size_t i = 0; i < arraysize(form_data_); ++i) {
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "components/autofill/core/common/password_form.h" #include "components/autofill/core/common/password_form.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#include "url/gurl.h" #include "url/gurl.h"
using autofill::FormData; using autofill::FormData;
...@@ -56,7 +57,7 @@ struct FormParsingTestCase { ...@@ -56,7 +57,7 @@ struct FormParsingTestCase {
ParseResultIndices save_result; ParseResultIndices save_result;
}; };
class FormParserTest : public testing::Test { class FormParserTest : public PlatformTest {
public: public:
FormParserTest() {} FormParserTest() {}
......
...@@ -12,13 +12,11 @@ ...@@ -12,13 +12,11 @@
#include "components/payments/core/payment_response.h" #include "components/payments/core/payment_response.h"
#include "components/payments/mojom/payment_request_data.mojom.h" #include "components/payments/mojom/payment_request_data.mojom.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
namespace payment_request_util { namespace payment_request_util {
class PaymentRequestUtilTest : public testing::Test { using PaymentRequestUtilTest = PlatformTest;
protected:
PaymentRequestUtilTest() {}
};
// Tests that serializing a default PaymentResponse yields the expected result. // Tests that serializing a default PaymentResponse yields the expected result.
TEST_F(PaymentRequestUtilTest, TEST_F(PaymentRequestUtilTest,
......
...@@ -7,14 +7,17 @@ ...@@ -7,14 +7,17 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
using JavaScriptDialogPresenterImplTest = PlatformTest;
// Tests that GetTruncatedMessageText() correctly truncates the length of a // Tests that GetTruncatedMessageText() correctly truncates the length of a
// string to the expected length. // string to the expected length.
TEST(JavaScriptDialogPresenterImplTest, GetTruncatedMessageText) { TEST_F(JavaScriptDialogPresenterImplTest, GetTruncatedMessageText) {
NSMutableString* text = [@"text" mutableCopy]; NSMutableString* text = [@"text" mutableCopy];
while (text.length < kJavaScriptDialogMaxMessageLength) { while (text.length < kJavaScriptDialogMaxMessageLength) {
[text appendString:text]; [text appendString:text];
......
...@@ -9,11 +9,14 @@ ...@@ -9,11 +9,14 @@
#import "ios/chrome/browser/ui/main_content/test/main_content_broadcast_test_util.h" #import "ios/chrome/browser/ui/main_content/test/main_content_broadcast_test_util.h"
#import "ios/chrome/browser/ui/main_content/test/test_main_content_ui_state.h" #import "ios/chrome/browser/ui/main_content/test/test_main_content_ui_state.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
using MainContentUIBroadcastingUtilTest = PlatformTest;
// Test implementation of MainContentUI. // Test implementation of MainContentUI.
@interface TestMainContentUI : NSObject<MainContentUI> @interface TestMainContentUI : NSObject<MainContentUI>
@property(nonatomic, readonly) TestMainContentUIState* mainContentUIState; @property(nonatomic, readonly) TestMainContentUIState* mainContentUIState;
...@@ -33,7 +36,7 @@ ...@@ -33,7 +36,7 @@
// Tests that the MainContentUIBroadcastingUtil functions successfully start // Tests that the MainContentUIBroadcastingUtil functions successfully start
// and stop broadcasting main content properties. // and stop broadcasting main content properties.
TEST(MainContentUIBroadcastingUtilTest, StartStop) { TEST_F(MainContentUIBroadcastingUtilTest, StartStop) {
TestMainContentUI* ui = [[TestMainContentUI alloc] init]; TestMainContentUI* ui = [[TestMainContentUI alloc] init];
ChromeBroadcaster* broadcaster = [[ChromeBroadcaster alloc] init]; ChromeBroadcaster* broadcaster = [[ChromeBroadcaster alloc] init];
VerifyMainContentUIBroadcast(ui.mainContentUIState, broadcaster, false); VerifyMainContentUIBroadcast(ui.mainContentUIState, broadcaster, false);
......
...@@ -8,14 +8,17 @@ ...@@ -8,14 +8,17 @@
#import "ios/chrome/browser/ui/toolbar/test/toolbar_broadcast_test_util.h" #import "ios/chrome/browser/ui/toolbar/test/toolbar_broadcast_test_util.h"
#import "ios/chrome/browser/ui/toolbar/toolbar_ui.h" #import "ios/chrome/browser/ui/toolbar/toolbar_ui.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
using ToolbarUIBroadcastingUtilTest = PlatformTest;
// Tests that the ToolbarUIBroadcastingUtil functions successfully start // Tests that the ToolbarUIBroadcastingUtil functions successfully start
// and stop broadcasting toolbar properties. // and stop broadcasting toolbar properties.
TEST(ToolbarUIBroadcastingUtilTest, StartStop) { TEST_F(ToolbarUIBroadcastingUtilTest, StartStop) {
ToolbarUIState* toolbar_ui = [[ToolbarUIState alloc] init]; ToolbarUIState* toolbar_ui = [[ToolbarUIState alloc] init];
ChromeBroadcaster* broadcaster = [[ChromeBroadcaster alloc] init]; ChromeBroadcaster* broadcaster = [[ChromeBroadcaster alloc] init];
VerifyToolbarUIBroadcast(toolbar_ui, broadcaster, false); VerifyToolbarUIBroadcast(toolbar_ui, broadcaster, false);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "net/base/io_buffer.h" #include "net/base/io_buffer.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
namespace net { namespace net {
...@@ -47,7 +48,7 @@ class MockChunkedDataStreamUploaderDelegate ...@@ -47,7 +48,7 @@ class MockChunkedDataStreamUploaderDelegate
int data_length_; int data_length_;
}; };
class ChunkedDataStreamUploaderTest : public testing::Test { class ChunkedDataStreamUploaderTest : public PlatformTest {
public: public:
ChunkedDataStreamUploaderTest() : callback_count(0) { ChunkedDataStreamUploaderTest() : callback_count(0) {
delegate_ = std::make_unique<MockChunkedDataStreamUploaderDelegate>(); delegate_ = std::make_unique<MockChunkedDataStreamUploaderDelegate>();
......
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