Home | History | Annotate | Download | only in syncable
      1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/sync/syncable/model_type_payload_map.h"
      6 
      7 #include <string>
      8 
      9 #include "base/memory/scoped_ptr.h"
     10 #include "base/values.h"
     11 #include "chrome/test/values_test_util.h"
     12 #include "testing/gtest/include/gtest/gtest.h"
     13 
     14 namespace syncable {
     15 namespace {
     16 
     17 using test::ExpectBooleanValue;
     18 using test::ExpectDictionaryValue;
     19 using test::ExpectIntegerValue;
     20 using test::ExpectListValue;
     21 using test::ExpectStringValue;
     22 
     23 class ModelTypePayloadMapTest : public testing::Test {};
     24 
     25 TEST_F(ModelTypePayloadMapTest, TypePayloadMapToValue) {
     26   ModelTypePayloadMap payloads;
     27   payloads[syncable::BOOKMARKS] = "bookmarkpayload";
     28   payloads[syncable::APPS] = "";
     29 
     30   scoped_ptr<DictionaryValue> value(ModelTypePayloadMapToValue(payloads));
     31   EXPECT_EQ(2u, value->size());
     32   ExpectStringValue("bookmarkpayload", *value, "Bookmarks");
     33   ExpectStringValue("", *value, "Apps");
     34   EXPECT_FALSE(value->HasKey("Preferences"));
     35 }
     36 
     37 }  // namespace
     38 }  // namespace syncable
     39