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 "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/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // the names f1-f100. | 165 // the names f1-f100. |
166 // | 166 // |
167 // Subclasses should be sure and invoke super's implementation of SetUp and | 167 // Subclasses should be sure and invoke super's implementation of SetUp and |
168 // TearDown. | 168 // TearDown. |
169 class BookmarkBarViewEventTestBase : public ViewEventTestBase { | 169 class BookmarkBarViewEventTestBase : public ViewEventTestBase { |
170 public: | 170 public: |
171 BookmarkBarViewEventTestBase() | 171 BookmarkBarViewEventTestBase() |
172 : ViewEventTestBase(), | 172 : ViewEventTestBase(), |
173 model_(NULL), | 173 model_(NULL), |
174 bb_view_(NULL), | 174 bb_view_(NULL), |
175 ui_thread_(BrowserThread::UI, MessageLoop::current()), | |
176 file_thread_(BrowserThread::FILE, MessageLoop::current()) { | 175 file_thread_(BrowserThread::FILE, MessageLoop::current()) { |
177 } | 176 } |
178 | 177 |
179 virtual void SetUp() { | 178 virtual void SetUp() { |
180 BookmarkBarView::testing_ = true; | 179 BookmarkBarView::testing_ = true; |
181 | 180 |
182 profile_.reset(new TestingProfile()); | 181 profile_.reset(new TestingProfile()); |
183 profile_->CreateBookmarkModel(true); | 182 profile_->CreateBookmarkModel(true); |
184 profile_->BlockUntilBookmarkModelLoaded(); | 183 profile_->BlockUntilBookmarkModelLoaded(); |
185 profile_->GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, true); | 184 profile_->GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, true); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 model_->AddURL(of, 1, ASCIIToUTF16("ofb"), GURL(test_base + "ofb")); | 284 model_->AddURL(of, 1, ASCIIToUTF16("ofb"), GURL(test_base + "ofb")); |
286 const BookmarkNode* of2 = model_->AddFolder(model_->other_node(), 2, | 285 const BookmarkNode* of2 = model_->AddFolder(model_->other_node(), 2, |
287 ASCIIToUTF16("OF2")); | 286 ASCIIToUTF16("OF2")); |
288 model_->AddURL(of2, 0, ASCIIToUTF16("of2a"), GURL(test_base + "of2a")); | 287 model_->AddURL(of2, 0, ASCIIToUTF16("of2a"), GURL(test_base + "of2a")); |
289 model_->AddURL(of2, 1, ASCIIToUTF16("of2b"), GURL(test_base + "of2b")); | 288 model_->AddURL(of2, 1, ASCIIToUTF16("of2b"), GURL(test_base + "of2b")); |
290 } | 289 } |
291 | 290 |
292 gfx::Size bb_view_pref_; | 291 gfx::Size bb_view_pref_; |
293 scoped_ptr<TestingProfile> profile_; | 292 scoped_ptr<TestingProfile> profile_; |
294 scoped_ptr<Browser> browser_; | 293 scoped_ptr<Browser> browser_; |
295 content::TestBrowserThread ui_thread_; | |
296 content::TestBrowserThread file_thread_; | 294 content::TestBrowserThread file_thread_; |
297 ViewsDelegateImpl views_delegate_; | 295 ViewsDelegateImpl views_delegate_; |
298 }; | 296 }; |
299 | 297 |
300 // Clicks on first menu, makes sure button is depressed. Moves mouse to first | 298 // Clicks on first menu, makes sure button is depressed. Moves mouse to first |
301 // child, clicks it and makes sure a navigation occurs. | 299 // child, clicks it and makes sure a navigation occurs. |
302 class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase { | 300 class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase { |
303 protected: | 301 protected: |
304 virtual void DoTestOnMessageLoop() { | 302 virtual void DoTestOnMessageLoop() { |
305 // Move the mouse to the first folder on the bookmark bar and press the | 303 // Move the mouse to the first folder on the bookmark bar and press the |
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 ASSERT_TRUE(menu != NULL); | 1576 ASSERT_TRUE(menu != NULL); |
1579 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); | 1577 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); |
1580 | 1578 |
1581 menu->GetMenuController()->CancelAll(); | 1579 menu->GetMenuController()->CancelAll(); |
1582 | 1580 |
1583 Done(); | 1581 Done(); |
1584 } | 1582 } |
1585 }; | 1583 }; |
1586 | 1584 |
1587 VIEW_TEST(BookmarkBarViewTest19, SiblingMenu) | 1585 VIEW_TEST(BookmarkBarViewTest19, SiblingMenu) |
OLD | NEW |