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