summaryrefslogtreecommitdiffstats
path: root/base/values_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* BinaryValue support for NULL buffer.rpaquay@chromium.org2013-01-081-19/+11
| | | | | | | | | | | | * Apply original change from CL 10389088 (https://chromiumcodereview.appspot.com/10389088) * Change BinaryValue to use "scoped_ptr<char[]>" instead of "scoped_ptr<char>". By contract, the memory owned should be deleted with the "delete[]" operator. BUG=127630 Review URL: https://chromiumcodereview.appspot.com/11745016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175482 0039d316-1c4b-4281-b951-d872f2087c98
* base: Do not use Value::Create* functions.tfarina@chromium.org2012-12-161-36/+33
| | | | | | | | | | BUG=160586 R=willchan@chromium.org,estade@chromium.org Review URL: https://chromiumcodereview.appspot.com/11519026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173368 0039d316-1c4b-4281-b951-d872f2087c98
* Reverting due to memory waterfall failures.jhawkins@chromium.org2012-05-201-11/+19
| | | | | | | | | | | | | Revert 138044 - Allowed BinaryValue to take a NULL buffer. BUG=127630 Review URL: https://chromiumcodereview.appspot.com/10389088 TBR=mitchellwrosen@chromium.org Review URL: https://chromiumcodereview.appspot.com/10388207 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138050 0039d316-1c4b-4281-b951-d872f2087c98
* Allowed BinaryValue to take a NULL buffer.mitchellwrosen@chromium.org2012-05-191-19/+11
| | | | | | | | BUG=127630 Review URL: https://chromiumcodereview.appspot.com/10389088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138044 0039d316-1c4b-4281-b951-d872f2087c98
* Coverity: Fix a leak.jhawkins@chromium.org2012-05-091-0/+31
| | | | | | | | | | | | | | | | | | | Also: * Clarify the interface for DictionaryValue::MergeDictionary. * Add tests that MergeDictionary performs a deep copy. FYI: * ReadExternalExtensionPrefFile() needs unit testing. CID=103941 BUG=none TEST=ValuesTest.MergeDictionaryDeepCopy R=finnur TBR=brettw Review URL: https://chromiumcodereview.appspot.com/10358020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136137 0039d316-1c4b-4281-b951-d872f2087c98
* Add virtual and OVERRIDE to base/ implementation filesrsleevi@chromium.org2012-04-061-2/+2
| | | | | | | | | | BUG=none TEST=compiles Review URL: http://codereview.chromium.org/10004001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131098 0039d316-1c4b-4281-b951-d872f2087c98
* Value::GetAsDictionarybattre@chromium.org2011-11-261-1/+17
| | | | | | | | | | BUG=none TEST=no Review URL: http://codereview.chromium.org/8701002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111623 0039d316-1c4b-4281-b951-d872f2087c98
* Add a key/value iterator to DictionaryValue (in addition to the existing keykalman@chromium.org2011-11-081-0/+37
| | | | | | | | | | | iterator). BUG= TEST=ValuesTest.DictionaryIterator Review URL: http://codereview.chromium.org/8351059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109102 0039d316-1c4b-4281-b951-d872f2087c98
* Adds Find method to the ListValue class.pastarmovj@chromium.org2011-09-191-0/+9
| | | | | | | | | | | | | This method makes working with lists easierand will be needed from the refactored signed settings code. BUG=chromium-os:14054 TEST=base_unittest --gtest_filter=ValuesTest.List Review URL: http://codereview.chromium.org/7892052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101741 0039d316-1c4b-4281-b951-d872f2087c98
* Revert recent changes to base::Valuestevenjb@google.com2011-08-261-8/+9
| | | | | | | | | | | | | | | | | | Reverts: 98223: base: Add AsList() function to Value API. 98266: base: Add AsBinary() function to Value API. There are two issues with these commits: 1. libcros uses base::Value to pass data to Chrome. It includes values.h from libchrome which contains its own copy. This is a terrible design flaw in libcros and is being addressed (http://crosbug.com/19576), however we need some time to address this before we can make these changes without breaking Chrome on ChromeOS. 2. AsList() and AsBinary() should be const. The fact that they were not const caused re-factoring that changed const Value& input arguments to Value*, which is against the spec. When we re-introduce this, these members should be made const. BUG=chromium-os:19604 TEST=Check bots + ChromeOS autotests Review URL: http://codereview.chromium.org/7753020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98378 0039d316-1c4b-4281-b951-d872f2087c98
* base: Add AsBinary() function to Value API.tfarina@chromium.org2011-08-251-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | This function should simplify some constructions. Instead of: if (!value->IsType(Value::TYPE_BINARY)) return false; BinaryValue* binary_value = static_cast<BinaryValue*>(value); You can do: BinaryValue* binary_value = value->AsBinary(); if (!binary_value) return false; BUG=None TEST=base_unittests --gtest_filter=Values* R=evan@chromium.org Review URL: http://codereview.chromium.org/7748017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98266 0039d316-1c4b-4281-b951-d872f2087c98
* base: Add AsList() function to Value API.tfarina@chromium.org2011-08-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | This function should simplify some constructions. Instead of: if (!value->IsType(Value::TYPE_LIST)) return false; ListValue* list_value = static_cast<ListValue*>(value); You can do: ListValue* list_value = value->AsList(); if (!list_value) return false; BUG=None TEST=base_unittests --gtest_filter=Values* R=evan@chromium.org,tony@chromium.org Review URL: http://codereview.chromium.org/7714004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98223 0039d316-1c4b-4281-b951-d872f2087c98
* base: Fix the TODO in ListValue::Remove().tfarina@chromium.org2011-08-131-1/+3
| | | | | | | | | | | | | Change the return type of Remove() to bool, and add a size_t output parameter. BUG=None TEST=None R=evan@chromium.org Review URL: http://codereview.chromium.org/7618021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96702 0039d316-1c4b-4281-b951-d872f2087c98
* base: Remove CreateBinaryValue() function as it's redundant.tfarina@chromium.org2011-08-111-2/+2
| | | | | | | | | | | | | | It does the same thing of BinaryValue::Create(), it's more verbose, and used only in unittest. BUG=None TEST=None R=evan@chromium.org Review URL: http://codereview.chromium.org/7623017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96413 0039d316-1c4b-4281-b951-d872f2087c98
* base: Use TEST() macro in Value unittests.tfarina@chromium.org2011-06-281-17/+18
| | | | | | | | | | | | | | | While I'm here: - Add 'base' namespace to this test file. - Remove unnecessary typedefs of testing::Test. BUG=None TEST=base_unittests R=evan@chromium.org Review URL: http://codereview.chromium.org/7275004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90862 0039d316-1c4b-4281-b951-d872f2087c98
* Modified Value::GetAsDouble so the function returns true when the object ↵yusukes@google.com2011-05-021-2/+7
| | | | | | | | | | | | | | | holds an Integer. This should be useful when implementing an extension API in C++ since chrome.api.call(1.0); call in JS passes a Value of Integer to the C++ code while chrome.api.call(1.1); does a Value of Double. I'm working on this following Mihai's suggestion in http://codereview.chromium.org/6905053/. BUG=chromium-os:14421 TEST=ran try Review URL: http://codereview.chromium.org/6893089 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83705 0039d316-1c4b-4281-b951-d872f2087c98
* Move some files from base to base/memory.levin@chromium.org2011-03-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | raw_scoped_refptr_mismatch_checker.h ref_counted.cc ref_counted.h ref_counted_memory.cc ref_counted_memory.h ref_counted_unittest.cc scoped_callback_factory.h scoped_comptr_win.h scoped_handle.h scoped_native_library.cc scoped_native_library.h scoped_native_library_unittest.cc scoped_nsobject.h scoped_open_process.h scoped_ptr.h scoped_ptr_unittest.cc scoped_temp_dir.cc scoped_temp_dir.h scoped_temp_dir_unittest.cc scoped_vector.h singleton.h singleton_objc.h singleton_unittest.cc linked_ptr.h linked_ptr_unittest.cc weak_ptr.cc weak_ptr.h weak_ptr_unittest.cc BUG=None TEST=Compile Review URL: http://codereview.chromium.org/6714032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79524 0039d316-1c4b-4281-b951-d872f2087c98
* Rename Real* to Double* in values.* and dependent filesarv@chromium.org2011-02-011-19/+19
| | | | | | | | | BUG=None TEST=Compiles and passes all tests Review URL: http://codereview.chromium.org/6248026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73232 0039d316-1c4b-4281-b951-d872f2087c98
* Made return types of various Value::DeepCopy() implementations more specificakalin@chromium.org2011-01-181-11/+67
| | | | | | | | | | | | | | | | | | Since C++ supports covariant return types, a subclass of Value can return its own pointer type for Value::DeepCopy(). Also made signatures of Value::Create*Value() more specific. Removed now-unnecessary casts. Added test for covariant return types. BUG=None TEST=Compile Review URL: http://codereview.chromium.org/6324004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71617 0039d316-1c4b-4281-b951-d872f2087c98
* Handle policy refresh internally in ConfigurationPolicyPrefStore.mnissler@chromium.org2010-12-231-132/+1
| | | | | | | | | | | This removes the final bits of thread-switching madness from PrefValueStore and also makes sure only the PrefStores and PrefService instances that are actually affected by a policy change get reconfigured. BUG=67715 TEST=unit tests in configuration_policy_provider_unittest.cc Review URL: http://codereview.chromium.org/6074003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70050 0039d316-1c4b-4281-b951-d872f2087c98
* Fix for Bug 50726 "Save extension list and "winning" prefs from extensions"bauerb@chromium.org2010-12-061-0/+23
| | | | | | | | | | | | | | | | | | | This is a redesign for http://codereview.chromium.org/4852002/ following discussions. The goal of this patch is to ensure that Chrome maintains the order in which extensions apply their preferences between restarts. This may be an issue if two extensions overwrite each others preferences. Furthermore, it ensures that preferences are persisted to disk between browser restarts. Therefore, previous settings are immediately available when the browser is restarted. A description of the design has been published https://docs.google.com/a/google.com/document/d/1E_HX_cUpET1gH2gDunGIU1EOywMM6FEOuVU6TlpnSwo/edit?hl=en for review and comments. - Sorry, accessible Google internally only. This CL requires http://codereview.chromium.org/5204006/ Contributed by battre@google.com BUG=50726 TEST=none Review URL: http://codereview.chromium.org/5213002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68355 0039d316-1c4b-4281-b951-d872f2087c98
* clang/mac: Fix most problems in unittest targets in webkit.gypthakis@chromium.org2010-10-031-2/+2
| | | | | | | | | | | | This does to WebPoint/gfx::Point what we did to WebString/string16 last friday and fixes a bunch of other small issues. Also fix two tiny issues in the base unit tests target. BUG=None TEST=None TBR=hans git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61343 0039d316-1c4b-4281-b951-d872f2087c98
* Fix DictionaryValue::Equals() to also detect differences in key names.mnissler@chromium.org2010-08-181-6/+13
| | | | | | | | | BUG=52419 TEST=unit tests in values_unittest.cc Review URL: http://codereview.chromium.org/3163020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56536 0039d316-1c4b-4281-b951-d872f2087c98
* Header cleanup in base.brettw@chromium.org2010-08-171-1/+0
| | | | | | | | | | | | | | This makes uses of StringPrintf and friends use the base namespace and include stringprintf.h explicitly. This also removes a bunch of unnecessary string_util includes (which exposed a few other errors like people forgetting to include <vector>. TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/3119022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56446 0039d316-1c4b-4281-b951-d872f2087c98
* Remove deprecated wstring Get(As)String() methods from Value, etc.viettrungluu@chromium.org2010-08-161-434/+0
| | | | | | | | | BUG=23581 TEST=builds and passes tests Review URL: http://codereview.chromium.org/3117017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56187 0039d316-1c4b-4281-b951-d872f2087c98
* Remove (deprecated) wstring version of Value::CreateStringValue().viettrungluu@chromium.org2010-08-151-26/+1
| | | | | | | | | BUG=23581 TEST=builds and passes tests Review URL: http://codereview.chromium.org/3136012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56170 0039d316-1c4b-4281-b951-d872f2087c98
* Remove deprecated wstring DictionaryValue::SetWithoutPathExpansion().viettrungluu@chromium.org2010-08-141-17/+1
| | | | | | | | | BUG=23581 TEST=builds and passes tests Review URL: http://codereview.chromium.org/3121017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56128 0039d316-1c4b-4281-b951-d872f2087c98
* Remove remaining deprecated wstring ↵viettrungluu@chromium.org2010-08-141-3/+0
| | | | | | | | | | | DictionaryValue::Get...WithoutPathExpansion()s. BUG=23581 TEST=builds and passes tests Review URL: http://codereview.chromium.org/3116013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56124 0039d316-1c4b-4281-b951-d872f2087c98
* Remove deprecated wstring ↵viettrungluu@chromium.org2010-08-141-4/+0
| | | | | | | | | | | DictionaryValue::Get{Dictionary,List}WithoutPathExpansion() overloads. BUG=23581 TEST=builds and passes tests Review URL: http://codereview.chromium.org/3163015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56121 0039d316-1c4b-4281-b951-d872f2087c98
* Rename DictionaryValue's SetStringFromUTF16() to SetString() (and overload).viettrungluu@chromium.org2010-08-041-1/+1
| | | | | | | | | | | | | Also do a bunch of drive-by changes while I'm at it. Still to do: rename GetStringAsUTF16() to GetString(). BUG=none TEST=builds everywhere, tests pass Review URL: http://codereview.chromium.org/3033050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54915 0039d316-1c4b-4281-b951-d872f2087c98
* Add dictionary comparing functions to DictionaryValue and unit testsdanno@chromium.org2010-08-041-22/+153
| | | | | | | | | TEST=none BUG=none Review URL: http://codereview.chromium.org/3035045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54879 0039d316-1c4b-4281-b951-d872f2087c98
* Remove Value/StringValue's ...UTF16() methods in favour of overloading.viettrungluu@chromium.org2010-08-031-44/+49
| | | | | | | | | | | Still to do: do the same for DictionaryValue. BUG=none TEST=builds Review URL: http://codereview.chromium.org/3023037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54751 0039d316-1c4b-4281-b951-d872f2087c98
* Add #include utf_string_conversions.h to all files that use ASCIIToWide andbrettw@chromium.org2010-08-031-0/+1
| | | | | | | | | | | | | | | ASCIIToUTF16. I removed string_util includes from a few places where it obviously wasn't needed. In a separate pass, I'm going to remove ASCIITo* from string_util, then I'm going to do an even later pass to find the unnecessary string_util.h includes and remove them. TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/3058027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54746 0039d316-1c4b-4281-b951-d872f2087c98
* Make ValuesTest use std::strings (instead of wstrings) for dictionary keys.viettrungluu@chromium.org2010-07-311-0/+440
| | | | | | | | | | | For now, keep the deprecated tests to check compatibility. BUG=23581 TEST=base_unittests Review URL: http://codereview.chromium.org/3041038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54431 0039d316-1c4b-4281-b951-d872f2087c98
* Preference provider implementation backed by JSON files in a directory.mnissler@chromium.org2010-05-141-1/+46
| | | | | | | | | BUG=42412 TEST=Unit tests in chrome/browser/value_tree_policy_decoder.cc and base/values_unittest.cc Review URL: http://codereview.chromium.org/2027010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47269 0039d316-1c4b-4281-b951-d872f2087c98
* Style cleanup in preparation for auto-linting base/.erg@google.com2010-01-261-1/+1
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/552004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37164 0039d316-1c4b-4281-b951-d872f2087c98
* Add string16 methods to JSON value classes.munjal@chromium.org2010-01-151-1/+40
| | | | | | | | | TEST=none BUG=32013 Review URL: http://codereview.chromium.org/543031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36397 0039d316-1c4b-4281-b951-d872f2087c98
* Remove emtpy lists and empty dictionaries from Preferences andtony@chromium.org2009-12-021-0/+75
| | | | | | | | | | Local State when writing to disk. BUG=28836 Review URL: http://codereview.chromium.org/449074 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33518 0039d316-1c4b-4281-b951-d872f2087c98
* Fix a memory leak when calling the one-arg form of ListValue::Remove().pkasting@chromium.org2009-11-301-0/+10
| | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/434108 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33314 0039d316-1c4b-4281-b951-d872f2087c98
* Many changes to DictionaryValues:pkasting@chromium.org2009-11-251-2/+24
| | | | | | | | | | | | | | | | | * Add support for keys with "." in them via new XXXWithoutPathExpansion() APIs. * Use these APIs with all key iterator usage. * SetXXX() calls cannot fail, so change them from bool to void. * Change GetSize() to size() since it's cheap, and add empty(). Other: * Use standard for loop format in more places (e.g. instead of while loops when they're really doing a for loop). * Shorten a few bits of code. BUG=567 TEST=none Review URL: http://codereview.chromium.org/441008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33109 0039d316-1c4b-4281-b951-d872f2087c98
* Minor Coverity nit: Unit test leaking data if failure occurs.finnur@chromium.org2009-07-031-9/+7
| | | | | | | | | BUG=None TEST=Coverity should stop complaining about this leak. Review URL: http://codereview.chromium.org/149153 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19886 0039d316-1c4b-4281-b951-d872f2087c98
* Use scoped_ptr to prevent memory leaks on test failures.patrick@chromium.org2009-03-241-19/+12
| | | | | | Review URL: http://codereview.chromium.org/50027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12409 0039d316-1c4b-4281-b951-d872f2087c98
* NO CODE CHANGEdeanm@chromium.org2009-03-101-1/+0
| | | | | | | | | Normalize end of file newlines in base/. All files end in a single newline. Review URL: http://codereview.chromium.org/42011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11329 0039d316-1c4b-4281-b951-d872f2087c98
* revert broken change 10833nsylvain@chromium.org2009-03-031-58/+53
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10837 0039d316-1c4b-4281-b951-d872f2087c98
* Port DictionaryValue to use string16 instead of wstring.dsh@google.com2009-03-031-53/+58
| | | | | | | Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=10818 Review URL: http://codereview.chromium.org/31014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10833 0039d316-1c4b-4281-b951-d872f2087c98
* Revert dsh's change 10818nsylvain@chromium.org2009-03-031-54/+53
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10821 0039d316-1c4b-4281-b951-d872f2087c98
* Port DictionaryValue to use string16 instead of wstring.dsh@google.com2009-03-031-53/+54
| | | | | | Review URL: http://codereview.chromium.org/31014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10818 0039d316-1c4b-4281-b951-d872f2087c98
* NO CODE CHANGE (except one global std::wstring changed to const wchar_t* ↵maruel@chromium.org2009-03-031-2/+2
| | | | | | | | | | | const per style compliance). Preliminary work to enforce new PRESUBMIT.py rules: - <=80 cols - no trailing whitespaces - svn:eol-style=LF git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10791 0039d316-1c4b-4281-b951-d872f2087c98
* Flesh out ListValue class.aa@chromium.org2009-01-201-0/+36
| | | | | | Review URL: http://codereview.chromium.org/18200 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8315 0039d316-1c4b-4281-b951-d872f2087c98
* Added std::string to Value via Set/GetString overloading.scherkus@chromium.org2008-12-111-4/+44
| | | | | | | | | | All input is converted to UTF-8. Output is converted back to wide during std::wstring version of GetString(). This is part one of some more patches to come where I switch clients over to UTF-8 strings. Review URL: http://codereview.chromium.org/13230 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6768 0039d316-1c4b-4281-b951-d872f2087c98