| 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" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 void EnableBlinkPlatformLogChannels(const std::string& channels) { | 40 void EnableBlinkPlatformLogChannels(const std::string& channels) { |
| 41 if (channels.empty()) | 41 if (channels.empty()) |
| 42 return; | 42 return; |
| 43 base::StringTokenizer t(channels, ", "); | 43 base::StringTokenizer t(channels, ", "); |
| 44 while (t.GetNext()) | 44 while (t.GetNext()) |
| 45 blink::enableLogChannel(t.token().c_str()); | 45 blink::enableLogChannel(t.token().c_str()); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void ParseBlinkCommandLineArgumentsForUnitTests() { | 48 void ParseBlinkCommandLineArgumentsForUnitTests() { |
| 49 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 49 const base::CommandLine& command_line = |
| 50 *base::CommandLine::ForCurrentProcess(); |
| 50 EnableBlinkPlatformLogChannels( | 51 EnableBlinkPlatformLogChannels( |
| 51 command_line.GetSwitchValueASCII(switches::kBlinkPlatformLogChannels)); | 52 command_line.GetSwitchValueASCII(switches::kBlinkPlatformLogChannels)); |
| 52 } | 53 } |
| 53 | 54 |
| 54 class TestEnvironment { | 55 class TestEnvironment { |
| 55 public: | 56 public: |
| 56 #if defined(OS_ANDROID) | 57 #if defined(OS_ANDROID) |
| 57 // Android UI message loop goes through Java, so don't use it in tests. | 58 // Android UI message loop goes through Java, so don't use it in tests. |
| 58 typedef base::MessageLoop MessageLoopType; | 59 typedef base::MessageLoop MessageLoopType; |
| 59 #else | 60 #else |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // http://code.google.com/p/chromium/issues/detail?id=9500 | 117 // http://code.google.com/p/chromium/issues/detail?id=9500 |
| 117 base::RunLoop().RunUntilIdle(); | 118 base::RunLoop().RunUntilIdle(); |
| 118 | 119 |
| 119 if (RunningOnValgrind()) | 120 if (RunningOnValgrind()) |
| 120 blink::WebCache::clear(); | 121 blink::WebCache::clear(); |
| 121 delete test_environment; | 122 delete test_environment; |
| 122 test_environment = NULL; | 123 test_environment = NULL; |
| 123 } | 124 } |
| 124 | 125 |
| 125 } // namespace content | 126 } // namespace content |
| OLD | NEW |