Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: chrome/browser/extensions/app_background_page_apitest.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/path_service.h" 5 #include "base/path_service.h"
6 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/background/background_contents_service.h" 8 #include "chrome/browser/background/background_contents_service.h"
9 #include "chrome/browser/background/background_contents_service_factory.h" 9 #include "chrome/browser/background/background_contents_service_factory.h"
10 #include "chrome/browser/background/background_mode_manager.h" 10 #include "chrome/browser/background/background_mode_manager.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 command_line->AppendSwitch(extensions::switches::kAllowHTTPBackgroundPage); 44 command_line->AppendSwitch(extensions::switches::kAllowHTTPBackgroundPage);
45 } 45 }
46 46
47 bool CreateApp(const std::string& app_manifest, 47 bool CreateApp(const std::string& app_manifest,
48 base::FilePath* app_dir) { 48 base::FilePath* app_dir) {
49 if (!app_dir_.CreateUniqueTempDir()) { 49 if (!app_dir_.CreateUniqueTempDir()) {
50 LOG(ERROR) << "Unable to create a temporary directory."; 50 LOG(ERROR) << "Unable to create a temporary directory.";
51 return false; 51 return false;
52 } 52 }
53 base::FilePath manifest_path = app_dir_.path().AppendASCII("manifest.json"); 53 base::FilePath manifest_path = app_dir_.path().AppendASCII("manifest.json");
54 int bytes_written = file_util::WriteFile(manifest_path, 54 int bytes_written = base::WriteFile(manifest_path,
55 app_manifest.data(), 55 app_manifest.data(),
56 app_manifest.size()); 56 app_manifest.size());
57 if (bytes_written != static_cast<int>(app_manifest.size())) { 57 if (bytes_written != static_cast<int>(app_manifest.size())) {
58 LOG(ERROR) << "Unable to write complete manifest to file. Return code=" 58 LOG(ERROR) << "Unable to write complete manifest to file. Return code="
59 << bytes_written; 59 << bytes_written;
60 return false; 60 return false;
61 } 61 }
62 *app_dir = app_dir_.path(); 62 *app_dir = app_dir_.path();
63 return true; 63 return true;
64 } 64 }
65 65
66 bool WaitForBackgroundMode(bool expected_background_mode) { 66 bool WaitForBackgroundMode(bool expected_background_mode) {
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); 638 extensions::ExtensionSystem::Get(browser()->profile())->process_manager();
639 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id()); 639 ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id());
640 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); 640 EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied());
641 641
642 manager->SetKeepaliveImpulseDecrementCallbackForTesting( 642 manager->SetKeepaliveImpulseDecrementCallbackForTesting(
643 idle_impulse_counter.SetGoalAndGetCallback(1)); 643 idle_impulse_counter.SetGoalAndGetCallback(1));
644 nacl_modules_loaded.Reply("be idle"); 644 nacl_modules_loaded.Reply("be idle");
645 idle_impulse_counter.Wait(); 645 idle_impulse_counter.Wait();
646 } 646 }
647 647
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698