| 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 "chrome/common/chrome_content_client.h" | 5 #include "chrome/common/chrome_content_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/string_split.h" | 8 #include "base/string_split.h" |
| 9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 } // namespace | 59 } // namespace |
| 60 | 60 |
| 61 | 61 |
| 62 namespace chrome_common { | 62 namespace chrome_common { |
| 63 | 63 |
| 64 TEST(ChromeContentClientTest, Basic) { | 64 TEST(ChromeContentClientTest, Basic) { |
| 65 #if !defined(OS_ANDROID) | 65 #if !defined(OS_ANDROID) |
| 66 CheckUserAgentStringOrdering(false); | 66 CheckUserAgentStringOrdering(false); |
| 67 #else | 67 #else |
| 68 // Do it once for mobile devices and once for other devices. | |
| 69 const char* kArguments[] = {"chrome"}; | 68 const char* kArguments[] = {"chrome"}; |
| 69 CommandLine::Reset(); |
| 70 CommandLine::Init(1, kArguments); |
| 70 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 71 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 71 command_line->Reset(); | 72 |
| 72 command_line->Init(1, kArguments); | 73 // Do it for regular devices. |
| 73 ASSERT_FALSE(command_line->HasSwitch(switches::kUseMobileUserAgent)); | 74 ASSERT_FALSE(command_line->HasSwitch(switches::kUseMobileUserAgent)); |
| 74 CheckUserAgentStringOrdering(false); | 75 CheckUserAgentStringOrdering(false); |
| 75 | 76 |
| 77 // Do it for mobile devices. |
| 76 command_line->AppendSwitch(switches::kUseMobileUserAgent); | 78 command_line->AppendSwitch(switches::kUseMobileUserAgent); |
| 77 ASSERT_TRUE(command_line->HasSwitch(switches::kUseMobileUserAgent)); | 79 ASSERT_TRUE(command_line->HasSwitch(switches::kUseMobileUserAgent)); |
| 78 CheckUserAgentStringOrdering(true); | 80 CheckUserAgentStringOrdering(true); |
| 79 #endif | 81 #endif |
| 80 } | 82 } |
| 81 | 83 |
| 82 } // namespace chrome_common | 84 } // namespace chrome_common |
| OLD | NEW |