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

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

Issue 11421079: Persist the Instant API to committed search result pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/content_settings/host_content_settings_map.h" 5 #include "chrome/browser/content_settings/host_content_settings_map.h"
6 #include "chrome/browser/history/history_service_factory.h" 6 #include "chrome/browser/history/history_service_factory.h"
7 #include "chrome/browser/instant/instant_loader.h" 7 #include "chrome/browser/instant/instant_loader.h"
8 #include "chrome/browser/instant/instant_model_observer.h" 8 #include "chrome/browser/instant/instant_model_observer.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/search_engines/template_url_service.h" 10 #include "chrome/browser/search_engines/template_url_service.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 EXPECT_EQ("search", value_); 393 EXPECT_EQ("search", value_);
394 EXPECT_TRUE(verbatim_); 394 EXPECT_TRUE(verbatim_);
395 EXPECT_EQ(1, oncancelcalls_); 395 EXPECT_EQ(1, oncancelcalls_);
396 EXPECT_EQ(1, onvisibilitycalls_); 396 EXPECT_EQ(1, onvisibilitycalls_);
397 } 397 }
398 398
399 // Test that the onreisze event is dispatched upon typing in the omnibox. 399 // Test that the onreisze event is dispatched upon typing in the omnibox.
400 IN_PROC_BROWSER_TEST_F(InstantTest, OnResizeEvent) { 400 IN_PROC_BROWSER_TEST_F(InstantTest, OnResizeEvent) {
401 ASSERT_NO_FATAL_FAILURE(SetupInstant()); 401 ASSERT_NO_FATAL_FAILURE(SetupInstant());
402 402
403 // This makes Instant load the preview, along with an initial onresize() (see 403 // This makes Instant load the preview, along with an initial onresize() (see
Jered 2012/11/27 18:19:53 Update comment.
sreeram 2012/11/29 07:33:19 Done.
404 // SearchBoxExtension::PageSupportsInstant() for why). 404 // SearchBoxExtension::PageSupportsInstant() for why).
405 FocusOmniboxAndWaitForInstantSupport(); 405 FocusOmniboxAndWaitForInstantSupport();
406 406
407 EXPECT_TRUE(UpdateSearchState(instant()->GetPreviewContents())); 407 EXPECT_TRUE(UpdateSearchState(instant()->GetPreviewContents()));
408 EXPECT_EQ(1, onresizecalls_); 408 EXPECT_EQ(0, onresizecalls_);
409 EXPECT_EQ(0, height_); 409 EXPECT_EQ(0, height_);
410 410
411 // Type a query into the omnibox. This should cause an onresize() event, with 411 // Type a query into the omnibox. This should cause an onresize() event, with
412 // a valid (non-zero) height. 412 // a valid (non-zero) height.
413 SetOmniboxTextAndWaitForInstantToShow("search"); 413 SetOmniboxTextAndWaitForInstantToShow("search");
414 414
415 EXPECT_TRUE(UpdateSearchState(instant()->GetPreviewContents())); 415 EXPECT_TRUE(UpdateSearchState(instant()->GetPreviewContents()));
416 EXPECT_EQ(2, onresizecalls_); 416 EXPECT_EQ(1, onresizecalls_);
417 EXPECT_LT(0, height_); 417 EXPECT_LT(0, height_);
418 } 418 }
419 419
420 // Test that the INSTANT_COMPLETE_NOW behavior works as expected. 420 // Test that the INSTANT_COMPLETE_NOW behavior works as expected.
421 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionIsCompletedNow) { 421 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionIsCompletedNow) {
422 ASSERT_NO_FATAL_FAILURE(SetupInstant()); 422 ASSERT_NO_FATAL_FAILURE(SetupInstant());
423 FocusOmniboxAndWaitForInstantSupport(); 423 FocusOmniboxAndWaitForInstantSupport();
424 424
425 // Tell the JS to request the given behavior. 425 // Tell the JS to request the given behavior.
426 EXPECT_TRUE(ExecuteScript("behavior = 'now'")); 426 EXPECT_TRUE(ExecuteScript("behavior = 'now'"));
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 1053
1054 SetOmniboxText("ins"); 1054 SetOmniboxText("ins");
1055 EXPECT_EQ(ASCIIToUTF16("tant"), omnibox()->GetInstantSuggestion()); 1055 EXPECT_EQ(ASCIIToUTF16("tant"), omnibox()->GetInstantSuggestion());
1056 1056
1057 SetOmniboxText("in"); 1057 SetOmniboxText("in");
1058 EXPECT_EQ(ASCIIToUTF16("stant"), omnibox()->GetInstantSuggestion()); 1058 EXPECT_EQ(ASCIIToUTF16("stant"), omnibox()->GetInstantSuggestion());
1059 1059
1060 SetOmniboxText("insane"); 1060 SetOmniboxText("insane");
1061 EXPECT_EQ(ASCIIToUTF16(""), omnibox()->GetInstantSuggestion()); 1061 EXPECT_EQ(ASCIIToUTF16(""), omnibox()->GetInstantSuggestion());
1062 } 1062 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/instant/instant_client.h » ('j') | chrome/browser/instant/instant_client.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698