std::unique_ptr<T[]> with HeapArray
made changes to compound_buffer_test Fixed: 326459287 Change-Id: Ieee16c1c3184a2c76a2505691c770eb91f26e694 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5435013 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ari Chivukula <arichiv@chromium.org> Reviewed-by: Joe Downing <joedow@chromium.org> Cr-Commit-Position: refs/heads/main@{#1331804}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
285b6aa3c6
commit
c8529bea76
@ -10,6 +10,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "base/containers/heap_array.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "net/base/io_buffer.h"
|
||||
@ -144,10 +145,10 @@ class CompoundBufferTest : public testing::Test {
|
||||
static void ReadString(CompoundBufferInputStream* input,
|
||||
const std::string& str) {
|
||||
SCOPED_TRACE(str);
|
||||
std::unique_ptr<char[]> buffer(new char[str.size() + 1]);
|
||||
auto buffer = base::HeapArray<char>::Uninit(str.size() + 1);
|
||||
buffer[str.size()] = '\0';
|
||||
EXPECT_EQ(ReadFromInput(input, buffer.get(), str.size()), str.size());
|
||||
EXPECT_STREQ(str.data(), buffer.get());
|
||||
EXPECT_EQ(ReadFromInput(input, buffer.data(), str.size()), str.size());
|
||||
EXPECT_STREQ(str.data(), buffer.data());
|
||||
}
|
||||
|
||||
// Construct and prepare data in the |buffer|.
|
||||
|
Reference in New Issue
Block a user