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

Side by Side Diff: chrome/test/webdriver/http_response_unittest.cc

Issue 10827362: Fix ChromeDriver flakiness with the C# webdriver bindings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/webdriver/http_response.cc ('k') | chrome/test/webdriver/webdriver_dispatch.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/test/webdriver/http_response.h" 5 #include "chrome/test/webdriver/http_response.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace webdriver { 8 namespace webdriver {
9 9
10 namespace { 10 namespace {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 TEST(HttpResponseTest, CanSetMimeType) { 58 TEST(HttpResponseTest, CanSetMimeType) {
59 HttpResponse response; 59 HttpResponse response;
60 60
61 response.SetMimeType("application/json"); 61 response.SetMimeType("application/json");
62 ExpectHeaderValue(response, "content-type", "application/json"); 62 ExpectHeaderValue(response, "content-type", "application/json");
63 63
64 response.SetMimeType("text/html"); 64 response.SetMimeType("text/html");
65 ExpectHeaderValue(response, "content-type", "text/html"); 65 ExpectHeaderValue(response, "content-type", "text/html");
66 } 66 }
67 67
68 TEST(HttpResponseTest, SetBody) { 68 TEST(HttpResponseTest, GetData) {
69 HttpResponse response; 69 HttpResponse response;
70 70 response.set_body("my body");
71 std::string body("foo bar"); 71 std::string data;
72 response.SetBody(body); 72 response.GetData(&data);
73 ASSERT_EQ(body.length(), response.length()); 73 const char* expected =
74 ASSERT_EQ(body, std::string(response.data(), response.length())); 74 "HTTP/1.1 200 OK\r\n"
75 75 "content-length:7\r\n"
76 // Grow the response size. 76 "\r\n"
77 body.append(" baz"); 77 "my body";
78 response.SetBody(body); 78 ASSERT_STREQ(expected, data.c_str());
79 ASSERT_EQ(body.length(), response.length());
80 ASSERT_EQ(body, std::string(response.data(), response.length()));
81
82 // Shrink the response size.
83 body = "small";
84 response.SetBody(body);
85 ASSERT_EQ(body.length(), response.length());
86 ASSERT_EQ(body, std::string(response.data(), response.length()));
87 } 79 }
88 80
89 } // namespace webdriver 81 } // namespace webdriver
OLDNEW
« no previous file with comments | « chrome/test/webdriver/http_response.cc ('k') | chrome/test/webdriver/webdriver_dispatch.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698