diff options
-rw-r--r-- | chrome/browser/automation/testing_automation_provider.cc | 16 | ||||
-rw-r--r-- | chrome/test/pyautolib/pyauto.py | 11 |
2 files changed, 20 insertions, 7 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 18c57e4..a0f7269b 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -11,6 +11,7 @@ #include "base/json/string_escape.h" #include "base/path_service.h" #include "base/stringprintf.h" +#include "base/thread_restrictions.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" @@ -43,6 +44,11 @@ #include "chrome/browser/location_bar.h" #include "chrome/browser/login_prompt.h" #include "chrome/browser/native_app_modal_dialog.h" +#include "chrome/browser/notifications/balloon.h" +#include "chrome/browser/notifications/balloon_collection.h" +#include "chrome/browser/notifications/balloon_host.h" +#include "chrome/browser/notifications/notification.h" +#include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/browser/profile.h" #include "chrome/browser/platform_util.h" #include "chrome/browser/prefs/pref_service.h" @@ -62,10 +68,6 @@ #include "chrome/common/net/url_request_context_getter.h" #include "chrome/common/notification_service.h" #include "chrome/common/url_constants.h" -#include "chrome/browser/notifications/balloon.h" -#include "chrome/browser/notifications/balloon_collection.h" -#include "chrome/browser/notifications/notification.h" -#include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/common/automation_messages.h" #include "net/base/cookie_store.h" #include "net/url_request/url_request_context.h" @@ -2337,6 +2339,7 @@ void TestingAutomationProvider::GetBrowserInfo( Browser* browser, DictionaryValue* args, IPC::Message* reply_message) { + base::ThreadRestrictions::ScopedAllowIO allow_io; // needed for PathService DictionaryValue* properties = new DictionaryValue; properties->SetString("ChromeVersion", chrome::kChromeVersion); properties->SetString("BrowserProcessExecutableName", @@ -4247,6 +4250,11 @@ void TestingAutomationProvider::GetActiveNotifications( balloon->SetString("content_url", notification.content_url().spec()); balloon->SetString("origin_url", notification.origin_url().spec()); balloon->SetString("display_source", notification.display_source()); + BalloonView* view = (*iter)->view(); + if (view && view->GetHost() && view->GetHost()->render_view_host()) { + balloon->SetInteger("pid", base::GetProcId( + view->GetHost()->render_view_host()->process()->GetHandle())); + } list->Append(balloon); } AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py index 8545f65..39d03a3 100644 --- a/chrome/test/pyautolib/pyauto.py +++ b/chrome/test/pyautolib/pyauto.py @@ -808,6 +808,8 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): executable path, pid info about the renderer/plugin/extension processes, window dimensions. (See sample below) + For notification pid info, see 'GetActiveNotifications'. + Returns: a dictionary @@ -1540,15 +1542,18 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): a list containing info about each active notification, with the first item in the list being the notification on the bottom of the notification stack. The 'content_url' key can refer to a URL or a data - URI. + URI. The 'pid' key-value pair may be omitted or invalid if the + notification is closing. SAMPLE: [ { u'content_url': u'data:text/html;charset=utf-8,%3C!DOCTYPE%l%3E%0Atm...' u'display_source': 'www.corp.google.com', - u'origin_url': 'http://www.corp.google.com/'}, + u'origin_url': 'http://www.corp.google.com/', + u'pid': 8505}, { u'content_url': 'http://www.gmail.com/special_notification.html', u'display_source': 'www.gmail.com', - u'origin_url': 'http://www.gmail.com/'}] + u'origin_url': 'http://www.gmail.com/', + u'pid': 9291}] Raises: pyauto_errors.JSONInterfaceError if the automation call returns an error. |