| 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/browser_event_router.h" | 5 #include "chrome/browser/extensions/browser_event_router.h" |
| 6 #include "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
| 7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
| 8 #include "chrome/browser/extensions/location_bar_controller.h" | 8 #include "chrome/browser/extensions/location_bar_controller.h" |
| 9 #include "chrome/browser/extensions/tab_helper.h" | 9 #include "chrome/browser/extensions/tab_helper.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 const Extension* extension = GetSingleLoadedExtension(); | 36 const Extension* extension = GetSingleLoadedExtension(); |
| 37 ASSERT_TRUE(extension) << message_; | 37 ASSERT_TRUE(extension) << message_; |
| 38 ExtensionAction* script_badge = extension->script_badge(); | 38 ExtensionAction* script_badge = extension->script_badge(); |
| 39 ASSERT_TRUE(script_badge); | 39 ASSERT_TRUE(script_badge); |
| 40 const extensions::LocationBarController* location_bar_controller = | 40 const extensions::LocationBarController* location_bar_controller = |
| 41 extensions::TabHelper::FromWebContents( | 41 extensions::TabHelper::FromWebContents( |
| 42 chrome::GetActiveWebContents(browser()))-> | 42 chrome::GetActiveWebContents(browser()))-> |
| 43 location_bar_controller(); | 43 location_bar_controller(); |
| 44 | 44 |
| 45 const int tab_id = SessionID::IdForTab( | 45 const int tab_id = SessionID::IdForTab( |
| 46 chrome::GetActiveTabContents(browser())); | 46 chrome::GetActiveWebContents(browser())); |
| 47 EXPECT_EQ(GURL(extension->GetResourceURL("default_popup.html")), | 47 EXPECT_EQ(GURL(extension->GetResourceURL("default_popup.html")), |
| 48 script_badge->GetPopupUrl(tab_id)); | 48 script_badge->GetPopupUrl(tab_id)); |
| 49 | 49 |
| 50 EXPECT_FALSE(script_badge->GetIsVisible(tab_id)); | 50 EXPECT_FALSE(script_badge->GetIsVisible(tab_id)); |
| 51 EXPECT_THAT(location_bar_controller->GetCurrentActions(), | 51 EXPECT_THAT(location_bar_controller->GetCurrentActions(), |
| 52 testing::ElementsAre()); | 52 testing::ElementsAre()); |
| 53 | 53 |
| 54 { | 54 { |
| 55 ResultCatcher catcher; | 55 ResultCatcher catcher; |
| 56 // Tell the extension to update the script badge state. | 56 // Tell the extension to update the script badge state. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 76 ResultCatcher catcher; | 76 ResultCatcher catcher; |
| 77 // Visit a non-extension page so the extension can run a content script and | 77 // Visit a non-extension page so the extension can run a content script and |
| 78 // cause the script badge to be animated in. | 78 // cause the script badge to be animated in. |
| 79 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("")); | 79 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("")); |
| 80 ASSERT_TRUE(catcher.GetNextResult()); | 80 ASSERT_TRUE(catcher.GetNextResult()); |
| 81 } | 81 } |
| 82 EXPECT_TRUE(script_badge->GetIsVisible(tab_id)); | 82 EXPECT_TRUE(script_badge->GetIsVisible(tab_id)); |
| 83 EXPECT_THAT(location_bar_controller->GetCurrentActions(), | 83 EXPECT_THAT(location_bar_controller->GetCurrentActions(), |
| 84 testing::ElementsAre(script_badge)); | 84 testing::ElementsAre(script_badge)); |
| 85 } | 85 } |
| OLD | NEW |