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

Side by Side Diff: chrome/browser/ui/views/browser_actions_container_browsertest.cc

Issue 8733004: Make ExtensionService use ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: = Created 9 years 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) 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(); 245 ExtensionService* service = browser()->profile()->GetExtensionService();
246 const size_t size_before = service->extensions()->size();
247 246
248 LOG(INFO) << "Loading extension\n" << std::flush; 247 LOG(INFO) << "Loading extension\n" << std::flush;
249 248
250 // Load extension A (contains browser action). 249 // Load extension A (contains browser action).
251 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("api_test") 250 const Extension* extension = LoadExtension(
252 .AppendASCII("browser_action") 251 test_data_dir_.AppendASCII("api_test")
253 .AppendASCII("crash_57536"))); 252 .AppendASCII("browser_action")
254 253 .AppendASCII("crash_57536"));
255 const Extension* extension = service->extensions()->at(size_before); 254 ASSERT_TRUE(extension);
256 255
257 LOG(INFO) << "Creating bitmap\n" << std::flush; 256 LOG(INFO) << "Creating bitmap\n" << std::flush;
258 257
259 // Create and cache and empty bitmap. 258 // Create and cache and empty bitmap.
260 SkBitmap bitmap; 259 SkBitmap bitmap;
261 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 260 bitmap.setConfig(SkBitmap::kARGB_8888_Config,
262 Extension::kBrowserActionIconMaxSize, 261 Extension::kBrowserActionIconMaxSize,
263 Extension::kBrowserActionIconMaxSize); 262 Extension::kBrowserActionIconMaxSize);
264 bitmap.allocPixels(); 263 bitmap.allocPixels();
265 264
266 LOG(INFO) << "Set as cached image\n" << std::flush; 265 LOG(INFO) << "Set as cached image\n" << std::flush;
267 266
268 gfx::Size size(Extension::kBrowserActionIconMaxSize, 267 gfx::Size size(Extension::kBrowserActionIconMaxSize,
269 Extension::kBrowserActionIconMaxSize); 268 Extension::kBrowserActionIconMaxSize);
270 extension->SetCachedImage( 269 extension->SetCachedImage(
271 extension->GetResource(extension->browser_action()->default_icon_path()), 270 extension->GetResource(extension->browser_action()->default_icon_path()),
272 bitmap, 271 bitmap,
273 size); 272 size);
274 273
275 LOG(INFO) << "Disabling extension\n" << std::flush; 274 LOG(INFO) << "Disabling extension\n" << std::flush;
276 DisableExtension(extension->id()); 275 DisableExtension(extension->id());
277 LOG(INFO) << "Enabling extension\n" << std::flush; 276 LOG(INFO) << "Enabling extension\n" << std::flush;
278 EnableExtension(extension->id()); 277 EnableExtension(extension->id());
279 LOG(INFO) << "Test ending\n" << std::flush; 278 LOG(INFO) << "Test ending\n" << std::flush;
280 } 279 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698