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/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 #else | 490 #else |
491 EXPECT_EQ(ASCIIToUTF16("A B"), back_model->GetLabelAt(3)); | 491 EXPECT_EQ(ASCIIToUTF16("A B"), back_model->GetLabelAt(3)); |
492 EXPECT_EQ(ASCIIToUTF16("A && B"), back_model->GetLabelAt(2)); | 492 EXPECT_EQ(ASCIIToUTF16("A && B"), back_model->GetLabelAt(2)); |
493 EXPECT_EQ(ASCIIToUTF16("A &&&& B"), back_model->GetLabelAt(1)); | 493 EXPECT_EQ(ASCIIToUTF16("A &&&& B"), back_model->GetLabelAt(1)); |
494 EXPECT_EQ(ASCIIToUTF16("A &&&&&& B"), back_model->GetLabelAt(0)); | 494 EXPECT_EQ(ASCIIToUTF16("A &&&&&& B"), back_model->GetLabelAt(0)); |
495 #endif // defined(OS_MACOSX) | 495 #endif // defined(OS_MACOSX) |
496 } | 496 } |
497 | 497 |
498 // Test asynchronous loading of favicon from history service. | 498 // Test asynchronous loading of favicon from history service. |
499 TEST_F(BackFwdMenuModelTest, FaviconLoadTest) { | 499 TEST_F(BackFwdMenuModelTest, FaviconLoadTest) { |
500 profile()->CreateHistoryService(true, false); | 500 ASSERT_TRUE(profile()->CreateHistoryService(true, false)); |
501 profile()->CreateFaviconService(); | 501 profile()->CreateFaviconService(); |
502 Browser::CreateParams native_params(profile(), chrome::GetActiveDesktop()); | 502 Browser::CreateParams native_params(profile(), chrome::GetActiveDesktop()); |
503 scoped_ptr<Browser> browser( | 503 scoped_ptr<Browser> browser( |
504 chrome::CreateBrowserWithTestWindowForParams(&native_params)); | 504 chrome::CreateBrowserWithTestWindowForParams(&native_params)); |
505 FaviconDelegate favicon_delegate; | 505 FaviconDelegate favicon_delegate; |
506 | 506 |
507 BackForwardMenuModel back_model( | 507 BackForwardMenuModel back_model( |
508 browser.get(), BackForwardMenuModel::BACKWARD_MENU); | 508 browser.get(), BackForwardMenuModel::BACKWARD_MENU); |
509 back_model.set_test_web_contents(controller().GetWebContents()); | 509 back_model.set_test_web_contents(controller().GetWebContents()); |
510 back_model.SetMenuModelDelegate(&favicon_delegate); | 510 back_model.SetMenuModelDelegate(&favicon_delegate); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 // Verify we did get the expected favicon. | 558 // Verify we did get the expected favicon. |
559 EXPECT_EQ(0, memcmp(new_icon_bitmap.getPixels(), | 559 EXPECT_EQ(0, memcmp(new_icon_bitmap.getPixels(), |
560 valid_icon_bitmap.getPixels(), | 560 valid_icon_bitmap.getPixels(), |
561 new_icon_bitmap.getSize())); | 561 new_icon_bitmap.getSize())); |
562 | 562 |
563 // Make sure the browser deconstructor doesn't have problems. | 563 // Make sure the browser deconstructor doesn't have problems. |
564 browser->tab_strip_model()->CloseAllTabs(); | 564 browser->tab_strip_model()->CloseAllTabs(); |
565 // This is required to prevent the message loop from hanging. | 565 // This is required to prevent the message loop from hanging. |
566 profile()->DestroyHistoryService(); | 566 profile()->DestroyHistoryService(); |
567 } | 567 } |
OLD | NEW |