| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/threading/thread_restrictions.h" |
| 10 #include "chrome/browser/extensions/startup_helper.h" | 11 #include "chrome/browser/extensions/startup_helper.h" |
| 11 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
| 12 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 13 #include "chrome/test/base/in_process_browser_test.h" | 14 #include "chrome/test/base/in_process_browser_test.h" |
| 14 | 15 |
| 15 class StartupHelperBrowserTest : public InProcessBrowserTest { | 16 class StartupHelperBrowserTest : public InProcessBrowserTest { |
| 16 public: | 17 public: |
| 17 StartupHelperBrowserTest() {} | 18 StartupHelperBrowserTest() {} |
| 18 ~StartupHelperBrowserTest() override {} | 19 ~StartupHelperBrowserTest() override {} |
| 19 | 20 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 42 | 43 |
| 43 for (std::vector<std::pair<base::FilePath, bool> >::iterator i = | 44 for (std::vector<std::pair<base::FilePath, bool> >::iterator i = |
| 44 expectations.begin(); | 45 expectations.begin(); |
| 45 i != expectations.end(); ++i) { | 46 i != expectations.end(); ++i) { |
| 46 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | 47 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
| 47 const base::FilePath& path = i->first; | 48 const base::FilePath& path = i->first; |
| 48 command_line.AppendSwitchPath(switches::kValidateCrx, path); | 49 command_line.AppendSwitchPath(switches::kValidateCrx, path); |
| 49 | 50 |
| 50 std::string error; | 51 std::string error; |
| 51 extensions::StartupHelper helper; | 52 extensions::StartupHelper helper; |
| 53 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 52 bool result = helper.ValidateCrx(command_line, &error); | 54 bool result = helper.ValidateCrx(command_line, &error); |
| 53 if (i->second) { | 55 if (i->second) { |
| 54 EXPECT_TRUE(result) << path.LossyDisplayName() | 56 EXPECT_TRUE(result) << path.LossyDisplayName() |
| 55 << " expected to be valid but wasn't"; | 57 << " expected to be valid but wasn't"; |
| 56 } else { | 58 } else { |
| 57 EXPECT_FALSE(result) << path.LossyDisplayName() | 59 EXPECT_FALSE(result) << path.LossyDisplayName() |
| 58 << " expected to be invalid but wasn't"; | 60 << " expected to be invalid but wasn't"; |
| 59 EXPECT_FALSE(error.empty()) << "Error message wasn't set for " | 61 EXPECT_FALSE(error.empty()) << "Error message wasn't set for " |
| 60 << path.LossyDisplayName(); | 62 << path.LossyDisplayName(); |
| 61 } | 63 } |
| 62 } | 64 } |
| 63 } | 65 } |
| OLD | NEW |