Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f53a23f authored by Kokoa Matsuda's avatar Kokoa Matsuda
Browse files

Replace libchrome StringPrintf in system/bta/test/ files

This change is to remove the direct dependency on libchrome.
Replaces StringPrintf in <base/strings/stringprintf.h>
with android::base::StringPrintf in <android-base/stringprintf.h>.
This change is very mechanical, no change in program behavior.

Test: m .
Bug: 360917504
Change-Id: I168437505d6e82c7c964e7e01765a521cb72ca9f
parent 9415ddaa
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#include <base/functional/bind.h>
#include <base/location.h>
#include <fmt/format.h>
#include <gtest/gtest.h>

#include <cstdint>
@@ -46,7 +47,7 @@ TEST_F(BtaApiTest, bta_status_text) {
  for (const auto& status : statuses) {
    ASSERT_STREQ(status.second.c_str(), bta_status_text(status.first).c_str());
  }
  auto unknown = base::StringPrintf("UNKNOWN[%d]", std::numeric_limits<uint8_t>::max());
  auto unknown = fmt::format("UNKNOWN[{}]", std::numeric_limits<uint8_t>::max());
  ASSERT_STREQ(
          unknown.c_str(),
          bta_status_text(static_cast<tBTA_STATUS>(std::numeric_limits<uint8_t>::max())).c_str());
+1 −1
Original line number Diff line number Diff line
@@ -16,11 +16,11 @@

#define LOG_TAG "bt_bta_dm_test"

#include <base/strings/stringprintf.h>
#include <base/test/bind_test_util.h>
#include <bluetooth/log.h>
#include <com_android_bluetooth_flags.h>
#include <flag_macros.h>
#include <fmt/format.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <sys/socket.h>
+6 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <bluetooth/log.h>
#include <com_android_bluetooth_flags.h>
#include <flag_macros.h>
#include <fmt/format.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>

@@ -426,7 +427,8 @@ TEST_F(BtaDmTest, bta_dm_search_evt_text) {
  for (const auto& event : events) {
    ASSERT_STREQ(event.second.c_str(), bta_dm_search_evt_text(event.first).c_str());
  }
  ASSERT_STREQ(base::StringPrintf("UNKNOWN[%hhu]", std::numeric_limits<uint8_t>::max()).c_str(),
  ASSERT_STREQ(
          fmt::format("UNKNOWN[{}]", std::numeric_limits<uint8_t>::max()).c_str(),
          bta_dm_search_evt_text(
                  static_cast<tBTA_DM_SEARCH_EVT>(std::numeric_limits<uint8_t>::max()))
                  .c_str());
+3 −3
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

#include <base/strings/stringprintf.h>
#include <fmt/format.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <sys/socket.h>
@@ -54,11 +54,11 @@ TEST_F(BtaDiscTest, gatt_history_callback) {
  };

  // C string
  gatt_history_callback(base::StringPrintf("%s", a[0].c_str()));
  gatt_history_callback(fmt::format("{}", a[0].c_str()));
  // Cpp string
  gatt_history_callback(a[1]);
  // Third entry for "fun"
  gatt_history_callback(base::StringPrintf("%s", a[2].c_str()));
  gatt_history_callback(fmt::format("{}", a[2].c_str()));

  std::vector<bluetooth::common::TimestampedEntry<std::string>> history =
          bluetooth::legacy::testing::PullCopyOfGattHistory();
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

#include <base/strings/stringprintf.h>
#include <fmt/format.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <sys/socket.h>