Index: content/renderer/media/android/webmediasession_android_unittest.cc |
diff --git a/content/renderer/media/android/webmediasession_android_unittest.cc b/content/renderer/media/android/webmediasession_android_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8847886ac462cbd2edb5673dad0cd7ecc81fabee |
--- /dev/null |
+++ b/content/renderer/media/android/webmediasession_android_unittest.cc |
@@ -0,0 +1,41 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/renderer/media/android/webmediasession_android.h" |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "content/renderer/media/android/renderer_media_session_manager.h" |
+#include "testing/gmock/include/gmock/gmock.h" |
+ |
+namespace content { |
+ |
+class WebMediaSessionTest : public testing::Test { |
+ public: |
+ bool SessionManagerHasSession(RendererMediaSessionManager* session_manager, |
+ WebMediaSessionAndroid* session) { |
+ for (auto& iter : session_manager->sessions_) { |
+ if (iter.second == session) |
+ return true; |
+ } |
+ return false; |
+ } |
+ |
+ bool IsSessionManagerEmpty(RendererMediaSessionManager* session_manager) { |
+ return session_manager->sessions_.empty(); |
+ } |
+}; |
+ |
+TEST_F(WebMediaSessionTest, TestRegistration) { |
mlamouri (slow - plz ping)
2015/11/24 14:25:07
Can you add more tests. For example, create two se
davve
2015/11/24 16:52:07
Not that much to tests yet, but note taken. Two mo
|
+ scoped_ptr<RendererMediaSessionManager> session_manager( |
+ new RendererMediaSessionManager(nullptr)); |
+ EXPECT_TRUE(IsSessionManagerEmpty(session_manager.get())); |
+ { |
+ scoped_ptr<WebMediaSessionAndroid> session( |
+ new WebMediaSessionAndroid(session_manager.get())); |
+ EXPECT_TRUE(SessionManagerHasSession(session_manager.get(), session.get())); |
+ } |
+ EXPECT_TRUE(IsSessionManagerEmpty(session_manager.get())); |
+} |
+ |
+} // namespace content |