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

Side by Side Diff: chrome/browser/bookmarks/bookmark_manager_extension_apitest.cc

Issue 11516010: Move BookmarkManagerAPI to c/b/e/api (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_ungoop4
Patch Set: Created 8 years 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
OLDNEW
(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 // Times out on win asan, http://crbug.com/166026
19 #if defined(OS_WIN) && defined(ADDRESS_SANITIZER)
20 #define MAYBE_BookmarkManager DISABLED_BookmarkManager
21 #else
22 #define MAYBE_BookmarkManager BookmarkManager
23 #endif
24 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_BookmarkManager) {
25 CommandLine::ForCurrentProcess()->AppendSwitch(
26 switches::kEnableExperimentalExtensionApis);
27
28 ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/standard"))
29 << message_;
30 }
31
32 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BookmarkManagerEditDisabled) {
33 CommandLine::ForCurrentProcess()->AppendSwitch(
34 switches::kEnableExperimentalExtensionApis);
35
36 Profile* profile = browser()->profile();
37
38 // Provide some testing data here, since bookmark editing will be disabled
39 // within the extension.
40 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile);
41 ui_test_utils::WaitForBookmarkModelToLoad(model);
42 const BookmarkNode* bar = model->bookmark_bar_node();
43 const BookmarkNode* folder = model->AddFolder(bar, 0, ASCIIToUTF16("Folder"));
44 model->AddURL(bar, 1, ASCIIToUTF16("AAA"), GURL("http://aaa.example.com"));
45 model->AddURL(folder, 0, ASCIIToUTF16("BBB"), GURL("http://bbb.example.com"));
46
47 PrefServiceBase* prefs = PrefServiceBase::FromBrowserContext(profile);
48 prefs->SetBoolean(prefs::kEditBookmarksEnabled, false);
49
50 ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/edit_disabled"))
51 << message_;
52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698