| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
| 9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
| 10 #endif | 10 #endif |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // Ensure that the tab and window are active. | 91 // Ensure that the tab and window are active. |
| 92 CheckActiveWindow(browser_proxy.get()); | 92 CheckActiveWindow(browser_proxy.get()); |
| 93 EXPECT_EQ(expected_tabstrip_index, | 93 EXPECT_EQ(expected_tabstrip_index, |
| 94 GetActiveTabIndex(expected_window_index)); | 94 GetActiveTabIndex(expected_window_index)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 // Adds tabs to the given browser, all navigated to url1_. Returns | 97 // Adds tabs to the given browser, all navigated to url1_. Returns |
| 98 // the final number of tabs. | 98 // the final number of tabs. |
| 99 int AddSomeTabs(BrowserProxy* browser, int how_many) { | 99 int AddSomeTabs(BrowserProxy* browser, int how_many) { |
| 100 int starting_tab_count = -1; | 100 int starting_tab_count = -1; |
| 101 // Use EXPECT instead of ASSERT throughout to avoid trying to return void. | |
| 102 EXPECT_TRUE(browser->GetTabCount(&starting_tab_count)); | 101 EXPECT_TRUE(browser->GetTabCount(&starting_tab_count)); |
| 103 | 102 |
| 104 for (int i = 0; i < how_many; ++i) { | 103 for (int i = 0; i < how_many; ++i) { |
| 105 EXPECT_TRUE(browser->AppendTab(url1_)); | 104 EXPECT_TRUE(browser->AppendTab(url1_)); |
| 106 int current_tab_count; | |
| 107 EXPECT_TRUE(browser->GetTabCount(¤t_tab_count)); | |
| 108 EXPECT_EQ(starting_tab_count + i + 1, current_tab_count); | |
| 109 } | 105 } |
| 110 int tab_count; | 106 int tab_count; |
| 111 EXPECT_TRUE(browser->GetTabCount(&tab_count)); | 107 EXPECT_TRUE(browser->GetTabCount(&tab_count)); |
| 112 EXPECT_EQ(starting_tab_count + how_many, tab_count); | 108 EXPECT_EQ(starting_tab_count + how_many, tab_count); |
| 113 return tab_count; | 109 return tab_count; |
| 114 } | 110 } |
| 115 | 111 |
| 116 // Ensure that the given browser occupies the currently active window. | 112 // Ensure that the given browser occupies the currently active window. |
| 117 void CheckActiveWindow(const BrowserProxy* browser) { | 113 void CheckActiveWindow(const BrowserProxy* browser) { |
| 118 // This entire check is disabled because even the IsActive() call | 114 // This entire check is disabled because even the IsActive() call |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 GURL url; | 602 GURL url; |
| 607 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); | 603 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); |
| 608 EXPECT_TRUE(url == url1_); | 604 EXPECT_TRUE(url == url1_); |
| 609 | 605 |
| 610 restored_tab_proxy = browser_proxy->GetTab(initial_tab_count + 1); | 606 restored_tab_proxy = browser_proxy->GetTab(initial_tab_count + 1); |
| 611 ASSERT_TRUE(restored_tab_proxy.get()); | 607 ASSERT_TRUE(restored_tab_proxy.get()); |
| 612 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); | 608 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); |
| 613 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); | 609 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); |
| 614 EXPECT_TRUE(url == url2_); | 610 EXPECT_TRUE(url == url2_); |
| 615 } | 611 } |
| OLD | NEW |