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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "content/public/browser/render_view_host_observer.h" | 24 #include "content/public/browser/render_view_host_observer.h" |
25 #include "content/public/common/url_constants.h" | 25 #include "content/public/common/url_constants.h" |
26 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
27 #include "net/test/test_server.h" | 27 #include "net/test/test_server.h" |
28 | 28 |
29 using content::RenderViewHost; | 29 using content::RenderViewHost; |
30 using content::SiteInstance; | 30 using content::SiteInstance; |
31 | 31 |
32 class RenderViewHostManagerTest : public InProcessBrowserTest { | 32 class RenderViewHostManagerTest : public InProcessBrowserTest { |
33 public: | 33 public: |
34 RenderViewHostManagerTest() { | 34 RenderViewHostManagerTest() {} |
35 EnableDOMAutomation(); | |
36 } | |
37 | 35 |
38 static bool GetFilePathWithHostAndPortReplacement( | 36 static bool GetFilePathWithHostAndPortReplacement( |
39 const std::string& original_file_path, | 37 const std::string& original_file_path, |
40 const net::HostPortPair& host_port_pair, | 38 const net::HostPortPair& host_port_pair, |
41 std::string* replacement_path) { | 39 std::string* replacement_path) { |
42 std::vector<net::TestServer::StringPair> replacement_text; | 40 std::vector<net::TestServer::StringPair> replacement_text; |
43 replacement_text.push_back( | 41 replacement_text.push_back( |
44 make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString())); | 42 make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString())); |
45 return net::TestServer::GetFilePathWithReplacements( | 43 return net::TestServer::GetFilePathWithReplacements( |
46 original_file_path, replacement_text, replacement_path); | 44 original_file_path, replacement_text, replacement_path); |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 // Now navigate to a different instance so that we swap out again. | 1112 // Now navigate to a different instance so that we swap out again. |
1115 ui_test_utils::NavigateToURL(browser(), | 1113 ui_test_utils::NavigateToURL(browser(), |
1116 https_server.GetURL("files/title2.html")); | 1114 https_server.GetURL("files/title2.html")); |
1117 rvh_observers.AddObserverToRVH(chrome::GetActiveWebContents(browser())-> | 1115 rvh_observers.AddObserverToRVH(chrome::GetActiveWebContents(browser())-> |
1118 GetRenderViewHost()); | 1116 GetRenderViewHost()); |
1119 | 1117 |
1120 // This used to leak a render view host. | 1118 // This used to leak a render view host. |
1121 chrome::CloseWebContents(browser(), chrome::GetActiveWebContents(browser())); | 1119 chrome::CloseWebContents(browser(), chrome::GetActiveWebContents(browser())); |
1122 EXPECT_EQ(0U, rvh_observers.GetNumObservers()); | 1120 EXPECT_EQ(0U, rvh_observers.GetNumObservers()); |
1123 } | 1121 } |
OLD | NEW |