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 #include <map> | 5 #include <map> |
6 #include <queue> | 6 #include <queue> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/file_util_proxy.h" | 12 #include "base/file_util_proxy.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
17 #include "base/scoped_temp_dir.h" | 17 #include "base/scoped_temp_dir.h" |
18 #include "base/task.h" | 18 #include "base/task.h" |
19 #include "base/time.h" | 19 #include "base/time.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | |
21 #include "chrome/browser/browser_thread.h" | |
22 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | |
23 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 20 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
24 #include "chrome/browser/safe_browsing/csd.pb.h" | 21 #include "chrome/browser/safe_browsing/csd.pb.h" |
25 #include "chrome/common/render_messages.h" | 22 #include "chrome/common/render_messages.h" |
26 #include "chrome/common/net/test_url_fetcher_factory.h" | 23 #include "chrome/common/net/test_url_fetcher_factory.h" |
27 #include "chrome/common/net/url_fetcher.h" | 24 #include "chrome/common/net/url_fetcher.h" |
| 25 #include "content/browser/browser_thread.h" |
| 26 #include "content/browser/renderer_host/test_render_view_host.h" |
28 #include "googleurl/src/gurl.h" | 27 #include "googleurl/src/gurl.h" |
29 #include "ipc/ipc_channel.h" | 28 #include "ipc/ipc_channel.h" |
30 #include "ipc/ipc_test_sink.h" | 29 #include "ipc/ipc_test_sink.h" |
31 #include "net/url_request/url_request_status.h" | 30 #include "net/url_request/url_request_status.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" |
32 | 32 |
33 namespace safe_browsing { | 33 namespace safe_browsing { |
34 | 34 |
35 class ClientSideDetectionServiceTest : public testing::Test { | 35 class ClientSideDetectionServiceTest : public testing::Test { |
36 protected: | 36 protected: |
37 virtual void SetUp() { | 37 virtual void SetUp() { |
38 file_thread_.reset(new BrowserThread(BrowserThread::FILE, &msg_loop_)); | 38 file_thread_.reset(new BrowserThread(BrowserThread::FILE, &msg_loop_)); |
39 | 39 |
40 factory_.reset(new FakeURLFetcherFactory()); | 40 factory_.reset(new FakeURLFetcherFactory()); |
41 URLFetcher::set_factory(factory_.get()); | 41 URLFetcher::set_factory(factory_.get()); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 EXPECT_EQ(rvh()->routing_id(), received_msg_.routing_id()); | 400 EXPECT_EQ(rvh()->routing_id(), received_msg_.routing_id()); |
401 | 401 |
402 // Now try an in-page navigation. This should not trigger an IPC. | 402 // Now try an in-page navigation. This should not trigger an IPC. |
403 did_receive_msg_ = false; | 403 did_receive_msg_ = false; |
404 NavigateAndCommit(GURL("http://host.com/#foo")); | 404 NavigateAndCommit(GURL("http://host.com/#foo")); |
405 MessageLoop::current()->RunAllPending(); | 405 MessageLoop::current()->RunAllPending(); |
406 ASSERT_FALSE(did_receive_msg_); | 406 ASSERT_FALSE(did_receive_msg_); |
407 } | 407 } |
408 | 408 |
409 } // namespace safe_browsing | 409 } // namespace safe_browsing |
OLD | NEW |