| 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" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 base::ListValue list; | 37 base::ListValue list; |
| 38 base::DictionaryValue* node = new base::DictionaryValue(); | 38 base::DictionaryValue* node = new base::DictionaryValue(); |
| 39 node->SetString("name", "Managed Bookmark"); | 39 node->SetString("name", "Managed Bookmark"); |
| 40 node->SetString("url", "http://www.chromium.org"); | 40 node->SetString("url", "http://www.chromium.org"); |
| 41 list.Append(node); | 41 list.Append(node); |
| 42 node = new base::DictionaryValue(); | 42 node = new base::DictionaryValue(); |
| 43 node->SetString("name", "Managed Folder"); | 43 node->SetString("name", "Managed Folder"); |
| 44 node->Set("children", new base::ListValue()); | 44 node->Set("children", new base::ListValue()); |
| 45 list.Append(node); | 45 list.Append(node); |
| 46 profile->GetPrefs()->Set(prefs::kManagedBookmarks, list); | 46 profile->GetPrefs()->Set(bookmarks::prefs::kManagedBookmarks, list); |
| 47 ASSERT_EQ(2, client->managed_node()->child_count()); | 47 ASSERT_EQ(2, client->managed_node()->child_count()); |
| 48 | 48 |
| 49 ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/standard")) | 49 ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/standard")) |
| 50 << message_; | 50 << message_; |
| 51 } | 51 } |
| 52 | 52 |
| 53 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BookmarkManagerEditDisabled) { | 53 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BookmarkManagerEditDisabled) { |
| 54 Profile* profile = browser()->profile(); | 54 Profile* profile = browser()->profile(); |
| 55 | 55 |
| 56 // Provide some testing data here, since bookmark editing will be disabled | 56 // Provide some testing data here, since bookmark editing will be disabled |
| 57 // within the extension. | 57 // within the extension. |
| 58 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); | 58 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); |
| 59 test::WaitForBookmarkModelToLoad(model); | 59 test::WaitForBookmarkModelToLoad(model); |
| 60 const BookmarkNode* bar = model->bookmark_bar_node(); | 60 const BookmarkNode* bar = model->bookmark_bar_node(); |
| 61 const BookmarkNode* folder = | 61 const BookmarkNode* folder = |
| 62 model->AddFolder(bar, 0, base::ASCIIToUTF16("Folder")); | 62 model->AddFolder(bar, 0, base::ASCIIToUTF16("Folder")); |
| 63 model->AddURL(bar, 1, base::ASCIIToUTF16("AAA"), | 63 model->AddURL(bar, 1, base::ASCIIToUTF16("AAA"), |
| 64 GURL("http://aaa.example.com")); | 64 GURL("http://aaa.example.com")); |
| 65 model->AddURL(folder, 0, base::ASCIIToUTF16("BBB"), | 65 model->AddURL(folder, 0, base::ASCIIToUTF16("BBB"), |
| 66 GURL("http://bbb.example.com")); | 66 GURL("http://bbb.example.com")); |
| 67 | 67 |
| 68 PrefService* prefs = user_prefs::UserPrefs::Get(profile); | 68 PrefService* prefs = user_prefs::UserPrefs::Get(profile); |
| 69 prefs->SetBoolean(prefs::kEditBookmarksEnabled, false); | 69 prefs->SetBoolean(bookmarks::prefs::kEditBookmarksEnabled, false); |
| 70 | 70 |
| 71 ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/edit_disabled")) | 71 ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/edit_disabled")) |
| 72 << message_; | 72 << message_; |
| 73 } | 73 } |
| OLD | NEW |