| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <gflags/gflags.h> | 5 #include <gflags/gflags.h> |
| 6 #include <map> | 6 #include <map> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <time.h> | 10 #include <time.h> |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 test_map["pixmap_to_texture"] = GetPixmapToTextureTestEGL(); | 208 test_map["pixmap_to_texture"] = GetPixmapToTextureTestEGL(); |
| 209 #else | 209 #else |
| 210 test_map["pixmap_to_texture"] = GetPixmapToTextureTest(); | 210 test_map["pixmap_to_texture"] = GetPixmapToTextureTest(); |
| 211 #endif | 211 #endif |
| 212 | 212 |
| 213 SwapInterval(sleep_duration ? 0 : 1); | 213 SwapInterval(sleep_duration ? 0 : 1); |
| 214 | 214 |
| 215 std::vector<std::string> tests; | 215 std::vector<std::string> tests; |
| 216 SplitString(FLAGS_tests, ',', &tests); | 216 SplitString(FLAGS_tests, ',', &tests); |
| 217 | 217 |
| 218 int return_code = 0; |
| 218 for (std::vector<std::string>::iterator it = tests.begin(); | 219 for (std::vector<std::string>::iterator it = tests.begin(); |
| 219 it != tests.end(); | 220 it != tests.end(); |
| 220 it++) | 221 it++) |
| 221 { | 222 { |
| 222 Test* t = test_map[*it]; | 223 Test* t = test_map[*it]; |
| 223 if (!t || !t->Start()) | 224 if (!t || !t->Start()) { |
| 225 return_code = 1; |
| 224 continue; | 226 continue; |
| 227 } |
| 225 | 228 |
| 226 Bool got_event = False; | 229 Bool got_event = False; |
| 227 uint64_t wait_until = GetUTime() + 1000000ULL * FLAGS_seconds_to_run; | 230 uint64_t wait_until = GetUTime() + 1000000ULL * FLAGS_seconds_to_run; |
| 228 for (int x = 0; | 231 for (int x = 0; |
| 229 !got_event && GetUTime() < wait_until; | 232 !got_event && GetUTime() < wait_until; |
| 230 x = (x + 4) % (2 * g_width)) | 233 x = (x + 4) % (2 * g_width)) |
| 231 { | 234 { |
| 232 const int shift = x < g_width ? x : 2 * g_width - x; | 235 const int shift = x < g_width ? x : 2 * g_width - x; |
| 233 | 236 |
| 234 t->Loop(shift); | 237 t->Loop(shift); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 246 KeyPressMask, &event); | 249 KeyPressMask, &event); |
| 247 } | 250 } |
| 248 | 251 |
| 249 t->Stop(); | 252 t->Stop(); |
| 250 } | 253 } |
| 251 | 254 |
| 252 // TODO: cleaner teardown. | 255 // TODO: cleaner teardown. |
| 253 | 256 |
| 254 glDeleteTextures(1, &texture); | 257 glDeleteTextures(1, &texture); |
| 255 DestroyContext(); | 258 DestroyContext(); |
| 256 return 0; | 259 return return_code; |
| 257 } | 260 } |
| OLD | NEW |