diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-04 15:49:46 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-04 15:49:46 +0000 |
commit | 267580c14d12d1debb93a9e6203b02530a278d02 (patch) | |
tree | bfed480b4192c9c0234fb987d6fd2d8c9cfe6e5d /chrome/browser | |
parent | 75bfc84bd5d6efecd31b6f2ed4fc7a8023d0b3b7 (diff) | |
download | chromium_src-267580c14d12d1debb93a9e6203b02530a278d02.zip chromium_src-267580c14d12d1debb93a9e6203b02530a278d02.tar.gz chromium_src-267580c14d12d1debb93a9e6203b02530a278d02.tar.bz2 |
Use strict json formating in extension_uitest.
This is in anticipation of the new, strict, JSON.parse landing in v8.
Review URL: http://codereview.chromium.org/560040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38105 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/extensions/extension_uitest.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/chrome/browser/extensions/extension_uitest.cc b/chrome/browser/extensions/extension_uitest.cc index 83eff72..8192968 100644 --- a/chrome/browser/extensions/extension_uitest.cc +++ b/chrome/browser/extensions/extension_uitest.cc @@ -293,18 +293,17 @@ class ExtensionTestBrowserEvents : public ExtensionUITest { } // Fire an event of the given name to the test extension. - void FireEvent(const char* event_name) { + void FireEvent(const char* event_message) { + // JSON doesn't allow single quotes. + std::string event_message_strict(event_message); + ReplaceSubstringsAfterOffset(&event_message_strict, 0, "\'", "\\\""); + namespace keys = extension_automation_constants; ASSERT_TRUE(tab_ != NULL); - // Build the event message to send to the extension. The only important - // part is the name, as the payload is not used by the test extension. - std::string message; - message += event_name; - tab_->HandleMessageFromExternalHost( - message, + event_message_strict, keys::kAutomationOrigin, keys::kAutomationBrowserEventRequestTarget); } @@ -335,11 +334,11 @@ const char* ExtensionTestBrowserEvents::events_[] = { "[\"windows.onFocusChanged\", \"[42]\"]", // Tab events. - "[\"tabs.onCreated\", \"[{'id\':42,'index':1,'windowId':1," + "[\"tabs.onCreated\", \"[{'id':42,'index':1,'windowId':1," "'selected':true,'url':'http://www.google.com'}]\"]", "[\"tabs.onUpdated\", \"[42, {'status': 'complete'," - "'url':'http://www.google.com'}, {'id\':42,'index':1,'windowId':1," + "'url':'http://www.google.com'}, {'id':42,'index':1,'windowId':1," "'selected':true,'url':'http://www.google.com'}]\"]", "[\"tabs.onMoved\", \"[42, {'windowId':1,'fromIndex':1,'toIndex':2}]\"]", @@ -353,7 +352,7 @@ const char* ExtensionTestBrowserEvents::events_[] = { "[\"tabs.onRemoved\", \"[43]\"]", // Bookmark events. - "[\"bookmarks.onCreated\", \"['42', {'id':'42','title':'foo',}]\"]", + "[\"bookmarks.onCreated\", \"['42', {'id':'42','title':'foo'}]\"]", "[\"bookmarks.onRemoved\", \"['42', {'parentId':'2','index':1}]\"]", |