| 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 "chrome/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
| 6 #include "chrome/browser/extensions/browser_action_test_util.h" | 6 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 7 #include "chrome/browser/sessions/restore_tab_helper.h" | 7 #include "chrome/browser/sessions/session_tab_helper.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_tabstrip.h" | 9 #include "chrome/browser/ui/browser_tabstrip.h" |
| 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
| 13 #include "chrome/common/extensions/extension_action.h" | 13 #include "chrome/common/extensions/extension_action.h" |
| 14 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
| 15 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/test/browser_test_utils.h" | 17 #include "content/public/test/browser_test_utils.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Load a page, the extension will detect the navigation and request to show | 108 // Load a page, the extension will detect the navigation and request to show |
| 109 // the page action icon. | 109 // the page action icon. |
| 110 ResultCatcher catcher; | 110 ResultCatcher catcher; |
| 111 ui_test_utils::NavigateToURL(browser(), | 111 ui_test_utils::NavigateToURL(browser(), |
| 112 test_server()->GetURL("files/extensions/test_file.txt")); | 112 test_server()->GetURL("files/extensions/test_file.txt")); |
| 113 ASSERT_TRUE(catcher.GetNextResult()); | 113 ASSERT_TRUE(catcher.GetNextResult()); |
| 114 } | 114 } |
| 115 | 115 |
| 116 // Make sure it appears and is the right one. | 116 // Make sure it appears and is the right one. |
| 117 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); | 117 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); |
| 118 int tab_id = chrome::GetActiveTabContents(browser())->restore_tab_helper()-> | 118 int tab_id = chrome::GetActiveTabContents(browser())->session_tab_helper()-> |
| 119 session_id().id(); | 119 session_id().id(); |
| 120 ExtensionAction* action = extension->page_action(); | 120 ExtensionAction* action = extension->page_action(); |
| 121 ASSERT_TRUE(action); | 121 ASSERT_TRUE(action); |
| 122 EXPECT_EQ("Make this page red", action->GetTitle(tab_id)); | 122 EXPECT_EQ("Make this page red", action->GetTitle(tab_id)); |
| 123 | 123 |
| 124 // Activate the shortcut (Ctrl+Shift+F). | 124 // Activate the shortcut (Ctrl+Shift+F). |
| 125 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 125 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 126 browser(), ui::VKEY_F, true, true, false, false)); | 126 browser(), ui::VKEY_F, true, true, false, false)); |
| 127 | 127 |
| 128 // Verify the command worked (the page action turns the page red). | 128 // Verify the command worked (the page action turns the page red). |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 { | 161 { |
| 162 ResultCatcher catcher; | 162 ResultCatcher catcher; |
| 163 // Activate the shortcut (Ctrl+Shift+F). | 163 // Activate the shortcut (Ctrl+Shift+F). |
| 164 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 164 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 165 browser(), ui::VKEY_F, true, true, false, false)); | 165 browser(), ui::VKEY_F, true, true, false, false)); |
| 166 ASSERT_TRUE(catcher.GetNextResult()); | 166 ASSERT_TRUE(catcher.GetNextResult()); |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 | 169 |
| OLD | NEW |