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/platform_app_browsertest_util.h" | 5 #include "chrome/browser/extensions/platform_app_browsertest_util.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "chrome/browser/extensions/api/tabs/tabs.h" | 9 #include "chrome/browser/extensions/api/tabs/tabs.h" |
10 #include "chrome/browser/extensions/extension_function_test_utils.h" | 10 #include "chrome/browser/extensions/extension_function_test_utils.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 return NULL; | 63 return NULL; |
64 } | 64 } |
65 | 65 |
66 size_t PlatformAppBrowserTest::RunGetWindowsFunctionForExtension( | 66 size_t PlatformAppBrowserTest::RunGetWindowsFunctionForExtension( |
67 const Extension* extension) { | 67 const Extension* extension) { |
68 GetAllWindowsFunction* function = new GetAllWindowsFunction(); | 68 GetAllWindowsFunction* function = new GetAllWindowsFunction(); |
69 function->set_extension(extension); | 69 function->set_extension(extension); |
70 scoped_ptr<base::ListValue> result(utils::ToList( | 70 scoped_ptr<base::ListValue> result(utils::ToList( |
71 utils::RunFunctionAndReturnResult(function, "[]", browser()))); | 71 utils::RunFunctionAndReturnSingleResult(function, "[]", browser()))); |
72 return result->GetSize(); | 72 return result->GetSize(); |
73 } | 73 } |
74 | 74 |
75 bool PlatformAppBrowserTest::RunGetWindowFunctionForExtension( | 75 bool PlatformAppBrowserTest::RunGetWindowFunctionForExtension( |
76 int window_id, | 76 int window_id, |
77 const Extension* extension) { | 77 const Extension* extension) { |
78 GetWindowFunction* function = new GetWindowFunction(); | 78 GetWindowFunction* function = new GetWindowFunction(); |
79 function->set_extension(extension); | 79 function->set_extension(extension); |
80 utils::RunFunction( | 80 utils::RunFunction( |
81 function, | 81 function, |
82 base::StringPrintf("[%u]", window_id), | 82 base::StringPrintf("[%u]", window_id), |
83 browser(), | 83 browser(), |
84 utils::NONE); | 84 utils::NONE); |
85 return function->GetResultValue() != NULL; | 85 return function->GetResultList() != NULL; |
86 } | 86 } |
87 | 87 |
88 size_t PlatformAppBrowserTest::GetShellWindowCount() { | 88 size_t PlatformAppBrowserTest::GetShellWindowCount() { |
89 return ShellWindowRegistry::Get(browser()->profile())-> | 89 return ShellWindowRegistry::Get(browser()->profile())-> |
90 shell_windows().size(); | 90 shell_windows().size(); |
91 } | 91 } |
92 | 92 |
93 void PlatformAppBrowserTest::ClearCommandLineArgs() { | 93 void PlatformAppBrowserTest::ClearCommandLineArgs() { |
94 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 94 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
95 CommandLine::StringVector args = command_line->GetArgs(); | 95 CommandLine::StringVector args = command_line->GetArgs(); |
(...skipping 18 matching lines...) Expand all Loading... |
114 browser()->profile(), extension, GURL(""), params); | 114 browser()->profile(), extension, GURL(""), params); |
115 } | 115 } |
116 | 116 |
117 void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { | 117 void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { |
118 ui_test_utils::WindowedNotificationObserver destroyed_observer( | 118 ui_test_utils::WindowedNotificationObserver destroyed_observer( |
119 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 119 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
120 content::NotificationService::AllSources()); | 120 content::NotificationService::AllSources()); |
121 window->Close(); | 121 window->Close(); |
122 destroyed_observer.Wait(); | 122 destroyed_observer.Wait(); |
123 } | 123 } |
OLD | NEW |