| 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/bookmark_bar_context_menu_controller.h" | 5 #include "chrome/browser/bookmark_bar_context_menu_controller.h" |
| 6 #include "chrome/browser/bookmarks/bookmark_model.h" | 6 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 7 #include "chrome/browser/profile.h" | 7 #include "chrome/browser/profile.h" |
| 8 #include "chrome/browser/views/bookmark_bar_view.h" | 8 #include "chrome/browser/views/bookmark_bar_view.h" |
| 9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
| 10 #include "chrome/common/pref_service.h" | 10 #include "chrome/common/pref_service.h" |
| 11 #include "chrome/browser/page_navigator.h" | 11 #include "chrome/browser/page_navigator.h" |
| 12 #include "chrome/test/testing_profile.h" | 12 #include "chrome/test/testing_profile.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 #include "generated_resources.h" | 15 #include "generated_resources.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // PageNavigator implementation that records the URL. | 19 // PageNavigator implementation that records the URL. |
| 20 class TestingPageNavigator : public PageNavigator { | 20 class TestingPageNavigator : public PageNavigator { |
| 21 public: | 21 public: |
| 22 virtual void OpenURL(const GURL& url, | 22 virtual void OpenURL(const GURL& url, const GURL& referrer, |
| 23 WindowOpenDisposition disposition, | 23 WindowOpenDisposition disposition, |
| 24 PageTransition::Type transition) { | 24 PageTransition::Type transition) { |
| 25 urls_.push_back(url); | 25 urls_.push_back(url); |
| 26 } | 26 } |
| 27 | 27 |
| 28 std::vector<GURL> urls_; | 28 std::vector<GURL> urls_; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 132 } |
| 133 | 133 |
| 134 // Tests the enabled state of open incognito. | 134 // Tests the enabled state of open incognito. |
| 135 TEST_F(BookmarkBarContextMenuControllerTest, DisableIncognito) { | 135 TEST_F(BookmarkBarContextMenuControllerTest, DisableIncognito) { |
| 136 BookmarkBarContextMenuController controller( | 136 BookmarkBarContextMenuController controller( |
| 137 bb_view_.get(), model_->GetBookmarkBarNode()->GetChild(0)); | 137 bb_view_.get(), model_->GetBookmarkBarNode()->GetChild(0)); |
| 138 EXPECT_TRUE(controller.IsCommandEnabled(IDS_BOOMARK_BAR_OPEN_INCOGNITO)); | 138 EXPECT_TRUE(controller.IsCommandEnabled(IDS_BOOMARK_BAR_OPEN_INCOGNITO)); |
| 139 profile_->set_off_the_record(true); | 139 profile_->set_off_the_record(true); |
| 140 EXPECT_FALSE(controller.IsCommandEnabled(IDS_BOOMARK_BAR_OPEN_INCOGNITO)); | 140 EXPECT_FALSE(controller.IsCommandEnabled(IDS_BOOMARK_BAR_OPEN_INCOGNITO)); |
| 141 } | 141 } |
| OLD | NEW |