OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <limits> | 5 #include <limits> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 // Remove empty lists and dictionaries. | 592 // Remove empty lists and dictionaries. |
593 root->Set("empty_dict", new DictionaryValue); | 593 root->Set("empty_dict", new DictionaryValue); |
594 root->Set("empty_list", new ListValue); | 594 root->Set("empty_list", new ListValue); |
595 root->SetWithoutPathExpansion("a.b.c.d.e", new DictionaryValue); | 595 root->SetWithoutPathExpansion("a.b.c.d.e", new DictionaryValue); |
596 root.reset(root->DeepCopyWithoutEmptyChildren()); | 596 root.reset(root->DeepCopyWithoutEmptyChildren()); |
597 EXPECT_TRUE(root->empty()); | 597 EXPECT_TRUE(root->empty()); |
598 | 598 |
599 // Make sure we don't prune too much. | 599 // Make sure we don't prune too much. |
600 root->SetBoolean("bool", true); | 600 root->SetBoolean("bool", true); |
601 root->Set("empty_dict", new DictionaryValue); | 601 root->Set("empty_dict", new DictionaryValue); |
602 root->SetString("empty_string", ""); | 602 root->SetString("empty_string", std::string()); |
603 root.reset(root->DeepCopyWithoutEmptyChildren()); | 603 root.reset(root->DeepCopyWithoutEmptyChildren()); |
604 EXPECT_EQ(2U, root->size()); | 604 EXPECT_EQ(2U, root->size()); |
605 | 605 |
606 // Should do nothing. | 606 // Should do nothing. |
607 root.reset(root->DeepCopyWithoutEmptyChildren()); | 607 root.reset(root->DeepCopyWithoutEmptyChildren()); |
608 EXPECT_EQ(2U, root->size()); | 608 EXPECT_EQ(2U, root->size()); |
609 | 609 |
610 // Nested test cases. These should all reduce back to the bool and string | 610 // Nested test cases. These should all reduce back to the bool and string |
611 // set above. | 611 // set above. |
612 { | 612 { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 seen2 = true; | 769 seen2 = true; |
770 } else { | 770 } else { |
771 ADD_FAILURE(); | 771 ADD_FAILURE(); |
772 } | 772 } |
773 } | 773 } |
774 EXPECT_TRUE(seen1); | 774 EXPECT_TRUE(seen1); |
775 EXPECT_TRUE(seen2); | 775 EXPECT_TRUE(seen2); |
776 } | 776 } |
777 | 777 |
778 } // namespace base | 778 } // namespace base |
OLD | NEW |