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 "bindings/core/v8/ScriptController.h" | 5 #include "bindings/core/v8/ScriptController.h" |
6 #include "bindings/core/v8/ScriptSourceCode.h" | 6 #include "bindings/core/v8/ScriptSourceCode.h" |
7 #include "bindings/core/v8/V8Binding.h" | 7 #include "bindings/core/v8/V8Binding.h" |
8 #include "bindings/core/v8/V8DOMActivityLogger.h" | 8 #include "bindings/core/v8/V8DOMActivityLogger.h" |
9 #include "public/web/WebCache.h" | 9 #include "public/web/WebCache.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "web/WebLocalFrameImpl.h" | 11 #include "web/WebLocalFrameImpl.h" |
12 #include "web/tests/FrameTestHelpers.h" | 12 #include "web/tests/FrameTestHelpers.h" |
13 #include "wtf/Forward.h" | 13 #include "wtf/Forward.h" |
| 14 #include "wtf/PtrUtil.h" |
14 #include "wtf/text/Base64.h" | 15 #include "wtf/text/Base64.h" |
15 #include <v8.h> | 16 #include <v8.h> |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 | 19 |
19 using blink::FrameTestHelpers::WebViewHelper; | 20 using blink::FrameTestHelpers::WebViewHelper; |
20 using blink::FrameTestHelpers::pumpPendingRequestsForFrameToLoad; | 21 using blink::FrameTestHelpers::pumpPendingRequestsForFrameToLoad; |
21 | 22 |
22 class TestActivityLogger : public V8DOMActivityLogger { | 23 class TestActivityLogger : public V8DOMActivityLogger { |
23 public: | 24 public: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 63 |
63 private: | 64 private: |
64 Vector<String> m_loggedActivities; | 65 Vector<String> m_loggedActivities; |
65 }; | 66 }; |
66 | 67 |
67 class ActivityLoggerTest : public testing::Test { | 68 class ActivityLoggerTest : public testing::Test { |
68 protected: | 69 protected: |
69 ActivityLoggerTest() | 70 ActivityLoggerTest() |
70 { | 71 { |
71 m_activityLogger = new TestActivityLogger(); | 72 m_activityLogger = new TestActivityLogger(); |
72 V8DOMActivityLogger::setActivityLogger(isolatedWorldId, String(), adoptP
tr(m_activityLogger)); | 73 V8DOMActivityLogger::setActivityLogger(isolatedWorldId, String(), wrapUn
ique(m_activityLogger)); |
73 m_webViewHelper.initialize(true); | 74 m_webViewHelper.initialize(true); |
74 m_scriptController = &m_webViewHelper.webViewImpl()->mainFrameImpl()->fr
ame()->script(); | 75 m_scriptController = &m_webViewHelper.webViewImpl()->mainFrameImpl()->fr
ame()->script(); |
75 FrameTestHelpers::loadFrame(m_webViewHelper.webViewImpl()->mainFrame(),
"about:blank"); | 76 FrameTestHelpers::loadFrame(m_webViewHelper.webViewImpl()->mainFrame(),
"about:blank"); |
76 } | 77 } |
77 | 78 |
78 ~ActivityLoggerTest() | 79 ~ActivityLoggerTest() |
79 { | 80 { |
80 WebCache::clear(); | 81 WebCache::clear(); |
81 } | 82 } |
82 | 83 |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 "blinkAddElement | script | data:text/html;charset=utf-8,D\n" | 530 "blinkAddElement | script | data:text/html;charset=utf-8,D\n" |
530 "blinkRequestResource | Script | data:text/html;charset=utf-8,D\n" | 531 "blinkRequestResource | Script | data:text/html;charset=utf-8,D\n" |
531 "blinkRequestResource | XMLHttpRequest | data:text/html;charset=utf-8,E"
; | 532 "blinkRequestResource | XMLHttpRequest | data:text/html;charset=utf-8,E"
; |
532 executeScriptInMainWorld(code); | 533 executeScriptInMainWorld(code); |
533 ASSERT_TRUE(verifyActivities("")); | 534 ASSERT_TRUE(verifyActivities("")); |
534 executeScriptInIsolatedWorld(code); | 535 executeScriptInIsolatedWorld(code); |
535 ASSERT_TRUE(verifyActivities(expectedActivities)); | 536 ASSERT_TRUE(verifyActivities(expectedActivities)); |
536 } | 537 } |
537 | 538 |
538 } // namespace blink | 539 } // namespace blink |
OLD | NEW |