OLD | NEW |
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 <gtk/gtk.h> | 5 #include <gtk/gtk.h> |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
| 9 #include "base/compiler_specific.h" |
9 #include "base/string_util.h" | 10 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/bookmarks/bookmark_model.h" | 12 #include "chrome/browser/bookmarks/bookmark_model.h" |
12 #include "chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.h" | 13 #include "chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.h" |
13 #include "chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.h" | 14 #include "chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.h" |
14 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
15 #include "content/test/test_browser_thread.h" | 16 #include "content/test/test_browser_thread.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 using base::Time; | 19 using base::Time; |
19 using base::TimeDelta; | 20 using base::TimeDelta; |
20 using bookmark_utils::GetTitleFromTreeIter; | 21 using bookmark_utils::GetTitleFromTreeIter; |
21 using content::BrowserThread; | 22 using content::BrowserThread; |
22 | 23 |
23 // Base class for bookmark editor tests. This class is a copy from | 24 // Base class for bookmark editor tests. This class is a copy from |
24 // bookmark_editor_view_unittest.cc, and all the tests in this file are | 25 // bookmark_editor_view_unittest.cc, and all the tests in this file are |
25 // GTK-ifications of the corresponding views tests. Testing here is really | 26 // GTK-ifications of the corresponding views tests. Testing here is really |
26 // important because on Linux, we make round trip copies from chrome's | 27 // important because on Linux, we make round trip copies from chrome's |
27 // BookmarkModel class to GTK's native GtkTreeStore. | 28 // BookmarkModel class to GTK's native GtkTreeStore. |
28 class BookmarkEditorGtkTest : public testing::Test { | 29 class BookmarkEditorGtkTest : public testing::Test { |
29 public: | 30 public: |
30 BookmarkEditorGtkTest() | 31 BookmarkEditorGtkTest() |
31 : ui_thread_(BrowserThread::UI, &message_loop_), | 32 : model_(NULL), |
32 file_thread_(BrowserThread::FILE, &message_loop_), | 33 ui_thread_(BrowserThread::UI, &message_loop_), |
33 model_(NULL) { | 34 file_thread_(BrowserThread::FILE, &message_loop_) { |
34 } | 35 } |
35 | 36 |
36 virtual void SetUp() { | 37 virtual void SetUp() OVERRIDE { |
37 profile_.reset(new TestingProfile()); | 38 profile_.reset(new TestingProfile()); |
38 profile_->CreateBookmarkModel(true); | 39 profile_->CreateBookmarkModel(true); |
39 profile_->BlockUntilBookmarkModelLoaded(); | 40 profile_->BlockUntilBookmarkModelLoaded(); |
40 | 41 |
41 model_ = profile_->GetBookmarkModel(); | 42 model_ = profile_->GetBookmarkModel(); |
42 | 43 |
43 AddTestData(); | 44 AddTestData(); |
44 } | 45 } |
45 | 46 |
46 virtual void TearDown() { | 47 virtual void TearDown() OVERRIDE { |
47 } | 48 } |
48 | 49 |
49 protected: | 50 protected: |
50 MessageLoopForUI message_loop_; | |
51 content::TestBrowserThread ui_thread_; | |
52 content::TestBrowserThread file_thread_; | |
53 BookmarkModel* model_; | |
54 scoped_ptr<TestingProfile> profile_; | |
55 | |
56 std::string base_path() const { return "file:///c:/tmp/"; } | 51 std::string base_path() const { return "file:///c:/tmp/"; } |
57 | 52 |
58 const BookmarkNode* GetNode(const std::string& name) { | 53 const BookmarkNode* GetNode(const std::string& name) { |
59 return model_->GetMostRecentlyAddedNodeForURL(GURL(base_path() + name)); | 54 return model_->GetMostRecentlyAddedNodeForURL(GURL(base_path() + name)); |
60 } | 55 } |
61 | 56 |
| 57 BookmarkModel* model_; |
| 58 scoped_ptr<TestingProfile> profile_; |
| 59 |
62 private: | 60 private: |
63 // Creates the following structure: | 61 // Creates the following structure: |
64 // bookmark bar node | 62 // bookmark bar node |
65 // a | 63 // a |
66 // F1 | 64 // F1 |
67 // f1a | 65 // f1a |
68 // F11 | 66 // F11 |
69 // f11a | 67 // f11a |
70 // F2 | 68 // F2 |
71 // other node | 69 // other node |
(...skipping 18 matching lines...) Expand all Loading... |
90 model_->AddURL(model_->other_node(), 0, ASCIIToUTF16("oa"), | 88 model_->AddURL(model_->other_node(), 0, ASCIIToUTF16("oa"), |
91 GURL(test_base + "oa")); | 89 GURL(test_base + "oa")); |
92 const BookmarkNode* of1 = | 90 const BookmarkNode* of1 = |
93 model_->AddFolder(model_->other_node(), 1, ASCIIToUTF16("OF1")); | 91 model_->AddFolder(model_->other_node(), 1, ASCIIToUTF16("OF1")); |
94 model_->AddURL(of1, 0, ASCIIToUTF16("of1a"), GURL(test_base + "of1a")); | 92 model_->AddURL(of1, 0, ASCIIToUTF16("of1a"), GURL(test_base + "of1a")); |
95 | 93 |
96 // Children of the synced node. | 94 // Children of the synced node. |
97 model_->AddURL(model_->synced_node(), 0, ASCIIToUTF16("sa"), | 95 model_->AddURL(model_->synced_node(), 0, ASCIIToUTF16("sa"), |
98 GURL(test_base + "sa")); | 96 GURL(test_base + "sa")); |
99 } | 97 } |
| 98 |
| 99 MessageLoopForUI message_loop_; |
| 100 content::TestBrowserThread ui_thread_; |
| 101 content::TestBrowserThread file_thread_; |
100 }; | 102 }; |
101 | 103 |
102 // Makes sure the tree model matches that of the bookmark bar model. | 104 // Makes sure the tree model matches that of the bookmark bar model. |
103 TEST_F(BookmarkEditorGtkTest, ModelsMatch) { | 105 TEST_F(BookmarkEditorGtkTest, ModelsMatch) { |
104 BookmarkEditorGtk editor( | 106 BookmarkEditorGtk editor( |
105 NULL, | 107 NULL, |
106 profile_.get(), | 108 profile_.get(), |
107 NULL, | 109 NULL, |
108 BookmarkEditor::EditDetails::AddNodeInFolder(NULL, -1), | 110 BookmarkEditor::EditDetails::AddNodeInFolder(NULL, -1), |
109 BookmarkEditor::SHOW_TREE); | 111 BookmarkEditor::SHOW_TREE); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 BookmarkEditorGtk editor(NULL, profile_.get(), NULL, | 156 BookmarkEditorGtk editor(NULL, profile_.get(), NULL, |
155 BookmarkEditor::EditDetails::EditNode(GetNode("a")), | 157 BookmarkEditor::EditDetails::EditNode(GetNode("a")), |
156 BookmarkEditor::SHOW_TREE); | 158 BookmarkEditor::SHOW_TREE); |
157 gtk_entry_set_text(GTK_ENTRY(editor.name_entry_), "new_a"); | 159 gtk_entry_set_text(GTK_ENTRY(editor.name_entry_), "new_a"); |
158 | 160 |
159 GtkTreeIter bookmark_bar_node; | 161 GtkTreeIter bookmark_bar_node; |
160 GtkTreeModel* store = GTK_TREE_MODEL(editor.tree_store_); | 162 GtkTreeModel* store = GTK_TREE_MODEL(editor.tree_store_); |
161 ASSERT_TRUE(gtk_tree_model_get_iter_first(store, &bookmark_bar_node)); | 163 ASSERT_TRUE(gtk_tree_model_get_iter_first(store, &bookmark_bar_node)); |
162 editor.ApplyEdits(&bookmark_bar_node); | 164 editor.ApplyEdits(&bookmark_bar_node); |
163 | 165 |
164 const BookmarkNode* bb_node = | 166 const BookmarkNode* bb_node = model_->bookmark_bar_node(); |
165 profile_->GetBookmarkModel()->bookmark_bar_node(); | |
166 ASSERT_EQ(ASCIIToUTF16("new_a"), bb_node->GetChild(0)->GetTitle()); | 167 ASSERT_EQ(ASCIIToUTF16("new_a"), bb_node->GetChild(0)->GetTitle()); |
167 // The URL shouldn't have changed. | 168 // The URL shouldn't have changed. |
168 ASSERT_TRUE(GURL(base_path() + "a") == bb_node->GetChild(0)->url()); | 169 ASSERT_TRUE(GURL(base_path() + "a") == bb_node->GetChild(0)->url()); |
169 } | 170 } |
170 | 171 |
171 // Changes the url and makes sure parent/visual order doesn't change. | 172 // Changes the url and makes sure parent/visual order doesn't change. |
172 TEST_F(BookmarkEditorGtkTest, EditURLKeepsPosition) { | 173 TEST_F(BookmarkEditorGtkTest, EditURLKeepsPosition) { |
173 Time node_time = GetNode("a")->date_added(); | 174 Time node_time = GetNode("a")->date_added(); |
174 BookmarkEditorGtk editor(NULL, profile_.get(), NULL, | 175 BookmarkEditorGtk editor(NULL, profile_.get(), NULL, |
175 BookmarkEditor::EditDetails::EditNode(GetNode("a")), | 176 BookmarkEditor::EditDetails::EditNode(GetNode("a")), |
176 BookmarkEditor::SHOW_TREE); | 177 BookmarkEditor::SHOW_TREE); |
177 gtk_entry_set_text(GTK_ENTRY(editor.url_entry_), | 178 gtk_entry_set_text(GTK_ENTRY(editor.url_entry_), |
178 GURL(base_path() + "new_a").spec().c_str()); | 179 GURL(base_path() + "new_a").spec().c_str()); |
179 | 180 |
180 GtkTreeIter bookmark_bar_node; | 181 GtkTreeIter bookmark_bar_node; |
181 GtkTreeModel* store = GTK_TREE_MODEL(editor.tree_store_); | 182 GtkTreeModel* store = GTK_TREE_MODEL(editor.tree_store_); |
182 ASSERT_TRUE(gtk_tree_model_get_iter_first(store, &bookmark_bar_node)); | 183 ASSERT_TRUE(gtk_tree_model_get_iter_first(store, &bookmark_bar_node)); |
183 editor.ApplyEdits(&bookmark_bar_node); | 184 editor.ApplyEdits(&bookmark_bar_node); |
184 | 185 |
185 const BookmarkNode* bb_node = | 186 const BookmarkNode* bb_node = model_->bookmark_bar_node(); |
186 profile_->GetBookmarkModel()->bookmark_bar_node(); | |
187 ASSERT_EQ(ASCIIToUTF16("a"), bb_node->GetChild(0)->GetTitle()); | 187 ASSERT_EQ(ASCIIToUTF16("a"), bb_node->GetChild(0)->GetTitle()); |
188 // The URL should have changed. | 188 // The URL should have changed. |
189 ASSERT_TRUE(GURL(base_path() + "new_a") == bb_node->GetChild(0)->url()); | 189 ASSERT_TRUE(GURL(base_path() + "new_a") == bb_node->GetChild(0)->url()); |
190 ASSERT_TRUE(node_time == bb_node->GetChild(0)->date_added()); | 190 ASSERT_TRUE(node_time == bb_node->GetChild(0)->date_added()); |
191 } | 191 } |
192 | 192 |
193 // Moves 'a' to be a child of the other node. | 193 // Moves 'a' to be a child of the other node. |
194 TEST_F(BookmarkEditorGtkTest, ChangeParent) { | 194 TEST_F(BookmarkEditorGtkTest, ChangeParent) { |
195 BookmarkEditorGtk editor(NULL, profile_.get(), NULL, | 195 BookmarkEditorGtk editor(NULL, profile_.get(), NULL, |
196 BookmarkEditor::EditDetails::EditNode(GetNode("a")), | 196 BookmarkEditor::EditDetails::EditNode(GetNode("a")), |
197 BookmarkEditor::SHOW_TREE); | 197 BookmarkEditor::SHOW_TREE); |
198 | 198 |
199 GtkTreeModel* store = GTK_TREE_MODEL(editor.tree_store_); | 199 GtkTreeModel* store = GTK_TREE_MODEL(editor.tree_store_); |
200 GtkTreeIter gtk_other_node; | 200 GtkTreeIter gtk_other_node; |
201 ASSERT_TRUE(gtk_tree_model_get_iter_first(store, >k_other_node)); | 201 ASSERT_TRUE(gtk_tree_model_get_iter_first(store, >k_other_node)); |
202 ASSERT_TRUE(gtk_tree_model_iter_next(store, >k_other_node)); | 202 ASSERT_TRUE(gtk_tree_model_iter_next(store, >k_other_node)); |
203 editor.ApplyEdits(>k_other_node); | 203 editor.ApplyEdits(>k_other_node); |
204 | 204 |
205 const BookmarkNode* other_node = profile_->GetBookmarkModel()->other_node(); | 205 const BookmarkNode* other_node = model_->other_node(); |
206 ASSERT_EQ(ASCIIToUTF16("a"), other_node->GetChild(2)->GetTitle()); | 206 ASSERT_EQ(ASCIIToUTF16("a"), other_node->GetChild(2)->GetTitle()); |
207 ASSERT_TRUE(GURL(base_path() + "a") == other_node->GetChild(2)->url()); | 207 ASSERT_TRUE(GURL(base_path() + "a") == other_node->GetChild(2)->url()); |
208 } | 208 } |
209 | 209 |
210 // Moves 'a' to be a child of the other node. | 210 // Moves 'a' to be a child of the other node. |
211 // Moves 'a' to be a child of the other node and changes its url to new_a. | 211 // Moves 'a' to be a child of the other node and changes its url to new_a. |
212 TEST_F(BookmarkEditorGtkTest, ChangeParentAndURL) { | 212 TEST_F(BookmarkEditorGtkTest, ChangeParentAndURL) { |
213 Time node_time = GetNode("a")->date_added(); | 213 Time node_time = GetNode("a")->date_added(); |
214 BookmarkEditorGtk editor(NULL, profile_.get(), NULL, | 214 BookmarkEditorGtk editor(NULL, profile_.get(), NULL, |
215 BookmarkEditor::EditDetails::EditNode(GetNode("a")), | 215 BookmarkEditor::EditDetails::EditNode(GetNode("a")), |
216 BookmarkEditor::SHOW_TREE); | 216 BookmarkEditor::SHOW_TREE); |
217 | 217 |
218 gtk_entry_set_text(GTK_ENTRY(editor.url_entry_), | 218 gtk_entry_set_text(GTK_ENTRY(editor.url_entry_), |
219 GURL(base_path() + "new_a").spec().c_str()); | 219 GURL(base_path() + "new_a").spec().c_str()); |
220 | 220 |
221 GtkTreeModel* store = GTK_TREE_MODEL(editor.tree_store_); | 221 GtkTreeModel* store = GTK_TREE_MODEL(editor.tree_store_); |
222 GtkTreeIter gtk_other_node; | 222 GtkTreeIter gtk_other_node; |
223 ASSERT_TRUE(gtk_tree_model_get_iter_first(store, >k_other_node)); | 223 ASSERT_TRUE(gtk_tree_model_get_iter_first(store, >k_other_node)); |
224 ASSERT_TRUE(gtk_tree_model_iter_next(store, >k_other_node)); | 224 ASSERT_TRUE(gtk_tree_model_iter_next(store, >k_other_node)); |
225 editor.ApplyEdits(>k_other_node); | 225 editor.ApplyEdits(>k_other_node); |
226 | 226 |
227 const BookmarkNode* other_node = profile_->GetBookmarkModel()->other_node(); | 227 const BookmarkNode* other_node = model_->other_node(); |
228 ASSERT_EQ(ASCIIToUTF16("a"), other_node->GetChild(2)->GetTitle()); | 228 ASSERT_EQ(ASCIIToUTF16("a"), other_node->GetChild(2)->GetTitle()); |
229 ASSERT_TRUE(GURL(base_path() + "new_a") == other_node->GetChild(2)->url()); | 229 ASSERT_TRUE(GURL(base_path() + "new_a") == other_node->GetChild(2)->url()); |
230 ASSERT_TRUE(node_time == other_node->GetChild(2)->date_added()); | 230 ASSERT_TRUE(node_time == other_node->GetChild(2)->date_added()); |
231 } | 231 } |
232 | 232 |
233 // Creates a new folder and moves a node to it. | 233 // Creates a new folder and moves a node to it. |
234 TEST_F(BookmarkEditorGtkTest, MoveToNewParent) { | 234 TEST_F(BookmarkEditorGtkTest, MoveToNewParent) { |
235 BookmarkEditorGtk editor(NULL, profile_.get(), NULL, | 235 BookmarkEditorGtk editor(NULL, profile_.get(), NULL, |
236 BookmarkEditor::EditDetails::EditNode(GetNode("a")), | 236 BookmarkEditor::EditDetails::EditNode(GetNode("a")), |
237 BookmarkEditor::SHOW_TREE); | 237 BookmarkEditor::SHOW_TREE); |
(...skipping 16 matching lines...) Expand all Loading... |
254 bookmark_utils::FOLDER_NAME, "F21", -1); | 254 bookmark_utils::FOLDER_NAME, "F21", -1); |
255 GtkTreeIter f211_iter; | 255 GtkTreeIter f211_iter; |
256 editor.AddNewFolder(&f21_iter, &f211_iter); | 256 editor.AddNewFolder(&f21_iter, &f211_iter); |
257 gtk_tree_store_set(editor.tree_store_, &f211_iter, | 257 gtk_tree_store_set(editor.tree_store_, &f211_iter, |
258 bookmark_utils::FOLDER_NAME, "F211", -1); | 258 bookmark_utils::FOLDER_NAME, "F211", -1); |
259 | 259 |
260 ASSERT_EQ(1, gtk_tree_model_iter_n_children(store, &f2_iter)); | 260 ASSERT_EQ(1, gtk_tree_model_iter_n_children(store, &f2_iter)); |
261 | 261 |
262 editor.ApplyEdits(&f2_iter); | 262 editor.ApplyEdits(&f2_iter); |
263 | 263 |
264 const BookmarkNode* bb_node = | 264 const BookmarkNode* bb_node = model_->bookmark_bar_node(); |
265 profile_->GetBookmarkModel()->bookmark_bar_node(); | |
266 const BookmarkNode* mf2 = bb_node->GetChild(1); | 265 const BookmarkNode* mf2 = bb_node->GetChild(1); |
267 | 266 |
268 // F2 in the model should have two children now: F21 and the node edited. | 267 // F2 in the model should have two children now: F21 and the node edited. |
269 ASSERT_EQ(2, mf2->child_count()); | 268 ASSERT_EQ(2, mf2->child_count()); |
270 // F21 should be first. | 269 // F21 should be first. |
271 ASSERT_EQ(ASCIIToUTF16("F21"), mf2->GetChild(0)->GetTitle()); | 270 ASSERT_EQ(ASCIIToUTF16("F21"), mf2->GetChild(0)->GetTitle()); |
272 // Then a. | 271 // Then a. |
273 ASSERT_EQ(ASCIIToUTF16("a"), mf2->GetChild(1)->GetTitle()); | 272 ASSERT_EQ(ASCIIToUTF16("a"), mf2->GetChild(1)->GetTitle()); |
274 | 273 |
275 // F21 should have one child, F211. | 274 // F21 should have one child, F211. |
(...skipping 13 matching lines...) Expand all Loading... |
289 | 288 |
290 gtk_entry_set_text(GTK_ENTRY(editor.url_entry_), | 289 gtk_entry_set_text(GTK_ENTRY(editor.url_entry_), |
291 GURL(base_path() + "a").spec().c_str()); | 290 GURL(base_path() + "a").spec().c_str()); |
292 gtk_entry_set_text(GTK_ENTRY(editor.name_entry_), "new_a"); | 291 gtk_entry_set_text(GTK_ENTRY(editor.name_entry_), "new_a"); |
293 | 292 |
294 GtkTreeIter bookmark_bar_node; | 293 GtkTreeIter bookmark_bar_node; |
295 GtkTreeModel* store = GTK_TREE_MODEL(editor.tree_store_); | 294 GtkTreeModel* store = GTK_TREE_MODEL(editor.tree_store_); |
296 ASSERT_TRUE(gtk_tree_model_get_iter_first(store, &bookmark_bar_node)); | 295 ASSERT_TRUE(gtk_tree_model_get_iter_first(store, &bookmark_bar_node)); |
297 editor.ApplyEdits(&bookmark_bar_node); | 296 editor.ApplyEdits(&bookmark_bar_node); |
298 | 297 |
299 const BookmarkNode* bb_node = | 298 const BookmarkNode* bb_node = model_->bookmark_bar_node(); |
300 profile_->GetBookmarkModel()->bookmark_bar_node(); | |
301 ASSERT_EQ(4, bb_node->child_count()); | 299 ASSERT_EQ(4, bb_node->child_count()); |
302 | 300 |
303 const BookmarkNode* new_node = bb_node->GetChild(3); | 301 const BookmarkNode* new_node = bb_node->GetChild(3); |
304 EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitle()); | 302 EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitle()); |
305 EXPECT_TRUE(GURL(base_path() + "a") == new_node->url()); | 303 EXPECT_TRUE(GURL(base_path() + "a") == new_node->url()); |
306 } | 304 } |
307 | 305 |
308 // Brings up the editor with no tree and modifies the url. | 306 // Brings up the editor with no tree and modifies the url. |
309 TEST_F(BookmarkEditorGtkTest, ChangeURLNoTree) { | 307 TEST_F(BookmarkEditorGtkTest, ChangeURLNoTree) { |
310 BookmarkEditorGtk editor(NULL, profile_.get(), NULL, | 308 BookmarkEditorGtk editor(NULL, profile_.get(), NULL, |
311 BookmarkEditor::EditDetails::EditNode( | 309 BookmarkEditor::EditDetails::EditNode( |
312 model_->other_node()->GetChild(0)), | 310 model_->other_node()->GetChild(0)), |
313 BookmarkEditor::NO_TREE); | 311 BookmarkEditor::NO_TREE); |
314 | 312 |
315 gtk_entry_set_text(GTK_ENTRY(editor.url_entry_), | 313 gtk_entry_set_text(GTK_ENTRY(editor.url_entry_), |
316 GURL(base_path() + "a").spec().c_str()); | 314 GURL(base_path() + "a").spec().c_str()); |
317 gtk_entry_set_text(GTK_ENTRY(editor.name_entry_), "new_a"); | 315 gtk_entry_set_text(GTK_ENTRY(editor.name_entry_), "new_a"); |
318 | 316 |
319 editor.ApplyEdits(NULL); | 317 editor.ApplyEdits(NULL); |
320 | 318 |
321 const BookmarkNode* other_node = profile_->GetBookmarkModel()->other_node(); | 319 const BookmarkNode* other_node = model_->other_node(); |
322 ASSERT_EQ(2, other_node->child_count()); | 320 ASSERT_EQ(2, other_node->child_count()); |
323 | 321 |
324 const BookmarkNode* new_node = other_node->GetChild(0); | 322 const BookmarkNode* new_node = other_node->GetChild(0); |
325 | 323 |
326 EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitle()); | 324 EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitle()); |
327 EXPECT_TRUE(GURL(base_path() + "a") == new_node->url()); | 325 EXPECT_TRUE(GURL(base_path() + "a") == new_node->url()); |
328 } | 326 } |
329 | 327 |
330 // Brings up the editor with no tree and modifies only the title. | 328 // Brings up the editor with no tree and modifies only the title. |
331 TEST_F(BookmarkEditorGtkTest, ChangeTitleNoTree) { | 329 TEST_F(BookmarkEditorGtkTest, ChangeTitleNoTree) { |
332 BookmarkEditorGtk editor(NULL, profile_.get(), NULL, | 330 BookmarkEditorGtk editor(NULL, profile_.get(), NULL, |
333 BookmarkEditor::EditDetails::EditNode( | 331 BookmarkEditor::EditDetails::EditNode( |
334 model_->other_node()->GetChild(0)), | 332 model_->other_node()->GetChild(0)), |
335 BookmarkEditor::NO_TREE); | 333 BookmarkEditor::NO_TREE); |
336 gtk_entry_set_text(GTK_ENTRY(editor.name_entry_), "new_a"); | 334 gtk_entry_set_text(GTK_ENTRY(editor.name_entry_), "new_a"); |
337 | 335 |
338 editor.ApplyEdits(); | 336 editor.ApplyEdits(); |
339 | 337 |
340 const BookmarkNode* other_node = profile_->GetBookmarkModel()->other_node(); | 338 const BookmarkNode* other_node = model_->other_node(); |
341 ASSERT_EQ(2, other_node->child_count()); | 339 ASSERT_EQ(2, other_node->child_count()); |
342 | 340 |
343 const BookmarkNode* new_node = other_node->GetChild(0); | 341 const BookmarkNode* new_node = other_node->GetChild(0); |
344 EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitle()); | 342 EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitle()); |
345 } | 343 } |
OLD | NEW |