Chromium Code Reviews| 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 #ifndef V8Regex_h | 5 #ifndef MojoTestHelper_h |
| 6 #define V8Regex_h | 6 #define MojoTestHelper_h |
| 7 | 7 |
| 8 #include "base/message_loop/message_loop.h" | |
| 8 #include "wtf/Noncopyable.h" | 9 #include "wtf/Noncopyable.h" |
| 9 #include "wtf/text/WTFString.h" | |
| 10 #include <v8.h> | |
| 11 | 10 |
| 12 namespace blink { | 11 namespace blink { |
| 13 | 12 |
| 14 class V8DebuggerImpl; | 13 // Provides common utilities to help writing unittests based on Mojo services. |
| 15 | 14 // |
| 16 enum MultilineMode { | 15 // Expected usage is: |
| 17 MultilineDisabled, | 16 // class YourUnittest : public ::testing::Test { |
| 18 MultilineEnabled | 17 // private: |
| 19 }; | 18 // MojoTestHelper mojo_test_helper_; |
|
esprehn
2016/02/18 06:48:13
This doesn't seem good, it just adds a message loo
Yuki
2016/02/18 07:20:35
Then, we're going to introduce this header file ju
| |
| 20 | 19 // }; |
| 21 class V8Regex { | 20 class MojoTestHelper final { |
| 22 USING_FAST_MALLOC(V8Regex); | 21 WTF_MAKE_NONCOPYABLE(MojoTestHelper); |
| 23 WTF_MAKE_NONCOPYABLE(V8Regex); | |
| 24 public: | 22 public: |
| 25 V8Regex(V8DebuggerImpl*, const String&, TextCaseSensitivity, MultilineMode = MultilineDisabled); | 23 MojoTestHelper() = default; |
| 26 int match(const String&, int startFrom = 0, int* matchLength = 0) const; | 24 ~MojoTestHelper() = default; |
| 27 bool isValid() const { return !m_regex.IsEmpty(); } | |
| 28 | 25 |
| 29 private: | 26 private: |
| 30 V8DebuggerImpl* m_debugger; | 27 base::MessageLoop m_messageLoop; // Mojo needs a message loop running. |
| 31 v8::Global<v8::RegExp> m_regex; | |
| 32 }; | 28 }; |
| 33 | 29 |
| 34 } // namespace blink | 30 } // namespace blink |
| 35 | 31 |
| 36 #endif // V8Regex_h | 32 #endif // MojoTestHelper_h |
| OLD | NEW |