Commit 6b57fd3e authored by Alec Douglas's avatar Alec Douglas Committed by Commit Bot

Fix BufferLimitConfig test for low memory devices

This commit fixes the BufferLimitConfig content unittest by accounting
for low memory devices.

When a device has 1 GB or less of RAM,
BackgroundTracingConfigImpl::GetMaximumTraceBufferSizeKb() returns the
low RAM buffer size instead of mobile network buffer size for Android.

This commit updates the BufferLimitConfig test expectations to handle
that code path properly.

TEST=out/Debug/bin/run_content_unittests --num_retries=0
       -f BackgroundTracingConfigTest.BufferLimitConfig

Bug: 1038539
Change-Id: I53622041b06c012b9b3b06dc9df49b8587f57b4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1983669Reviewed-by: default avataroysteine <oysteine@chromium.org>
Commit-Queue: oysteine <oysteine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#731773}
parent 9a8b9532
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
#include "base/json/json_writer.h" #include "base/json/json_writer.h"
#include "base/system/sys_info.h"
#include "base/values.h" #include "base/values.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "content/browser/tracing/background_tracing_config_impl.h" #include "content/browser/tracing/background_tracing_config_impl.h"
...@@ -690,7 +691,11 @@ TEST_F(BackgroundTracingConfigTest, BufferLimitConfig) { ...@@ -690,7 +691,11 @@ TEST_F(BackgroundTracingConfigTest, BufferLimitConfig) {
notifier.set_type(net::NetworkChangeNotifier::CONNECTION_2G); notifier.set_type(net::NetworkChangeNotifier::CONNECTION_2G);
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
EXPECT_EQ(300u, config->GetTraceConfig().GetTraceBufferSizeInKb()); int64_t ram_mb = base::SysInfo::AmountOfPhysicalMemoryMB();
size_t expected_trace_buffer_size =
(ram_mb > 0 && ram_mb <= 1024) ? 800u : 300u;
EXPECT_EQ(expected_trace_buffer_size,
config->GetTraceConfig().GetTraceBufferSizeInKb());
EXPECT_EQ(600u, config->GetTraceUploadLimitKb()); EXPECT_EQ(600u, config->GetTraceUploadLimitKb());
#endif #endif
......
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