summaryrefslogtreecommitdiffstats
path: root/devtools/shared/heapsnapshot/tests/gtest/SerializesTypeNames.cpp
blob: 4c29b28832c8b439f9813c43705910127bc8321f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* -*- 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));
});