flutter_flutter/engine/wtf/RefPtrTest.cpp
Adam Barth d8d7db82a0 Really remove config.h
This CL generated by |sed -i '/sky\/engine\/config.h/d'| and a manual sweep to
catch some oddballs.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1206763002.
2015-06-23 23:15:28 -07:00

34 lines
910 B
C++

// 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 "sky/engine/wtf/RefPtr.h"
#include <gtest/gtest.h>
#include "sky/engine/wtf/text/StringImpl.h"
namespace {
TEST(RefPtrTest, Basic)
{
RefPtr<StringImpl> string;
EXPECT_TRUE(!string);
string = StringImpl::create("test");
EXPECT_TRUE(!!string);
string.clear();
EXPECT_TRUE(!string);
}
TEST(RefPtrTest, MoveAssignmentOperator)
{
RefPtr<StringImpl> a = StringImpl::create("a");
RefPtr<StringImpl> b = StringImpl::create("b");
// FIXME: Instead of explicitly casting to RefPtr<StringImpl>&& here, we should use std::move, but that
// requires us to have a standard library that supports move semantics.
b = static_cast<RefPtr<StringImpl>&&>(a);
EXPECT_TRUE(!!b);
EXPECT_TRUE(!a);
}
}