Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Side by Side Diff: ash/test/ash_test_environment_content.cc

Issue 2316803002: Splits ash_test_resources_100_percent into two pak files (Closed)
Patch Set: fix Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/test/ash_test_environment_content.h" 5 #include "ash/test/ash_test_environment_content.h"
6 6
7 #include "ash/test/ash_test_views_delegate.h" 7 #include "ash/test/ash_test_views_delegate.h"
8 #include "ash/test/content/test_shell_content_state.h" 8 #include "ash/test/content/test_shell_content_state.h"
9 #include "base/files/file_path.h"
msw 2016/09/06 23:30:02 nit: cleanup these three new includes.
sky 2016/09/06 23:47:32 Done.
9 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/path_service.h"
10 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
11 #include "content/public/test/test_browser_thread_bundle.h" 13 #include "content/public/test/test_browser_thread_bundle.h"
12 #include "content/public/test/web_contents_tester.h" 14 #include "content/public/test/web_contents_tester.h"
15 #include "ui/base/resource/resource_bundle.h"
13 16
14 namespace ash { 17 namespace ash {
15 namespace test { 18 namespace test {
16 namespace { 19 namespace {
17 20
18 class AshTestViewsDelegateContent : public AshTestViewsDelegate { 21 class AshTestViewsDelegateContent : public AshTestViewsDelegate {
19 public: 22 public:
20 AshTestViewsDelegateContent() {} 23 AshTestViewsDelegateContent() {}
21 ~AshTestViewsDelegateContent() override {} 24 ~AshTestViewsDelegateContent() override {}
22 25
23 // AshTestViewsDelegate: 26 // AshTestViewsDelegate:
24 content::WebContents* CreateWebContents( 27 content::WebContents* CreateWebContents(
25 content::BrowserContext* browser_context, 28 content::BrowserContext* browser_context,
26 content::SiteInstance* site_instance) override { 29 content::SiteInstance* site_instance) override {
27 return content::WebContentsTester::CreateTestWebContents(browser_context, 30 return content::WebContentsTester::CreateTestWebContents(browser_context,
28 site_instance); 31 site_instance);
29 } 32 }
30 33
31 private: 34 private:
32 DISALLOW_COPY_AND_ASSIGN(AshTestViewsDelegateContent); 35 DISALLOW_COPY_AND_ASSIGN(AshTestViewsDelegateContent);
33 }; 36 };
34 37
35 } // namespace 38 } // namespace
36 39
37 // static 40 // static
38 std::unique_ptr<AshTestEnvironment> AshTestEnvironment::Create() { 41 std::unique_ptr<AshTestEnvironment> AshTestEnvironment::Create() {
39 return base::MakeUnique<AshTestEnvironmentContent>(); 42 return base::MakeUnique<AshTestEnvironmentContent>();
40 } 43 }
41 44
45 // static
46 std::string AshTestEnvironment::Get100PercentResourceFileName() {
47 return "ash_test_resources_with_content_100_percent.pak";
48 }
49
42 AshTestEnvironmentContent::AshTestEnvironmentContent() 50 AshTestEnvironmentContent::AshTestEnvironmentContent()
43 : thread_bundle_(base::MakeUnique<content::TestBrowserThreadBundle>()) {} 51 : thread_bundle_(base::MakeUnique<content::TestBrowserThreadBundle>()) {}
44 52
45 AshTestEnvironmentContent::~AshTestEnvironmentContent() {} 53 AshTestEnvironmentContent::~AshTestEnvironmentContent() {}
46 54
47 void AshTestEnvironmentContent::SetUp() { 55 void AshTestEnvironmentContent::SetUp() {
48 ShellContentState* content_state = content_state_; 56 ShellContentState* content_state = content_state_;
49 if (!content_state) { 57 if (!content_state) {
50 test_shell_content_state_ = new TestShellContentState; 58 test_shell_content_state_ = new TestShellContentState;
51 content_state = test_shell_content_state_; 59 content_state = test_shell_content_state_;
52 } 60 }
53 ShellContentState::SetInstance(content_state); 61 ShellContentState::SetInstance(content_state);
54 } 62 }
55 63
56 void AshTestEnvironmentContent::TearDown() { 64 void AshTestEnvironmentContent::TearDown() {
57 ShellContentState::DestroyInstance(); 65 ShellContentState::DestroyInstance();
58 } 66 }
59 67
60 base::SequencedWorkerPool* AshTestEnvironmentContent::GetBlockingPool() { 68 base::SequencedWorkerPool* AshTestEnvironmentContent::GetBlockingPool() {
61 return content::BrowserThread::GetBlockingPool(); 69 return content::BrowserThread::GetBlockingPool();
62 } 70 }
63 71
64 std::unique_ptr<views::ViewsDelegate> 72 std::unique_ptr<views::ViewsDelegate>
65 AshTestEnvironmentContent::CreateViewsDelegate() { 73 AshTestEnvironmentContent::CreateViewsDelegate() {
66 return base::MakeUnique<AshTestViewsDelegateContent>(); 74 return base::MakeUnique<AshTestViewsDelegateContent>();
67 } 75 }
68 76
69 } // namespace test 77 } // namespace test
70 } // namespace ash 78 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698