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