| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bookmarks/bookmark_context_menu_controller.h" | 5 #include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 class BookmarkContextMenuControllerTest : public testing::Test { | 45 class BookmarkContextMenuControllerTest : public testing::Test { |
| 46 public: | 46 public: |
| 47 BookmarkContextMenuControllerTest() | 47 BookmarkContextMenuControllerTest() |
| 48 : ui_thread_(BrowserThread::UI, &message_loop_), | 48 : ui_thread_(BrowserThread::UI, &message_loop_), |
| 49 file_thread_(BrowserThread::FILE, &message_loop_), | 49 file_thread_(BrowserThread::FILE, &message_loop_), |
| 50 model_(NULL) { | 50 model_(NULL) { |
| 51 } | 51 } |
| 52 | 52 |
| 53 virtual void SetUp() override { | 53 void SetUp() override { |
| 54 TestingProfile::Builder builder; | 54 TestingProfile::Builder builder; |
| 55 profile_ = builder.Build(); | 55 profile_ = builder.Build(); |
| 56 profile_->CreateBookmarkModel(true); | 56 profile_->CreateBookmarkModel(true); |
| 57 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); | 57 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); |
| 58 bookmarks::test::WaitForBookmarkModelToLoad(model_); | 58 bookmarks::test::WaitForBookmarkModelToLoad(model_); |
| 59 AddTestData(model_); | 59 AddTestData(model_); |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual void TearDown() override { | 62 void TearDown() override { |
| 63 ui::Clipboard::DestroyClipboardForCurrentThread(); | 63 ui::Clipboard::DestroyClipboardForCurrentThread(); |
| 64 | 64 |
| 65 // Flush the message loop to make application verifiers happy. | 65 // Flush the message loop to make application verifiers happy. |
| 66 message_loop_.RunUntilIdle(); | 66 message_loop_.RunUntilIdle(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Creates the following structure: | 69 // Creates the following structure: |
| 70 // a | 70 // a |
| 71 // F1 | 71 // F1 |
| 72 // f1a | 72 // f1a |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 new base::FundamentalValue(false)); | 353 new base::FundamentalValue(false)); |
| 354 EXPECT_FALSE( | 354 EXPECT_FALSE( |
| 355 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); | 355 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); |
| 356 | 356 |
| 357 // And enabling the shortcut by policy disables the command too. | 357 // And enabling the shortcut by policy disables the command too. |
| 358 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, | 358 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, |
| 359 new base::FundamentalValue(true)); | 359 new base::FundamentalValue(true)); |
| 360 EXPECT_FALSE( | 360 EXPECT_FALSE( |
| 361 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); | 361 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); |
| 362 } | 362 } |
| OLD | NEW |