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
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/api/declarative_content/declarative_content_condition_tracker_test.h"
7 #include "base/run_loop.h"
8 #include "chrome/test/base/testing_profile.h"
9 #include "content/public/browser/render_view_host.h"
10 #include "content/public/browser/web_contents.h"
11 #include "content/public/test/mock_render_process_host.h"
12 #include "content/public/test/web_contents_tester.h"
14 namespace extensions
{
16 DeclarativeContentConditionTrackerTest::DeclarativeContentConditionTrackerTest()
17 : profile_(new TestingProfile
),
18 next_predicate_group_id_(1) {
21 DeclarativeContentConditionTrackerTest::
22 ~DeclarativeContentConditionTrackerTest() {
23 // MockRenderProcessHosts are deleted from the message loop, and their
24 // deletion must complete before RenderViewHostTestEnabler's destructor is
26 base::RunLoop().RunUntilIdle();
29 scoped_ptr
<content::WebContents
>
30 DeclarativeContentConditionTrackerTest::MakeTab() {
31 return make_scoped_ptr(content::WebContentsTester::CreateTestWebContents(
36 content::MockRenderProcessHost
*
37 DeclarativeContentConditionTrackerTest::GetMockRenderProcessHost(
38 content::WebContents
* contents
) {
39 return static_cast<content::MockRenderProcessHost
*>(
40 contents
->GetRenderViewHost()->GetProcess());
43 const void* DeclarativeContentConditionTrackerTest::GeneratePredicateGroupID() {
44 // The group ID is opaque to the trackers.
45 return reinterpret_cast<const void*>(next_predicate_group_id_
++);
48 } // namespace extensions