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

Unified Diff: third_party/WebKit/Source/wtf/OptionalTest.cpp

Issue 2771783003: Move wtf_unittests to platform/wtf/. (Closed)
Patch Set: Rebase. Created 3 years, 9 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 | « third_party/WebKit/Source/wtf/MathExtrasTest.cpp ('k') | third_party/WebKit/Source/wtf/PassRefPtrTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/OptionalTest.cpp
diff --git a/third_party/WebKit/Source/wtf/OptionalTest.cpp b/third_party/WebKit/Source/wtf/OptionalTest.cpp
deleted file mode 100644
index 683354583407a0ef1797a294890945eaab55f781..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/wtf/OptionalTest.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2015 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 "wtf/Optional.h"
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace WTF {
-namespace {
-
-struct IntBox {
- IntBox(int n) : number(n) {}
- int number;
-};
-
-class DestructionNotifier {
- public:
- DestructionNotifier(bool& flag) : m_flag(flag) {}
- ~DestructionNotifier() { m_flag = true; }
-
- private:
- bool& m_flag;
-};
-
-TEST(OptionalTest, BooleanTest) {
- Optional<int> optional;
- EXPECT_FALSE(optional);
- optional.emplace(0);
- EXPECT_TRUE(optional);
-}
-
-TEST(OptionalTest, Dereference) {
- Optional<int> optional;
- optional.emplace(1);
- EXPECT_EQ(1, *optional);
-
- Optional<IntBox> optionalIntbox;
- optionalIntbox.emplace(42);
- EXPECT_EQ(42, optionalIntbox->number);
-}
-
-TEST(OptionalTest, DestructorCalled) {
- // Destroying a disengaged optional shouldn't do anything.
- { Optional<DestructionNotifier> optional; }
-
- // Destroying an engaged optional should call the destructor.
- bool isDestroyed = false;
- {
- Optional<DestructionNotifier> optional;
- optional.emplace(isDestroyed);
- EXPECT_FALSE(isDestroyed);
- }
- EXPECT_TRUE(isDestroyed);
-}
-
-} // namespace
-} // namespace WTF
« no previous file with comments | « third_party/WebKit/Source/wtf/MathExtrasTest.cpp ('k') | third_party/WebKit/Source/wtf/PassRefPtrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698