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

Side by Side Diff: chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc

Issue 2086423005: Using WebContents::UpdateTitleForEntry() instead of NavigationEntry::SetTitle() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improving comment and removing the NOTREACHED. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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/toolbar/back_forward_menu_model.h" 5 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 EXPECT_EQ(c, model->GetChapterStopCount(h)); 72 EXPECT_EQ(c, model->GetChapterStopCount(h));
73 if (h > 0) 73 if (h > 0)
74 h += 2; // Separator and View History link. 74 h += 2; // Separator and View History link.
75 if (c > 0) 75 if (c > 0)
76 ++c; 76 ++c;
77 EXPECT_EQ(h + c, model->GetItemCount()); 77 EXPECT_EQ(h + c, model->GetItemCount());
78 } 78 }
79 79
80 void LoadURLAndUpdateState(const char* url, const char* title) { 80 void LoadURLAndUpdateState(const char* url, const char* title) {
81 NavigateAndCommit(GURL(url)); 81 NavigateAndCommit(GURL(url));
82 controller().GetLastCommittedEntry()->SetTitle(base::UTF8ToUTF16(title)); 82 web_contents()->UpdateTitleForEntry(
83 controller().GetLastCommittedEntry(), base::UTF8ToUTF16(title));
83 } 84 }
84 85
85 // Navigate back or forward the given amount and commits the entry (which 86 // Navigate back or forward the given amount and commits the entry (which
86 // will be pending after we ask to navigate there). 87 // will be pending after we ask to navigate there).
87 void NavigateToOffset(int offset) { 88 void NavigateToOffset(int offset) {
88 controller().GoToOffset(offset); 89 controller().GoToOffset(offset);
89 WebContentsTester::For(web_contents())->CommitPendingNavigation(); 90 WebContentsTester::For(web_contents())->CommitPendingNavigation();
90 } 91 }
91 92
92 // Same as NavigateToOffset but goes to an absolute index. 93 // Same as NavigateToOffset but goes to an absolute index.
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 // Verify we did get the expected favicon. 561 // Verify we did get the expected favicon.
561 EXPECT_EQ(0, memcmp(new_icon_bitmap.getPixels(), 562 EXPECT_EQ(0, memcmp(new_icon_bitmap.getPixels(),
562 valid_icon_bitmap.getPixels(), 563 valid_icon_bitmap.getPixels(),
563 new_icon_bitmap.getSize())); 564 new_icon_bitmap.getSize()));
564 565
565 // Make sure the browser deconstructor doesn't have problems. 566 // Make sure the browser deconstructor doesn't have problems.
566 browser->tab_strip_model()->CloseAllTabs(); 567 browser->tab_strip_model()->CloseAllTabs();
567 // This is required to prevent the message loop from hanging. 568 // This is required to prevent the message loop from hanging.
568 profile()->DestroyHistoryService(); 569 profile()->DestroyHistoryService();
569 } 570 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698