summaryrefslogtreecommitdiffstats
path: root/chrome/test/testing_profile.cc
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-29 19:46:56 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-29 19:46:56 +0000
commitd364c659874cdc48ea7d2e6e26c9df1335be1863 (patch)
tree03fcd110ac2678940127bb382d54b300794e0976 /chrome/test/testing_profile.cc
parent83aad14e14607a1bf1bea7c94d2cf71324b8a2d0 (diff)
downloadchromium_src-d364c659874cdc48ea7d2e6e26c9df1335be1863.zip
chromium_src-d364c659874cdc48ea7d2e6e26c9df1335be1863.tar.gz
chromium_src-d364c659874cdc48ea7d2e6e26c9df1335be1863.tar.bz2
Makes the HistoryContentsProvider query bookmark titles. I nuked a
couple of fields that I felt were redundant. I'm pretty sure I got the same logic, but you better stare at this to convince yourself. BUG=1256202 TEST=covered by unit tests git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1545 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/testing_profile.cc')
-rw-r--r--chrome/test/testing_profile.cc46
1 files changed, 45 insertions, 1 deletions
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index c91c372..ac7021d 100644
--- a/chrome/test/testing_profile.cc
+++ b/chrome/test/testing_profile.cc
@@ -7,6 +7,40 @@
#include "chrome/browser/history/history_backend.h"
#include "chrome/common/chrome_constants.h"
+namespace {
+
+// BookmarkLoadObserver is used when blocking until the BookmarkBarModel
+// finishes loading. As soon as the BookmarkBarModel finishes loading the
+// message loop is quit.
+class BookmarkLoadObserver : public BookmarkBarModelObserver {
+ public:
+ BookmarkLoadObserver() {}
+ virtual void Loaded(BookmarkBarModel* model) {
+ MessageLoop::current()->Quit();
+ }
+
+ virtual void BookmarkNodeMoved(BookmarkBarModel* model,
+ BookmarkBarNode* old_parent,
+ int old_index,
+ BookmarkBarNode* new_parent,
+ int new_index) {}
+ virtual void BookmarkNodeAdded(BookmarkBarModel* model,
+ BookmarkBarNode* parent,
+ int index) {}
+ virtual void BookmarkNodeRemoved(BookmarkBarModel* model,
+ BookmarkBarNode* parent,
+ int index) {}
+ virtual void BookmarkNodeChanged(BookmarkBarModel* model,
+ BookmarkBarNode* node) {}
+ virtual void BookmarkNodeFavIconLoaded(BookmarkBarModel* model,
+ BookmarkBarNode* node) {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BookmarkLoadObserver);
+};
+
+} // namespace
+
TestingProfile::TestingProfile()
: start_time_(Time::Now()), has_history_service_(false) {
PathService::Get(base::DIR_TEMP, &path_);
@@ -75,7 +109,17 @@ void TestingProfile::CreateBookmarkBarModel(bool delete_file) {
bookmark_bar_model_->Load();
}
+void TestingProfile::BlockUntilBookmarkModelLoaded() {
+ DCHECK(bookmark_bar_model_.get());
+ if (bookmark_bar_model_->IsLoaded())
+ return;
+ BookmarkLoadObserver observer;
+ bookmark_bar_model_->AddObserver(&observer);
+ MessageLoop::current()->Run();
+ bookmark_bar_model_->RemoveObserver(&observer);
+ DCHECK(bookmark_bar_model_->IsLoaded());
+}
+
void TestingProfile::CreateTemplateURLModel() {
template_url_model_.reset(new TemplateURLModel(this));
}
-