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

Unified Diff: chrome/browser/ui/search/search_tab_helper_unittest.cc

Issue 78443005: New Tab: fix tab title flickering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 7 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/search_tab_helper_unittest.cc
diff --git a/chrome/browser/ui/search/search_tab_helper_unittest.cc b/chrome/browser/ui/search/search_tab_helper_unittest.cc
index 8842d042a6a328cc8c350060bb6097a943f368a9..f9676b94e8594c94db5a7acef63569d21cb8a996 100644
--- a/chrome/browser/ui/search/search_tab_helper_unittest.cc
+++ b/chrome/browser/ui/search/search_tab_helper_unittest.cc
@@ -21,10 +21,12 @@
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/mock_render_process_host.h"
+#include "grit/generated_resources.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_test_sink.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
namespace {
@@ -205,3 +207,42 @@ TEST_F(SearchTabHelperTest, OnChromeIdentityCheckSignedOutMismatch) {
EXPECT_EQ(test_identity, params.a);
ASSERT_FALSE(params.b);
}
+
+class TabTitleObserver : public content::WebContentsObserver {
+ public:
+ explicit TabTitleObserver(content::WebContents* contents)
+ : WebContentsObserver(contents) {}
+
+ string16 title_on_start() { return title_on_start_; }
+ string16 title_on_commit() { return title_on_commit_; }
+
+ private:
+ virtual void DidStartProvisionalLoadForFrame(
+ int64 /* frame_id */,
+ int64 /* parent_frame_id */,
+ bool /* is_main_frame */,
+ const GURL& /* validated_url */,
+ bool /* is_error_page */,
+ bool /* is_iframe_srcdoc */,
+ content::RenderViewHost* /* render_view_host */) OVERRIDE {
+ title_on_start_ = web_contents()->GetTitle();
+ }
+
+ virtual void DidNavigateMainFrame(
+ const content::LoadCommittedDetails& /* details */,
+ const content::FrameNavigateParams& /* params */) OVERRIDE {
+ title_on_commit_ = web_contents()->GetTitle();
+ }
+
+ string16 title_on_start_;
+ string16 title_on_commit_;
+};
+
+TEST_F(SearchTabHelperTest, TitleIsSetForNTP) {
+ TabTitleObserver title_observer(web_contents());
+ NavigateAndCommit(GURL(chrome::kChromeUINewTabURL));
+ const string16 title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE);
+ EXPECT_EQ(title, title_observer.title_on_start());
+ EXPECT_EQ(title, title_observer.title_on_commit());
+ EXPECT_EQ(title, web_contents()->GetTitle());
+}
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698