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

Side by Side Diff: content/renderer/presentation/presentation_connection_proxy.cc

Issue 2730123003: [Presentation API] Add layout test for connection.close() and fix test failures (Closed)
Patch Set: Created 3 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "content/renderer/presentation/presentation_connection_proxy.h" 5 #include "content/renderer/presentation/presentation_connection_proxy.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/public/common/presentation_session.h" 8 #include "content/public/common/presentation_session.h"
9 #include "content/renderer/presentation/presentation_dispatcher.h" 9 #include "content/renderer/presentation/presentation_dispatcher.h"
10 #include "third_party/WebKit/public/platform/WebString.h" 10 #include "third_party/WebKit/public/platform/WebString.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 61
62 // TODO(crbug.com/588874): Ensure legal PresentationConnection state transitions 62 // TODO(crbug.com/588874): Ensure legal PresentationConnection state transitions
63 // in a single place. 63 // in a single place.
64 void PresentationConnectionProxy::DidChangeState( 64 void PresentationConnectionProxy::DidChangeState(
65 content::PresentationConnectionState state) { 65 content::PresentationConnectionState state) {
66 if (state == content::PRESENTATION_CONNECTION_STATE_CONNECTED) { 66 if (state == content::PRESENTATION_CONNECTION_STATE_CONNECTED) {
67 source_connection_->didChangeState( 67 source_connection_->didChangeState(
68 blink::WebPresentationConnectionState::Connected); 68 blink::WebPresentationConnectionState::Connected);
69 } else if (state == content::PRESENTATION_CONNECTION_STATE_CLOSED) { 69 } else if (state == content::PRESENTATION_CONNECTION_STATE_CLOSED) {
70 source_connection_->didChangeState( 70 source_connection_->didClose(
71 blink::WebPresentationConnectionState::Closed); 71 blink::WebPresentationConnectionCloseReason::Closed, "");
72 } else { 72 } else {
73 NOTREACHED(); 73 NOTREACHED();
74 } 74 }
75 } 75 }
76 76
77 void PresentationConnectionProxy::OnClose() { 77 void PresentationConnectionProxy::OnClose() {
78 DCHECK(target_connection_ptr_); 78 DCHECK(target_connection_ptr_);
79 source_connection_->didChangeState( 79 source_connection_->didClose(
80 blink::WebPresentationConnectionState::Closed); 80 blink::WebPresentationConnectionCloseReason::Closed, "");
81 target_connection_ptr_->DidChangeState( 81 target_connection_ptr_->DidChangeState(
mark a. foltz 2017/03/06 18:57:55 Part of the connection refactoring should better a
zhaobin 2017/03/06 19:52:23 Acknowledged.
82 content::PRESENTATION_CONNECTION_STATE_CLOSED); 82 content::PRESENTATION_CONNECTION_STATE_CLOSED);
83 } 83 }
84 84
85 void PresentationConnectionProxy::close() const { 85 void PresentationConnectionProxy::close() const {
86 DCHECK(target_connection_ptr_); 86 DCHECK(target_connection_ptr_);
87 target_connection_ptr_->OnClose(); 87 target_connection_ptr_->OnClose();
88 } 88 }
89 89
90 ControllerConnectionProxy::ControllerConnectionProxy( 90 ControllerConnectionProxy::ControllerConnectionProxy(
91 blink::WebPresentationConnection* controller_connection) 91 blink::WebPresentationConnection* controller_connection)
(...skipping 27 matching lines...) Expand all
119 blink::mojom::PresentationConnectionPtr controller_connection_ptr) { 119 blink::mojom::PresentationConnectionPtr controller_connection_ptr) {
120 DCHECK(!target_connection_ptr_); 120 DCHECK(!target_connection_ptr_);
121 target_connection_ptr_ = std::move(controller_connection_ptr); 121 target_connection_ptr_ = std::move(controller_connection_ptr);
122 target_connection_ptr_->DidChangeState( 122 target_connection_ptr_->DidChangeState(
123 content::PRESENTATION_CONNECTION_STATE_CONNECTED); 123 content::PRESENTATION_CONNECTION_STATE_CONNECTED);
124 124
125 DidChangeState(content::PRESENTATION_CONNECTION_STATE_CONNECTED); 125 DidChangeState(content::PRESENTATION_CONNECTION_STATE_CONNECTED);
126 } 126 }
127 127
128 } // namespace content 128 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698