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 "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/task.h" | 7 #include "base/task.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/gtk/tabstrip_origin_provider.h" | 11 #include "chrome/browser/ui/gtk/tabstrip_origin_provider.h" |
12 #include "chrome/test/base/testing_browser_process_test.h" | |
13 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
14 #include "content/browser/browser_thread.h" | 13 #include "content/browser/browser_thread.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
16 | 15 |
17 // Dummy implementation that's good enough for the tests; we don't test | 16 // Dummy implementation that's good enough for the tests; we don't test |
18 // rendering here so all we need is a non-NULL object. | 17 // rendering here so all we need is a non-NULL object. |
19 class EmptyTabstripOriginProvider : public TabstripOriginProvider { | 18 class EmptyTabstripOriginProvider : public TabstripOriginProvider { |
20 public: | 19 public: |
21 virtual gfx::Point GetTabStripOriginForWidget(GtkWidget* widget) { | 20 virtual gfx::Point GetTabStripOriginForWidget(GtkWidget* widget) { |
22 return gfx::Point(0, 0); | 21 return gfx::Point(0, 0); |
23 } | 22 } |
24 }; | 23 }; |
25 | 24 |
26 class BookmarkBarGtkUnittest : public TestingBrowserProcessTest { | 25 class BookmarkBarGtkUnittest : public testing::Test { |
27 protected: | 26 protected: |
28 BookmarkBarGtkUnittest() | 27 BookmarkBarGtkUnittest() |
29 : ui_thread_(BrowserThread::UI, &message_loop_), | 28 : ui_thread_(BrowserThread::UI, &message_loop_), |
30 file_thread_(BrowserThread::FILE, &message_loop_) { | 29 file_thread_(BrowserThread::FILE, &message_loop_) { |
31 } | 30 } |
32 | 31 |
33 virtual void SetUp() { | 32 virtual void SetUp() { |
34 profile_.reset(new TestingProfile()); | 33 profile_.reset(new TestingProfile()); |
35 profile_->CreateBookmarkModel(true); | 34 profile_->CreateBookmarkModel(true); |
36 profile_->BlockUntilBookmarkModelLoaded(); | 35 profile_->BlockUntilBookmarkModelLoaded(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 ASCIIToUTF16("other"), GURL("http://two.com")); | 89 ASCIIToUTF16("other"), GURL("http://two.com")); |
91 | 90 |
92 bookmark_bar_->Loaded(model, false); | 91 bookmark_bar_->Loaded(model, false); |
93 | 92 |
94 // We should expect two children to the bookmark bar's toolbar. | 93 // We should expect two children to the bookmark bar's toolbar. |
95 GList* children = gtk_container_get_children( | 94 GList* children = gtk_container_get_children( |
96 GTK_CONTAINER(bookmark_bar_->bookmark_toolbar_.get())); | 95 GTK_CONTAINER(bookmark_bar_->bookmark_toolbar_.get())); |
97 EXPECT_EQ(2U, g_list_length(children)); | 96 EXPECT_EQ(2U, g_list_length(children)); |
98 g_list_free(children); | 97 g_list_free(children); |
99 } | 98 } |
OLD | NEW |