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

Side by Side 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, 6 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 | Annotate | Revision Log
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 "base/prefs/pref_service.h"
6 #include "base/values.h"
7 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
5 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h"
11 #include "components/bookmarks/browser/bookmark_model.h"
12 #include "components/bookmarks/browser/bookmark_node.h"
13 #include "components/bookmarks/common/bookmark_pref_names.h"
14 #include "components/bookmarks/test/bookmark_test_helpers.h"
6 15
7 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Bookmarks) { 16 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Bookmarks) {
17 // Add test managed bookmarks to verify that the bookmarks API can read them
18 // and can't modify them.
19 Profile* profile = browser()->profile();
20 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile);
21 test::WaitForBookmarkModelToLoad(model);
22
23 base::ListValue list;
24 base::DictionaryValue* node = new base::DictionaryValue();
25 node->SetString("name", "Managed Bookmark");
26 node->SetString("url", "http://www.chromium.org");
27 list.Append(node);
28 node = new base::DictionaryValue();
29 node->SetString("name", "Managed Folder");
30 node->Set("children", new base::ListValue());
31 list.Append(node);
32 profile->GetPrefs()->Set(prefs::kManagedBookmarks, list);
33 ASSERT_EQ(2, model->managed_node()->child_count());
34
8 ASSERT_TRUE(RunExtensionTest("bookmarks")) << message_; 35 ASSERT_TRUE(RunExtensionTest("bookmarks")) << message_;
9 } 36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698