| 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/stringprintf.h" | 6 #include "base/stringprintf.h" |
| 7 #include "chrome/browser/content_settings/host_content_settings_map.h" | 7 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 8 #include "chrome/browser/history/history.h" | 8 #include "chrome/browser/history/history.h" |
| 9 #include "chrome/browser/history/history_service_factory.h" | 9 #include "chrome/browser/history/history_service_factory.h" |
| 10 #include "chrome/browser/instant/instant_controller.h" | 10 #include "chrome/browser/instant/instant_controller.h" |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 EXPECT_EQ(preview_tab, chrome::GetActiveTabContents(browser())); | 760 EXPECT_EQ(preview_tab, chrome::GetActiveTabContents(browser())); |
| 761 EXPECT_TRUE(CheckVisibilityIs(preview_tab, true)); | 761 EXPECT_TRUE(CheckVisibilityIs(preview_tab, true)); |
| 762 } | 762 } |
| 763 | 763 |
| 764 // Test that the task manager identifies Instant's preview tab correctly. | 764 // Test that the task manager identifies Instant's preview tab correctly. |
| 765 IN_PROC_BROWSER_TEST_F(InstantTest, TaskManagerPrefix) { | 765 IN_PROC_BROWSER_TEST_F(InstantTest, TaskManagerPrefix) { |
| 766 // The browser starts with one new tab, so the task manager should have two | 766 // The browser starts with one new tab, so the task manager should have two |
| 767 // rows initially, one for the browser process and one for tab's renderer. | 767 // rows initially, one for the browser process and one for tab's renderer. |
| 768 TaskManagerModel* task_manager = TaskManager::GetInstance()->model(); | 768 TaskManagerModel* task_manager = TaskManager::GetInstance()->model(); |
| 769 task_manager->StartUpdating(); | 769 task_manager->StartUpdating(); |
| 770 TaskManagerBrowserTestUtil::WaitForResourceChange(2); | 770 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); |
| 771 | 771 |
| 772 ASSERT_NO_FATAL_FAILURE(SetupInstant("instant.html")); | 772 ASSERT_NO_FATAL_FAILURE(SetupInstant("instant.html")); |
| 773 instant()->OnAutocompleteGotFocus(); | 773 instant()->OnAutocompleteGotFocus(); |
| 774 WaitFor(chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED); | 774 WaitFor(chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED); |
| 775 | 775 |
| 776 // Now there should be three rows, the third being the Instant preview. | 776 // Now there should be three rows, the third being the Instant preview. |
| 777 TaskManagerBrowserTestUtil::WaitForResourceChange(3); | 777 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); |
| 778 string16 prefix = l10n_util::GetStringFUTF16( | 778 string16 prefix = l10n_util::GetStringFUTF16( |
| 779 IDS_TASK_MANAGER_INSTANT_PREVIEW_PREFIX, string16()); | 779 IDS_TASK_MANAGER_INSTANT_PREVIEW_PREFIX, string16()); |
| 780 string16 title = task_manager->GetResourceTitle(2); | 780 string16 title = task_manager->GetResourceTitle(2); |
| 781 EXPECT_TRUE(StartsWith(title, prefix, true)) << title << " vs " << prefix; | 781 EXPECT_TRUE(StartsWith(title, prefix, true)) << title << " vs " << prefix; |
| 782 } | 782 } |
| 783 | 783 |
| 784 void HistoryQueryDone(base::RunLoop* run_loop, | 784 void HistoryQueryDone(base::RunLoop* run_loop, |
| 785 bool* result, | 785 bool* result, |
| 786 HistoryService::Handle /* handle */, | 786 HistoryService::Handle /* handle */, |
| 787 bool success, | 787 bool success, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 // Refresh the loader, the preview contents should remain the same. | 921 // Refresh the loader, the preview contents should remain the same. |
| 922 instant()->OnStaleLoader(); | 922 instant()->OnStaleLoader(); |
| 923 EXPECT_TRUE(instant()->is_showing()); | 923 EXPECT_TRUE(instant()->is_showing()); |
| 924 | 924 |
| 925 instant()->stale_loader_timer_.Stop(); | 925 instant()->stale_loader_timer_.Stop(); |
| 926 // The refresh should happen once the omnibox loses focus. | 926 // The refresh should happen once the omnibox loses focus. |
| 927 EXPECT_TRUE(instant()->loader()->supports_instant()); | 927 EXPECT_TRUE(instant()->loader()->supports_instant()); |
| 928 instant()->OnAutocompleteLostFocus(NULL); | 928 instant()->OnAutocompleteLostFocus(NULL); |
| 929 EXPECT_FALSE(instant()->loader()->supports_instant()); | 929 EXPECT_FALSE(instant()->loader()->supports_instant()); |
| 930 } | 930 } |
| OLD | NEW |