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

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

Issue 10821097: Removing instances of profile_->GetBookmarkModel() as part of converting BookmarkModel to a PKS. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/bookmarks/bookmark_manager_extension_api.h" 7 #include "chrome/browser/bookmarks/bookmark_manager_extension_api.h"
8 #include "chrome/browser/bookmarks/bookmark_model.h" 8 #include "chrome/browser/bookmarks/bookmark_model.h"
9 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
11 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
15 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
16 17
17 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BookmarkManager) { 18 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BookmarkManager) {
18 CommandLine::ForCurrentProcess()->AppendSwitch( 19 CommandLine::ForCurrentProcess()->AppendSwitch(
19 switches::kEnableExperimentalExtensionApis); 20 switches::kEnableExperimentalExtensionApis);
20 21
21 ASSERT_TRUE(RunExtensionTest("bookmark_manager/standard")) << message_; 22 ASSERT_TRUE(RunExtensionTest("bookmark_manager/standard")) << message_;
22 } 23 }
23 24
24 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BookmarkManagerEditDisabled) { 25 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BookmarkManagerEditDisabled) {
25 CommandLine::ForCurrentProcess()->AppendSwitch( 26 CommandLine::ForCurrentProcess()->AppendSwitch(
26 switches::kEnableExperimentalExtensionApis); 27 switches::kEnableExperimentalExtensionApis);
27 28
28 Profile* profile = browser()->profile(); 29 Profile* profile = browser()->profile();
29 30
30 // Provide some testing data here, since bookmark editing will be disabled 31 // Provide some testing data here, since bookmark editing will be disabled
31 // within the extension. 32 // within the extension.
32 BookmarkModel* model = profile->GetBookmarkModel(); 33 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile);
33 ui_test_utils::WaitForBookmarkModelToLoad(model); 34 ui_test_utils::WaitForBookmarkModelToLoad(model);
34 const BookmarkNode* bar = model->bookmark_bar_node(); 35 const BookmarkNode* bar = model->bookmark_bar_node();
35 const BookmarkNode* folder = model->AddFolder(bar, 0, ASCIIToUTF16("Folder")); 36 const BookmarkNode* folder = model->AddFolder(bar, 0, ASCIIToUTF16("Folder"));
36 model->AddURL(bar, 1, ASCIIToUTF16("AAA"), GURL("http://aaa.example.com")); 37 model->AddURL(bar, 1, ASCIIToUTF16("AAA"), GURL("http://aaa.example.com"));
37 model->AddURL(folder, 0, ASCIIToUTF16("BBB"), GURL("http://bbb.example.com")); 38 model->AddURL(folder, 0, ASCIIToUTF16("BBB"), GURL("http://bbb.example.com"));
38 39
39 profile->GetPrefs()->SetBoolean(prefs::kEditBookmarksEnabled, false); 40 profile->GetPrefs()->SetBoolean(prefs::kEditBookmarksEnabled, false);
40 41
41 ASSERT_TRUE(RunExtensionTest("bookmark_manager/edit_disabled")) << message_; 42 ASSERT_TRUE(RunExtensionTest("bookmark_manager/edit_disabled")) << message_;
42 } 43 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_manager_extension_api.cc ('k') | chrome/browser/bookmarks/bookmark_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698