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

Unified Diff: mojo/edk/system/unique_identifier_unittest.cc

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 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 | « mojo/edk/system/unique_identifier.cc ('k') | mojo/edk/system/waiter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/unique_identifier_unittest.cc
diff --git a/mojo/edk/system/unique_identifier_unittest.cc b/mojo/edk/system/unique_identifier_unittest.cc
deleted file mode 100644
index 2be4f6ea4ff0de413e2097daddcfb219cc4af830..0000000000000000000000000000000000000000
--- a/mojo/edk/system/unique_identifier_unittest.cc
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2014 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 "mojo/edk/system/unique_identifier.h"
-
-#include <set>
-#include <sstream>
-
-#include "base/containers/hash_tables.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace mojo {
-namespace system {
-namespace {
-
-TEST(UniqueIdentifierTest, Basic) {
- // (This also checks copy constructibility.)
- UniqueIdentifier id1 = UniqueIdentifier::Generate();
-
- EXPECT_EQ(id1, id1);
- EXPECT_FALSE(id1 != id1);
- EXPECT_FALSE(id1 < id1);
-
- UniqueIdentifier id2 = UniqueIdentifier::Generate();
-
- EXPECT_FALSE(id2 == id1);
- EXPECT_NE(id2, id1);
- EXPECT_TRUE((id1 < id2) ^ (id2 < id1));
-
- // Test copyability.
- id2 = id1;
-}
-
-TEST(UniqueIdentifierTest, Logging) {
- std::ostringstream oss1;
- UniqueIdentifier id1 = UniqueIdentifier::Generate();
- oss1 << id1;
- EXPECT_FALSE(oss1.str().empty());
-
- std::ostringstream oss2;
- UniqueIdentifier id2 = UniqueIdentifier::Generate();
- oss2 << id2;
- EXPECT_FALSE(oss2.str().empty());
-
- EXPECT_NE(id1, id2);
- EXPECT_NE(oss1.str(), oss2.str());
-}
-
-TEST(UniqueIdentifierTest, StdSet) {
- std::set<UniqueIdentifier> s;
- EXPECT_TRUE(s.empty());
-
- UniqueIdentifier id1 = UniqueIdentifier::Generate();
- EXPECT_TRUE(s.find(id1) == s.end());
- s.insert(id1);
- EXPECT_TRUE(s.find(id1) != s.end());
- EXPECT_FALSE(s.empty());
-
- UniqueIdentifier id2 = UniqueIdentifier::Generate();
- EXPECT_TRUE(s.find(id2) == s.end());
- s.insert(id2);
- EXPECT_TRUE(s.find(id2) != s.end());
- // Make sure |id1| is still in |s|.
- EXPECT_TRUE(s.find(id1) != s.end());
-
- s.erase(id1);
- EXPECT_TRUE(s.find(id1) == s.end());
- // Make sure |id2| is still in |s|.
- EXPECT_TRUE(s.find(id2) != s.end());
-
- s.erase(id2);
- EXPECT_TRUE(s.find(id2) == s.end());
- EXPECT_TRUE(s.empty());
-}
-
-TEST(UniqueIdentifierTest, HashSet) {
- base::hash_set<UniqueIdentifier> s;
- EXPECT_TRUE(s.empty());
-
- UniqueIdentifier id1 = UniqueIdentifier::Generate();
- EXPECT_TRUE(s.find(id1) == s.end());
- s.insert(id1);
- EXPECT_TRUE(s.find(id1) != s.end());
- EXPECT_FALSE(s.empty());
-
- UniqueIdentifier id2 = UniqueIdentifier::Generate();
- EXPECT_TRUE(s.find(id2) == s.end());
- s.insert(id2);
- EXPECT_TRUE(s.find(id2) != s.end());
- // Make sure |id1| is still in |s|.
- EXPECT_TRUE(s.find(id1) != s.end());
-
- s.erase(id1);
- EXPECT_TRUE(s.find(id1) == s.end());
- // Make sure |id2| is still in |s|.
- EXPECT_TRUE(s.find(id2) != s.end());
-
- s.erase(id2);
- EXPECT_TRUE(s.find(id2) == s.end());
- EXPECT_TRUE(s.empty());
-}
-
-} // namespace
-} // namespace system
-} // namespace mojo
« no previous file with comments | « mojo/edk/system/unique_identifier.cc ('k') | mojo/edk/system/waiter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698