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/base64.h" | 5 #include "base/base64.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 TEST(CapabilitiesParser, SimpleCaps) { | 29 TEST(CapabilitiesParser, SimpleCaps) { |
30 DictionaryValue dict; | 30 DictionaryValue dict; |
31 DictionaryValue* options = new DictionaryValue(); | 31 DictionaryValue* options = new DictionaryValue(); |
32 dict.Set("chromeOptions", options); | 32 dict.Set("chromeOptions", options); |
33 | 33 |
34 options->SetString("binary", "binary"); | 34 options->SetString("binary", "binary"); |
35 options->SetString("channel", "channel"); | 35 options->SetString("channel", "channel"); |
36 options->SetBoolean("detach", true); | 36 options->SetBoolean("detach", true); |
37 options->SetBoolean("loadAsync", true); | 37 options->SetBoolean("loadAsync", true); |
38 options->SetBoolean("nativeEvents", true); | |
39 | 38 |
40 Capabilities caps; | 39 Capabilities caps; |
41 base::ScopedTempDir temp_dir; | 40 base::ScopedTempDir temp_dir; |
42 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 41 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
43 CapabilitiesParser parser(&dict, temp_dir.path(), Logger(), &caps); | 42 CapabilitiesParser parser(&dict, temp_dir.path(), Logger(), &caps); |
44 ASSERT_FALSE(parser.Parse()); | 43 ASSERT_FALSE(parser.Parse()); |
45 EXPECT_EQ(FILE_PATH_LITERAL("binary"), caps.command.GetProgram().value()); | 44 EXPECT_EQ(FILE_PATH_LITERAL("binary"), caps.command.GetProgram().value()); |
46 EXPECT_STREQ("channel", caps.channel.c_str()); | 45 EXPECT_STREQ("channel", caps.channel.c_str()); |
47 EXPECT_TRUE(caps.detach); | 46 EXPECT_TRUE(caps.detach); |
48 EXPECT_TRUE(caps.load_async); | 47 EXPECT_TRUE(caps.load_async); |
49 EXPECT_TRUE(caps.native_events); | |
50 } | 48 } |
51 | 49 |
52 TEST(CapabilitiesParser, Args) { | 50 TEST(CapabilitiesParser, Args) { |
53 DictionaryValue dict; | 51 DictionaryValue dict; |
54 DictionaryValue* options = new DictionaryValue(); | 52 DictionaryValue* options = new DictionaryValue(); |
55 dict.Set("chromeOptions", options); | 53 dict.Set("chromeOptions", options); |
56 | 54 |
57 ListValue* args = new ListValue(); | 55 ListValue* args = new ListValue(); |
58 args->Append(Value::CreateStringValue("arg1")); | 56 args->Append(Value::CreateStringValue("arg1")); |
59 args->Append(Value::CreateStringValue("arg2=val")); | 57 args->Append(Value::CreateStringValue("arg2=val")); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 ASSERT_FALSE(parser.Parse()); | 290 ASSERT_FALSE(parser.Parse()); |
293 | 291 |
294 const std::set<std::string>& rm_set = caps.exclude_switches; | 292 const std::set<std::string>& rm_set = caps.exclude_switches; |
295 EXPECT_EQ(static_cast<size_t>(3), rm_set.size()); | 293 EXPECT_EQ(static_cast<size_t>(3), rm_set.size()); |
296 ASSERT_TRUE(rm_set.find(switches::kNoFirstRun) != rm_set.end()); | 294 ASSERT_TRUE(rm_set.find(switches::kNoFirstRun) != rm_set.end()); |
297 ASSERT_TRUE(rm_set.find(switches::kDisableSync) != rm_set.end()); | 295 ASSERT_TRUE(rm_set.find(switches::kDisableSync) != rm_set.end()); |
298 ASSERT_TRUE(rm_set.find(switches::kDisableTranslate) != rm_set.end()); | 296 ASSERT_TRUE(rm_set.find(switches::kDisableTranslate) != rm_set.end()); |
299 } | 297 } |
300 | 298 |
301 } // namespace webdriver | 299 } // namespace webdriver |
OLD | NEW |