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

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

Issue 2232863002: Remove search::GetSearchTerms since it always returns empty string (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_query_extract
Patch Set: Mac 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 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 "components/toolbar/toolbar_model.h" 5 #include "components/toolbar/toolbar_model.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 void ToolbarModelTest::NavigateAndCheckText( 96 void ToolbarModelTest::NavigateAndCheckText(
97 const GURL& url, 97 const GURL& url,
98 const base::string16& expected_text) { 98 const base::string16& expected_text) {
99 // Check while loading. 99 // Check while loading.
100 content::NavigationController* controller = 100 content::NavigationController* controller =
101 &browser()->tab_strip_model()->GetWebContentsAt(0)->GetController(); 101 &browser()->tab_strip_model()->GetWebContentsAt(0)->GetController();
102 controller->LoadURL(url, content::Referrer(), ui::PAGE_TRANSITION_LINK, 102 controller->LoadURL(url, content::Referrer(), ui::PAGE_TRANSITION_LINK,
103 std::string()); 103 std::string());
104 ToolbarModel* toolbar_model = browser()->toolbar_model(); 104 ToolbarModel* toolbar_model = browser()->toolbar_model();
105 EXPECT_EQ(expected_text, toolbar_model->GetText()); 105 EXPECT_EQ(expected_text, toolbar_model->GetText());
106 EXPECT_FALSE(toolbar_model->WouldPerformSearchTermReplacement(false));
107 EXPECT_TRUE(toolbar_model->ShouldDisplayURL()); 106 EXPECT_TRUE(toolbar_model->ShouldDisplayURL());
108 107
109 // Check after commit. 108 // Check after commit.
110 CommitPendingLoad(controller); 109 CommitPendingLoad(controller);
111 EXPECT_EQ(expected_text, toolbar_model->GetText()); 110 EXPECT_EQ(expected_text, toolbar_model->GetText());
112 EXPECT_FALSE(toolbar_model->WouldPerformSearchTermReplacement(false));
113 EXPECT_TRUE(toolbar_model->ShouldDisplayURL()); 111 EXPECT_TRUE(toolbar_model->ShouldDisplayURL());
114 } 112 }
115 113
116 void ToolbarModelTest::NavigateAndCheckElided(const GURL& url) { 114 void ToolbarModelTest::NavigateAndCheckElided(const GURL& url) {
117 // Check while loading. 115 // Check while loading.
118 content::NavigationController* controller = 116 content::NavigationController* controller =
119 &browser()->tab_strip_model()->GetWebContentsAt(0)->GetController(); 117 &browser()->tab_strip_model()->GetWebContentsAt(0)->GetController();
120 controller->LoadURL(url, content::Referrer(), ui::PAGE_TRANSITION_LINK, 118 controller->LoadURL(url, content::Referrer(), ui::PAGE_TRANSITION_LINK,
121 std::string()); 119 std::string());
122 ToolbarModel* toolbar_model = browser()->toolbar_model(); 120 ToolbarModel* toolbar_model = browser()->toolbar_model();
(...skipping 22 matching lines...) Expand all
145 } 143 }
146 } 144 }
147 145
148 TEST_F(ToolbarModelTest, ShouldElideLongURLs) { 146 TEST_F(ToolbarModelTest, ShouldElideLongURLs) {
149 AddTab(browser(), GURL(url::kAboutBlankURL)); 147 AddTab(browser(), GURL(url::kAboutBlankURL));
150 const std::string long_text(content::kMaxURLDisplayChars + 1024, '0'); 148 const std::string long_text(content::kMaxURLDisplayChars + 1024, '0');
151 NavigateAndCheckElided( 149 NavigateAndCheckElided(
152 GURL(std::string("https://www.foo.com/?") + long_text)); 150 GURL(std::string("https://www.foo.com/?") + long_text));
153 NavigateAndCheckElided(GURL(std::string("data:abc") + long_text)); 151 NavigateAndCheckElided(GURL(std::string("data:abc") + long_text));
154 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698