Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void executeScriptInMainWorld(const String& script) const 83 void executeScriptInMainWorld(const String& script) const
84 { 84 {
85 v8::HandleScope scope(v8::Isolate::GetCurrent()); 85 v8::HandleScope scope(v8::Isolate::GetCurrent());
86 m_scriptController->executeScriptInMainWorld(script); 86 m_scriptController->executeScriptInMainWorld(script);
87 pumpPendingRequestsForFrameToLoad(m_webViewHelper.webViewImpl()->mainFra me()); 87 pumpPendingRequestsForFrameToLoad(m_webViewHelper.webViewImpl()->mainFra me());
88 } 88 }
89 89
90 void executeScriptInIsolatedWorld(const String& script) const 90 void executeScriptInIsolatedWorld(const String& script) const
91 { 91 {
92 v8::HandleScope scope(v8::Isolate::GetCurrent()); 92 v8::HandleScope scope(v8::Isolate::GetCurrent());
93 WillBeHeapVector<ScriptSourceCode> sources; 93 HeapVector<ScriptSourceCode> sources;
94 sources.append(ScriptSourceCode(script)); 94 sources.append(ScriptSourceCode(script));
95 Vector<v8::Local<v8::Value>> results; 95 Vector<v8::Local<v8::Value>> results;
96 m_scriptController->executeScriptInIsolatedWorld(isolatedWorldId, source s, extensionGroup, 0); 96 m_scriptController->executeScriptInIsolatedWorld(isolatedWorldId, source s, extensionGroup, 0);
97 pumpPendingRequestsForFrameToLoad(m_webViewHelper.webViewImpl()->mainFra me()); 97 pumpPendingRequestsForFrameToLoad(m_webViewHelper.webViewImpl()->mainFra me());
98 } 98 }
99 99
100 bool verifyActivities(const String& activities) 100 bool verifyActivities(const String& activities)
101 { 101 {
102 Vector<String> activityVector; 102 Vector<String> activityVector;
103 activities.split("\n", activityVector); 103 activities.split("\n", activityVector);
104 return m_activityLogger->verifyActivities(activityVector); 104 return m_activityLogger->verifyActivities(activityVector);
105 } 105 }
106 106
107 private: 107 private:
108 static const int isolatedWorldId = 1; 108 static const int isolatedWorldId = 1;
109 static const int extensionGroup = 0; 109 static const int extensionGroup = 0;
110 110
111 WebViewHelper m_webViewHelper; 111 WebViewHelper m_webViewHelper;
112 RawPtrWillBePersistent<ScriptController> m_scriptController; 112 Persistent<ScriptController> m_scriptController;
113 // TestActivityLogger is owned by a static table within V8DOMActivityLogger 113 // TestActivityLogger is owned by a static table within V8DOMActivityLogger
114 // and should be alive as long as not overwritten. 114 // and should be alive as long as not overwritten.
115 TestActivityLogger* m_activityLogger; 115 TestActivityLogger* m_activityLogger;
116 }; 116 };
117 117
118 TEST_F(ActivityLoggerTest, EventHandler) 118 TEST_F(ActivityLoggerTest, EventHandler)
119 { 119 {
120 const char* code = 120 const char* code =
121 "document.body.innerHTML = '<a onclick=\\\'do()\\\'>test</a>';" 121 "document.body.innerHTML = '<a onclick=\\\'do()\\\'>test</a>';"
122 "document.body.onchange = function(){};" 122 "document.body.onchange = function(){};"
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 "blinkAddElement | script | data:text/html;charset=utf-8,D\n" 529 "blinkAddElement | script | data:text/html;charset=utf-8,D\n"
530 "blinkRequestResource | Script | data:text/html;charset=utf-8,D\n" 530 "blinkRequestResource | Script | data:text/html;charset=utf-8,D\n"
531 "blinkRequestResource | XMLHttpRequest | data:text/html;charset=utf-8,E" ; 531 "blinkRequestResource | XMLHttpRequest | data:text/html;charset=utf-8,E" ;
532 executeScriptInMainWorld(code); 532 executeScriptInMainWorld(code);
533 ASSERT_TRUE(verifyActivities("")); 533 ASSERT_TRUE(verifyActivities(""));
534 executeScriptInIsolatedWorld(code); 534 executeScriptInIsolatedWorld(code);
535 ASSERT_TRUE(verifyActivities(expectedActivities)); 535 ASSERT_TRUE(verifyActivities(expectedActivities));
536 } 536 }
537 537
538 } // namespace blink 538 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698