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

Side by Side Diff: chrome/browser/extensions/api/streams_private/streams_resource_throttle_browsertest.cc

Issue 12645004: Add Resource Handler for creating Streams to forward to extensions (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Disable Stream Resource Throttle Created 7 years, 9 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/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "chrome/browser/download/download_prefs.h" 7 #include "chrome/browser/download/download_prefs.h"
8 #include "chrome/browser/extensions/api/streams_private/streams_resource_throttl e.h" 8 #include "chrome/browser/extensions/api/streams_private/streams_resource_throttl e.h"
9 #include "chrome/browser/extensions/event_router.h" 9 #include "chrome/browser/extensions/event_router.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 // Sends onExecuteContentHandler event with the MIME type "test/done" to the 172 // Sends onExecuteContentHandler event with the MIME type "test/done" to the
173 // test extension. 173 // test extension.
174 // The test extension calls 'chrome.test.notifySuccess' when it receives the 174 // The test extension calls 'chrome.test.notifySuccess' when it receives the
175 // event with the "test/done" MIME type (unless the 'chrome.test.notifyFail' 175 // event with the "test/done" MIME type (unless the 'chrome.test.notifyFail'
176 // has already been called). 176 // has already been called).
177 void SendDoneEvent() { 177 void SendDoneEvent() {
178 scoped_ptr<ListValue> event_args(new ListValue()); 178 scoped_ptr<ListValue> event_args(new ListValue());
179 event_args->Append(new base::StringValue("test/done")); 179 event_args->Append(new base::StringValue("test/done"));
180 event_args->Append(new base::StringValue("http://foo")); 180 event_args->Append(new base::StringValue("http://foo"));
181 event_args->Append(new base::StringValue("blob://bar"));
181 182
182 scoped_ptr<Event> event(new Event( 183 scoped_ptr<Event> event(new Event(
183 "streamsPrivate.onExecuteMimeTypeHandler", event_args.Pass())); 184 "streamsPrivate.onExecuteMimeTypeHandler", event_args.Pass()));
184 185
185 ExtensionSystem::Get(browser()->profile())->event_router()-> 186 ExtensionSystem::Get(browser()->profile())->event_router()->
186 DispatchEventToExtension(test_extension_id_, event.Pass()); 187 DispatchEventToExtension(test_extension_id_, event.Pass());
187 } 188 }
188 189
189 // Loads the test extension and set's up its file_browser_handler to handle 190 // Loads the test extension and set's up its file_browser_handler to handle
190 // 'application/msword' and 'plain/text' MIME types. 191 // 'application/msword' and 'plain/text' MIME types.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // The test extension should not receive any events by now. Send it an event 391 // The test extension should not receive any events by now. Send it an event
391 // with MIME type "test/done", so it stops waiting for the events. (If there 392 // with MIME type "test/done", so it stops waiting for the events. (If there
392 // was an event with MIME type 'plain/text', |catcher.GetNextResult()| will 393 // was an event with MIME type 'plain/text', |catcher.GetNextResult()| will
393 // fail regardless of the sent event; chrome.test.notifySuccess will not be 394 // fail regardless of the sent event; chrome.test.notifySuccess will not be
394 // called by the extension). 395 // called by the extension).
395 SendDoneEvent(); 396 SendDoneEvent();
396 EXPECT_TRUE(catcher.GetNextResult()); 397 EXPECT_TRUE(catcher.GetNextResult());
397 } 398 }
398 399
399 } // namespace 400 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698