| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/bookmark_bar_gtk.h" | 5 #include "chrome/browser/gtk/bookmark_bar_gtk.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 8 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| 10 #include "chrome/browser/gtk/tabstrip_origin_provider.h" | 11 #include "chrome/browser/gtk/tabstrip_origin_provider.h" |
| 11 #include "base/task.h" | 12 #include "base/task.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "chrome/test/testing_profile.h" | 14 #include "chrome/test/testing_profile.h" |
| 14 | 15 |
| 15 // 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 |
| 16 // rendering here so all we need is a non-NULL object. | 17 // rendering here so all we need is a non-NULL object. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // There are no bookmarks in the model by default. Expect that the | 53 // There are no bookmarks in the model by default. Expect that the |
| 53 // |instructions_label| is shown. | 54 // |instructions_label| is shown. |
| 54 EXPECT_TRUE(bookmark_bar_->show_instructions_); | 55 EXPECT_TRUE(bookmark_bar_->show_instructions_); |
| 55 } | 56 } |
| 56 | 57 |
| 57 TEST_F(BookmarkBarGtkUnittest, HidesHelpMessageWithBookmark) { | 58 TEST_F(BookmarkBarGtkUnittest, HidesHelpMessageWithBookmark) { |
| 58 BookmarkModel* model = profile_->GetBookmarkModel(); | 59 BookmarkModel* model = profile_->GetBookmarkModel(); |
| 59 | 60 |
| 60 const BookmarkNode* parent = model->GetBookmarkBarNode(); | 61 const BookmarkNode* parent = model->GetBookmarkBarNode(); |
| 61 model->AddURL(parent, parent->GetChildCount(), | 62 model->AddURL(parent, parent->GetChildCount(), |
| 62 L"title", GURL("http://one.com")); | 63 ASCIIToUTF16("title"), GURL("http://one.com")); |
| 63 | 64 |
| 64 bookmark_bar_->Loaded(model); | 65 bookmark_bar_->Loaded(model); |
| 65 EXPECT_FALSE(bookmark_bar_->show_instructions_); | 66 EXPECT_FALSE(bookmark_bar_->show_instructions_); |
| 66 } | 67 } |
| 67 | 68 |
| 68 TEST_F(BookmarkBarGtkUnittest, BuildsButtons) { | 69 TEST_F(BookmarkBarGtkUnittest, BuildsButtons) { |
| 69 BookmarkModel* model = profile_->GetBookmarkModel(); | 70 BookmarkModel* model = profile_->GetBookmarkModel(); |
| 70 | 71 |
| 71 const BookmarkNode* parent = model->GetBookmarkBarNode(); | 72 const BookmarkNode* parent = model->GetBookmarkBarNode(); |
| 72 model->AddURL(parent, parent->GetChildCount(), | 73 model->AddURL(parent, parent->GetChildCount(), |
| 73 L"title", GURL("http://one.com")); | 74 ASCIIToUTF16("title"), GURL("http://one.com")); |
| 74 model->AddURL(parent, parent->GetChildCount(), | 75 model->AddURL(parent, parent->GetChildCount(), |
| 75 L"other", GURL("http://two.com")); | 76 ASCIIToUTF16("other"), GURL("http://two.com")); |
| 76 | 77 |
| 77 bookmark_bar_->Loaded(model); | 78 bookmark_bar_->Loaded(model); |
| 78 | 79 |
| 79 // We should expect two children to the bookmark bar's toolbar. | 80 // We should expect two children to the bookmark bar's toolbar. |
| 80 GList* children = gtk_container_get_children( | 81 GList* children = gtk_container_get_children( |
| 81 GTK_CONTAINER(bookmark_bar_->bookmark_toolbar_.get())); | 82 GTK_CONTAINER(bookmark_bar_->bookmark_toolbar_.get())); |
| 82 EXPECT_EQ(2U, g_list_length(children)); | 83 EXPECT_EQ(2U, g_list_length(children)); |
| 83 g_list_free(children); | 84 g_list_free(children); |
| 84 } | 85 } |
| OLD | NEW |