| 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" |
| 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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // Flaky on Windows and Linux. http://crbug.com/383452 | 24 // Flaky on Windows and Linux. http://crbug.com/383452 |
| 25 #if defined(OS_WIN) || defined(OS_LINUX) | 25 #if defined(OS_WIN) || defined(OS_LINUX) |
| 26 #define MAYBE_Bookmarks DISABLED_Bookmarks | 26 #define MAYBE_Bookmarks DISABLED_Bookmarks |
| 27 #else | 27 #else |
| 28 #define MAYBE_Bookmarks Bookmarks | 28 #define MAYBE_Bookmarks Bookmarks |
| 29 #endif | 29 #endif |
| 30 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Bookmarks) { | 30 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Bookmarks) { |
| 31 // Add test managed and supervised bookmarks to verify that the bookmarks API | 31 // Add test managed and supervised bookmarks to verify that the bookmarks API |
| 32 // can read them and can't modify them. | 32 // can read them and can't modify them. |
| 33 Profile* profile = browser()->profile(); | 33 Profile* profile = browser()->profile(); |
| 34 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); | 34 BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile); |
| 35 bookmarks::ManagedBookmarkService* managed = | 35 bookmarks::ManagedBookmarkService* managed = |
| 36 ManagedBookmarkServiceFactory::GetForProfile(profile); | 36 ManagedBookmarkServiceFactory::GetForProfile(profile); |
| 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)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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", new 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 |