| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/ui/browser_command_controller.h" | 9 #include "chrome/browser/ui/browser_command_controller.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 contents2->SetIsCrashed(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); | 61 contents2->SetIsCrashed(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); |
| 62 EXPECT_TRUE(contents2->IsCrashed()); | 62 EXPECT_TRUE(contents2->IsCrashed()); |
| 63 | 63 |
| 64 // Selecting the second tab does not cause a load or clear the crash. | 64 // Selecting the second tab does not cause a load or clear the crash. |
| 65 tab_strip_model->ActivateTabAt(1, true); | 65 tab_strip_model->ActivateTabAt(1, true); |
| 66 EXPECT_TRUE(tab_strip_model->IsTabSelected(1)); | 66 EXPECT_TRUE(tab_strip_model->IsTabSelected(1)); |
| 67 EXPECT_FALSE(contents2->IsLoading()); | 67 EXPECT_FALSE(contents2->IsLoading()); |
| 68 EXPECT_TRUE(contents2->IsCrashed()); | 68 EXPECT_TRUE(contents2->IsCrashed()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 TEST_F(BrowserUnitTest, SetBackgroundColorForNewTab) { | 71 // This tests a workaround which is not necessary on Mac. |
| 72 // https://crbug.com/719230 |
| 73 #if defined(OS_MACOSX) |
| 74 #define MAYBE_SetBackgroundColorForNewTab DISABLED_SetBackgroundColorForNewTab |
| 75 #else |
| 76 #define MAYBE_SetBackgroundColorForNewTab SetBackgroundColorForNewTab |
| 77 #endif |
| 78 TEST_F(BrowserUnitTest, MAYBE_SetBackgroundColorForNewTab) { |
| 72 TabStripModel* tab_strip_model = browser()->tab_strip_model(); | 79 TabStripModel* tab_strip_model = browser()->tab_strip_model(); |
| 73 | 80 |
| 74 WebContents* contents1 = CreateTestWebContents(); | 81 WebContents* contents1 = CreateTestWebContents(); |
| 75 tab_strip_model->AppendWebContents(contents1, true); | 82 tab_strip_model->AppendWebContents(contents1, true); |
| 76 WebContentsTester::For(contents1)->NavigateAndCommit(GURL("about:blank")); | 83 WebContentsTester::For(contents1)->NavigateAndCommit(GURL("about:blank")); |
| 77 WebContentsTester::For(contents1)->TestSetIsLoading(false); | 84 WebContentsTester::For(contents1)->TestSetIsLoading(false); |
| 78 | 85 |
| 79 contents1->GetMainFrame()->GetView()->SetBackgroundColor(SK_ColorRED); | 86 contents1->GetMainFrame()->GetView()->SetBackgroundColor(SK_ColorRED); |
| 80 | 87 |
| 81 // Add a second tab in the background. | 88 // Add a second tab in the background. |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // Activate the 1st tab which is NTP. | 248 // Activate the 1st tab which is NTP. |
| 242 browser()->tab_strip_model()->ActivateTabAt(0, true); | 249 browser()->tab_strip_model()->ActivateTabAt(0, true); |
| 243 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); | 250 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); |
| 244 EXPECT_EQ(BookmarkBar::SHOW, window_bookmark_bar_state()); | 251 EXPECT_EQ(BookmarkBar::SHOW, window_bookmark_bar_state()); |
| 245 | 252 |
| 246 // Activate the 2nd tab which is non-NTP. | 253 // Activate the 2nd tab which is non-NTP. |
| 247 browser()->tab_strip_model()->ActivateTabAt(1, true); | 254 browser()->tab_strip_model()->ActivateTabAt(1, true); |
| 248 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); | 255 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); |
| 249 EXPECT_EQ(BookmarkBar::SHOW, window_bookmark_bar_state()); | 256 EXPECT_EQ(BookmarkBar::SHOW, window_bookmark_bar_state()); |
| 250 } | 257 } |
| OLD | NEW |