summaryrefslogtreecommitdiffstats
path: root/sync/js/js_event_details_unittest.cc
blob: 563def7c7b2d5fe5d0722ccedcc73ffbd14f1e04 (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
28
29
30
31
32
33
34
35
36
// Copyright (c) 2012 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 "sync/js/js_event_details.h"

#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace syncer {
namespace {

class JsEventDetailsTest : public testing::Test {};

TEST_F(JsEventDetailsTest, EmptyList) {
  JsEventDetails details;
  EXPECT_TRUE(details.Get().empty());
  EXPECT_EQ("{}", details.ToString());
}

TEST_F(JsEventDetailsTest, FromDictionary) {
  DictionaryValue dict;
  dict.SetString("foo", "bar");
  dict.Set("baz", new ListValue());

  scoped_ptr<DictionaryValue> dict_copy(dict.DeepCopy());

  JsEventDetails details(&dict);

  // |details| should take over |dict|'s data.
  EXPECT_TRUE(dict.empty());
  EXPECT_TRUE(details.Get().Equals(dict_copy.get()));
}

}  // namespace
}  // namespace syncer