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

Unified Diff: extensions/browser/api/cast_channel/cast_channel_apitest.cc

Issue 456213002: Cast channel: Add cast.channel.getLogs extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/cast_channel/cast_channel_apitest.cc
diff --git a/extensions/browser/api/cast_channel/cast_channel_apitest.cc b/extensions/browser/api/cast_channel/cast_channel_apitest.cc
index 69e2d8f8a95efcd540ac7b2ac1c2aa62513c189e..414809636761c17876b74ac652ca6ee5ddf95df8 100644
--- a/extensions/browser/api/cast_channel/cast_channel_apitest.cc
+++ b/extensions/browser/api/cast_channel/cast_channel_apitest.cc
@@ -116,6 +116,25 @@ class CastChannelAPITest : public ExtensionApiTest {
.WillRepeatedly(Return(cast_channel::CHANNEL_ERROR_NONE));
}
+ void SetUpOpenSendClose() {
+ SetUpMockCastSocket();
+ {
+ InSequence dummy;
Wez 2014/08/13 20:32:25 nit: s/dummy/sequence or simply 's'
imcheng 2014/08/13 20:46:03 Done.
+ EXPECT_CALL(*mock_cast_socket_, Connect(_))
+ .WillOnce(InvokeCompletionCallback<0>(net::OK));
+ EXPECT_CALL(*mock_cast_socket_, ready_state())
+ .WillOnce(Return(cast_channel::READY_STATE_OPEN));
+ EXPECT_CALL(*mock_cast_socket_, SendMessage(A<const MessageInfo&>(), _))
+ .WillOnce(InvokeCompletionCallback<1>(net::OK));
+ EXPECT_CALL(*mock_cast_socket_, ready_state())
+ .WillOnce(Return(cast_channel::READY_STATE_OPEN));
+ EXPECT_CALL(*mock_cast_socket_, Close(_))
+ .WillOnce(InvokeCompletionCallback<0>(net::OK));
+ EXPECT_CALL(*mock_cast_socket_, ready_state())
+ .WillOnce(Return(cast_channel::READY_STATE_CLOSED));
+ }
+ }
+
extensions::CastChannelAPI* GetApi() {
return extensions::CastChannelAPI::Get(profile());
}
@@ -204,23 +223,7 @@ IN_PROC_BROWSER_TEST_F(CastChannelAPITest, MAYBE_TestOpenSendClose) {
// Test loading extension, opening a channel with a URL, adding a listener,
// writing, reading, and closing.
IN_PROC_BROWSER_TEST_F(CastChannelAPITest, MAYBE_TestOpenSendCloseWithUrl) {
- SetUpMockCastSocket();
-
- {
- InSequence dummy;
- EXPECT_CALL(*mock_cast_socket_, Connect(_))
- .WillOnce(InvokeCompletionCallback<0>(net::OK));
- EXPECT_CALL(*mock_cast_socket_, ready_state())
- .WillOnce(Return(cast_channel::READY_STATE_OPEN));
- EXPECT_CALL(*mock_cast_socket_, SendMessage(A<const MessageInfo&>(), _))
- .WillOnce(InvokeCompletionCallback<1>(net::OK));
- EXPECT_CALL(*mock_cast_socket_, ready_state())
- .WillOnce(Return(cast_channel::READY_STATE_OPEN));
- EXPECT_CALL(*mock_cast_socket_, Close(_))
- .WillOnce(InvokeCompletionCallback<0>(net::OK));
- EXPECT_CALL(*mock_cast_socket_, ready_state())
- .WillOnce(Return(cast_channel::READY_STATE_CLOSED));
- }
+ SetUpOpenSendClose();
EXPECT_TRUE(RunExtensionSubtest("cast_channel/api",
"test_open_send_close_url.html"));
@@ -260,6 +263,20 @@ IN_PROC_BROWSER_TEST_F(CastChannelAPITest, MAYBE_TestOpenReceiveClose) {
EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
}
+// TODO(imcheng): Win Dbg has a workaround that makes RunExtensionSubtest
+// always return true without actually running the test. Remove when fixed.
+#if defined(OS_WIN) && !defined(NDEBUG)
+#define MAYBE_TestGetLogs DISABLED_TestGetLogs
+#else
+#define MAYBE_TestGetLogs TestGetLogs
+#endif
+// Test loading extension, execute a open-send-close sequence, then get logs.
+IN_PROC_BROWSER_TEST_F(CastChannelAPITest, MAYBE_TestGetLogs) {
+ SetUpOpenSendClose();
+
+ EXPECT_TRUE(RunExtensionSubtest("cast_channel/api", "test_get_logs.html"));
+}
+
// TODO(munjal): Win Dbg has a workaround that makes RunExtensionSubtest
// always return true without actually running the test. Remove when fixed.
// Flaky on mac: crbug.com/393969
« no previous file with comments | « extensions/browser/api/cast_channel/cast_channel_api.cc ('k') | extensions/browser/api/cast_channel/logger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698