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

Unified Diff: chrome/browser/extensions/api/preference/preference_api_prefs_unittest.cc

Issue 2683203004: Move Storage for ListValue and DictValue in Union (Closed)
Patch Set: Add missing return statements. Created 3 years, 10 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
« base/values.cc ('K') | « base/values_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/preference/preference_api_prefs_unittest.cc
diff --git a/chrome/browser/extensions/api/preference/preference_api_prefs_unittest.cc b/chrome/browser/extensions/api/preference/preference_api_prefs_unittest.cc
index 6fcad79d080bc0418e40064b9b6d211feba3ebd0..a4a893391d40c14c2f1a4b3f0816d88f4df77d8e 100644
--- a/chrome/browser/extensions/api/preference/preference_api_prefs_unittest.cc
+++ b/chrome/browser/extensions/api/preference/preference_api_prefs_unittest.cc
@@ -8,7 +8,7 @@
#include <string>
#include "base/macros.h"
-#include "base/memory/ref_counted.h"
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/content_settings/content_settings_service.h"
#include "chrome/browser/extensions/api/preference/preference_api.h"
@@ -411,45 +411,21 @@ class ControlledPrefsReenableExtension : public ExtensionControlledPrefsTest {
};
TEST_F(ControlledPrefsDisableExtension, ControlledPrefsReenableExtension) { }
-// Mock class to test whether objects are deleted correctly.
-class MockStringValue : public base::StringValue {
- public:
- explicit MockStringValue(const std::string& in_value)
- : base::StringValue(in_value) {
- }
- virtual ~MockStringValue() {
- Die();
- }
- MOCK_METHOD0(Die, void());
-};
-
class ControlledPrefsSetExtensionControlledPref
: public ExtensionControlledPrefsTest {
public:
void Initialize() override {
- MockStringValue* v1 = new MockStringValue("https://www.chromium.org");
- MockStringValue* v2 = new MockStringValue("https://www.chromium.org");
- MockStringValue* v1i = new MockStringValue("https://www.chromium.org");
- MockStringValue* v2i = new MockStringValue("https://www.chromium.org");
+ base::StringValue* v1 = new base::StringValue("https://www.chromium.org");
+ base::StringValue* v2 = new base::StringValue("https://www.chromium.org");
+ base::StringValue* v1i = new base::StringValue("https://www.chromium.org");
+ base::StringValue* v2i = new base::StringValue("https://www.chromium.org");
// Ownership is taken, value shall not be deleted.
- EXPECT_CALL(*v1, Die()).Times(0);
- EXPECT_CALL(*v1i, Die()).Times(0);
InstallExtensionControlledPref(extension1(), kPref1, v1);
InstallExtensionControlledPrefIncognito(extension1(), kPref1, v1i);
- testing::Mock::VerifyAndClearExpectations(v1);
- testing::Mock::VerifyAndClearExpectations(v1i);
// Make sure there is no memory leak and both values are deleted.
- EXPECT_CALL(*v1, Die()).Times(1);
- EXPECT_CALL(*v1i, Die()).Times(1);
- EXPECT_CALL(*v2, Die()).Times(1);
- EXPECT_CALL(*v2i, Die()).Times(1);
InstallExtensionControlledPref(extension1(), kPref1, v2);
InstallExtensionControlledPrefIncognito(extension1(), kPref1, v2i);
prefs_.RecreateExtensionPrefs();
- testing::Mock::VerifyAndClearExpectations(v1);
- testing::Mock::VerifyAndClearExpectations(v1i);
- testing::Mock::VerifyAndClearExpectations(v2);
- testing::Mock::VerifyAndClearExpectations(v2i);
}
void Verify() override {}
« base/values.cc ('K') | « base/values_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698