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 27 matching lines...) Expand all Loading... |
38 using content::BrowserThread; | 38 using content::BrowserThread; |
39 using content::OpenURLParams; | 39 using content::OpenURLParams; |
40 using content::PageNavigator; | 40 using content::PageNavigator; |
41 using content::WebContents; | 41 using content::WebContents; |
42 | 42 |
43 namespace { | 43 namespace { |
44 | 44 |
45 // PageNavigator implementation that records the URL. | 45 // PageNavigator implementation that records the URL. |
46 class TestingPageNavigator : public PageNavigator { | 46 class TestingPageNavigator : public PageNavigator { |
47 public: | 47 public: |
48 virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE { | 48 virtual WebContents* OpenURL(const OpenURLParams& params) override { |
49 urls_.push_back(params.url); | 49 urls_.push_back(params.url); |
50 return NULL; | 50 return NULL; |
51 } | 51 } |
52 | 52 |
53 std::vector<GURL> urls_; | 53 std::vector<GURL> urls_; |
54 }; | 54 }; |
55 | 55 |
56 } // namespace | 56 } // namespace |
57 | 57 |
58 class BookmarkContextMenuTest : public testing::Test { | 58 class BookmarkContextMenuTest : public testing::Test { |
59 public: | 59 public: |
60 BookmarkContextMenuTest() | 60 BookmarkContextMenuTest() |
61 : ui_thread_(BrowserThread::UI, &message_loop_), | 61 : ui_thread_(BrowserThread::UI, &message_loop_), |
62 file_thread_(BrowserThread::FILE, &message_loop_), | 62 file_thread_(BrowserThread::FILE, &message_loop_), |
63 model_(NULL) { | 63 model_(NULL) { |
64 } | 64 } |
65 | 65 |
66 virtual void SetUp() OVERRIDE { | 66 virtual void SetUp() override { |
67 event_source_ = ui::PlatformEventSource::CreateDefault(); | 67 event_source_ = ui::PlatformEventSource::CreateDefault(); |
68 profile_.reset(new TestingProfile()); | 68 profile_.reset(new TestingProfile()); |
69 profile_->CreateBookmarkModel(true); | 69 profile_->CreateBookmarkModel(true); |
70 | 70 |
71 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); | 71 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); |
72 test::WaitForBookmarkModelToLoad(model_); | 72 test::WaitForBookmarkModelToLoad(model_); |
73 | 73 |
74 AddTestData(); | 74 AddTestData(); |
75 } | 75 } |
76 | 76 |
77 virtual void TearDown() OVERRIDE { | 77 virtual void TearDown() override { |
78 ui::Clipboard::DestroyClipboardForCurrentThread(); | 78 ui::Clipboard::DestroyClipboardForCurrentThread(); |
79 | 79 |
80 BrowserThread::GetBlockingPool()->FlushForTesting(); | 80 BrowserThread::GetBlockingPool()->FlushForTesting(); |
81 // Flush the message loop to make application verifiers happy. | 81 // Flush the message loop to make application verifiers happy. |
82 message_loop_.RunUntilIdle(); | 82 message_loop_.RunUntilIdle(); |
83 event_source_.reset(); | 83 event_source_.reset(); |
84 } | 84 } |
85 | 85 |
86 protected: | 86 protected: |
87 base::MessageLoopForUI message_loop_; | 87 base::MessageLoopForUI message_loop_; |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 controller.reset(new BookmarkContextMenu( | 376 controller.reset(new BookmarkContextMenu( |
377 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); | 377 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); |
378 EXPECT_TRUE(controller->IsCommandVisible(IDC_BOOKMARK_BAR_NEW_FOLDER)); | 378 EXPECT_TRUE(controller->IsCommandVisible(IDC_BOOKMARK_BAR_NEW_FOLDER)); |
379 EXPECT_TRUE( | 379 EXPECT_TRUE( |
380 controller->IsCommandVisible(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS)); | 380 controller->IsCommandVisible(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS)); |
381 menu = controller->menu(); | 381 menu = controller->menu(); |
382 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_NEW_FOLDER)->visible()); | 382 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_NEW_FOLDER)->visible()); |
383 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS) | 383 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS) |
384 ->visible()); | 384 ->visible()); |
385 } | 385 } |
OLD | NEW |