| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser_actions_bar_browsertest.h" | 5 #include "chrome/browser/ui/toolbar/browser_actions_bar_browsertest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 // Tests that first loading an extension action in an incognito profile, then | 650 // Tests that first loading an extension action in an incognito profile, then |
| 651 // removing the incognito profile and using the extension action in a normal | 651 // removing the incognito profile and using the extension action in a normal |
| 652 // profile doesn't crash. | 652 // profile doesn't crash. |
| 653 // Regression test for crbug.com/663726. | 653 // Regression test for crbug.com/663726. |
| 654 IN_PROC_BROWSER_TEST_F(BrowserActionsBarIncognitoTest, IncognitoMode) { | 654 IN_PROC_BROWSER_TEST_F(BrowserActionsBarIncognitoTest, IncognitoMode) { |
| 655 EXPECT_TRUE(browser()->profile()->IsOffTheRecord()); | 655 EXPECT_TRUE(browser()->profile()->IsOffTheRecord()); |
| 656 const extensions::Extension* extension = LoadExtensionIncognito( | 656 const extensions::Extension* extension = LoadExtensionIncognito( |
| 657 test_data_dir_.AppendASCII("api_test/browser_action_with_icon")); | 657 test_data_dir_.AppendASCII("api_test/browser_action_with_icon")); |
| 658 ASSERT_TRUE(extension); | 658 ASSERT_TRUE(extension); |
| 659 Browser* second_browser = | 659 Browser* second_browser = |
| 660 new Browser(Browser::CreateParams(profile()->GetOriginalProfile())); | 660 new Browser(Browser::CreateParams(profile()->GetOriginalProfile(), true)); |
| 661 base::RunLoop().RunUntilIdle(); | 661 base::RunLoop().RunUntilIdle(); |
| 662 EXPECT_FALSE(second_browser->profile()->IsOffTheRecord()); | 662 EXPECT_FALSE(second_browser->profile()->IsOffTheRecord()); |
| 663 | 663 |
| 664 content::WindowedNotificationObserver window_close_observer( | 664 content::WindowedNotificationObserver window_close_observer( |
| 665 chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(browser())); | 665 chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(browser())); |
| 666 browser()->window()->Close(); | 666 browser()->window()->Close(); |
| 667 window_close_observer.Wait(); | 667 window_close_observer.Wait(); |
| 668 | 668 |
| 669 std::vector<ToolbarActionViewController*> actions = | 669 std::vector<ToolbarActionViewController*> actions = |
| 670 second_browser->window()->GetToolbarActionsBar()->GetActions(); | 670 second_browser->window()->GetToolbarActionsBar()->GetActions(); |
| 671 ASSERT_EQ(1u, actions.size()); | 671 ASSERT_EQ(1u, actions.size()); |
| 672 gfx::Image icon = actions[0]->GetIcon( | 672 gfx::Image icon = actions[0]->GetIcon( |
| 673 second_browser->tab_strip_model()->GetActiveWebContents(), | 673 second_browser->tab_strip_model()->GetActiveWebContents(), |
| 674 gfx::Size(ToolbarActionsBar::IconWidth(false), | 674 gfx::Size(ToolbarActionsBar::IconWidth(false), |
| 675 ToolbarActionsBar::IconHeight())); | 675 ToolbarActionsBar::IconHeight())); |
| 676 const gfx::ImageSkia* skia = icon.ToImageSkia(); | 676 const gfx::ImageSkia* skia = icon.ToImageSkia(); |
| 677 ASSERT_TRUE(skia); | 677 ASSERT_TRUE(skia); |
| 678 // Force the image to try and load a representation. | 678 // Force the image to try and load a representation. |
| 679 skia->GetRepresentation(2.0); | 679 skia->GetRepresentation(2.0); |
| 680 } | 680 } |
| OLD | NEW |