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

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

Issue 635623003: Cleanup: Better constify some strings in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix mac Created 6 years, 2 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
« no previous file with comments | « chrome/test/chromedriver/session_commands.cc ('k') | chrome/test/chromedriver/util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/memory/linked_ptr.h" 11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/test/chromedriver/chrome/status.h" 17 #include "chrome/test/chromedriver/chrome/status.h"
18 #include "chrome/test/chromedriver/chrome/stub_chrome.h" 18 #include "chrome/test/chromedriver/chrome/stub_chrome.h"
19 #include "chrome/test/chromedriver/commands.h" 19 #include "chrome/test/chromedriver/commands.h"
20 #include "chrome/test/chromedriver/session.h" 20 #include "chrome/test/chromedriver/session.h"
21 #include "chrome/test/chromedriver/session_commands.h" 21 #include "chrome/test/chromedriver/session_commands.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 23
24 TEST(SessionCommandTest, FileUpload) { 24 TEST(SessionCommandTest, FileUpload) {
25 Session session("id"); 25 Session session("id");
26 base::DictionaryValue params; 26 base::DictionaryValue params;
27 scoped_ptr<base::Value> value; 27 scoped_ptr<base::Value> value;
28 // Zip file entry that contains a single file with contents 'COW\n', base64 28 // Zip file entry that contains a single file with contents 'COW\n', base64
29 // encoded following RFC 1521. 29 // encoded following RFC 1521.
30 const char* kBase64ZipEntry = 30 const char kBase64ZipEntry[] =
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;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 status_code = ExecuteSetAutoReporting(&session, params, &value).code(); 146 status_code = ExecuteSetAutoReporting(&session, params, &value).code();
147 ASSERT_EQ(kOk, status_code); 147 ASSERT_EQ(kOk, status_code);
148 ASSERT_FALSE(session.auto_reporting_enabled); 148 ASSERT_FALSE(session.auto_reporting_enabled);
149 149
150 // check that autoreporting was disabled successfully 150 // check that autoreporting was disabled successfully
151 status_code = ExecuteIsAutoReporting(&session, params, &value).code(); 151 status_code = ExecuteIsAutoReporting(&session, params, &value).code();
152 ASSERT_EQ(kOk, status_code); 152 ASSERT_EQ(kOk, status_code);
153 ASSERT_TRUE(value.get()->GetAsBoolean(&enabled)); 153 ASSERT_TRUE(value.get()->GetAsBoolean(&enabled));
154 ASSERT_FALSE(enabled); 154 ASSERT_FALSE(enabled);
155 } 155 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/session_commands.cc ('k') | chrome/test/chromedriver/util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698