| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Unit tests for the SyncApi. Note that a lot of the underlying | 5 // Unit tests for the SyncApi. Note that a lot of the underlying |
| 6 // functionality is provided by the Syncable layer, which has its own | 6 // functionality is provided by the Syncable layer, which has its own |
| 7 // unit tests. We'll test SyncApi specific things in this harness. | 7 // unit tests. We'll test SyncApi specific things in this harness. |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 new StrictMock<MockExtraChangeRecordData>()); | 683 new StrictMock<MockExtraChangeRecordData>()); |
| 684 EXPECT_CALL(*extra, ToValue()).Times(2).WillRepeatedly( | 684 EXPECT_CALL(*extra, ToValue()).Times(2).WillRepeatedly( |
| 685 Invoke(&extra_value, &DictionaryValue::DeepCopy)); | 685 Invoke(&extra_value, &DictionaryValue::DeepCopy)); |
| 686 | 686 |
| 687 record.extra.reset(extra.release()); | 687 record.extra.reset(extra.release()); |
| 688 scoped_ptr<DictionaryValue> value(record.ToValue(&trans)); | 688 scoped_ptr<DictionaryValue> value(record.ToValue(&trans)); |
| 689 CheckDeleteChangeRecordValue(record, *value); | 689 CheckDeleteChangeRecordValue(record, *value); |
| 690 } | 690 } |
| 691 } | 691 } |
| 692 | 692 |
| 693 TEST_F(SyncApiTest, EmptyTags) { |
| 694 WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); |
| 695 ReadNode root_node(&trans); |
| 696 root_node.InitByRootLookup(); |
| 697 WriteNode node(&trans); |
| 698 std::string empty_tag; |
| 699 EXPECT_FALSE(node.InitUniqueByCreation( |
| 700 syncable::TYPED_URLS, root_node, empty_tag)); |
| 701 EXPECT_FALSE(node.InitByTagLookup(empty_tag)); |
| 702 } |
| 703 |
| 693 namespace { | 704 namespace { |
| 694 | 705 |
| 695 class TestHttpPostProviderInterface : public HttpPostProviderInterface { | 706 class TestHttpPostProviderInterface : public HttpPostProviderInterface { |
| 696 public: | 707 public: |
| 697 virtual ~TestHttpPostProviderInterface() {} | 708 virtual ~TestHttpPostProviderInterface() {} |
| 698 | 709 |
| 699 virtual void SetUserAgent(const char* user_agent) OVERRIDE {} | 710 virtual void SetUserAgent(const char* user_agent) OVERRIDE {} |
| 700 virtual void SetExtraRequestHeaders(const char* headers) OVERRIDE {} | 711 virtual void SetExtraRequestHeaders(const char* headers) OVERRIDE {} |
| 701 virtual void SetURL(const char* url, int port) OVERRIDE {} | 712 virtual void SetURL(const char* url, int port) OVERRIDE {} |
| 702 virtual void SetPostPayload(const char* content_type, | 713 virtual void SetPostPayload(const char* content_type, |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 EXPECT_EQ(syncable::BOOKMARKS, node2.GetModelType()); | 1596 EXPECT_EQ(syncable::BOOKMARKS, node2.GetModelType()); |
| 1586 // We should de-canonicalize the title in GetTitle(), but the title in the | 1597 // We should de-canonicalize the title in GetTitle(), but the title in the |
| 1587 // specifics should be stored in the server legal form. | 1598 // specifics should be stored in the server legal form. |
| 1588 EXPECT_EQ(raw_title2, node2.GetTitle()); | 1599 EXPECT_EQ(raw_title2, node2.GetTitle()); |
| 1589 EXPECT_EQ(title2, node2.GetBookmarkSpecifics().title()); | 1600 EXPECT_EQ(title2, node2.GetBookmarkSpecifics().title()); |
| 1590 EXPECT_EQ(url2, node2.GetBookmarkSpecifics().url()); | 1601 EXPECT_EQ(url2, node2.GetBookmarkSpecifics().url()); |
| 1591 } | 1602 } |
| 1592 } | 1603 } |
| 1593 | 1604 |
| 1594 } // namespace browser_sync | 1605 } // namespace browser_sync |
| OLD | NEW |