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

Side by Side Diff: chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc

Issue 10873022: Revert 152904 - Moving FaviconService to a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 "chrome/browser/ui/toolbar/back_forward_menu_model.h" 5 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h"
6 6
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/favicon/favicon_service_factory.h"
12 #include "chrome/browser/history/history.h" 11 #include "chrome/browser/history/history.h"
13 #include "chrome/browser/history/history_service_factory.h" 12 #include "chrome/browser/history/history_service_factory.h"
14 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_tabstrip.h" 15 #include "chrome/browser/ui/browser_tabstrip.h"
17 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
18 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 17 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
19 #include "chrome/test/base/test_browser_window.h" 18 #include "chrome/test/base/test_browser_window.h"
20 #include "chrome/test/base/testing_profile.h" 19 #include "chrome/test/base/testing_profile.h"
21 #include "content/public/browser/navigation_controller.h" 20 #include "content/public/browser/navigation_controller.h"
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 GURL url1_favicon("http://www.a.com/1/favicon.ico"); 522 GURL url1_favicon("http://www.a.com/1/favicon.ico");
524 523
525 NavigateAndCommit(url1); 524 NavigateAndCommit(url1);
526 // Navigate to a new URL so that url1 will be in the BackForwardMenuModel. 525 // Navigate to a new URL so that url1 will be in the BackForwardMenuModel.
527 NavigateAndCommit(url2); 526 NavigateAndCommit(url2);
528 527
529 // Set the desired favicon for url1. 528 // Set the desired favicon for url1.
530 HistoryServiceFactory::GetForProfile( 529 HistoryServiceFactory::GetForProfile(
531 profile(), Profile::EXPLICIT_ACCESS)->AddPage( 530 profile(), Profile::EXPLICIT_ACCESS)->AddPage(
532 url1, history::SOURCE_BROWSED); 531 url1, history::SOURCE_BROWSED);
533 FaviconServiceFactory::GetForProfile( 532 profile()->GetFaviconService(Profile::EXPLICIT_ACCESS)->SetFavicon(url1,
534 profile(), Profile::EXPLICIT_ACCESS)->SetFavicon( 533 url1_favicon, icon_data, history::FAVICON);
535 url1, url1_favicon, icon_data, history::FAVICON);
536 534
537 // Will return the current icon (default) but start an anync call 535 // Will return the current icon (default) but start an anync call
538 // to retrieve the favicon from the favicon service. 536 // to retrieve the favicon from the favicon service.
539 gfx::Image default_icon; 537 gfx::Image default_icon;
540 back_model.GetIconAt(0, &default_icon); 538 back_model.GetIconAt(0, &default_icon);
541 539
542 // Make the favicon service run GetFavIconForURL, 540 // Make the favicon service run GetFavIconForURL,
543 // FaviconDelegate.OnIconChanged will be called. 541 // FaviconDelegate.OnIconChanged will be called.
544 MessageLoop::current()->Run(); 542 MessageLoop::current()->Run();
545 543
(...skipping 18 matching lines...) Expand all
564 // Verify we did get the expected favicon. 562 // Verify we did get the expected favicon.
565 EXPECT_EQ(0, memcmp(new_icon_bitmap.getPixels(), 563 EXPECT_EQ(0, memcmp(new_icon_bitmap.getPixels(),
566 valid_icon_bitmap.getPixels(), 564 valid_icon_bitmap.getPixels(),
567 new_icon_bitmap.getSize())); 565 new_icon_bitmap.getSize()));
568 566
569 // Make sure the browser deconstructor doesn't have problems. 567 // Make sure the browser deconstructor doesn't have problems.
570 chrome::CloseAllTabs(browser.get()); 568 chrome::CloseAllTabs(browser.get());
571 // This is required to prevent the message loop from hanging. 569 // This is required to prevent the message loop from hanging.
572 profile()->DestroyHistoryService(); 570 profile()->DestroyHistoryService();
573 } 571 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/back_forward_menu_model.cc ('k') | chrome/browser/ui/webui/extensions/extension_icon_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698