| 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_test_message_listener.h" | 9 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 ++num_tabs; | 45 ++num_tabs; |
| 46 size_t num_browsers = static_cast<size_t>(num_popups + num_panels) + 1; | 46 size_t num_browsers = static_cast<size_t>(num_popups + num_panels) + 1; |
| 47 | 47 |
| 48 const base::TimeDelta kWaitTime = base::TimeDelta::FromSeconds(15); | 48 const base::TimeDelta kWaitTime = base::TimeDelta::FromSeconds(15); |
| 49 base::TimeTicks end_time = base::TimeTicks::Now() + kWaitTime; | 49 base::TimeTicks end_time = base::TimeTicks::Now() + kWaitTime; |
| 50 while (base::TimeTicks::Now() < end_time) { | 50 while (base::TimeTicks::Now() < end_time) { |
| 51 if (browser::GetBrowserCount(browser->profile()) == num_browsers && | 51 if (browser::GetBrowserCount(browser->profile()) == num_browsers && |
| 52 browser->tab_count() == num_tabs) | 52 browser->tab_count() == num_tabs) |
| 53 break; | 53 break; |
| 54 | 54 |
| 55 ui_test_utils::RunAllPendingInMessageLoop(); | 55 content::RunAllPendingInMessageLoop(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 EXPECT_EQ(num_browsers, browser::GetBrowserCount(browser->profile())); | 58 EXPECT_EQ(num_browsers, browser::GetBrowserCount(browser->profile())); |
| 59 EXPECT_EQ(num_tabs, browser->tab_count()); | 59 EXPECT_EQ(num_tabs, browser->tab_count()); |
| 60 | 60 |
| 61 int num_popups_seen = 0; | 61 int num_popups_seen = 0; |
| 62 int num_panels_seen = 0; | 62 int num_panels_seen = 0; |
| 63 for (BrowserList::const_iterator iter = BrowserList::begin(); | 63 for (BrowserList::const_iterator iter = BrowserList::begin(); |
| 64 iter != BrowserList::end(); ++iter) { | 64 iter != BrowserList::end(); ++iter) { |
| 65 if (*iter == browser) | 65 if (*iter == browser) |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 ASSERT_NO_FATAL_FAILURE(OpenWindow(chrome::GetActiveWebContents(browser()), | 317 ASSERT_NO_FATAL_FAILURE(OpenWindow(chrome::GetActiveWebContents(browser()), |
| 318 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + | 318 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + |
| 319 "/newtab.html"), false, &newtab)); | 319 "/newtab.html"), false, &newtab)); |
| 320 | 320 |
| 321 // Extension API should succeed. | 321 // Extension API should succeed. |
| 322 bool result = false; | 322 bool result = false; |
| 323 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( | 323 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
| 324 newtab->GetRenderViewHost(), L"", L"testExtensionApi()", &result)); | 324 newtab->GetRenderViewHost(), L"", L"testExtensionApi()", &result)); |
| 325 EXPECT_TRUE(result); | 325 EXPECT_TRUE(result); |
| 326 } | 326 } |
| OLD | NEW |