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

Unified Diff: chrome/browser/extensions/api/cookies/cookies_unittest.cc

Issue 2777063003: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Just rebased Created 3 years, 8 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
Index: chrome/browser/extensions/api/cookies/cookies_unittest.cc
diff --git a/chrome/browser/extensions/api/cookies/cookies_unittest.cc b/chrome/browser/extensions/api/cookies/cookies_unittest.cc
index 8eab26262047f7f0dbd5f453c22311ab078152dc..850dc97dd844af6a69331c122fad651c6db5c613 100644
--- a/chrome/browser/extensions/api/cookies/cookies_unittest.cc
+++ b/chrome/browser/extensions/api/cookies/cookies_unittest.cc
@@ -5,11 +5,12 @@
// Tests common functionality used by the Chrome Extensions Cookies API
// implementation.
-#include "testing/gtest/include/gtest/gtest.h"
-
#include <stddef.h>
+#include <utility>
+
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/cookies/cookies_api_constants.h"
#include "chrome/browser/extensions/api/cookies/cookies_helpers.h"
@@ -18,6 +19,7 @@
#include "content/public/test/test_browser_thread_bundle.h"
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_constants.h"
+#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
using extensions::api::cookies::Cookie;
@@ -119,10 +121,10 @@ TEST_F(ExtensionCookiesTest, ExtensionTypeCreation) {
EXPECT_EQ(10000, *cookie2.expiration_date);
TestingProfile profile;
- base::ListValue* tab_ids_list = new base::ListValue();
+ auto tab_ids_list = base::MakeUnique<base::ListValue>();
std::vector<int> tab_ids;
CookieStore cookie_store =
- cookies_helpers::CreateCookieStore(&profile, tab_ids_list);
+ cookies_helpers::CreateCookieStore(&profile, std::move(tab_ids_list));
EXPECT_EQ("0", cookie_store.id);
EXPECT_EQ(tab_ids, cookie_store.tab_ids);
}
@@ -168,9 +170,9 @@ TEST_F(ExtensionCookiesTest, DomainMatching) {
for (size_t i = 0; i < arraysize(tests); ++i) {
// Build up the Params struct.
base::ListValue args;
- base::DictionaryValue* dict = new base::DictionaryValue();
+ auto dict = base::MakeUnique<base::DictionaryValue>();
dict->SetString(keys::kDomainKey, std::string(tests[i].filter));
- args.Set(0, dict);
+ args.Set(0, std::move(dict));
std::unique_ptr<GetAll::Params> params(GetAll::Params::Create(args));
cookies_helpers::MatchFilter filter(&params->details);

Powered by Google App Engine
This is Rietveld 408576698