| 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 "chrome/browser/bookmarks/bookmark_model.h" | 5 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 6 #include "chrome/browser/bookmarks/bookmark_utils.h" | 6 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 7 #include "chrome/browser/chrome_thread.h" |
| 7 #include "chrome/browser/views/bookmark_context_menu.h" | 8 #include "chrome/browser/views/bookmark_context_menu.h" |
| 8 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
| 9 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| 10 #include "chrome/common/pref_service.h" | 11 #include "chrome/common/pref_service.h" |
| 11 #include "chrome/browser/tab_contents/page_navigator.h" | 12 #include "chrome/browser/tab_contents/page_navigator.h" |
| 12 #include "chrome/test/testing_profile.h" | 13 #include "chrome/test/testing_profile.h" |
| 13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 16 |
| 16 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 30 } | 31 } |
| 31 | 32 |
| 32 std::vector<GURL> urls_; | 33 std::vector<GURL> urls_; |
| 33 }; | 34 }; |
| 34 | 35 |
| 35 } // namespace | 36 } // namespace |
| 36 | 37 |
| 37 class BookmarkContextMenuTest : public testing::Test { | 38 class BookmarkContextMenuTest : public testing::Test { |
| 38 public: | 39 public: |
| 39 BookmarkContextMenuTest() | 40 BookmarkContextMenuTest() |
| 40 : model_(NULL) { | 41 : ui_thread_(ChromeThread::UI, &message_loop_), |
| 42 file_thread_(ChromeThread::FILE, &message_loop_), |
| 43 model_(NULL) { |
| 41 } | 44 } |
| 42 | 45 |
| 43 virtual void SetUp() { | 46 virtual void SetUp() { |
| 44 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
| 45 BookmarkBarView::testing_ = true; | 48 BookmarkBarView::testing_ = true; |
| 46 #endif | 49 #endif |
| 47 | 50 |
| 48 profile_.reset(new TestingProfile()); | 51 profile_.reset(new TestingProfile()); |
| 49 profile_->set_has_history_service(true); | 52 profile_->set_has_history_service(true); |
| 50 profile_->CreateBookmarkModel(true); | 53 profile_->CreateBookmarkModel(true); |
| 51 profile_->BlockUntilBookmarkModelLoaded(); | 54 profile_->BlockUntilBookmarkModelLoaded(); |
| 52 | 55 |
| 53 model_ = profile_->GetBookmarkModel(); | 56 model_ = profile_->GetBookmarkModel(); |
| 54 | 57 |
| 55 AddTestData(); | 58 AddTestData(); |
| 56 } | 59 } |
| 57 | 60 |
| 58 virtual void TearDown() { | 61 virtual void TearDown() { |
| 59 #if defined(OS_WIN) | 62 #if defined(OS_WIN) |
| 60 BookmarkBarView::testing_ = false; | 63 BookmarkBarView::testing_ = false; |
| 61 #endif | 64 #endif |
| 62 | 65 |
| 63 // Flush the message loop to make Purify happy. | 66 // Flush the message loop to make Purify happy. |
| 64 message_loop_.RunAllPending(); | 67 message_loop_.RunAllPending(); |
| 65 } | 68 } |
| 66 | 69 |
| 67 protected: | 70 protected: |
| 68 MessageLoopForUI message_loop_; | 71 MessageLoopForUI message_loop_; |
| 72 ChromeThread ui_thread_; |
| 73 ChromeThread file_thread_; |
| 69 scoped_ptr<TestingProfile> profile_; | 74 scoped_ptr<TestingProfile> profile_; |
| 70 BookmarkModel* model_; | 75 BookmarkModel* model_; |
| 71 TestingPageNavigator navigator_; | 76 TestingPageNavigator navigator_; |
| 72 | 77 |
| 73 private: | 78 private: |
| 74 // Creates the following structure: | 79 // Creates the following structure: |
| 75 // a | 80 // a |
| 76 // F1 | 81 // F1 |
| 77 // f1a | 82 // f1a |
| 78 // F11 | 83 // F11 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 controller.IsCommandEnabled(IDS_BOOMARK_BAR_OPEN_ALL_NEW_WINDOW)); | 293 controller.IsCommandEnabled(IDS_BOOMARK_BAR_OPEN_ALL_NEW_WINDOW)); |
| 289 EXPECT_FALSE(controller.IsCommandEnabled(IDS_BOOMARK_BAR_OPEN_ALL_INCOGNITO)); | 294 EXPECT_FALSE(controller.IsCommandEnabled(IDS_BOOMARK_BAR_OPEN_ALL_INCOGNITO)); |
| 290 EXPECT_FALSE(controller.IsCommandEnabled(IDS_BOOKMARK_BAR_REMOVE)); | 295 EXPECT_FALSE(controller.IsCommandEnabled(IDS_BOOKMARK_BAR_REMOVE)); |
| 291 EXPECT_FALSE( | 296 EXPECT_FALSE( |
| 292 controller.IsCommandEnabled(IDS_BOOKMARK_MANAGER_SHOW_IN_FOLDER)); | 297 controller.IsCommandEnabled(IDS_BOOKMARK_MANAGER_SHOW_IN_FOLDER)); |
| 293 EXPECT_FALSE( | 298 EXPECT_FALSE( |
| 294 controller.IsCommandEnabled(IDS_BOOMARK_BAR_ADD_NEW_BOOKMARK)); | 299 controller.IsCommandEnabled(IDS_BOOMARK_BAR_ADD_NEW_BOOKMARK)); |
| 295 EXPECT_FALSE( | 300 EXPECT_FALSE( |
| 296 controller.IsCommandEnabled(IDS_BOOMARK_BAR_NEW_FOLDER)); | 301 controller.IsCommandEnabled(IDS_BOOMARK_BAR_NEW_FOLDER)); |
| 297 } | 302 } |
| OLD | NEW |