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

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

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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/toolbar_model.h" 5 #include "chrome/browser/ui/toolbar/toolbar_model.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 10 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 192 }
193 193
194 void ToolbarModelTest::NavigateAndCheckText( 194 void ToolbarModelTest::NavigateAndCheckText(
195 const GURL& url, 195 const GURL& url,
196 const base::string16& expected_text, 196 const base::string16& expected_text,
197 bool would_perform_search_term_replacement, 197 bool would_perform_search_term_replacement,
198 bool should_display_url) { 198 bool should_display_url) {
199 // Check while loading. 199 // Check while loading.
200 content::NavigationController* controller = 200 content::NavigationController* controller =
201 &browser()->tab_strip_model()->GetWebContentsAt(0)->GetController(); 201 &browser()->tab_strip_model()->GetWebContentsAt(0)->GetController();
202 controller->LoadURL(url, content::Referrer(), content::PAGE_TRANSITION_LINK, 202 controller->LoadURL(url, content::Referrer(), ui::PAGE_TRANSITION_LINK,
203 std::string()); 203 std::string());
204 ToolbarModel* toolbar_model = browser()->toolbar_model(); 204 ToolbarModel* toolbar_model = browser()->toolbar_model();
205 EXPECT_EQ(expected_text, toolbar_model->GetText()); 205 EXPECT_EQ(expected_text, toolbar_model->GetText());
206 EXPECT_EQ(would_perform_search_term_replacement, 206 EXPECT_EQ(would_perform_search_term_replacement,
207 toolbar_model->WouldPerformSearchTermReplacement(false)); 207 toolbar_model->WouldPerformSearchTermReplacement(false));
208 EXPECT_EQ(should_display_url, toolbar_model->ShouldDisplayURL()); 208 EXPECT_EQ(should_display_url, toolbar_model->ShouldDisplayURL());
209 209
210 // Check after commit. 210 // Check after commit.
211 CommitPendingLoad(controller); 211 CommitPendingLoad(controller);
212 // Fake a secure connection for HTTPS URLs, or the toolbar will refuse to 212 // Fake a secure connection for HTTPS URLs, or the toolbar will refuse to
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 // Verify that search terms are extracted while the page is loading. 325 // Verify that search terms are extracted while the page is loading.
326 TEST_F(ToolbarModelTest, SearchTermsWhileLoading) { 326 TEST_F(ToolbarModelTest, SearchTermsWhileLoading) {
327 chrome::EnableQueryExtractionForTesting(); 327 chrome::EnableQueryExtractionForTesting();
328 AddTab(browser(), GURL(url::kAboutBlankURL)); 328 AddTab(browser(), GURL(url::kAboutBlankURL));
329 329
330 // While loading, we should be willing to extract search terms. 330 // While loading, we should be willing to extract search terms.
331 content::NavigationController* controller = 331 content::NavigationController* controller =
332 &browser()->tab_strip_model()->GetWebContentsAt(0)->GetController(); 332 &browser()->tab_strip_model()->GetWebContentsAt(0)->GetController();
333 controller->LoadURL(GURL("https://google.com/search?q=tractor+supply&espv=1"), 333 controller->LoadURL(GURL("https://google.com/search?q=tractor+supply&espv=1"),
334 content::Referrer(), content::PAGE_TRANSITION_LINK, 334 content::Referrer(), ui::PAGE_TRANSITION_LINK,
335 std::string()); 335 std::string());
336 ToolbarModel* toolbar_model = browser()->toolbar_model(); 336 ToolbarModel* toolbar_model = browser()->toolbar_model();
337 controller->GetVisibleEntry()->GetSSL().security_style = 337 controller->GetVisibleEntry()->GetSSL().security_style =
338 content::SECURITY_STYLE_UNKNOWN; 338 content::SECURITY_STYLE_UNKNOWN;
339 EXPECT_TRUE(toolbar_model->WouldPerformSearchTermReplacement(false)); 339 EXPECT_TRUE(toolbar_model->WouldPerformSearchTermReplacement(false));
340 340
341 // When done loading, we shouldn't extract search terms if we didn't get an 341 // When done loading, we shouldn't extract search terms if we didn't get an
342 // authenticated connection. 342 // authenticated connection.
343 CommitPendingLoad(controller); 343 CommitPendingLoad(controller);
344 controller->GetVisibleEntry()->GetSSL().security_style = 344 controller->GetVisibleEntry()->GetSSL().security_style =
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 413
414 // Disabling URL replacement should reset to only showing URLs. 414 // Disabling URL replacement should reset to only showing URLs.
415 browser()->toolbar_model()->set_url_replacement_enabled(false); 415 browser()->toolbar_model()->set_url_replacement_enabled(false);
416 for (size_t i = 0; i < arraysize(test_items); ++i) { 416 for (size_t i = 0; i < arraysize(test_items); ++i) {
417 const TestItem& test_item = test_items[i]; 417 const TestItem& test_item = test_items[i];
418 NavigateAndCheckText(test_item.url, 418 NavigateAndCheckText(test_item.url,
419 test_item.expected_text_url_replacement_inactive, 419 test_item.expected_text_url_replacement_inactive,
420 false, test_item.should_display_url); 420 false, test_item.should_display_url);
421 } 421 }
422 } 422 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/toolbar_model_impl.cc ('k') | chrome/browser/ui/views/accessibility/invert_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698