| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/test/blink_test_environment.h" | 5 #include "content/test/blink_test_environment.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/strings/string_tokenizer.h" | 12 #include "base/strings/string_tokenizer.h" |
| 13 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 14 #include "content/public/common/user_agent.h" | 14 #include "content/public/common/user_agent.h" |
| 15 #include "content/public/test/test_content_client_initializer.h" |
| 15 #include "content/test/test_webkit_platform_support.h" | 16 #include "content/test/test_webkit_platform_support.h" |
| 16 #include "third_party/WebKit/public/web/WebCache.h" | 17 #include "third_party/WebKit/public/web/WebCache.h" |
| 17 #include "third_party/WebKit/public/web/WebKit.h" | 18 #include "third_party/WebKit/public/web/WebKit.h" |
| 18 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 19 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 19 #include "url/url_util.h" | 20 #include "url/url_util.h" |
| 20 | 21 |
| 21 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| 22 #include "ui/gfx/win/dpi.h" | 23 #include "ui/gfx/win/dpi.h" |
| 23 #endif | 24 #endif |
| 24 | 25 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 typedef base::MessageLoop MessageLoopType; | 57 typedef base::MessageLoop MessageLoopType; |
| 57 #else | 58 #else |
| 58 typedef base::MessageLoopForUI MessageLoopType; | 59 typedef base::MessageLoopForUI MessageLoopType; |
| 59 #endif | 60 #endif |
| 60 | 61 |
| 61 TestEnvironment() { | 62 TestEnvironment() { |
| 62 main_message_loop_.reset(new MessageLoopType); | 63 main_message_loop_.reset(new MessageLoopType); |
| 63 | 64 |
| 64 // TestWebKitPlatformSupport must be instantiated after MessageLoopType. | 65 // TestWebKitPlatformSupport must be instantiated after MessageLoopType. |
| 65 webkit_platform_support_.reset(new TestWebKitPlatformSupport); | 66 webkit_platform_support_.reset(new TestWebKitPlatformSupport); |
| 67 content_initializer_.reset(new content::TestContentClientInitializer()); |
| 66 } | 68 } |
| 67 | 69 |
| 68 ~TestEnvironment() { | 70 ~TestEnvironment() { |
| 69 } | 71 } |
| 70 | 72 |
| 71 TestWebKitPlatformSupport* webkit_platform_support() const { | 73 TestWebKitPlatformSupport* webkit_platform_support() const { |
| 72 return webkit_platform_support_.get(); | 74 return webkit_platform_support_.get(); |
| 73 } | 75 } |
| 74 | 76 |
| 75 private: | 77 private: |
| 76 scoped_ptr<MessageLoopType> main_message_loop_; | 78 scoped_ptr<MessageLoopType> main_message_loop_; |
| 77 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; | 79 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; |
| 80 scoped_ptr<TestContentClientInitializer> content_initializer_; |
| 78 }; | 81 }; |
| 79 | 82 |
| 80 TestEnvironment* test_environment; | 83 TestEnvironment* test_environment; |
| 81 | 84 |
| 82 } // namespace | 85 } // namespace |
| 83 | 86 |
| 84 void SetUpBlinkTestEnvironment() { | 87 void SetUpBlinkTestEnvironment() { |
| 85 ParseBlinkCommandLineArgumentsForUnitTests(); | 88 ParseBlinkCommandLineArgumentsForUnitTests(); |
| 86 | 89 |
| 87 blink::WebRuntimeFeatures::enableExperimentalFeatures(true); | 90 blink::WebRuntimeFeatures::enableExperimentalFeatures(true); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 112 // http://code.google.com/p/chromium/issues/detail?id=9500 | 115 // http://code.google.com/p/chromium/issues/detail?id=9500 |
| 113 base::RunLoop().RunUntilIdle(); | 116 base::RunLoop().RunUntilIdle(); |
| 114 | 117 |
| 115 if (RunningOnValgrind()) | 118 if (RunningOnValgrind()) |
| 116 blink::WebCache::clear(); | 119 blink::WebCache::clear(); |
| 117 delete test_environment; | 120 delete test_environment; |
| 118 test_environment = NULL; | 121 test_environment = NULL; |
| 119 } | 122 } |
| 120 | 123 |
| 121 } // namespace content | 124 } // namespace content |
| OLD | NEW |