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

Side by Side Diff: chrome/test/chromedriver/session_commands_unittest.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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) 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 20 matching lines...) Expand all
31 "UEsDBBQAAAAAAMROi0K/wAzGBAAAAAQAAAADAAAAbW9vQ09XClBLAQIUAxQAAAAAAMROi0K/" 31 "UEsDBBQAAAAAAMROi0K/wAzGBAAAAAQAAAADAAAAbW9vQ09XClBLAQIUAxQAAAAAAMROi0K/"
32 "wAzG\nBAAAAAQAAAADAAAAAAAAAAAAAACggQAAAABtb29QSwUGAAAAAAEAAQAxAAAAJQAAAA" 32 "wAzG\nBAAAAAQAAAADAAAAAAAAAAAAAACggQAAAABtb29QSwUGAAAAAAEAAQAxAAAAJQAAAA"
33 "AA\n"; 33 "AA\n";
34 params.SetString("file", kBase64ZipEntry); 34 params.SetString("file", kBase64ZipEntry);
35 Status status = ExecuteUploadFile(&session, params, &value); 35 Status status = ExecuteUploadFile(&session, params, &value);
36 ASSERT_EQ(kOk, status.code()) << status.message(); 36 ASSERT_EQ(kOk, status.code()) << status.message();
37 base::FilePath::StringType path; 37 base::FilePath::StringType path;
38 ASSERT_TRUE(value->GetAsString(&path)); 38 ASSERT_TRUE(value->GetAsString(&path));
39 ASSERT_TRUE(base::PathExists(base::FilePath(path))); 39 ASSERT_TRUE(base::PathExists(base::FilePath(path)));
40 std::string data; 40 std::string data;
41 ASSERT_TRUE(file_util::ReadFileToString(base::FilePath(path), &data)); 41 ASSERT_TRUE(base::ReadFileToString(base::FilePath(path), &data));
42 ASSERT_STREQ("COW\n", data.c_str()); 42 ASSERT_STREQ("COW\n", data.c_str());
43 } 43 }
44 44
45 namespace { 45 namespace {
46 46
47 class DetachChrome : public StubChrome { 47 class DetachChrome : public StubChrome {
48 public: 48 public:
49 DetachChrome() : quit_called_(false) {} 49 DetachChrome() : quit_called_(false) {}
50 virtual ~DetachChrome() {} 50 virtual ~DetachChrome() {}
51 51
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 }; 104 };
105 105
106 } // namespace 106 } // namespace
107 107
108 TEST(SessionCommandsTest, QuitFails) { 108 TEST(SessionCommandsTest, QuitFails) {
109 Session session("id", scoped_ptr<Chrome>(new FailsToQuitChrome())); 109 Session session("id", scoped_ptr<Chrome>(new FailsToQuitChrome()));
110 base::DictionaryValue params; 110 base::DictionaryValue params;
111 scoped_ptr<base::Value> value; 111 scoped_ptr<base::Value> value;
112 ASSERT_EQ(kUnknownError, ExecuteQuit(false, &session, params, &value).code()); 112 ASSERT_EQ(kUnknownError, ExecuteQuit(false, &session, params, &value).code());
113 } 113 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/chrome_launcher_unittest.cc ('k') | chrome/test/chromedriver/util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698