OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/message_loop/message_loop.h" | |
7 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
8 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/thread_task_runner_handle.h" |
9 #include "chrome/browser/extensions/blacklist.h" | 9 #include "chrome/browser/extensions/blacklist.h" |
10 #include "chrome/browser/extensions/blacklist_state_fetcher.h" | 10 #include "chrome/browser/extensions/blacklist_state_fetcher.h" |
11 #include "chrome/browser/extensions/fake_safe_browsing_database_manager.h" | 11 #include "chrome/browser/extensions/fake_safe_browsing_database_manager.h" |
12 #include "chrome/browser/extensions/test_blacklist.h" | 12 #include "chrome/browser/extensions/test_blacklist.h" |
13 #include "chrome/browser/extensions/test_blacklist_state_fetcher.h" | 13 #include "chrome/browser/extensions/test_blacklist_state_fetcher.h" |
14 #include "chrome/browser/extensions/test_extension_prefs.h" | 14 #include "chrome/browser/extensions/test_extension_prefs.h" |
15 #include "content/public/test/test_browser_thread_bundle.h" | 15 #include "content/public/test/test_browser_thread_bundle.h" |
16 #include "extensions/browser/extension_prefs.h" | 16 #include "extensions/browser/extension_prefs.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
(...skipping 22 matching lines...) Expand all Loading... |
41 const std::string& c, | 41 const std::string& c, |
42 const std::string& d) { | 42 const std::string& d) { |
43 std::set<std::string> set = Set(a, b, c); | 43 std::set<std::string> set = Set(a, b, c); |
44 set.insert(d); | 44 set.insert(d); |
45 return set; | 45 return set; |
46 } | 46 } |
47 | 47 |
48 class BlacklistTest : public testing::Test { | 48 class BlacklistTest : public testing::Test { |
49 public: | 49 public: |
50 BlacklistTest() | 50 BlacklistTest() |
51 : test_prefs_(base::MessageLoopProxy::current()) {} | 51 : test_prefs_(base::ThreadTaskRunnerHandle::Get()) {} |
52 | 52 |
53 protected: | 53 protected: |
54 ExtensionPrefs* prefs() { | 54 ExtensionPrefs* prefs() { |
55 return test_prefs_.prefs(); | 55 return test_prefs_.prefs(); |
56 } | 56 } |
57 | 57 |
58 std::string AddExtension(const std::string& id) { | 58 std::string AddExtension(const std::string& id) { |
59 return test_prefs_.AddExtension(id)->id(); | 59 return test_prefs_.AddExtension(id)->id(); |
60 } | 60 } |
61 | 61 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 base::RunLoop().RunUntilIdle(); | 253 base::RunLoop().RunUntilIdle(); |
254 | 254 |
255 // No new fetchers. | 255 // No new fetchers. |
256 EXPECT_FALSE(fetcher_tester.HandleFetcher(2)); | 256 EXPECT_FALSE(fetcher_tester.HandleFetcher(2)); |
257 EXPECT_EQ(BLACKLISTED_CWS_POLICY_VIOLATION, cached_states[a]); | 257 EXPECT_EQ(BLACKLISTED_CWS_POLICY_VIOLATION, cached_states[a]); |
258 EXPECT_EQ(BLACKLISTED_POTENTIALLY_UNWANTED, cached_states[b]); | 258 EXPECT_EQ(BLACKLISTED_POTENTIALLY_UNWANTED, cached_states[b]); |
259 EXPECT_EQ(0U, cached_states.count(c)); | 259 EXPECT_EQ(0U, cached_states.count(c)); |
260 } | 260 } |
261 | 261 |
262 } // namespace extensions | 262 } // namespace extensions |
OLD | NEW |