Home | History | Annotate | Download | only in extensions
      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
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/extensions/test_blacklist.h"
      6 
      7 #include <set>
      8 
      9 #include "base/bind.h"
     10 #include "base/message_loop/message_loop.h"
     11 #include "base/run_loop.h"
     12 #include "chrome/browser/extensions/blacklist.h"
     13 
     14 namespace extensions {
     15 
     16 TestBlacklist::TestBlacklist(Blacklist* blacklist)
     17     : blacklist_(blacklist) {
     18 }
     19 
     20 namespace {
     21 
     22 void Assign(std::set<std::string>* out, const std::set<std::string>& in) {
     23   *out = in;
     24 }
     25 
     26 }  // namespace
     27 
     28 bool TestBlacklist::IsBlacklisted(const std::string& extension_id) {
     29   std::set<std::string> id_set;
     30   id_set.insert(extension_id);
     31   std::set<std::string> blacklist_set;
     32   blacklist_->GetBlacklistedIDs(id_set,
     33                                 base::Bind(&Assign, &blacklist_set));
     34   base::RunLoop().RunUntilIdle();
     35   return blacklist_set.count(extension_id) > 0;
     36 }
     37 
     38 }  // namespace extensions
     39