| 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 "content/browser/loader/resource_scheduler.h" | 5 #include "content/browser/loader/resource_scheduler.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2211 TestWebContents::Create(browser_context.get(), site_instance_2.get())); | 2211 TestWebContents::Create(browser_context.get(), site_instance_2.get())); |
| 2212 base::RunLoop().RunUntilIdle(); | 2212 base::RunLoop().RunUntilIdle(); |
| 2213 | 2213 |
| 2214 RenderViewHostImpl* rvh1 = web_contents_1->GetRenderViewHost(); | 2214 RenderViewHostImpl* rvh1 = web_contents_1->GetRenderViewHost(); |
| 2215 RenderViewHostImpl* rvh2 = web_contents_2->GetRenderViewHost(); | 2215 RenderViewHostImpl* rvh2 = web_contents_2->GetRenderViewHost(); |
| 2216 ResourceScheduler* scheduler = ResourceDispatcherHostImpl::Get()->scheduler(); | 2216 ResourceScheduler* scheduler = ResourceDispatcherHostImpl::Get()->scheduler(); |
| 2217 | 2217 |
| 2218 // Check initial visibility is set correctly. | 2218 // Check initial visibility is set correctly. |
| 2219 EXPECT_EQ(scheduler->IsClientVisibleForTesting(rvh1->GetProcess()->GetID(), | 2219 EXPECT_EQ(scheduler->IsClientVisibleForTesting(rvh1->GetProcess()->GetID(), |
| 2220 rvh1->GetRoutingID()), | 2220 rvh1->GetRoutingID()), |
| 2221 !rvh1->is_hidden()); | 2221 !rvh1->GetWidget()->is_hidden()); |
| 2222 EXPECT_EQ(scheduler->IsClientVisibleForTesting(rvh2->GetProcess()->GetID(), | 2222 EXPECT_EQ(scheduler->IsClientVisibleForTesting(rvh2->GetProcess()->GetID(), |
| 2223 rvh1->GetRoutingID()), | 2223 rvh1->GetRoutingID()), |
| 2224 !rvh2->is_hidden()); | 2224 !rvh2->GetWidget()->is_hidden()); |
| 2225 | 2225 |
| 2226 // 1 visible, 1 hidden | 2226 // 1 visible, 1 hidden |
| 2227 rvh1->WasShown(ui::LatencyInfo()); | 2227 rvh1->WasShown(ui::LatencyInfo()); |
| 2228 rvh2->WasHidden(); | 2228 rvh2->WasHidden(); |
| 2229 base::RunLoop().RunUntilIdle(); | 2229 base::RunLoop().RunUntilIdle(); |
| 2230 | 2230 |
| 2231 EXPECT_TRUE(scheduler->IsClientVisibleForTesting(rvh1->GetProcess()->GetID(), | 2231 EXPECT_TRUE(scheduler->IsClientVisibleForTesting(rvh1->GetProcess()->GetID(), |
| 2232 rvh1->GetRoutingID())); | 2232 rvh1->GetRoutingID())); |
| 2233 EXPECT_FALSE(scheduler->IsClientVisibleForTesting(rvh2->GetProcess()->GetID(), | 2233 EXPECT_FALSE(scheduler->IsClientVisibleForTesting(rvh2->GetProcess()->GetID(), |
| 2234 rvh2->GetRoutingID())); | 2234 rvh2->GetRoutingID())); |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2724 } | 2724 } |
| 2725 | 2725 |
| 2726 scoped_ptr<TestRequest> last_different_host(NewRequest("http://host_new/last", | 2726 scoped_ptr<TestRequest> last_different_host(NewRequest("http://host_new/last", |
| 2727 net::LOWEST)); | 2727 net::LOWEST)); |
| 2728 EXPECT_FALSE(last_different_host->started()); | 2728 EXPECT_FALSE(last_different_host->started()); |
| 2729 } | 2729 } |
| 2730 | 2730 |
| 2731 } // unnamed namespace | 2731 } // unnamed namespace |
| 2732 | 2732 |
| 2733 } // namespace content | 2733 } // namespace content |
| OLD | NEW |