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

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_unittest.cc

Issue 10827045: 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, 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/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h" 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h" 10 #include "chrome/browser/bookmarks/bookmark_model.h"
11 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
11 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/gtk/tabstrip_origin_provider.h" 13 #include "chrome/browser/ui/gtk/tabstrip_origin_provider.h"
13 #include "chrome/test/base/test_browser_window.h" 14 #include "chrome/test/base/test_browser_window.h"
14 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
15 #include "content/public/test/test_browser_thread.h" 16 #include "content/public/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 content::BrowserThread; 19 using content::BrowserThread;
19 20
20 // Dummy implementation that's good enough for the tests; we don't test 21 // Dummy implementation that's good enough for the tests; we don't test
21 // rendering here so all we need is a non-NULL object. 22 // rendering here so all we need is a non-NULL object.
22 class EmptyTabstripOriginProvider : public TabstripOriginProvider { 23 class EmptyTabstripOriginProvider : public TabstripOriginProvider {
23 public: 24 public:
24 virtual gfx::Point GetTabStripOriginForWidget(GtkWidget* widget) { 25 virtual gfx::Point GetTabStripOriginForWidget(GtkWidget* widget) {
25 return gfx::Point(0, 0); 26 return gfx::Point(0, 0);
26 } 27 }
27 }; 28 };
28 29
29 class BookmarkBarGtkUnittest : public testing::Test { 30 class BookmarkBarGtkUnittest : public testing::Test {
30 protected: 31 protected:
31 BookmarkBarGtkUnittest() 32 BookmarkBarGtkUnittest()
32 : ui_thread_(BrowserThread::UI, &message_loop_), 33 : ui_thread_(BrowserThread::UI, &message_loop_),
33 file_thread_(BrowserThread::FILE, &message_loop_) { 34 file_thread_(BrowserThread::FILE, &message_loop_) {
34 } 35 }
35 36
36 virtual void SetUp() OVERRIDE { 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 model_ = profile_->GetBookmarkModel(); 41 model_ = BookmarkModelFactory::GetForProfile(profile_.get());
41 42
42 browser_.reset( 43 browser_.reset(
43 chrome::CreateBrowserWithTestWindowForProfile(profile_.get())); 44 chrome::CreateBrowserWithTestWindowForProfile(profile_.get()));
44 origin_provider_.reset(new EmptyTabstripOriginProvider); 45 origin_provider_.reset(new EmptyTabstripOriginProvider);
45 bookmark_bar_.reset(new BookmarkBarGtk(NULL, browser_.get(), 46 bookmark_bar_.reset(new BookmarkBarGtk(NULL, browser_.get(),
46 origin_provider_.get())); 47 origin_provider_.get()));
47 } 48 }
48 49
49 virtual void TearDown() OVERRIDE { 50 virtual void TearDown() OVERRIDE {
50 message_loop_.RunAllPending(); 51 message_loop_.RunAllPending();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 ASCIIToUTF16("other"), GURL("http://two.com")); 93 ASCIIToUTF16("other"), GURL("http://two.com"));
93 94
94 bookmark_bar_->Loaded(model_, false); 95 bookmark_bar_->Loaded(model_, false);
95 96
96 // We should expect two children to the bookmark bar's toolbar. 97 // We should expect two children to the bookmark bar's toolbar.
97 GList* children = gtk_container_get_children( 98 GList* children = gtk_container_get_children(
98 GTK_CONTAINER(bookmark_bar_->bookmark_toolbar_.get())); 99 GTK_CONTAINER(bookmark_bar_->bookmark_toolbar_.get()));
99 EXPECT_EQ(2U, g_list_length(children)); 100 EXPECT_EQ(2U, g_list_length(children));
100 g_list_free(children); 101 g_list_free(children);
101 } 102 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc ('k') | chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698