| 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/V8DOMActivityLogger.h" | 9 #include "bindings/core/v8/V8DOMActivityLogger.h" |
| 10 #include "web/WebLocalFrameImpl.h" | 10 #include "web/WebLocalFrameImpl.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 Vector<ScriptSourceCode> sources; | 88 Vector<ScriptSourceCode> sources; |
| 89 sources.append(ScriptSourceCode(script)); | 89 sources.append(ScriptSourceCode(script)); |
| 90 Vector<v8::Local<v8::Value> > results; | 90 Vector<v8::Local<v8::Value> > results; |
| 91 m_scriptController->executeScriptInIsolatedWorld(isolatedWorldId, source
s, extensionGroup, 0); | 91 m_scriptController->executeScriptInIsolatedWorld(isolatedWorldId, source
s, extensionGroup, 0); |
| 92 runPendingTasks(); | 92 runPendingTasks(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool verifyActivities(const String& activities) | 95 bool verifyActivities(const String& activities) |
| 96 { | 96 { |
| 97 Vector<String> activityVector; | 97 Vector<String> activityVector; |
| 98 activities.split('\n', activityVector); | 98 activities.split("\n", activityVector); |
| 99 return m_activityLogger->verifyActivities(activityVector); | 99 return m_activityLogger->verifyActivities(activityVector); |
| 100 } | 100 } |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 static const int isolatedWorldId = 1; | 103 static const int isolatedWorldId = 1; |
| 104 static const int extensionGroup = 0; | 104 static const int extensionGroup = 0; |
| 105 | 105 |
| 106 WebViewHelper m_webViewHelper; | 106 WebViewHelper m_webViewHelper; |
| 107 ScriptController* m_scriptController; | 107 ScriptController* m_scriptController; |
| 108 // TestActivityLogger is owned by a static table within V8DOMActivityLogger | 108 // TestActivityLogger is owned by a static table within V8DOMActivityLogger |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 "blinkSetAttribute | form | action | data:text/html;charset=utf-8,A | da
ta:text/html;charset=utf-8,B\n" | 426 "blinkSetAttribute | form | action | data:text/html;charset=utf-8,A | da
ta:text/html;charset=utf-8,B\n" |
| 427 "blinkSetAttribute | form | action | data:text/html;charset=utf-8,B | da
ta:text/html;charset=utf-8,C\n" | 427 "blinkSetAttribute | form | action | data:text/html;charset=utf-8,B | da
ta:text/html;charset=utf-8,C\n" |
| 428 "blinkSetAttribute | form | action | data:text/html;charset=utf-8,C | da
ta:text/html;charset=utf-8,D\n" | 428 "blinkSetAttribute | form | action | data:text/html;charset=utf-8,C | da
ta:text/html;charset=utf-8,D\n" |
| 429 "blinkSetAttribute | form | action | data:text/html;charset=utf-8,D | da
ta:text/html;charset=utf-8,E"; | 429 "blinkSetAttribute | form | action | data:text/html;charset=utf-8,D | da
ta:text/html;charset=utf-8,E"; |
| 430 executeScriptInMainWorld(code); | 430 executeScriptInMainWorld(code); |
| 431 ASSERT_TRUE(verifyActivities("")); | 431 ASSERT_TRUE(verifyActivities("")); |
| 432 executeScriptInIsolatedWorld(code); | 432 executeScriptInIsolatedWorld(code); |
| 433 ASSERT_TRUE(verifyActivities(expectedActivities)); | 433 ASSERT_TRUE(verifyActivities(expectedActivities)); |
| 434 } | 434 } |
| 435 | 435 |
| 436 TEST_F(ActivityLoggerTest, DISABLED_LocalDOMWindowAttribute) |
| 437 { |
| 438 const char* code = |
| 439 "location.href = 'data:text/html;charset=utf-8,A';" |
| 440 "location.assign('data:text/html;charset=utf-8,B');" |
| 441 "location.replace('data:text/html;charset=utf-8,C');" |
| 442 "location.protocol = 'protocol';" |
| 443 "location.pathname = 'pathname';" |
| 444 "location.search = 'search';" |
| 445 "location.hash = 'hash';" |
| 446 "location.href = 'about:blank';"; |
| 447 const char* expectedActivities = |
| 448 "blinkSetAttribute | LocalDOMWindow | url | about:blank | data:text/html
;charset=utf-8,A\n" |
| 449 "blinkSetAttribute | LocalDOMWindow | url | about:blank | data:text/html
;charset=utf-8,B\n" |
| 450 "blinkSetAttribute | LocalDOMWindow | url | about:blank | data:text/html
;charset=utf-8,C\n" |
| 451 "blinkSetAttribute | LocalDOMWindow | url | about:blank | protocol:blank
\n" |
| 452 "blinkSetAttribute | LocalDOMWindow | url | about:blank | about:pathname
\n" |
| 453 "blinkSetAttribute | LocalDOMWindow | url | about:blank | about:blank?se
arch\n" |
| 454 "blinkSetAttribute | LocalDOMWindow | url | about:blank | about:blank#ha
sh\n" |
| 455 "blinkSetAttribute | LocalDOMWindow | url | about:blank#hash | about:bla
nk\n"; |
| 456 executeScriptInMainWorld(code); |
| 457 ASSERT_TRUE(verifyActivities("")); |
| 458 executeScriptInIsolatedWorld(code); |
| 459 ASSERT_TRUE(verifyActivities(expectedActivities)); |
| 460 } |
| 461 |
| 436 } // namespace | 462 } // namespace |
| OLD | NEW |