Index: ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm |
diff --git a/ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm b/ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm |
index 09d7543e47f9aa6b1d96626cd4261168b0fd0e91..d351af764f46ebef8892340d80cafe9671358760 100644 |
--- a/ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm |
+++ b/ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm |
@@ -4,8 +4,10 @@ |
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h" |
+#include "base/bind.h" |
#include "base/mac/foundation_util.h" |
#include "base/mac/scoped_nsobject.h" |
+#include "base/test/logging_utils.h" |
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "testing/gtest_mac.h" |
@@ -47,7 +49,11 @@ typedef NS_ENUM(NSInteger, ItemType) { |
ItemTypeWeasleyFooter, |
}; |
-void LogSink(const std::string& str) { |
+void LogSink(const char* file, |
+ int line, |
+ size_t message_start, |
+ size_t stack_start, |
+ const std::string& str) { |
// No-op. |
} |
@@ -302,7 +308,7 @@ void LogSink(const std::string& str) { |
[[CollectionViewModel alloc] init]); |
[model addSectionWithIdentifier:SectionIdentifierCheese]; |
- logging::SetLogAssertHandler(&LogSink); |
+ logging::ScopedLogAssertHandler scoped_assert_handler(base::Bind(LogSink)); |
bool out_of_bounds_exception_thrown = false; |
@try { |
[model indexInItemTypeForIndexPath:[NSIndexPath indexPathForItem:0 |
@@ -313,7 +319,6 @@ void LogSink(const std::string& str) { |
} |
} |
EXPECT_TRUE(out_of_bounds_exception_thrown); |
- logging::SetLogAssertHandler(nullptr); |
} |
TEST(CollectionViewModelTest, RemoveItems) { |