| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 using base::ASCIIToUTF16; | 28 using base::ASCIIToUTF16; |
| 29 using content::BrowserThread; | 29 using content::BrowserThread; |
| 30 using content::OpenURLParams; | 30 using content::OpenURLParams; |
| 31 using content::PageNavigator; | 31 using content::PageNavigator; |
| 32 using content::WebContents; | 32 using content::WebContents; |
| 33 | 33 |
| 34 // PageNavigator implementation that records the URL. | 34 // PageNavigator implementation that records the URL. |
| 35 class TestingPageNavigator : public PageNavigator { | 35 class TestingPageNavigator : public PageNavigator { |
| 36 public: | 36 public: |
| 37 virtual WebContents* OpenURL(const OpenURLParams& params) override { | 37 WebContents* OpenURL(const OpenURLParams& params) override { |
| 38 urls_.push_back(params.url); | 38 urls_.push_back(params.url); |
| 39 return NULL; | 39 return NULL; |
| 40 } | 40 } |
| 41 | 41 |
| 42 std::vector<GURL> urls_; | 42 std::vector<GURL> urls_; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 class BookmarkContextMenuControllerTest : public testing::Test { | 45 class BookmarkContextMenuControllerTest : public testing::Test { |
| 46 public: | 46 public: |
| 47 BookmarkContextMenuControllerTest() | 47 BookmarkContextMenuControllerTest() |
| (...skipping 305 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 |