| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/memory/scoped_nsobject.h" | 5 #include "base/mac/scoped_nsobject.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 11 #include "chrome/browser/ui/cocoa/history_menu_bridge.h" | 11 #include "chrome/browser/ui/cocoa/history_menu_bridge.h" |
| 12 #include "chrome/browser/ui/cocoa/history_menu_cocoa_controller.h" | 12 #include "chrome/browser/ui/cocoa/history_menu_cocoa_controller.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 @interface FakeHistoryMenuController : HistoryMenuCocoaController { | 15 @interface FakeHistoryMenuController : HistoryMenuCocoaController { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 FakeHistoryMenuController* controller() { | 65 FakeHistoryMenuController* controller() { |
| 66 return static_cast<FakeHistoryMenuController*>(bridge_->controller_.get()); | 66 return static_cast<FakeHistoryMenuController*>(bridge_->controller_.get()); |
| 67 } | 67 } |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 scoped_ptr<HistoryMenuBridge> bridge_; | 70 scoped_ptr<HistoryMenuBridge> bridge_; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 TEST_F(HistoryMenuCocoaControllerTest, OpenURLForItem) { | 73 TEST_F(HistoryMenuCocoaControllerTest, OpenURLForItem) { |
| 74 scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@"History"]); | 74 base::scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@"History"]); |
| 75 CreateItems(menu.get()); | 75 CreateItems(menu.get()); |
| 76 | 76 |
| 77 std::map<NSMenuItem*, HistoryMenuBridge::HistoryItem*>& items = | 77 std::map<NSMenuItem*, HistoryMenuBridge::HistoryItem*>& items = |
| 78 menu_item_map(); | 78 menu_item_map(); |
| 79 std::map<NSMenuItem*, HistoryMenuBridge::HistoryItem*>::iterator it = | 79 std::map<NSMenuItem*, HistoryMenuBridge::HistoryItem*>::iterator it = |
| 80 items.begin(); | 80 items.begin(); |
| 81 | 81 |
| 82 for ( ; it != items.end(); ++it) { | 82 for ( ; it != items.end(); ++it) { |
| 83 HistoryMenuBridge::HistoryItem* item = it->second; | 83 HistoryMenuBridge::HistoryItem* item = it->second; |
| 84 EXPECT_FALSE(controller()->opened_[item->session_id]); | 84 EXPECT_FALSE(controller()->opened_[item->session_id]); |
| 85 [controller() openHistoryMenuItem:it->first]; | 85 [controller() openHistoryMenuItem:it->first]; |
| 86 EXPECT_TRUE(controller()->opened_[item->session_id]); | 86 EXPECT_TRUE(controller()->opened_[item->session_id]); |
| 87 } | 87 } |
| 88 } | 88 } |
| OLD | NEW |