| 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 "components/test_runner/test_common.h" | 5 #include "components/test_runner/test_common.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 sizeof(data_url_pattern) - 1; | 26 sizeof(data_url_pattern) - 1; |
| 27 | 27 |
| 28 // This mock is used to initialize blink. | 28 // This mock is used to initialize blink. |
| 29 class MockBlinkPlatform : NON_EXPORTED_BASE(public blink::Platform) { | 29 class MockBlinkPlatform : NON_EXPORTED_BASE(public blink::Platform) { |
| 30 public: | 30 public: |
| 31 MockBlinkPlatform() { | 31 MockBlinkPlatform() { |
| 32 blink::initializeWithoutV8(this); | 32 blink::initializeWithoutV8(this); |
| 33 } | 33 } |
| 34 ~MockBlinkPlatform() override {} | 34 ~MockBlinkPlatform() override {} |
| 35 | 35 |
| 36 void registerMemoryDumpProvider(blink::WebMemoryDumpProvider*, | |
| 37 const char* name) override {} | |
| 38 void unregisterMemoryDumpProvider(blink::WebMemoryDumpProvider*) override {} | |
| 39 | |
| 40 private: | 36 private: |
| 41 DISALLOW_COPY_AND_ASSIGN(MockBlinkPlatform); | 37 DISALLOW_COPY_AND_ASSIGN(MockBlinkPlatform); |
| 42 }; | 38 }; |
| 43 | 39 |
| 44 base::LazyInstance<MockBlinkPlatform>::Leaky g_mock_blink_platform = | 40 base::LazyInstance<MockBlinkPlatform>::Leaky g_mock_blink_platform = |
| 45 LAZY_INSTANCE_INITIALIZER; | 41 LAZY_INSTANCE_INITIALIZER; |
| 46 | 42 |
| 47 } // namespace | 43 } // namespace |
| 48 | 44 |
| 49 std::string NormalizeLayoutTestURL(const std::string& url) { | 45 std::string NormalizeLayoutTestURL(const std::string& url) { |
| 50 std::string result = url; | 46 std::string result = url; |
| 51 size_t pos; | 47 size_t pos; |
| 52 if (!url.find(file_url_pattern) && | 48 if (!url.find(file_url_pattern) && |
| 53 ((pos = url.find(layout_tests_pattern)) != std::string::npos)) { | 49 ((pos = url.find(layout_tests_pattern)) != std::string::npos)) { |
| 54 // adjust file URLs to match upstream results. | 50 // adjust file URLs to match upstream results. |
| 55 result.replace(0, pos + layout_tests_pattern_size, file_test_prefix); | 51 result.replace(0, pos + layout_tests_pattern_size, file_test_prefix); |
| 56 } else if (!url.find(data_url_pattern)) { | 52 } else if (!url.find(data_url_pattern)) { |
| 57 // URL-escape data URLs to match results upstream. | 53 // URL-escape data URLs to match results upstream. |
| 58 std::string path = url.substr(data_url_pattern_size); | 54 std::string path = url.substr(data_url_pattern_size); |
| 59 result.replace(data_url_pattern_size, url.length(), path); | 55 result.replace(data_url_pattern_size, url.length(), path); |
| 60 } | 56 } |
| 61 return result; | 57 return result; |
| 62 } | 58 } |
| 63 | 59 |
| 64 void EnsureBlinkInitialized() { | 60 void EnsureBlinkInitialized() { |
| 65 g_mock_blink_platform.Get(); | 61 g_mock_blink_platform.Get(); |
| 66 } | 62 } |
| 67 | 63 |
| 68 } // namespace test_runner | 64 } // namespace test_runner |
| OLD | NEW |