| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/extensions/api/declarative_content/declarative_content_
condition_tracker_test.h" | 5 #include "chrome/browser/extensions/api/declarative_content/declarative_content_
condition_tracker_test.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
| 9 #include "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| 11 #include "content/public/test/mock_render_process_host.h" | 11 #include "content/public/test/mock_render_process_host.h" |
| 12 #include "content/public/test/web_contents_tester.h" | 12 #include "content/public/test/web_contents_tester.h" |
| 13 | 13 |
| 14 namespace extensions { | 14 namespace extensions { |
| 15 | 15 |
| 16 DeclarativeContentConditionTrackerTest::DeclarativeContentConditionTrackerTest() | 16 DeclarativeContentConditionTrackerTest::DeclarativeContentConditionTrackerTest() |
| 17 : profile_(new TestingProfile), | 17 : profile_(new TestingProfile), |
| 18 next_predicate_group_id_(1) { | 18 next_predicate_group_id_(1) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 DeclarativeContentConditionTrackerTest:: | 21 DeclarativeContentConditionTrackerTest:: |
| 22 ~DeclarativeContentConditionTrackerTest() { | 22 ~DeclarativeContentConditionTrackerTest() { |
| 23 // MockRenderProcessHosts are deleted from the message loop, and their | 23 // MockRenderProcessHosts are deleted from the message loop, and their |
| 24 // deletion must complete before RenderViewHostTestEnabler's destructor is | 24 // deletion must complete before RenderViewHostTestEnabler's destructor is |
| 25 // run. | 25 // run. |
| 26 base::RunLoop().RunUntilIdle(); | 26 base::RunLoop().RunUntilIdle(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 scoped_ptr<content::WebContents> | 29 std::unique_ptr<content::WebContents> |
| 30 DeclarativeContentConditionTrackerTest::MakeTab() { | 30 DeclarativeContentConditionTrackerTest::MakeTab() { |
| 31 scoped_ptr<content::WebContents> tab( | 31 std::unique_ptr<content::WebContents> tab( |
| 32 content::WebContentsTester::CreateTestWebContents(profile_.get(), | 32 content::WebContentsTester::CreateTestWebContents(profile_.get(), |
| 33 nullptr)); | 33 nullptr)); |
| 34 content::RenderFrameHostTester::For(tab->GetMainFrame()) | 34 content::RenderFrameHostTester::For(tab->GetMainFrame()) |
| 35 ->InitializeRenderFrameIfNeeded(); | 35 ->InitializeRenderFrameIfNeeded(); |
| 36 return tab; | 36 return tab; |
| 37 } | 37 } |
| 38 | 38 |
| 39 content::MockRenderProcessHost* | 39 content::MockRenderProcessHost* |
| 40 DeclarativeContentConditionTrackerTest::GetMockRenderProcessHost( | 40 DeclarativeContentConditionTrackerTest::GetMockRenderProcessHost( |
| 41 content::WebContents* contents) { | 41 content::WebContents* contents) { |
| 42 return static_cast<content::MockRenderProcessHost*>( | 42 return static_cast<content::MockRenderProcessHost*>( |
| 43 contents->GetRenderViewHost()->GetProcess()); | 43 contents->GetRenderViewHost()->GetProcess()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 const void* DeclarativeContentConditionTrackerTest::GeneratePredicateGroupID() { | 46 const void* DeclarativeContentConditionTrackerTest::GeneratePredicateGroupID() { |
| 47 // The group ID is opaque to the trackers. | 47 // The group ID is opaque to the trackers. |
| 48 return reinterpret_cast<const void*>(next_predicate_group_id_++); | 48 return reinterpret_cast<const void*>(next_predicate_group_id_++); |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace extensions | 51 } // namespace extensions |
| OLD | NEW |