pw_kvs: Make fake flash memory a publicly accessible lib

Move fake flash memory from a kvs-internal util library to a publicly
available library.

Change-Id: I8b8fe0a85540c767ff38c6cf780f6c6391c25751
diff --git a/pw_kvs/BUILD b/pw_kvs/BUILD
index 15899ad..f3ff9e2 100644
--- a/pw_kvs/BUILD
+++ b/pw_kvs/BUILD
@@ -75,19 +75,16 @@
 )
 
 pw_cc_library(
-    name = "test_utils",
+    name = "fake_flash",
     srcs = [
-        "in_memory_fake_flash.cc",
+        "fake_flash_memory.cc",
     ],
     hdrs = [
-        "public/pw_kvs/in_memory_fake_flash.h",
-        "pw_kvs_private/byte_utils.h",
+        "public/pw_kvs/fake_flash_memory.h",
     ],
-    includes = ["public"],
-    visibility = ["//visibility:private"],
     deps = [
+        ":pw_kvs",
         "//pw_containers",
-        "//pw_kvs",
         "//pw_log",
         "//pw_log:facade",
         "//pw_span",
@@ -96,6 +93,15 @@
 )
 
 pw_cc_library(
+    name = "test_utils",
+    hdrs = [
+        "pw_kvs_private/byte_utils.h",
+    ],
+    includes = ["public"],
+    visibility = ["//visibility:private"],
+)
+
+pw_cc_library(
     name = "test_partition",
     srcs = [
         "flash_partition_with_stats.cc",
diff --git a/pw_kvs/BUILD.gn b/pw_kvs/BUILD.gn
index 43ef1ec..3017e5d 100644
--- a/pw_kvs/BUILD.gn
+++ b/pw_kvs/BUILD.gn
@@ -67,18 +67,23 @@
   ]
 }
 
+source_set("fake_flash") {
+  public_configs = [ ":default_config" ]
+  public = [ "public/pw_kvs/fake_flash_memory.h" ]
+  sources = [ "fake_flash_memory.cc" ]
+  public_deps = [
+    dir_pw_containers,
+    dir_pw_kvs,
+    dir_pw_span,
+    dir_pw_status,
+  ]
+  deps = [ dir_pw_log ]
+}
+
 source_set("test_utils") {
   public_configs = [ ":default_config" ]
-  public = [
-    "public/pw_kvs/in_memory_fake_flash.h",
-    "pw_kvs_private/byte_utils.h",
-  ]
-  sources = [ "in_memory_fake_flash.cc" ]
+  public = [ "pw_kvs_private/byte_utils.h" ]
   visibility = [ ":*" ]
-  public_deps = [
-    dir_pw_kvs,
-    dir_pw_log,
-  ]
 }
 
 source_set("test_partition") {
@@ -97,8 +102,8 @@
   sources = [ "debug_cli.cc" ]
   deps = [
     ":crc16",
+    ":fake_flash",
     ":pw_kvs",
-    ":test_utils",
   ]
 }
 
@@ -134,6 +139,7 @@
 pw_test("entry_test") {
   deps = [
     ":crc16",
+    ":fake_flash",
     ":pw_kvs",
     ":test_utils",
   ]
@@ -142,6 +148,7 @@
 
 pw_test("entry_cache_test") {
   deps = [
+    ":fake_flash",
     ":pw_kvs",
     ":test_utils",
   ]
@@ -151,6 +158,7 @@
 pw_test("key_value_store_test") {
   deps = [
     ":crc16",
+    ":fake_flash",
     ":pw_kvs",
     ":test_utils",
     dir_pw_checksum,
@@ -162,6 +170,7 @@
 pw_test("key_value_store_binary_format_test") {
   deps = [
     ":crc16",
+    ":fake_flash",
     ":pw_kvs",
     ":test_utils",
     dir_pw_log,
@@ -172,9 +181,9 @@
 pw_test("key_value_store_fuzz_test") {
   deps = [
     ":crc16",
+    ":fake_flash",
     ":pw_kvs",
     ":test_partition",
-    ":test_utils",
   ]
   sources = [ "key_value_store_fuzz_test.cc" ]
 }
@@ -182,9 +191,9 @@
 pw_test("key_value_store_map_test") {
   deps = [
     ":crc16",
+    ":fake_flash",
     ":pw_kvs",
     ":test_partition",
-    ":test_utils",
     dir_pw_checksum,
   ]
   sources = [ "key_value_store_map_test.cc" ]
@@ -192,17 +201,17 @@
 
 pw_test("sectors_test") {
   deps = [
+    ":fake_flash",
     ":pw_kvs",
-    ":test_utils",
   ]
   sources = [ "sectors_test.cc" ]
 }
 
 pw_test("key_value_store_wear_test") {
   deps = [
+    ":fake_flash",
     ":pw_kvs",
     ":test_partition",
-    ":test_utils",
     dir_pw_log,
   ]
   sources = [ "key_value_store_wear_test.cc" ]
diff --git a/pw_kvs/alignment_test.cc b/pw_kvs/alignment_test.cc
index c80cec3..2b25e94 100644
--- a/pw_kvs/alignment_test.cc
+++ b/pw_kvs/alignment_test.cc
@@ -185,7 +185,7 @@
 // Output class that can be programmed to fail for testing purposes.
 // TODO(hepler): If we create a general pw_io / pw_stream module, this and
 // InputWithErrorInjection should be made into generic test utility classes,
-// similar to InMemoryFakeFlash.
+// similar to FakeFlashMemory.
 struct OutputWithErrorInjection final : public Output {
  public:
   enum { kKeepGoing, kBreakOnNext, kBroken } state = kKeepGoing;
diff --git a/pw_kvs/debug_cli.cc b/pw_kvs/debug_cli.cc
index 11519ad..958a631 100644
--- a/pw_kvs/debug_cli.cc
+++ b/pw_kvs/debug_cli.cc
@@ -17,7 +17,7 @@
 #include <string>
 
 #include "pw_kvs/crc16_checksum.h"
-#include "pw_kvs/in_memory_fake_flash.h"
+#include "pw_kvs/fake_flash_memory.h"
 #include "pw_kvs/key_value_store.h"
 
 namespace pw::kvs {
@@ -43,7 +43,7 @@
 
 void Run() {
   // 4 x 4k sectors, 16 byte alignment
-  FakeFlashBuffer<4 * 1024, 4> test_flash(16);
+  FakeFlashMemoryBuffer<4 * 1024, 4> test_flash(16);
 
   FlashPartition test_partition(&test_flash, 0, test_flash.sector_count());
   test_partition.Erase(0, test_partition.sector_count());
diff --git a/pw_kvs/entry_cache_test.cc b/pw_kvs/entry_cache_test.cc
index 76bf5dc..01fa3a1 100644
--- a/pw_kvs/entry_cache_test.cc
+++ b/pw_kvs/entry_cache_test.cc
@@ -15,8 +15,8 @@
 #include "pw_kvs/internal/entry_cache.h"
 
 #include "gtest/gtest.h"
+#include "pw_kvs/fake_flash_memory.h"
 #include "pw_kvs/flash_memory.h"
-#include "pw_kvs/in_memory_fake_flash.h"
 #include "pw_kvs/internal/hash.h"
 #include "pw_kvs/internal/key_descriptor.h"
 #include "pw_kvs_private/byte_utils.h"
@@ -282,7 +282,7 @@
   }
 
   static constexpr size_t kTotalSectors = 128;
-  FakeFlashBuffer<kSectorSize, kTotalSectors> flash_;
+  FakeFlashMemoryBuffer<kSectorSize, kTotalSectors> flash_;
   FlashPartition partition_;
 
   Vector<SectorDescriptor, kTotalSectors> sector_descriptors_;
diff --git a/pw_kvs/entry_test.cc b/pw_kvs/entry_test.cc
index e4512de..553ed52 100644
--- a/pw_kvs/entry_test.cc
+++ b/pw_kvs/entry_test.cc
@@ -20,9 +20,9 @@
 #include "pw_kvs/alignment.h"
 #include "pw_kvs/checksum.h"
 #include "pw_kvs/crc16_checksum.h"
+#include "pw_kvs/fake_flash_memory.h"
 #include "pw_kvs/flash_memory.h"
 #include "pw_kvs/format.h"
-#include "pw_kvs/in_memory_fake_flash.h"
 #include "pw_kvs_private/byte_utils.h"
 #include "pw_span/span.h"
 
@@ -35,7 +35,7 @@
 constexpr EntryFormat kFormat{0xbeef, nullptr};
 
 TEST(Entry, Size_RoundsUpToAlignment) {
-  FakeFlashBuffer<64, 2> flash(16);
+  FakeFlashMemoryBuffer<64, 2> flash(16);
 
   for (size_t alignment_bytes = 1; alignment_bytes <= 4096; ++alignment_bytes) {
     FlashPartition partition(&flash, 0, flash.sector_count(), alignment_bytes);
@@ -55,7 +55,7 @@
 }
 
 TEST(Entry, Construct_ValidEntry) {
-  FakeFlashBuffer<64, 2> flash(16);
+  FakeFlashMemoryBuffer<64, 2> flash(16);
   FlashPartition partition(&flash, 0, flash.sector_count());
 
   auto entry =
@@ -68,7 +68,7 @@
 }
 
 TEST(Entry, Construct_Tombstone) {
-  FakeFlashBuffer<64, 2> flash(16);
+  FakeFlashMemoryBuffer<64, 2> flash(16);
   FlashPartition partition(&flash, 0, flash.sector_count());
 
   auto entry = Entry::Tombstone(partition, 1, kFormat, "key", 123);
@@ -109,7 +109,7 @@
     EXPECT_EQ(Status::OK, Entry::Read(partition_, 0, kFormats, &entry_));
   }
 
-  FakeFlashBuffer<1024, 4> flash_;
+  FakeFlashMemoryBuffer<1024, 4> flash_;
   FlashPartition partition_;
   Entry entry_;
 };
@@ -194,7 +194,7 @@
 }
 
 TEST(ValidEntry, Write) {
-  FakeFlashBuffer<1024, 4> flash;
+  FakeFlashMemoryBuffer<1024, 4> flash;
   FlashPartition partition(&flash, 0, flash.sector_count(), 32);
 
   Entry entry = Entry::Valid(
@@ -225,7 +225,7 @@
     EXPECT_EQ(Status::OK, Entry::Read(partition_, 0, kFormats, &entry_));
   }
 
-  FakeFlashBuffer<1024, 4> flash_;
+  FakeFlashMemoryBuffer<1024, 4> flash_;
   FlashPartition partition_;
   Entry entry_;
 };
@@ -261,7 +261,7 @@
 }
 
 TEST(TombstoneEntry, Write) {
-  FakeFlashBuffer<1024, 4> flash;
+  FakeFlashMemoryBuffer<1024, 4> flash;
   FlashPartition partition(&flash);
   ChecksumCrc16 checksum;
 
@@ -278,7 +278,7 @@
 }
 
 TEST(Entry, Checksum_NoChecksumRequiresZero) {
-  FakeFlashBuffer<1024, 4> flash(kEntry1);
+  FakeFlashMemoryBuffer<1024, 4> flash(kEntry1);
   FlashPartition partition(&flash);
   Entry entry;
 
@@ -297,7 +297,7 @@
 }
 
 TEST(Entry, Checksum_ChecksPadding) {
-  FakeFlashBuffer<1024, 4> flash(
+  FakeFlashMemoryBuffer<1024, 4> flash(
       AsBytes(kHeader1, kKey1, kValue1, ByteStr("\0\0\0\0\1")));
   FlashPartition partition(&flash);
   Entry entry;
@@ -441,7 +441,7 @@
 
 TEST(ValidEntryInFlash, UpdateAndCopy_DifferentFormatSameAlignment) {
   // Use 32-bit alignment, the same as the original entry's alignment.
-  FakeFlashBuffer<1024, 4> flash(kEntry1);
+  FakeFlashMemoryBuffer<1024, 4> flash(kEntry1);
   FlashPartition partition(&flash, 0, 4, 32);
   Entry entry;
   ASSERT_EQ(Status::OK, Entry::Read(partition, 0, kFormats, &entry));
@@ -467,7 +467,7 @@
 
 TEST(ValidEntryInFlash, UpdateAndCopy_DifferentFormatLargerAlignment) {
   // Use 64-bit alignment, larger than the original entry's alignment.
-  FakeFlashBuffer<1024, 4> flash(kEntry1);
+  FakeFlashMemoryBuffer<1024, 4> flash(kEntry1);
   FlashPartition partition(&flash, 0, 4, 64);
   Entry entry;
   ASSERT_EQ(Status::OK, Entry::Read(partition, 0, kFormats, &entry));
diff --git a/pw_kvs/in_memory_fake_flash.cc b/pw_kvs/fake_flash_memory.cc
similarity index 91%
rename from pw_kvs/in_memory_fake_flash.cc
rename to pw_kvs/fake_flash_memory.cc
index d0e0c6b..9443836 100644
--- a/pw_kvs/in_memory_fake_flash.cc
+++ b/pw_kvs/fake_flash_memory.cc
@@ -14,7 +14,7 @@
 
 #define PW_LOG_MODULE_NAME "KVS"
 
-#include "pw_kvs/in_memory_fake_flash.h"
+#include "pw_kvs/fake_flash_memory.h"
 
 #include "pw_log/log.h"
 
@@ -55,7 +55,7 @@
   return status_;
 }
 
-Status InMemoryFakeFlash::Erase(Address address, size_t num_sectors) {
+Status FakeFlashMemory::Erase(Address address, size_t num_sectors) {
   if (address % sector_size_bytes() != 0) {
     PW_LOG_ERROR(
         "Attempted to erase sector at non-sector aligned boundary; address %zx",
@@ -77,8 +77,7 @@
   return Status::OK;
 }
 
-StatusWithSize InMemoryFakeFlash::Read(Address address,
-                                       span<std::byte> output) {
+StatusWithSize FakeFlashMemory::Read(Address address, span<std::byte> output) {
   if (address + output.size() >= sector_count() * size_bytes()) {
     return StatusWithSize::OUT_OF_RANGE;
   }
@@ -89,8 +88,8 @@
   return StatusWithSize(status, output.size());
 }
 
-StatusWithSize InMemoryFakeFlash::Write(Address address,
-                                        span<const std::byte> data) {
+StatusWithSize FakeFlashMemory::Write(Address address,
+                                      span<const std::byte> data) {
   if (address % alignment_bytes() != 0 ||
       data.size() % alignment_bytes() != 0) {
     PW_LOG_ERROR("Unaligned write; address %zx, size %zu B, alignment %zu",
diff --git a/pw_kvs/key_value_store_binary_format_test.cc b/pw_kvs/key_value_store_binary_format_test.cc
index 8ce04d4..4c48e55 100644
--- a/pw_kvs/key_value_store_binary_format_test.cc
+++ b/pw_kvs/key_value_store_binary_format_test.cc
@@ -18,8 +18,8 @@
 
 #include "gtest/gtest.h"
 #include "pw_kvs/crc16_checksum.h"
+#include "pw_kvs/fake_flash_memory.h"
 #include "pw_kvs/format.h"
-#include "pw_kvs/in_memory_fake_flash.h"
 #include "pw_kvs/internal/hash.h"
 #include "pw_kvs/key_value_store.h"
 #include "pw_kvs_private/byte_utils.h"
@@ -171,7 +171,7 @@
     std::memcpy(flash_.buffer().data(), contents.data(), contents.size());
   }
 
-  FakeFlashBuffer<512, 4> flash_;
+  FakeFlashMemoryBuffer<512, 4> flash_;
   FlashPartition partition_;
   KeyValueStoreBuffer<kMaxEntries, kMaxUsableSectors> kvs_;
 };
@@ -378,7 +378,7 @@
     std::memcpy(flash_.buffer().data(), contents.data(), contents.size());
   }
 
-  FakeFlashBuffer<512, 4> flash_;
+  FakeFlashMemoryBuffer<512, 4> flash_;
   FlashPartition partition_;
   KeyValueStoreBuffer<kMaxEntries, kMaxUsableSectors> kvs_;
 };
@@ -635,7 +635,7 @@
     EXPECT_EQ(Status::OK, kvs_.Init());
   }
 
-  FakeFlashBuffer<512, 4, 3> flash_;
+  FakeFlashMemoryBuffer<512, 4, 3> flash_;
   FlashPartition partition_;
   KeyValueStoreBuffer<kMaxEntries, kMaxUsableSectors, 2, 3> kvs_;
 };
@@ -869,7 +869,7 @@
     EXPECT_EQ(Status::OK, kvs_.Init());
   }
 
-  FakeFlashBuffer<512, 4, 3> flash_;
+  FakeFlashMemoryBuffer<512, 4, 3> flash_;
   FlashPartition partition_;
   KeyValueStoreBuffer<kMaxEntries, kMaxUsableSectors, 1, 3> kvs_;
 };
@@ -922,7 +922,7 @@
     EXPECT_EQ(Status::OK, kvs_.Init());
   }
 
-  FakeFlashBuffer<512, 4, 3> flash_;
+  FakeFlashMemoryBuffer<512, 4, 3> flash_;
   FlashPartition partition_;
   KeyValueStoreBuffer<kMaxEntries, kMaxUsableSectors, 2> kvs_;
 };
@@ -1014,7 +1014,7 @@
     EXPECT_EQ(Status::OK, kvs_.Init());
   }
 
-  FakeFlashBuffer<512, 8> flash_;
+  FakeFlashMemoryBuffer<512, 8> flash_;
   FlashPartition partition_;
   KeyValueStoreBuffer<kMaxEntries, kMaxUsableSectors> kvs_;
 };
diff --git a/pw_kvs/key_value_store_fuzz_test.cc b/pw_kvs/key_value_store_fuzz_test.cc
index a73e92f..8ef1ebc 100644
--- a/pw_kvs/key_value_store_fuzz_test.cc
+++ b/pw_kvs/key_value_store_fuzz_test.cc
@@ -14,8 +14,8 @@
 
 #include "gtest/gtest.h"
 #include "pw_kvs/crc16_checksum.h"
+#include "pw_kvs/fake_flash_memory.h"
 #include "pw_kvs/flash_partition_with_stats.h"
-#include "pw_kvs/in_memory_fake_flash.h"
 #include "pw_kvs/key_value_store.h"
 
 namespace pw::kvs {
@@ -32,7 +32,7 @@
 constexpr size_t kMaxUsableSectors = 256;
 
 // 4 x 4k sectors, 16 byte alignment
-FakeFlashBuffer<4 * 1024, 6> test_flash(16);
+FakeFlashMemoryBuffer<4 * 1024, 6> test_flash(16);
 
 FlashPartitionWithStatsBuffer<kMaxUsableSectors> test_partition(
     &test_flash, 0, test_flash.sector_count());
diff --git a/pw_kvs/key_value_store_map_test.cc b/pw_kvs/key_value_store_map_test.cc
index 4b15880..ac6a83b 100644
--- a/pw_kvs/key_value_store_map_test.cc
+++ b/pw_kvs/key_value_store_map_test.cc
@@ -28,8 +28,8 @@
 
 #include "gtest/gtest.h"
 #include "pw_kvs/crc16_checksum.h"
+#include "pw_kvs/fake_flash_memory.h"
 #include "pw_kvs/flash_partition_with_stats.h"
-#include "pw_kvs/in_memory_fake_flash.h"
 #include "pw_kvs/internal/entry.h"
 #include "pw_kvs/key_value_store.h"
 #include "pw_log/log.h"
@@ -393,8 +393,8 @@
 
   static constexpr size_t kMaxValueLength = 64;
 
-  static FakeFlashBuffer<kParams.sector_size,
-                         (kParams.sector_count * kParams.redundancy)>
+  static FakeFlashMemoryBuffer<kParams.sector_size,
+                               (kParams.sector_count * kParams.redundancy)>
       flash_;
 
   FlashPartitionWithStatsBuffer<kMaxEntries> partition_;
@@ -406,11 +406,11 @@
 };
 
 template <const TestParameters& kParams>
-FakeFlashBuffer<kParams.sector_size,
-                (kParams.sector_count * kParams.redundancy)>
+FakeFlashMemoryBuffer<kParams.sector_size,
+                      (kParams.sector_count * kParams.redundancy)>
     KvsTester<kParams>::flash_ =
-        FakeFlashBuffer<kParams.sector_size,
-                        (kParams.sector_count * kParams.redundancy)>(
+        FakeFlashMemoryBuffer<kParams.sector_size,
+                              (kParams.sector_count * kParams.redundancy)>(
             kParams.sector_alignment);
 
 #define _TEST(fixture, test, ...) \
diff --git a/pw_kvs/key_value_store_test.cc b/pw_kvs/key_value_store_test.cc
index 0c9d48e..2b044b2 100644
--- a/pw_kvs/key_value_store_test.cc
+++ b/pw_kvs/key_value_store_test.cc
@@ -39,7 +39,7 @@
 #include "pw_string/string_builder.h"
 
 #if USE_MEMORY_BUFFER
-#include "pw_kvs/in_memory_fake_flash.h"
+#include "pw_kvs/fake_flash_memory.h"
 #endif  // USE_MEMORY_BUFFER
 
 namespace pw::kvs {
@@ -112,7 +112,7 @@
   FlashWithPartitionFake(size_t alignment_bytes)
       : memory(alignment_bytes), partition(&memory, 0, memory.sector_count()) {}
 
-  FakeFlashBuffer<sector_size_bytes, sector_count> memory;
+  FakeFlashMemoryBuffer<sector_size_bytes, sector_count> memory;
   FlashPartition partition;
 
  public:
@@ -156,10 +156,10 @@
 #if USE_MEMORY_BUFFER
 // Although it might be useful to test other configurations, some tests require
 // at least 3 sectors; therfore it should have this when checked in.
-FakeFlashBuffer<4 * 1024, 6> test_flash(
+FakeFlashMemoryBuffer<4 * 1024, 6> test_flash(
     16);  // 4 x 4k sectors, 16 byte alignment
 FlashPartition test_partition(&test_flash, 0, test_flash.sector_count());
-FakeFlashBuffer<1024, 60> large_test_flash(8);
+FakeFlashMemoryBuffer<1024, 60> large_test_flash(8);
 FlashPartition large_test_partition(&large_test_flash,
                                     0,
                                     large_test_flash.sector_count());
diff --git a/pw_kvs/key_value_store_wear_test.cc b/pw_kvs/key_value_store_wear_test.cc
index 1bea08e..e907576 100644
--- a/pw_kvs/key_value_store_wear_test.cc
+++ b/pw_kvs/key_value_store_wear_test.cc
@@ -16,9 +16,9 @@
 #define PW_KVS_RECORD_PARTITION_STATS 1
 
 #include "gtest/gtest.h"
+#include "pw_kvs/fake_flash_memory.h"
 #include "pw_kvs/flash_memory.h"
 #include "pw_kvs/flash_partition_with_stats.h"
-#include "pw_kvs/in_memory_fake_flash.h"
 #include "pw_kvs/key_value_store.h"
 #include "pw_log/log.h"
 
@@ -40,7 +40,7 @@
   static constexpr size_t kMaxEntries = 256;
   static constexpr size_t kTestPartitionSectorSize = 512;
 
-  FakeFlashBuffer<kTestPartitionSectorSize, kSectors> flash_;
+  FakeFlashMemoryBuffer<kTestPartitionSectorSize, kSectors> flash_;
   FlashPartitionWithStatsBuffer<kSectors> partition_;
 
   KeyValueStoreBuffer<kMaxEntries, kSectors> kvs_;
diff --git a/pw_kvs/public/pw_kvs/in_memory_fake_flash.h b/pw_kvs/public/pw_kvs/fake_flash_memory.h
similarity index 82%
rename from pw_kvs/public/pw_kvs/in_memory_fake_flash.h
rename to pw_kvs/public/pw_kvs/fake_flash_memory.h
index b7b57b9..a0916bf 100644
--- a/pw_kvs/public/pw_kvs/in_memory_fake_flash.h
+++ b/pw_kvs/public/pw_kvs/fake_flash_memory.h
@@ -78,7 +78,7 @@
 // This uses a buffer to mimic the behaviour of flash (requires erase before
 // write, checks alignments, and is addressed in sectors). The underlying buffer
 // is not initialized.
-class InMemoryFakeFlash : public FlashMemory {
+class FakeFlashMemory : public FlashMemory {
  private:
   static Vector<FlashError, 0> no_errors_;
 
@@ -88,12 +88,12 @@
 
   static constexpr std::byte kErasedValue = std::byte{0xff};
 
-  InMemoryFakeFlash(span<std::byte> buffer,
-                    size_t sector_size,
-                    size_t sector_count,
-                    size_t alignment_bytes = kDefaultAlignmentBytes,
-                    Vector<FlashError>& read_errors = no_errors_,
-                    Vector<FlashError>& write_errors = no_errors_)
+  FakeFlashMemory(span<std::byte> buffer,
+                  size_t sector_size,
+                  size_t sector_count,
+                  size_t alignment_bytes = kDefaultAlignmentBytes,
+                  Vector<FlashError>& read_errors = no_errors_,
+                  Vector<FlashError>& write_errors = no_errors_)
       : FlashMemory(sector_size, sector_count, alignment_bytes),
         buffer_(buffer),
         read_errors_(read_errors),
@@ -143,25 +143,27 @@
   Vector<FlashError>& write_errors_;
 };
 
-// Creates an InMemoryFakeFlash backed by a std::array. The array is initialized
+// Creates an FakeFlashMemory backed by a std::array. The array is initialized
 // to the erased value. A byte array to which to initialize the memory may be
 // provided.
 template <size_t kSectorSize, size_t kSectorCount, size_t kInjectedErrors = 8>
-class FakeFlashBuffer : public InMemoryFakeFlash {
+class FakeFlashMemoryBuffer : public FakeFlashMemory {
  public:
   // Creates a flash memory with no data written.
-  explicit FakeFlashBuffer(size_t alignment_bytes = kDefaultAlignmentBytes)
-      : FakeFlashBuffer(std::array<std::byte, 0>{}, alignment_bytes) {}
+  explicit FakeFlashMemoryBuffer(
+      size_t alignment_bytes = kDefaultAlignmentBytes)
+      : FakeFlashMemoryBuffer(std::array<std::byte, 0>{}, alignment_bytes) {}
 
   // Creates a flash memory initialized to the provided contents.
-  explicit FakeFlashBuffer(span<const std::byte> contents,
-                           size_t alignment_bytes = kDefaultAlignmentBytes)
-      : InMemoryFakeFlash(buffer_,
-                          kSectorSize,
-                          kSectorCount,
-                          alignment_bytes,
-                          read_errors_,
-                          write_errors_) {
+  explicit FakeFlashMemoryBuffer(
+      span<const std::byte> contents,
+      size_t alignment_bytes = kDefaultAlignmentBytes)
+      : FakeFlashMemory(buffer_,
+                        kSectorSize,
+                        kSectorCount,
+                        alignment_bytes,
+                        read_errors_,
+                        write_errors_) {
     std::memset(buffer_.data(), int(kErasedValue), buffer_.size());
     std::memcpy(buffer_.data(),
                 contents.data(),
diff --git a/pw_kvs/sectors_test.cc b/pw_kvs/sectors_test.cc
index edf56c2..50755a4 100644
--- a/pw_kvs/sectors_test.cc
+++ b/pw_kvs/sectors_test.cc
@@ -15,7 +15,7 @@
 #include "pw_kvs/internal/sectors.h"
 
 #include "gtest/gtest.h"
-#include "pw_kvs/in_memory_fake_flash.h"
+#include "pw_kvs/fake_flash_memory.h"
 
 namespace pw::kvs::internal {
 namespace {
@@ -26,7 +26,7 @@
       : partition_(&flash_),
         sectors_(sector_descriptors_, partition_, nullptr) {}
 
-  FakeFlashBuffer<128, 16> flash_;
+  FakeFlashMemoryBuffer<128, 16> flash_;
   FlashPartition partition_;
   Vector<SectorDescriptor, 32> sector_descriptors_;
   Sectors sectors_;