OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/strings/string_util.h" | 5 #include "base/strings/string_util.h" |
6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/public/browser/navigation_controller.h" | 8 #include "content/public/browser/navigation_controller.h" |
9 #include "content/public/browser/notification_service.h" | 9 #include "content/public/browser/notification_service.h" |
10 #include "content/public/browser/notification_types.h" | 10 #include "content/public/browser/notification_types.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 // Handles |request| by serving a response with title set to request contents. | 27 // Handles |request| by serving a response with title set to request contents. |
28 scoped_ptr<net::test_server::HttpResponse> HandleEchoTitleRequest( | 28 scoped_ptr<net::test_server::HttpResponse> HandleEchoTitleRequest( |
29 const std::string& echotitle_path, | 29 const std::string& echotitle_path, |
30 const net::test_server::HttpRequest& request) { | 30 const net::test_server::HttpRequest& request) { |
31 if (!StartsWithASCII(request.relative_url, echotitle_path, true)) | 31 if (!base::StartsWithASCII(request.relative_url, echotitle_path, true)) |
32 return scoped_ptr<net::test_server::HttpResponse>(); | 32 return scoped_ptr<net::test_server::HttpResponse>(); |
33 | 33 |
34 scoped_ptr<net::test_server::BasicHttpResponse> http_response( | 34 scoped_ptr<net::test_server::BasicHttpResponse> http_response( |
35 new net::test_server::BasicHttpResponse); | 35 new net::test_server::BasicHttpResponse); |
36 http_response->set_code(net::HTTP_OK); | 36 http_response->set_code(net::HTTP_OK); |
37 http_response->set_content( | 37 http_response->set_content( |
38 base::StringPrintf( | 38 base::StringPrintf( |
39 "<html><head><title>%s</title></head></html>", | 39 "<html><head><title>%s</title></head></html>", |
40 request.content.c_str())); | 40 request.content.c_str())); |
41 return http_response.Pass(); | 41 return http_response.Pass(); |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 NavigateToURL(shell(), GetURL("title2.html")); | 490 NavigateToURL(shell(), GetURL("title2.html")); |
491 | 491 |
492 ASSERT_TRUE(ExecuteScriptAndExtractInt( | 492 ASSERT_TRUE(ExecuteScriptAndExtractInt( |
493 shell()->web_contents(), | 493 shell()->web_contents(), |
494 "domAutomationController.send(history.length)", | 494 "domAutomationController.send(history.length)", |
495 &length)); | 495 &length)); |
496 EXPECT_EQ(2, length); | 496 EXPECT_EQ(2, length); |
497 } | 497 } |
498 | 498 |
499 } // namespace content | 499 } // namespace content |
OLD | NEW |