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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "FrameTestHelpers.h" | 7 #include "FrameTestHelpers.h" |
8 #include "bindings/core/v8/ScriptController.h" | 8 #include "bindings/core/v8/ScriptController.h" |
9 #include "bindings/core/v8/ScriptSourceCode.h" | 9 #include "bindings/core/v8/ScriptSourceCode.h" |
10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
11 #include "bindings/core/v8/V8DOMActivityLogger.h" | 11 #include "bindings/core/v8/V8DOMActivityLogger.h" |
| 12 #include "public/web/WebCache.h" |
12 #include "web/WebLocalFrameImpl.h" | 13 #include "web/WebLocalFrameImpl.h" |
13 #include "wtf/Forward.h" | 14 #include "wtf/Forward.h" |
14 #include "wtf/text/Base64.h" | 15 #include "wtf/text/Base64.h" |
15 #include <gtest/gtest.h> | 16 #include <gtest/gtest.h> |
16 #include <v8.h> | 17 #include <v8.h> |
17 | 18 |
18 namespace blink { | 19 namespace blink { |
19 | 20 |
20 using blink::FrameTestHelpers::WebViewHelper; | 21 using blink::FrameTestHelpers::WebViewHelper; |
21 using blink::FrameTestHelpers::pumpPendingRequestsDoNotUse; | 22 using blink::FrameTestHelpers::pumpPendingRequestsDoNotUse; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 protected: | 63 protected: |
63 ActivityLoggerTest() | 64 ActivityLoggerTest() |
64 { | 65 { |
65 m_activityLogger = new TestActivityLogger(); | 66 m_activityLogger = new TestActivityLogger(); |
66 V8DOMActivityLogger::setActivityLogger(isolatedWorldId, String(), adoptP
tr(m_activityLogger)); | 67 V8DOMActivityLogger::setActivityLogger(isolatedWorldId, String(), adoptP
tr(m_activityLogger)); |
67 m_webViewHelper.initialize(true); | 68 m_webViewHelper.initialize(true); |
68 m_scriptController = &m_webViewHelper.webViewImpl()->mainFrameImpl()->fr
ame()->script(); | 69 m_scriptController = &m_webViewHelper.webViewImpl()->mainFrameImpl()->fr
ame()->script(); |
69 FrameTestHelpers::loadFrame(m_webViewHelper.webViewImpl()->mainFrame(),
"about:blank"); | 70 FrameTestHelpers::loadFrame(m_webViewHelper.webViewImpl()->mainFrame(),
"about:blank"); |
70 } | 71 } |
71 | 72 |
| 73 ~ActivityLoggerTest() |
| 74 { |
| 75 WebCache::clear(); |
| 76 } |
| 77 |
72 void executeScriptInMainWorld(const String& script) const | 78 void executeScriptInMainWorld(const String& script) const |
73 { | 79 { |
74 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 80 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
75 m_scriptController->executeScriptInMainWorld(script); | 81 m_scriptController->executeScriptInMainWorld(script); |
76 pumpPendingRequestsDoNotUse(m_webViewHelper.webViewImpl()->mainFrame()); | 82 pumpPendingRequestsDoNotUse(m_webViewHelper.webViewImpl()->mainFrame()); |
77 } | 83 } |
78 | 84 |
79 void executeScriptInIsolatedWorld(const String& script) const | 85 void executeScriptInIsolatedWorld(const String& script) const |
80 { | 86 { |
81 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 87 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 "blinkAddElement | script | data:text/html;charset=utf-8,D\n" | 524 "blinkAddElement | script | data:text/html;charset=utf-8,D\n" |
519 "blinkRequestResource | Script | data:text/html;charset=utf-8,D\n" | 525 "blinkRequestResource | Script | data:text/html;charset=utf-8,D\n" |
520 "blinkRequestResource | XMLHttpRequest | data:text/html;charset=utf-8,E"
; | 526 "blinkRequestResource | XMLHttpRequest | data:text/html;charset=utf-8,E"
; |
521 executeScriptInMainWorld(code); | 527 executeScriptInMainWorld(code); |
522 ASSERT_TRUE(verifyActivities("")); | 528 ASSERT_TRUE(verifyActivities("")); |
523 executeScriptInIsolatedWorld(code); | 529 executeScriptInIsolatedWorld(code); |
524 ASSERT_TRUE(verifyActivities(expectedActivities)); | 530 ASSERT_TRUE(verifyActivities(expectedActivities)); |
525 } | 531 } |
526 | 532 |
527 } // namespace blink | 533 } // namespace blink |
OLD | NEW |