| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 ASSERT_TRUE(RunExtensionTest("browser_action/no_icon")) << message_; | 97 ASSERT_TRUE(RunExtensionTest("browser_action/no_icon")) << message_; |
| 98 const Extension* extension = GetSingleLoadedExtension(); | 98 const Extension* extension = GetSingleLoadedExtension(); |
| 99 ASSERT_TRUE(extension) << message_; | 99 ASSERT_TRUE(extension) << message_; |
| 100 | 100 |
| 101 // Test that there is a browser action in the toolbar. | 101 // Test that there is a browser action in the toolbar. |
| 102 ASSERT_EQ(1, GetBrowserActionsBar().NumberOfBrowserActions()); | 102 ASSERT_EQ(1, GetBrowserActionsBar().NumberOfBrowserActions()); |
| 103 EXPECT_TRUE(GetBrowserActionsBar().HasIcon(0)); | 103 EXPECT_TRUE(GetBrowserActionsBar().HasIcon(0)); |
| 104 | 104 |
| 105 // Set prev_id which holds the id of the previous image, and use it in the | 105 // Set prev_id which holds the id of the previous image, and use it in the |
| 106 // next test to see if the image changes. | 106 // next test to see if the image changes. |
| 107 uint32_t prev_id = extension->browser_action()->GetIcon(0).getGenerationID(); | 107 ExtensionAction::PathToIconCache empty_cache; |
| 108 uint32_t prev_id = extension->browser_action()->GetIcon(0, empty_cache). |
| 109 ToSkBitmap()->getGenerationID(); |
| 108 | 110 |
| 109 // Tell the extension to update the icon using setIcon({imageData:...}). | 111 // Tell the extension to update the icon using setIcon({imageData:...}). |
| 110 ResultCatcher catcher; | 112 ResultCatcher catcher; |
| 111 ui_test_utils::NavigateToURL(browser(), | 113 ui_test_utils::NavigateToURL(browser(), |
| 112 GURL(extension->GetResourceURL("update.html"))); | 114 GURL(extension->GetResourceURL("update.html"))); |
| 113 ASSERT_TRUE(catcher.GetNextResult()); | 115 ASSERT_TRUE(catcher.GetNextResult()); |
| 114 | 116 |
| 115 // Test that we received the changes. | 117 // Test that we received the changes. |
| 116 EXPECT_TRUE(GetBrowserActionsBar().HasIcon(0)); | 118 EXPECT_TRUE(GetBrowserActionsBar().HasIcon(0)); |
| 117 EXPECT_NE(prev_id, extension->browser_action()->GetIcon(0).getGenerationID()); | 119 EXPECT_NE(prev_id, |
| 118 prev_id = extension->browser_action()->GetIcon(0).getGenerationID(); | 120 extension->browser_action()->GetIcon(0, empty_cache). |
| 121 ToSkBitmap()->getGenerationID()); |
| 122 prev_id = extension->browser_action()->GetIcon(0, empty_cache). |
| 123 ToSkBitmap()->getGenerationID(); |
| 119 | 124 |
| 120 // Tell the extension to update the icon using setIcon({path:...}). | 125 // Tell the extension to update the icon using setIcon({path:...}). |
| 121 ui_test_utils::NavigateToURL(browser(), | 126 ui_test_utils::NavigateToURL(browser(), |
| 122 GURL(extension->GetResourceURL("update2.html"))); | 127 GURL(extension->GetResourceURL("update2.html"))); |
| 123 ASSERT_TRUE(catcher.GetNextResult()); | 128 ASSERT_TRUE(catcher.GetNextResult()); |
| 124 EXPECT_TRUE(GetBrowserActionsBar().HasIcon(0)); | 129 EXPECT_TRUE(GetBrowserActionsBar().HasIcon(0)); |
| 125 EXPECT_NE(prev_id, extension->browser_action()->GetIcon(0).getGenerationID()); | 130 EXPECT_NE(prev_id, |
| 131 extension->browser_action()->GetIcon(0, empty_cache). |
| 132 ToSkBitmap()->getGenerationID()); |
| 126 } | 133 } |
| 127 | 134 |
| 128 // This test is flaky as per http://crbug.com/74557. | 135 // This test is flaky as per http://crbug.com/74557. |
| 129 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, | 136 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, |
| 130 DISABLED_TabSpecificBrowserActionState) { | 137 DISABLED_TabSpecificBrowserActionState) { |
| 131 ASSERT_TRUE(RunExtensionTest("browser_action/tab_specific_state")) << | 138 ASSERT_TRUE(RunExtensionTest("browser_action/tab_specific_state")) << |
| 132 message_; | 139 message_; |
| 133 const Extension* extension = GetSingleLoadedExtension(); | 140 const Extension* extension = GetSingleLoadedExtension(); |
| 134 ASSERT_TRUE(extension) << message_; | 141 ASSERT_TRUE(extension) << message_; |
| 135 | 142 |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 ResultCatcher catcher; | 469 ResultCatcher catcher; |
| 463 ui_test_utils::NavigateToURL(browser(), | 470 ui_test_utils::NavigateToURL(browser(), |
| 464 GURL(extension->GetResourceURL("update.html"))); | 471 GURL(extension->GetResourceURL("update.html"))); |
| 465 ASSERT_TRUE(catcher.GetNextResult()); | 472 ASSERT_TRUE(catcher.GetNextResult()); |
| 466 | 473 |
| 467 // Test the getters for a specific tab. | 474 // Test the getters for a specific tab. |
| 468 ui_test_utils::NavigateToURL(browser(), | 475 ui_test_utils::NavigateToURL(browser(), |
| 469 GURL(extension->GetResourceURL("update2.html"))); | 476 GURL(extension->GetResourceURL("update2.html"))); |
| 470 ASSERT_TRUE(catcher.GetNextResult()); | 477 ASSERT_TRUE(catcher.GetNextResult()); |
| 471 } | 478 } |
| OLD | NEW |