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

Side by Side Diff: chrome/browser/extensions/api/bookmarks/bookmark_apitest.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 unified diff | Download patch
OLDNEW
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 <memory> 5 #include <memory>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/memory/ptr_util.h"
8 #include "base/values.h" 9 #include "base/values.h"
9 #include "build/build_config.h" 10 #include "build/build_config.h"
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
11 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" 12 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
12 #include "chrome/browser/extensions/extension_apitest.h" 13 #include "chrome/browser/extensions/extension_apitest.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
15 #include "components/bookmarks/browser/bookmark_model.h" 16 #include "components/bookmarks/browser/bookmark_model.h"
16 #include "components/bookmarks/browser/bookmark_node.h" 17 #include "components/bookmarks/browser/bookmark_node.h"
17 #include "components/bookmarks/common/bookmark_pref_names.h" 18 #include "components/bookmarks/common/bookmark_pref_names.h"
(...skipping 19 matching lines...) Expand all
37 bookmarks::test::WaitForBookmarkModelToLoad(model); 38 bookmarks::test::WaitForBookmarkModelToLoad(model);
38 39
39 { 40 {
40 base::ListValue list; 41 base::ListValue list;
41 std::unique_ptr<base::DictionaryValue> node(new base::DictionaryValue()); 42 std::unique_ptr<base::DictionaryValue> node(new base::DictionaryValue());
42 node->SetString("name", "Managed Bookmark"); 43 node->SetString("name", "Managed Bookmark");
43 node->SetString("url", "http://www.chromium.org"); 44 node->SetString("url", "http://www.chromium.org");
44 list.Append(std::move(node)); 45 list.Append(std::move(node));
45 node.reset(new base::DictionaryValue()); 46 node.reset(new base::DictionaryValue());
46 node->SetString("name", "Managed Folder"); 47 node->SetString("name", "Managed Folder");
47 node->Set("children", new base::ListValue()); 48 node->Set("children", base::MakeUnique<base::ListValue>());
48 list.Append(std::move(node)); 49 list.Append(std::move(node));
49 profile->GetPrefs()->Set(bookmarks::prefs::kManagedBookmarks, list); 50 profile->GetPrefs()->Set(bookmarks::prefs::kManagedBookmarks, list);
50 ASSERT_EQ(2, managed->managed_node()->child_count()); 51 ASSERT_EQ(2, managed->managed_node()->child_count());
51 } 52 }
52 53
53 { 54 {
54 base::ListValue list; 55 base::ListValue list;
55 std::unique_ptr<base::DictionaryValue> node(new base::DictionaryValue()); 56 std::unique_ptr<base::DictionaryValue> node(new base::DictionaryValue());
56 node->SetString("name", "Supervised Bookmark"); 57 node->SetString("name", "Supervised Bookmark");
57 node->SetString("url", "http://www.pbskids.org"); 58 node->SetString("url", "http://www.pbskids.org");
58 list.Append(std::move(node)); 59 list.Append(std::move(node));
59 node.reset(new base::DictionaryValue()); 60 node.reset(new base::DictionaryValue());
60 node->SetString("name", "Supervised Folder"); 61 node->SetString("name", "Supervised Folder");
61 node->Set("children", new base::ListValue()); 62 node->Set("children", base::MakeUnique<base::ListValue>());
62 list.Append(std::move(node)); 63 list.Append(std::move(node));
63 profile->GetPrefs()->Set(bookmarks::prefs::kSupervisedBookmarks, list); 64 profile->GetPrefs()->Set(bookmarks::prefs::kSupervisedBookmarks, list);
64 ASSERT_EQ(2, managed->supervised_node()->child_count()); 65 ASSERT_EQ(2, managed->supervised_node()->child_count());
65 } 66 }
66 67
67 ASSERT_TRUE(RunExtensionTest("bookmarks")) << message_; 68 ASSERT_TRUE(RunExtensionTest("bookmarks")) << message_;
68 } 69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698