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

Side by Side Diff: chrome/browser/storage/durable_storage_browsertest.cc

Issue 2216713002: Use BookmarkModelFactory::GetForBrowserContext everywhere (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bookmarks
Patch Set: Replace in .mm files Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
(...skipping 25 matching lines...) Expand all
36 content::RenderFrameHost* GetRenderFrameHost(Browser* browser) { 36 content::RenderFrameHost* GetRenderFrameHost(Browser* browser) {
37 return browser->tab_strip_model()->GetActiveWebContents()->GetMainFrame(); 37 return browser->tab_strip_model()->GetActiveWebContents()->GetMainFrame();
38 } 38 }
39 39
40 content::RenderFrameHost* GetRenderFrameHost() { 40 content::RenderFrameHost* GetRenderFrameHost() {
41 return GetRenderFrameHost(browser()); 41 return GetRenderFrameHost(browser());
42 } 42 }
43 43
44 void Bookmark(Browser* browser) { 44 void Bookmark(Browser* browser) {
45 bookmarks::BookmarkModel* bookmark_model = 45 bookmarks::BookmarkModel* bookmark_model =
46 BookmarkModelFactory::GetForProfile(browser->profile()); 46 BookmarkModelFactory::GetForBrowserContext(browser->profile());
47 bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model); 47 bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model);
48 bookmarks::AddIfNotBookmarked(bookmark_model, url_, base::ASCIIToUTF16("")); 48 bookmarks::AddIfNotBookmarked(bookmark_model, url_, base::ASCIIToUTF16(""));
49 } 49 }
50 50
51 void Bookmark() { 51 void Bookmark() {
52 Bookmark(browser()); 52 Bookmark(browser());
53 } 53 }
54 54
55 GURL url_; 55 GURL url_;
56 56
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 bool is_persistent = false; 113 bool is_persistent = false;
114 114
115 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 115 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
116 GetRenderFrameHost(), "requestPermission()", &is_persistent)); 116 GetRenderFrameHost(), "requestPermission()", &is_persistent));
117 EXPECT_TRUE(is_persistent); 117 EXPECT_TRUE(is_persistent);
118 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 118 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
119 GetRenderFrameHost(), "checkPermission()", &is_persistent)); 119 GetRenderFrameHost(), "checkPermission()", &is_persistent));
120 EXPECT_TRUE(is_persistent); 120 EXPECT_TRUE(is_persistent);
121 121
122 bookmarks::BookmarkModel* bookmark_model = 122 bookmarks::BookmarkModel* bookmark_model =
123 BookmarkModelFactory::GetForProfile(browser()->profile()); 123 BookmarkModelFactory::GetForBrowserContext(browser()->profile());
124 bookmarks::RemoveAllBookmarks(bookmark_model, url_); 124 bookmarks::RemoveAllBookmarks(bookmark_model, url_);
125 125
126 // Unbookmarking doesn't change the permission. 126 // Unbookmarking doesn't change the permission.
127 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 127 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
128 GetRenderFrameHost(), "checkPermission()", &is_persistent)); 128 GetRenderFrameHost(), "checkPermission()", &is_persistent));
129 EXPECT_TRUE(is_persistent); 129 EXPECT_TRUE(is_persistent);
130 // Requesting after unbookmarking doesn't change the default box. 130 // Requesting after unbookmarking doesn't change the default box.
131 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 131 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
132 GetRenderFrameHost(), "requestPermission()", &is_persistent)); 132 GetRenderFrameHost(), "requestPermission()", &is_persistent));
133 EXPECT_TRUE(is_persistent); 133 EXPECT_TRUE(is_persistent);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 bool is_persistent = false; 167 bool is_persistent = false;
168 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(GetRenderFrameHost(browser), 168 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(GetRenderFrameHost(browser),
169 "requestPermission()", 169 "requestPermission()",
170 &is_persistent)); 170 &is_persistent));
171 EXPECT_TRUE(is_persistent); 171 EXPECT_TRUE(is_persistent);
172 172
173 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 173 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
174 GetRenderFrameHost(browser), "checkPermission()", &is_persistent)); 174 GetRenderFrameHost(browser), "checkPermission()", &is_persistent));
175 EXPECT_TRUE(is_persistent); 175 EXPECT_TRUE(is_persistent);
176 } 176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698