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

Unified Diff: chrome/browser/extensions/api/bookmarks/bookmark_apitest.cc

Issue 308273002: Made the bookmarks extension APIs aware of managed bookmarks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/bookmarks/bookmark_apitest.cc
diff --git a/chrome/browser/extensions/api/bookmarks/bookmark_apitest.cc b/chrome/browser/extensions/api/bookmarks/bookmark_apitest.cc
index ebd68287c6cccdd8c1172c859db82d2d675c1cdd..68e9586dbf5e85fa706259bf0928e6c9e0c405f5 100644
--- a/chrome/browser/extensions/api/bookmarks/bookmark_apitest.cc
+++ b/chrome/browser/extensions/api/bookmarks/bookmark_apitest.cc
@@ -2,8 +2,35 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/prefs/pref_service.h"
+#include "base/values.h"
+#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/extensions/extension_apitest.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "components/bookmarks/browser/bookmark_model.h"
+#include "components/bookmarks/browser/bookmark_node.h"
+#include "components/bookmarks/common/bookmark_pref_names.h"
+#include "components/bookmarks/test/bookmark_test_helpers.h"
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Bookmarks) {
+ // Add test managed bookmarks to verify that the bookmarks API can read them
+ // and can't modify them.
+ Profile* profile = browser()->profile();
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile);
+ test::WaitForBookmarkModelToLoad(model);
+
+ base::ListValue list;
+ base::DictionaryValue* node = new base::DictionaryValue();
+ node->SetString("name", "Managed Bookmark");
+ node->SetString("url", "http://www.chromium.org");
+ list.Append(node);
+ node = new base::DictionaryValue();
+ node->SetString("name", "Managed Folder");
+ node->Set("children", new base::ListValue());
+ list.Append(node);
+ profile->GetPrefs()->Set(prefs::kManagedBookmarks, list);
+ ASSERT_EQ(2, model->managed_node()->child_count());
+
ASSERT_TRUE(RunExtensionTest("bookmarks")) << message_;
}

Powered by Google App Engine
This is Rietveld 408576698