OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 "window_manager/mock_chrome.h" | 5 #include "window_manager/mock_chrome.h" |
6 | 6 |
7 #include <cairomm/context.h> | 7 #include <cairomm/context.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 "data/chrome_page_google.png," | 28 "data/chrome_page_google.png," |
29 "data/chrome_page_gmail.png," | 29 "data/chrome_page_gmail.png," |
30 "data/chrome_page_chrome.png", | 30 "data/chrome_page_chrome.png", |
31 "Comma-separated images to use for tabs"); | 31 "Comma-separated images to use for tabs"); |
32 DEFINE_string(tab_titles, "Google,Gmail,Google Chrome", | 32 DEFINE_string(tab_titles, "Google,Gmail,Google Chrome", |
33 "Comma-separated titles to use for tabs"); | 33 "Comma-separated titles to use for tabs"); |
34 DEFINE_int32(tabs_per_window, 3, "Number of tabs to add to each window"); | 34 DEFINE_int32(tabs_per_window, 3, "Number of tabs to add to each window"); |
35 DEFINE_int32(window_height, 640, "Window height"); | 35 DEFINE_int32(window_height, 640, "Window height"); |
36 DEFINE_int32(window_width, 920, "Window width"); | 36 DEFINE_int32(window_width, 920, "Window width"); |
37 | 37 |
38 using chromeos::AtomCache; | 38 using chromeos::SplitStringUsing; |
39 using chromeos::GetCurrentTime; | 39 |
40 using chromeos::RealXConnection; | 40 using window_manager::AtomCache; |
41 using chromeos::WmIpc; | 41 using window_manager::GetCurrentTime; |
| 42 using window_manager::RealXConnection; |
| 43 using window_manager::WmIpc; |
42 | 44 |
43 namespace mock_chrome { | 45 namespace mock_chrome { |
44 | 46 |
45 const int TabSummary::kTabImageWidth = 160; | 47 const int TabSummary::kTabImageWidth = 160; |
46 const int TabSummary::kTabImageHeight = 120; | 48 const int TabSummary::kTabImageHeight = 120; |
47 const int TabSummary::kPadding = 20; | 49 const int TabSummary::kPadding = 20; |
48 const int TabSummary::kInsertCursorWidth = 2; | 50 const int TabSummary::kInsertCursorWidth = 2; |
49 | 51 |
50 const int FloatingTab::kWidth = 240; | 52 const int FloatingTab::kWidth = 240; |
51 const int FloatingTab::kHeight = 180; | 53 const int FloatingTab::kHeight = 180; |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 int main(int argc, char** argv) { | 942 int main(int argc, char** argv) { |
941 Gtk::Main kit(argc, argv); | 943 Gtk::Main kit(argc, argv); |
942 google::ParseCommandLineFlags(&argc, &argv, true); | 944 google::ParseCommandLineFlags(&argc, &argv, true); |
943 CommandLine::Init(argc, argv); | 945 CommandLine::Init(argc, argv); |
944 logging::InitLogging(NULL, | 946 logging::InitLogging(NULL, |
945 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 947 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
946 logging::DONT_LOCK_LOG_FILE, | 948 logging::DONT_LOCK_LOG_FILE, |
947 logging::APPEND_TO_OLD_LOG_FILE); | 949 logging::APPEND_TO_OLD_LOG_FILE); |
948 | 950 |
949 std::vector<std::string> filenames; | 951 std::vector<std::string> filenames; |
950 chromeos::SplitStringUsing(FLAGS_tab_images, ",", &filenames); | 952 SplitStringUsing(FLAGS_tab_images, ",", &filenames); |
951 CHECK(!filenames.empty()) | 953 CHECK(!filenames.empty()) |
952 << "At least one image must be supplied using --tab_images"; | 954 << "At least one image must be supplied using --tab_images"; |
953 | 955 |
954 std::vector<std::string> titles; | 956 std::vector<std::string> titles; |
955 chromeos::SplitStringUsing(FLAGS_tab_titles, ",", &titles); | 957 SplitStringUsing(FLAGS_tab_titles, ",", &titles); |
956 CHECK_EQ(filenames.size(), titles.size()) | 958 CHECK_EQ(filenames.size(), titles.size()) |
957 << "Must specify same number of tab images and titles"; | 959 << "Must specify same number of tab images and titles"; |
958 | 960 |
959 mock_chrome::MockChrome mock_chrome; | 961 mock_chrome::MockChrome mock_chrome; |
960 for (int i = 0; i < FLAGS_num_windows; ++i) { | 962 for (int i = 0; i < FLAGS_num_windows; ++i) { |
961 mock_chrome::ChromeWindow* win = | 963 mock_chrome::ChromeWindow* win = |
962 mock_chrome.CreateWindow(FLAGS_window_width, FLAGS_window_height); | 964 mock_chrome.CreateWindow(FLAGS_window_width, FLAGS_window_height); |
963 for (int j = 0; j < FLAGS_tabs_per_window; ++j) { | 965 for (int j = 0; j < FLAGS_tabs_per_window; ++j) { |
964 win->InsertTab(new mock_chrome::Tab(filenames[j % filenames.size()], | 966 win->InsertTab(new mock_chrome::Tab(filenames[j % filenames.size()], |
965 titles[j % titles.size()]), | 967 titles[j % titles.size()]), |
966 win->num_tabs()); | 968 win->num_tabs()); |
967 } | 969 } |
968 win->ActivateTab(i % win->num_tabs()); | 970 win->ActivateTab(i % win->num_tabs()); |
969 } | 971 } |
970 | 972 |
971 filenames.clear(); | 973 filenames.clear(); |
972 chromeos::SplitStringUsing(FLAGS_panel_images, ",", &filenames); | 974 SplitStringUsing(FLAGS_panel_images, ",", &filenames); |
973 CHECK(!filenames.empty()) | 975 CHECK(!filenames.empty()) |
974 << "At least one image must be supplied using --panel_images"; | 976 << "At least one image must be supplied using --panel_images"; |
975 | 977 |
976 titles.clear(); | 978 titles.clear(); |
977 chromeos::SplitStringUsing(FLAGS_panel_titles, ",", &titles); | 979 SplitStringUsing(FLAGS_panel_titles, ",", &titles); |
978 CHECK_EQ(filenames.size(), titles.size()) | 980 CHECK_EQ(filenames.size(), titles.size()) |
979 << "Must specify same number of panel images and titles"; | 981 << "Must specify same number of panel images and titles"; |
980 | 982 |
981 for (int i = 0; i < FLAGS_num_panels; ++i) { | 983 for (int i = 0; i < FLAGS_num_panels; ++i) { |
982 mock_chrome.CreatePanel(filenames[i % filenames.size()], | 984 mock_chrome.CreatePanel(filenames[i % filenames.size()], |
983 titles[i % titles.size()]); | 985 titles[i % titles.size()]); |
984 } | 986 } |
985 | 987 |
986 Gtk::Main::run(); | 988 Gtk::Main::run(); |
987 return 0; | 989 return 0; |
988 } | 990 } |
OLD | NEW |