Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: chrome/browser/extensions/api/extension_action/browser_action_apitest.cc

Issue 10806058: Move icon fallbacks into ExtensionAction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move the icon cache inside ExtensionAction. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 uint32_t prev_id = extension->browser_action()->GetIcon(0).
108 ToSkBitmap()->getGenerationID();
108 109
109 // Tell the extension to update the icon using setIcon({imageData:...}). 110 // Tell the extension to update the icon using setIcon({imageData:...}).
110 ResultCatcher catcher; 111 ResultCatcher catcher;
111 ui_test_utils::NavigateToURL(browser(), 112 ui_test_utils::NavigateToURL(browser(),
112 GURL(extension->GetResourceURL("update.html"))); 113 GURL(extension->GetResourceURL("update.html")));
113 ASSERT_TRUE(catcher.GetNextResult()); 114 ASSERT_TRUE(catcher.GetNextResult());
114 115
115 // Test that we received the changes. 116 // Test that we received the changes.
116 EXPECT_TRUE(GetBrowserActionsBar().HasIcon(0)); 117 EXPECT_TRUE(GetBrowserActionsBar().HasIcon(0));
117 EXPECT_NE(prev_id, extension->browser_action()->GetIcon(0).getGenerationID()); 118 EXPECT_NE(prev_id,
118 prev_id = extension->browser_action()->GetIcon(0).getGenerationID(); 119 extension->browser_action()->GetIcon(0).
120 ToSkBitmap()->getGenerationID());
121 prev_id = extension->browser_action()->GetIcon(0).
122 ToSkBitmap()->getGenerationID();
119 123
120 // Tell the extension to update the icon using setIcon({path:...}). 124 // Tell the extension to update the icon using setIcon({path:...}).
121 ui_test_utils::NavigateToURL(browser(), 125 ui_test_utils::NavigateToURL(browser(),
122 GURL(extension->GetResourceURL("update2.html"))); 126 GURL(extension->GetResourceURL("update2.html")));
123 ASSERT_TRUE(catcher.GetNextResult()); 127 ASSERT_TRUE(catcher.GetNextResult());
124 EXPECT_TRUE(GetBrowserActionsBar().HasIcon(0)); 128 EXPECT_TRUE(GetBrowserActionsBar().HasIcon(0));
125 EXPECT_NE(prev_id, extension->browser_action()->GetIcon(0).getGenerationID()); 129 EXPECT_NE(prev_id,
130 extension->browser_action()->GetIcon(0).
131 ToSkBitmap()->getGenerationID());
126 } 132 }
127 133
128 // This test is flaky as per http://crbug.com/74557. 134 // This test is flaky as per http://crbug.com/74557.
129 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, 135 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest,
130 DISABLED_TabSpecificBrowserActionState) { 136 DISABLED_TabSpecificBrowserActionState) {
131 ASSERT_TRUE(RunExtensionTest("browser_action/tab_specific_state")) << 137 ASSERT_TRUE(RunExtensionTest("browser_action/tab_specific_state")) <<
132 message_; 138 message_;
133 const Extension* extension = GetSingleLoadedExtension(); 139 const Extension* extension = GetSingleLoadedExtension();
134 ASSERT_TRUE(extension) << message_; 140 ASSERT_TRUE(extension) << message_;
135 141
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 ResultCatcher catcher; 470 ResultCatcher catcher;
465 ui_test_utils::NavigateToURL(browser(), 471 ui_test_utils::NavigateToURL(browser(),
466 GURL(extension->GetResourceURL("update.html"))); 472 GURL(extension->GetResourceURL("update.html")));
467 ASSERT_TRUE(catcher.GetNextResult()); 473 ASSERT_TRUE(catcher.GetNextResult());
468 474
469 // Test the getters for a specific tab. 475 // Test the getters for a specific tab.
470 ui_test_utils::NavigateToURL(browser(), 476 ui_test_utils::NavigateToURL(browser(),
471 GURL(extension->GetResourceURL("update2.html"))); 477 GURL(extension->GetResourceURL("update2.html")));
472 ASSERT_TRUE(catcher.GetNextResult()); 478 ASSERT_TRUE(catcher.GetNextResult());
473 } 479 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698