| 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_action.h" | 5 #include "chrome/browser/extensions/extension_action.h" |
| 6 #include "chrome/browser/extensions/extension_action_manager.h" | 6 #include "chrome/browser/extensions/extension_action_manager.h" |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
| 8 #include "chrome/browser/extensions/extension_tab_util.h" | 8 #include "chrome/browser/extensions/extension_tab_util.h" |
| 9 #include "chrome/browser/extensions/extension_test_message_listener.h" | 9 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 // Make sure leaving a matching page unshows the page action. | 50 // Make sure leaving a matching page unshows the page action. |
| 51 NavigateInRenderer(tab, GURL("http://not_checked/")); | 51 NavigateInRenderer(tab, GURL("http://not_checked/")); |
| 52 EXPECT_FALSE(page_action->GetIsVisible(tab_id)); | 52 EXPECT_FALSE(page_action->GetIsVisible(tab_id)); |
| 53 | 53 |
| 54 // Insert a password field to make sure that's noticed. | 54 // Insert a password field to make sure that's noticed. |
| 55 ASSERT_TRUE(content::ExecuteScript( | 55 ASSERT_TRUE(content::ExecuteScript( |
| 56 tab, "document.body.innerHTML = '<input type=\"password\">';")); | 56 tab, "document.body.innerHTML = '<input type=\"password\">';")); |
| 57 // Give the mutation observer a chance to run and send back the | 57 // Give the mutation observer a chance to run and send back the |
| 58 // matching-selector update. | 58 // matching-selector update. |
| 59 ASSERT_TRUE(content::ExecuteScript(tab, "")); | 59 ASSERT_TRUE(content::ExecuteScript(tab, std::string())); |
| 60 EXPECT_TRUE(page_action->GetIsVisible(tab_id)); | 60 EXPECT_TRUE(page_action->GetIsVisible(tab_id)); |
| 61 | 61 |
| 62 // Remove it again to make sure that reverts the action. | 62 // Remove it again to make sure that reverts the action. |
| 63 ASSERT_TRUE(content::ExecuteScript( | 63 ASSERT_TRUE(content::ExecuteScript( |
| 64 tab, "document.body.innerHTML = 'Hello world';")); | 64 tab, "document.body.innerHTML = 'Hello world';")); |
| 65 // Give the mutation observer a chance to run and send back the | 65 // Give the mutation observer a chance to run and send back the |
| 66 // matching-selector update. | 66 // matching-selector update. |
| 67 ASSERT_TRUE(content::ExecuteScript(tab, "")); | 67 ASSERT_TRUE(content::ExecuteScript(tab, std::string())); |
| 68 EXPECT_FALSE(page_action->GetIsVisible(tab_id)); | 68 EXPECT_FALSE(page_action->GetIsVisible(tab_id)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace | 71 } // namespace |
| 72 } // namespace extensions | 72 } // namespace extensions |
| OLD | NEW |