OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/keyboard_codes.h" | 5 #include "base/keyboard_codes.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "chrome/browser/automation/ui_controls.h" | 7 #include "chrome/browser/automation/ui_controls.h" |
8 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
9 #include "chrome/browser/bookmarks/bookmark_utils.h" | 9 #include "chrome/browser/bookmarks/bookmark_utils.h" |
10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // of2b | 62 // of2b |
63 // | 63 // |
64 // * if CreateBigMenu returns return true, 100 menu items are created here with | 64 // * if CreateBigMenu returns return true, 100 menu items are created here with |
65 // the names f1-f100. | 65 // the names f1-f100. |
66 // | 66 // |
67 // Subclasses should be sure and invoke super's implementation of SetUp and | 67 // Subclasses should be sure and invoke super's implementation of SetUp and |
68 // TearDown. | 68 // TearDown. |
69 class BookmarkBarViewEventTestBase : public ViewEventTestBase { | 69 class BookmarkBarViewEventTestBase : public ViewEventTestBase { |
70 public: | 70 public: |
71 BookmarkBarViewEventTestBase() | 71 BookmarkBarViewEventTestBase() |
72 : ViewEventTestBase(), model_(NULL), bb_view_(NULL) { | 72 : ViewEventTestBase(), |
| 73 model_(NULL), |
| 74 bb_view_(NULL), |
| 75 ui_thread_(ChromeThread::UI, MessageLoop::current()), |
| 76 file_thread_(ChromeThread::FILE, MessageLoop::current()) { |
73 } | 77 } |
74 | 78 |
75 virtual void SetUp() { | 79 virtual void SetUp() { |
76 views::MenuItemView::allow_task_nesting_during_run_ = true; | 80 views::MenuItemView::allow_task_nesting_during_run_ = true; |
77 BookmarkBarView::testing_ = true; | 81 BookmarkBarView::testing_ = true; |
78 | 82 |
79 profile_.reset(new TestingProfile()); | 83 profile_.reset(new TestingProfile()); |
80 profile_->set_has_history_service(true); | 84 profile_->set_has_history_service(true); |
81 profile_->CreateBookmarkModel(true); | 85 profile_->CreateBookmarkModel(true); |
| 86 profile_->BlockUntilBookmarkModelLoaded(); |
82 profile_->GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, true); | 87 profile_->GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, true); |
83 | 88 |
84 model_ = profile_->GetBookmarkModel(); | 89 model_ = profile_->GetBookmarkModel(); |
85 model_->ClearStore(); | 90 model_->ClearStore(); |
86 | 91 |
87 bb_view_ = new BookmarkBarView(profile_.get(), NULL); | 92 bb_view_ = new BookmarkBarView(profile_.get(), NULL); |
88 bb_view_->SetPageNavigator(&navigator_); | 93 bb_view_->SetPageNavigator(&navigator_); |
89 | 94 |
90 AddTestData(CreateBigMenu()); | 95 AddTestData(CreateBigMenu()); |
91 | 96 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 const BookmarkNode* of = model_->AddGroup(model_->other_node(), 1, L"OF"); | 169 const BookmarkNode* of = model_->AddGroup(model_->other_node(), 1, L"OF"); |
165 model_->AddURL(of, 0, L"ofa", GURL(test_base + "ofa")); | 170 model_->AddURL(of, 0, L"ofa", GURL(test_base + "ofa")); |
166 model_->AddURL(of, 1, L"ofb", GURL(test_base + "ofb")); | 171 model_->AddURL(of, 1, L"ofb", GURL(test_base + "ofb")); |
167 const BookmarkNode* of2 = model_->AddGroup(model_->other_node(), 2, L"OF2"); | 172 const BookmarkNode* of2 = model_->AddGroup(model_->other_node(), 2, L"OF2"); |
168 model_->AddURL(of2, 0, L"of2a", GURL(test_base + "of2a")); | 173 model_->AddURL(of2, 0, L"of2a", GURL(test_base + "of2a")); |
169 model_->AddURL(of2, 1, L"of2b", GURL(test_base + "of2b")); | 174 model_->AddURL(of2, 1, L"of2b", GURL(test_base + "of2b")); |
170 } | 175 } |
171 | 176 |
172 gfx::Size bb_view_pref_; | 177 gfx::Size bb_view_pref_; |
173 scoped_ptr<TestingProfile> profile_; | 178 scoped_ptr<TestingProfile> profile_; |
| 179 ChromeThread ui_thread_; |
| 180 ChromeThread file_thread_; |
174 }; | 181 }; |
175 | 182 |
176 // Clicks on first menu, makes sure button is depressed. Moves mouse to first | 183 // Clicks on first menu, makes sure button is depressed. Moves mouse to first |
177 // child, clicks it and makes sure a navigation occurs. | 184 // child, clicks it and makes sure a navigation occurs. |
178 class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase { | 185 class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase { |
179 protected: | 186 protected: |
180 virtual void DoTestOnMessageLoop() { | 187 virtual void DoTestOnMessageLoop() { |
181 // Move the mouse to the first folder on the bookmark bar and press the | 188 // Move the mouse to the first folder on the bookmark bar and press the |
182 // mouse. | 189 // mouse. |
183 views::TextButton* button = bb_view_->GetBookmarkButton(0); | 190 views::TextButton* button = bb_view_->GetBookmarkButton(0); |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 CreateEventTask(this, &BookmarkBarViewTest13::Step5)); | 1057 CreateEventTask(this, &BookmarkBarViewTest13::Step5)); |
1051 } | 1058 } |
1052 | 1059 |
1053 void Step5() { | 1060 void Step5() { |
1054 DLOG(WARNING) << " DONE"; | 1061 DLOG(WARNING) << " DONE"; |
1055 Done(); | 1062 Done(); |
1056 } | 1063 } |
1057 }; | 1064 }; |
1058 | 1065 |
1059 VIEW_TEST(BookmarkBarViewTest13, ClickOnContextMenuSeparator) | 1066 VIEW_TEST(BookmarkBarViewTest13, ClickOnContextMenuSeparator) |
OLD | NEW |