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