| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/shell_integration_linux.h" | 5 #include "chrome/browser/shell_integration_linux.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cstdlib> | 10 #include <cstdlib> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // Provides mock environment variables values based on a stored map. | 39 // Provides mock environment variables values based on a stored map. |
| 40 class MockEnvironment : public base::Environment { | 40 class MockEnvironment : public base::Environment { |
| 41 public: | 41 public: |
| 42 MockEnvironment() {} | 42 MockEnvironment() {} |
| 43 | 43 |
| 44 void Set(base::StringPiece name, const std::string& value) { | 44 void Set(base::StringPiece name, const std::string& value) { |
| 45 variables_[name.as_string()] = value; | 45 variables_[name.as_string()] = value; |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool GetVar(base::StringPiece variable_name, std::string* result) override { | 48 bool GetVar(base::StringPiece variable_name, std::string* result) override { |
| 49 if (ContainsKey(variables_, variable_name.as_string())) { | 49 if (base::ContainsKey(variables_, variable_name.as_string())) { |
| 50 *result = variables_[variable_name.as_string()]; | 50 *result = variables_[variable_name.as_string()]; |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| 53 | 53 |
| 54 return false; | 54 return false; |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool SetVar(base::StringPiece variable_name, | 57 bool SetVar(base::StringPiece variable_name, |
| 58 const std::string& new_value) override { | 58 const std::string& new_value) override { |
| 59 ADD_FAILURE(); | 59 ADD_FAILURE(); |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 EXPECT_EQ("baR", internal::GetProgramClassClass(command_line, "foo.desktop")); | 664 EXPECT_EQ("baR", internal::GetProgramClassClass(command_line, "foo.desktop")); |
| 665 | 665 |
| 666 command_line = base::CommandLine(base::FilePath()); | 666 command_line = base::CommandLine(base::FilePath()); |
| 667 command_line.AppendSwitchASCII("user-data-dir", "/tmp/baz"); | 667 command_line.AppendSwitchASCII("user-data-dir", "/tmp/baz"); |
| 668 EXPECT_EQ("foo (/tmp/baz)", | 668 EXPECT_EQ("foo (/tmp/baz)", |
| 669 internal::GetProgramClassName(command_line, "foo.desktop")); | 669 internal::GetProgramClassName(command_line, "foo.desktop")); |
| 670 EXPECT_EQ("Foo", internal::GetProgramClassClass(command_line, "foo.desktop")); | 670 EXPECT_EQ("Foo", internal::GetProgramClassClass(command_line, "foo.desktop")); |
| 671 } | 671 } |
| 672 | 672 |
| 673 } // namespace shell_integration_linux | 673 } // namespace shell_integration_linux |
| OLD | NEW |