| OLD | NEW |
| 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/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 DISALLOW_COPY_AND_ASSIGN(AshTestViewsDelegateContent); | 32 DISALLOW_COPY_AND_ASSIGN(AshTestViewsDelegateContent); |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 // static | 37 // static |
| 38 std::unique_ptr<AshTestEnvironment> AshTestEnvironment::Create() { | 38 std::unique_ptr<AshTestEnvironment> AshTestEnvironment::Create() { |
| 39 return base::MakeUnique<AshTestEnvironmentContent>(); | 39 return base::MakeUnique<AshTestEnvironmentContent>(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // static |
| 43 std::string AshTestEnvironment::Get100PercentResourceFileName() { |
| 44 return "ash_test_resources_with_content_100_percent.pak"; |
| 45 } |
| 46 |
| 42 AshTestEnvironmentContent::AshTestEnvironmentContent() | 47 AshTestEnvironmentContent::AshTestEnvironmentContent() |
| 43 : thread_bundle_(base::MakeUnique<content::TestBrowserThreadBundle>()) {} | 48 : thread_bundle_(base::MakeUnique<content::TestBrowserThreadBundle>()) {} |
| 44 | 49 |
| 45 AshTestEnvironmentContent::~AshTestEnvironmentContent() {} | 50 AshTestEnvironmentContent::~AshTestEnvironmentContent() {} |
| 46 | 51 |
| 47 void AshTestEnvironmentContent::SetUp() { | 52 void AshTestEnvironmentContent::SetUp() { |
| 48 ShellContentState* content_state = content_state_; | 53 ShellContentState* content_state = content_state_; |
| 49 if (!content_state) { | 54 if (!content_state) { |
| 50 test_shell_content_state_ = new TestShellContentState; | 55 test_shell_content_state_ = new TestShellContentState; |
| 51 content_state = test_shell_content_state_; | 56 content_state = test_shell_content_state_; |
| 52 } | 57 } |
| 53 ShellContentState::SetInstance(content_state); | 58 ShellContentState::SetInstance(content_state); |
| 54 } | 59 } |
| 55 | 60 |
| 56 void AshTestEnvironmentContent::TearDown() { | 61 void AshTestEnvironmentContent::TearDown() { |
| 57 ShellContentState::DestroyInstance(); | 62 ShellContentState::DestroyInstance(); |
| 58 } | 63 } |
| 59 | 64 |
| 60 base::SequencedWorkerPool* AshTestEnvironmentContent::GetBlockingPool() { | 65 base::SequencedWorkerPool* AshTestEnvironmentContent::GetBlockingPool() { |
| 61 return content::BrowserThread::GetBlockingPool(); | 66 return content::BrowserThread::GetBlockingPool(); |
| 62 } | 67 } |
| 63 | 68 |
| 64 std::unique_ptr<views::ViewsDelegate> | 69 std::unique_ptr<views::ViewsDelegate> |
| 65 AshTestEnvironmentContent::CreateViewsDelegate() { | 70 AshTestEnvironmentContent::CreateViewsDelegate() { |
| 66 return base::MakeUnique<AshTestViewsDelegateContent>(); | 71 return base::MakeUnique<AshTestViewsDelegateContent>(); |
| 67 } | 72 } |
| 68 | 73 |
| 69 } // namespace test | 74 } // namespace test |
| 70 } // namespace ash | 75 } // namespace ash |
| OLD | NEW |