Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6502)

Unified Diff: chrome/browser/ui/cocoa/history_menu_bridge_unittest.mm

Issue 2200993004: Make TabRestoreService::Entry noncopyable and fix up surrounding code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tab-test-cleanup
Patch Set: Get session ID from entries, take tabs' active status directly instead of an index Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/history_menu_bridge_unittest.mm
diff --git a/chrome/browser/ui/cocoa/history_menu_bridge_unittest.mm b/chrome/browser/ui/cocoa/history_menu_bridge_unittest.mm
index ec800d6f8b3df133b11cb061204c543913669d29..634d2339f6d188f734603a5c534f621b48a40c29 100644
--- a/chrome/browser/ui/cocoa/history_menu_bridge_unittest.mm
+++ b/chrome/browser/ui/cocoa/history_menu_bridge_unittest.mm
@@ -98,14 +98,10 @@ class HistoryMenuBridgeTest : public CocoaProfileTest {
}
MockTRS::Entries CreateSessionEntries(
- std::vector<std::unique_ptr<MockTRS::Entry>>* out,
std::initializer_list<MockTRS::Entry*> entries) {
MockTRS::Entries ret;
- out->reserve(out->size() + entries.size());
- for (auto* entry : entries) {
+ for (auto* entry : entries)
ret.emplace_back(entry);
- out->emplace_back(entry);
- }
return ret;
}
@@ -127,10 +123,8 @@ class HistoryMenuBridgeTest : public CocoaProfileTest {
auto window = new MockTRS::Window;
window->id = id;
window->tabs.reserve(tabs.size());
- for (auto* tab : tabs) {
- window->tabs.emplace_back(std::move(*tab));
- delete tab;
- }
+ for (auto* tab : tabs)
+ window->tabs.emplace_back(std::move(tab));
return window;
}
@@ -241,8 +235,7 @@ TEST_F(HistoryMenuBridgeTest, AddItemToMenu) {
// Test that the menu is created for a set of simple tabs.
TEST_F(HistoryMenuBridgeTest, RecentlyClosedTabs) {
std::unique_ptr<MockTRS> trs(new MockTRS(profile()));
- std::vector<std::unique_ptr<MockTRS::Entry>> hold_entries;
- auto entries{CreateSessionEntries(&hold_entries, {
+ auto entries{CreateSessionEntries({
CreateSessionTab(24, "http://google.com", "Google"),
CreateSessionTab(42, "http://apple.com", "Apple"),
})};
@@ -271,8 +264,7 @@ TEST_F(HistoryMenuBridgeTest, RecentlyClosedTabs) {
// Test that the menu is created for a mix of windows and tabs.
TEST_F(HistoryMenuBridgeTest, RecentlyClosedTabsAndWindows) {
std::unique_ptr<MockTRS> trs(new MockTRS(profile()));
- std::vector<std::unique_ptr<MockTRS::Entry>> hold_entries;
- auto entries{CreateSessionEntries(&hold_entries, {
+ auto entries{CreateSessionEntries({
CreateSessionTab(24, "http://google.com", "Google"),
CreateSessionWindow(30, {
CreateSessionTab(31, "http://foo.com", "foo"),
« no previous file with comments | « chrome/browser/ui/cocoa/history_menu_bridge.mm ('k') | chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698