| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/views/bookmarks/bookmark_context_menu.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "components/bookmarks/browser/bookmark_model.h" | 24 #include "components/bookmarks/browser/bookmark_model.h" |
| 25 #include "components/bookmarks/test/bookmark_test_helpers.h" | 25 #include "components/bookmarks/test/bookmark_test_helpers.h" |
| 26 #include "content/public/browser/page_navigator.h" | 26 #include "content/public/browser/page_navigator.h" |
| 27 #include "content/public/test/test_browser_thread.h" | 27 #include "content/public/test/test_browser_thread.h" |
| 28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
| 29 #include "ui/base/clipboard/clipboard.h" | 29 #include "ui/base/clipboard/clipboard.h" |
| 30 #include "ui/events/platform/platform_event_source.h" | 30 #include "ui/events/platform/platform_event_source.h" |
| 31 #include "ui/views/controls/menu/menu_item_view.h" | 31 #include "ui/views/controls/menu/menu_item_view.h" |
| 32 | 32 |
| 33 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
| 34 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 34 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 35 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 35 #endif | 36 #endif |
| 36 | 37 |
| 37 using base::ASCIIToUTF16; | 38 using base::ASCIIToUTF16; |
| 38 using bookmarks::BookmarkModel; | 39 using bookmarks::BookmarkModel; |
| 39 using bookmarks::BookmarkNode; | 40 using bookmarks::BookmarkNode; |
| 40 using content::BrowserThread; | 41 using content::BrowserThread; |
| 41 using content::OpenURLParams; | 42 using content::OpenURLParams; |
| 42 using content::PageNavigator; | 43 using content::PageNavigator; |
| 43 using content::WebContents; | 44 using content::WebContents; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 58 } // namespace | 59 } // namespace |
| 59 | 60 |
| 60 class BookmarkContextMenuTest : public testing::Test { | 61 class BookmarkContextMenuTest : public testing::Test { |
| 61 public: | 62 public: |
| 62 BookmarkContextMenuTest() | 63 BookmarkContextMenuTest() |
| 63 : ui_thread_(BrowserThread::UI, &message_loop_), | 64 : ui_thread_(BrowserThread::UI, &message_loop_), |
| 64 file_thread_(BrowserThread::FILE, &message_loop_), | 65 file_thread_(BrowserThread::FILE, &message_loop_), |
| 65 model_(NULL) { | 66 model_(NULL) { |
| 66 } | 67 } |
| 67 | 68 |
| 69 #if defined(OS_WIN) |
| 70 static void SetUpTestCase() { |
| 71 IncognitoModePrefs::InitializePlatformParentalControls(); |
| 72 } |
| 73 #endif |
| 74 |
| 68 void SetUp() override { | 75 void SetUp() override { |
| 69 event_source_ = ui::PlatformEventSource::CreateDefault(); | 76 event_source_ = ui::PlatformEventSource::CreateDefault(); |
| 70 profile_.reset(new TestingProfile()); | 77 profile_.reset(new TestingProfile()); |
| 71 profile_->CreateBookmarkModel(true); | 78 profile_->CreateBookmarkModel(true); |
| 72 | 79 |
| 73 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); | 80 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); |
| 74 bookmarks::test::WaitForBookmarkModelToLoad(model_); | 81 bookmarks::test::WaitForBookmarkModelToLoad(model_); |
| 75 | 82 |
| 76 AddTestData(); | 83 AddTestData(); |
| 77 } | 84 } |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 controller.reset(new BookmarkContextMenu( | 385 controller.reset(new BookmarkContextMenu( |
| 379 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); | 386 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); |
| 380 EXPECT_TRUE(controller->IsCommandVisible(IDC_BOOKMARK_BAR_NEW_FOLDER)); | 387 EXPECT_TRUE(controller->IsCommandVisible(IDC_BOOKMARK_BAR_NEW_FOLDER)); |
| 381 EXPECT_TRUE( | 388 EXPECT_TRUE( |
| 382 controller->IsCommandVisible(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS)); | 389 controller->IsCommandVisible(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS)); |
| 383 menu = controller->menu(); | 390 menu = controller->menu(); |
| 384 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_NEW_FOLDER)->visible()); | 391 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_NEW_FOLDER)->visible()); |
| 385 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS) | 392 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS) |
| 386 ->visible()); | 393 ->visible()); |
| 387 } | 394 } |
| OLD | NEW |