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 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT_CO
NDITION_TRACKER_TEST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT_CO
NDITION_TRACKER_TEST_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT_CO
NDITION_TRACKER_TEST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT_CO
NDITION_TRACKER_TEST_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
11 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
12 #include "content/public/browser/render_view_host.h" | 13 #include "content/public/browser/render_view_host.h" |
13 #include "content/public/test/browser_test_utils.h" | 14 #include "content/public/test/browser_test_utils.h" |
14 #include "content/public/test/test_browser_thread_bundle.h" | 15 #include "content/public/test/test_browser_thread_bundle.h" |
15 #include "content/public/test/test_renderer_host.h" | 16 #include "content/public/test/test_renderer_host.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 class MockRenderProcessHost; | 20 class MockRenderProcessHost; |
20 class WebContents; | 21 class WebContents; |
21 } // namespace content | 22 } // namespace content |
22 | 23 |
23 namespace extensions { | 24 namespace extensions { |
24 | 25 |
25 // Creates a TestWebContents browser context and mocks out RenderViewHosts. The | 26 // Creates a TestWebContents browser context and mocks out RenderViewHosts. The |
26 // latter is done to avoid having to run renderer processes and because the | 27 // latter is done to avoid having to run renderer processes and because the |
27 // actual RenderViewHost implementation depends on things not available in this | 28 // actual RenderViewHost implementation depends on things not available in this |
28 // configuration. | 29 // configuration. |
29 class DeclarativeContentConditionTrackerTest : public testing::Test { | 30 class DeclarativeContentConditionTrackerTest : public testing::Test { |
30 public: | 31 public: |
31 DeclarativeContentConditionTrackerTest(); | 32 DeclarativeContentConditionTrackerTest(); |
32 ~DeclarativeContentConditionTrackerTest() override; | 33 ~DeclarativeContentConditionTrackerTest() override; |
33 | 34 |
34 protected: | 35 protected: |
35 // Creates a new WebContents and retains ownership. | 36 // Creates a new WebContents and retains ownership. |
36 scoped_ptr<content::WebContents> MakeTab(); | 37 std::unique_ptr<content::WebContents> MakeTab(); |
37 | 38 |
38 // Gets the MockRenderProcessHost associated with a WebContents. | 39 // Gets the MockRenderProcessHost associated with a WebContents. |
39 content::MockRenderProcessHost* GetMockRenderProcessHost( | 40 content::MockRenderProcessHost* GetMockRenderProcessHost( |
40 content::WebContents* contents); | 41 content::WebContents* contents); |
41 | 42 |
42 TestingProfile* profile() { return profile_.get(); } | 43 TestingProfile* profile() { return profile_.get(); } |
43 | 44 |
44 const void* GeneratePredicateGroupID(); | 45 const void* GeneratePredicateGroupID(); |
45 | 46 |
46 private: | 47 private: |
47 content::TestBrowserThreadBundle thread_bundle_; | 48 content::TestBrowserThreadBundle thread_bundle_; |
48 | 49 |
49 // Enables MockRenderProcessHosts. | 50 // Enables MockRenderProcessHosts. |
50 content::RenderViewHostTestEnabler render_view_host_test_enabler_; | 51 content::RenderViewHostTestEnabler render_view_host_test_enabler_; |
51 | 52 |
52 const scoped_ptr<TestingProfile> profile_; | 53 const std::unique_ptr<TestingProfile> profile_; |
53 | 54 |
54 uintptr_t next_predicate_group_id_; | 55 uintptr_t next_predicate_group_id_; |
55 | 56 |
56 DISALLOW_COPY_AND_ASSIGN(DeclarativeContentConditionTrackerTest); | 57 DISALLOW_COPY_AND_ASSIGN(DeclarativeContentConditionTrackerTest); |
57 }; | 58 }; |
58 | 59 |
59 } // namespace extensions | 60 } // namespace extensions |
60 | 61 |
61 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT
_CONDITION_TRACKER_TEST_H_ | 62 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT
_CONDITION_TRACKER_TEST_H_ |
OLD | NEW |