| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #if !defined(__has_feature) || !__has_feature(objc_arc) | 5 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 6 #error "This file requires ARC support." | 6 #error "This file requires ARC support." |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #import "remoting/client/ios/bridge/client_proxy.h" | 9 #import "remoting/client/ios/bridge/client_proxy.h" |
| 10 | 10 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 const std::string& pairingId, | 191 const std::string& pairingId, |
| 192 const std::string& pairingSecret) { | 192 const std::string& pairingSecret) { |
| 193 NSString* hostNameAsNSString = base::SysUTF8ToNSString(hostName); | 193 NSString* hostNameAsNSString = base::SysUTF8ToNSString(hostName); |
| 194 | 194 |
| 195 // Check if credentials are currently stored, and if so, delete them. | 195 // Check if credentials are currently stored, and if so, delete them. |
| 196 HostPreferences* existingHost = | 196 HostPreferences* existingHost = |
| 197 [HostPreferences hostForId:hostNameAsNSString]; | 197 [HostPreferences hostForId:hostNameAsNSString]; |
| 198 if (existingHost != nil) { | 198 if (existingHost != nil) { |
| 199 existingHost.pairId = @""; | 199 existingHost.pairId = @""; |
| 200 existingHost.pairSecret = @""; | 200 existingHost.pairSecret = @""; |
| 201 [existingHost saveToSSOKeychain]; | 201 [existingHost saveToKeychain]; |
| 202 } | 202 } |
| 203 | 203 |
| 204 clientProxy_->CommitPairingCredentials(hostName, pairingId, pairingSecret); | 204 clientProxy_->CommitPairingCredentials(hostName, pairingId, pairingSecret); |
| 205 | 205 |
| 206 // Fetch new credentials from keychain. | 206 // Fetch new credentials from keychain. |
| 207 HostPreferences* host = [HostPreferences hostForId:hostNameAsNSString]; | 207 HostPreferences* host = [HostPreferences hostForId:hostNameAsNSString]; |
| 208 | 208 |
| 209 ASSERT_TRUE(host != nil); | 209 ASSERT_TRUE(host != nil); |
| 210 ASSERT_TRUE([base::SysUTF8ToNSString(hostName) | 210 ASSERT_TRUE([base::SysUTF8ToNSString(hostName) |
| 211 isEqualToString:host.hostId]); | 211 isEqualToString:host.hostId]); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 223 } else { | 223 } else { |
| 224 ASSERT_TRUE([host.pairSecret isEqualToString:@""]); | 224 ASSERT_TRUE([host.pairSecret isEqualToString:@""]); |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 | 227 |
| 228 std::unique_ptr<ClientProxy> clientProxy_; | 228 std::unique_ptr<ClientProxy> clientProxy_; |
| 229 ClientProxyDelegateTester* delegateTester_; | 229 ClientProxyDelegateTester* delegateTester_; |
| 230 ClientProxyDelegateWrapper* delegateWrapper_; | 230 ClientProxyDelegateWrapper* delegateWrapper_; |
| 231 }; | 231 }; |
| 232 | 232 |
| 233 // TODO(nicholss): Removing these tests for now until we settle on a | 233 // TODO(nicholss): Commenting these tests out for now until we settle on |
| 234 // what the final strings will be. | 234 // what the final strings will be. |
| 235 // TEST_F(ClientProxyTest, ReportConnectionStatusINITIALIZING) { | 235 // TEST_F(ClientProxyTest, ReportConnectionStatusINITIALIZING) { |
| 236 // TestConnnectionStatus(protocol::ConnectionToHost::State::INITIALIZING, | 236 // TestConnnectionStatus(protocol::ConnectionToHost::State::INITIALIZING, |
| 237 // kStatusINITIALIZING); | 237 // kStatusINITIALIZING); |
| 238 // } | 238 // } |
| 239 // | 239 // |
| 240 // TEST_F(ClientProxyTest, ReportConnectionStatusCONNECTING) { | 240 // TEST_F(ClientProxyTest, ReportConnectionStatusCONNECTING) { |
| 241 // TestConnnectionStatus(protocol::ConnectionToHost::State::CONNECTING, | 241 // TestConnnectionStatus(protocol::ConnectionToHost::State::CONNECTING, |
| 242 // kStatusCONNECTING); | 242 // kStatusCONNECTING); |
| 243 // } | 243 // } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 TEST_F(ClientProxyTest, CommitPairingCredentialsBasic) { | 277 TEST_F(ClientProxyTest, CommitPairingCredentialsBasic) { |
| 278 ValidateHost("", "", ""); | 278 ValidateHost("", "", ""); |
| 279 } | 279 } |
| 280 | 280 |
| 281 TEST_F(ClientProxyTest, CommitPairingCredentialsExtended) { | 281 TEST_F(ClientProxyTest, CommitPairingCredentialsExtended) { |
| 282 ValidateHost(base::SysNSStringToUTF8(kHostName), | 282 ValidateHost(base::SysNSStringToUTF8(kHostName), |
| 283 base::SysNSStringToUTF8(kPairingId), | 283 base::SysNSStringToUTF8(kPairingId), |
| 284 base::SysNSStringToUTF8(kPairingSecret)); | 284 base::SysNSStringToUTF8(kPairingSecret)); |
| 285 } | 285 } |
| 286 | 286 |
| 287 // TODO(nicholss): Re-enable these tests. | 287 // TODO(nicholss): Re-enable these tests. Activly changing how rendering |
| 288 // is done for the app at the moment. |
| 288 // TEST_F(ClientProxyTest, RedrawCanvasBasic) { | 289 // TEST_F(ClientProxyTest, RedrawCanvasBasic) { |
| 289 // webrtc::BasicDesktopFrame frame(webrtc::DesktopSize(1, 1)); | 290 // webrtc::BasicDesktopFrame frame(webrtc::DesktopSize(1, 1)); |
| 290 // webrtc::DesktopRegion regions; | 291 // webrtc::DesktopRegion regions; |
| 291 // regions.AddRect(webrtc::DesktopRect::MakeLTRB(0, 0, 1, 1)); | 292 // regions.AddRect(webrtc::DesktopRect::MakeLTRB(0, 0, 1, 1)); |
| 292 // | 293 // |
| 293 // clientProxy_->RedrawCanvas(webrtc::DesktopSize(1, 1), &frame, regions); | 294 // clientProxy_->RedrawCanvas(webrtc::DesktopSize(1, 1), &frame, regions); |
| 294 // | 295 // |
| 295 // ASSERT_TRUE(webrtc::DesktopSize(1, 1).equals(delegateTester_.size)); | 296 // ASSERT_TRUE(webrtc::DesktopSize(1, 1).equals(delegateTester_.size)); |
| 296 // ASSERT_EQ(4, delegateTester_.stride); | 297 // ASSERT_EQ(4, delegateTester_.stride); |
| 297 // ASSERT_TRUE(delegateTester_.data != NULL); | 298 // ASSERT_TRUE(delegateTester_.data != NULL); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 ASSERT_EQ(kCursorHotSpotX, delegateTester_.hotspot.x()); | 363 ASSERT_EQ(kCursorHotSpotX, delegateTester_.hotspot.x()); |
| 363 ASSERT_EQ(kCursorHotSpotY, delegateTester_.hotspot.y()); | 364 ASSERT_EQ(kCursorHotSpotY, delegateTester_.hotspot.y()); |
| 364 ASSERT_TRUE(delegateTester_.data != NULL); | 365 ASSERT_TRUE(delegateTester_.data != NULL); |
| 365 for (int i = 0; i < kCursorDataLength / 4; i++) { | 366 for (int i = 0; i < kCursorDataLength / 4; i++) { |
| 366 ASSERT_TRUE(memcmp(&delegateTester_.data[i * 4], &kCursorDataPattern, 4) == | 367 ASSERT_TRUE(memcmp(&delegateTester_.data[i * 4], &kCursorDataPattern, 4) == |
| 367 0); | 368 0); |
| 368 } | 369 } |
| 369 } | 370 } |
| 370 | 371 |
| 371 } // namespace remoting | 372 } // namespace remoting |
| OLD | NEW |