OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_action_test_util.h" | 5 #include "chrome/browser/extensions/browser_action_test_util.h" |
6 #include "chrome/browser/extensions/extension_browsertest.h" | 6 #include "chrome/browser/extensions/extension_browsertest.h" |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/views/browser_actions_container.h" | 10 #include "chrome/browser/ui/views/browser_actions_container.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 ReloadExtension(idA); | 236 ReloadExtension(idA); |
237 | 237 |
238 // The browser action should become visible again. | 238 // The browser action should become visible again. |
239 EXPECT_EQ(1, browser_actions_bar()->VisibleBrowserActions()); | 239 EXPECT_EQ(1, browser_actions_bar()->VisibleBrowserActions()); |
240 } | 240 } |
241 | 241 |
242 IN_PROC_BROWSER_TEST_F(BrowserActionsContainerTest, TestCrash57536) { | 242 IN_PROC_BROWSER_TEST_F(BrowserActionsContainerTest, TestCrash57536) { |
243 LOG(INFO) << "Test starting\n" << std::flush; | 243 LOG(INFO) << "Test starting\n" << std::flush; |
244 | 244 |
245 ExtensionService* service = browser()->profile()->GetExtensionService(); | |
246 const size_t size_before = service->extensions()->size(); | |
247 | |
248 LOG(INFO) << "Loading extension\n" << std::flush; | 245 LOG(INFO) << "Loading extension\n" << std::flush; |
249 | 246 |
250 // Load extension A (contains browser action). | 247 // Load extension A (contains browser action). |
251 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("api_test") | 248 const Extension* extension = LoadExtension( |
252 .AppendASCII("browser_action") | 249 test_data_dir_.AppendASCII("api_test") |
253 .AppendASCII("crash_57536"))); | 250 .AppendASCII("browser_action") |
254 | 251 .AppendASCII("crash_57536")); |
255 const Extension* extension = service->extensions()->at(size_before); | 252 ASSERT_TRUE(extension); |
256 | 253 |
257 LOG(INFO) << "Creating bitmap\n" << std::flush; | 254 LOG(INFO) << "Creating bitmap\n" << std::flush; |
258 | 255 |
259 // Create and cache and empty bitmap. | 256 // Create and cache and empty bitmap. |
260 SkBitmap bitmap; | 257 SkBitmap bitmap; |
261 bitmap.setConfig(SkBitmap::kARGB_8888_Config, | 258 bitmap.setConfig(SkBitmap::kARGB_8888_Config, |
262 Extension::kBrowserActionIconMaxSize, | 259 Extension::kBrowserActionIconMaxSize, |
263 Extension::kBrowserActionIconMaxSize); | 260 Extension::kBrowserActionIconMaxSize); |
264 bitmap.allocPixels(); | 261 bitmap.allocPixels(); |
265 | 262 |
266 LOG(INFO) << "Set as cached image\n" << std::flush; | 263 LOG(INFO) << "Set as cached image\n" << std::flush; |
267 | 264 |
268 gfx::Size size(Extension::kBrowserActionIconMaxSize, | 265 gfx::Size size(Extension::kBrowserActionIconMaxSize, |
269 Extension::kBrowserActionIconMaxSize); | 266 Extension::kBrowserActionIconMaxSize); |
270 extension->SetCachedImage( | 267 extension->SetCachedImage( |
271 extension->GetResource(extension->browser_action()->default_icon_path()), | 268 extension->GetResource(extension->browser_action()->default_icon_path()), |
272 bitmap, | 269 bitmap, |
273 size); | 270 size); |
274 | 271 |
275 LOG(INFO) << "Disabling extension\n" << std::flush; | 272 LOG(INFO) << "Disabling extension\n" << std::flush; |
276 DisableExtension(extension->id()); | 273 DisableExtension(extension->id()); |
277 LOG(INFO) << "Enabling extension\n" << std::flush; | 274 LOG(INFO) << "Enabling extension\n" << std::flush; |
278 EnableExtension(extension->id()); | 275 EnableExtension(extension->id()); |
279 LOG(INFO) << "Test ending\n" << std::flush; | 276 LOG(INFO) << "Test ending\n" << std::flush; |
280 } | 277 } |
OLD | NEW |