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

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

Issue 12213093: Remove ImageLoadingTracker class (Closed) Base URL: https://git.chromium.org/chromium/src.git@Issue_163929
Patch Set: Fix merge conflict Created 7 years, 10 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
« no previous file with comments | « chrome/browser/ui/extensions/shell_window.cc ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/ui/views/browser_actions_container.h" 5 #include "chrome/browser/ui/views/browser_actions_container.h"
6 6
7 #include "chrome/browser/extensions/browser_action_test_util.h" 7 #include "chrome/browser/extensions/browser_action_test_util.h"
8 #include "chrome/browser/extensions/extension_action.h"
9 #include "chrome/browser/extensions/extension_action_manager.h"
10 #include "chrome/browser/extensions/extension_browsertest.h" 8 #include "chrome/browser/extensions/extension_browsertest.h"
11 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/extension_system.h"
13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/common/extensions/extension_constants.h"
17 #include "chrome/common/extensions/extension_icon_set.h"
18 #include "chrome/common/extensions/extension_resource.h"
19 #include "content/public/test/test_utils.h" 10 #include "content/public/test/test_utils.h"
20 11
21 using extensions::Extension; 12 using extensions::Extension;
22 13
23 class BrowserActionsContainerTest : public ExtensionBrowserTest { 14 class BrowserActionsContainerTest : public ExtensionBrowserTest {
24 public: 15 public:
25 BrowserActionsContainerTest() { 16 BrowserActionsContainerTest() {
26 } 17 }
27 virtual ~BrowserActionsContainerTest() {} 18 virtual ~BrowserActionsContainerTest() {}
28 19
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 EXPECT_EQ(1, browser_actions_bar()->VisibleBrowserActions()); 231 EXPECT_EQ(1, browser_actions_bar()->VisibleBrowserActions());
241 std::string idA = browser_actions_bar()->GetExtensionId(0); 232 std::string idA = browser_actions_bar()->GetExtensionId(0);
242 233
243 // Force hide this browser action. 234 // Force hide this browser action.
244 ExtensionService* service = extensions::ExtensionSystem::Get( 235 ExtensionService* service = extensions::ExtensionSystem::Get(
245 browser()->profile())->extension_service(); 236 browser()->profile())->extension_service();
246 service->extension_prefs()->SetBrowserActionVisibility( 237 service->extension_prefs()->SetBrowserActionVisibility(
247 service->GetExtensionById(idA, false), false); 238 service->GetExtensionById(idA, false), false);
248 EXPECT_EQ(0, browser_actions_bar()->VisibleBrowserActions()); 239 EXPECT_EQ(0, browser_actions_bar()->VisibleBrowserActions());
249 } 240 }
250
251 IN_PROC_BROWSER_TEST_F(BrowserActionsContainerTest, TestCrash57536) {
252 LOG(INFO) << "Test starting\n" << std::flush;
253
254 LOG(INFO) << "Loading extension\n" << std::flush;
255
256 // Load extension A (contains browser action).
257 const Extension* extension = LoadExtension(
258 test_data_dir_.AppendASCII("api_test")
259 .AppendASCII("browser_action")
260 .AppendASCII("crash_57536"));
261 ASSERT_TRUE(extension);
262
263 LOG(INFO) << "Creating bitmap\n" << std::flush;
264
265 // Create and cache and empty bitmap.
266 SkBitmap bitmap;
267 bitmap.setConfig(SkBitmap::kARGB_8888_Config,
268 Extension::kBrowserActionIconMaxSize,
269 Extension::kBrowserActionIconMaxSize);
270 bitmap.allocPixels();
271
272 LOG(INFO) << "Set as cached image\n" << std::flush;
273
274 gfx::Size size(Extension::kBrowserActionIconMaxSize,
275 Extension::kBrowserActionIconMaxSize);
276 const ExtensionIconSet* default_icon =
277 extensions::ExtensionActionManager::Get(browser()->profile())->
278 GetBrowserAction(*extension)->default_icon();
279 const std::string path =
280 default_icon->Get(extension_misc::EXTENSION_ICON_ACTION,
281 ExtensionIconSet::MATCH_EXACTLY);
282
283 extension->SetCachedImage(extension->GetResource(path), bitmap, size);
284
285 LOG(INFO) << "Disabling extension\n" << std::flush;
286 DisableExtension(extension->id());
287 LOG(INFO) << "Enabling extension\n" << std::flush;
288 EnableExtension(extension->id());
289 LOG(INFO) << "Test ending\n" << std::flush;
290 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/extensions/shell_window.cc ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698