| 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 "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manage
r_private_api.h" | 5 #include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manage
r_private_api.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 12 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | 12 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
| 13 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" |
| 13 #include "chrome/browser/extensions/extension_apitest.h" | 14 #include "chrome/browser/extensions/extension_apitest.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 17 #include "components/bookmarks/browser/bookmark_model.h" | 18 #include "components/bookmarks/browser/bookmark_model.h" |
| 18 #include "components/bookmarks/common/bookmark_pref_names.h" | 19 #include "components/bookmarks/common/bookmark_pref_names.h" |
| 19 #include "components/bookmarks/test/bookmark_test_helpers.h" | 20 #include "components/bookmarks/test/bookmark_test_helpers.h" |
| 20 #include "components/user_prefs/user_prefs.h" | 21 #include "components/user_prefs/user_prefs.h" |
| 21 | 22 |
| 22 // Times out on win syzyasan, http://crbug.com/166026 | 23 // Times out on win syzyasan, http://crbug.com/166026 |
| 23 #if defined(SYZYASAN) | 24 #if defined(SYZYASAN) |
| 24 #define MAYBE_BookmarkManager DISABLED_BookmarkManager | 25 #define MAYBE_BookmarkManager DISABLED_BookmarkManager |
| 25 #else | 26 #else |
| 26 #define MAYBE_BookmarkManager BookmarkManager | 27 #define MAYBE_BookmarkManager BookmarkManager |
| 27 #endif | 28 #endif |
| 28 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_BookmarkManager) { | 29 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_BookmarkManager) { |
| 29 // Add managed bookmarks. | 30 // Add managed bookmarks. |
| 30 Profile* profile = browser()->profile(); | 31 Profile* profile = browser()->profile(); |
| 32 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); |
| 31 ChromeBookmarkClient* client = | 33 ChromeBookmarkClient* client = |
| 32 BookmarkModelFactory::GetChromeBookmarkClientForProfile(profile); | 34 ChromeBookmarkClientFactory::GetForProfile(profile); |
| 33 BookmarkModel* model = client->model(); | |
| 34 test::WaitForBookmarkModelToLoad(model); | 35 test::WaitForBookmarkModelToLoad(model); |
| 35 | 36 |
| 36 base::ListValue list; | 37 base::ListValue list; |
| 37 base::DictionaryValue* node = new base::DictionaryValue(); | 38 base::DictionaryValue* node = new base::DictionaryValue(); |
| 38 node->SetString("name", "Managed Bookmark"); | 39 node->SetString("name", "Managed Bookmark"); |
| 39 node->SetString("url", "http://www.chromium.org"); | 40 node->SetString("url", "http://www.chromium.org"); |
| 40 list.Append(node); | 41 list.Append(node); |
| 41 node = new base::DictionaryValue(); | 42 node = new base::DictionaryValue(); |
| 42 node->SetString("name", "Managed Folder"); | 43 node->SetString("name", "Managed Folder"); |
| 43 node->Set("children", new base::ListValue()); | 44 node->Set("children", new base::ListValue()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 63 GURL("http://aaa.example.com")); | 64 GURL("http://aaa.example.com")); |
| 64 model->AddURL(folder, 0, base::ASCIIToUTF16("BBB"), | 65 model->AddURL(folder, 0, base::ASCIIToUTF16("BBB"), |
| 65 GURL("http://bbb.example.com")); | 66 GURL("http://bbb.example.com")); |
| 66 | 67 |
| 67 PrefService* prefs = user_prefs::UserPrefs::Get(profile); | 68 PrefService* prefs = user_prefs::UserPrefs::Get(profile); |
| 68 prefs->SetBoolean(prefs::kEditBookmarksEnabled, false); | 69 prefs->SetBoolean(prefs::kEditBookmarksEnabled, false); |
| 69 | 70 |
| 70 ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/edit_disabled")) | 71 ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/edit_disabled")) |
| 71 << message_; | 72 << message_; |
| 72 } | 73 } |
| OLD | NEW |