| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "base/command_line.h" | |
| 6 #include "base/prefs/public/pref_service_base.h" | |
| 7 #include "base/utf_string_conversions.h" | |
| 8 #include "chrome/browser/bookmarks/bookmark_manager_extension_api.h" | |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | |
| 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | |
| 11 #include "chrome/browser/extensions/extension_apitest.h" | |
| 12 #include "chrome/browser/profiles/profile.h" | |
| 13 #include "chrome/browser/ui/browser.h" | |
| 14 #include "chrome/common/chrome_switches.h" | |
| 15 #include "chrome/common/pref_names.h" | |
| 16 #include "chrome/test/base/ui_test_utils.h" | |
| 17 | |
| 18 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BookmarkManager) { | |
| 19 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 20 switches::kEnableExperimentalExtensionApis); | |
| 21 | |
| 22 ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/standard")) | |
| 23 << message_; | |
| 24 } | |
| 25 | |
| 26 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BookmarkManagerEditDisabled) { | |
| 27 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 28 switches::kEnableExperimentalExtensionApis); | |
| 29 | |
| 30 Profile* profile = browser()->profile(); | |
| 31 | |
| 32 // Provide some testing data here, since bookmark editing will be disabled | |
| 33 // within the extension. | |
| 34 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); | |
| 35 ui_test_utils::WaitForBookmarkModelToLoad(model); | |
| 36 const BookmarkNode* bar = model->bookmark_bar_node(); | |
| 37 const BookmarkNode* folder = model->AddFolder(bar, 0, ASCIIToUTF16("Folder")); | |
| 38 model->AddURL(bar, 1, ASCIIToUTF16("AAA"), GURL("http://aaa.example.com")); | |
| 39 model->AddURL(folder, 0, ASCIIToUTF16("BBB"), GURL("http://bbb.example.com")); | |
| 40 | |
| 41 PrefServiceBase* prefs = PrefServiceBase::FromBrowserContext(profile); | |
| 42 prefs->SetBoolean(prefs::kEditBookmarksEnabled, false); | |
| 43 | |
| 44 ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/edit_disabled")) | |
| 45 << message_; | |
| 46 } | |
| OLD | NEW |