0
Files
src/sql/sql_memory_dump_provider_unittest.cc
Ho Cheung adbf3fb72a [base] [trace_event] Rename Macro-like enum values in base/trace_event
Many macro-like enum values are defined in //base/trace_event/,
for example, `enum class MemoryDumpDeterminism : uint32_t { NONE,
FORCE_GC }`.

Google C++ style guide recommends today to not name macro-like enum
values.

This patch only renames some Macro-like enum values, and the remaining
Macro-like enum values will be renamed in subsequent patches.

Bug: 1453482
Change-Id: I0d103a0d258ef4c60876c1f8bc8e4d9685792744
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4841679
Reviewed-by: Primiano Tucci <primiano@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Commit-Queue: Ho Cheung <uioptt24@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1193888}
2023-09-08 02:01:11 +00:00

45 lines
1.2 KiB
C++

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sql/sql_memory_dump_provider.h"
#include "base/files/scoped_temp_dir.h"
#include "base/trace_event/memory_dump_request_args.h"
#include "base/trace_event/process_memory_dump.h"
#include "sql/database.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace sql {
namespace {
class SQLMemoryDumpProviderTest : public testing::Test {
public:
~SQLMemoryDumpProviderTest() override = default;
void SetUp() override {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
ASSERT_TRUE(db_.Open(
temp_dir_.GetPath().AppendASCII("memory_dump_provider_test.sqlite")));
ASSERT_TRUE(db_.Execute("CREATE TABLE foo (a, b)"));
}
protected:
base::ScopedTempDir temp_dir_;
Database db_;
};
TEST_F(SQLMemoryDumpProviderTest, OnMemoryDump) {
base::trace_event::MemoryDumpArgs args = {
base::trace_event::MemoryDumpLevelOfDetail::kDetailed};
base::trace_event::ProcessMemoryDump pmd(args);
ASSERT_TRUE(SqlMemoryDumpProvider::GetInstance()->OnMemoryDump(args, &pmd));
ASSERT_TRUE(pmd.GetAllocatorDump("sqlite"));
}
} // namespace
} // namespace sql