| 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/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 9 #include "chrome/browser/extensions/browser_action_test_util.h" | 9 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 // Lazy Background Page doesn't exist yet. | 144 // Lazy Background Page doesn't exist yet. |
| 145 ExtensionProcessManager* pm = | 145 ExtensionProcessManager* pm = |
| 146 browser()->profile()->GetExtensionProcessManager(); | 146 browser()->profile()->GetExtensionProcessManager(); |
| 147 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); | 147 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); |
| 148 int num_page_actions = browser()->window()->GetLocationBar()-> | 148 int num_page_actions = browser()->window()->GetLocationBar()-> |
| 149 GetLocationBarForTesting()->PageActionVisibleCount(); | 149 GetLocationBarForTesting()->PageActionVisibleCount(); |
| 150 | 150 |
| 151 // Open a tab to a URL that will trigger the page action to show. | 151 // Open a tab to a URL that will trigger the page action to show. |
| 152 LazyBackgroundObserver page_complete; | 152 LazyBackgroundObserver page_complete; |
| 153 ui_test_utils::WindowedNotificationObserver page_action_changed( | 153 content::WindowedNotificationObserver page_action_changed( |
| 154 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, | 154 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, |
| 155 content::NotificationService::AllSources()); | 155 content::NotificationService::AllSources()); |
| 156 ui_test_utils::NavigateToURL( | 156 ui_test_utils::NavigateToURL( |
| 157 browser(), test_server()->GetURL("files/extensions/test_file.html")); | 157 browser(), test_server()->GetURL("files/extensions/test_file.html")); |
| 158 page_complete.Wait(); | 158 page_complete.Wait(); |
| 159 | 159 |
| 160 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); | 160 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); |
| 161 | 161 |
| 162 // Page action is shown. | 162 // Page action is shown. |
| 163 page_action_changed.Wait(); | 163 page_action_changed.Wait(); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); | 365 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); |
| 366 | 366 |
| 367 // The browser action has a new title. | 367 // The browser action has a new title. |
| 368 BrowserActionTestUtil browser_action(browser()); | 368 BrowserActionTestUtil browser_action(browser()); |
| 369 ASSERT_EQ(1, browser_action.NumberOfBrowserActions()); | 369 ASSERT_EQ(1, browser_action.NumberOfBrowserActions()); |
| 370 EXPECT_EQ("Success", browser_action.GetTooltip(0)); | 370 EXPECT_EQ("Success", browser_action.GetTooltip(0)); |
| 371 } | 371 } |
| 372 | 372 |
| 373 // TODO: background page with timer. | 373 // TODO: background page with timer. |
| 374 // TODO: background page that interacts with popup. | 374 // TODO: background page that interacts with popup. |
| OLD | NEW |