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

Unified Diff: content/test/data/media/webui/integration_test.html

Issue 68173025: Introduce new interface for MediaInternals updates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix JavaScript test. Use non-exported base. Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/resources/media/media_internals.html ('k') | media/audio/audio_logging.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/media/webui/integration_test.html
diff --git a/content/test/data/media/webui/integration_test.html b/content/test/data/media/webui/integration_test.html
index be567a0f1cc4411a6bcb588a4e63981dd667d238..63aee2431a4cc3f99e32f88ce86d5aa81e80561a 100644
--- a/content/test/data/media/webui/integration_test.html
+++ b/content/test/data/media/webui/integration_test.html
@@ -15,15 +15,14 @@ found in the LICENSE file.
playerUpdated: doNothing,
playerRemoved: doNothing,
playerAdded: doNothing,
- audioStreamUpdated: doNothing,
- audioStreamAdded: doNothing,
- audioStreamRemoved: doNothing
+ audioComponentAdded: doNothing,
+ audioComponentRemoved: doNothing
};
var manager = new Manager(mockClientRenderer);
media.initialize(manager);
- window.manager= manager;
+ window.manager = manager;
};
// The renderer and player ids are completely arbitrarily.
@@ -59,19 +58,40 @@ found in the LICENSE file.
assertEquals(undefined, window.manager.players_[TEST_NAME]);
};
- // Audio Streams are weird, they are handled separately
- window.testAddAudioStream = function() {
+ window.testAudioComponents = function() {
var event = {
- id: 'ID',
- status: 'created',
- playing: true
+ component_id: 1,
+ component_type: 0,
+ owner_id: 3,
+ status: 'created'
};
- window.media.addAudioStream(event);
+ // Ensure no components are currently present.
+ assertEquals(0, window.manager.audioComponents_.length);
- var player = window.manager.audioStreams_[event.id];
- assertTrue(undefined !== player);
- assertEquals(event.playing, player['playing']);
+ // Test adding an audio component.
+ window.media.updateAudioComponent(event);
+ assertEquals(1, window.manager.audioComponents_.length);
+
+ // The key format is an implementation detail we don't care about, so
+ // just ensure there's only one key and then use it directly.
+ assertEquals(1, Object.keys(
+ window.manager.audioComponents_[event.component_type]).length);
+ for (key in window.manager.audioComponents_[event.component_type]) {
+ var component =
+ window.manager.audioComponents_[event.component_type][key];
+ assertEquals(event.component_id, component['component_id']);
+ assertEquals(event.component_type, component['component_type']);
+ assertEquals(event.owner_id, component['owner_id']);
+ assertEquals(event.status, component['status']);
+ }
+
+ // Test removing an audio component.
+ event.status = 'closed';
+ window.media.updateAudioComponent(event);
+ assertEquals(1, window.manager.audioComponents_.length);
+ assertEquals(0, Object.keys(
+ window.manager.audioComponents_[event.component_type]).length);
};
</script>
</body>
« no previous file with comments | « content/browser/resources/media/media_internals.html ('k') | media/audio/audio_logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698