Commit a6508c56 authored by Bailey Forrest's avatar Bailey Forrest Committed by Commit Bot

[chromecast] Replace StatusCallbackChecker with MockCallback

BUG=internal b/78359662
TEST= cast_bluetooth_unittests

Change-Id: Idd10f3edcc161b964cfda90826058564d55c6a6a
Reviewed-on: https://chromium-review.googlesource.com/1022953
Commit-Queue: Bailey Forrest <bcf@chromium.org>
Reviewed-by: default avatarStephen Lanham <slan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553258}
parent d4c3aa25
...@@ -32,17 +32,3 @@ test("cast_bluetooth_unittests") { ...@@ -32,17 +32,3 @@ test("cast_bluetooth_unittests") {
"//testing/gtest:gtest", "//testing/gtest:gtest",
] ]
} }
cast_source_set("test_support") {
testonly = true
sources = [
"test_util.cc",
"test_util.h",
]
deps = [
"//base",
"//chromecast/public",
]
}
...@@ -84,7 +84,6 @@ cast_source_set("unittests") { ...@@ -84,7 +84,6 @@ cast_source_set("unittests") {
":test_support", ":test_support",
"//base", "//base",
"//base/test:test_support", "//base/test:test_support",
"//chromecast/device/bluetooth:test_support",
"//chromecast/device/bluetooth:util", "//chromecast/device/bluetooth:util",
"//chromecast/device/bluetooth/shlib:mock_shlib", "//chromecast/device/bluetooth/shlib:mock_shlib",
"//chromecast/public", "//chromecast/public",
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "chromecast/device/bluetooth/le/remote_device.h" #include "chromecast/device/bluetooth/le/remote_device.h"
#include "chromecast/device/bluetooth/le/remote_service.h" #include "chromecast/device/bluetooth/le/remote_service.h"
#include "chromecast/device/bluetooth/shlib/mock_gatt_client.h" #include "chromecast/device/bluetooth/shlib/mock_gatt_client.h"
#include "chromecast/device/bluetooth/test_util.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromecast/device/bluetooth/test_util.h"
namespace chromecast {
namespace bluetooth {
StatusCallbackChecker::StatusCallbackChecker() = default;
StatusCallbackChecker::~StatusCallbackChecker() = default;
void StatusCallbackChecker::Reset() {
called_ = false;
status_ = false;
}
base::OnceCallback<void(bool success)> StatusCallbackChecker::CreateCallback() {
return base::BindOnce(&StatusCallbackChecker::OnStatus,
base::Unretained(this));
}
void StatusCallbackChecker::OnStatus(bool status) {
called_ = true;
status_ = status;
}
} // namespace bluetooth
} // namespace chromecast
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_DEVICE_BLUETOOTH_TEST_UTIL_H_
#define CHROMECAST_DEVICE_BLUETOOTH_TEST_UTIL_H_
#include "base/bind.h"
#include "base/callback.h"
#include "base/macros.h"
namespace chromecast {
namespace bluetooth {
class StatusCallbackChecker {
public:
StatusCallbackChecker();
~StatusCallbackChecker();
void Reset();
base::OnceCallback<void(bool success)> CreateCallback();
bool called() const { return called_; }
bool status() const { return status_; }
private:
void OnStatus(bool status);
bool status_ = false;
bool called_ = false;
DISALLOW_COPY_AND_ASSIGN(StatusCallbackChecker);
};
} // namespace bluetooth
} // namespace chromecast
#endif // CHROMECAST_DEVICE_BLUETOOTH_TEST_UTIL_H_
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