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

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

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

Powered by Google App Engine
This is Rietveld 408576698