| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 &success)); | 1144 &success)); |
| 1145 EXPECT_TRUE(success); | 1145 EXPECT_TRUE(success); |
| 1146 } | 1146 } |
| 1147 | 1147 |
| 1148 // This class ensures that all the given RenderViewHosts have properly been | 1148 // This class ensures that all the given RenderViewHosts have properly been |
| 1149 // shutdown. | 1149 // shutdown. |
| 1150 class RenderViewHostDestructionObserver : public WebContentsObserver { | 1150 class RenderViewHostDestructionObserver : public WebContentsObserver { |
| 1151 public: | 1151 public: |
| 1152 explicit RenderViewHostDestructionObserver(WebContents* web_contents) | 1152 explicit RenderViewHostDestructionObserver(WebContents* web_contents) |
| 1153 : WebContentsObserver(web_contents) {} | 1153 : WebContentsObserver(web_contents) {} |
| 1154 virtual ~RenderViewHostDestructionObserver() {} | 1154 ~RenderViewHostDestructionObserver() override {} |
| 1155 void EnsureRVHGetsDestructed(RenderViewHost* rvh) { | 1155 void EnsureRVHGetsDestructed(RenderViewHost* rvh) { |
| 1156 watched_render_view_hosts_.insert(rvh); | 1156 watched_render_view_hosts_.insert(rvh); |
| 1157 } | 1157 } |
| 1158 size_t GetNumberOfWatchedRenderViewHosts() const { | 1158 size_t GetNumberOfWatchedRenderViewHosts() const { |
| 1159 return watched_render_view_hosts_.size(); | 1159 return watched_render_view_hosts_.size(); |
| 1160 } | 1160 } |
| 1161 | 1161 |
| 1162 private: | 1162 private: |
| 1163 // WebContentsObserver implementation: | 1163 // WebContentsObserver implementation: |
| 1164 virtual void RenderViewDeleted(RenderViewHost* rvh) override { | 1164 void RenderViewDeleted(RenderViewHost* rvh) override { |
| 1165 watched_render_view_hosts_.erase(rvh); | 1165 watched_render_view_hosts_.erase(rvh); |
| 1166 } | 1166 } |
| 1167 | 1167 |
| 1168 std::set<RenderViewHost*> watched_render_view_hosts_; | 1168 std::set<RenderViewHost*> watched_render_view_hosts_; |
| 1169 }; | 1169 }; |
| 1170 | 1170 |
| 1171 // Crashes under ThreadSanitizer, http://crbug.com/356758. | 1171 // Crashes under ThreadSanitizer, http://crbug.com/356758. |
| 1172 #if defined(THREAD_SANITIZER) | 1172 #if defined(THREAD_SANITIZER) |
| 1173 #define MAYBE_LeakingRenderViewHosts DISABLED_LeakingRenderViewHosts | 1173 #define MAYBE_LeakingRenderViewHosts DISABLED_LeakingRenderViewHosts |
| 1174 #else | 1174 #else |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 GURL webui_url2(webui_url.spec() + "#foo"); | 1383 GURL webui_url2(webui_url.spec() + "#foo"); |
| 1384 NavigateToURL(shell(), webui_url2); | 1384 NavigateToURL(shell(), webui_url2); |
| 1385 EXPECT_EQ(webui, web_contents->GetRenderManagerForTesting()->web_ui()); | 1385 EXPECT_EQ(webui, web_contents->GetRenderManagerForTesting()->web_ui()); |
| 1386 EXPECT_FALSE(web_contents->GetRenderManagerForTesting()->pending_web_ui()); | 1386 EXPECT_FALSE(web_contents->GetRenderManagerForTesting()->pending_web_ui()); |
| 1387 } | 1387 } |
| 1388 | 1388 |
| 1389 class RFHMProcessPerTabTest : public RenderFrameHostManagerTest { | 1389 class RFHMProcessPerTabTest : public RenderFrameHostManagerTest { |
| 1390 public: | 1390 public: |
| 1391 RFHMProcessPerTabTest() {} | 1391 RFHMProcessPerTabTest() {} |
| 1392 | 1392 |
| 1393 virtual void SetUpCommandLine(CommandLine* command_line) override { | 1393 void SetUpCommandLine(CommandLine* command_line) override { |
| 1394 command_line->AppendSwitch(switches::kProcessPerTab); | 1394 command_line->AppendSwitch(switches::kProcessPerTab); |
| 1395 } | 1395 } |
| 1396 }; | 1396 }; |
| 1397 | 1397 |
| 1398 // Test that we still swap processes for BrowsingInstance changes even in | 1398 // Test that we still swap processes for BrowsingInstance changes even in |
| 1399 // --process-per-tab mode. See http://crbug.com/343017. | 1399 // --process-per-tab mode. See http://crbug.com/343017. |
| 1400 // Disabled on Android: http://crbug.com/345873. | 1400 // Disabled on Android: http://crbug.com/345873. |
| 1401 // Crashes under ThreadSanitizer, http://crbug.com/356758. | 1401 // Crashes under ThreadSanitizer, http://crbug.com/356758. |
| 1402 #if defined(OS_ANDROID) || defined(THREAD_SANITIZER) | 1402 #if defined(OS_ANDROID) || defined(THREAD_SANITIZER) |
| 1403 #define MAYBE_BackFromWebUI DISABLED_BackFromWebUI | 1403 #define MAYBE_BackFromWebUI DISABLED_BackFromWebUI |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 // Navigate to url1 and check bindings. | 1467 // Navigate to url1 and check bindings. |
| 1468 NavigateToURL(new_shell, url1); | 1468 NavigateToURL(new_shell, url1); |
| 1469 // The navigation should have used the first SiteInstance, otherwise | 1469 // The navigation should have used the first SiteInstance, otherwise |
| 1470 // |initial_rvh| did not have a chance to be used. | 1470 // |initial_rvh| did not have a chance to be used. |
| 1471 EXPECT_EQ(new_web_contents->GetSiteInstance(), site_instance1); | 1471 EXPECT_EQ(new_web_contents->GetSiteInstance(), site_instance1); |
| 1472 EXPECT_EQ(BINDINGS_POLICY_WEB_UI, | 1472 EXPECT_EQ(BINDINGS_POLICY_WEB_UI, |
| 1473 new_web_contents->GetRenderViewHost()->GetEnabledBindings()); | 1473 new_web_contents->GetRenderViewHost()->GetEnabledBindings()); |
| 1474 } | 1474 } |
| 1475 | 1475 |
| 1476 } // namespace content | 1476 } // namespace content |
| OLD | NEW |