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

Side by Side Diff: chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_apitest.cc

Issue 2811673002: Reland: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Workaround with std::move 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 "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manage r_private_api.h" 5 #include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manage r_private_api.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 29 matching lines...) Expand all
40 ManagedBookmarkServiceFactory::GetForProfile(profile); 40 ManagedBookmarkServiceFactory::GetForProfile(profile);
41 bookmarks::test::WaitForBookmarkModelToLoad(model); 41 bookmarks::test::WaitForBookmarkModelToLoad(model);
42 42
43 base::ListValue list; 43 base::ListValue list;
44 std::unique_ptr<base::DictionaryValue> node(new base::DictionaryValue()); 44 std::unique_ptr<base::DictionaryValue> node(new base::DictionaryValue());
45 node->SetString("name", "Managed Bookmark"); 45 node->SetString("name", "Managed Bookmark");
46 node->SetString("url", "http://www.chromium.org"); 46 node->SetString("url", "http://www.chromium.org");
47 list.Append(std::move(node)); 47 list.Append(std::move(node));
48 node.reset(new base::DictionaryValue()); 48 node.reset(new base::DictionaryValue());
49 node->SetString("name", "Managed Folder"); 49 node->SetString("name", "Managed Folder");
50 node->Set("children", new base::ListValue()); 50 node->Set("children", base::MakeUnique<base::ListValue>());
51 list.Append(std::move(node)); 51 list.Append(std::move(node));
52 profile->GetPrefs()->Set(bookmarks::prefs::kManagedBookmarks, list); 52 profile->GetPrefs()->Set(bookmarks::prefs::kManagedBookmarks, list);
53 ASSERT_EQ(2, managed->managed_node()->child_count()); 53 ASSERT_EQ(2, managed->managed_node()->child_count());
54 54
55 ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/standard")) 55 ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/standard"))
56 << message_; 56 << message_;
57 } 57 }
58 58
59 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BookmarkManagerEditDisabled) { 59 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BookmarkManagerEditDisabled) {
60 Profile* profile = browser()->profile(); 60 Profile* profile = browser()->profile();
61 61
62 // Provide some testing data here, since bookmark editing will be disabled 62 // Provide some testing data here, since bookmark editing will be disabled
63 // within the extension. 63 // within the extension.
64 BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile); 64 BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile);
65 bookmarks::test::WaitForBookmarkModelToLoad(model); 65 bookmarks::test::WaitForBookmarkModelToLoad(model);
66 const BookmarkNode* bar = model->bookmark_bar_node(); 66 const BookmarkNode* bar = model->bookmark_bar_node();
67 const BookmarkNode* folder = 67 const BookmarkNode* folder =
68 model->AddFolder(bar, 0, base::ASCIIToUTF16("Folder")); 68 model->AddFolder(bar, 0, base::ASCIIToUTF16("Folder"));
69 model->AddURL(bar, 1, base::ASCIIToUTF16("AAA"), 69 model->AddURL(bar, 1, base::ASCIIToUTF16("AAA"),
70 GURL("http://aaa.example.com")); 70 GURL("http://aaa.example.com"));
71 model->AddURL(folder, 0, base::ASCIIToUTF16("BBB"), 71 model->AddURL(folder, 0, base::ASCIIToUTF16("BBB"),
72 GURL("http://bbb.example.com")); 72 GURL("http://bbb.example.com"));
73 73
74 PrefService* prefs = user_prefs::UserPrefs::Get(profile); 74 PrefService* prefs = user_prefs::UserPrefs::Get(profile);
75 prefs->SetBoolean(bookmarks::prefs::kEditBookmarksEnabled, false); 75 prefs->SetBoolean(bookmarks::prefs::kEditBookmarksEnabled, false);
76 76
77 ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/edit_disabled")) 77 ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/edit_disabled"))
78 << message_; 78 << message_;
79 } 79 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698