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 <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 Loading... |
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 Loading... |
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 } |
OLD | NEW |