| 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 "chrome/browser/extensions/api/tabs/tabs.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 437 |
| 438 Browser* focused_window = CreateBrowser(browser()->profile()); | 438 Browser* focused_window = CreateBrowser(browser()->profile()); |
| 439 #if defined(OS_MACOSX) | 439 #if defined(OS_MACOSX) |
| 440 // See BrowserWindowCocoa::Show. In tests, Browser::window()->IsActive won't | 440 // See BrowserWindowCocoa::Show. In tests, Browser::window()->IsActive won't |
| 441 // work unless we fake the browser being launched by the user. | 441 // work unless we fake the browser being launched by the user. |
| 442 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow( | 442 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow( |
| 443 focused_window->window()->GetNativeWindow())); | 443 focused_window->window()->GetNativeWindow())); |
| 444 #endif | 444 #endif |
| 445 | 445 |
| 446 // Needed on Mac and Linux so that the BrowserWindow::IsActive calls work. | 446 // Needed on Mac and Linux so that the BrowserWindow::IsActive calls work. |
| 447 ui_test_utils::RunAllPendingInMessageLoop(); | 447 content::RunAllPendingInMessageLoop(); |
| 448 | 448 |
| 449 GURL url; | 449 GURL url; |
| 450 AddTabAtIndexToBrowser(focused_window, 0, url, content::PAGE_TRANSITION_LINK); | 450 AddTabAtIndexToBrowser(focused_window, 0, url, content::PAGE_TRANSITION_LINK); |
| 451 int focused_window_id = ExtensionTabUtil::GetWindowId(focused_window); | 451 int focused_window_id = ExtensionTabUtil::GetWindowId(focused_window); |
| 452 | 452 |
| 453 // Get tabs in the 'last focused' window called from non-focused browser. | 453 // Get tabs in the 'last focused' window called from non-focused browser. |
| 454 scoped_ptr<base::ListValue> result(utils::ToList( | 454 scoped_ptr<base::ListValue> result(utils::ToList( |
| 455 utils::RunFunctionAndReturnSingleResult( | 455 utils::RunFunctionAndReturnSingleResult( |
| 456 new QueryTabsFunction(), | 456 new QueryTabsFunction(), |
| 457 "[{\"lastFocusedWindow\":true}]", | 457 "[{\"lastFocusedWindow\":true}]", |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 | 542 |
| 543 static const char kArgsMaximizedWithBounds[] = | 543 static const char kArgsMaximizedWithBounds[] = |
| 544 "[%u, {\"state\": \"maximized\", \"width\": 500}]"; | 544 "[%u, {\"state\": \"maximized\", \"width\": 500}]"; |
| 545 EXPECT_TRUE(MatchPattern( | 545 EXPECT_TRUE(MatchPattern( |
| 546 utils::RunFunctionAndReturnError( | 546 utils::RunFunctionAndReturnError( |
| 547 new UpdateWindowFunction(), | 547 new UpdateWindowFunction(), |
| 548 base::StringPrintf(kArgsMaximizedWithBounds, window_id), | 548 base::StringPrintf(kArgsMaximizedWithBounds, window_id), |
| 549 browser()), | 549 browser()), |
| 550 keys::kInvalidWindowStateError)); | 550 keys::kInvalidWindowStateError)); |
| 551 } | 551 } |
| OLD | NEW |