OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
14 #include "base/task.h" | 14 #include "base/task.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "chrome/browser/safe_browsing/browser_features.h" | 16 #include "chrome/browser/safe_browsing/browser_features.h" |
17 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 17 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
18 #include "chrome/common/safe_browsing/client_model.pb.h" | 18 #include "chrome/common/safe_browsing/client_model.pb.h" |
19 #include "chrome/common/safe_browsing/csd.pb.h" | 19 #include "chrome/common/safe_browsing/csd.pb.h" |
20 #include "chrome/renderer/safe_browsing/features.h" | 20 #include "chrome/renderer/safe_browsing/features.h" |
21 #include "chrome/test/base/testing_browser_process_test.h" | |
22 #include "content/browser/browser_thread.h" | 21 #include "content/browser/browser_thread.h" |
23 #include "content/common/url_fetcher.h" | 22 #include "content/common/url_fetcher.h" |
24 #include "content/test/test_url_fetcher_factory.h" | 23 #include "content/test/test_url_fetcher_factory.h" |
25 #include "crypto/sha2.h" | 24 #include "crypto/sha2.h" |
26 #include "googleurl/src/gurl.h" | 25 #include "googleurl/src/gurl.h" |
27 #include "net/url_request/url_request_status.h" | 26 #include "net/url_request/url_request_status.h" |
28 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
30 | 29 |
31 using ::testing::_; | 30 using ::testing::_; |
(...skipping 24 matching lines...) Expand all Loading... |
56 private: | 55 private: |
57 DISALLOW_COPY_AND_ASSIGN(MockClientSideDetectionService); | 56 DISALLOW_COPY_AND_ASSIGN(MockClientSideDetectionService); |
58 }; | 57 }; |
59 | 58 |
60 ACTION(QuitCurrentMessageLoop) { | 59 ACTION(QuitCurrentMessageLoop) { |
61 MessageLoop::current()->Quit(); | 60 MessageLoop::current()->Quit(); |
62 } | 61 } |
63 | 62 |
64 } // namespace | 63 } // namespace |
65 | 64 |
66 class ClientSideDetectionServiceTest : public TestingBrowserProcessTest { | 65 class ClientSideDetectionServiceTest : public testing::Test { |
67 protected: | 66 protected: |
68 virtual void SetUp() { | 67 virtual void SetUp() { |
69 file_thread_.reset(new BrowserThread(BrowserThread::FILE, &msg_loop_)); | 68 file_thread_.reset(new BrowserThread(BrowserThread::FILE, &msg_loop_)); |
70 | 69 |
71 factory_.reset(new FakeURLFetcherFactory()); | 70 factory_.reset(new FakeURLFetcherFactory()); |
72 | 71 |
73 browser_thread_.reset(new BrowserThread(BrowserThread::UI, &msg_loop_)); | 72 browser_thread_.reset(new BrowserThread(BrowserThread::UI, &msg_loop_)); |
74 } | 73 } |
75 | 74 |
76 virtual void TearDown() { | 75 virtual void TearDown() { |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 << "Non-model feature " << i; | 744 << "Non-model feature " << i; |
746 } | 745 } |
747 | 746 |
748 // Also check the serialized forms in case there's a field that we forget | 747 // Also check the serialized forms in case there's a field that we forget |
749 // to add above. | 748 // to add above. |
750 EXPECT_EQ(expected.SerializeAsString(), | 749 EXPECT_EQ(expected.SerializeAsString(), |
751 sanitized_request.SerializeAsString()); | 750 sanitized_request.SerializeAsString()); |
752 } | 751 } |
753 | 752 |
754 } // namespace safe_browsing | 753 } // namespace safe_browsing |
OLD | NEW |