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

Side by Side Diff: chrome/browser/instant/instant_browsertest.cc

Issue 10810062: Moving common code into OmniboxView from OmniboxView* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More win fixes Created 8 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 | Annotate | Revision Log
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/content_settings/host_content_settings_map.h" 9 #include "chrome/browser/content_settings/host_content_settings_map.h"
10 #include "chrome/browser/instant/instant_controller.h" 10 #include "chrome/browser/instant/instant_controller.h"
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 EnableInstant(); 452 EnableInstant();
453 SetupInstantProvider("instant.html"); 453 SetupInstantProvider("instant.html");
454 DetermineInstantSupport(); 454 DetermineInstantSupport();
455 455
456 ASSERT_TRUE(SetSuggestionsJavascriptArgument( 456 ASSERT_TRUE(SetSuggestionsJavascriptArgument(
457 "{suggestions:[{value:'defg'}],complete_behavior:'never'}")); 457 "{suggestions:[{value:'defg'}],complete_behavior:'never'}"));
458 SearchAndWaitForPreviewToShow(); 458 SearchAndWaitForPreviewToShow();
459 EXPECT_EQ("defg", GetSuggestion()); 459 EXPECT_EQ("defg", GetSuggestion());
460 460
461 EXPECT_EQ(INSTANT_COMPLETE_NEVER, 461 EXPECT_EQ(INSTANT_COMPLETE_NEVER,
462 omnibox()->model()->instant_complete_behavior()); 462 omnibox()->GetModel()->instant_complete_behavior());
463 EXPECT_EQ("def", UTF16ToUTF8(omnibox()->GetText())); 463 EXPECT_EQ("def", UTF16ToUTF8(omnibox()->GetText()));
464 } 464 }
465 465
466 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(InstantCompleteDelayed)) { 466 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(InstantCompleteDelayed)) {
467 ASSERT_TRUE(test_server()->Start()); 467 ASSERT_TRUE(test_server()->Start());
468 EnableInstant(); 468 EnableInstant();
469 SetupInstantProvider("instant.html"); 469 SetupInstantProvider("instant.html");
470 DetermineInstantSupport(); 470 DetermineInstantSupport();
471 471
472 ASSERT_TRUE(SetSuggestionsJavascriptArgument( 472 ASSERT_TRUE(SetSuggestionsJavascriptArgument(
473 "{suggestions:[{value:'defg'}],complete_behavior:'delayed'}")); 473 "{suggestions:[{value:'defg'}],complete_behavior:'delayed'}"));
474 SearchAndWaitForPreviewToShow(); 474 SearchAndWaitForPreviewToShow();
475 EXPECT_EQ("defg", GetSuggestion()); 475 EXPECT_EQ("defg", GetSuggestion());
476 476
477 EXPECT_EQ(INSTANT_COMPLETE_DELAYED, 477 EXPECT_EQ(INSTANT_COMPLETE_DELAYED,
478 omnibox()->model()->instant_complete_behavior()); 478 omnibox()->GetModel()->instant_complete_behavior());
479 EXPECT_EQ("def", UTF16ToUTF8(omnibox()->GetText())); 479 EXPECT_EQ("def", UTF16ToUTF8(omnibox()->GetText()));
480 } 480 }
481 481
482 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(InstantCompleteNow)) { 482 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(InstantCompleteNow)) {
483 ASSERT_TRUE(test_server()->Start()); 483 ASSERT_TRUE(test_server()->Start());
484 EnableInstant(); 484 EnableInstant();
485 SetupInstantProvider("instant.html"); 485 SetupInstantProvider("instant.html");
486 DetermineInstantSupport(); 486 DetermineInstantSupport();
487 487
488 ASSERT_TRUE(SetSuggestionsJavascriptArgument( 488 ASSERT_TRUE(SetSuggestionsJavascriptArgument(
489 "{suggestions:[{value:'defg'}],complete_behavior:'now'}")); 489 "{suggestions:[{value:'defg'}],complete_behavior:'now'}"));
490 SearchAndWaitForPreviewToShow(); 490 SearchAndWaitForPreviewToShow();
491 EXPECT_EQ("defg", GetSuggestion()); 491 EXPECT_EQ("defg", GetSuggestion());
492 492
493 EXPECT_EQ(INSTANT_COMPLETE_NOW, 493 EXPECT_EQ(INSTANT_COMPLETE_NOW,
494 omnibox()->model()->instant_complete_behavior()); 494 omnibox()->GetModel()->instant_complete_behavior());
495 EXPECT_EQ("defg", UTF16ToUTF8(omnibox()->GetText())); 495 EXPECT_EQ("defg", UTF16ToUTF8(omnibox()->GetText()));
496 } 496 }
497 497
498 // Verifies that instant previews aren't shown for crash URLs. 498 // Verifies that instant previews aren't shown for crash URLs.
499 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(CrashUrlCancelsInstant)) { 499 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(CrashUrlCancelsInstant)) {
500 ASSERT_TRUE(test_server()->Start()); 500 ASSERT_TRUE(test_server()->Start());
501 EnableInstant(); 501 EnableInstant();
502 SetupInstantProvider("instant.html"); 502 SetupInstantProvider("instant.html");
503 503
504 omnibox()->SetUserText(ASCIIToUTF16(chrome::kChromeUICrashURL)); 504 omnibox()->SetUserText(ASCIIToUTF16(chrome::kChromeUICrashURL));
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 DetermineInstantSupport(); 835 DetermineInstantSupport();
836 SearchAndWaitForPreviewToShow(); 836 SearchAndWaitForPreviewToShow();
837 837
838 // Now there should be three rows, the third being the instant preview. 838 // Now there should be three rows, the third being the instant preview.
839 TaskManagerBrowserTestUtil::WaitForResourceChange(3); 839 TaskManagerBrowserTestUtil::WaitForResourceChange(3);
840 string16 prefix = l10n_util::GetStringFUTF16( 840 string16 prefix = l10n_util::GetStringFUTF16(
841 IDS_TASK_MANAGER_INSTANT_PREVIEW_PREFIX, string16()); 841 IDS_TASK_MANAGER_INSTANT_PREVIEW_PREFIX, string16());
842 string16 title = task_manager->GetResourceTitle(2); 842 string16 title = task_manager->GetResourceTitle(2);
843 EXPECT_TRUE(StartsWith(title, prefix, true)) << title << " vs " << prefix; 843 EXPECT_TRUE(StartsWith(title, prefix, true)) << title << " vs " << prefix;
844 } 844 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698