| 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 27 matching lines...) Expand all Loading... |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 IN_PROC_BROWSER_TEST_F(ScriptBadgeApiTest, Basics) { | 40 IN_PROC_BROWSER_TEST_F(ScriptBadgeApiTest, Basics) { |
| 41 ASSERT_TRUE(test_server()->Start()); | 41 ASSERT_TRUE(test_server()->Start()); |
| 42 ASSERT_TRUE(RunExtensionTest("script_badge/basics")) << message_; | 42 ASSERT_TRUE(RunExtensionTest("script_badge/basics")) << message_; |
| 43 const Extension* extension = GetSingleLoadedExtension(); | 43 const Extension* extension = GetSingleLoadedExtension(); |
| 44 ASSERT_TRUE(extension) << message_; | 44 ASSERT_TRUE(extension) << message_; |
| 45 ExtensionAction* script_badge = extension->script_badge(); | 45 ExtensionAction* script_badge = extension->script_badge(); |
| 46 ASSERT_TRUE(script_badge); | 46 ASSERT_TRUE(script_badge); |
| 47 const extensions::LocationBarController* location_bar_controller = | 47 const extensions::LocationBarController* location_bar_controller = |
| 48 chrome::GetActiveTabContents(browser())->extension_tab_helper()-> | 48 extensions::TabHelper::FromWebContents( |
| 49 location_bar_controller(); | 49 chrome::GetActiveWebContents(browser()))-> |
| 50 location_bar_controller(); |
| 50 | 51 |
| 51 const int tab_id = SessionID::IdForTab( | 52 const int tab_id = SessionID::IdForTab( |
| 52 chrome::GetActiveWebContents(browser())); | 53 chrome::GetActiveWebContents(browser())); |
| 53 EXPECT_EQ(GURL(extension->GetResourceURL("default_popup.html")), | 54 EXPECT_EQ(GURL(extension->GetResourceURL("default_popup.html")), |
| 54 script_badge->GetPopupUrl(tab_id)); | 55 script_badge->GetPopupUrl(tab_id)); |
| 55 | 56 |
| 56 EXPECT_FALSE(script_badge->GetIsVisible(tab_id)); | 57 EXPECT_FALSE(script_badge->GetIsVisible(tab_id)); |
| 57 EXPECT_THAT(location_bar_controller->GetCurrentActions(), | 58 EXPECT_THAT(location_bar_controller->GetCurrentActions(), |
| 58 testing::ElementsAre()); | 59 testing::ElementsAre()); |
| 59 | 60 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 82 ResultCatcher catcher; | 83 ResultCatcher catcher; |
| 83 // Visit a non-extension page so the extension can run a content script and | 84 // Visit a non-extension page so the extension can run a content script and |
| 84 // cause the script badge to be animated in. | 85 // cause the script badge to be animated in. |
| 85 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("")); | 86 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("")); |
| 86 ASSERT_TRUE(catcher.GetNextResult()); | 87 ASSERT_TRUE(catcher.GetNextResult()); |
| 87 } | 88 } |
| 88 EXPECT_TRUE(script_badge->GetIsVisible(tab_id)); | 89 EXPECT_TRUE(script_badge->GetIsVisible(tab_id)); |
| 89 EXPECT_THAT(location_bar_controller->GetCurrentActions(), | 90 EXPECT_THAT(location_bar_controller->GetCurrentActions(), |
| 90 testing::ElementsAre(script_badge)); | 91 testing::ElementsAre(script_badge)); |
| 91 } | 92 } |
| OLD | NEW |