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

Side by Side Diff: chrome/test/live_sync/bookmark_model_verifier.cc

Issue 7318001: bookmarks: Rename |loaded_favicon_| to |is_favicon_loaded_| so it matches with the getter accessor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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 "chrome/test/live_sync/bookmark_model_verifier.h" 5 #include "chrome/test/live_sync/bookmark_model_verifier.h"
6 6
7 #include <stack> 7 #include <stack>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 17 matching lines...) Expand all
28 node_(node), 28 node_(node),
29 wait_for_load_(false) { 29 wait_for_load_(false) {
30 model->AddObserver(this); 30 model->AddObserver(this);
31 } 31 }
32 virtual ~FaviconChangeObserver() { 32 virtual ~FaviconChangeObserver() {
33 model_->RemoveObserver(this); 33 model_->RemoveObserver(this);
34 } 34 }
35 void WaitForGetFavicon() { 35 void WaitForGetFavicon() {
36 wait_for_load_ = true; 36 wait_for_load_ = true;
37 ui_test_utils::RunMessageLoop(); 37 ui_test_utils::RunMessageLoop();
38 ASSERT_TRUE(node_->is_favicon_loaded()); 38 ASSERT_TRUE(node_->favicon_loaded());
39 } 39 }
40 void WaitForSetFavicon() { 40 void WaitForSetFavicon() {
41 wait_for_load_ = false; 41 wait_for_load_ = false;
42 ui_test_utils::RunMessageLoop(); 42 ui_test_utils::RunMessageLoop();
43 } 43 }
44 virtual void Loaded(BookmarkModel* model) OVERRIDE {} 44 virtual void Loaded(BookmarkModel* model) OVERRIDE {}
45 virtual void BookmarkNodeMoved(BookmarkModel* model, 45 virtual void BookmarkNodeMoved(BookmarkModel* model,
46 const BookmarkNode* old_parent, 46 const BookmarkNode* old_parent,
47 int old_index, 47 int old_index,
48 const BookmarkNode* new_parent, 48 const BookmarkNode* new_parent,
(...skipping 10 matching lines...) Expand all
59 if (model == model_ && node == node_) 59 if (model == model_ && node == node_)
60 model->GetFavicon(node); 60 model->GetFavicon(node);
61 } 61 }
62 virtual void BookmarkNodeChildrenReordered( 62 virtual void BookmarkNodeChildrenReordered(
63 BookmarkModel* model, 63 BookmarkModel* model,
64 const BookmarkNode* node) OVERRIDE {} 64 const BookmarkNode* node) OVERRIDE {}
65 virtual void BookmarkNodeFaviconChanged( 65 virtual void BookmarkNodeFaviconChanged(
66 BookmarkModel* model, 66 BookmarkModel* model,
67 const BookmarkNode* node) OVERRIDE { 67 const BookmarkNode* node) OVERRIDE {
68 if (model == model_ && node == node_) { 68 if (model == model_ && node == node_) {
69 if (!wait_for_load_ || (wait_for_load_ && node->is_favicon_loaded())) 69 if (!wait_for_load_ || (wait_for_load_ && node->favicon_loaded()))
70 MessageLoopForUI::current()->Quit(); 70 MessageLoopForUI::current()->Quit();
71 } 71 }
72 } 72 }
73 73
74 private: 74 private:
75 BookmarkModel* model_; 75 BookmarkModel* model_;
76 const BookmarkNode* node_; 76 const BookmarkNode* node_;
77 bool wait_for_load_; 77 bool wait_for_load_;
78 DISALLOW_COPY_AND_ASSIGN(FaviconChangeObserver); 78 DISALLOW_COPY_AND_ASSIGN(FaviconChangeObserver);
79 }; 79 };
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 const SkBitmap& BookmarkModelVerifier::GetFavicon( 312 const SkBitmap& BookmarkModelVerifier::GetFavicon(
313 BookmarkModel* model, 313 BookmarkModel* model,
314 const BookmarkNode* node) const { 314 const BookmarkNode* node) const {
315 // If a favicon wasn't explicitly set for a particular URL, simply return its 315 // If a favicon wasn't explicitly set for a particular URL, simply return its
316 // blank favicon. 316 // blank favicon.
317 if (urls_with_favicons_.find(node->GetURL()) == urls_with_favicons_.end()) { 317 if (urls_with_favicons_.find(node->GetURL()) == urls_with_favicons_.end()) {
318 return node->favicon(); 318 return node->favicon();
319 } 319 }
320 // If a favicon was explicitly set, we may need to wait for it to be loaded 320 // If a favicon was explicitly set, we may need to wait for it to be loaded
321 // via BookmarkModel::GetFavIcon(), which is an asynchronous operation. 321 // via BookmarkModel::GetFavIcon(), which is an asynchronous operation.
322 if (!node->is_favicon_loaded()) { 322 if (!node->favicon_loaded()) {
323 FaviconChangeObserver observer(model, node); 323 FaviconChangeObserver observer(model, node);
324 model->GetFavicon(node); 324 model->GetFavicon(node);
325 observer.WaitForGetFavicon(); 325 observer.WaitForGetFavicon();
326 } 326 }
327 EXPECT_TRUE(node->is_favicon_loaded()); 327 EXPECT_TRUE(node->favicon_loaded());
328 return node->favicon(); 328 return node->favicon();
329 } 329 }
330 330
331 void BookmarkModelVerifier::Move(BookmarkModel* model, 331 void BookmarkModelVerifier::Move(BookmarkModel* model,
332 const BookmarkNode* node, 332 const BookmarkNode* node,
333 const BookmarkNode* new_parent, 333 const BookmarkNode* new_parent,
334 int index) { 334 int index) {
335 if (use_verifier_model_) { 335 if (use_verifier_model_) {
336 const BookmarkNode* v_new_parent = NULL; 336 const BookmarkNode* v_new_parent = NULL;
337 const BookmarkNode* v_node = NULL; 337 const BookmarkNode* v_node = NULL;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 const BookmarkNode* v_node = NULL; 380 const BookmarkNode* v_node = NULL;
381 FindNodeInVerifier(model, node, &v_node); 381 FindNodeInVerifier(model, node, &v_node);
382 bookmark_utils::ApplyEditsWithNoFolderChange( 382 bookmark_utils::ApplyEditsWithNoFolderChange(
383 verifier_model_, v_node->parent(), 383 verifier_model_, v_node->parent(),
384 BookmarkEditor::EditDetails(v_node), v_node->GetTitle(), new_url); 384 BookmarkEditor::EditDetails(v_node), v_node->GetTitle(), new_url);
385 } 385 }
386 return bookmark_utils::ApplyEditsWithNoFolderChange( 386 return bookmark_utils::ApplyEditsWithNoFolderChange(
387 model, node->parent(), BookmarkEditor::EditDetails(node), 387 model, node->parent(), BookmarkEditor::EditDetails(node),
388 node->GetTitle(), new_url); 388 node->GetTitle(), new_url);
389 } 389 }
OLDNEW
« chrome/browser/bookmarks/bookmark_model.h ('K') | « chrome/browser/bookmarks/bookmark_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698