| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Note that although this is not a "browser" test, it runs as part of | 5 // Note that although this is not a "browser" test, it runs as part of |
| 6 // browser_tests. This is because WebKit does not work properly if it is | 6 // browser_tests. This is because WebKit does not work properly if it is |
| 7 // shutdown and re-initialized. Since browser_tests runs each test in a | 7 // shutdown and re-initialized. Since browser_tests runs each test in a |
| 8 // new process, this avoids the problem. | 8 // new process, this avoids the problem. |
| 9 | 9 |
| 10 #include "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h" | 10 #include "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h" |
| 11 | 11 |
| 12 #include <string.h> // for memcpy() | 12 #include <string.h> // for memcpy() |
| 13 #include <map> | 13 #include <map> |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "base/callback.h" | 16 #include "base/callback.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
| 19 #include "base/process.h" | 19 #include "base/process.h" |
| 20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 21 #include "chrome/common/main_function_params.h" | 21 #include "chrome/common/main_function_params.h" |
| 22 #include "chrome/common/render_messages.h" | 22 #include "chrome/common/render_messages.h" |
| 23 #include "chrome/common/render_messages_params.h" |
| 23 #include "chrome/common/sandbox_init_wrapper.h" | 24 #include "chrome/common/sandbox_init_wrapper.h" |
| 24 #include "chrome/renderer/mock_render_process.h" | 25 #include "chrome/renderer/mock_render_process.h" |
| 25 #include "chrome/renderer/render_thread.h" | 26 #include "chrome/renderer/render_thread.h" |
| 26 #include "chrome/renderer/render_view.h" | 27 #include "chrome/renderer/render_view.h" |
| 27 #include "chrome/renderer/render_view_visitor.h" | 28 #include "chrome/renderer/render_view_visitor.h" |
| 28 #include "chrome/renderer/renderer_main_platform_delegate.h" | 29 #include "chrome/renderer/renderer_main_platform_delegate.h" |
| 29 #include "chrome/renderer/safe_browsing/features.h" | 30 #include "chrome/renderer/safe_browsing/features.h" |
| 30 #include "googleurl/src/gurl.h" | 31 #include "googleurl/src/gurl.h" |
| 31 #include "ipc/ipc_channel.h" | 32 #include "ipc/ipc_channel.h" |
| 33 #include "net/base/upload_data.h" |
| 32 #include "net/http/http_response_headers.h" | 34 #include "net/http/http_response_headers.h" |
| 33 #include "testing/gmock/include/gmock/gmock.h" | 35 #include "testing/gmock/include/gmock/gmock.h" |
| 34 #include "testing/gtest/include/gtest/gtest.h" | 36 #include "testing/gtest/include/gtest/gtest.h" |
| 35 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 37 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
| 36 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" | 38 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" |
| 37 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 39 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
| 38 #include "webkit/glue/webkit_glue.h" | 40 #include "webkit/glue/webkit_glue.h" |
| 39 | 41 |
| 40 using ::testing::ContainerEq; | 42 using ::testing::ContainerEq; |
| 41 | 43 |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 FeatureMap features; | 413 FeatureMap features; |
| 412 LoadURL("http://host.com/"); | 414 LoadURL("http://host.com/"); |
| 413 ASSERT_TRUE(ExtractFeatures(&features)); | 415 ASSERT_TRUE(ExtractFeatures(&features)); |
| 414 EXPECT_THAT(features.features(), ContainerEq(expected_features.features())); | 416 EXPECT_THAT(features.features(), ContainerEq(expected_features.features())); |
| 415 } | 417 } |
| 416 | 418 |
| 417 // TODO(bryner): Test extraction with multiple passes, including the case where | 419 // TODO(bryner): Test extraction with multiple passes, including the case where |
| 418 // the node we stopped on is removed from the document. | 420 // the node we stopped on is removed from the document. |
| 419 | 421 |
| 420 } // namespace safe_browsing | 422 } // namespace safe_browsing |
| OLD | NEW |