Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Unified Diff: chrome/browser/safe_browsing/preference_validation_delegate_unittest.cc

Issue 332053005: Unit test for NULL values in preference validation delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: new test for clarity Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/safe_browsing/preference_validation_delegate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/preference_validation_delegate_unittest.cc
diff --git a/chrome/browser/safe_browsing/preference_validation_delegate_unittest.cc b/chrome/browser/safe_browsing/preference_validation_delegate_unittest.cc
index 0e66dc00ed80e9e9806b607197dcf4a5344ea45b..e4d32ef71d50d5ae04ca9672712603658f9cb148 100644
--- a/chrome/browser/safe_browsing/preference_validation_delegate_unittest.cc
+++ b/chrome/browser/safe_browsing/preference_validation_delegate_unittest.cc
@@ -83,6 +83,17 @@ class PreferenceValidationDelegateTest : public testing::Test {
scoped_ptr<TrackedPreferenceValidationDelegate> instance_;
};
+// Tests that a NULL value results in an incident with no value.
+TEST_F(PreferenceValidationDelegateTest, NullValue) {
+ instance_->OnAtomicPreferenceValidation(kPrefPath_,
+ NULL,
+ PrefHashStoreTransaction::CLEARED,
+ TrackedPreferenceHelper::DONT_RESET);
+ safe_browsing::ClientIncidentReport_IncidentData* incident =
+ incidents_.back();
+ EXPECT_FALSE(incident->tracked_preference().has_atomic_value());
gab 2014/06/16 22:33:27 Optional: instead of returning no serialized value
grt (UTC plus 2) 2014/06/17 02:05:33 value_state() indicates that it was cleared. i've
+}
+
// Tests that all supported value types can be stringified into an incident. The
// parameters for the test are the type of value to test and the expected value
// string.
« no previous file with comments | « chrome/browser/safe_browsing/preference_validation_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698