OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/location.h" | 5 #include "base/location.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 command_line->AppendSwitch(switches::kDisablePopupBlocking); | 50 command_line->AppendSwitch(switches::kDisablePopupBlocking); |
51 command_line->AppendSwitch(extensions::switches::kAllowHTTPBackgroundPage); | 51 command_line->AppendSwitch(extensions::switches::kAllowHTTPBackgroundPage); |
52 } | 52 } |
53 | 53 |
54 bool CreateApp(const std::string& app_manifest, | 54 bool CreateApp(const std::string& app_manifest, |
55 base::FilePath* app_dir) { | 55 base::FilePath* app_dir) { |
56 if (!app_dir_.CreateUniqueTempDir()) { | 56 if (!app_dir_.CreateUniqueTempDir()) { |
57 LOG(ERROR) << "Unable to create a temporary directory."; | 57 LOG(ERROR) << "Unable to create a temporary directory."; |
58 return false; | 58 return false; |
59 } | 59 } |
60 base::FilePath manifest_path = app_dir_.path().AppendASCII("manifest.json"); | 60 base::FilePath manifest_path = |
| 61 app_dir_.GetPath().AppendASCII("manifest.json"); |
61 int bytes_written = base::WriteFile(manifest_path, | 62 int bytes_written = base::WriteFile(manifest_path, |
62 app_manifest.data(), | 63 app_manifest.data(), |
63 app_manifest.size()); | 64 app_manifest.size()); |
64 if (bytes_written != static_cast<int>(app_manifest.size())) { | 65 if (bytes_written != static_cast<int>(app_manifest.size())) { |
65 LOG(ERROR) << "Unable to write complete manifest to file. Return code=" | 66 LOG(ERROR) << "Unable to write complete manifest to file. Return code=" |
66 << bytes_written; | 67 << bytes_written; |
67 return false; | 68 return false; |
68 } | 69 } |
69 *app_dir = app_dir_.path(); | 70 *app_dir = app_dir_.GetPath(); |
70 return true; | 71 return true; |
71 } | 72 } |
72 | 73 |
73 bool WaitForBackgroundMode(bool expected_background_mode) { | 74 bool WaitForBackgroundMode(bool expected_background_mode) { |
74 #if defined(OS_CHROMEOS) | 75 #if defined(OS_CHROMEOS) |
75 // BackgroundMode is not supported on chromeos, so we should test the | 76 // BackgroundMode is not supported on chromeos, so we should test the |
76 // behavior of BackgroundContents, but not the background mode state itself. | 77 // behavior of BackgroundContents, but not the background mode state itself. |
77 return true; | 78 return true; |
78 #else | 79 #else |
79 BackgroundModeManager* manager = | 80 BackgroundModeManager* manager = |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 extensions::ProcessManager::Get(browser()->profile()); | 635 extensions::ProcessManager::Get(browser()->profile()); |
635 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id()); | 636 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id()); |
636 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); | 637 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); |
637 | 638 |
638 manager->SetKeepaliveImpulseDecrementCallbackForTesting( | 639 manager->SetKeepaliveImpulseDecrementCallbackForTesting( |
639 idle_impulse_counter.SetGoalAndGetCallback(1)); | 640 idle_impulse_counter.SetGoalAndGetCallback(1)); |
640 nacl_modules_loaded.Reply("be idle"); | 641 nacl_modules_loaded.Reply("be idle"); |
641 idle_impulse_counter.Wait(); | 642 idle_impulse_counter.Wait(); |
642 #endif | 643 #endif |
643 } | 644 } |
OLD | NEW |