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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #else | 56 #else |
57 return PanelManager::GetInstance()->num_panels(); | 57 return PanelManager::GetInstance()->num_panels(); |
58 #endif | 58 #endif |
59 } | 59 } |
60 | 60 |
61 bool WaitForTabsAndPopups(Browser* browser, | 61 bool WaitForTabsAndPopups(Browser* browser, |
62 int num_tabs, | 62 int num_tabs, |
63 int num_popups, | 63 int num_popups, |
64 int num_panels) { | 64 int num_panels) { |
65 SCOPED_TRACE( | 65 SCOPED_TRACE( |
66 StringPrintf("WaitForTabsAndPopups tabs:%d, popups:%d, panels:%d", | 66 base::StringPrintf("WaitForTabsAndPopups tabs:%d, popups:%d, panels:%d", |
67 num_tabs, num_popups, num_panels)); | 67 num_tabs, num_popups, num_panels)); |
68 // We start with one tab and one browser already open. | 68 // We start with one tab and one browser already open. |
69 ++num_tabs; | 69 ++num_tabs; |
70 size_t num_browsers = static_cast<size_t>(num_popups) + 1; | 70 size_t num_browsers = static_cast<size_t>(num_popups) + 1; |
71 | 71 |
72 const base::TimeDelta kWaitTime = base::TimeDelta::FromSeconds(10); | 72 const base::TimeDelta kWaitTime = base::TimeDelta::FromSeconds(10); |
73 base::TimeTicks end_time = base::TimeTicks::Now() + kWaitTime; | 73 base::TimeTicks end_time = base::TimeTicks::Now() + kWaitTime; |
74 while (base::TimeTicks::Now() < end_time) { | 74 while (base::TimeTicks::Now() < end_time) { |
75 if (chrome::GetBrowserCount(browser->profile(), | 75 if (chrome::GetBrowserCount(browser->profile(), |
76 browser->host_desktop_type()) == num_browsers && | 76 browser->host_desktop_type()) == num_browsers && |
77 browser->tab_strip_model()->count() == num_tabs && | 77 browser->tab_strip_model()->count() == num_tabs && |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(), | 453 OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(), |
454 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + | 454 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + |
455 "/newtab.html"), false, &newtab)); | 455 "/newtab.html"), false, &newtab)); |
456 | 456 |
457 // Extension API should succeed. | 457 // Extension API should succeed. |
458 bool result = false; | 458 bool result = false; |
459 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", | 459 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", |
460 &result)); | 460 &result)); |
461 EXPECT_TRUE(result); | 461 EXPECT_TRUE(result); |
462 } | 462 } |
OLD | NEW |