Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_interactive_test.cc

Issue 569493003: Remove CreateEmptyExtension from extension_function_test_utils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_window.h" 12 #include "chrome/browser/ui/browser_window.h"
13 #include "chrome/test/base/in_process_browser_test.h" 13 #include "chrome/test/base/in_process_browser_test.h"
14 #include "chrome/test/base/interactive_test_utils.h" 14 #include "chrome/test/base/interactive_test_utils.h"
15 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
16 #include "extensions/common/test_util.h"
16 17
17 namespace keys = extensions::tabs_constants; 18 namespace keys = extensions::tabs_constants;
18 namespace utils = extension_function_test_utils; 19 namespace utils = extension_function_test_utils;
19 20
20 typedef InProcessBrowserTest ExtensionTabsTest; 21 typedef InProcessBrowserTest ExtensionTabsTest;
21 22
22 // http://crbug.com/154081 for Aura specific 23 // http://crbug.com/154081 for Aura specific
23 // http://crbug.com/179063 for other general failures on try bots. 24 // http://crbug.com/179063 for other general failures on try bots.
24 #if defined(OS_WIN) 25 #if defined(OS_WIN)
25 #define MAYBE_GetLastFocusedWindow DISABLED_GetLastFocusedWindow 26 #define MAYBE_GetLastFocusedWindow DISABLED_GetLastFocusedWindow
26 #else 27 #else
27 #define MAYBE_GetLastFocusedWindow GetLastFocusedWindow 28 #define MAYBE_GetLastFocusedWindow GetLastFocusedWindow
28 #endif 29 #endif
29 30
30 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, MAYBE_GetLastFocusedWindow) { 31 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, MAYBE_GetLastFocusedWindow) {
31 // Create a new window which making it the "last focused" window. 32 // Create a new window which making it the "last focused" window.
32 // Note that "last focused" means the "top" most window. 33 // Note that "last focused" means the "top" most window.
33 Browser* new_browser = CreateBrowser(browser()->profile()); 34 Browser* new_browser = CreateBrowser(browser()->profile());
34 int focused_window_id = 35 int focused_window_id =
35 extensions::ExtensionTabUtil::GetWindowId(new_browser); 36 extensions::ExtensionTabUtil::GetWindowId(new_browser);
36 37
37 scoped_refptr<extensions::WindowsGetLastFocusedFunction> function = 38 scoped_refptr<extensions::WindowsGetLastFocusedFunction> function =
38 new extensions::WindowsGetLastFocusedFunction(); 39 new extensions::WindowsGetLastFocusedFunction();
39 scoped_refptr<extensions::Extension> extension(utils::CreateEmptyExtension()); 40 scoped_refptr<extensions::Extension> extension(
41 extensions::test_util::CreateEmptyExtension());
40 function->set_extension(extension.get()); 42 function->set_extension(extension.get());
41 scoped_ptr<base::DictionaryValue> result(utils::ToDictionary( 43 scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
42 utils::RunFunctionAndReturnSingleResult(function.get(), 44 utils::RunFunctionAndReturnSingleResult(function.get(),
43 "[]", 45 "[]",
44 new_browser))); 46 new_browser)));
45 47
46 // The id should always match the last focused window and does not depend 48 // The id should always match the last focused window and does not depend
47 // on what was passed to RunFunctionAndReturnSingleResult. 49 // on what was passed to RunFunctionAndReturnSingleResult.
48 EXPECT_EQ(focused_window_id, utils::GetInteger(result.get(), "id")); 50 EXPECT_EQ(focused_window_id, utils::GetInteger(result.get(), "id"));
49 base::ListValue* tabs = NULL; 51 base::ListValue* tabs = NULL;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 124 }
123 125
124 #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
125 #define MAYBE_TabCurrentWindow DISABLED_TabCurrentWindow 127 #define MAYBE_TabCurrentWindow DISABLED_TabCurrentWindow
126 #else 128 #else
127 #define MAYBE_TabCurrentWindow TabCurrentWindow 129 #define MAYBE_TabCurrentWindow TabCurrentWindow
128 #endif 130 #endif
129 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_TabCurrentWindow) { 131 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_TabCurrentWindow) {
130 ASSERT_TRUE(RunExtensionTest("tabs/current_window")) << message_; 132 ASSERT_TRUE(RunExtensionTest("tabs/current_window")) << message_;
131 } 133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698