Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Unified Diff: content/common/bluetooth/web_bluetooth_device_id_unittest.cc

Issue 2157493003: Revert of bluetooth: Use WebBluetoothDeviceId instead of string (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-uuid-typemap
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/bluetooth/web_bluetooth_device_id_struct_traits.h ('k') | content/content_common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/bluetooth/web_bluetooth_device_id_unittest.cc
diff --git a/content/common/bluetooth/web_bluetooth_device_id_unittest.cc b/content/common/bluetooth/web_bluetooth_device_id_unittest.cc
deleted file mode 100644
index 44f7daafc40ae07f5780d96e2feb13d2c5f2d02c..0000000000000000000000000000000000000000
--- a/content/common/bluetooth/web_bluetooth_device_id_unittest.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2016 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 "content/common/bluetooth/web_bluetooth_device_id.h"
-
-#include "base/base64.h"
-#include "base/strings/string_util.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using content::WebBluetoothDeviceId;
-
-namespace {
-
-const char kValidDeviceId1[] = "123456789012345678901A==";
-const char kValidDeviceId2[] = "AbCdEfGhIjKlMnOpQrS+/Q==";
-const char kInvalidLongDeviceId[] = "12345678901234567890123=";
-const char kInvalidShortDeviceId[] = "12345678901234567890";
-const char kInvalidCharacterDeviceId[] = "123456789012345678901*==";
-// A base64 string should have a length of a multiple of 4.
-const char kInvalidLengthDeviceId[] = "123456789012345678901";
-
-} // namespace
-
-TEST(WebBluetoothDeviceIdTest, DefaultConstructor) {
- WebBluetoothDeviceId default_id1;
- WebBluetoothDeviceId default_id2;
- WebBluetoothDeviceId valid_id(kValidDeviceId1);
-
- ASSERT_DEATH_IF_SUPPORTED(default_id1.str(), "");
- ASSERT_DEATH_IF_SUPPORTED(default_id2.str(), "");
- ASSERT_TRUE(WebBluetoothDeviceId::IsValid(valid_id.str()));
-
- EXPECT_DEATH_IF_SUPPORTED([&]() { return default_id1 == default_id2; }(), "");
- EXPECT_DEATH_IF_SUPPORTED([&]() { return default_id1 != default_id2; }(), "");
-
- EXPECT_DEATH_IF_SUPPORTED([&]() { return default_id1 == valid_id; }(), "");
- EXPECT_DEATH_IF_SUPPORTED([&]() { return valid_id == default_id1; }(), "");
-
- EXPECT_DEATH_IF_SUPPORTED([&]() { return default_id1 != valid_id; }(), "");
- EXPECT_DEATH_IF_SUPPORTED([&]() { return valid_id != default_id1; }(), "");
-}
-
-TEST(WebBluetoothDeviceIdTest, StrConstructor) {
- WebBluetoothDeviceId valid1(kValidDeviceId1);
- WebBluetoothDeviceId valid2(kValidDeviceId2);
-
- EXPECT_TRUE(valid1 == valid1);
- EXPECT_TRUE(valid2 == valid2);
-
- EXPECT_TRUE(valid1 != valid2);
-
- EXPECT_DEATH_IF_SUPPORTED(WebBluetoothDeviceId(""), "");
- EXPECT_DEATH_IF_SUPPORTED(
- [&]() { return WebBluetoothDeviceId(kInvalidLongDeviceId); }(), "");
- EXPECT_DEATH_IF_SUPPORTED(
- [&]() { return WebBluetoothDeviceId(kInvalidShortDeviceId); }(), "");
- EXPECT_DEATH_IF_SUPPORTED(
- [&]() { return WebBluetoothDeviceId(kInvalidCharacterDeviceId); }(), "");
- EXPECT_DEATH_IF_SUPPORTED(
- [&]() { return WebBluetoothDeviceId(kInvalidLengthDeviceId); }(), "");
-}
-
-TEST(WebBluetoothDeviceIdTest, IsValid_Valid) {
- EXPECT_TRUE(WebBluetoothDeviceId::IsValid(kValidDeviceId1));
- EXPECT_TRUE(WebBluetoothDeviceId::IsValid(kValidDeviceId2));
-}
-
-TEST(WebBluetoothDeviceIdTest, IsValid_Invalid) {
- EXPECT_FALSE(WebBluetoothDeviceId::IsValid(""));
- EXPECT_FALSE(WebBluetoothDeviceId::IsValid(kInvalidLongDeviceId));
- EXPECT_FALSE(WebBluetoothDeviceId::IsValid(kInvalidShortDeviceId));
- EXPECT_FALSE(WebBluetoothDeviceId::IsValid(kInvalidCharacterDeviceId));
- EXPECT_FALSE(WebBluetoothDeviceId::IsValid(kInvalidLengthDeviceId));
-}
-
-TEST(WebBluetoothDeviceIdTest, Create) {
- // Tests that Create generates a valid Device Id.
- EXPECT_TRUE(
- WebBluetoothDeviceId::IsValid(WebBluetoothDeviceId::Create().str()));
-}
« no previous file with comments | « content/common/bluetooth/web_bluetooth_device_id_struct_traits.h ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698