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

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: Eliminate a use-after-free, Windows build fix 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..34a7dd38d519946c2fd79c1df457809f7192cc32 100644
--- a/chrome/browser/ui/cocoa/history_menu_bridge_unittest.mm
+++ b/chrome/browser/ui/cocoa/history_menu_bridge_unittest.mm
@@ -98,13 +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) {
sky 2016/08/04 16:34:38 no {}
ret.emplace_back(entry);
- out->emplace_back(entry);
}
return ret;
}
@@ -127,10 +124,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 +236,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 +265,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"),

Powered by Google App Engine
This is Rietveld 408576698