Remove location namespace in third_party/nearby.

PiperOrigin-RevId: 500023196
This commit is contained in:
Suet-Fei Li
2023-01-06 02:53:57 -08:00
committed by Copybara-Service
parent 7afea00649
commit 084f7ebd88
714 changed files with 2710 additions and 3738 deletions
@@ -19,7 +19,6 @@
#include "internal/platform/implementation/atomic_boolean.h"
namespace location {
namespace nearby {
namespace windows {
@@ -40,6 +39,5 @@ class AtomicBoolean : public api::AtomicBoolean {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_ATOMIC_BOOLEAN_H_
@@ -18,7 +18,7 @@
TEST(atomic_boolean, SuccessfulCreation) {
// Arrange
location::nearby::windows::AtomicBoolean atomicBoolean;
nearby::windows::AtomicBoolean atomicBoolean;
bool oldValue = true;
bool result = false;
@@ -19,7 +19,6 @@
#include "internal/platform/implementation/atomic_reference.h"
namespace location {
namespace nearby {
namespace windows {
@@ -40,6 +39,5 @@ class AtomicUint32 : public api::AtomicUint32 {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_ATOMIC_REFERENCE_H_
@@ -18,7 +18,7 @@
TEST(atomic_reference, SuccessfulCreation) {
// Arrange
location::nearby::windows::AtomicUint32 atomicUint32;
nearby::windows::AtomicUint32 atomicUint32;
uint32_t result = UINT32_MAX;
const uint32_t expected = 0;
@@ -31,7 +31,7 @@ TEST(atomic_reference, SuccessfulCreation) {
TEST(atomic_reference, SuccessfulMaxSet) {
// Arrange
location::nearby::windows::AtomicUint32 atomicUint32;
nearby::windows::AtomicUint32 atomicUint32;
uint32_t result = 0;
const uint32_t expected = UINT32_MAX;
@@ -45,7 +45,7 @@ TEST(atomic_reference, SuccessfulMaxSet) {
TEST(atomic_reference, SuccessfulMinSet) {
// Arrange
location::nearby::windows::AtomicUint32 atomicUint32;
nearby::windows::AtomicUint32 atomicUint32;
uint32_t result = UINT32_MAX;
const uint32_t expected = 0;
@@ -59,7 +59,7 @@ TEST(atomic_reference, SuccessfulMinSet) {
TEST(atomic_reference, SetNegativeOneReturnsMAXUINT) {
// Arrange
location::nearby::windows::AtomicUint32 atomicUint32;
nearby::windows::AtomicUint32 atomicUint32;
uint32_t result = 0;
const uint32_t expected = UINT32_MAX;
@@ -35,7 +35,6 @@
#include "winrt/Windows.Storage.Streams.h"
#include "winrt/base.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -609,4 +608,3 @@ void BleMedium::AdvertisementReceivedHandler(
} // namespace windows
} // namespace nearby
} // namespace location
@@ -31,7 +31,6 @@
#include "internal/platform/implementation/windows/bluetooth_adapter.h"
#include "winrt/Windows.Devices.Bluetooth.Advertisement.h"
namespace location {
namespace nearby {
namespace windows {
@@ -120,7 +119,6 @@ class BleMedium : public api::BleMedium {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_BLE_MEDIUM_H_
@@ -25,7 +25,6 @@
#include "internal/platform/implementation/windows/ble.h"
#include "internal/platform/implementation/windows/bluetooth_adapter.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -308,4 +307,3 @@ TEST(BleMedium, DISABLED_StopScanning) {
} // namespace
} // namespace windows
} // namespace nearby
} // namespace location
@@ -19,7 +19,6 @@
#include "internal/platform/implementation/ble.h"
namespace location {
namespace nearby {
namespace windows {
@@ -57,6 +56,5 @@ class BlePeripheral : public api::BlePeripheral {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_BLE_PERIPHERAL_H_
@@ -17,7 +17,6 @@
#include "absl/synchronization/mutex.h"
#include "internal/platform/implementation/ble.h"
namespace location {
namespace nearby {
namespace windows {
@@ -46,4 +45,3 @@ BlePeripheral* BleSocket::GetRemotePeripheral() {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -21,7 +21,6 @@
#include "internal/platform/input_stream.h"
#include "internal/platform/output_stream.h"
namespace location {
namespace nearby {
namespace windows {
@@ -78,6 +77,5 @@ class BleSocket : public api::BleSocket {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_BLE_SOCKET_H_
@@ -25,19 +25,18 @@
#include "winrt/Windows.Devices.Bluetooth.h"
#include "winrt/Windows.Foundation.Collections.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
using ::location::nearby::api::ble_v2::AdvertiseParameters;
using ::location::nearby::api::ble_v2::BleAdvertisementData;
using ::location::nearby::api::ble_v2::BleServerSocket;
using ::location::nearby::api::ble_v2::BleSocket;
using ::location::nearby::api::ble_v2::GattClient;
using ::location::nearby::api::ble_v2::ServerGattConnectionCallback;
using ::location::nearby::api::ble_v2::TxPowerLevel;
using ::nearby::api::ble_v2::AdvertiseParameters;
using ::nearby::api::ble_v2::BleAdvertisementData;
using ::nearby::api::ble_v2::BleServerSocket;
using ::nearby::api::ble_v2::BleSocket;
using ::nearby::api::ble_v2::GattClient;
using ::nearby::api::ble_v2::ServerGattConnectionCallback;
using ::nearby::api::ble_v2::TxPowerLevel;
using ::winrt::Windows::Devices::Bluetooth::BluetoothError;
using ::winrt::Windows::Devices::Bluetooth::Advertisement::
BluetoothLEAdvertisement;
@@ -444,4 +443,3 @@ void BleV2Medium::AdvertisementReceivedHandler(
} // namespace windows
} // namespace nearby
} // namespace location
@@ -28,7 +28,6 @@
#include "internal/platform/output_stream.h"
#include "winrt/Windows.Devices.Bluetooth.Advertisement.h"
namespace location {
namespace nearby {
namespace windows {
@@ -132,6 +131,5 @@ class BleV2Medium : public api::ble_v2::BleMedium {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_BLE_V2_H_
@@ -21,7 +21,6 @@
#include "internal/platform/implementation/ble_v2.h"
#include "internal/platform/implementation/windows/bluetooth_adapter.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -94,4 +93,3 @@ TEST(BleV2Medium, DISABLED_StopScanning) {
} // namespace
} // namespace windows
} // namespace nearby
} // namespace location
@@ -45,7 +45,6 @@ typedef std::basic_string<TCHAR> tstring;
#define BLUETOOTH_RADIO_REGISTRY_NAME_KEY "Local Name"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -199,12 +198,10 @@ void BluetoothAdapter::RestoreRadioNameIfNecessary() {
std::string settings_path(kLocalSettingsFileName);
auto full_path =
location::nearby::api::ImplementationPlatform::GetAppDataPath(
settings_path);
nearby::api::ImplementationPlatform::GetAppDataPath(settings_path);
auto settings_file =
location::nearby::api::ImplementationPlatform::CreateInputFile(full_path,
0);
nearby::api::ImplementationPlatform::CreateInputFile(full_path, 0);
if (settings_file == nullptr) {
return;
}
@@ -245,12 +242,10 @@ void BluetoothAdapter::StoreRadioNames(absl::string_view original_radio_name,
std::string settings_path(kLocalSettingsFileName);
auto full_path =
location::nearby::api::ImplementationPlatform::GetAppDataPath(
settings_path);
nearby::api::ImplementationPlatform::GetAppDataPath(settings_path);
auto settings_file =
location::nearby::api::ImplementationPlatform::CreateOutputFile(
full_path);
nearby::api::ImplementationPlatform::CreateOutputFile(full_path);
if (settings_file == nullptr) {
return;
@@ -760,4 +755,3 @@ std::string BluetoothAdapter::GetNameFromComputerName() const {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -27,7 +27,6 @@
#include "internal/platform/implementation/windows/generated/winrt/Windows.Devices.Radios.h"
#include "internal/platform/implementation/windows/generated/winrt/base.h"
namespace location {
namespace nearby {
namespace windows {
@@ -119,6 +118,5 @@ class BluetoothAdapter : public api::BluetoothAdapter {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_BLUETOOTH_ADAPTER_H_
@@ -21,7 +21,6 @@
#include "absl/synchronization/notification.h"
#include "internal/platform/implementation/bluetooth_adapter.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -194,4 +193,3 @@ TEST(BluetoothAdapter, DISABLED_GetNameFromComputerName) {
} // namespace
} // namespace windows
} // namespace nearby
} // namespace location
@@ -30,7 +30,6 @@
#include "internal/platform/implementation/windows/utils.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
@@ -134,4 +133,3 @@ RfcommDeviceService BluetoothDevice::GetRfcommServiceForIdAsync(
} // namespace windows
} // namespace nearby
} // namespace location
@@ -28,7 +28,6 @@
#include "internal/platform/input_stream.h"
#include "internal/platform/output_stream.h"
namespace location {
namespace nearby {
namespace windows {
@@ -97,6 +96,5 @@ class BluetoothDevice : public api::BluetoothDevice {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_BLUETOOTH_CLASSIC_DEVICE_H_
@@ -42,7 +42,6 @@
#include "internal/platform/implementation/windows/wifi_lan.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -309,7 +308,7 @@ std::unique_ptr<api::BluetoothSocket> BluetoothClassicMedium::ConnectToService(
<< winrt::to_string(device_id) << ", service: " << service_uuid;
return nullptr;
}
location::nearby::CancellationFlagListener cancellation_flag_listener(
nearby::CancellationFlagListener cancellation_flag_listener(
cancellation_flag, [&rfcomm_socket]() {
rfcomm_socket->CancelIOAsync().get();
rfcomm_socket->Close();
@@ -800,4 +799,3 @@ bool BluetoothClassicMedium::InitializeServiceSdpAttributes(
} // namespace windows
} // namespace nearby
} // namespace location
@@ -28,7 +28,6 @@
#include "internal/platform/implementation/windows/generated/winrt/Windows.Networking.Sockets.h"
#include "internal/platform/implementation/windows/generated/winrt/base.h"
namespace location {
namespace nearby {
namespace windows {
@@ -209,6 +208,5 @@ class BluetoothClassicMedium : public api::BluetoothClassicMedium {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_BLUETOOTH_CLASSIC_MEDIUM_H_
@@ -35,19 +35,16 @@
// STOP/HANG AND IS INTENDED SOLELY FOR DEBUG AND DEMONSTRATION PURPOSES. DO NOT
// ATTEMPT TO BUILD AND RUN THIS TEST ON GOOGLE3 YOU HAVE BEEN WARNED
using ::location::nearby::windows::BluetoothDevice;
using ::nearby::windows::BluetoothDevice;
typedef std::map<const std::string, location::nearby::api::BluetoothDevice*>
DeviceMap;
typedef std::map<const std::string, nearby::api::BluetoothDevice*> DeviceMap;
class BluetoothClassicMediumTests : public testing::Test {
protected:
static void device_discovered_cb(
location::nearby::api::BluetoothDevice& device) {
static void device_discovered_cb(nearby::api::BluetoothDevice& device) {
const std::string address = device.GetMacAddress();
std::map<std::string,
location::nearby::api::BluetoothDevice*>::const_iterator it =
std::map<std::string, nearby::api::BluetoothDevice*>::const_iterator it =
deviceList.find(address);
std::string buffer =
@@ -63,10 +60,9 @@ class BluetoothClassicMediumTests : public testing::Test {
}
}
static void device_name_changed_cb(
location::nearby::api::BluetoothDevice& device) {}
static void device_name_changed_cb(nearby::api::BluetoothDevice& device) {}
static void device_lost_cb(location::nearby::api::BluetoothDevice& device) {
static void device_lost_cb(nearby::api::BluetoothDevice& device) {
deviceList.erase(device.GetMacAddress());
}
@@ -76,7 +72,7 @@ class BluetoothClassicMediumTests : public testing::Test {
#ifdef TESTING_LOCALLY
TEST_F(BluetoothClassicMediumTests, ManualTest) {
auto bluetoothAdapter = location::nearby::windows::BluetoothAdapter();
auto bluetoothAdapter = nearby::windows::BluetoothAdapter();
std::string bluetoothAdapterName = bluetoothAdapter.GetName();
bluetoothAdapter.SetName("BluetoothTestName");
@@ -84,21 +80,20 @@ TEST_F(BluetoothClassicMediumTests, ManualTest) {
bluetoothAdapter.SetName("");
bluetoothAdapterName = bluetoothAdapter.GetName();
std::unique_ptr<location::nearby::windows::BluetoothClassicMedium> bcm =
std::make_unique<location::nearby::windows::BluetoothClassicMedium>(
std::unique_ptr<nearby::windows::BluetoothClassicMedium> bcm =
std::make_unique<nearby::windows::BluetoothClassicMedium>(
bluetoothAdapter);
bluetoothAdapter.SetScanMode(location::nearby::windows::BluetoothAdapter::
ScanMode::kConnectableDiscoverable);
bluetoothAdapter.SetScanMode(
nearby::windows::BluetoothAdapter::ScanMode::kConnectableDiscoverable);
auto mode = bluetoothAdapter.GetScanMode();
bcm->StartDiscovery(
location::nearby::api::BluetoothClassicMedium::DiscoveryCallback{
.device_discovered_cb = device_discovered_cb,
.device_name_changed_cb = device_name_changed_cb,
.device_lost_cb = device_lost_cb,
});
bcm->StartDiscovery(nearby::api::BluetoothClassicMedium::DiscoveryCallback{
.device_discovered_cb = device_discovered_cb,
.device_name_changed_cb = device_name_changed_cb,
.device_lost_cb = device_lost_cb,
});
Sleep(30000);
@@ -107,7 +102,7 @@ TEST_F(BluetoothClassicMediumTests, ManualTest) {
winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommServiceId::SerialPort()
.AsString());
location::nearby::CancellationFlag cancellationFlag;
nearby::CancellationFlag cancellationFlag;
bcm->ConnectToService(*currentDevice,
// "a82efa21-ae5c-3dde-9bbc-f16da7b16c5a",
"00001101-0000-1000-8000-00805F9B34FB",
@@ -119,17 +114,16 @@ TEST_F(BluetoothClassicMediumTests, ManualTest) {
#endif
TEST_F(BluetoothClassicMediumTests, ConnectToServiceNullUuid) {
// Arrange
auto bluetoothAdapter = location::nearby::windows::BluetoothAdapter();
auto bluetoothAdapter = nearby::windows::BluetoothAdapter();
std::unique_ptr<location::nearby::windows::BluetoothClassicMedium>
std::unique_ptr<nearby::windows::BluetoothClassicMedium>
bluetoothClassicMedium =
std::make_unique<location::nearby::windows::BluetoothClassicMedium>(
std::make_unique<nearby::windows::BluetoothClassicMedium>(
bluetoothAdapter);
location::nearby::windows::BluetoothDevice bluetoothDevice =
location::nearby::windows::BluetoothDevice(
std::string("1D:EA:DB:EE:B9:00"));
location::nearby::CancellationFlag cancellationFlag;
nearby::windows::BluetoothDevice bluetoothDevice =
nearby::windows::BluetoothDevice(std::string("1D:EA:DB:EE:B9:00"));
nearby::CancellationFlag cancellationFlag;
auto bluetoothClassicMediumImpl = bluetoothClassicMedium.get();
@@ -143,16 +137,15 @@ TEST_F(BluetoothClassicMediumTests, ConnectToServiceNullUuid) {
TEST_F(BluetoothClassicMediumTests, ConnectToServiceNullCancellationFlag) {
// Arrange
auto bluetoothAdapter = location::nearby::windows::BluetoothAdapter();
auto bluetoothAdapter = nearby::windows::BluetoothAdapter();
std::unique_ptr<location::nearby::windows::BluetoothClassicMedium>
std::unique_ptr<nearby::windows::BluetoothClassicMedium>
bluetoothClassicMedium =
std::make_unique<location::nearby::windows::BluetoothClassicMedium>(
std::make_unique<nearby::windows::BluetoothClassicMedium>(
bluetoothAdapter);
location::nearby::windows::BluetoothDevice bluetoothDevice =
location::nearby::windows::BluetoothDevice(
std::string("1D:EA:DB:EE:B9:00"));
nearby::windows::BluetoothDevice bluetoothDevice =
nearby::windows::BluetoothDevice(std::string("1D:EA:DB:EE:B9:00"));
auto bluetoothClassicMediumImpl = bluetoothClassicMedium.get();
@@ -166,17 +159,16 @@ TEST_F(BluetoothClassicMediumTests, ConnectToServiceNullCancellationFlag) {
TEST_F(BluetoothClassicMediumTests, ConnectToServiceWithInvalidServiceUuid) {
// Arrange
auto bluetoothAdapter = location::nearby::windows::BluetoothAdapter();
auto bluetoothAdapter = nearby::windows::BluetoothAdapter();
std::unique_ptr<location::nearby::windows::BluetoothClassicMedium>
std::unique_ptr<nearby::windows::BluetoothClassicMedium>
bluetoothClassicMedium =
std::make_unique<location::nearby::windows::BluetoothClassicMedium>(
std::make_unique<nearby::windows::BluetoothClassicMedium>(
bluetoothAdapter);
location::nearby::windows::BluetoothDevice bluetoothDevice =
location::nearby::windows::BluetoothDevice(
std::string("1D:EA:DB:EE:B9:00"));
location::nearby::CancellationFlag cancellationFlag;
nearby::windows::BluetoothDevice bluetoothDevice =
nearby::windows::BluetoothDevice(std::string("1D:EA:DB:EE:B9:00"));
nearby::CancellationFlag cancellationFlag;
auto bluetoothClassicMediumImpl = bluetoothClassicMedium.get();
@@ -25,7 +25,6 @@
#include "internal/platform/implementation/windows/bluetooth_classic_socket.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
@@ -158,4 +157,3 @@ bool BluetoothServerSocket::listen() {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -28,7 +28,6 @@
#include "internal/platform/implementation/windows/bluetooth_classic_socket.h"
#include "internal/platform/implementation/windows/generated/winrt/base.h"
namespace location {
namespace nearby {
namespace windows {
@@ -111,5 +110,5 @@ class BluetoothServerSocket : public api::BluetoothServerSocket {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_BLUETOOTH_CLASSIC_SERVER_SOCKET_H_
@@ -21,7 +21,6 @@
#include "internal/platform/implementation/windows/generated/winrt/base.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
@@ -277,4 +276,3 @@ Exception BluetoothSocket::BluetoothOutputStream::Close() {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -23,7 +23,6 @@
#include "internal/platform/implementation/windows/generated/winrt/Windows.Networking.Sockets.h"
#include "internal/platform/implementation/windows/generated/winrt/Windows.Storage.Streams.h"
namespace location {
namespace nearby {
namespace windows {
@@ -137,6 +136,5 @@ class BluetoothSocket : public api::BluetoothSocket {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_BLUETOOTH_CLASSIC_SOCKET_H_
@@ -19,7 +19,6 @@
#include "winrt/Windows.Foundation.Collections.h"
#include "winrt/base.h"
namespace location {
namespace nearby {
namespace windows {
@@ -115,4 +114,3 @@ void BluetoothPairing::OnPair(DevicePairingResult& pairing_result) {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -21,7 +21,6 @@
#include "winrt/Windows.Devices.Enumeration.h"
namespace location {
namespace nearby {
namespace windows {
@@ -56,6 +55,5 @@ class BluetoothPairing {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_BLUETOOTH_PAIRING_H_
@@ -23,7 +23,6 @@
#include "internal/platform/implementation/windows/mutex.h"
#include "internal/platform/mutex.h"
namespace location {
namespace nearby {
namespace windows {
@@ -51,5 +50,5 @@ class ConditionVariable : public api::ConditionVariable {
};
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_CONDITION_VARIABLE_H_
@@ -37,7 +37,7 @@ class ConditionVariableTests : public testing::Test {
if (timedWait == true) {
auto result = this->condition_variable_actual_.Wait(*timeout);
if (result.value == location::nearby::Exception::kSuccess) {
if (result.value == nearby::Exception::kSuccess) {
return true;
} else {
return false;
@@ -55,13 +55,12 @@ class ConditionVariableTests : public testing::Test {
}
private:
location::nearby::windows::Mutex mutex_actual_ =
location::nearby::windows::Mutex(
location::nearby::windows::Mutex::Mode::kRegular);
location::nearby::windows::Mutex& mutex_ = mutex_actual_;
location::nearby::windows::ConditionVariable condition_variable_actual_ =
location::nearby::windows::ConditionVariable(&mutex_);
location::nearby::windows::ConditionVariable& condition_variable_ =
nearby::windows::Mutex mutex_actual_ =
nearby::windows::Mutex(nearby::windows::Mutex::Mode::kRegular);
nearby::windows::Mutex& mutex_ = mutex_actual_;
nearby::windows::ConditionVariable condition_variable_actual_ =
nearby::windows::ConditionVariable(&mutex_);
nearby::windows::ConditionVariable& condition_variable_ =
condition_variable_actual_;
};
};
@@ -23,7 +23,7 @@ class CountDownLatchTests : public testing::Test {
public:
class TestData {
public:
std::unique_ptr<location::nearby::api::CountDownLatch>& countDownLatch;
std::unique_ptr<nearby::api::CountDownLatch>& countDownLatch;
LONG volatile& count;
};
@@ -58,8 +58,8 @@ TEST_F(CountDownLatchTests, CountDownLatchAwaitSucceeds) {
// Arrange
LONG volatile count = 0;
std::unique_ptr<location::nearby::api::CountDownLatch> countDownLatch =
location::nearby::api::ImplementationPlatform::CreateCountDownLatch(3);
std::unique_ptr<nearby::api::CountDownLatch> countDownLatch =
nearby::api::ImplementationPlatform::CreateCountDownLatch(3);
HANDLE hThreads[3];
DWORD dwThreadID;
@@ -83,11 +83,11 @@ TEST_F(CountDownLatchTests, CountDownLatchAwaitSucceeds) {
}
// Act
location::nearby::Exception result = countDownLatch->Await();
nearby::Exception result = countDownLatch->Await();
//
// Assert
EXPECT_EQ(result.value, location::nearby::Exception::kSuccess);
EXPECT_EQ(result.value, nearby::Exception::kSuccess);
EXPECT_EQ(count, 3);
}
@@ -95,11 +95,11 @@ TEST_F(CountDownLatchTests, CountDownLatchAwaitTimeoutTimesOut) {
// Arrange
LONG volatile count = 0;
std::unique_ptr<location::nearby::api::CountDownLatch> countDownLatch =
location::nearby::api::ImplementationPlatform::CreateCountDownLatch(3);
std::unique_ptr<nearby::api::CountDownLatch> countDownLatch =
nearby::api::ImplementationPlatform::CreateCountDownLatch(3);
// Act
location::nearby::ExceptionOr<bool> result =
nearby::ExceptionOr<bool> result =
countDownLatch->Await(absl::Milliseconds(5));
Sleep(40);
@@ -109,15 +109,15 @@ TEST_F(CountDownLatchTests, CountDownLatchAwaitTimeoutTimesOut) {
// TODO(jfcarroll)I think there's a bug in the shared version of this, it's
// not returning a timeout exception, need to look at it some more.
// EXPECT_EQ(result.GetException().value,
// location::nearby::Exception::kTimeout);
// nearby::Exception::kTimeout);
}
TEST_F(CountDownLatchTests, CountDownLatchAwaitNoTimeoutSucceeds) {
// Arrange
LONG volatile count = 0;
std::unique_ptr<location::nearby::api::CountDownLatch> countDownLatch =
location::nearby::api::ImplementationPlatform::CreateCountDownLatch(3);
std::unique_ptr<nearby::api::CountDownLatch> countDownLatch =
nearby::api::ImplementationPlatform::CreateCountDownLatch(3);
TestData testData{countDownLatch, count};
@@ -142,20 +142,20 @@ TEST_F(CountDownLatchTests, CountDownLatchAwaitNoTimeoutSucceeds) {
WaitForMultipleObjects(3, hThreads, true, INFINITE);
// Act
location::nearby::ExceptionOr<bool> result =
nearby::ExceptionOr<bool> result =
countDownLatch->Await(absl::Milliseconds(100));
// Assert
EXPECT_TRUE(result.GetResult());
EXPECT_EQ(result.GetException().value, location::nearby::Exception::kSuccess);
EXPECT_EQ(result.GetException().value, nearby::Exception::kSuccess);
EXPECT_EQ(count, 3);
}
TEST_F(CountDownLatchTests, CountDownLatchCountDownBeforeAwaitSucceeds) {
// Arrange
LONG volatile count = 0;
std::unique_ptr<location::nearby::api::CountDownLatch> countDownLatch =
location::nearby::api::ImplementationPlatform::CreateCountDownLatch(1);
std::unique_ptr<nearby::api::CountDownLatch> countDownLatch =
nearby::api::ImplementationPlatform::CreateCountDownLatch(1);
HANDLE hThread;
DWORD dwThreadID;
@@ -26,7 +26,7 @@
#endif
// Function implementations for platform/api/crypto.h.
namespace location {
namespace nearby {
// Initialize global crypto state.
@@ -55,4 +55,3 @@ ByteArray Crypto::Sha256(absl::string_view input) {
}
} // namespace nearby
} // namespace location
@@ -18,7 +18,6 @@
#include "gtest/gtest.h"
namespace location {
namespace nearby {
namespace {
@@ -49,4 +48,3 @@ TEST(CryptoTest, Sha256HashOnEmptyInput) {
} // namespace
} // namespace nearby
} // namespace location
@@ -18,7 +18,6 @@
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
@@ -54,4 +53,3 @@ void Executor::Shutdown() {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -20,7 +20,6 @@
#include "internal/platform/implementation/executor.h"
#include "internal/platform/implementation/windows/thread_pool.h"
namespace location {
namespace nearby {
namespace windows {
@@ -46,6 +45,5 @@ class Executor : public api::Executor {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_EXECUTOR_H_
@@ -24,7 +24,6 @@
#include "absl/time/time.h"
#include "internal/platform/implementation/windows/test_data.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -321,4 +320,3 @@ TEST(ExecutorTests,
} // namespace
} // namespace windows
} // namespace nearby
} // namespace location
@@ -25,7 +25,6 @@
#include "internal/platform/exception.h"
#include "internal/platform/implementation/windows/utils.h"
namespace location {
namespace nearby {
namespace windows {
@@ -108,4 +107,3 @@ Exception IOFile::Flush() {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -25,7 +25,6 @@
#include "internal/platform/implementation/input_file.h"
#include "internal/platform/implementation/output_file.h"
namespace location {
namespace nearby {
namespace windows {
@@ -57,6 +56,5 @@ class IOFile final : public api::InputFile, public api::OutputFile {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_FILE_H_
@@ -34,7 +34,6 @@
#include "internal/platform/implementation/windows/utils.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
@@ -268,4 +267,3 @@ void FilePath::ReplaceInvalidCharacters(std::wstring& path) {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -19,7 +19,6 @@
#include "absl/strings/string_view.h"
namespace location {
namespace nearby {
namespace windows {
@@ -46,6 +45,5 @@ class FilePath {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_FILE_PATH_H_
@@ -26,7 +26,6 @@
#include "gtest/gtest.h"
namespace location {
namespace nearby {
namespace windows {
@@ -855,4 +854,3 @@ AHoleBetweenRenamedFiles) {
}
} // namespace windows
} // namespace nearby
} // namespace location
@@ -17,7 +17,6 @@
#include "internal/platform/implementation/future.h"
namespace location {
namespace nearby {
namespace windows {
@@ -45,6 +44,5 @@ class Future : public api::Future<T> {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_FUTURE_H_
@@ -24,7 +24,6 @@
#include "absl/strings/str_cat.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -32,7 +31,7 @@ namespace {
constexpr DWORD kSchemaMaximumLength = 10;
constexpr DWORD kHostNameMaximumLength = 256;
using ::location::nearby::api::WebResponse;
using ::nearby::api::WebResponse;
} // namespace
@@ -410,4 +409,3 @@ absl::Status HttpLoader::HTTPCodeToStatus(int status_code,
} // namespace windows
} // namespace nearby
} // namespace location
@@ -25,7 +25,6 @@
#include "absl/strings/string_view.h"
#include "internal/platform/implementation/http_loader.h"
namespace location {
namespace nearby {
namespace windows {
@@ -35,11 +34,11 @@ namespace windows {
// WinInet APIs to get HTTP response. The platform handles HTTP/HTTPS sessions.
class HttpLoader {
public:
explicit HttpLoader(const location::nearby::api::WebRequest& request)
explicit HttpLoader(const nearby::api::WebRequest& request)
: request_(request) {}
~HttpLoader() = default;
absl::StatusOr<location::nearby::api::WebResponse> GetResponse();
absl::StatusOr<nearby::api::WebResponse> GetResponse();
private:
// Defines the buffer size. It is used to init a buffer for receiving HTTP
@@ -48,7 +47,7 @@ class HttpLoader {
absl::Status ConnectWebServer();
absl::Status SendRequest();
absl::StatusOr<location::nearby::api::WebResponse> ProcessResponse();
absl::StatusOr<nearby::api::WebResponse> ProcessResponse();
void DisconnectWebServer();
absl::StatusOr<int> QueryStatusCode(HINTERNET file_handle);
@@ -68,7 +67,7 @@ class HttpLoader {
absl::Status HTTPCodeToStatus(int status_code,
absl::string_view status_message);
location::nearby::api::WebRequest request_;
nearby::api::WebRequest request_;
std::string host_;
std::string path_;
std::string schema_;
@@ -82,6 +81,5 @@ class HttpLoader {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_HTTP_LOADER_H_
@@ -18,11 +18,10 @@
#include "gtest/gtest.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
using ::location::nearby::api::WebRequest;
using ::nearby::api::WebRequest;
TEST(HttpLoader, DISABLED_TestGetUrl) {
WebRequest request;
@@ -50,4 +49,3 @@ TEST(HttpLoader, DISABLED_TestInvalidUrl) {
} // namespace
} // namespace windows
} // namespace nearby
} // namespace location
@@ -19,7 +19,6 @@
#include "internal/platform/byte_array.h"
#include "internal/platform/exception.h"
namespace location {
namespace nearby {
namespace windows {
@@ -45,6 +44,5 @@ class InputFile : public api::InputFile {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_INPUT_FILE_H_
@@ -24,7 +24,7 @@ class InputFileTests : public testing::Test {
protected:
// You can define per-test set-up logic as usual.
void SetUp() override {
location::nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
auto path = test_utils::GetPayloadPath(payloadId);
hFile_ = CreateFileA(path.c_str(), // name of the write
@@ -52,7 +52,7 @@ class InputFileTests : public testing::Test {
// You can define per-test tear-down logic as usual.
void TearDown() override {
location::nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
if (FileExists(test_utils::GetPayloadPath(payloadId).c_str())) {
DeleteFileA(test_utils::GetPayloadPath(payloadId).c_str());
}
@@ -70,71 +70,67 @@ class InputFileTests : public testing::Test {
};
TEST_F(InputFileTests, SuccessfulCreation) {
location::nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
std::unique_ptr<location::nearby::api::InputFile> inputFile = nullptr;
nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
std::unique_ptr<nearby::api::InputFile> inputFile = nullptr;
inputFile = location::nearby::api::ImplementationPlatform::CreateInputFile(
inputFile = nearby::api::ImplementationPlatform::CreateInputFile(
payloadId, strlen(TEST_STRING));
EXPECT_NE(inputFile, nullptr);
EXPECT_EQ(inputFile->Close(),
location::nearby::Exception{location::nearby::Exception::kSuccess});
EXPECT_EQ(inputFile->Close(), nearby::Exception{nearby::Exception::kSuccess});
}
TEST_F(InputFileTests, SuccessfulGetFilePath) {
location::nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
std::unique_ptr<location::nearby::api::InputFile> inputFile = nullptr;
nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
std::unique_ptr<nearby::api::InputFile> inputFile = nullptr;
std::string fileName;
inputFile = location::nearby::api::ImplementationPlatform::CreateInputFile(
inputFile = nearby::api::ImplementationPlatform::CreateInputFile(
payloadId, strlen(TEST_STRING));
fileName = inputFile->GetFilePath();
EXPECT_EQ(inputFile->Close(),
location::nearby::Exception{location::nearby::Exception::kSuccess});
EXPECT_EQ(inputFile->Close(), nearby::Exception{nearby::Exception::kSuccess});
EXPECT_EQ(fileName, test_utils::GetPayloadPath(payloadId).c_str());
}
TEST_F(InputFileTests, SuccessfulGetTotalSize) {
location::nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
std::unique_ptr<location::nearby::api::InputFile> inputFile = nullptr;
nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
std::unique_ptr<nearby::api::InputFile> inputFile = nullptr;
int64_t size = -1;
inputFile = location::nearby::api::ImplementationPlatform::CreateInputFile(
inputFile = nearby::api::ImplementationPlatform::CreateInputFile(
payloadId, strlen(TEST_STRING));
size = inputFile->GetTotalSize();
EXPECT_EQ(inputFile->Close(),
location::nearby::Exception{location::nearby::Exception::kSuccess});
EXPECT_EQ(inputFile->Close(), nearby::Exception{nearby::Exception::kSuccess});
EXPECT_EQ(size, strlen(TEST_STRING));
}
TEST_F(InputFileTests, SuccessfulRead) {
location::nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
std::unique_ptr<location::nearby::api::InputFile> inputFile = nullptr;
nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
std::unique_ptr<nearby::api::InputFile> inputFile = nullptr;
inputFile = location::nearby::api::ImplementationPlatform::CreateInputFile(
inputFile = nearby::api::ImplementationPlatform::CreateInputFile(
payloadId, strlen(TEST_STRING));
auto fileSize = inputFile->GetTotalSize();
auto dataRead = inputFile->Read(fileSize);
EXPECT_TRUE(dataRead.ok());
EXPECT_EQ(inputFile->Close(),
location::nearby::Exception{location::nearby::Exception::kSuccess});
EXPECT_EQ(inputFile->Close(), nearby::Exception{nearby::Exception::kSuccess});
EXPECT_STREQ(std::string(dataRead.result()).c_str(), TEST_STRING);
}
TEST_F(InputFileTests, FailedRead) {
location::nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
std::unique_ptr<location::nearby::api::InputFile> inputFile = nullptr;
nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
std::unique_ptr<nearby::api::InputFile> inputFile = nullptr;
inputFile = location::nearby::api::ImplementationPlatform::CreateInputFile(
inputFile = nearby::api::ImplementationPlatform::CreateInputFile(
payloadId, strlen(TEST_STRING));
auto fileSize = inputFile->GetTotalSize();
@@ -17,7 +17,6 @@
#include "internal/platform/implementation/listenable_future.h"
namespace location {
namespace nearby {
namespace windows {
@@ -36,6 +35,5 @@ class ListenableFuture : public api::ListenableFuture<T> {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_LISTENABLE_FUTURE_H_
@@ -19,7 +19,6 @@
// no "base" in OSS.
#include "base/stringprintf.h"
namespace location {
namespace nearby {
namespace windows {
@@ -71,4 +70,3 @@ bool LogMessage::ShouldCreateLogMessage(Severity severity) {
}
} // namespace api
} // namespace nearby
} // namespace location
@@ -18,7 +18,6 @@
#include "glog/logging.h"
#include "internal/platform/implementation/log_message.h"
namespace location {
namespace nearby {
namespace windows {
@@ -40,6 +39,5 @@ class LogMessage : public api::LogMessage {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_LOG_MESSAGE_H_
@@ -21,7 +21,6 @@
#include "internal/platform/implementation/windows/mediums_manager/mediums_manager.h"
namespace location {
namespace nearby {
namespace api {
@@ -33,6 +32,5 @@ class MediumsApi {
} // namespace api
} // namespace nearby
} // namespace location
#endif // THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_MEDIUMS_API_H_
@@ -20,7 +20,6 @@
#include "internal/platform/implementation/windows/mediums_manager/mediums_manager_impl.h"
namespace location {
namespace nearby {
namespace api {
@@ -30,4 +29,3 @@ std::unique_ptr<MediumsManager> MediumsApi::CreateMediumsManager() {
} // namespace api
} // namespace nearby
} // namespace location
@@ -20,7 +20,6 @@
#include "absl/strings/string_view.h"
#include "internal/platform/byte_array.h"
namespace location {
namespace nearby {
namespace api {
@@ -42,6 +41,5 @@ class MediumsManager {
} // namespace api
} // namespace nearby
} // namespace location
#endif // THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_MEDIUMS_MANAGER_MEDIUMS_MANAGER_H_
@@ -24,7 +24,6 @@
#include "winrt/Windows.Storage.Streams.h"
#include "winrt/base.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -287,4 +286,3 @@ void MediumsManager::PublisherHandler(
} // namespace windows
} // namespace nearby
} // namespace location
@@ -24,7 +24,6 @@
#include "internal/platform/implementation/windows/mediums_manager/mediums_manager.h"
#include "winrt/Windows.Devices.Bluetooth.Advertisement.h"
namespace location {
namespace nearby {
namespace windows {
@@ -55,6 +54,5 @@ class MediumsManager : public api::MediumsManager {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_MEDIUMS_MANAGER_MEDIUMS_MANAGER_IMPL_H_
@@ -23,7 +23,7 @@
#include "absl/memory/memory.h"
#include "absl/synchronization/mutex.h"
#include "internal/platform/implementation/mutex.h"
namespace location {
namespace nearby {
namespace windows {
@@ -68,5 +68,5 @@ class ABSL_LOCKABLE Mutex : public api::Mutex {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_MUTEX_H_
@@ -22,7 +22,7 @@ class MutexTests : public testing::Test {
public:
class MutexTest {
public:
MutexTest(location::nearby::windows::Mutex& mutex) : mutex_(mutex) {}
MutexTest(nearby::windows::Mutex& mutex) : mutex_(mutex) {}
std::future<bool> WaitForLock() { // NOLINT
return std::async(std::launch::async,
@@ -39,14 +39,14 @@ class MutexTests : public testing::Test {
}
private:
location::nearby::windows::Mutex& mutex_;
nearby::windows::Mutex& mutex_;
};
};
TEST_F(MutexTests, SuccessfulRecursiveCreation) {
// Arrange
location::nearby::windows::Mutex mutex = location::nearby::windows::Mutex(
location::nearby::windows::Mutex::Mode::kRecursive);
nearby::windows::Mutex mutex =
nearby::windows::Mutex(nearby::windows::Mutex::Mode::kRecursive);
// Act
std::recursive_mutex& actual = mutex.GetRecursiveMutex();
@@ -57,8 +57,7 @@ TEST_F(MutexTests, SuccessfulRecursiveCreation) {
TEST_F(MutexTests, SuccessfulCreation) {
// Arrange
location::nearby::windows::Mutex mutex(
location::nearby::windows::Mutex::Mode::kRegular);
nearby::windows::Mutex mutex(nearby::windows::Mutex::Mode::kRegular);
// Act
absl::Mutex& actual = mutex.GetMutex();
@@ -69,10 +68,9 @@ TEST_F(MutexTests, SuccessfulCreation) {
TEST_F(MutexTests, SuccessfulSignal) {
// Arrange
location::nearby::windows::Mutex mutex(
location::nearby::windows::Mutex::Mode::kRegular);
nearby::windows::Mutex mutex(nearby::windows::Mutex::Mode::kRegular);
location::nearby::windows::Mutex& mutexRef = mutex;
nearby::windows::Mutex& mutexRef = mutex;
MutexTest mutexTest(mutexRef);
mutex.Lock();
@@ -87,10 +85,9 @@ TEST_F(MutexTests, SuccessfulSignal) {
TEST_F(MutexTests, SuccessfulRecursiveSignal) {
// Arrange
location::nearby::windows::Mutex mutex(
location::nearby::windows::Mutex::Mode::kRecursive);
nearby::windows::Mutex mutex(nearby::windows::Mutex::Mode::kRecursive);
location::nearby::windows::Mutex& mutexRef = mutex;
nearby::windows::Mutex& mutexRef = mutex;
MutexTest mutexTest(mutexRef);
mutex.Lock();
@@ -19,7 +19,6 @@
#include "internal/platform/byte_array.h"
#include "internal/platform/exception.h"
namespace location {
namespace nearby {
namespace windows {
@@ -42,6 +41,5 @@ class OutputFile : public api::OutputFile {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_OUTPUT_FILE_H_
@@ -24,7 +24,7 @@ class OutputFileTests : public testing::Test {
protected:
// You can define per-test set-up logic as usual.
void SetUp() override {
location::nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
if (FileExists(test_utils::GetPayloadPath(payloadId).c_str())) {
DeleteFileA(test_utils::GetPayloadPath(payloadId).c_str());
}
@@ -32,7 +32,7 @@ class OutputFileTests : public testing::Test {
// You can define per-test tear-down logic as usual.
void TearDown() override {
location::nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
if (FileExists(test_utils::GetPayloadPath(payloadId).c_str())) {
DeleteFileA(test_utils::GetPayloadPath(payloadId).c_str());
}
@@ -47,26 +47,24 @@ class OutputFileTests : public testing::Test {
};
TEST_F(OutputFileTests, SuccessfulCreation) {
location::nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
std::unique_ptr<location::nearby::api::OutputFile> outputFile = nullptr;
nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
std::unique_ptr<nearby::api::OutputFile> outputFile = nullptr;
EXPECT_NO_THROW(
outputFile =
location::nearby::api::ImplementationPlatform::CreateOutputFile(
payloadId));
nearby::api::ImplementationPlatform::CreateOutputFile(payloadId));
EXPECT_NE(outputFile, nullptr);
EXPECT_NO_THROW(outputFile->Close());
}
TEST_F(OutputFileTests, SuccessfulClose) {
location::nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
std::unique_ptr<location::nearby::api::OutputFile> outputFile = nullptr;
nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
std::unique_ptr<nearby::api::OutputFile> outputFile = nullptr;
EXPECT_NO_THROW(
outputFile =
location::nearby::api::ImplementationPlatform::CreateOutputFile(
payloadId));
nearby::api::ImplementationPlatform::CreateOutputFile(payloadId));
EXPECT_NO_THROW(outputFile->Close());
@@ -74,14 +72,13 @@ TEST_F(OutputFileTests, SuccessfulClose) {
}
TEST_F(OutputFileTests, SuccessfulWrite) {
location::nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
location::nearby::ByteArray data(std::string(TEST_STRING));
std::unique_ptr<location::nearby::api::OutputFile> outputFile = nullptr;
nearby::PayloadId payloadId(TEST_PAYLOAD_ID);
nearby::ByteArray data(std::string(TEST_STRING));
std::unique_ptr<nearby::api::OutputFile> outputFile = nullptr;
EXPECT_NO_THROW(
outputFile =
location::nearby::api::ImplementationPlatform::CreateOutputFile(
payloadId));
nearby::api::ImplementationPlatform::CreateOutputFile(payloadId));
EXPECT_NO_THROW(outputFile->Write(data));
EXPECT_NO_THROW(outputFile->Close());
@@ -63,7 +63,6 @@
#include "internal/platform/implementation/windows/wifi_lan.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace api {
@@ -310,4 +309,3 @@ absl::StatusOr<WebResponse> ImplementationPlatform::SendRequest(
} // namespace api
} // namespace nearby
} // namespace location
@@ -23,7 +23,6 @@
#include "absl/time/time.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
@@ -83,4 +82,3 @@ void ScheduledExecutor::Shutdown() {
}
} // namespace windows
} // namespace nearby
} // namespace location
@@ -27,7 +27,6 @@
#include "internal/platform/implementation/scheduled_executor.h"
#include "internal/platform/implementation/windows/executor.h"
namespace location {
namespace nearby {
namespace windows {
@@ -99,6 +98,5 @@ class ScheduledExecutor : public api::ScheduledExecutor {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_SCHEDULED_EXECUTOR_H_
@@ -23,7 +23,6 @@
#include "absl/time/time.h"
#include "internal/platform/implementation/windows/test_data.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -178,4 +177,3 @@ TEST(ScheduledExecutorTests, CancelAfterStartedFails) {
} // namespace
} // namespace windows
} // namespace nearby
} // namespace location
@@ -17,7 +17,6 @@
#include "internal/platform/implementation/server_sync.h"
namespace location {
namespace nearby {
namespace windows {
@@ -85,6 +84,5 @@ class ServerSyncMedium : public api::ServerSyncMedium {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_SERVER_SYNC_H_
@@ -17,7 +17,6 @@
#include "internal/platform/implementation/settable_future.h"
namespace location {
namespace nearby {
namespace windows {
@@ -46,6 +45,5 @@ class SettableFuture : public api::SettableFuture<T> {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_SETTABLE_FUTURE_H_
@@ -17,7 +17,6 @@
#include "internal/platform/implementation/windows/executor.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
@@ -62,4 +61,3 @@ void SubmittableExecutor::Shutdown() {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -18,7 +18,6 @@
#include "internal/platform/implementation/submittable_executor.h"
#include "internal/platform/implementation/windows/executor.h"
namespace location {
namespace nearby {
namespace windows {
@@ -50,6 +49,5 @@ class SubmittableExecutor : public api::SubmittableExecutor {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_SUBMITTABLE_EXECUTOR_H_
@@ -22,7 +22,6 @@
#include "absl/time/time.h"
#include "internal/platform/implementation/windows/test_data.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -248,4 +247,3 @@ TEST(SubmittableExecutorTests, SingleThreadedDoSubmitMultipleTasksSucceeds) {
} // namespace
} // namespace windows
} // namespace nearby
} // namespace location
@@ -17,7 +17,6 @@
#include "internal/platform/implementation/system_clock.h"
namespace location {
namespace nearby {
// Initialize global system state.
@@ -38,6 +37,5 @@ Exception SystemClock::Sleep(absl::Duration duration) {
}
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_SYSTEM_CLOCK_H_
@@ -34,7 +34,7 @@ std::wstring StringToWideString(const std::string& s) {
return r;
}
std::string GetPayloadPath(location::nearby::PayloadId payload_id) {
std::string GetPayloadPath(nearby::PayloadId payload_id) {
PWSTR basePath;
// Retrieves the full path of a known folder identified by the folder's
@@ -37,7 +37,7 @@
namespace test_utils {
std::wstring StringToWideString(const std::string& s);
std::string GetPayloadPath(location::nearby::PayloadId payload_id);
std::string GetPayloadPath(nearby::PayloadId payload_id);
} // namespace test_utils
#endif // PLATFORM_IMPL_WINDOWS_TEST_UTILS_H_
@@ -24,7 +24,6 @@
#include "internal/platform/logging.h"
#include "internal/platform/runnable.h"
namespace location {
namespace nearby {
namespace windows {
@@ -163,4 +162,3 @@ void ThreadPool::RunNextTask() {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -23,7 +23,6 @@
#include "absl/synchronization/mutex.h"
#include "internal/platform/runnable.h"
namespace location {
namespace nearby {
namespace windows {
@@ -70,6 +69,5 @@ class ThreadPool {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_THREAD_POOL_H_
@@ -23,7 +23,6 @@
#include "absl/time/clock.h"
#include "absl/time/time.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -71,4 +70,3 @@ TEST(ThreadPool, TasksInMultipleThreadsRunInParallel) {
} // namespace
} // namespace windows
} // namespace nearby
} // namespace location
@@ -40,7 +40,6 @@
#include "internal/platform/implementation/windows/generated/winrt/Windows.Foundation.Collections.h"
#include "internal/platform/implementation/windows/generated/winrt/Windows.Networking.Connectivity.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -124,7 +123,7 @@ std::vector<std::string> GetIpv4Addresses() {
}
ByteArray Sha256(absl::string_view input, size_t size) {
ByteArray hash = location::nearby::Crypto::Sha256(input);
ByteArray hash = nearby::Crypto::Sha256(input);
return ByteArray{hash.data(), size};
}
@@ -228,4 +227,3 @@ std::vector<std::string> InspectableReader::ReadStringArray(
} // namespace windows
} // namespace nearby
} // namespace location
@@ -27,7 +27,6 @@
#include "internal/platform/implementation/windows/generated/winrt/Windows.Foundation.h"
#include "internal/platform/implementation/windows/generated/winrt/base.h"
namespace location {
namespace nearby {
namespace windows {
@@ -70,6 +69,5 @@ class InspectableReader {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_UTILS_H_
@@ -19,8 +19,8 @@
#include "gtest/gtest.h"
// using ::location::nearby::windows::uint64_to_mac_address_string;
namespace location {
// using ::nearby::windows::uint64_to_mac_address_string;
namespace nearby {
namespace windows {
@@ -68,4 +68,3 @@ TEST(UtilsTests, IpDotdecimalTo4Bytes) {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -17,7 +17,6 @@
#include "internal/platform/implementation/webrtc.h"
namespace location {
namespace nearby {
namespace windows {
@@ -66,13 +65,13 @@ class WebRtcMedium : public api::WebRtcMedium {
// TODO(b/184975123): replace with real implementation.
std::unique_ptr<api::WebRtcSignalingMessenger> GetSignalingMessenger(
absl::string_view self_id,
const connections::LocationHint& location_hint) override {
const location::nearby::connections::LocationHint& location_hint)
override {
return nullptr;
}
};
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_WEBRTC_H_
@@ -29,7 +29,6 @@
#include "internal/platform/implementation/windows/generated/winrt/Windows.Foundation.h"
#include "internal/platform/implementation/windows/generated/winrt/Windows.Networking.Connectivity.h"
namespace location {
namespace nearby {
namespace windows {
@@ -126,6 +125,5 @@ class WifiMedium : public api::WifiMedium {
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_WIFI_H_
@@ -50,7 +50,6 @@
#include "internal/platform/implementation/windows/generated/winrt/Windows.Storage.Streams.h"
#include "internal/platform/implementation/windows/generated/winrt/base.h"
namespace location {
namespace nearby {
namespace windows {
@@ -318,12 +317,11 @@ class WifiDirectMedium : public api::WifiDirectMedium {
std::shared_ptr<api::Cancelable> connection_timeout_ = nullptr;
// Listener to connect cancellation.
std::unique_ptr<location::nearby::CancellationFlagListener>
std::unique_ptr<nearby::CancellationFlagListener>
connection_cancellation_listener_ = nullptr;
};
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_WIFI_DIRECT_H_
@@ -28,7 +28,6 @@
#include "internal/platform/implementation/windows/utils.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -117,7 +116,7 @@ std::unique_ptr<api::WifiDirectSocket> WifiDirectMedium::ConnectToService(
}
connection_cancellation_listener_ =
std::make_unique<location::nearby::CancellationFlagListener>(
std::make_unique<nearby::CancellationFlagListener>(
cancellation_flag, [socket]() {
NEARBY_LOGS(WARNING)
<< "connect is closed due to it is cancelled.";
@@ -638,4 +637,3 @@ std::string WifiDirectMedium::GetErrorMessage(std::exception_ptr eptr) {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -29,7 +29,6 @@
#include "internal/platform/implementation/windows/wifi_direct.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -279,4 +278,3 @@ std::string WifiDirectServerSocket::GetDirectGOIpAddresses() const {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -18,7 +18,6 @@
#include "internal/platform/implementation/windows/wifi_direct.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
@@ -198,5 +197,4 @@ Exception WifiDirectSocket::SocketOutputStream::Close() {
}
} // namespace windows
} // namespace nearby
} // namespace location
} // namespace nearby
@@ -44,7 +44,6 @@
#include "internal/platform/implementation/windows/generated/winrt/Windows.Storage.Streams.h"
#include "internal/platform/implementation/windows/generated/winrt/base.h"
namespace location {
namespace nearby {
namespace windows {
@@ -311,12 +310,11 @@ class WifiHotspotMedium : public api::WifiHotspotMedium {
std::shared_ptr<api::Cancelable> connection_timeout_ = nullptr;
// Listener to connect cancellation.
std::unique_ptr<location::nearby::CancellationFlagListener>
std::unique_ptr<nearby::CancellationFlagListener>
connection_cancellation_listener_ = nullptr;
};
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_WIFI_HOTSPOT_H_
@@ -26,7 +26,6 @@
#include "internal/platform/implementation/windows/utils.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -118,7 +117,7 @@ std::unique_ptr<api::WifiHotspotSocket> WifiHotspotMedium::ConnectToService(
}
connection_cancellation_listener_ =
std::make_unique<location::nearby::CancellationFlagListener>(
std::make_unique<nearby::CancellationFlagListener>(
cancellation_flag, [socket]() {
NEARBY_LOGS(WARNING)
<< "connect is closed due to it is cancelled.";
@@ -624,4 +623,3 @@ std::string WifiHotspotMedium::GetErrorMessage(std::exception_ptr eptr) {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -29,7 +29,6 @@
#include "internal/platform/implementation/windows/wifi_hotspot.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -279,4 +278,3 @@ std::string WifiHotspotServerSocket::GetHotspotIpAddresses() const {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -18,7 +18,6 @@
#include "internal/platform/implementation/windows/wifi_hotspot.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
@@ -199,4 +198,3 @@ Exception WifiHotspotSocket::SocketOutputStream::Close() {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -56,7 +56,6 @@
#include "internal/platform/implementation/windows/generated/winrt/Windows.Storage.Streams.h"
#include "internal/platform/implementation/windows/generated/winrt/base.h"
namespace location {
namespace nearby {
namespace windows {
@@ -375,12 +374,11 @@ class WifiLanMedium : public api::WifiLanMedium {
std::shared_ptr<api::Cancelable> connection_timeout_ = nullptr;
// Listener to connect cancellation.
std::unique_ptr<location::nearby::CancellationFlagListener>
std::unique_ptr<nearby::CancellationFlagListener>
connection_cancellation_listener_ = nullptr;
};
} // namespace windows
} // namespace nearby
} // namespace location
#endif // PLATFORM_IMPL_WINDOWS_WIFI_LAN_H_
@@ -42,7 +42,6 @@
#include "internal/platform/logging.h"
#include "internal/platform/runnable.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -364,7 +363,7 @@ std::unique_ptr<api::WifiLanSocket> WifiLanMedium::ConnectToService(
}
connection_cancellation_listener_ =
std::make_unique<location::nearby::CancellationFlagListener>(
std::make_unique<nearby::CancellationFlagListener>(
cancellation_flag, [socket]() {
NEARBY_LOGS(WARNING)
<< "connect is closed due to it is cancelled.";
@@ -794,4 +793,3 @@ std::string WifiLanMedium::GetErrorMessage(std::exception_ptr eptr) {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -25,7 +25,6 @@
#include "internal/platform/implementation/windows/wifi_lan.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
namespace {
@@ -248,4 +247,3 @@ std::vector<std::string> WifiLanServerSocket::GetIpAddresses() const {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -18,7 +18,6 @@
#include "internal/platform/implementation/windows/wifi_lan.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
@@ -198,4 +197,3 @@ Exception WifiLanSocket::SocketOutputStream::Close() {
} // namespace windows
} // namespace nearby
} // namespace location
@@ -20,7 +20,6 @@
#include "internal/platform/implementation/windows/wifi.h"
#include "internal/platform/logging.h"
namespace location {
namespace nearby {
namespace windows {
@@ -251,4 +250,3 @@ std::string WifiMedium::InternalGetIpAddress() {
} // namespace windows
} // namespace nearby
} // namespace location