| OLD | NEW |
| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 363 |
| 364 // Check that the value is reflected and oncancel is called. | 364 // Check that the value is reflected and oncancel is called. |
| 365 EXPECT_EQ("true 0 1 1 true d false def false 3 3", | 365 EXPECT_EQ("true 0 1 1 true d false def false 3 3", |
| 366 GetSearchStateAsString(preview_tab, true)); | 366 GetSearchStateAsString(preview_tab, true)); |
| 367 | 367 |
| 368 // Make sure the searchbox values were reset. | 368 // Make sure the searchbox values were reset. |
| 369 EXPECT_EQ("true 0 1 1 true d false false 0 0", | 369 EXPECT_EQ("true 0 1 1 true d false false 0 0", |
| 370 GetSearchStateAsString(preview_tab, false)); | 370 GetSearchStateAsString(preview_tab, false)); |
| 371 } | 371 } |
| 372 | 372 |
| 373 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(SetSuggestionsArrayOfStrings)) { | |
| 374 ASSERT_TRUE(test_server()->Start()); | |
| 375 EnableInstant(); | |
| 376 SetupInstantProvider("instant.html"); | |
| 377 DetermineInstantSupport(); | |
| 378 | |
| 379 ASSERT_TRUE(SetSuggestionsJavascriptArgument("['defg', 'unused']")); | |
| 380 SearchAndWaitForPreviewToShow(); | |
| 381 EXPECT_EQ("defg", GetSuggestion()); | |
| 382 } | |
| 383 | |
| 384 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(SetSuggestionsEmptyArray)) { | 373 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(SetSuggestionsEmptyArray)) { |
| 385 ASSERT_TRUE(test_server()->Start()); | 374 ASSERT_TRUE(test_server()->Start()); |
| 386 EnableInstant(); | 375 EnableInstant(); |
| 387 SetupInstantProvider("instant.html"); | 376 SetupInstantProvider("instant.html"); |
| 388 DetermineInstantSupport(); | 377 DetermineInstantSupport(); |
| 389 | 378 |
| 390 ASSERT_TRUE(SetSuggestionsJavascriptArgument("[]")); | 379 ASSERT_TRUE(SetSuggestionsJavascriptArgument("[]")); |
| 391 SearchAndWaitForPreviewToShow(); | 380 SearchAndWaitForPreviewToShow(); |
| 392 EXPECT_EQ("", GetSuggestion()); | 381 EXPECT_EQ("", GetSuggestion()); |
| 393 } | 382 } |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 DetermineInstantSupport(); | 825 DetermineInstantSupport(); |
| 837 SearchAndWaitForPreviewToShow(); | 826 SearchAndWaitForPreviewToShow(); |
| 838 | 827 |
| 839 // Now there should be three rows, the third being the instant preview. | 828 // Now there should be three rows, the third being the instant preview. |
| 840 TaskManagerBrowserTestUtil::WaitForResourceChange(3); | 829 TaskManagerBrowserTestUtil::WaitForResourceChange(3); |
| 841 string16 prefix = l10n_util::GetStringFUTF16( | 830 string16 prefix = l10n_util::GetStringFUTF16( |
| 842 IDS_TASK_MANAGER_INSTANT_PREVIEW_PREFIX, string16()); | 831 IDS_TASK_MANAGER_INSTANT_PREVIEW_PREFIX, string16()); |
| 843 string16 title = task_manager->GetResourceTitle(2); | 832 string16 title = task_manager->GetResourceTitle(2); |
| 844 EXPECT_TRUE(StartsWith(title, prefix, true)) << title << " vs " << prefix; | 833 EXPECT_TRUE(StartsWith(title, prefix, true)) << title << " vs " << prefix; |
| 845 } | 834 } |
| OLD | NEW |