app_list: Re-enable people search.
[chromium-blink-merge.git] / chrome / browser / extensions / api / bookmarks / bookmark_apitest.cc
blobfb59a2c0e2cded381e5e883bae60e6987b211660
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
3 // found in the LICENSE file.
5 #include "base/prefs/pref_service.h"
6 #include "base/values.h"
7 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
8 #include "chrome/browser/bookmarks/chrome_bookmark_client.h"
9 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h"
10 #include "chrome/browser/extensions/extension_apitest.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h"
13 #include "components/bookmarks/browser/bookmark_model.h"
14 #include "components/bookmarks/browser/bookmark_node.h"
15 #include "components/bookmarks/common/bookmark_pref_names.h"
16 #include "components/bookmarks/test/bookmark_test_helpers.h"
18 using bookmarks::BookmarkModel;
20 // Flaky on Windows and Linux. http://crbug.com/383452
21 #if defined(OS_WIN) || defined(OS_LINUX)
22 #define MAYBE_Bookmarks DISABLED_Bookmarks
23 #else
24 #define MAYBE_Bookmarks Bookmarks
25 #endif
26 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Bookmarks) {
27 // Add test managed bookmarks to verify that the bookmarks API can read them
28 // and can't modify them.
29 Profile* profile = browser()->profile();
30 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile);
31 ChromeBookmarkClient* client =
32 ChromeBookmarkClientFactory::GetForProfile(profile);
33 bookmarks::test::WaitForBookmarkModelToLoad(model);
35 base::ListValue list;
36 base::DictionaryValue* node = new base::DictionaryValue();
37 node->SetString("name", "Managed Bookmark");
38 node->SetString("url", "http://www.chromium.org");
39 list.Append(node);
40 node = new base::DictionaryValue();
41 node->SetString("name", "Managed Folder");
42 node->Set("children", new base::ListValue());
43 list.Append(node);
44 profile->GetPrefs()->Set(bookmarks::prefs::kManagedBookmarks, list);
45 ASSERT_EQ(2, client->managed_node()->child_count());
47 ASSERT_TRUE(RunExtensionTest("bookmarks")) << message_;