Home | History | Annotate | Download | only in views
      1 // Copyright (c) 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 "base/basictypes.h"
      6 #include "base/bind.h"
      7 #include "base/compiler_specific.h"
      8 #include "base/path_service.h"
      9 #include "base/test/launcher/unit_test_launcher.h"
     10 #include "base/test/test_suite.h"
     11 #include "ui/base/resource/resource_bundle.h"
     12 #include "ui/base/ui_base_paths.h"
     13 
     14 class ViewTestSuite : public base::TestSuite {
     15  public:
     16   ViewTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {}
     17 
     18  protected:
     19   virtual void Initialize() OVERRIDE {
     20     base::TestSuite::Initialize();
     21     ui::RegisterPathProvider();
     22 
     23     base::FilePath pak_dir;
     24     PathService::Get(base::DIR_MODULE, &pak_dir);
     25 
     26     base::FilePath pak_file;
     27     pak_file = pak_dir.Append(FILE_PATH_LITERAL("ui_test.pak"));
     28 
     29     ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file);
     30   }
     31 
     32   virtual void Shutdown() OVERRIDE {
     33     ui::ResourceBundle::CleanupSharedInstance();
     34     base::TestSuite::Shutdown();
     35   }
     36 
     37  private:
     38   DISALLOW_COPY_AND_ASSIGN(ViewTestSuite);
     39 };
     40 
     41 int main(int argc, char** argv) {
     42   ViewTestSuite test_suite(argc, argv);
     43 
     44   return base::LaunchUnitTests(
     45       argc, argv, base::Bind(&ViewTestSuite::Run,
     46                              base::Unretained(&test_suite)));
     47 }
     48