| OLD | NEW |
| 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/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 EXPECT_EQ(ASCIIToUTF16("A && B"), back_model->GetLabelAt(2)); | 495 EXPECT_EQ(ASCIIToUTF16("A && B"), back_model->GetLabelAt(2)); |
| 496 EXPECT_EQ(ASCIIToUTF16("A &&&& B"), back_model->GetLabelAt(1)); | 496 EXPECT_EQ(ASCIIToUTF16("A &&&& B"), back_model->GetLabelAt(1)); |
| 497 EXPECT_EQ(ASCIIToUTF16("A &&&&&& B"), back_model->GetLabelAt(0)); | 497 EXPECT_EQ(ASCIIToUTF16("A &&&&&& B"), back_model->GetLabelAt(0)); |
| 498 #endif // defined(OS_MACOSX) | 498 #endif // defined(OS_MACOSX) |
| 499 } | 499 } |
| 500 | 500 |
| 501 // Test asynchronous loading of favicon from history service. | 501 // Test asynchronous loading of favicon from history service. |
| 502 TEST_F(BackFwdMenuModelTest, FaviconLoadTest) { | 502 TEST_F(BackFwdMenuModelTest, FaviconLoadTest) { |
| 503 ASSERT_TRUE(profile()->CreateHistoryService(true, false)); | 503 ASSERT_TRUE(profile()->CreateHistoryService(true, false)); |
| 504 profile()->CreateFaviconService(); | 504 profile()->CreateFaviconService(); |
| 505 Browser::CreateParams native_params(profile()); | 505 Browser::CreateParams native_params(profile(), true); |
| 506 std::unique_ptr<Browser> browser( | 506 std::unique_ptr<Browser> browser( |
| 507 chrome::CreateBrowserWithTestWindowForParams(&native_params)); | 507 chrome::CreateBrowserWithTestWindowForParams(&native_params)); |
| 508 FaviconDelegate favicon_delegate; | 508 FaviconDelegate favicon_delegate; |
| 509 | 509 |
| 510 BackForwardMenuModel back_model( | 510 BackForwardMenuModel back_model( |
| 511 browser.get(), BackForwardMenuModel::BACKWARD_MENU); | 511 browser.get(), BackForwardMenuModel::BACKWARD_MENU); |
| 512 back_model.set_test_web_contents(controller().GetWebContents()); | 512 back_model.set_test_web_contents(controller().GetWebContents()); |
| 513 back_model.SetMenuModelDelegate(&favicon_delegate); | 513 back_model.SetMenuModelDelegate(&favicon_delegate); |
| 514 | 514 |
| 515 SkBitmap new_icon_bitmap(CreateBitmap(SK_ColorRED)); | 515 SkBitmap new_icon_bitmap(CreateBitmap(SK_ColorRED)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 valid_icon_bitmap.getPixels(), | 559 valid_icon_bitmap.getPixels(), |
| 560 default_icon_bitmap.getSize())); | 560 default_icon_bitmap.getSize())); |
| 561 // Verify we did get the expected favicon. | 561 // Verify we did get the expected favicon. |
| 562 EXPECT_EQ(0, memcmp(new_icon_bitmap.getPixels(), | 562 EXPECT_EQ(0, memcmp(new_icon_bitmap.getPixels(), |
| 563 valid_icon_bitmap.getPixels(), | 563 valid_icon_bitmap.getPixels(), |
| 564 new_icon_bitmap.getSize())); | 564 new_icon_bitmap.getSize())); |
| 565 | 565 |
| 566 // Make sure the browser deconstructor doesn't have problems. | 566 // Make sure the browser deconstructor doesn't have problems. |
| 567 browser->tab_strip_model()->CloseAllTabs(); | 567 browser->tab_strip_model()->CloseAllTabs(); |
| 568 } | 568 } |
| OLD | NEW |