| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // | 106 // |
| 107 // * if CreateBigMenu returns return true, 100 menu items are created here with | 107 // * if CreateBigMenu returns return true, 100 menu items are created here with |
| 108 // the names f1-f100. | 108 // the names f1-f100. |
| 109 // | 109 // |
| 110 // Subclasses should be sure and invoke super's implementation of SetUp and | 110 // Subclasses should be sure and invoke super's implementation of SetUp and |
| 111 // TearDown. | 111 // TearDown. |
| 112 class BookmarkBarViewEventTestBase : public ViewEventTestBase { | 112 class BookmarkBarViewEventTestBase : public ViewEventTestBase { |
| 113 public: | 113 public: |
| 114 BookmarkBarViewEventTestBase() | 114 BookmarkBarViewEventTestBase() |
| 115 : ViewEventTestBase(), | 115 : ViewEventTestBase(), |
| 116 model_(NULL), | 116 model_(NULL) {} |
| 117 file_thread_(BrowserThread::FILE, base::MessageLoop::current()) {} | |
| 118 | 117 |
| 119 virtual void SetUp() OVERRIDE { | 118 virtual void SetUp() OVERRIDE { |
| 120 views::MenuController::TurnOffContextMenuSelectionHoldForTest(); | 119 views::MenuController::TurnOffContextMenuSelectionHoldForTest(); |
| 121 BookmarkBarView::DisableAnimationsForTesting(true); | 120 BookmarkBarView::DisableAnimationsForTesting(true); |
| 122 | 121 |
| 123 profile_.reset(new TestingProfile()); | 122 profile_.reset(new TestingProfile()); |
| 124 profile_->CreateBookmarkModel(true); | 123 profile_->CreateBookmarkModel(true); |
| 125 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); | 124 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); |
| 126 ui_test_utils::WaitForBookmarkModelToLoad(model_); | 125 ui_test_utils::WaitForBookmarkModelToLoad(model_); |
| 127 profile_->GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, true); | 126 profile_->GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, true); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 const BookmarkNode* of2 = model_->AddFolder(model_->other_node(), 2, | 235 const BookmarkNode* of2 = model_->AddFolder(model_->other_node(), 2, |
| 237 ASCIIToUTF16("OF2")); | 236 ASCIIToUTF16("OF2")); |
| 238 model_->AddURL(of2, 0, ASCIIToUTF16("of2a"), GURL(test_base + "of2a")); | 237 model_->AddURL(of2, 0, ASCIIToUTF16("of2a"), GURL(test_base + "of2a")); |
| 239 model_->AddURL(of2, 1, ASCIIToUTF16("of2b"), GURL(test_base + "of2b")); | 238 model_->AddURL(of2, 1, ASCIIToUTF16("of2b"), GURL(test_base + "of2b")); |
| 240 } | 239 } |
| 241 | 240 |
| 242 gfx::Size bb_view_pref_; | 241 gfx::Size bb_view_pref_; |
| 243 scoped_ptr<TestingProfile> profile_; | 242 scoped_ptr<TestingProfile> profile_; |
| 244 scoped_ptr<Browser> browser_; | 243 scoped_ptr<Browser> browser_; |
| 245 scoped_ptr<ScopedTestingLocalState> local_state_; | 244 scoped_ptr<ScopedTestingLocalState> local_state_; |
| 246 content::TestBrowserThread file_thread_; | |
| 247 ChromeViewsDelegate views_delegate_; | 245 ChromeViewsDelegate views_delegate_; |
| 248 }; | 246 }; |
| 249 | 247 |
| 250 // Clicks on first menu, makes sure button is depressed. Moves mouse to first | 248 // Clicks on first menu, makes sure button is depressed. Moves mouse to first |
| 251 // child, clicks it and makes sure a navigation occurs. | 249 // child, clicks it and makes sure a navigation occurs. |
| 252 class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase { | 250 class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase { |
| 253 protected: | 251 protected: |
| 254 virtual void DoTestOnMessageLoop() OVERRIDE { | 252 virtual void DoTestOnMessageLoop() OVERRIDE { |
| 255 // Move the mouse to the first folder on the bookmark bar and press the | 253 // Move the mouse to the first folder on the bookmark bar and press the |
| 256 // mouse. | 254 // mouse. |
| (...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 EXPECT_TRUE(bb_view_->GetContextMenu() == NULL); | 1774 EXPECT_TRUE(bb_view_->GetContextMenu() == NULL); |
| 1777 EXPECT_TRUE(bb_view_->GetMenu() == NULL); | 1775 EXPECT_TRUE(bb_view_->GetMenu() == NULL); |
| 1778 | 1776 |
| 1779 Done(); | 1777 Done(); |
| 1780 } | 1778 } |
| 1781 | 1779 |
| 1782 ContextMenuNotificationObserver observer_; | 1780 ContextMenuNotificationObserver observer_; |
| 1783 }; | 1781 }; |
| 1784 | 1782 |
| 1785 VIEW_TEST(BookmarkBarViewTest21, ContextMenusForEmptyFolder) | 1783 VIEW_TEST(BookmarkBarViewTest21, ContextMenusForEmptyFolder) |
| OLD | NEW |