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/values.h" | 5 #include "base/values.h" |
6 #include "chrome/browser/extensions/api/tabs/tabs_api.h" | 6 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/extensions/extension_function_test_utils.h" | 9 #include "chrome/browser/extensions/extension_function_test_utils.h" |
10 #include "chrome/browser/extensions/extension_tab_util.h" | 10 #include "chrome/browser/extensions/extension_tab_util.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // See BrowserWindowCocoa::Show. In tests, Browser::window()->IsActive won't | 76 // See BrowserWindowCocoa::Show. In tests, Browser::window()->IsActive won't |
77 // work unless we fake the browser being launched by the user. | 77 // work unless we fake the browser being launched by the user. |
78 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow( | 78 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow( |
79 focused_window->window()->GetNativeWindow())); | 79 focused_window->window()->GetNativeWindow())); |
80 #endif | 80 #endif |
81 | 81 |
82 // Needed on Mac and Linux so that the BrowserWindow::IsActive calls work. | 82 // Needed on Mac and Linux so that the BrowserWindow::IsActive calls work. |
83 content::RunAllPendingInMessageLoop(); | 83 content::RunAllPendingInMessageLoop(); |
84 | 84 |
85 GURL url; | 85 GURL url; |
86 AddTabAtIndexToBrowser(focused_window, 0, url, content::PAGE_TRANSITION_LINK); | 86 AddTabAtIndexToBrowser(focused_window, 0, url, ui::PAGE_TRANSITION_LINK); |
87 int focused_window_id = | 87 int focused_window_id = |
88 extensions::ExtensionTabUtil::GetWindowId(focused_window); | 88 extensions::ExtensionTabUtil::GetWindowId(focused_window); |
89 | 89 |
90 // Get tabs in the 'last focused' window called from non-focused browser. | 90 // Get tabs in the 'last focused' window called from non-focused browser. |
91 scoped_refptr<extensions::TabsQueryFunction> function = | 91 scoped_refptr<extensions::TabsQueryFunction> function = |
92 new extensions::TabsQueryFunction(); | 92 new extensions::TabsQueryFunction(); |
93 scoped_ptr<base::ListValue> result(utils::ToList( | 93 scoped_ptr<base::ListValue> result(utils::ToList( |
94 utils::RunFunctionAndReturnSingleResult(function.get(), | 94 utils::RunFunctionAndReturnSingleResult(function.get(), |
95 "[{\"lastFocusedWindow\":true}]", | 95 "[{\"lastFocusedWindow\":true}]", |
96 browser()))); | 96 browser()))); |
(...skipping 27 matching lines...) Expand all Loading... |
124 } | 124 } |
125 | 125 |
126 #if defined(OS_WIN) // http://crbug.com/154081 && http://crbug.com/171080 | 126 #if defined(OS_WIN) // http://crbug.com/154081 && http://crbug.com/171080 |
127 #define MAYBE_TabCurrentWindow DISABLED_TabCurrentWindow | 127 #define MAYBE_TabCurrentWindow DISABLED_TabCurrentWindow |
128 #else | 128 #else |
129 #define MAYBE_TabCurrentWindow TabCurrentWindow | 129 #define MAYBE_TabCurrentWindow TabCurrentWindow |
130 #endif | 130 #endif |
131 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_TabCurrentWindow) { | 131 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_TabCurrentWindow) { |
132 ASSERT_TRUE(RunExtensionTest("tabs/current_window")) << message_; | 132 ASSERT_TRUE(RunExtensionTest("tabs/current_window")) << message_; |
133 } | 133 } |
OLD | NEW |