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

Side by Side Diff: components/test_runner/test_common.cc

Issue 1660383002: Refactoring: Move some classes from content/child to platform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add PLATFORM_EXPORT; Address haraken's review Created 4 years, 10 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
« no previous file with comments | « no previous file | content/child/blink_platform_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
36 private: 40 private:
37 DISALLOW_COPY_AND_ASSIGN(MockBlinkPlatform); 41 DISALLOW_COPY_AND_ASSIGN(MockBlinkPlatform);
38 }; 42 };
39 43
40 base::LazyInstance<MockBlinkPlatform>::Leaky g_mock_blink_platform = 44 base::LazyInstance<MockBlinkPlatform>::Leaky g_mock_blink_platform =
41 LAZY_INSTANCE_INITIALIZER; 45 LAZY_INSTANCE_INITIALIZER;
42 46
43 } // namespace 47 } // namespace
44 48
45 std::string NormalizeLayoutTestURL(const std::string& url) { 49 std::string NormalizeLayoutTestURL(const std::string& url) {
46 std::string result = url; 50 std::string result = url;
47 size_t pos; 51 size_t pos;
48 if (!url.find(file_url_pattern) && 52 if (!url.find(file_url_pattern) &&
49 ((pos = url.find(layout_tests_pattern)) != std::string::npos)) { 53 ((pos = url.find(layout_tests_pattern)) != std::string::npos)) {
50 // adjust file URLs to match upstream results. 54 // adjust file URLs to match upstream results.
51 result.replace(0, pos + layout_tests_pattern_size, file_test_prefix); 55 result.replace(0, pos + layout_tests_pattern_size, file_test_prefix);
52 } else if (!url.find(data_url_pattern)) { 56 } else if (!url.find(data_url_pattern)) {
53 // URL-escape data URLs to match results upstream. 57 // URL-escape data URLs to match results upstream.
54 std::string path = url.substr(data_url_pattern_size); 58 std::string path = url.substr(data_url_pattern_size);
55 result.replace(data_url_pattern_size, url.length(), path); 59 result.replace(data_url_pattern_size, url.length(), path);
56 } 60 }
57 return result; 61 return result;
58 } 62 }
59 63
60 void EnsureBlinkInitialized() { 64 void EnsureBlinkInitialized() {
61 g_mock_blink_platform.Get(); 65 g_mock_blink_platform.Get();
62 } 66 }
63 67
64 } // namespace test_runner 68 } // namespace test_runner
OLDNEW
« no previous file with comments | « no previous file | content/child/blink_platform_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698