diff options
Diffstat (limited to 'dom/heapsnapshot/tests/gtest/SerializesTypeNames.cpp')
-rw-r--r-- | dom/heapsnapshot/tests/gtest/SerializesTypeNames.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/dom/heapsnapshot/tests/gtest/SerializesTypeNames.cpp b/dom/heapsnapshot/tests/gtest/SerializesTypeNames.cpp new file mode 100644 index 000000000..a259c297b --- /dev/null +++ b/dom/heapsnapshot/tests/gtest/SerializesTypeNames.cpp @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Test that a ubi::Node's typeName gets properly serialized into a core dump. + +#include "DevTools.h" + +using testing::Property; +using testing::Return; + +DEF_TEST(SerializesTypeNames, { + FakeNode node; + + ::testing::NiceMock<MockWriter> writer; + EXPECT_CALL(writer, writeNode(Property(&JS::ubi::Node::typeName, + UTF16StrEq(u"FakeNode")), + _)) + .Times(1) + .WillOnce(Return(true)); + + JS::AutoCheckCannotGC noGC(cx); + ASSERT_TRUE(WriteHeapGraph(cx, + JS::ubi::Node(&node), + writer, + /* wantNames = */ true, + /* zones = */ nullptr, + noGC)); + }); |